[PATCH xserver 3/3] xwayland: Attach and configure window only when asked by Wayland
Tiago Vignatti
tiago.vignatti at intel.com
Fri Nov 30 11:20:15 PST 2012
Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
hw/xfree86/xwayland/xserver.xml | 33 +++++++++++++++++
hw/xfree86/xwayland/xwayland-private.h | 3 ++
hw/xfree86/xwayland/xwayland-window.c | 7 +---
hw/xfree86/xwayland/xwayland.c | 62 +++++++++++++++++++++++++++++++-
4 files changed, 98 insertions(+), 7 deletions(-)
diff --git a/hw/xfree86/xwayland/xserver.xml b/hw/xfree86/xwayland/xserver.xml
index 907c882..3779d1a 100644
--- a/hw/xfree86/xwayland/xserver.xml
+++ b/hw/xfree86/xwayland/xserver.xml
@@ -34,6 +34,29 @@
</description>
<arg name="fd" type="fd"/>
</event>
+
+ <event name="map">
+ <description summary="notify X when window can be mapped">
+ Notify X that Window 'id' is ready to be mapped. Effectively this
+ happens after compositor receiving wm.map from WM.
+ </description>
+
+ <arg name="id" type="uint"/>
+ </event>
+
+ <event name="configure">
+ <description summary="notify X about new window configuration">
+ Worth to note that coordinates 'x' and 'y' are global.
+ </description>
+
+ <arg name="id" type="uint"/>
+ <arg name="x" type="int"/>
+ <arg name="y" type="int"/>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ <arg name="edges" type="uint"/>
+ </event>
+
</interface>
<interface name="wm" version="1">
@@ -45,6 +68,16 @@
</description>
</request>
+ <request name="map">
+ <description summary="notify compositor when window can be mapped">
+ Notify compositor that Window 'id' is ready to be mapped via X.
+ Effectively this happens after a MapNotify hits the window manager and
+ the compositor in principle would proceed notifying X via xserver.map.
+ </description>
+
+ <arg name="id" type="uint"/>
+ </request>
+
<request name="set_window">
<description summary="specify window id, geometries and positioning">
Notifies the compositor about X Window id and its configuration
diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h
index 2716ebe..2ec8981 100644
--- a/hw/xfree86/xwayland/xwayland-private.h
+++ b/hw/xfree86/xwayland/xwayland-private.h
@@ -113,6 +113,9 @@ xwl_global_get(struct xwl_screen *xwl_screen, const char *interface);
struct xwl_screen *xwl_screen_get(ScreenPtr screen);
+void
+xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap);
+
void xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrninfo);
int xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen);
diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c
index 09ebb99..11d3416 100644
--- a/hw/xfree86/xwayland/xwayland-window.c
+++ b/hw/xfree86/xwayland/xwayland-window.c
@@ -59,7 +59,7 @@ static const struct wl_callback_listener free_pixmap_listener = {
free_pixmap,
};
-static void
+void
xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap)
{
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
@@ -193,12 +193,7 @@ xwl_realize_window(WindowPtr window)
return FALSE;
}
- if (xwl_screen->xorg_server)
- xserver_set_window_surface(xwl_screen->xorg_server,
- xwl_window->surface, window->drawable.id);
-
wl_surface_set_user_data(xwl_window->surface, xwl_window);
- xwl_window_attach(xwl_window, (*screen->GetWindowPixmap)(window));
dixSetPrivate(&window->devPrivates,
&xwl_window_private_key, xwl_window);
diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
index bf90826..5d73ee8 100644
--- a/hw/xfree86/xwayland/xwayland.c
+++ b/hw/xfree86/xwayland/xwayland.c
@@ -68,9 +68,69 @@ xserver_listen_socket(void *data, struct xserver *xserver, int fd)
ListenOnOpenFD(fd, TRUE);
}
+static void
+xserver_handle_map(void *data, struct xserver *xserver, uint32_t id)
+{
+ struct xwl_screen *xwl_screen = data;
+ struct xwl_window *xwl_window, *wtmp;
+ ScreenPtr screen = xwl_screen->screen;
+ WindowPtr pWin;
+
+ xorg_list_for_each_entry_safe(xwl_window, wtmp,
+ &xwl_screen->window_list, link) {
+ pWin = xwl_window->window;
+ if (pWin->drawable.id == id) {
+ xserver_set_window_surface(xwl_screen->xorg_server,
+ xwl_window->surface,
+ pWin->drawable.id);
+ xwl_window_attach(xwl_window, (*screen->GetWindowPixmap)(pWin));
+ return;
+ }
+ }
+}
+
+static void
+xserver_handle_configure(void *data, struct xserver *xserver, uint32_t id,
+ int x, int y, int32_t width, int32_t height,
+ uint32_t edges)
+{
+ struct xwl_screen *xwl_screen = data;
+ struct xwl_window *xwl_window, *wtmp;
+ WindowPtr pWin;
+ ClientPtr pClient;
+ int err;
+ uint32_t mask = CWX | CWY | CWWidth | CWHeight;
+ XID vlist[4];
+
+ vlist[0] = x;
+ vlist[1] = y;
+ vlist[2] = width;
+ vlist[3] = height;
+
+ xorg_list_for_each_entry_safe(xwl_window, wtmp,
+ &xwl_screen->window_list, link) {
+ pWin = xwl_window->window;
+ if (pWin->drawable.id == id) {
+ err =
+ dixLookupClient(&pClient, pWin->drawable.id, serverClient,
+ DixUnknownAccess);
+ if (err != Success) {
+ ErrorF("Failed to lookup window: 0x%x\n",
+ (unsigned int) pWin->drawable.id);
+ return;
+ }
+
+ ConfigureWindow(pWin, mask, vlist, pClient);
+ return;
+ }
+ }
+}
+
static const struct xserver_listener xwl_server_listener = {
xserver_client,
- xserver_listen_socket
+ xserver_listen_socket,
+ xserver_handle_map,
+ xserver_handle_configure
};
static void
--
1.7.9.5
More information about the wayland-devel
mailing list