Commit Graph

273 Commits

Author SHA1 Message Date
Victor Brekenfeld bd305dc7ee x11: fixup buffer age
The current code always acquires the buffer it just submitted,
which results in always rendering to a buffer with age "1", although
its contents are older, because the currently held buffer is already
submitted, just not to the swapchain. When it finally is submitted
its age is again set to 1, the other gets its correct age (but too late)
and the circle is repeated again. So lets fix that.
2021-11-29 15:55:27 +01:00
Victoria Brekenfeld a8bc2f4a50
Merge pull request #421 from Smithay/x11/swapchain
x11: use swapchain and expose age
2021-11-27 19:53:12 +01:00
Victoria Brekenfeld 8a5d030a98 x11: Use swapchain and expose age
Refactors the `X11Surface` to use the `Swapchain` internally,
which gives us a buffer age implemenation, which we can then use
to change the `Present` struct of the X11 backend to provide age
values to the user.

This change also merged the `Present` struct into the surface
because submits should now happen explicitly via a new `submit`-call
instead of being submitted implicitly on drop.
This allows the buffer to be discarded if rendering fails.
2021-11-26 22:24:12 +01:00
LoipesMas 4c514156b7
Fix ScaleDown scaling up 2021-11-26 20:57:16 +01:00
Victoria Brekenfeld 6b3a00fc06
Merge pull request #420 from i509VCB/x11/egl-drm
Rework X11 backend to use EGL for finding gbm device and associated commits
2021-11-26 13:43:49 +01:00
Victor Brekenfeld a4f2729608 gbm: expose buffer age 2021-11-24 18:57:51 +01:00
i509VCB 86716f9c9f x11: allocate buffers using gbm with modifiers 2021-11-24 18:42:24 +01:00
i509VCB 53d43905ac x11: store dmabufs in buffer object userdata 2021-11-24 18:11:27 +01:00
i509VCB e4891b0c9e
egl: Introduce EGLDevice
More specifically, this introduces a way to query the available EGL devices on a system, `EGLDevices::enumerate`.
Also this introduces a way to get the `EGLDevice` used by an `EGLDisplay`, `EGLDevice::device_for_display`

Co-authored-by: Drakulix <github@drakulix.de>
2021-11-23 10:52:02 -06:00
i509VCB 5210b39c35 anvil: deduplicate some input handler logic 2021-11-22 15:27:42 +01:00
i509VCB 3283010d2c Add Forward/Back mouse buttons 2021-10-27 12:23:12 -05:00
Poly 67ed81a00c Anvil XDG Decoration 2021-10-27 14:18:52 +02:00
i509VCB 77c970e197 winit: rework around `WinitEvent` vs `InputEvent<Special = WinitEvent>` 2021-10-27 14:16:19 +02:00
i509VCB 2e68cfda5a X11 backend 2021-10-17 13:46:15 -05:00
i509VCB c8d56f1cf3 Move X11Source to smithay under`x11rb_event_source` feature 2021-10-17 13:46:07 -05:00
i509VCB d041e5cdf6 anvil: Derive missing `fmt::Debug` 2021-10-17 13:46:07 -05:00
Poly 8114bac8fd Remove XDG Shell V6 2021-10-16 19:33:15 +02:00
i509VCB fdaf1859b0 anvil: Pass window and output maps using dispatch data AnvilState 2021-10-16 13:14:46 +02:00
i509VCB f5bf204454 anvil: Passing `ANVIL_MUTEX_LOG` uses Mutex logging drain
fmt...
2021-10-14 10:54:43 -05:00
Victor Brekenfeld 55eb73cb9e wayland/seat: add return value to `KeyboardHandle::input` 2021-09-19 17:10:08 +02:00
Victor Brekenfeld 90dd28c910 wayland/seat: Add `KeysymHandle` to allow for keycode conversions.
Currently keycodes are always converted using xkbcommons
`State::key_get_one_sym` function. This may be not what the compositor
wants, e.g. if it represents keybindings with explicit modifiers.
Applying Shift in this case changes the sym, making it necessary for
the compositor to *undo* this transformation, which is hard or even
impossible and very unnecessary, when we have all the necessary
information in smithay.

Therefor this commit replaces the `Keysym` argument of the filter
closure with a `KeysymHandle`, which allows for different variants of
keysyms to be received. Modified (as previously), unmodified or even
as a raw keycode.
2021-09-17 17:12:26 +02:00
Victor Berger cc48759338
Merge pull request #369 from i509VCB/anvil_render_fn
anvil: Split out logic for drawing layers and windows from backends
2021-08-24 14:26:22 +02:00
Victor Berger f4ba6f5bea
Merge pull request #366 from psychon/x11-event-thread
Anvil: Use a dedicated X11 event thread for event reading
2021-08-24 11:31:02 +02:00
i509VCB 5d2e601426 Fence the module I guess 2021-08-21 17:18:54 -05:00
i509VCB e020347c6b anvil: Split out logic for drawing layers and windows
At the moment also splitting our Drag and Drop requires unraveling some backend specific stuff.
2021-08-21 16:55:32 -05:00
Uli Schlachter 9af64eb0b3 rustfmt
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-14 17:53:32 +02:00
Uli Schlachter 05e5036584 Exit the worker thread when X11Source is dropped
The previous commit added a new worker thread. This thread might sit in
wait_for_event() indefinitely even after the X11Source was dropped. This
is because nothing guarantees that an X11 event will come in "soonish".
And only then would the thread notice that its main thread is gone.

This commit cleans that up by having X11Source explicitly wake up the
event thread and wait for it to exit in its Drop implementation.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-14 17:37:26 +02:00
Uli Schlachter 6004ecdc14 Anvil: Move X11 event reading to a thread
x11rb caches X11 events internally. This cache is used when waiting for
the reply of a request and an event is received first.  This cache is
however also used when sending a request, because the X11 client may
never block and stop reading while writing a request. Doing so could
cause a deadlock with the X11 server.

Thus, this commit changes X11Source to spawn a thread internally. This
thread calls wait_for_event() in a loop and uses a calloop channel to
forward these events to the main loop. x11rb's RustConnection internally
uses a ConditionVariable to make sure this thread will wake up when
needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-14 17:25:51 +02:00
Christian Meissl 85fa46ad2c Add example for setting the initial popup geometry 2021-08-04 23:12:22 +02:00
Christian Meissl 6d3d5f7933 implement popup protocol checks 2021-08-04 23:12:22 +02:00
Christian Meissl b36cfbb392 add v3 positioner fields and handle requests
add support for xdg_popup reposition
increment supported wm_base version to 3
2021-08-03 15:57:22 +02:00
Poly 524501b2e8 anvil: split `bring_nth_window_to_top` to separate fn 2021-07-31 22:36:55 +02:00
Poly f0cdb235d7 anvil: implement xdg-activation 2021-07-31 21:16:39 +02:00
Poly 115403633b anvil: Implement wlr_layer_shell 2021-07-31 13:44:04 +02:00
Poly 217b63f106 Fix Clippy for Anvil 2021-07-30 18:10:48 +02:00
Victor Berger 3387957065 CI: deny warnings in anvil 2021-07-25 10:14:08 +02:00
Victor Berger f366dfd12a wlcs: pointer input handling 2021-07-25 09:39:49 +02:00
Victor Berger bdb257474d Main structure of WLCS integration. 2021-07-25 09:39:49 +02:00
Victor Berger 56c3f53575 anvil: make into a library+bin crate 2021-07-25 09:39:49 +02:00
Victor Berger 782b21f363 Update dependencies 2021-07-25 09:09:12 +02:00
Poly 7e4e78151a Implement XdgOutput protocol 2021-07-24 18:51:27 +02:00
Poly 0720f7d8ff Move surface to mouse position when unmaximizing 2021-07-19 20:35:07 +02:00
Poly bd35dfb4b6 Automatically unmaximize toplevel when it is moved 2021-07-19 19:12:38 +02:00
Victor Brekenfeld 1cf1d4739b buffer: use Size instead of width/height 2021-07-13 23:37:28 +02:00
Victor Brekenfeld 7dadd63e35 anvil: Introduce debug feature and draw fps 2021-07-13 23:37:28 +02:00
Victor Brekenfeld 8bd17d71d2 renderer: Support cropping and scaling 2021-07-13 23:28:07 +02:00
Victor Brekenfeld b67688e1c8 anvil/udev: Try to load XCursor theme for default cursor 2021-07-13 23:21:08 +02:00
Victor Brekenfeld 56f5557f8c anvil: Move import_bitmap into anvil 2021-07-13 23:21:08 +02:00
Christian Meissl d09de13bfc use size for transformed functions 2021-07-13 22:38:32 +02:00
Christian Meissl 72e4d910fe implement fractional HiDPI scaling
expose output from output map and return a reference
in find

change scale with keyboard shortcut

scale input coordinates and render location
according to output_scale

scale buffers during rendering

adapt window locations on output scale
change to that the location will appear
to be stable

scale udev pointer location on output scale
change to make the pointer location appear stable

Use a UserDataMap to store the udev output id

Short names for udev outputs for easier output
scale configuration
2021-07-13 22:38:32 +02:00