[mutter/wayland] wayland: Replace make_toplevel / window_unmanaging with set_window
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] wayland: Replace make_toplevel / window_unmanaging with set_window
- Date: Wed, 2 Apr 2014 15:42:20 +0000 (UTC)
commit 3c404c5db3b08219154e832c05ce4cfcfb5d6277
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Apr 2 10:37:08 2014 -0400
wayland: Replace make_toplevel / window_unmanaging with set_window
The make_toplevel / window_unmanaging interface has never made
a lot of sense to me. Replace it with set_window, which does
effectively the same thing.
It's still not perfect in the case of XWayland, but I don't think
XWayland will ever make me happy.
src/core/window.c | 2 +-
src/wayland/meta-wayland-surface.c | 40 ++++++++++++++++++------------------
src/wayland/meta-wayland-surface.h | 4 +-
src/wayland/meta-xwayland.c | 4 +--
4 files changed, 24 insertions(+), 26 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 1deece0..0ba7980 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1468,7 +1468,7 @@ meta_window_unmanage (MetaWindow *window,
/* This needs to happen for both Wayland and XWayland clients,
* so it can't be in MetaWindowWayland. */
if (window->surface)
- meta_wayland_surface_window_unmanaged (window->surface);
+ meta_wayland_surface_set_window (window->surface, NULL);
if (window->visible_to_compositor)
{
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 2eb32ec..2c49c47 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -549,16 +549,13 @@ const struct wl_surface_interface meta_wayland_surface_interface = {
};
void
-meta_wayland_surface_make_toplevel (MetaWaylandSurface *surface)
+meta_wayland_surface_set_window (MetaWaylandSurface *surface,
+ MetaWindow *window)
{
- clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), TRUE);
-}
+ gboolean has_window = (window != NULL);
-void
-meta_wayland_surface_window_unmanaged (MetaWaylandSurface *surface)
-{
- clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), FALSE);
- surface->window = NULL;
+ clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), has_window);
+ surface->window = window;
}
static void
@@ -909,6 +906,7 @@ xdg_shell_get_xdg_surface (struct wl_client *client,
struct wl_resource *surface_resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
+ MetaWindow *window;
if (!create_surface_extension (&surface->xdg_surface,
META_XDG_SURFACE_VERSION,
@@ -923,8 +921,8 @@ xdg_shell_get_xdg_surface (struct wl_client *client,
return;
}
- meta_wayland_surface_make_toplevel (surface);
- surface->window = meta_window_wayland_new (meta_get_display (), surface);
+ window = meta_window_wayland_new (meta_get_display (), surface);
+ meta_wayland_surface_set_window (surface, window);
}
static void
@@ -962,6 +960,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource);
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
+ MetaWindow *window;
if (parent_surf == NULL || parent_surf->window == NULL)
return;
@@ -979,15 +978,15 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
return;
}
- meta_wayland_surface_make_toplevel (surface);
- surface->window = meta_window_wayland_new (meta_get_display (), surface);
- surface->window->rect.x = parent_surf->window->rect.x + x;
- surface->window->rect.y = parent_surf->window->rect.y + y;
- surface->window->showing_for_first_time = FALSE;
- surface->window->placed = TRUE;
- meta_window_set_transient_for (surface->window, parent_surf->window);
+ window = meta_window_wayland_new (meta_get_display (), surface);
+ window->rect.x = parent_surf->window->rect.x + x;
+ window->rect.y = parent_surf->window->rect.y + y;
+ window->showing_for_first_time = FALSE;
+ window->placed = TRUE;
+ meta_window_set_transient_for (window, parent_surf->window);
+ meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU);
- meta_window_set_type (surface->window, META_WINDOW_DROPDOWN_MENU);
+ meta_wayland_surface_set_window (surface, window);
meta_wayland_pointer_start_popup_grab (&seat->pointer, surface);
}
@@ -1270,6 +1269,7 @@ wl_shell_get_shell_surface (struct wl_client *client,
struct wl_resource *surface_resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
+ MetaWindow *window;
if (!create_surface_extension (&surface->wl_shell_surface,
META_WL_SHELL_SURFACE_VERSION,
@@ -1284,8 +1284,8 @@ wl_shell_get_shell_surface (struct wl_client *client,
return;
}
- meta_wayland_surface_make_toplevel (surface);
- surface->window = meta_window_wayland_new (meta_get_display (), surface);
+ window = meta_window_wayland_new (meta_get_display (), surface);
+ meta_wayland_surface_set_window (surface, window);
}
static const struct wl_shell_interface meta_wayland_wl_shell_interface = {
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index e088653..25fe83c 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -111,8 +111,8 @@ MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *composit
guint32 id,
guint32 version);
-void meta_wayland_surface_make_toplevel (MetaWaylandSurface *surface);
-void meta_wayland_surface_window_unmanaged (MetaWaylandSurface *surface);
+void meta_wayland_surface_set_window (MetaWaylandSurface *surface,
+ MetaWindow *window);
void meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
int width,
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 7748b12..d261ca7 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -54,9 +54,7 @@ xserver_set_window_id (struct wl_client *client,
if (window->surface)
window->surface->window = NULL;
- meta_wayland_surface_make_toplevel (surface);
-
- surface->window = window;
+ meta_wayland_surface_set_window (surface, window);
window->surface = surface;
meta_compositor_window_surface_changed (display->compositor, window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]