Commit graph

276 commits

Author SHA1 Message Date
MariuszTrybus
0b924f541c
constraints: Lock surface region when region is empty (#6627)
* Pointer constraints: Lock surface region when region is empty

* Format code
2024-06-22 17:05:05 +02:00
Tom Englund
fa022901cf
surface: add virtual destructor to surfacerole to avoid undefined behaviour (#6620)
* surfacerole: add virtual destructor

all classes that will be derived from should have a virtual destructor
otherwise deleting an instance via pointer to a base class is undefined
behaviour, layershell/xdgshell hits this with std::default_delete in the
new sharedptr implentation.

* includes: fix missing includes

fix missing includes for no precompiled headers builds, and remove a
redefiniton of a macro already defined in macros.hpp
2024-06-22 00:40:45 +02:00
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
Tom Englund
28ce0e0f80
misc: a few compiler level performance optimisations (#6559)
* window: use const references instead of copies

use const references instead of wasteful copies and make the = operator
check for self assignment and return early. also use const in all the
other operators.

* listener: pass std::function as const reference

instead of copies pass the std::functions as const references.

* config: dont unnecessarily convert to c_str

getHyprlangConfigValuePtr wants an std::string and we already have an
std::string, dont convert it to a c_str only for it to be converted back
to an std::string.

* buffer: pass attributes as const reference

pass attributes as const reference instead of copies.
2024-06-17 17:37:36 +02:00
a9c7a0830f data-device: minor fixes
send leave after drop, improve checks in completeDrag
2024-06-17 16:14:45 +02:00
785d062887 seat: track pressed pointer buttons
releases them on leave, unless there is a dnd going on
2024-06-17 16:07:32 +02:00
1360677478 subcompositor/renderer: fixup handling of subsurfaces below the main one
some apps (notably vlc 4) place a subsurface below the main surface (which is kinda cursed) but we have to accomodate for that
2024-06-17 12:42:39 +02:00
d5ef10abf4 data-device: properly abort drag on missing device
sometimes there is no focused device (e.g. when dnd'ing on nothing or xwayland) in which case abort would fail to send cancelled to the source.

ref #6543
2024-06-16 20:56:50 +02:00
172ee1cada data-device: minor fixups
ref #6543

firefox needs a re-enter after a dnd

don't destroy dnd on an offer destroy, it's not valid
2024-06-16 20:36:55 +02:00
Dashie
738530e62e
xdg-shell: Continue transform of popup until size fits (#6521) 2024-06-16 20:01:08 +02:00
2031af82fa wl_data_device: send drop_performed in completeDrag
ref #6509
2024-06-16 17:41:16 +02:00
d0a6fa7aa6 wl_seat: accomodate for apps late-binding seat resources
Sends enter events when an app binds wl_keyboard or wl_pointer later than it should. Fixes some buggy apps.

Fixes #6131
2024-06-16 17:04:10 +02:00
648ac8a00b xdg-shell: properly check for resource version for TILED and SUSPENDED states
fixes #6535
2024-06-16 16:46:22 +02:00
1b5444494d seat/dnd: unfocus pointer from surfaces on dnd start
GTK is speshyal and requires this for functioning properly. Ugh.

It's technically not required by spec, f you gtk.

Ref #6509
2024-06-16 16:23:41 +02:00
908bec1564 wl_seat: send repeat data from current keyboard on bind
ref #6515
2024-06-15 21:24:34 +02:00
77f44bfcab output: avoid crashes when binding a defunct wl_output global
ref #6508
2024-06-15 17:56:44 +02:00
6c24dc0bb1 xdg-shell: fixup xdg-positioner's pointForAnchor with non-corner points
fixes #6157
2024-06-15 17:43:39 +02:00
46ef6653be data-device: abort drag on unaccepted offers
fixes #6509
2024-06-15 17:33:21 +02:00
Yang, Ying-chao
a54f98c203
virtualkeyboard: check if VirtualKeyboard is valid before accessing client. (#6460)
This fixes crash when restarting fcitx (#6378)
2024-06-13 11:33:47 +02:00
0e18da8467 foreign-toplevel: fixup output resource finding
fixes #6457
2024-06-12 23:28:52 +02:00
c7e85e26f7 seat: fixup touch event handling
fixes #6353
2024-06-12 16:49:26 +02:00
1bae19ce85 datadevice: only send actions for ver >= 3
fixes #6444
2024-06-12 16:16:27 +02:00
Maximilian Seidler
1c388e52fb
session-lock: fix refocus after unlocking (#6423) 2024-06-11 17:18:51 +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
Jan Beich
811429bfd4
wayland: consistently check mmap error after 6967a31450 (#6402)
mmap() returns MAP_FAILED on error, not nullptr.
2024-06-10 22:31:03 +02:00
outfoxxed
89a3c90613
wlr-foreign-toplevel: fix fullscreen failing and add output support (#6360)
* wlr-foreign-toplevel: fix fullscreen failing and add output support

* fix for core protocol rewrite
2024-06-10 12:16:38 +02:00
1423707dbe output: remove wl_output globals for mirrored displays
ref #6387
2024-06-10 00:06:42 +02:00
9994b73ad0 buffer: track asynchronous buffers and don't release them until unref
synchronous buffers are read instantly and we can release them, but asynchronous ones have to be locked until they are unref'd from .current to avoid reading from a buffer after .release()
2024-06-08 17:27:56 +02:00
211353dc34 core: verify surface roles on creation of objects 2024-06-08 12:03:47 +02:00
10e02076b1 wayland: fix invalid wl_output_mode dimensions sent 2024-06-08 11:50:44 +02:00
5b6d54cae0 xdg_shell: ignore outdated ack_configure events 2024-06-08 10:57:37 +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
c31d9ef417 xdg_shell: fix nested xdg_positioner calculations
ref #6240
2024-06-07 20:24:09 +02:00
9bc00897fc xdg_shell: improve xdg_positioner slide behavior
ref #6240
2024-06-07 19:46:51 +02:00
d6337146bb xdg_shell: improve xdg_positioner resize calculations
ref #6240
2024-06-07 18:42:38 +02:00
0ac0f32671 toplevelexport: avoid locking software cursors during render
this may trigger a render begin/end and fuck up the pass

fixes #6277
2024-06-03 21:10:31 +02:00
wouter@wouterbijlsma.nl
e08195d240 Fix initial xdg-decoration toplevel decoration mode negotiation
Clients using zxdg_decoration_manager_v1::get_toplevel_decoration may
expect a receiving a zxdg_toplevel_decoration_v1::configure event to
determine the initial decoration mode, without having to go through a
zxdg_toplevel_decoration_v1::set_mode request. Hyprland was not sending
this event, resulting in unwanted decorations being drawn.

Specifically, clients using libdecor, e.g. applications using recent
GLFW, would draw GTK decorations with artefacts. This change fixes
these.
2024-06-02 23:11:55 +02:00
66acdfe2ad seat: don't send keymap on empty device 2024-06-02 18:38:36 +02:00
Vaxry
addd3e7f1a
xwayland: move to hyprland impl (#6086) 2024-05-25 22:43:51 +02:00
Alessio Molinari
eea0a6a704
internal: Replace monitor rule when disabling head. (#6136)
Closes #5978
2024-05-23 21:15:31 +02:00
62401d5b3f screencopy: use a simple renderer for frame passing 2024-05-23 00:42:16 +02:00
baef55da1d xdg-shell: fixup positioner behavior with slide and resize
if sliding and resizing, include the slide in the resize to avoid off-screen surfaces.

fixes #6150
2024-05-21 14:50:33 +02:00
2ead1fd221 virtual-keyboard: emit event before finishing keyboard
ref #6123
2024-05-17 20:07:33 +01:00
f21b6fe576 tablet: avoid null deref on an empty cursor set
fixes#6116
2024-05-17 14:51:06 +01:00
3381e2b55b datadevice: guard surface in dnd for null
fixes #6076
2024-05-15 16:26:02 +01:00
94c20a1863 primary-selection: move to hyprland impl 2024-05-14 23:13:35 +01:00
eed1361f39 wlr-data-device: move to hyprland impl 2024-05-14 23:13:35 +01:00
7eeee2c94e wl-data-device: move to hyprland impl 2024-05-14 23:13:35 +01:00
fc72df8e58 seatmgr: Add a grab class 2024-05-14 23:13:33 +01:00
0cfdde3d1a xdg-shell: move to new impl 2024-05-14 23:02:24 +01:00
121d3a7213 wl_seat: move to hyprland impl 2024-05-14 23:02:24 +01:00
Sungyoon Cho
d0a4a0e0d8
input: fix modifier and leds (#6062) 2024-05-14 16:14:43 +01:00
8562d38477 screencopy: don't spam sw cursor locks 2024-05-11 22:10:42 +01:00
a7e23d2f1e presentation-time: move to new impl 2024-05-10 02:38:54 +01:00
635a02d83f layer-shell: move to new impl
Also bumps the hw-s dep
2024-05-09 22:02:18 +01:00
d7aed240db text-input-v3: atomically enable/disable on commit 2024-05-09 14:27:48 +01:00
c98acaed62 virtual-keyboard: release keys before destroy 2024-05-09 14:07:21 +01:00
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
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
e4e84064f2 xdg-activation: keep tokens after the resource is dead
fixes #5957
2024-05-08 22:17:17 +01:00
5e7925eaeb foreign-toplevel: bypass no activate focus checks
ref #5939

those are used by focus switchers so they should bypass stuff like focus_on_activate = false
2024-05-08 01:31:22 +01:00
22a86fd7a2 session-lock: don't allow events from rejected locks
fixes #5913
2024-05-07 18:43:00 +01:00
ec092bd601 core: chase hyprwayland-scanner 2024-05-07 14:28:26 +01:00
0acad88c3c foreign-toplevel-wlr: send current class and title on map
fixes #5910
2024-05-07 11:48:08 +01:00
Agent00Ming
fa69de8ab6
pointer-constraints: Remove unnecessary cursor warps (#5895)
modified:   src/protocols/PointerConstraints.cpp

Co-authored-by: Agent_00Ming <agent00ming9366@gmail.com>
2024-05-06 17:19:26 +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
outfoxxed
aaf35b9f1f
protocols: add hyprland_focus_grab_v1 implementation (#5850)
* 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>
2024-05-05 03:14:35 +01:00
62eadad20f kde-server-decoration: move to new impl 2024-05-05 02:00:55 +01:00
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
8a2269272b output-management: move to new impl 2024-05-03 18:08:04 +01:00
2755297670 virtual-pointer: move to new impl 2024-05-03 01:52:05 +01:00
6aa2d123ae virtual-keyboard: move to new impl 2024-05-03 00:31:48 +01:00
a3ca016d42 cursor-shape: use - instead of _ in shapes
ref #5824
2024-05-02 16:21:33 +01:00
eeb78ef965 fractional: set scale before configure
fixes #5842
2024-05-02 15:13:47 +01:00
0237e39f74 protocols: utilize hyprwayland-scanner 0.3.3 functions
stuff like ::version(), ::client(), ::error() etc
2024-05-01 19:40:35 +01:00
8bcccf9f0f ime-v2: move to new impl 2024-05-01 16:41:17 +01:00
ed58cc4c31 sessionLock: remove m_pLastFocus on destroy of surface
fixes #5822
2024-05-01 02:33:36 +01:00
70ebc3add3 sessionLock: call wlr_surface_map/_unmap on the surface manually
fixes unmapped subsurfaces etc

ref #5816
2024-04-30 21:59:07 +01:00
a09103cd38 sessionLock: set locked after emitting event
ref #5816
2024-04-30 21:20:06 +01:00
dbb8b294d6 sessionLock: fix incorrect protocol error raised
fixes #5816
2024-04-30 20:02:30 +01:00
90e1411315 session-lock: move to new impl 2024-04-30 16:34:09 +01:00
5e6f7b1cdb cursor-shape: allow duplicate devices per pointer resource
fixes #5798
2024-04-30 00:05:29 +01:00
f2b03e9679 ext-idle-notify: move to new impl 2024-04-29 17:50:07 +01:00
86133983a9 xdg-activation: move to new impl 2024-04-29 16:43:24 +01:00
33e0bb1478 wlr-output-power: move to new impl 2024-04-29 01:38:24 +01:00
2e763764bf pointer-constraints: don't warp on entering a confined pointer
ref #5774
2024-04-27 21:15:33 +01:00
e400a288d0 pointer-constraints: remove emoji to fix clang
fixes #5765
2024-04-27 13:27:24 +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
25aec3ac8c pointer-constraints: move to new impl 2024-04-27 03:17:04 +01:00
d9ec2785cb wlr-foreign-toplevel: send done after property changes
fixes #5753
2024-04-26 13:14:50 +01:00
1d40af64d3 text-input-v3: move to new impl 2024-04-25 23:27:44 +01:00
9fc3cb5629 foreign-toplevel: fix bad_any_cast in moveWindow
fixes #5740
2024-04-25 16:35:09 +01:00
01df3b73d8 shortcuts-inhibitor: move to new impl 2024-04-25 14:32:35 +01:00
ecf282d331 wlr-foreign-toplevel: move to new impl 2024-04-25 01:10:43 +01:00
3878f806ff pointer-gestures: move to new impl 2024-04-24 21:36:56 +01:00
d86eec332f idle-inhibit: don't destroy inhibitor on surface destroy
fixes #5731
2024-04-24 19:15:01 +01:00
e5fa0007a5 foreign: fix no-pch builds 2024-04-24 16:03:56 +01:00
0d1bb65c75 ext-foreign-toplevel: add implementation 2024-04-24 15:48:06 +01:00
012a2802e0 Protocols: implement protoLog 2024-04-22 18:44:25 +01:00
741c75d907 gamma-control: move to new impl 2024-04-22 18:21:03 +01:00