mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
view: add view_is_related()
Allows removing xwayland-specific stuff from seat.c. Based on a suggestion from @Consolatis. v2: add comments
This commit is contained in:
parent
9b0031aec4
commit
5c4038493f
4 changed files with 38 additions and 21 deletions
25
src/seat.c
25
src/seat.c
|
|
@ -13,10 +13,6 @@
|
|||
#include "labwc.h"
|
||||
#include "view.h"
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
input_device_destroy(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -357,30 +353,17 @@ focus_change_notify(struct wl_listener *listener, void *data)
|
|||
struct view *view = event->new_surface ?
|
||||
view_from_wlr_surface(event->new_surface) : NULL;
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
/*
|
||||
* If an xwayland-unmanaged surface was focused belonging to the
|
||||
* same application as the focused view, allow the view to remain
|
||||
* active. This fixes an issue with menus immediately closing in
|
||||
* some X11 apps (try LibreOffice with SAL_USE_VCLPLUGIN=gen).
|
||||
*/
|
||||
struct wlr_surface *old_surface =
|
||||
server->focused_view ? server->focused_view->surface : NULL;
|
||||
|
||||
if (old_surface && event->new_surface && !view
|
||||
&& wlr_surface_is_xwayland_surface(old_surface)
|
||||
&& wlr_surface_is_xwayland_surface(event->new_surface)) {
|
||||
struct wlr_xwayland_surface *old_xsurface =
|
||||
wlr_xwayland_surface_from_wlr_surface(old_surface);
|
||||
struct wlr_xwayland_surface *new_xsurface =
|
||||
wlr_xwayland_surface_from_wlr_surface(event->new_surface);
|
||||
|
||||
if (old_xsurface && new_xsurface
|
||||
&& old_xsurface->pid == new_xsurface->pid) {
|
||||
return;
|
||||
}
|
||||
if (!view && server->focused_view && event->new_surface
|
||||
&& view_is_related(server->focused_view,
|
||||
event->new_surface)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (view != server->focused_view) {
|
||||
if (server->focused_view) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue