xwayland: Split a helper out

This will make the next commit, which ports to the new ClientMessage
API, more understandable.
This commit is contained in:
Jasper St. Pierre 2014-04-02 10:19:39 -04:00
parent e07bd15fc2
commit 9653b79a35

View File

@ -37,6 +37,25 @@
#include "meta-window-actor-private.h"
#include "xserver-server-protocol.h"
static void
associate_window_with_surface (MetaWindow *window,
MetaWaylandSurface *surface)
{
MetaDisplay *display = window->display;
/* If the window has an existing surface, like if we're
* undecorating or decorating the window, then we need
* to detach the window from its old surface.
*/
if (window->surface)
window->surface->window = NULL;
meta_wayland_surface_set_window (surface, window);
window->surface = surface;
meta_compositor_window_surface_changed (display->compositor, window);
}
static void
xserver_set_window_id (struct wl_client *client,
struct wl_resource *compositor_resource,
@ -51,17 +70,7 @@ xserver_set_window_id (struct wl_client *client,
if (!window)
return;
/* If the window has an existing surface, like if we're
* undecorating or decorating the window, then we need
* to detach the window from its old surface.
*/
if (window->surface)
window->surface->window = NULL;
meta_wayland_surface_set_window (surface, window);
window->surface = surface;
meta_compositor_window_surface_changed (display->compositor, window);
associate_window_with_surface (window, surface);
}
static const struct xserver_interface xserver_implementation = {