This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.
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.
Commit 9aa8ce69 forgot to set shsurf->fullscreen_output in
fullscreen_binding(), causing segfault when fullscreening using key
bindings. This patch fixes that.
https://bugs.freedesktop.org/show_bug.cgi?id=79828
Signed-off-by: Boyan Ding <stu_dby@126.com>
Fixes a crash on touch devices without a pointer, when touching
the window frame of a client.
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
With most of the code in send_configure_for_surface, the helper
methods don't give us that much benefit, so stop using them. We
can't kill them off, as they're part of the shell interface and
used by the WM.
Currently, there's a giant bug in how xdg-shell state management
is done. If a client calls set_fullscreen and then set_maximized,
it will get two configure events:
=> set_fullscreen
<= configure(800, 600, [STATE_FULLSCREEN])
=> set_maximized
<= configure(800, 560, [STATE_FULLSCREEN, STATE_MAXIMIZED])
Since fullscreen takes precedence over maximized, the client will
render full-screen at 800x600 first, and then 800x560 next. As
a result, the surface gets the wrong size.
This is because the code that sends out configure requests is
"immediate" -- when an app calls set_maximized, we immediately
send out the configure event that would have happened if we
transitioned immediately into maximized mode.
In wl_shell, this is correct behavior. However, in xdg-shell,
this is wrong. State needs to be more carefully managed in
xdg-shell, as states aren't exclusive.
Pull all the code that sends out configure events out and send
them centrally, based on Weston's on surface state management.
This should work with both wl_shell and xdg_shell's strategies.
Currently, there's a race condition. When resizing from the left, and
a client attaches a buffer after the resize ends, you suddenly see the
buffer jump to the right, because the resize ended while multiple
attaches were in-flight. Making resize a state can fix this, as the
server can now know exactly when the resize ended, and whether a commit
was before or after that place.
We don't implement the correct tracking in this commit; that's left as
an exercise to the reader.
Additionally, clients like terminals might want to display resize popups
to display the number of cells when in a resize. They can use the hint
here to figure out whether they are resizing.
The states system, so far, has been a complicated mix of weird APIs
that solved a real race condition, but have been particularly ugly
for both compositors and clients to implement.
It's a confusing name that comes from the ICCCM. The ICCCM is best
forgotten about.
With the addition of the potential new "transient" role meaning a
parent-relative toplevel like a long-lived popup, used for e.g.
tooltips, the set_transient_for name will become even more confusing.
The check to avoid calling weston_keyboard_set_focus() for a seat that
didn't have a keyboard in restore_focus_state() was cheking the wrong
seat (the one from the previous loop). That caused a crash when
switching workspaces if there was an extra seat that didn't have a
keyboard.
https://bugs.freedesktop.org/show_bug.cgi?id=78349
Views that extend past the bottom of the output are still visible after
the workspace animation ends but before its layer is hidden. When the
layer was hidden, nothing would cause those regions to be repainted,
leading to artifacts.
https://bugs.freedesktop.org/show_bug.cgi?id=78363
With xdg_shell wl_shell starting to diverge in how they work, there's
less shared code in set_fullscreen(). The problem is that the xwayland
window manager calls into set_fulscreen() which now doesn't complete
the fullscreen transition. Add shell_interface_set_fullscreen() for
the shell interface set_fullscreen hook to use.
https://bugs.freedesktop.org/show_bug.cgi?id=78230
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.
This moves the check for shsurf->grabbed into surface_move() and
surface_resize(), which are shared with the xwayland code. This prevents
trying to resize or move an xwayland window with multiple pointers.
9c376b54ea fixed the crash when a client goes
away during a resize grab. The shsurf->resource is set to NULL in that
case and we were trying to send out events to a NULL resource. However,
xwayland shell surfaces are created by the xwayland module and don't have a
resource. We use a different function pointer for sending the configure
events that handle the events inside xwayland instead of sending protocol
events.
To fix all this, we just move the check for a NULL resource into the
functions that we use for sending configure events for wl_shell and
xdg_shell.
The geometry for visible views will keep unchanged,
weston_view_set_position() doesn't mark these views
as dirty. So there is no chance for them to reassign output, then
these views will disappear.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=72946
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
When commit 07926d90 factored out the code that chooses in which layer
a surface is added to, it changed the behavior for surfaces with no
type. Instead of not adding it to any layer, the surface is added to
the current workspace.
This patch restores the old behavior.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77527
Previously, desktop-shell would only create its internal shell_seat object
for each seat available when the desktop-shell module is loaded. This is a
problem any time seats are created dynamically. In particular, the Wayland
and RDP backends create seats on an as-needed basis and they weren't
getting picked up proprely by desktop-shell.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77649
lower_fullscreen_surface() was removing fullscreen surfaces from
the fullscreen layer and inserting them in the normal workspace
layer. However, those fullscreen surfaces were never put back in
the fullscreen layer, causing bugs such as unrelated surfaces
being drawn between a fullscreen surface and its black view.
Change the lower_fullscreen_surface() logic so that it lowers
fullscreen surfaces to the workspace layer *and* hides the
black views. Make this reversible by re-configuring the lowered
fullscreen surface: when it is re-configured, the black view
will be shown again and the surface will be restacked in the
fullscreen layer.
https://bugs.freedesktop.org/show_bug.cgi?id=73575https://bugs.freedesktop.org/show_bug.cgi?id=74221https://bugs.freedesktop.org/show_bug.cgi?id=74222
If a client exists during a resize grab, the resource for the shell
surface being resized is destroyed. The shell surface is not destroyed
immediately, however, because of the window close animation. In that
case, the compositor would crash trying to send configure events to
the surface being resized, since it would pass a NULL pointer to
wl_resource_post_event().
The code for the resize grab was already able to handle the surface
going away, so expand it to also handle the resource going away and
fix the crash.
https://bugs.freedesktop.org/show_bug.cgi?id=77344
In order to do the window close animation, a reference for a destroyed
surface is kept. However, the reference count was also increased for
unmapped surfaces, in which case the animation wouldn't run. Since the
reference count was decremented in the animation done function, it would
never be decreased for unmapped surfaces, causing them to not be
released.
The close animation also changed how shell surfaces are released. The
destroy function for its resource was changed to not deallocate the
surface, and instead keep it around until the animation finishes and
the weston surface is destroyed. The destruction should happen in the
destroy listener for the weston surface, but it wouldn't destroy the
shell surface in the case the resource was still valid, assuming that
it would be freed in the resource destroy function.
We now carry the shell_client around with each shell_surface. This is much
more reliable than tacitly assuming that there is only one wl_shell or
xdg_shell instance bound to a particular wl_client. In particular, weston
would crash when a client bound to both wl_shell and xdg_shell even if it
only ever used one of them.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Previously, the repositioning logic would iterate the compositor's list
of layers and move the views on those layers. However, that failed in
two different ways: it didn't cover hidden workspaces and crashed when
the display was locked.
This patch changes the logic to explicit iterate over all the layers
owned by the shell. The iteration is done through a helper function,
shell_for_each_layer().
https://bugs.freedesktop.org/show_bug.cgi?id=76859https://bugs.freedesktop.org/show_bug.cgi?id=77290
When a fullscreen surface gets the maximized state, the function
reset_surface_type() is called and that causes unset_fullscreen() to be
called. That function would set the value of shsurf->fullscreen_output
to NULL. However, since the surface still has the fullscreen state, it
will be configured as a fullscreen surface again, and an attempt to
access that field would cause the compositor to crash.
Fix the crash by keeping the value of fullscreen_output around after
unset_fullscreen(). This is safe since the value is only used when a
surface has the fullscreen state and is replaced on a new request to
make the surface fullscreen.
https://bugs.freedesktop.org/show_bug.cgi?id=76867
The timer was left running after the screensaver was terminated. When
it triggered, a fade out that would in turn cause the screen to be
locked was started. Since that could happen without the compositor
emitting the idle signal, there would be no wake signal to make the
shell show the lock screen, so the system was left unresponsive
until the idle signal actually triggered.
https://bugs.freedesktop.org/show_bug.cgi?id=70923
Before commit 2f5faff7f9 when the compositor is locked it would
reset the keyboard focus on all of the seats as part of pushing the
focus_state. This was removed because it now always keeps track of the
focus_state in the workspace instead of waiting until the state is
pushed. However this had the side effect that the active surface would
retain focus when the compositor is locked. This patch just makes it
explicitly set the keyboard focus to NULL on all of the seats when
locking. This will be restored based on the workspace's state when
unlocking.
https://bugs.freedesktop.org/show_bug.cgi?id=73905
The focus_state list on a workspace only contains entries for seats
which have a keyboard focus on that workspace. For workspaces that
have no surfaces the list will be empty. That means that when a
workspace with no surfaces is switched to it would previously leave
the keyboard focus unaffected and you could still type in the surface
on the old workspace.
This patch makes it instead reset the keyboard focus to NULL for seats
without a focus_state. It does this by temporarily stealing the
compositor's list of seats while it iterates the focus_states. After
all of the focus states have been processed any seats remaining in
this temporary list have their focus reset.
https://bugs.freedesktop.org/show_bug.cgi?id=73905
Commit c85f1d45 caused the move of an unresponsive surface to be no
longer possible, since the grabbed flag would prevent the move grab
to start while the busy grab was still active.
The shell_destroy_shell_surface function only set the backing resource to
NULL, leaving an unusable surface in the popup_grab list until the surface's
fading animation finished and it could be freed. This caused a segfault if
the shell tried to forcibly break the grab during that time interval due to
the compositor losing the keyboard focus.
https://bugs.freedesktop.org/show_bug.cgi?id=77072
When a client calls the input panel (weston-keyboard e.g.)
and then goes fullscreen, the panel will not be hidden
anymore.
Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>