mirror of
https://github.com/brl/mutter.git
synced 2025-02-20 15:04:09 +00:00
wayland: Move surface check to MetaWaylandSurface
Allows dropping various HAVE_XWAYLAND ifdef as the function would always return false if Mutter is built without XWayland Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
This commit is contained in:
parent
a27b9d9707
commit
02a436d607
@ -92,8 +92,7 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
|||||||
MetaWaylandSurfaceRole *role = META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
MetaWaylandSurfaceRole *role = META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
||||||
MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role);
|
MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role);
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
if (!meta_wayland_surface_is_xwayland (surface))
|
||||||
if (!meta_xwayland_is_xwayland_surface (surface))
|
|
||||||
{
|
{
|
||||||
MetaWaylandSurfaceRole *surface_role =
|
MetaWaylandSurfaceRole *surface_role =
|
||||||
META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
||||||
@ -123,7 +122,6 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
|||||||
surface->buffer_transform);
|
surface->buffer_transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
meta_wayland_surface_update_outputs (surface);
|
meta_wayland_surface_update_outputs (surface);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ surface_constraint_data_new (MetaWaylandSurface *surface)
|
|||||||
connect_window (data, window);
|
connect_window (data, window);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
else if (meta_xwayland_is_xwayland_surface (surface))
|
else if (meta_wayland_surface_is_xwayland (surface))
|
||||||
{
|
{
|
||||||
data->window_associated_handler_id =
|
data->window_associated_handler_id =
|
||||||
g_signal_connect (surface->role, "window-associated",
|
g_signal_connect (surface->role, "window-associated",
|
||||||
@ -475,7 +475,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
|||||||
* For subsurfaces the window of the ancestor might be gone already.
|
* For subsurfaces the window of the ancestor might be gone already.
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
g_warn_if_fail (meta_xwayland_is_xwayland_surface (constraint->surface) ||
|
g_warn_if_fail (meta_wayland_surface_is_xwayland (constraint->surface) ||
|
||||||
META_IS_WAYLAND_SUBSURFACE (constraint->surface->role));
|
META_IS_WAYLAND_SUBSURFACE (constraint->surface->role));
|
||||||
#endif
|
#endif
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -488,8 +488,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
|||||||
if (constraint->seat->pointer->focus_surface != constraint->surface)
|
if (constraint->seat->pointer->focus_surface != constraint->surface)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
if (meta_wayland_surface_is_xwayland (constraint->surface))
|
||||||
if (meta_xwayland_is_xwayland_surface (constraint->surface))
|
|
||||||
{
|
{
|
||||||
MetaDisplay *display = meta_window_get_display (window);
|
MetaDisplay *display = meta_window_get_display (window);
|
||||||
|
|
||||||
@ -511,7 +510,6 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
|||||||
display->focus_window->client_type != META_WINDOW_CLIENT_TYPE_X11)
|
display->focus_window->client_type != META_WINDOW_CLIENT_TYPE_X11)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!meta_window_appears_focused (window))
|
if (!meta_window_appears_focused (window))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -632,9 +630,7 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo
|
|||||||
MetaFrame *frame = window->frame;
|
MetaFrame *frame = window->frame;
|
||||||
int actual_width, actual_height;
|
int actual_width, actual_height;
|
||||||
|
|
||||||
#ifdef HAVE_XWAYLAND
|
g_assert (meta_wayland_surface_is_xwayland (constraint->surface));
|
||||||
g_assert (meta_xwayland_is_xwayland_surface (constraint->surface));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
actual_width = window->buffer_rect.width - (frame->child_x +
|
actual_width = window->buffer_rect.width - (frame->child_x +
|
||||||
frame->right_width);
|
frame->right_width);
|
||||||
|
@ -2396,3 +2396,17 @@ meta_wayland_surface_get_compositor (MetaWaylandSurface *surface)
|
|||||||
{
|
{
|
||||||
return surface->compositor;
|
return surface->compositor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_wayland_surface_is_xwayland (MetaWaylandSurface *surface)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_XWAYLAND
|
||||||
|
MetaWaylandCompositor *compositor = surface->compositor;
|
||||||
|
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||||
|
|
||||||
|
return surface->resource != NULL &&
|
||||||
|
wl_resource_get_client (surface->resource) == manager->client;
|
||||||
|
#else
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -419,6 +419,7 @@ meta_wayland_surface_state_new (void)
|
|||||||
{
|
{
|
||||||
return g_object_new (META_TYPE_WAYLAND_SURFACE_STATE, NULL);
|
return g_object_new (META_TYPE_WAYLAND_SURFACE_STATE, NULL);
|
||||||
}
|
}
|
||||||
|
gboolean meta_wayland_surface_is_xwayland (MetaWaylandSurface *surface);
|
||||||
|
|
||||||
static inline GNode *
|
static inline GNode *
|
||||||
meta_get_next_subsurface_sibling (GNode *n)
|
meta_get_next_subsurface_sibling (GNode *n)
|
||||||
|
@ -1033,7 +1033,7 @@ meta_xwayland_dnd_handle_xfixes_selection_notify (MetaWaylandCompositor *composi
|
|||||||
focus = compositor->seat->pointer->focus_surface;
|
focus = compositor->seat->pointer->focus_surface;
|
||||||
|
|
||||||
if (event->owner != None && event->owner != x11_display->selection.xwindow &&
|
if (event->owner != None && event->owner != x11_display->selection.xwindow &&
|
||||||
focus && meta_xwayland_is_xwayland_surface (focus))
|
focus && meta_wayland_surface_is_xwayland (focus))
|
||||||
{
|
{
|
||||||
dnd->source = meta_wayland_data_source_xwayland_new (dnd, compositor);
|
dnd->source = meta_wayland_data_source_xwayland_new (dnd, compositor);
|
||||||
meta_wayland_data_device_set_dnd_source (&compositor->seat->data_device,
|
meta_wayland_data_device_set_dnd_source (&compositor->seat->data_device,
|
||||||
|
@ -146,16 +146,6 @@ meta_xwayland_handle_wl_surface_id (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface)
|
|
||||||
{
|
|
||||||
MetaWaylandCompositor *compositor = surface->compositor;
|
|
||||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
|
||||||
|
|
||||||
return surface->resource != NULL &&
|
|
||||||
wl_resource_get_client (surface->resource) == manager->client;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
try_display (int display,
|
try_display (int display,
|
||||||
char **filename_out,
|
char **filename_out,
|
||||||
|
@ -39,9 +39,6 @@ void
|
|||||||
meta_xwayland_handle_wl_surface_id (MetaWindow *window,
|
meta_xwayland_handle_wl_surface_id (MetaWindow *window,
|
||||||
guint32 surface_id);
|
guint32 surface_id);
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_xwayland_handle_xwayland_grab (MetaWindow *window,
|
meta_xwayland_handle_xwayland_grab (MetaWindow *window,
|
||||||
gboolean allow);
|
gboolean allow);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user