Commit Graph

263 Commits

Author SHA1 Message Date
Victor Berger f27658b759
Merge pull request #306 from cmeissl/feature/surface-enter-leave 2021-07-03 17:01:13 +02:00
Christian Meissl 6b2273235a fix popup geometry calculation and relative
placement to parent geometry
2021-07-01 23:52:40 +02:00
Christian Meissl da317bfc5d use the current xdg_toplevel state to check...
...if we are resizing. The configure message
is the result from telling the client that resizing
has stopped and therefore not include the resizing
state. The current state is safe to use because
AckConfigure will move the state to last_acked
and the current state will be set on the next surface commit.
2021-07-01 20:04:29 +02:00
Christian Meissl df208fa6c8 clamp cursor with current output height
move fullscreen output geometry calculation to
a helper function

rename with_outputs to with_client_outputs and
take client instead of generic resource
2021-06-30 23:56:01 +02:00
Christian Meissl d7e10acc78 workaround for fullscreen request without client output 2021-06-30 18:24:54 +02:00
Christian Meissl 0d88a392fa add an output_map which handles...
the positioning of outputs, tracks
the surfaces on the outputs and
sends enter/leave for the surfaces

Additionally the output_map will
handle re-location of windows if
a output mode is changed, an output is
added or removed.

The shell has been updated to use the
primary output for the initial placement.
The fullscreen/maximize requests will now
handle the shell part correctly. For real
fullscreen output the rendering has to be
changed.

The output name is considered unique
and an output can be retrieved from
the map by location, output or name.
This can be used as the base for HiDPI
handling.
2021-06-30 18:24:51 +02:00
Victor Brekenfeld 616bacdff2
Merge pull request #318 from Smithay/refactor/input_backend
Rework `InputBackend` abstractions to track individual devices
2021-06-30 00:14:20 +02:00
Victor Brekenfeld 50741bc7bb Rework `InputBackend` abstractions to track individual devices
Removes the notion of Seats from `InputBackend` and replaces it with
`DeviceAdded` and `DeviceRemoved` events allowing compositors to
descriminate between single devices.

A new abstraction to model multiple seats on a single input backend
may be be added separately at a later time.
2021-06-30 00:06:59 +02:00
Victor Berger 3a0c631edd Rudimentary xdg_popup support 2021-06-29 23:59:55 +02:00
Victor Berger da5c814555 Clippy fixes 2021-06-29 18:03:44 +02:00
Victor Berger 053bc98faa Fix all CI warnings 2021-06-29 18:03:44 +02:00
Poly 3623947939 [Anvil] XDG activate support 2021-06-29 15:13:19 +02:00
Victor Brekenfeld eb5e4bcf92 Fix wl_drm on winit backend 2021-06-27 22:19:12 +02:00
Victor Berger ad55ab71c9 compositor: Introduce transaction state tracking
This changes the state handling logic of wl_surface to automatically
track subsurface pending in the form of transactions. The role enum
(and the associated type parameter) is no more, and replaced by a
general-purpose typemap-like container on surfaces.

The new logic is introduced in the files:

- `src/wayland/compositor/cache.rs`
- `src/wayland/compositor/transaction.rs`

The rest of the PR is the fallout of these changes, as well as a few
trivial clippy fixes.
2021-06-26 21:52:38 +02:00
Victor Brekenfeld d17cd5326d Remove EGLBufferReader from buffer_type and buffer_dimensions api 2021-06-24 22:17:08 +02:00
Victor Brekenfeld c578a9e16c Move EGLBufferReader management into ImportEgl 2021-06-24 22:12:08 +02:00
Victor Brekenfeld ce3b2d1eab Rework `DrmRenderSurface` into `GbmBufferedSurface`.
Removes the renderer from the `DrmRenderSurface` allowing anvil
to use just one renderer per backend.

Since the old `DrmRenderSurface` was dependant on gbm anyway to import
buffers, the new `GbmBufferedSurface` does now only supports gbm as an allocator,
which hugely simplifies the code and also skips some unnecessary imports/exports.
2021-06-23 18:36:06 +02:00
Christian Meissl 4cb03a1d0d track suppressed keys and...
...forward non suppressed keys on release
fixes #242
2021-06-20 12:07:47 +02:00
Poly 69543c0cfa Fix Anvil panic when resizing dead window 2021-06-18 11:39:33 +02:00
Poly f9f77288c8
libseat support (#292) 2021-06-15 23:35:16 +02:00
cmeissl e9aef7caad
rework xdg_shell (#286)
* rework xdg_shell
use distinct surface roles for xdg_toplevel and
xdg_popup using a xdg_role! macro

* fix clippy warnings in shell

* added a generic DeadResource error and...
...added a result to xdg with_pending_state
Renamed the ToplevelState to ToplevelStateSet
2021-06-15 23:32:02 +02:00
Victor Berger 9ad0edd2a3 Fix several clippy lints 2021-06-10 22:01:10 +02:00
Victor Berger c630bd9086 cargo fmt 2021-06-10 22:01:10 +02:00
Victor Berger 671e2053e9 xwayland: rework as an EventSource
Reorganize the XWayland abstraction into a calloop EventLoop.

Fixes #245
Fixes #203
2021-06-10 21:52:08 +02:00
Victor Berger 01b5c1a183 anvil: don't release SHM buffers twice 2021-06-09 21:15:27 +02:00
Victor Brekenfeld 5b70ca4206 anvil: dmabuf support 2021-06-08 21:57:35 +02:00
Victor Brekenfeld 969cdda85c renderer: Split Renderer trait into Import sub-traits 2021-06-08 21:47:05 +02:00
Victor Berger 327321612d anvil: remove several Rc and RefCell 2021-06-03 11:45:22 +02:00
Victor Berger 85440840c8 anvil: flatten DrmRenderer into AnvilState 2021-06-03 11:45:22 +02:00
Victor Berger 4bf6bfa08d anvil: reorganize platform-specific values 2021-06-03 11:45:22 +02:00
Victor Berger 3f01f978f8 wayland.compositor: DispatchData available in the callback 2021-06-03 11:45:22 +02:00
Victor Berger aaa6e625e9 Update to calloop 0.8, DrmDevice as an EventSource 2021-06-03 11:45:22 +02:00
Christian Meissl 4f0161658f make the frame_callback a list 2021-05-30 15:40:35 +02:00
Victor Brekenfeld 25c61c7a73 Fixup import_buffer definition to account for subsurface damage 2021-05-27 17:35:28 +02:00
Victor Brekenfeld 12e80ca2c6 cargo fmt 2021-05-26 19:12:45 +02:00
Victor Brekenfeld 67a9478293 renderer: Properly cache shm-resource surface-global 2021-05-25 00:40:55 +02:00
Victor Berger 6bfe6e1f25 Fix damage handling to support multiple rectangles 2021-05-24 23:50:14 +02:00
Victor Brekenfeld 978ef1b393 renderer: Closure-based api 2021-05-24 23:46:03 +02:00
Victor Brekenfeld a4f66da69f drm: Properly expose planes for surfaces 2021-05-20 01:06:16 +02:00
Victor Brekenfeld 5e1128b973 gles2: Link texture in buffer for caching 2021-05-17 00:40:10 +02:00
Victor Brekenfeld 55b4d4b89a shm: Release buffer as soon as possible 2021-05-16 20:08:10 +02:00
Victor Brekenfeld c41cc9828f renderer: Cache textures in SurfaceAttributes 2021-05-16 20:00:45 +02:00
Victor Brekenfeld 524057418e drm: Fixup tty switching 2021-05-15 22:28:39 +02:00
Victor Brekenfeld 149c923876 cargo fmt 2021-05-15 18:17:43 +02:00
Victor Brekenfeld b4f216d7b8 anvil: Update to new renderer changes 2021-05-15 16:12:13 +02:00
Victor Brekenfeld 5245595037 fix: Compiling anvil without egl 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 1839756f68 fix: Try shm-buffer imports, even if we do not have an egl-buffer reader... 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 52c01535d0 rustfmt 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 36bf5618ed clippy fixes 2021-05-15 16:12:12 +02:00
Victor Brekenfeld ccd86cd8c1 anvil: Do not throw rendering errors away 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 795903d7e0 anvil: Fixup compiling egl support 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 0661ebebb8 anvil: Properly free textures 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 30a8693789 anvil: Reintroduce egl buffer support 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 45cd37373a anvil: Render software cursors again 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 43d3e9cd14 anvil: Fixup udev/tty backend, so that it runs at least 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 2c9c150e5e renderer: Remove `Frame` trait and merge into `Renderer`
Tracking of Frames, so that only one unique one can exist at a time
(gles does not allow multiple frames being rendered in parallel)
lead to very unfriendly lifetime-heavy code. A renderer is already
*unique*, just move the code there and add an error variant to catch
misuses.
2021-05-15 16:12:12 +02:00
Victor Brekenfeld fb30c830d7 Fixup anvil for winit rendering
- Since a lot of functionality is now in smithay's rendering module
  we can get rid of shm_load, shaders and the glium dependency.
- glium_drawer becomes drawing and only features some code to get from surfaces
  to textures for any(!) renderer.
  (Should probably moved into smithay at some point as well.)
- buffer_utils is only necessary to query the buffer size anymore.
- disable egl-buffer support temporarily
2021-05-15 16:12:12 +02:00
Victor Berger 991eba216d Update most dependencies 2021-02-22 20:27:46 +01:00
Uli Schlachter ff09b8e116 Use the correct position for Xwayland surfaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter 3504182a5e Add a new surface role for Xwayland surfaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter 734b541ecd Map between X11 Windows and WlSurfaces
Xwayland gives us a mapping between X11 window and WlSurface IDs via
special WL_SURFACE_ID messages. This commit uses these messages to find
the corresponding WlSurface. For this, the new client.get_resource API
from wayland-server is needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter a6c40a002b Add an X11 EventSource to calloop
This commit creates an event source for calloop that receives X11 events
from the X11 server.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter df01587459 Become the X11 window manager after Xwayland startup
This commits adds the necessary magic incantations to become the X11 WM
after Xwayland starts.

This uses the pure-Rust implementation from x11rb, but any other X11
crate could be used as well.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter 2f0dadd6ca anvil: Add a xwayland feature
This commit adds an xwayland feature to anvil. Right now, this feature
doesn't do much. anvil uses the smithay code to start XWayland, but does
not do anything with it once it is running.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Victor Berger 36e11284c2 New clippy fixes 2020-11-02 10:24:55 +01:00
Victor Berger 8fde779806 Dependencies updates 2020-11-02 10:24:55 +01:00
Eric Anholt 78d28165c3
Update nix to 0.19 (#237) 2020-10-31 18:33:18 +01:00
Victor Berger d3429fa37d anvil: send frame callback before blocking to draw on winit 2020-10-26 12:52:28 +01:00
Victor Berger 5421b9675c anvil: send millisecond time in frame callback
This is what the protocol requires, and apps rely on it to figure
out how long time elapsed between draws.
2020-10-26 12:52:28 +01:00
Jonas Platte bcc8f13b2b Fix most rustc & clippy warnings 2020-09-16 12:56:32 +02:00
Mateus Carmo M de F Barbosa 2a351d0879 Use Serial type for all serials 2020-08-27 13:07:01 +02:00
Victor Berger 49dda88c63 backend.input: keep sub-pixel precision in events
libinput provides sub-pixel precision for pointer motion & touch events.
Keep this precision by switching all coordinates values from input
events to f64 (rather than i32 or u32). Otherwise, values are rounded
and part of the movment is lost.

Potentially fixes #224
2020-07-13 17:56:20 +02:00
Victor Brekenfeld 9c3c3d939e cargo fmt & lint 2020-06-28 00:25:15 +02:00
Victor Brekenfeld 3fd336aba5 anvil: GliumDrawer handle hardware cursors and track state 2020-06-28 00:23:24 +02:00
Victor Brekenfeld bf011e8071 anvil: Introduce BufferTextures 2020-06-28 00:23:24 +02:00
Victor Brekenfeld 4930e7e8b2 anvil: create a texture per backend 2020-06-28 00:23:24 +02:00
Victor Brekenfeld f84d6cb180 anvil/udev: do not upload a cursor every frame 2020-06-28 00:23:24 +02:00
Victor Brekenfeld 7e75a68e57 anvil: allow swapping monitors via shortcut 2020-06-28 00:23:24 +02:00
Victor Brekenfeld 33fb393383 anvil: clamp input to current output instead of full hd 2020-06-28 00:23:22 +02:00
Victor Brekenfeld d7f800c76d anvil: create and render to multiple outputs independently 2020-06-28 00:05:01 +02:00
Victor Brekenfeld 9fd8dd9cec anvil: allow draw_windows to take optional output coordinates 2020-06-28 00:05:01 +02:00
Victor Brekenfeld 7b4459f649 drm: Make surfaces `Send` 2020-06-11 18:57:05 +02:00
Victor Brekenfeld cc67764c23 make clippy happy 2020-06-11 12:16:43 +02:00
Victor Berger a717fa36cd backend.session: Migrate to using Signaler
Change the session backend to rely on Signaler to propagate its
signals. Also introduce the Linkable trait to allow generic composition
of objects needing to listen for signals.
2020-05-23 21:37:22 +02:00
Victor Berger c3859d999b backend.session: use pkg-config to find logind lib
Introduce the `backend_session_elogind` cargo feature which pulls
`backend_session_logind` and makes the logind session backend seek
`libelogind.so` instead of `libsystemd.so`.

Fixes #127
2020-05-23 21:37:22 +02:00
Victor Berger b05c2ccbba backend.session: rework as calloop event sources
Rework the Session Notifiers so that they are calloop event sources
by themselves, allowing them to be inserted by the user without the
`bind_session` dance.

Also update the logind backend to use the current dbus-rs API, rather
than the deprecated one.
2020-05-23 21:37:22 +02:00
Victor Brekenfeld 0c19a461b6 anvil: use fallback-device for gbm/nvidia 2020-05-23 00:29:32 +02:00
Victor Brekenfeld 38d3db565a anvil: do not double initialize surfaces with multiple matching encoders 2020-05-23 00:29:32 +02:00
Victor Brekenfeld 64a57a4cc8 downgrade some recoverable errors to warnings 2020-05-12 20:03:03 +02:00
Victor Brekenfeld f1c40f7306 lint: fmt & clippy 2020-05-12 20:03:03 +02:00
Victor Brekenfeld 7518f8c0f7 anvil: retry initial renderings 2020-05-12 19:47:10 +02:00
Victor Berger b708f88da6 anvil: Fuse InputHandler into AnvilState 2020-05-12 08:46:34 +02:00
Victor Berger 8f543eb597 backend.input: rework libinput as a calloop source 2020-05-12 08:46:34 +02:00
Victor Berger 5552c81a32 anvil: Introduce InputInitData to simplify function prototypes 2020-05-02 13:27:35 +02:00
Victor Berger 35d8cea547 anvil: Introduce RenderTextureSpec to simplify render_texture 2020-05-02 13:27:35 +02:00
Victor Berger 64aedce01f anvil: Introduce ShellHandle type to simply return values 2020-05-02 13:27:35 +02:00
Victor Berger 743a80c004 anvil: remove unused imports 2020-05-02 13:27:35 +02:00
Victor Brekenfeld 28166ce002
Merge pull request #206 from Smithay/fix/drm_connector
Fix drm mode and connector handling
2020-05-01 16:46:36 +02:00
Victor Brekenfeld 9300e35093 lint: fmt 2020-04-30 19:03:02 +02:00
Victor Brekenfeld 31b6d84442 WIP: Rework egl and glium errors 2020-04-30 00:24:35 +02:00