Commit Graph

336 Commits

Author SHA1 Message Date
Vaxry 912e7ba82d render: fixup format mismatch after leaving DS
fixes #7373
2024-08-17 19:27:20 +02:00
Vaxry 92744b5b9a
IPC: Add config descriptions (#7377)
Thanks @gulafaran for the work

---

Co-authored-by: @gulafaran
2024-08-17 17:33:16 +01:00
Tom Englund 3fa6db1e7a
core: fix data race and a unsigned int rollover (#7278)
* keybindmgr: avoid uint rollover on mouse keycode

mouse keycode is 0, and the switch case checks for 0 - 8 and rolls over,
just return early if keycode is 0.

* watchdog: avoid data races in watchdog

asan thread sanitizer reported data races in the watchdog from reading
and setting the bool variables make them std::atomic bools. also add a
atomic bool for the main thread to wait for to avoid data race when
reading the config values.

* hyprdebug: change non unicode character to name

asan created false positives and didnt like this bit, so for the sake of
easier debugging rename it to something unicode.
2024-08-12 18:19:03 +01:00
Tom Englund 4b4971c06f
internal: introduce new types to avoid unsigned int rollover and signed int overflow (#7216)
* framebuffer: avoid gluint overflow

GLuint was being initialized to -1 and rolling over to unsigned int max,
its defined behaviour but very unnecessery. add a bool and use it for
checking if allocated or not.

* opengl: avoid gluint rollover

-1 rolls over to unsigned int max, use 0xFF instead.

* core: big uint64_t to int type conversion

there were a few uint64_t to int implicit conversions overflowing int
and causing UB, make all monitor/workspaces/windows use the new
typedefs. also fix the various related 64 to 32 implicit conversions
going around found with -Wshorten-64-to-32
2024-08-08 21:01:50 +02:00
Vaxry 83a334f97d
core: Move to C++26 and use native_handle to CLOEXEC the debug fd (#7219)
Requires GCC >= 14 / Clang >= 18

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-08-08 11:54:41 +02:00
Tom Englund 5b736a4a66
debug: dont manually unlock the lock_guard (#7210)
when lock_guard goes out of scope it RAII itself and calls unlock.
causes crashes on freebsd/libc++ and double unlocking a mutex is UB.
2024-08-07 13:22:01 +02:00
Tom Englund 5489682799
internal: some minor fd/socket cleanups and make logging thread safe (#7123)
* bezier: dont loop on float values

Using a floating-point loop variable with a fixed increment can cause precision
errors over time due to the nature of floating-point arithmetic.
and cause undesired effects.

ex
iteration 1 = 0.10000000149011611938
iteration 2 = 0.20000000298023223877

eventually..

iteration 8 = 0.80000001192092895508
iteration 9 = 0.89999997615814208984

* hyprctl: close sockets on destruction

store socketpath and close the fd and unlink the socket path on exit.

* eventloopmgr: close the timerfd

close the timerfd on exit.

* debug: make logging thread safe

instead of opening and closing the logfile on each write open it on init
and close it on compositor exit. also add a mutex so accidently using
logging from a thread like the watchdog or similiar doesnt cause issues.

* xwl: clean up fd logic

check if the fd is actually opened before closing, and close the
pipesource FD on exit.
2024-07-31 21:00:14 +02:00
MightyPlaza e989a0bcff
internal: refactor fullscreen states (#7104)
* refactor fullscreen
modified:   src/Compositor.cpp
modified:   src/Compositor.hpp
modified:   src/config/ConfigManager.cpp
modified:   src/config/ConfigManager.hpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/LayerSurface.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/desktop/Workspace.cpp
modified:   src/desktop/Workspace.hpp
modified:   src/events/Windows.cpp
modified:   src/helpers/Monitor.cpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/DwindleLayout.hpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/layout/IHyprLayout.hpp
modified:   src/layout/MasterLayout.cpp
modified:   src/layout/MasterLayout.hpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/KeybindManager.hpp
modified:   src/managers/input/IdleInhibitor.cpp
modified:   src/managers/input/InputManager.cpp
modified:   src/managers/input/Swipe.cpp
modified:   src/protocols/ForeignToplevelWlr.cpp
modified:   src/render/Renderer.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp

* clean up
modified:   src/config/ConfigManager.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.hpp
modified:   src/desktop/Workspace.cpp
modified:   src/events/Windows.cpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/input/Swipe.cpp

* fix mapWindow fullscreen
modified:   src/events/Windows.cpp

* fix typo
modified:   src/desktop/Workspace.cpp

* add fullscreenstate
modified:   src/config/ConfigManager.cpp
modified:   src/events/Windows.cpp

* change syncFullscreen to lower
modified:   src/config/ConfigManager.hpp

* initialize fs state
modified:   src/desktop/Window.hpp
2024-07-31 19:55:52 +02:00
Ikalco 3b9b5346b8
protocols: Move globalshortcuts impl (#7102)
* move global shortcuts to hyprwayland-scanner

* remove wayland-scanner from deps

* fix the thing
2024-07-30 23:33:56 +02:00
MightyPlaza 735e3c6c56
crashreporter: add date and flags to crash report (#7028)
modified:   src/debug/CrashReporter.cpp
2024-07-24 19:05:54 +02:00
Vaxry 016da234d0
Core: Move to aquamarine (#6608)
Moves Hyprland from wlroots to aquamarine for the backend.

---------

Signed-off-by: Vaxry <vaxry@vaxry.net>
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
Co-authored-by: vaxerski <vaxerski@users.noreply.github.com>
Co-authored-by: UjinT34 <41110182+UjinT34@users.noreply.github.com>
Co-authored-by: Tom Englund <tomenglund26@gmail.com>
Co-authored-by: Ikalco <73481042+ikalco@users.noreply.github.com>
Co-authored-by: diniamo <diniamo53@gmail.com>
2024-07-21 13:09:54 +02:00
MightyPlaza a443902abc
core: Improve handling of window properties (#6776)
* add mWindowProperties

modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp

* support int values
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp

* create m_sWindowData

modified:   src/Compositor.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/layout/MasterLayout.cpp
modified:   src/managers/AnimationManager.cpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/XWaylandManager.cpp
modified:   src/render/OpenGL.cpp
modified:   src/render/Renderer.cpp
modified:   src/render/decorations/CHyprBorderDecoration.cpp
modified:   src/render/decorations/CHyprDropShadowDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp

* simplify some properties
modified:   src/Compositor.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/managers/KeybindManager.cpp

* store multiple values in CWindowOverridableVar
modified:   src/Compositor.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/managers/AnimationManager.cpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/XWaylandManager.cpp
modified:   src/render/OpenGL.cpp
modified:   src/render/Renderer.cpp
modified:   src/render/decorations/CHyprBorderDecoration.cpp
modified:   src/render/decorations/CHyprDropShadowDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp

* clean up
modified:   src/Compositor.cpp
modified:   src/Compositor.hpp
modified:   src/config/ConfigManager.cpp
modified:   src/config/ConfigManager.hpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/layout/IHyprLayout.hpp
modified:   src/layout/MasterLayout.cpp
modified:   src/managers/KeybindManager.cpp

* use SET_PROP priority for exec rules
modified:   src/config/ConfigManager.hpp
modified:   src/desktop/Window.cpp

* add default value
modified:   src/Compositor.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/XWaylandManager.cpp
modified:   src/render/OpenGL.cpp
modified:   src/render/Renderer.cpp
modified:   src/render/decorations/CHyprBorderDecoration.cpp
modified:   src/render/decorations/CHyprDropShadowDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp

* add setprop toggle
modified:   src/config/ConfigManager.hpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp

* add setprop toggle
modified:   src/debug/HyprCtl.cpp

* make window rules functional
modified:   src/config/ConfigManager.cpp
modified:   src/desktop/Window.cpp

* minor fixes
modified:   src/Compositor.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.hpp

* properly clean layout data
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/layout/IHyprLayout.hpp
modified:   src/layout/MasterLayout.cpp

* remove newline
modified:   src/events/Windows.cpp

* fixes
modified:   src/config/ConfigManager.hpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp

* use CamelCase
modified:   src/Compositor.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/managers/AnimationManager.cpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/XWaylandManager.cpp
modified:   src/render/OpenGL.cpp
modified:   src/render/Renderer.cpp
modified:   src/render/decorations/CHyprBorderDecoration.cpp
modified:   src/render/decorations/CHyprDropShadowDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp
2024-07-11 16:10:42 +02:00
Yusuf 19fb13e6cf
internal: Add functions to hyprctl header (#6745)
* add functions to hyprctl header

* refactor monitor json into own function and add it to header

* format hyprctl.hpp

* move functions to namespace

* move helper functions to class
2024-07-07 17:52:56 +02:00
UjinT34 4d6f96f74f
debug: add Nvidia driver info (#6715)
* add nvidia driver info to systeminfo

* check file exists
2024-06-30 13:16:41 +02:00
Przegryw321 d6de248b0d
window: expose pseudotiled state and add param to dispatcher (#6583)
* Show pseudotiled state of window in hyprctl clients

* Add a window as an optional argument for the pseudo dispatcher

* change formatting
2024-06-19 23:19:18 +02:00
Vaxry fb15b7aa2a core: Move to hyprutils for Math
Moves CRegion, CBox and Vector2D over to hyprutils.

Requires hyprutils>=0.1.4
2024-06-19 16:20:15 +02:00
Vaxry b98e0876d3 hyprctl: avoid using select()
move to poll()

ref #6584
2024-06-18 21:53:01 +02:00
Alexander b2590b58c5
hyprctl: added --follow option to rolliglog (#6325)
Co-authored-by: Крылов Александр <aleksandr.krylov@hyperus.team>
2024-06-14 12:11:40 +02:00
Moritz G e1b05f8eaf
binds: Add description to key binds (#6358)
---------

Co-authored-by: Yusuf Duran <firatyusuf.d@gmail.com>
2024-06-11 19:49:54 +02:00
Vaxry 8c64a4bad7
core: move to hyprutils for utils (#6385)
* core: move to hyprutils for utils

Nix: add hyprutils dep

* Meson: add hyprutils dep

* flake.lock: update

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-06-11 17:17:45 +02:00
Vaxry 6967a31450
wayland/core: move to new impl (#6268)
* wayland/core/dmabuf: move to new impl

it's the final countdown
2024-06-08 10:07:59 +02:00
giskard c95845b148
log: log with local timezone (#6331)
* log: log with local timezone

* log: backward compatability for clang 17 with libc++
2024-06-05 18:30:46 +02:00
phonetic112 82099fd1c0
hyprctl: Allow setting name for custom/headless outputs (#6319) 2024-06-05 18:26:38 +02:00
Tom Englund eaecf7db14 core: fix a few asan reported issues and a coredump on exit (#6285)
* xwayland: add destructor to CXWM and free resource

the wl_event_resource was running upon destruction of the compositor
causing a null pointer segfault in onX11Event so ensure the event is
removed upon destruction, also free the memory allocated by
xcb_errors_context_new and finally call xcb_disconnect on the connection
to free the fd and its memory.

* hyprctl: dont leak the fd on destruction

add a destructor and properly free the fd on destruction

* eventloop: add destructor and free event source

properly free the wl_event_source upon destruction.
2024-06-03 18:46:20 +02:00
giskard ebf258788e
config: add tag dispacther and window rule (#6211) 2024-05-28 23:37:24 +02:00
Ikalco 73b133d015
hyprctl: Make setcursor better (support XCursor themes, give fail message) (#6097)
* add support for changing to X cursor themes

* use new hyprcursor abi for options

* remove unneeded struct
2024-05-28 23:35:18 +02:00
Flafy 546a486bab
hyprctl: add delimiter to hyprctl batch command (#6261)
adds a delimiter of 3 newlines to separate different command outputs
2024-05-27 22:31:35 +02:00
Gabriel Ford 553232a3e4
hyprctl: Add Config Flag to `hyprctl systeminfo` (#6160) 2024-05-25 22:46:07 +02:00
System64 255272ea18
debug: Add ARM GPU info (#6212)
Added a simple way to get basic info about the GPU on ARM based systems
2024-05-23 18:04:39 +02:00
giskard 93fea89043
renderer: render fonts with pango, add global `font_family` config option (#6138) 2024-05-22 10:09:36 +02:00
Vaxry 0cfdde3d1a xdg-shell: move to new impl 2024-05-14 23:02:24 +01:00
Paul 064bdb06f1
hyprctl: Add locked cmd to requests (#6042)
Co-authored-by: Leftas <info@leftas.dev>
2024-05-13 14:57:06 +01:00
Vaxry b0861b6709 config: move various cursor-related vars to cursor: 2024-05-09 22:25:20 +01:00
Vaxry 84e8d1810d Tablet: move to new impl
Ring and strip are not implemented. Will I implement this? God fucking knows. Nobody seems to have that anyways.
2024-05-09 13:37:39 +01:00
Vaxry ed411f53bd cursor: move to a hyprland impl
This moves wlr_cursor to a completely new impl mostly under
CPointerManager

Also adds beginSimple to OpenGL for simple render passes (e.g. cursor)
2024-05-09 13:37:39 +01:00
Ikalco 6ccc22194c
xkb: check value correctly with xkb_state_layout_index_is_active() (#5925) 2024-05-07 16:07:50 +01:00
Vaxry 1ed1ce9506
internal: new shared_ptr and weak_ptr implementation (#5883)
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.
2024-05-05 17:16:00 +01:00
Vaxry 1237732b97 input: Introduce basic hyprland HID classes
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.
2024-05-03 22:40:27 +01:00
Tom Englund d5bf15387a
internal: fix a few asan reported leaks on exit of hyprland (#5852)
* 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
2024-05-03 14:42:08 +01:00
Sungyoon Cho 801437cd54
hyprctl: add missing json string escapes (#5811) 2024-04-30 14:13:36 +01:00
Vaxry 39595aaca3 hyprctl: make commits wrapped in quotes in json 2024-04-29 16:10:26 +01:00
thejch a783cd8f40
log: Add some colors to stdout log 🔴🟡🟢🔵🟣 (#5778)
* add colored log

* add config option

* make it dynamic
2024-04-29 16:07:35 +01:00
Vaxry a5a6480917
core: Move /tmp/hypr to $XDG_RUNTIME_DIR/hypr (#5788)
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`.
2024-04-28 22:25:24 +01:00
virchau13 90a53aed59
CrashReporter: fix deadlocks by making it mostly async-signal-safe (#5771)
`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.
2024-04-27 17:38:48 +01:00
Vaxry bca7804bb6
internal: Window storage rework - part 1 (#5762)
* Window storage rework - part 1

* format

* remove useless include

* fix pch

* format

* fix crash in dwindle

* fix vram leak

* prefer .expired() for bool checks
2024-04-27 12:43:12 +01:00
Vaxry 012a2802e0 Protocols: implement protoLog 2024-04-22 18:44:25 +01:00
Vaxry 4ad739ec63 HookSystem: improve callback safety 2024-04-20 20:16:42 +01:00
Thomas Lindae 78b04c3a76
hyprctl: fix activewindow request not showing workspace name (#5623) 2024-04-17 17:44:46 +01:00
FUFSoB c99803af15
notifications: fix notifications on manually rotated monitor (#5599) 2024-04-15 21:47:39 +01:00
JManch 303b9956b2
hyprctl: print monitor disabled status (#5525) 2024-04-10 09:50:00 +01:00