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
* added option to choose the default monitor that the cursor will appear in upon startup
* fix: don't set cursor to default monitor after startup
* refactor to checkDefaultCursorWarp also fix focus
* CrashReporter: skip Linux field on BSDs after 90a53aed59
In file included from src/debug/CrashReporter.cpp:10:
src/debug/signal-safe.hpp:113:17: error: no member named 'sa_restorer' in 'sigaction'
act.sa_restorer = NULL;
~~~ ^
* CrashReporter: ensure *argv[] is NULL-terminated after 90a53aed59
execv() may fail with EFAULT otherwise.
* hyprpm: add missing header after 335015fe2d
hyprpm/src/core/PluginManager.cpp:165:43: error: use of undeclared identifier 'getuid'
165 | const std::string USERNAME = getpwuid(getuid())->pw_name;
| ^
hyprpm/src/core/PluginManager.cpp:431:45: error: use of undeclared identifier 'getuid'
431 | const std::string USERNAME = getpwuid(getuid())->pw_name;
| ^
hyprpm/src/core/PluginManager.cpp:558:43: error: use of undeclared identifier 'getuid'
558 | const std::string USERNAME = getpwuid(getuid())->pw_name;
| ^
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`.
`CrashReporter::createAndSaveCrash()` is not async-signal-safe,
resulting in random deadlocks/double-crashes during Hyprland crashes.
This changes the function to be (mostly) async-signal-safe.
* Fix duplication of "special:" in special workspace name
modified: src/desktop/Workspace.cpp
* Track default special workspace name as special:special
This is to fix the edge cases with the previous commit without breaking
user configs.
modified: src/helpers/MiscFunctions.cpp
---------
Co-authored-by: Agent_00Ming <agent00ming9366@gmail.com>