moves std::shared_ptrs to a new implementation
Advantages:
- you can dereference a weak_ptr directly. This will obviously segfault on a nullptr deref if it's expired.
- this is useful to avoid the .lock() hell where we are 100% sure the pointer _should_ be valid. (and if it isn't, it should throw.)
- weak_ptrs are still valid while the SP is being destroyed.
- reasoning: while an object (e.g. CWindow) is being destroyed, its `weak_ptr self` should be accessible (the sp is still alive, and so is CWindow), but it's not because by stl it's already expired (to prevent resurrection)
- this impl solves it differently. w_p is expired, but can still be dereferenced and used. Creating `s_p`s is not possible anymore, though.
- this is useful in destructors and callbacks.
* protocols: add hyprland_focus_grab_v1 implementation
* protocols/focus_grab: fix keyboard focus staying on unlisted windows
When creating a focus grab with layershell surfaces, the last active
toplevel kept keyboard focus.
* protocols/focus_grab: fix formatting
* protocols/focus_grab: try to pick surface for keyboard focus
* focus_grab: update keyboard focus to match spec
* Revert "protocols/focus_grab: try to pick surface for keyboard focus"
This reverts commit 090358d0d1.
* protocols/focus_grab: fix issues and match new spec
* kde-server-decoration: move to new impl
* protocols/focus_grab: review fixup
* Update hyprland-protocols
---------
Co-authored-by: Vaxry <vaxry@vaxry.net>
Implements an intermediary HID class for mice, keyboards and touch devices, removing the old structs from WLClasses.hpp
Yes, virtual ones are duplicated a bit, but will likely be de-duped once wlr_input_device is not used anymore.
* inputmgr: dont double free on hotplug
since we are also unrefing the state on hotplugging the keyboard set the
state to nullptr so the destructor if case actually catches its been
already freed.
* keybindgmgr: dont double free on layout switching
d5bf153 added keymap unref at the end of updateXKBTranslationState to
not leak it when exiting, only it causes updateXKBTranslationState to
double free when changing layouts. since its already freed. remove the
unneeded extra xkb_keymap_unref.
* notifications: free cairo images on destruction
asan reports a leak on exit if we dont free the image we created in the
draw function. add a destructor and free images on exit.
* compositor: destroy wlroots types on exit
there are a few types not being destroyed on exit and causing a leak on
exit in wlroots reported by asan, add those.
* cursormgr: ensure we destroy cursor mgr on exit
add a destructor and call wlr_xcursor_manager_destroy on the manager on
destruction, leak reported by asan.
* keybindmgr: free state and keymap
add missing keymap_unref on creation, and add a destructor and free the
state on exit. leak reported by asan.
* skeyboard: add destructor and free state
free the state on destruction of keyboard, reported as leak by asan
Moves the directory containing sockets and logs.
Also restructures lockfiles a bit.
For consumers, check if `$XDG_RUNTIME_DIR/hypr` exists. If so, use it. If not, use the old `/tmp/hypr`.
* Reverse Window Positioning.
* Cleanup old comments and logs.
* Finish Splitting Left and Right offset.
* Forgot to add Auto Left to ConfigManager
* Fix problems with auto_left.
* Nearly finish up and down.
* Finish draft of all four dirs. Testing now.
* Change Y value in moveTo for up and down.
* Format, comment, and cleanup.
* Address Vaxry's feedback.
* Add check to see if auto position is first rule.
* Run clang-format.
By default enabled, will track the initial opened workspace of a window spawned for 2 minutes or until it's moved to a different workspace.
For example: you run a launcher and open an app on workspace 1, but quickly switch to workspace 2. The app will now open on workspace 1 regardless of your switch.
With the `silent` suffix, the focus remains on the current position in
the layout or the current monitor, instead of following the moved
window. When combined with `movewindow mon:X`, this this allows you to
get the same behavior as xmonad's `windowToScreen` command.
* remove unnecessary include
* cmake: use pkg_get_variable
We can find wayland-scanner executable and wayland-protocols dir by
taking advantage of this function, so no need to use find_program or
manually call pkgconf executable.
* cmake: remove explicit rdynamic option
CMAKE_ENABLE_EXPORTS=ON already implies rdynamic so it's redundant to
set the latter explicitly.
Also, CMAKE_ENABLE_EXPORTS is superseded by
CMAKE_EXECUTABLE_ENABLE_EXPORTS in cmake 3.27.
* cmake: make xcb-errors dep optional
xcb-errors is being used in wlroots, where it's optional. So make it
optional in hyprland as well
* workspace: update windows when group updates
* workspace: update windows when floating toggle
* workspace: update windows when stop dragging window by mouse
`lastBoxLocal`'s size should be the actual popup's size instead of the cursor
rectangle's size. Also, the rectangle position is now relative to the popup.
(Actually fixes#5255 imho.)
One thing #3922 missed was handling focus held by buttons. Let's hope I get
it right this time.
* workspacerules: add back on-created-empty functionality
* clang format
* workspacerules: spawn on-created-empty window while initializing CWorkspace
* clang format
* configManager: fix typo
---------
Co-authored-by: Your Name <you@example.com>
* dont render when workspace offset
* add guard
* can remove useless code now if workspace offset is not taken into account
* clang-format
* when special workspace is moved, set anim to move
* add offset back
* make it a configurable option because some folks apparently can't align their monitors correctly and may not want this feature😔
* remove config option
* Add options to set tablet's active area
* Set tablet's active area in `setTabletConfigs`
* Fix formatting for new variables in ConfigManager
* Report tablet's physical size with hyprctl
* Workspace Swipe: Refactor update and end functions
* Touch: Implement workspace swipe better
ignoring additional fingers and new touches
allow gaps-right and gaps-left to be different
* fix: refocus after destroy focused surface
* refactor: minor refactor on refocus loop condition
* refactor: minor refactor on condition
* style: format code
* lock: use uint64_t for iMonitorID
* lock: move activateLock to onNewSessionLock
* lock: add red screen fade
* lock: damage when fading the red screen and delay for screencopy
* lock: remove redundant scheduleFrameForMonitor
* Allow for input:scroll_factor configuration
This PR will allow for a `scroll_factor` configuration within an `input`
block. The purpose is to control the scroll factor of external mice.
Closes#2574.
* clang-format
* allow fullscreen/maximize in special workspace
* remove duplicate code
* hide top layer
* fix special fullscreen deco
* edit
* fix fade top layer when toggle special
* remove double render
* Add the 'catchall' keyword that matches all keys
This keyword can be used to define arbitrary keybinds. The only special
behavior that it exhibits is that it matches every key, including
modifier keys. Any flags still apply normally.
This commit also fixes an issue that keys bound via the code:KEYCODE
format were not unbound correctly.
* Disallow catchall keybinds outside of submaps
A catchall keybind outside a submap would prevent essentially all key
events from going through to applications and would be difficult to
remove again.
* rewritten constraints
* send pointer enter on activate if not pointer focus
* minor cleanup
* simulate movement on commit
* don't ignore oneshot prop
* various fixes
* dont send motion on confined
* update pos hint on region change
* animation: Refactor AnimatedVariable
This commit decomposes the AnimatedVariable class into a base class
with the common attribute to all variable types and a templated derived
type containing strongly typed info on the type being animated.
Access to the typed version is perfomed using the visitor pattern. A
utility is provided to build a visitor on the fly using lambdas.
Adding a new type to be animated should just be a matter of adding the
typed in the list defined by the ANIMABLE_TYPES macro
The size of the commit is justified by the API change in the
AnimatedVariable class. No more vec(), fl() or col() method but a unified
value() method.
* animation: Remove visitor pattern
* animation: Fix coding style
* animation: Fix coding style
This commit adds the new configuration option 'resolve_binds_by_sym'
which can be set globally or per-device. It is off by default, which
preserves the current behavior.
This setting only affects the behavior of keybinds that are defined via
key symbols, not those defined via keycode. Binds defined by symbols
currently activate if the keycode pressed would generate the specified
symbol on the first layout specified in the input section.
If enabled, keys pressed on the relevant device will instead match
keybinds by the symbols they produce with their current layout.
Closes#1881.
* Map bound touch devices and tablets to an output
* Add "[[Auto]]" default option for auto detecting outputs for touch inputs
* Bind new monitors to configured touch and tablet devices
* Use Monitor::matchesStaticSelector in CConfigManager::getMonitorRuleFor
* Use Monitor::matchesStaticSelector in CCompositor::getMonitorFromString
* fix: movewindoworgroup when no window or group is in desired direction, e.g. move window onto empty workspace on next monitor
* fix: movewindoworgroup when no window or group is in desired direction, e.g. move window onto empty workspace on next monitor
* reset flake.nix
* add: changes mentioned in review of #4486
* feat: implement xmonad/qtile-style workspace switching
Implements the focusWorkspaceOnCurrentMonitor dispatcher and function,
which implements XMonad/Qtile-style workspace switching.
When called, focusWorkspaceOnCurrentMonitor will:
1. Send the requested workspace to the current monitor,
2. If the workspace was previously active on a different monitor,
replace it with the workspace that was previously active on the
current monitor,
3. Focus the workspace on the current monitor.
* fix: address PR comments
When workspace_swipe_use_r is enabled, swiping from WS 1 to a non-empty WS 2 would
hide WS 1 (Similar effect to issue #4076). This is caused by a faulty
check which doesn't consider, that workspaceIDLeft could be the current
workspace.
This bug is only a problem for r, because m wraps around on WS 1 m-1, whereas r stays on WS 1.