Commit graph

494 commits

Author SHA1 Message Date
Daniel Stone e2a48f6f68 desktop-shell: Deduplicate center_on_output() in fullscreen
weston_shell_utils_center_on_output() already handles the case where we
don't have an output to aim at.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 2ab3d33903 desktop-shell: Deduplicate center_on_output() in fullscreen
weston_shell_utils_center_on_output() already calculates the subsurface
bounding box for us.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Daniel Stone 8ed7f0f459 desktop-shell: Use weston_view_move_to_layer() for minimised views
When we're moving a view to the minimised layer, use our new(ish) helper
to move it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-08-11 14:10:45 +03:00
Marius Vlad c59a02c15e desktop-shell: Don't reposition windows on every resize
Remove any attempt to reposition windows when handling an output resize.

This had some side-effects on x11 and wayland backends that keep moving
windows at random positions when manually the output.

A more smarter approach would be to move them only if they're actually
affected by a resize -- like no longer in the output's viewing area, but
that remains for another day.

Fixes: #793

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-08-09 21:26:10 +03:00
Daniel Stone 760d60f508 desktop-shell: Remove unnecessary repaint schedules
We don't need to explicitly schedule a repaint once we've reconfigured
some views.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-24 12:35:47 +03:00
Derek Foreman c4d24c01b3 desktop-shell: store xwayland positions in weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-19 07:48:33 -05:00
Derek Foreman 89ff5ddfd9 libweston: Replace struct_weston_position with weston_coords
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-19 07:48:30 -05:00
Derek Foreman 9056a11460 desktop-shell: Use weston_coord for configure_static_view
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-19 07:41:33 -05:00
Marius Vlad eefd8ae2e0 desktop-shell: Handle all other shsurfs
The output resize handler we only accounts for the background and panel
surfaces, so this handles all other regular shsurfs.

This patch would reuse any previously saved position, or reposition the
surfaces to avoid placing them outside of the output area. For maximized
or fullscreen type of surfaces, issue a new configure event to let
clients react to the new output dimensions.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-07-06 19:06:22 +00:00
Marius Vlad aeabba8e18 desktop-shell: Keep track of shsurf being created/removed
We'd need to go over them when handling output resize so use
desktop_shell to hang of the list of shsurfs.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-07-06 19:06:22 +00:00
Marius Vlad ecab79bfb7 desktop-shell: Use a common helper to handle surface resizes
This introduces two helpers, shsurf_is_max_or_fullscreen() and
set_shsurf_size_maximized_or_fullscreen() to handle
maximized/unmaximized fullscreen/unfullscreen transitions.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-07-06 19:06:22 +00:00
Daniel Stone fc776c3b59 view: Add weston_view_add_transform and weston_view_remove_transform
They do what they say on the box, and inflict damage where required.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone 7d2c5e0c33 view: Add weston_view_set_alpha()
Does what it says on the box: sets the view's alpha, also inflicting
damage where required.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone e9c67aedba desktop-shell: Remove unused fullscreen transform
I don't know when this stopped being used, but it's obviously not
any more.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone 785af26007 desktop-shell: Be more precise with rotation damage
When we're rotating a surface, only mark the geometry as dirty after
we've actually updated the transformations. Then we can restrict our
repaint to just the view itself, not the full compositor.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 1da1d860fe desktop-shell: Use weston_view_to_layer() for lock surface
Use the new helper instead of open-coding part of it. This removes a
comment about not marking a surface as mapped until it has a buffer: the
surface->width == 0 check already guarantees that we have a buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 5c9231b116 desktop-shell: Use weston_view_move_to_layer() for static views
Use our new helper instead of open-coding part of it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 1c2edaac6b desktop-shell: Use weston_view_move_to_layer() for fullscreen background
Use the new helper for placing the fullscreen background view.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone c1bbcba6e8 desktop-shell: Create fade-out views at destroy time
Instead of pre-creating a fade-out view that's sort of left half-mapped
around in the scene graph, create the view only when we need it, and use
the helpers to make sure that the damage is correctly handled.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone fd620717b3 desktop-shell: Use weston_view_move_to_layer() for per-view unfade
This is kind of immaterial since the view is going to be destroyed, but
it's a step.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 179d4513d0 desktop-shell: Use weston_view_move_to_layer() for fullscreen fades
Use our shiny new helper for fullscreen fades.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 62dbbd6706 desktop-shell: Use weston_view_move_to_layer() for fullscreen switching
When we're tabbing away from fullscreen views, use the new helper rather
than open-coding layer switching.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 07103d1842 weston-desktop: Match desktop-shell view mapping semantics
Preserve the same order as desktop-shell for handling view (un)mapping,
so we can move these into a shared helper. These should have no
functional effect but provide a helpful bisect point.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 4b3e09fa71 desktop-shell: Centralise view mapping for shell_surfaces
shell_surface_update_layer() is the thing which moves our views around
into layers. Since we want to keep an invariant that a view is mapped if
it is on a layer, and unmapped if it is not on a layer, handle mapping
along with the layer moves.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 166d9661fb desktop-shell: Make view mapping more consistent
Try to stick to a pattern of first mapping a surface, then inserting a
view into a layer together with marking it as mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 54b78dd644 desktop-shell: Don't damage unmapped views
If a view isn't mapped, then we don't need to damage beneath it, as nothing's
beneath it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 0bee7ff4ee desktop-shell: Actually dirty surface regions when moving
weston_view_geometry_dirty() won't automatically clear out the old
region, so manually damage underneath the view before we mark the
geometry dirty.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 5ff5d0ea90 desktop-shell: shell_surfaces always have a layer
There is no way for shell_surface_calculate_layer_link() to give us a
NULL layer, so don't pretend it can and silently drop out without
removing it from the old layer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone 570bf1824a desktop-shell: Don't restart client on exit
When we're shutting down, don't try to restart the shell client.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone abe893d8ea frontend: Rename weston_client_start to wet_client_start
It's not libweston, so it shouldn't be weston_.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Derek Foreman db51409b9a desktop-shell: Pass a weston_coord to calc_input_panel_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman 643c9b929f desktop-shell: use weston_coord in weston_move_*_grab
Replace some wl_fixed_t pairs with weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman 2ac566d281 libweston: Add more weston_coord arithmetic helpers
Until now we've only had the unadorned arithmetic functions, but they're
easy to abuse and tedious to use.

For now, we just add weston_coord_global_add/sub functions and use them
where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman d961e59d4a libweston: Add getters for view position/offset
This is stored as an unadorned weston_coord internally, but with getter
functions we can put together the appropriate global or surface
coordinate.

Use them where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman 1f81c082b5 libweston: Add weston_coord_truncate()
Truncating a weston coord to integer values is something we do
frequently enough to warrant a helper function.

Use this in the kiosk and desktop shells where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Marius Vlad 51f377b813 desktop-shell: Do another update transform
This is similar to commit 'libweston: Update view transforms more often', where
we update the view's transform when getting the panel dimensions.

Fixes #740

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-06-13 16:32:39 +00:00
Derek Foreman 0bf2d82e0c libweston: Use weston_coord in struct weston_touch
Convert the grab coordinate to a weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:58:17 -05:00
Derek Foreman e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Derek Foreman 244dc963b9 libweston: use weston_coord for weston_view_set_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:19 -05:00
Sergio Gómez a7f63c1220 libweston/input: Use WESTON_ACTIVATE_FLAG_FULLSCREEN in activation logic
The addition in a former commit of the flags field in the activation data will
let us pass the reason for activation to the constraint logic. We use that
reason here to unconditionally enable constraints in the recently 'fullscreened'
surface.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-05-25 12:07:03 +03:00
Sergio Gómez 7828712684 desktop-shell: Activate shell surface when client requests fullscreen
When a toplevel xdg surface is changing from non-fullscreen to fullscreen upon a
client request, activate its corresponding shell surface.

This will let us use the activation mechanism to enforce the enabling of
pointer confinement.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-05-25 12:07:03 +03:00
Sergio Gómez e93da8fe3d desktop-shell: Check that fullscreen surface actually has a black view
When the position or size of a fullscreen surface changes (e.g., due to change
in the output), the surface commit logic in desktop_surface_committed() resets
the fullscreen by first calling unset_fullscreen() and later on calling
shell_configure_fullscreen(). One part of this reset is the recreation of the
black view curtain (destroyed in unset_fullscreen() and created again in
shell_configure_fullscreen()).

In the upcoming commit we will replace the call to shell_configure_fullscreen()
with a call to activate() (since we want to activate this shell surface, and
activate() already has a call to shell_configure_fullscreen() in it).

The code in activate() by default lowers the fullscreen layer of the shell
surface through lower_fullscreen_layer(), which is called before
shell_configure_fullscreen(). This lowering function assumes that the fullscreen
shell surface has a valid black view curtain, which as said before was removed
in the call to unset_fullscreen(). Add the check to guard against this case.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-05-25 12:07:03 +03:00
Marius Vlad a991691eee desktop-shell: Do not attempt to change the state
Upon connector reconnect/disconnect we seem to ignore any kind of window
state we might have previously to disconnect so this takes that into
account and avoids a change in the state in case we detect one set-up
previously.

Fixes: #731

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-04-11 11:26:24 +00:00
Michael Olbrich 9eab270de5 tablet: Add binding to activate surfaces using the tablet tool
Based on patches from:
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>
Bastian Farkas <bfarkas@de.adit-jv.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Lyude Paul 6a06669b58 clients: Add support for tablet cursor motion to window frames in libtoytoolkit
When it comes to a window frame, a tablet tool and cursor act almost
identical; they click things, drag things, etc. The tool type and extra
axes don't serve any use in the context of a window frame, so tablet
pointers share the frame_pointer structures used for the mouse pointer.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Jonas Ådahl cc3d30c28b shell: Keep window 'activated' state if child has focus
Popups should have keyboard focus when active, but the toplevel window
should still appear "active". Make sure this is the case by changing the
"active" tracking to see whether any child surface has keyboard focus.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-30 17:14:29 +00:00
Michael Olbrich 00f08ec79c compositor/text-backend: use xzalloc everywhere
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-27 16:01:18 +01:00
Derek Foreman 48c93e84e6 desktop-shell: Use weston_coord for saved position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 59a0bd99bd libweston: Use weston_coord in surface committed handler
I also snuck in a trivial change to drag_surface_configure at the same
time to avoid yet another micro patch.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 5e353d523f libweston: Use weston_coord in struct weston_view
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00