Commit graph

31 commits

Author SHA1 Message Date
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 60a00d8c6c xwayland: Use weston_coord
Smash weston_coord into a whole bunch of xwayland internals.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-19 07:41:33 -05:00
Derek Foreman eebbe26d7b libweston-desktop: Unset use_geometry when unsetting relative_to
In other parts of the code, use_geometry implies a parent is present. So
let's clear it when we clear relative placement.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-19 12:37:08 +00:00
Derek Foreman 123e921871 xwayland: Fix assert with some parented windows
Having use_geometry set is not the only time we have a parent window,
apparently.

Clicking on the 'Line diff' drop down in gitk would cause an assert()
because of this.

Fixes #769

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-19 12:37:08 +00:00
Alexandros Frantzis b7b0042777 xwayland: Notify the shell when a window drops the fullscreen state
Notify the shell of the state transition when going from fullscreen to
normal toplevel window.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-07-06 21:19:18 +00:00
Alexandros Frantzis ca7b631310 xwayland: Allow shells to make xwayland surfaces fullscreen
The fullscreen state for xwayland surfaces can currently only be
effectively set from the client side. This commit enables
libweston-desktop based shells to properly set the fullscreen state
for xwayland surfaces.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-07-06 21:19:18 +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
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
Michael Olbrich 6d3d98851e libweston-desktop: implement tablet tool grab
This is needed for correct focus handling when xdg popups are opened.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Jonas Ådahl 8f4b141299 desktop: Make popup grab follow keyboard focus semantics
A popup grab is specified to have the top most popup surface gain
keyboard focus. This means the keyboard focus should always follow the
most recent xdg_popup.grab() surface. Make sure this happens by keeping
track of the parent surface in the libweston-desktop popup grab,
updating the keyboard focus when surfaces are added and removed from the
popup chain, and restoring the keyboard focus to the toplevel when there
are no popups anymore.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-30 17:14:29 +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
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 583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 3bb09ea3cb input: Use weston_coord for weston_touch functions
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman c3cd8306c9 libweston: Pass weston_coords to weston_compositor_pick_view
Continuing to convert things to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Tran Ba Khang(MS/EMC31-XC) 776fafe13a libweston/desktop: committed when transiting from valid to invalid buffer
Every shells have an implementation of weston_desktop_api structures.
It includes some callbacks to listen to xdg_surface signals. Committed callback
is one of them.

Currently, the xdg_shell don't invoke the weston_desktop_api->committed
callback when the xdg_surface is initial stage or no surface content.

In the case: the client attached a null buffer after the valid buffer,
the shell isn't going to invoke to xdg_surface committed, and don't know
the surface is disappeared. If the surface is fullscreen, we will get
a black background on the screen until a new valid frame come. That
should not happen.

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:05:19 +02:00
Derek Foreman fe4d5711bf libweston: Split weston_view_set_position() into rel and abs variants
One variant is used when a view is being positioned relative to a parent,
the other is when the view is being given an absolute position in the
global space.

This will help later when surface and global coordinates are different
data types, but for now the two functions do essentially the same thing.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman 889c2e3f0d xwayland: Fix delay in displaying pop-up menu
Xwayland pop-up menus aren't displayed until the mouse moves, or some other
action causes the compositor to repaint.

This is because the shell knows nothing about xwayland override redirect
windows, so it won't assign them an output. Without an output, the
surface commit won't cause a repaint.

Fix this with brute force by updating their geometry on commit. If the
geometry is dirty (and it will be for new surfaces), this will cause an
output to be assigned before the upcoming weston_surface_schedule_repaint()

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Found-by: Hideyuki Nagase <hideyukn@microsoft.com>
2023-01-28 12:56:23 +00:00
Derek Foreman ef4d2955f0 libweston-desktop: Prevent spurious focus change signals
This should prevent extra focus signal emission the similarly to
how default_grab_pointer_focus() does, though we don't have the
surface jumping logic here.

This stops xdg pings from being sent every output repaint during
a grab when the pointer isn't in any windows belonging to the
grab parent.

An example would be running weston-terminal, bringing up the
right click pop-up, and moving the mouse onto the desktop while
another client causes repaints.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-12-02 16:07:25 +00:00
Derek Foreman 58de1aac5c libweston-desktop: Set grab client before calling grab functions
This prevents a spurious pointer focus clear at the start of a grab.
This would, for example, cause an extra pointer leave when bringing
up a right-click pop-up in a ttk app like weston-terminal.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-12-02 16:07:25 +00:00
Marius Vlad bf0c99f519 libweston/desktop, desktop-shell: Add getters for pending state
This introduces a few getters to retrieve the pending state from
libweston-desktop, now just libweston, and makes use of it,
specifically get_pending_maximized to avoid sending invalid
dimensions to the client in the particular use case
set_maximized/unset_fullscreen.

These pending state getters are useful to query/poke a not-applied
yet state, and could be useful where we don't have a buffer attached
where the client might be set-up as maximized, but internally libweston
hasn't yet applied that pending state.

Fixes #645

Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-11-10 13:06:07 +02:00
Derek Foreman 4d141a7881 libweston: Don't return coordinates from weston_compositor_pick_view
Sometimes callers don't want them, and sometimes (when view is NULL) the
coordinate is invalid.

Waste a tiny bit of time calculating them as needed in the callers
instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-02 10:25:15 +00:00
Derek Foreman eed00f679e input: Don't pass surface coordinates to weston_pointer_set_focus
We're always passing pointer->x, y converted to surface coordinates, or
garbage if view is NULL. Let's just stop passing those coordinates
entirely and calculate them in the function.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-02 10:25:15 +00:00
Marius Vlad 1b4def3c48 libweston/desktop: Migrate libweston-desktop/libweston-desktop.h
With commit 'Move libweston-desktop into libweston' we've moved out
libweston-desktop DSO into libweston.  Move also the header to
libweston/desktop.

This removes removes the libweston-desktop pc file and bumps libweston
major version to 12.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 13:57:26 +03:00
Marius Vlad 37a3025d89 libweston/desktop/xdg-shell: Add tiled orientation states
With the help of a newly introduced function, weston_desktop_surface_set_orientation(),
this patch adds missing tiled states from the xdg-shell protocol.
The orientation state is passed on as a bitmask enumeration flag, which the
shell can set, allowing multiple tiling states at once.

These new states are incorporated the same way as the others, retaining
the set state, but also avoiding sending new configure events if nothing
changed since previously acked data.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-08-09 13:36:40 +03:00
Daniel Stone b047f989a5 xdg-shell: Implement xdg-shell v5 capabilities event
This skips over xdg-shell v4, which can be implemented with no changes
as it's just another optional event.

v5 adds a capabilities event, which we send to inform clients of the
window manager's capabilities.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-26 12:09:04 +03:00
Daniel Stone 1541c44777 libweston-desktop: Add shell capability queries
Allow other components to query which window-management operations are
supported by the shell.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-26 12:09:04 +03:00
Derek Foreman 23e3a3285a libweston-desktop: Add get_position
Plumb the new weston_desktop_api_get_position() through to xwayland.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Derek Foreman d615abdffd shells: Add libweston-desktop API to query position and add to shells
We're going to need this to properly send xwayland events later, so add
API to get the current x,y co-ordinates of a shell surface and add it to
the kiosk and desktop shells.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Hideyuki Nagase e4100f856d xwayland: Change layer for xwayland override redirect windows
Our positioning of override redirect windows falls apart when an
app is on the fullscreen layer, because we end up putting its
menus and tooltips beneath it. This patch raises the special
override redirect layer to be just below things like on-screen
keyboards (and, unfortunately, above things like panels).

There is no perfect way to deal with this problem, especially
for content like tooltips that don't come with transience hints.

In some cases override redirect menus could be better placed by
using the parenting/transience information provided with them
at map time, and we should probably do that at some point, but
that would still leave us with tooltips below full screen
applications, and the need for this layer change.

based on a patch
Co-authored-by: Hideyuki Nagase <hideyukn@microsoft.com>
Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>

I changed the layer position and the comments, so:
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-28 11:37:54 +00:00
Daniel Stone 9336263d9b Move libweston-desktop into libweston
It's not really useful to have libweston without libweston-desktop. It's
also very little code.

Merging both into the same DSO will allow us to cut out a bunch of
indirection and pain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-28 10:35:52 +00:00