This provides an example of keeping a weston_surface alive after the client
destroys it. We install a destroy listener for the resource, so that we'll
be notifified when the client destroys it. Then we increase the weston_surface
refcount so that we keep the surface and initiate an animation. When
the animation finishes we can finally destroy the surface.
Rather than require that the client implement two methods for every state,
simply have one global request, change_state, and one global event,
request_change_state.
When a view was destroyed while we were on exposay, we didn't
remove it from the list of views, and so when leaving exposay
we were trying to animate (and sometimes activate) a
non-existent view, causing a crash.
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
This was always a little iffy. At least it could have been a signal,
but we now have focus signal, so lets just use that. We lose
the ability to detect unresponsive clients at key event time, but we
could add that back by adding a key_signal.
Use a static assert to catch mismatch between implementation and
interface version. Fix window.c to not use XDG_SHELL_VERSION_CURRENT,
which will fail to catch version mismatches. The implementation version
must updated manually when the implementation is updated to use the new
interface.
Responsivenes is a per-client thing so we move the ping/pong functionality
to xdg_shell. Having this per-window was carries over from the EWMH
protocol, where the WM has no other way to do this. In wayland, the
compositor can directly ping the client that owns the surface.
This is used to figure out the size of "invisible" decorations, which we'll
use to better know the visible extents of the surface, which we can use for
constraining, titlebars, and more.
Remove the listener for output destroy from weston_view and instead
iterate views owned by the shell in its own output destroy listener.
This simplifies the code a bit since keeping the view listening for the
destroy on the right output was a bit complicated. This also removes the
function pointer output_destroyed from weston_view. The only user for it
was desktop shell, but now this is all handled in shell.c.
Since that signal is per output, it is necessary to track in which
output a view is in so that the signal is handled properly.
Instead, add a compositor wide output moved signal, that is handled by
the shell. The shell iterates over the layers it owns to move views
appropriately.
When xwayland creates a shell surface we don't have a resource. The
recently added shell_surface_is_wl_shell/xdg_surface() tests don't
handle that very well.
For now, we assume that a surface without a resource is created from
xwayland and is a wl_shell surface. We'll want to modify that to be a
xdg surface eventually, but for now this stops weston from crashing.
Since commit 9046d2, when destroying a surface, we remove all the
links from its children. But when the child surfaces are destroyed,
those links will be removed again, but since they were not properly
initialized, weston will crash.
Call shell_surface_set_parent instead which removes the link and
sets parent while also initializing the link, thus avoiding this
crash.
We don't have focus-follows-mouse, so it makes more sense to
maximize or fullscreen the surface that has the keyboard focus,
not the one behind the pointer.
We have to move the surface destroy listener around as we track the
currently focused surface. Introduce a helper function,
focus_state_set_focus() for this and use throughout.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73768
Various functions that operate on a weston_surface assume the
surface has a shell_surface. That is, they unconditionally
deref the get_shell_surface() result. Hence, if for some reason
the call to get_shell_surface() returned NULL to those functions then
a segmentation fault would occur and the program would crash. So,
adding an assert(...) on the get_shell_surface() return value adds an
extra sanity check and does not change this behavior. The assert also
adds an extra benefit to the programmer by documenting that the function
expects and requires the weston_surface to have a shell_surface and
would be a program logic error, otherwise.
The assert() also silences some static analyzers about the possible
NULL deref.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
exposay_highlight_surface() is called from exposay_pick(),
exposay_layout(), and exposay_maybe_move() where the esurface
parameter is already validated prior to the call. This makes
the 'esurface' NULL check redundant. This assumes any future
calls to exposay_highlight_surface() will also validate the
'esurface' parameter prior to the call.
This fixes the logic in exposay_highlight_surface so static
analyzers don't complain about the possibility that 'view'
might be NULL deref'd when a 'esurface' == NULL condition is
true.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
When the last window of the X11 compositor is closed during a fade or
while locked, we'll try to start a fade back to the lock screen. However,
if we closed the last window, there are no outputs left and the animation
will try to run with surface->output == NULL.
https://bugs.freedesktop.org/show_bug.cgi?id=73665
This is part of the fix for bug 72540. We cancel the popup grab when the
screensaver kicks in so that the screen unlock dialog can get input events.
The bigger problem is in mesa however, where we try to allocate new buffers
as cairo-gles2 does a gratuituous (but valid) eglMakeCurrent() as we
remove the tooltip or popup-menu.
Since we removed the weston_layer with the regular surfaces, EGL blocks
waiting for a frame event that never comes.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=72540
The grab stays alive as long as at least one touch point is down. If touch
point 0 is lifted while other touch points are down, the surface will jump
around when touch point 0 is put down again.
This change marks the grab as inactive once touch point 0 is lifted
and then ignores touch events until all touch points eventually are
lifted and the grab terminates.
https://bugs.freedesktop.org/show_bug.cgi?id=73750
Add a config file option to enable it, but leave it off by default. Exposay
still triggers too many lock-ups or stuck grabs and triggers under X even
when the Wayland window doesn't have keyboard focus.
We now track the child surfaces of a shell surface and the child surfaces
have a pointer back to their parent. We need to clean all this up and
NULL out the childrens parent pointers when a shell surface is destroyed.
Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72931
The keyboard is too chatty, make it use a dbg() function for logging
which defaults to disabled.
Also drop a noisy fprintf() in input_panel_configure().
It's possible to touch a surface to move it and let go before we get
to common_surface_move(), in which case we don't have a touch focus
when we get there. For pointers, we could click a surface, but have the
surface go away before we get to common_surface_move(), in which
case the button count is non-zero, but we don't have a surface.
In either case we crash, so let's add a check to make sure we still
have a focus surface before we try to move it.
Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73448
This fixes the crash when move, rotate or resize binding is activated
while exposay effect is active.
Steps to reproduce:
- activate exposay
- try to rotate the surface with mod + right mouse button
- crash
Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72885
We were calling exposay_highlight_surface() inside a wl_list_for_each
loop for a layer, but exposay_highlight_surface() calls activate()
which calls shell_surface_update_layer(), which removes the surface
from its layer and reinserts it, causing an infinite loop.
Call exposay_highlight_surface() outside the for_each to avoid this.
https://bugs.freedesktop.org/show_bug.cgi?id=72404