When we moved the configure event size to being based on the window
geometry, we changed the coordinates of the configure request to being
frame geometry based. Frame geometry includes titlebar and border, but
not shadow margins.
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The seat picked in weston_wm_window_handle_moveresize can sometimes
be NULL when it is (somehow) triggered with all buttons released.
This patch checks whether the seat is NULL to avoid NULL dereference.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80837
Signed-off-by: Boyan Ding <stu_dby@126.com>
If X windows are created and destroyed very fast sometimes the WM window
object gets created and destroyed before we get around to handling client
messages. Failing to check that the window is still valid can result in a
segfault.
When Xwayland requests that a wl_surface be created and the X event is
handled before the wayland requests, a surface ID is stored to
window->surface_id and the window is added to the unpaired window list. When
weston_wm_create_surface is called, the window is removed from the list and
window->surface_id is set to zero. If window->surface_id is not zero when
weston_wm_window_destroy is called, the window is assumed to be in the
unpaired window list and wl_list_remove is called. If
weston_wm_window_handle_surface_id is called and the surface has already
been created, the window is not added to the unpaired window list, but
window->surface_id isn't set to zero. When the window is destroyed, removing
the window from the list is attempted anyway and a crash occurs.
This patch stores the surface ID in a temporary variable and only assigns it
to window->surface_id when the window is added to the unpaired window list.
Otherwise window->surface_id is set to zero to maintain its use as a flag
variable.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80273
Signed-off-by: Tyler Veness <calcmogul@gmail.com>
Currently, there is a fun flicker when toggling maximization or
fullscreen on a window in mutter or more sophisicated compositors
and WMs.
What happens is that the client want so go maximized, so we
calculate the size that we want the window to resize to (640x480),
and then add on its margins to find the buffer size (+10 = 660x500),
and then send out a configure event for that size. The client
renders to that size, realizes that it's maximized, and then
says "oh hey, my margins are actually 0 now!", and so the compositor
has to send out another configure event.
In order to fix this, make the the configure request correspond to
the window geometry we'd like the window to be at. At the same time,
replace set_margin with set_window_geometry, where we specify a rect
rather than a border around the window.
send_configure was originally modelled after
wl_shell_surface::send_configure, which takes these arguments. However,
the X WM and xdg_surface::configure variants don't use these arguments.
We already store the resize edges for a surface while it's being
resized, so just use the saved state in the wl_shell_surface variant.
Make sure we're looking at the right location. The frame could have
received a motion event from a pointer from a different wl_seat, but
under X it looks like our core pointer moved. Move the frame pointer
to the button press location before deciding what to do.
If we're going to move or resize an xwayland surface, we used to just
pick the first seat in the list for doing the move/resize. Ideally we
can map from the XInput device doing the click to the corresponding
weston_seat, but that requires using xcb xinput, which isn't well supported.
Instead, lets use a simple heuristic that just picks the pointer that
most recently delivered a button event to the window in question.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73807
Set up X windows that are transient for another window as transient
surfaces in shell.c. This keeps the transient windows on top of their
parent as windows are raised, lowered for fullscreened.
https://bugs.freedesktop.org/show_bug.cgi?id=69443
This fixes crashes caused by popup windows that don't have override_redirect
(e.g., menus in VLC and KDE apps).
Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Fixes a crash caused by accessing a deleted view in weston_wm_window_schedule_repaint. It can be easily reproduced by switching between menus in Firefox.
Signed-off-by: Dima Ryazanov <dima@gmail.com>
The logic here broke at some point so that we would only update the
input region for non-fullscreen windows. Thus, a fullscreen window would
be stuck with whatever size the most recent non-fullscreen size was.
https://bugs.freedesktop.org/show_bug.cgi?id=69219
The weston_surface structure is split into two structures:
* The weston_surface structure storres everything required for a
client-side or server-side surface. This includes buffers; callbacks;
backend private data; input, damage, and opaque regions; and a few other
bookkeeping bits.
* The weston_view structure represents an entity in the scenegraph and
storres all of the geometry information. This includes clip region,
alpha, position, and the transformation list as well as all of the
temporary information derived from the geometry state. Because a view,
and not a surface, is a scenegraph element, the view is what is placed
in layers and planes.
There are a few things worth noting about the surface/view split:
1. This is *not* a modification to the protocol. It is, instead, a
modification to Weston's internal scenegraph to allow a single surface
to exist in multiple places at a time. Clients are completely unaware
of how many views to a particular surface exist.
2. A view is considered a direct child of a surface and is destroyed when
the surface is destroyed. Because of this, the view.surface pointer is
always valid and non-null.
3. The compositor's surface_list is replaced with a view_list. Due to
subsurfaces, building the view list is a little more complicated than
it used to be and involves building a tree of views on the fly whenever
subsurfaces are used. However, this means that backends can remain
completely subsurface-agnostic.
4. Surfaces and views both keep track of which outputs they are on.
5. The weston_surface structure now has width and height fields. These
are populated when a new buffer is attached before surface.configure
is called. This is because there are many surface-based operations
that really require the width and height and digging through the views
didn't work well.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
We get the child position but never use this information here. Just remove it.
Spotted by Christopher Michael.
Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
the unmap event will be followed by the deletion of the weston_surface,
so the shell_surface will also be deleted by the shell. Having removed
the surface_destroy_listener, the surface_destroy callback doesn't
get called, so reset the value of shsurf here.
We used to destroy the frame window and reparent the client window to
wm_window. That means that we lose the destroy_notify event when the
client window is destroyed later, since we don't select for
substructure_notify on wm_window.
Instead of destroying and reparenting, just unmap the frame window.
window->x/y is the coordinate of the top-level surface (whether that's
the frame window or an override-redirect window) and the wayland surface
should be placed there, without the t->margin offset.
The coordinate transformation was broken (worked for first output where
output->x/y was 0,0, broke on all other outputs). We can just use
surface->geometry.x/y directly. We can't use the full transformation,
the best we can do is to move the X window to the geometry.x/y location.
Get rid of the static old_sx/sy hack as well.
We only get configure notify for toplevel (frame or override-redirect window)
and those are the cases where we want to update window->x/y. The way the
code worked, we'd exit immeidately in those cases and window->x/y would
not be updated.
We can get a destroy notify for the frame window after we've removed it
from the hash table. This turns into a NULL pointer deref when we look up
the window and try to use it for debugging printout.
Fixes the failing xwayland test case.
Window contents cannot be assumed to be fully opaque for windows drawn with
a RGBA visual. The optimization of setting a full opaque region is limited to
windows with a color depth != 32.
xeyes works as expected now. subwindows are popped also as expected. This
patch should fix the following:
https://bugs.freedesktop.org/show_bug.cgi?id=59983
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>