Some clients like the mpv video player now request the xdg_shell
protocol so these will fail if the compositor only provides the
xdg_shell_unstable_v6 protocol. Compositors like mir and gnome provide
both protocols.
The two protocols are very similar therefore the code in xdg-shell-v6.c
has been refactored to work with the new xdg_shell protocol and now
resides in xdg-shell.c.
Pekka:
- split the patch
- fix continued line alignment
Daniel
- allow anchor_rect to initially have zero dimensions
- account for get_popup allowing NULL parent surface
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Meson is a build system, currently implemented in Python, with multiple
output backends, including Ninja and Make. The build file syntax is
clean and easy to read unlike autotools. In practise, configuring and
building with Meson and Ninja has been observed to be much faster than
with autotools. Also cross-building support is excellent.
More information at http://mesonbuild.com
Since moving to Meson requires some changes from users in any case, we
took this opportunity to revamp build options. Most of the build options
still exist, some have changed names or more, and a few have been
dropped. The option to choose the Cairo flavour is not implemented since
for the longest time the Cairo image backend has been the only
recommended one.
This Meson build should be fully functional and it installs everything
an all-enabled autotools build does. Installed pkg-config files have
some minor differences that should be insignificant. Building of some
developer documentation that was never installed with autotools is
missing.
It is expected that the autotools build system will be removed soon
after the next Weston release.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
For toplevel surfaces, the shell will do the same thing. Without this, the
commit does not trigger repaints, because the output mask for the surface
is not set.
Without this the popup is not shown unless something else triggers a
repaint. This is usually not seen because the mouse cursor triggers a
repaint at the same time.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
The user data of a wl_resource representing a wl_output protocol object
used to be a pointer to weston_output. Now that weston_output is being
split, wl_output more accurately refers to weston_head which is a single
monitor.
Change the wl_output user data to point to weston_head.
weston_output_from_resource() is replaced with
weston_head_from_resource().
This change is not strictly necessary, but architecturally it is the
right thing to do. In the future there might appear the need to refer to
a specific head of a cloned pair, for instance.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
When a surface has a buffer at creation time we send an error, which results
in a disconnection and all resources being destroyed.
Since we send that error and return before performing the configure_list init
weston_desktop_xdg_surface_destroy() will walk an uninitialized list and
dereference a NULL pointer.
Initializing the list earlier prevents this from happening.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Ensure the server can safely handle client requests for wl_seat resource
that have become inert due to weston_seat object release and subsequent
destruction.
The clean-up involves, among other things, unsetting the destroyed
weston_seat object from the user data of wl_seat resources, and handling
this NULL user data case where required.
The list of sites extracting and using weston_seat object from wl_seat
resources which were audited for this patch are:
Legend:
N/A = Not Applicable (not implemented by weston)
FIXED = Fixed in the commit
OK = Already works correctly
== keyboard_shortcuts_inhibit_unstable_v1 ==
[N/A] zwp_keyboard_shortcuts_inhibit_manager_v1.inhibit_shortcuts
== tablet_input_unstable_v{1,2} ==
[N/A] zwp_tablet_manager_v{1,2}.get_tablet_seat
== text_input_unstable_v1 ==
[FIXED] zwp_text_input_v1.activate
[FIXED] zwp_text_input_v1.deactivate
== wl_data_device ==
[FIXED] wl_data_device_manager.get_data_device
[OK] wl_data_device.start_drag
[FIXED] wl_data_device.set_selection
[OK] wl_data_device.release
== wl_shell ==
[FIXED] wl_shell_surface.move
[FIXED] wl_shell_surface.resize
[FIXED] wl_shell_surface.set_popup
== xdg_shell and xdg_shell_unstable_v6 ==
[FIXED] xdg_toplevel.show_window_menu
[FIXED] xdg_toplevel.move
[FIXED] xdg_toplevel.resize
[FIXED] xdg_popup.grab
== xdg_shell_unstable_v5 ==
[FIXED] xdg_shell.get_xdg_popup
[FIXED] xdg_surface.show_window_menu
[FIXED] xdg_surface.move
[FIXED] xdg_surface.resize
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Drop support for the obsolete xdg-shell v5 protocol. This clears the
path to properly support xdg-shell stable, since xdg-shell stable and
xdg-shell v5 can't currently co-exist in the same compositor, as both
define structures with the same name (such as struct
xdg_surface_interface).
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Proposed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
This fixes a race between Xwayland committing the surface content via
the wl_surface, and the XWM setting the role of the surface.
We now keep track of the (first) content commit on the surface and
forward it to the shell when we finally get the role.
There is no need to track later changes, as the only way for Xwayland to
unmap a surface is to destroy it.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
As discussed on
https://lists.freedesktop.org/archives/wayland-devel/2017-August/034720.html,
it's useful for the shell implementation to know when these change,
for example to relay the information on to taskbars or similar.
To avoid ABI changes or the need to make the weston_desktop_surface
definition public, new functions are introduced for attaching
listeners to these signals.
Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Change code related to touch motion events to use struct timespec to
represent time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change code related to touch up events to use struct timespec to represent
time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change code related to touch down events to use struct timespec to
represent time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change code related to key events to use struct timespec to represent
time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change code related to axis events to use struct timespec to represent
time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change code related to button events to use struct timespec to represent
time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change code related to motion events to use struct timespec to represent
time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-uninstalled.pc files are a pkg-config facility for working with
uninstalled libraries.
With pkg-config, foo-uninstalled.pc overrides foo.pc. foo-uninstalled.pc
should never be installed, and will be generated with references to the
build directory.
If you set up your environment so pkg-config looks for .pc files in your
build directories, you can use this to build and link against libraries
you haven't installed with "make install".
This can save time and space over installing with a prefix.
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
If a surface is in state A, and we just sent a configure for state B,
setting back state A would be ignored, because state B has not been
committed yet.
Now, we check against the latest configured state (which is current
state if configure list is empty).
Reported on wlroots https://github.com/swaywm/wlroots/pull/280
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
The old code for scheduling configure events on idle looked like:
if (configure_scheduled) {
if (this_event_is_the_same) {
remove_timer();
return;
}
}
If we queued one new event (either changed, or the client had never
received any configure event), followed immediately by one event which
was the same as the first, we would delete the scheduled send of the
first event.
Fix this by treating unconfigured surface as never the same.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Without this weston crashes when a client using xdg-shell-v5 is run.
Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
commit 749637a8a3
introduced this feature, but the break is outside of any conditional
so only the first item in the list is ever tested.
If a client skips a few configures and then acks the most recent
it's still operating within spec, so the break should only occur
when a match is found.
This version also adds a break after we miss the target, as a tiny
optimization (the list will be cleaned up on disconnect anyway),
as it makes the code no more difficult to read or maintain.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Shell surfaces may have a geometry that is different to the size of
their main surface, e.g. due to subcompositing.
In states where size is strictly enforced (fullscreen and maximized),
the size that the compositor wants must be checked against the window
geometry and not just the main surface size.
Fix by calling weston_desktop_surface_get_geometry and using that size
instead of main surface size.
Signed-off-by: Philipp Kerling <pkerling@casix.org>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This is a simple wrapper for casting the user data of a wl_resource into
a struct weston_output pointer. Using the wrapper clearly marks all the
places where a wl_output protocol object is used.
Replace ALL wl_output related calls to wl_resource_get_user_data() with
a call to weston_output_from_resource().
v2: add type assert in weston_output_from_resource().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
When we receive configure_notify we should update the surface's
position by calling xwayland_api->set_xwayland(). Otherwise some surfaces
like dnd surfaces from xwayland views are "stuck" at one place. When
setting XWAYLAND state though we should always call view_set_position(),
not just the first time we set this state.
Signed-off-by: Ilia Bozhinov <ammen99@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Now we keep track of serial->state association and we discard the states
that the client ignored.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
We were checking against the pending size, which lead some clients
(simple-egl) to crash because they sent a buffer before acknowledging
the latest configure event.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
When switching a state twice in a row, we were overwriting the old value
without setting it back, sending a wrong state to the client.
Now we update our requested state, then check if we need to schedule a
configure event, if we have one scheduled already or even if we can
cancel it.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Fix up the window position whenever the geometry info changes.
If the window geometry changes, we want to keep the input-responding
content anchored to top-left. It is done by manipulating the dx,dy
arguments originating from a wl_surface.attach request.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.
Add provision to relay the initial position through libweston-desktop:
- weston_desktop_api gains a new entry set_xwayland_position
- implement set_toplevel_with_position() in xwayland internal interface
Once xwayland plugin starts calling set_toplevel_with_position(),
libweston-desktop can relay that information to a shell if the shell
wants to hear it.
If a shell does not implement the set_xwayland_position hook, the
old behaviour remains: the shell positions xwayland toplevels like any
other.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Currently, layers’ order depends on the module loading order and it does
not survive runtime modifications (like shell locking/unlocking).
With this patch, modules can safely add their own layer at the expected
position in the stack, with runtime persistence.
v4 Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix three whitespace issues]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Helps tracking what happens with XWM.
Use the same debugging guard as XWM.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
X client's don't have a wl_client associated with their
weston_desktop_client, so make sure to not use it.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
No need to add protocol/, as it's already handled by an explicit
compiler include path.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
The xwayland window type XWAYLAND is not handled by the shell at all,
instead libweston-desktop maps such surfaces itself. However, it forgot
to set weston_surface::is_mapped and weston_view::is_mapped.
weston_surface::is_mapped affects the behaviour of weston_view_unmap()
and weston_surface_attach().
weston_view::is_mapped affects the behaviour of weston_view_unmap() and
weston_view_destroy().
When manually mapping a window of type XWAYLAND, mark both the view and
surface as mapped. This follows the expections in libweston, even though
the meaning of is_mapped is not clearly defined for either surface or
view.
Also, when the XWAYLAND window is manually unmapped, unmap the
weston_surface. This updates weston_surface::is_mapped to reflect the
state. However, as a side-effect it will also unmap all sibling views,
should any exist.
v2: rename surface_base to wsurface
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
Add documentation (asserts) that show that windows of types XWAYLAND are
never registered with the shell.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Setting to a constant is much easier to read and grep for than setting to
a computed variable.
There are no functional changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Add an assert to ensure that a window of type XWAYLAND is never
attempted with a parent. Following the code though, the assert can be
made even stricter by allowing only TRANSIENT to have a parent.
This is essentially adding documentation.
v2: use stricter assert
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
According to the xdg-shell v6 protocol a positioner object is only
complete if both the size and its anchor rectangle are set. Ensure the
weston clients do this and let weston be more strict on checking if a
client has done so.
This also fixes weston-terminal popups not showing up on gnome-shell
3.22.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
The wl_shell_surface spec says that it is destroyed automatically by the
server when the wl_surface is destroyed, and indeed it does not have a
destroy request. So, do that.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Fixes:
implicit conversion from enumeration type '...' to different
enumeration type '...' [-Wenum-conversion]
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Even if the surface size is already correct, we need to store the
configured size in case some other state change triggers a configure
event.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
These requests need a mapped surface, which can only happen after the
initial configure event.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
This way we are sure the compositor is aware of a surface when we
forward a request for said surface.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
With this weston_view_destroy() call, Xwayland popups make Weston freeze
in a busy-loop (probably corrupted wl_list).
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>