[PATCH xserver 2/4] xwayland: Track new protocol for xwm split

Tiago Vignatti tiago.vignatti at intel.com
Wed Dec 19 11:32:28 PST 2012


Selection is broken at the moment!

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 hw/xfree86/xwayland/xserver.xml       |  131 ++++++++++++++++++++++++++++++++-
 hw/xfree86/xwayland/xwayland-window.c |    2 +-
 hw/xfree86/xwayland/xwayland.c        |   23 ++----
 3 files changed, 137 insertions(+), 19 deletions(-)

diff --git a/hw/xfree86/xwayland/xserver.xml b/hw/xfree86/xwayland/xserver.xml
index 9e25f5c..4f89bb1 100644
--- a/hw/xfree86/xwayland/xserver.xml
+++ b/hw/xfree86/xwayland/xserver.xml
@@ -1,18 +1,145 @@
 <protocol name="xserver">
 
   <interface name="xserver" version="1">
-    <request name="set_window_id">
+    <description summary="global object to connect X with Wayland">
+    </description>
+
+    <request name="set_window_surface">
+      <description summary="specify window surface">
+	It specifies the assignment between an X Window 'id' and an Wayland
+	'surface'. The compositor will cache it internally, then create a
+	shell_surface which will be mapped on the screen based on the
+	information the wm interface will provide for the given window.
+      </description>
+
       <arg name="surface" type="object" interface="wl_surface"/>
-      <arg name="id" type="uint"/>
+      <arg name="xid" type="uint"/>
     </request>
 
     <event name="client">
+      <description summary="send client fd to X">
+	In principle, this event must be used only once and to send window
+	manager (WM) fd to X. This is one tip of the opened socketpair; the
+	other has to be sent via wm interface in order to plug both X and WM.
+      </description>
       <arg name="fd" type="fd"/>
     </event>
 
     <event name="listen_socket">
+      <description summary="send client to be listened on opened fd">
+	This event should be used to send the first real X client fd to the X
+	server; this is the client that triggered X initialization but had to
+	wait for the WM gets connected before. A good practice is to call this
+	event after receiving wm.is_ready.
+      </description>
+      <arg name="fd" type="fd"/>
+    </event>
+  </interface>
+
+  <interface name="wm" version="1">
+    <description summary="XWayland window manager global object">
+    </description>
+
+    <request name="is_ready">
+      <description summary="notifies that WM is ready and connected to X">
+      </description>
+    </request>
+
+    <request name="create_xwindow">
+      <description summary="instantiates xm_xwin objects">
+      </description>
+      <arg name="id" type="new_id" interface="wm_xwin"/>
+      <arg name="xid" type="uint"/>
+    </request>
+
+    <event name="xserver">
+      <description summary="send X fd to window manager">
+	This is the other tip of the socketpair used for connecting X and
+	window manager with each other; see xserver.wm.
+      </description>
+
       <arg name="fd" type="fd"/>
     </event>
+
+    <enum name="state">
+      <description summary="wm states">
+        Describes the wm state the Wayland compositor desires.
+      </description>
+
+      <entry name="deactivate" value="1" summary="deactivate all the windows"/>
+    </enum>
+
+    <event name="state">
+      <description summary="notifies window manager about window state">
+      </description>
+
+      <arg name="state" type="uint"/>
+    </event>
+  </interface>
+
+  <interface name="wm_xwin" version="1">
+    <description summary="">
+    </description>
+
+    <request name="set_window">
+      <description summary="specify window id, geometries and positioning">
+	Notifies the compositor about X Window id and its configuration
+	regarding size and location on the screen. The compositor is
+	responsible for looking the surface based on the id and map it on the
+	screen. The x and y arguments specify the global position of the
+	surface on the current output, exactly how X11 works. The flags
+	argument can be used to tell the type of window or control whether the
+	surface will receive the keyboard focus or not, after being mapped.
+      </description>
+
+      <arg name="x" type="int"/>
+      <arg name="y" type="int"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+      <arg name="flags" type="uint"/>
+    </request>
+ 
+    <request name="move">
+    </request>
+
+    <request name="resize">
+      <arg name="edges" type="uint"/>
+    </request>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy an wm_xwindow">
+      </description>
+    </request>
+
+    <event name="configure">
+      <description summary="suggest resize">
+	The configure event asks the client to resize its surface. The size is
+	a hint, in the sense that the client is free to ignore it if it
+	doesn't resize, pick a smaller size (to satisfy aspect ration or
+	resize in steps of NxM pixels). The client is free to dismiss all but
+	the last configure event it received.
+      </description>
+
+      <arg name="edges" type="uint"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+    </event>
+
+    <enum name="state">
+      <description summary="window states">
+        Describes the window state the Wayland compositor desires.
+      </description>
+
+      <entry name="activate" value="1" summary="activate and give focus"/>
+      <entry name="kill" value="2" summary="send a kill"/>
+    </enum>
+
+    <event name="state">
+      <description summary="notifies window about its state">
+      </description>
+
+      <arg name="state" type="uint"/>
+    </event>
   </interface>
 
 </protocol>
diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c
index 41c4376..09ebb99 100644
--- a/hw/xfree86/xwayland/xwayland-window.c
+++ b/hw/xfree86/xwayland/xwayland-window.c
@@ -194,7 +194,7 @@ xwl_realize_window(WindowPtr window)
     }
 
     if (xwl_screen->xorg_server)
-	xserver_set_window_id(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);
diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
index 3396e5f..bf90826 100644
--- a/hw/xfree86/xwayland/xwayland.c
+++ b/hw/xfree86/xwayland/xwayland.c
@@ -74,27 +74,12 @@ static const struct xserver_listener xwl_server_listener = {
 };
 
 static void
-xwl_xserver_bind(struct xwl_screen *xwl_screen)
-{
-    struct xwl_global *xwl_global = xwl_global_get(xwl_screen, "xserver");
-
-    xwl_screen->xorg_server = wl_registry_bind(xwl_screen->registry,
-	                             xwl_global->id, &xserver_interface, 1);
-    xserver_add_listener(xwl_screen->xorg_server, &xwl_server_listener,
-                         xwl_screen);
-}
-
-static void
 xwl_input_delayed_init(void *data, struct wl_callback *callback, uint32_t time)
 {
     struct xwl_screen *xwl_screen = data;
 
-    ErrorF("xwl_input_delayed_init\n");
-
     wl_callback_destroy(callback);
-
     xwl_seat_bind(xwl_screen);
-    xwl_xserver_bind(xwl_screen);
 }
 
 static const struct wl_callback_listener delayed_init_listner = {
@@ -131,6 +116,11 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
         xwl_screen->shm =
             wl_registry_bind(registry, id, &wl_shm_interface, 1);
 	return;
+    } else if (strcmp(interface, "xserver") == 0) {
+        xwl_screen->xorg_server =
+            wl_registry_bind(registry, id, &xserver_interface, 1);
+	xserver_add_listener(xwl_screen->xorg_server, &xwl_server_listener, xwl_screen);
+	return;
     }
 
     /* cache list of globals, so we can bind the interfaces later in a desired
@@ -269,11 +259,12 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen,
     noScreenSaverExtension = TRUE;
 
     xdnd_atom = MakeAtom("XdndSelection", 13, 1);
+#if 0
     if (!AddCallback(&SelectionCallback,
 		     xwayland_selection_callback, xwl_screen)) {
 	return FALSE;
     }
-
+#endif
     xorg_list_init(&xwl_screen->seat_list);
     xorg_list_init(&xwl_screen->damage_window_list);
     xorg_list_init(&xwl_screen->window_list);
-- 
1.7.9.5



More information about the wayland-devel mailing list