diff --git a/modules/codec/avcodec/Modules.am b/modules/codec/avcodec/Modules.am
index b9adb875b4726fd1bb1f331f22ac7005d00aae4b..8eabc7dadb263f484794c862531efed8ece68f49 100644
--- a/modules/codec/avcodec/Modules.am
+++ b/modules/codec/avcodec/Modules.am
@@ -9,7 +9,7 @@ libavcodec_plugin_la_SOURCES = \
 	fourcc.c \
 	chroma.h \
 	chroma.c \
-        vaapi.h \
+	vaapi.h \
 	vaapi.c \
 	vaapi_x11.c \
 	dxva2.c \
@@ -17,6 +17,8 @@ libavcodec_plugin_la_SOURCES = \
 	copy.h \
 	va.c \
 	va.h \
+	../../video_output/xcb/events.c \
+	../../video_output/xcb/xcb_events_vlc.h \
 	$(NULL)
 if ENABLE_SOUT
 libavcodec_plugin_la_SOURCES += \
diff --git a/modules/codec/avcodec/vaapi_x11.c b/modules/codec/avcodec/vaapi_x11.c
index 1bfc5e6f04a56387370b03db78de05e759c882f2..c7c20dad63171362d302cff5c0d4989df3b5b048 100644
--- a/modules/codec/avcodec/vaapi_x11.c
+++ b/modules/codec/avcodec/vaapi_x11.c
@@ -49,6 +49,8 @@
 #include "avcodec.h"
 #include "copy.h"
 
+#include <xcb/xcb.h>
+#include <X11/Xlib-xcb.h>
 #include <vlc_xlib.h>
 #include <libavcodec/vaapi.h>
 #include <va/va.h>
@@ -58,6 +60,8 @@
 
 #include <X11/Xutil.h>
 
+#include "../../video_output/xcb/xcb_events_vlc.h"
+
 /* define for extra debugging */
 #undef VAAPI_DEBUG
 
@@ -90,17 +94,18 @@ struct vout_display_sys_t
     vlc_mutex_t   cache_lock;
     vlc_array_t   cache;  /* array of subpicture_subpicture_cache_t */
 
+    xcb_cursor_t cursor; /* blank cursor */
+    xcb_window_t window; /* drawable X window */
+
     unsigned int i_display_order;
     bool visible;  /* whether to draw */
-
-    /* */
-    Window window;
 };
 
 static picture_pool_t *Pool (vout_display_t *, unsigned);
 static void Render (vout_display_t *, picture_t *, subpicture_t *);
 static void DisplayPicture (vout_display_t *, picture_t *, subpicture_t *);
 static int Control  (vout_display_t *, int, va_list);
+static void Manage (vout_display_t *);
 
 /* cache management */
 static unsigned int cache_counter = 0;
@@ -308,27 +313,16 @@ error:
     return VLC_EGENERIC;
 }
 
-static vout_window_t *MakeWindow (vout_display_t *vd)
+static vout_window_t *MakeWindow(vout_display_t *vd)
 {
-    vout_display_sys_t *sys = (vout_display_sys_t *)vd->sys;
     vout_window_cfg_t wnd_cfg;
 
-    sys->conn->lock();
-    /* FIXME: Correct vout_window_t display size
-     * looks like it assumes fullscreen for
-     * vout_display_PlacePicture() to work as expected. */
-    unsigned int width, height;
-    int screen = DefaultScreen(sys->conn->p_display_x11);
-    width = DisplayWidth(sys->conn->p_display_x11, screen);
-    height = DisplayHeight(sys->conn->p_display_x11, screen);
-    sys->conn->unlock();
-
     memset (&wnd_cfg, 0, sizeof (wnd_cfg));
     wnd_cfg.type = VOUT_WINDOW_TYPE_XID;
     wnd_cfg.x = var_InheritInteger (vd, "video-x");
     wnd_cfg.y = var_InheritInteger (vd, "video-y");
-    wnd_cfg.width  = width;
-    wnd_cfg.height = height;
+    wnd_cfg.width  = vd->cfg->display.width;
+    wnd_cfg.height = vd->cfg->display.height;
 
     vout_window_t *wnd = vout_display_NewWindow (vd, &wnd_cfg);
     if (wnd == NULL)
@@ -336,29 +330,77 @@ static vout_window_t *MakeWindow (vout_display_t *vd)
     return wnd;
 }
 
-static int GetWindowSize(vout_display_t *vd, unsigned int *pi_width, unsigned int *pi_height)
+static const xcb_screen_t *FindWindow(vout_display_t *vd, xcb_connection_t *conn,
+           unsigned *restrict pnum, uint8_t *restrict pdepth,
+           uint16_t *restrict pwidth, uint16_t *restrict pheight)
 {
     vout_display_sys_t *sys = vd->sys;
-    Status status;
-    Window root_window;
 
-    int x, y;
-    unsigned int bw, depth;
+    xcb_get_geometry_reply_t *geo =
+        xcb_get_geometry_reply (conn,
+            xcb_get_geometry(conn, sys->embed->handle.xid), NULL);
+    if (geo == NULL)
+    {
+        msg_Err (vd, "parent window not valid");
+        return NULL;
+    }
 
-    sys->conn->lock();
-    status = XGetGeometry(sys->conn->p_display_x11,
-                          sys->embed->handle.xid,
-                          &root_window,
-                          &x, &y, pi_width, pi_height,
-                          &bw, &depth);
-    sys->conn->unlock();
+    xcb_window_t root = geo->root;
+    *pdepth = geo->depth;
+    *pwidth = geo->width;
+    *pheight = geo->height;
+    free (geo);
+
+    /* Find the selected screen */
+    const xcb_setup_t *setup = xcb_get_setup(conn);
+    const xcb_screen_t *screen = NULL;
+    unsigned num = 0;
 
-    if (status == 0)
+    for (xcb_screen_iterator_t i = xcb_setup_roots_iterator(setup);
+         i.rem > 0;
+         xcb_screen_next (&i))
     {
-        msg_Err(vd, "failed getting geometry");
-        return VLC_EGENERIC;
+        if (i.data->root == root)
+        {
+            screen = i.data;
+            break;
+        }
+        num++;
+    }
+
+    if (screen == NULL)
+    {
+        msg_Err(vd, "parent window screen not found");
+        return NULL;
     }
+    msg_Dbg(vd, "using screen 0x%"PRIx32 " (number: %u)", root, num);
+    *pnum = num;
+    return screen;
+}
 
+static int CreateWindow (vout_display_t *vd, xcb_connection_t *conn,
+                         uint_fast8_t depth, xcb_visualid_t vid,
+                         uint_fast16_t width, uint_fast16_t height)
+{
+    vout_display_sys_t *sys = vd->sys;
+    const uint32_t mask = XCB_CW_EVENT_MASK;
+    const uint32_t values[] = {
+        /* XCB_CW_EVENT_MASK */
+        XCB_EVENT_MASK_VISIBILITY_CHANGE,
+    };
+    xcb_void_cookie_t cc, cm;
+
+    cc = xcb_create_window_checked (conn, depth, sys->window,
+                                    sys->embed->handle.xid, 0, 0,
+                                    width, height, 0,
+                                    XCB_WINDOW_CLASS_INPUT_OUTPUT,
+                                    vid, mask, values);
+    cm = xcb_map_window_checked (conn, sys->window);
+    if (CheckError (vd, conn, "cannot create X11 window", cc)
+     || CheckError (vd, conn, "cannot map X11 window", cm))
+        return VLC_EGENERIC;
+
+    msg_Dbg (vd, "using VAAPI X11 window %08"PRIx32, sys->window);
     return VLC_SUCCESS;
 }
 
@@ -388,21 +430,55 @@ int OpenVaapiX11 (vlc_object_t *obj)
     sys->render.i_cache  = VA_INVALID_ID;
     sys->display.i_cache = VA_INVALID_ID;
 
-    sys->visible = false;
+    sys->embed = MakeWindow(vd);
+    if (unlikely(sys->embed == NULL))
+        goto error;
 
     /* Create a VA display */
-    sys->conn = vlc_va_Initialize(NULL);
+    sys->conn = vlc_va_Initialize(sys->embed->display.x11);
     if (!sys->conn)
         goto error;
 
-    sys->embed = MakeWindow(vd);
-    if (unlikely(sys->embed == NULL))
+    if (FindVAFourCC(vd) != VLC_SUCCESS)
         goto error;
 
-    if (FindVAFourCC(vd) != VLC_SUCCESS)
+    XSetEventQueueOwner(sys->conn->p_display_x11, XCBOwnsEventQueue);
+
+    xcb_connection_t *conn = XGetXCBConnection(sys->conn->p_display_x11);
+    assert(conn);
+
+    RegisterMouseEvents(obj, conn, sys->embed->handle.xid);
+
+    /* Find window parameters */
+    unsigned snum;
+    uint8_t depth;
+    uint16_t width, height;
+    const xcb_screen_t *scr = FindWindow(vd, conn, &snum, &depth,
+                                          &width, &height);
+    if (scr == NULL)
         goto error;
 
-    msg_Dbg(vd, "using VAAPI X11 window (version %d.%d)",
+    sys->window = xcb_generate_id (conn);
+
+#if 0
+    xcb_get_window_attributes_reply_t *wa =
+        xcb_get_window_attributes_reply(conn,
+            xcb_get_window_attributes(conn, sys->embed->handle.xid), NULL);
+    if (wa == NULL)
+        goto error;
+    xcb_visualid_t visual = wa->visual;
+    free (wa);
+#endif
+    if (!CreateWindow(vd, conn, depth, 0 /* ??? */, width, height))
+    {
+        msg_Err (vd, "cannot create VAAPI-X11 window");
+        goto error;
+    }
+
+    sys->cursor = CreateBlankCursor(conn, scr);
+    sys->visible = false;
+
+    msg_Dbg(vd, "using VAAPI X11 video output (libva version %d.%d)",
             sys->conn->i_version_major, sys->conn->i_version_minor);
 
     /* */
@@ -427,7 +503,7 @@ int OpenVaapiX11 (vlc_object_t *obj)
     vd->pool = Pool;
     vd->display = DisplayPicture;
     vd->control = Control;
-    vd->manage = NULL; //Manage;
+    vd->manage = Manage;
     vd->info = info;
 
     /* */
@@ -435,12 +511,7 @@ int OpenVaapiX11 (vlc_object_t *obj)
     if (is_fullscreen && vout_window_SetFullScreen (sys->embed, true))
         is_fullscreen = false;
     vout_display_SendEventFullscreen (vd, is_fullscreen);
-    unsigned int width, height;
-    if (GetWindowSize(vd, &width, &height) == VLC_SUCCESS)
-    {
-        vout_window_SetSize (sys->embed, width, height);
-        vout_display_SendEventDisplaySize (vd, width, height, is_fullscreen);
-    }
+    vout_display_SendEventDisplaySize (vd, width, height, is_fullscreen);
     return VLC_SUCCESS;
 
 error:
@@ -455,10 +526,11 @@ void CloseVaapiX11 (vlc_object_t *obj)
 
     if (sys->conn && sys->conn->p_display_x11)
     {
-        sys->conn->lock();
-        XFlush(sys->conn->p_display_x11);
-        XSync(sys->conn->p_display_x11, False);
-        sys->conn->unlock();
+        /* show the default cursor */
+        xcb_change_window_attributes(XGetXCBConnection(sys->conn->p_display_x11),
+                                     sys->embed->handle.xid, XCB_CW_CURSOR,
+                                     &(uint32_t) { XCB_CURSOR_NONE });
+        xcb_flush(XGetXCBConnection(sys->conn->p_display_x11));
     }
 
     if (sys->embed)
@@ -495,6 +567,14 @@ void CloseVaapiX11 (vlc_object_t *obj)
     free(vd->sys);
 }
 
+static void Manage (vout_display_t *vd)
+{
+    vout_display_sys_t *sys = vd->sys;
+    xcb_connection_t *conn = XGetXCBConnection(sys->conn->p_display_x11);
+
+    ManageEvent(vd, conn, &sys->visible);
+}
+
 static int Control (vout_display_t *vd, int query, va_list ap)
 {
     vout_display_sys_t *sys = vd->sys;
@@ -503,14 +583,14 @@ static int Control (vout_display_t *vd, int query, va_list ap)
     {
     case VOUT_DISPLAY_CHANGE_FULLSCREEN:
     {
-        const vout_display_cfg_t *c = va_arg (ap, const vout_display_cfg_t *);
-        return vout_window_SetFullScreen (sys->embed, c->is_fullscreen);
+        const vout_display_cfg_t *c = va_arg(ap, const vout_display_cfg_t *);
+        return vout_window_SetFullScreen(sys->embed, c->is_fullscreen);
     }
 
     case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
     {
-        unsigned state = va_arg (ap, unsigned);
-        return vout_window_SetState (sys->embed, state);
+        unsigned state = va_arg(ap, unsigned);
+        return vout_window_SetState(sys->embed, state);
     }
 
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
@@ -519,6 +599,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     {
+        xcb_connection_t *conn = XGetXCBConnection(sys->conn->p_display_x11);
         const vout_display_cfg_t *cfg;
         const video_format_t *source;
         bool is_forced = false;
@@ -526,15 +607,15 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
          || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
         {
-            source = (const video_format_t *)va_arg (ap, const video_format_t *);
+            source = (const video_format_t *)va_arg(ap, const video_format_t *);
             cfg = vd->cfg;
         }
         else
         {
             source = &vd->source;
-            cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *);
+            cfg = (const vout_display_cfg_t*)va_arg(ap, const vout_display_cfg_t *);
             if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
-                is_forced = (bool)va_arg (ap, int);
+                is_forced = (bool)va_arg(ap, int);
         }
 
         /* */
@@ -542,8 +623,22 @@ static int Control (vout_display_t *vd, int query, va_list ap)
          && is_forced
          && (cfg->display.width  != vd->cfg->display.width
            ||cfg->display.height != vd->cfg->display.height)
-         && vout_window_SetSize (sys->embed,
-                                 cfg->display.width, cfg->display.height))
+         && vout_window_SetSize(sys->embed,
+                                cfg->display.width, cfg->display.height))
+            return VLC_EGENERIC;
+
+        vout_display_place_t place;
+        vout_display_PlacePicture(&place, source, cfg, false);
+
+        /* Move the picture within the window */
+        const uint32_t values[] = { place.x, place.y,
+                                    place.width, place.height, };
+        xcb_void_cookie_t ck =
+            xcb_configure_window_checked(conn, sys->window,
+                            XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
+                          | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
+                              values);
+        if (CheckError(vd, conn, "cannot resize X11 window", ck))
             return VLC_EGENERIC;
 
         return VLC_SUCCESS;
@@ -557,11 +652,17 @@ static int Control (vout_display_t *vd, int query, va_list ap)
     /* Hide the mouse. It will be send when
      * vout_display_t::info.b_hide_mouse is false */
     case VOUT_DISPLAY_HIDE_MOUSE:
-        /* FIXME */
+    {
+        xcb_connection_t *conn = XGetXCBConnection(sys->conn->p_display_x11);
+
+        xcb_change_window_attributes(conn, sys->embed->handle.xid,
+                                     XCB_CW_CURSOR, &(uint32_t){ sys->cursor });
+        xcb_flush(conn);
         return VLC_SUCCESS;
+    }
 
     default:
-        msg_Err (vd, "Unknown request in XCB vout display");
+        msg_Err (vd, "Unknown request in VAAPI-X11 vout display");
         return VLC_EGENERIC;
     }
 }
@@ -1168,7 +1269,7 @@ static void DisplayVASurface(vout_display_t *vd, VASurfaceID surface, picture_t
     sys->conn->lock();
 
     VAStatus status;
-    status = vaPutSurface(sys->conn->p_display, surface, sys->embed->handle.xid,
+    status = vaPutSurface(sys->conn->p_display, surface, sys->window,
                           picture->format.i_x_offset, picture->format.i_y_offset,
                           picture->format.i_visible_width, picture->format.i_visible_height,
                           place.x, place.y, place.width, place.height,
diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am
index 724cfeb8b8fbbe8d93be92d9ed8b78744d9596e7..23f9b0d232e87dfca100725da7792644674af81f 100644
--- a/modules/video_output/Modules.am
+++ b/modules/video_output/Modules.am
@@ -42,6 +42,7 @@ libvlc_LTLIBRARIES += \
 
 ### XCB ###
 libxcb_x11_plugin_la_SOURCES = \
+	xcb/xcb_events_vlc.h \
 	xcb/xcb_vlc.h \
 	xcb/x11.c \
 	xcb/common.c \
@@ -53,6 +54,7 @@ libxcb_x11_plugin_la_LIBADD = $(AM_LIBADD) \
 libxcb_x11_plugin_la_DEPENDENCIES =
 
 libxcb_xv_plugin_la_SOURCES = \
+	xcb/xcb_events_vlc.h \
 	xcb/xcb_vlc.h \
 	xcb/xvideo.c \
 	xcb/common.c \
@@ -64,6 +66,7 @@ libxcb_xv_plugin_la_LIBADD = $(AM_LIBADD) \
 libxcb_xv_plugin_la_DEPENDENCIES =
 
 libxcb_glx_plugin_la_SOURCES = \
+	xcb/xcb_events_vlc.h \
 	xcb/xcb_vlc.h \
 	xcb/glx.c \
 	opengl.h \
diff --git a/modules/video_output/xcb/common.c b/modules/video_output/xcb/common.c
index cc44a4d3ad59c7fee822a6fdfdd725983996b1c1..0fc27b6198f93cb92a775bd13dfaae2d53827f45 100644
--- a/modules/video_output/xcb/common.c
+++ b/modules/video_output/xcb/common.c
@@ -38,6 +38,7 @@
 #include <vlc_common.h>
 #include <vlc_vout_display.h>
 
+#include "xcb_events_vlc.h"
 #include "xcb_vlc.h"
 
 /**
diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index e68a35e7e73b704284ac08c3b3f610f984848b81..cead30a5bda2d172ac96eeeaaae3dbc77af29fce 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -32,7 +32,7 @@
 #include <vlc_common.h>
 #include <vlc_vout_display.h>
 
-#include "xcb_vlc.h"
+#include "xcb_events_vlc.h"
 
 /**
  * Check for an error
diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index 53fc4525f194890f95bc4ee4b6798c16df415aa6..6810d41aafcaa5c6d2bf5369b080618c86e3537c 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -39,6 +39,7 @@
 #include <vlc_opengl.h>
 #include "../opengl.h"
 
+#include "xcb_events_vlc.h"
 #include "xcb_vlc.h"
 
 static int  Open (vlc_object_t *);
diff --git a/modules/video_output/xcb/keys.c b/modules/video_output/xcb/keys.c
index 4dcfe999ca074ca8cbfef8fe25a627d777dac998..0e7baa62f5d75e7b9cb8127881bb4a07fe59c5e0 100644
--- a/modules/video_output/xcb/keys.c
+++ b/modules/video_output/xcb/keys.c
@@ -30,6 +30,7 @@
 
 #include <xcb/xcb.h>
 #include <vlc_common.h>
+#include "xcb_events_vlc.h"
 #include "xcb_vlc.h"
 
 #ifdef HAVE_XCB_KEYSYMS
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 4f8cbcc680c6f8ca98de937a9760bd76c71b16a4..4bbc569f59e866b13ac1bf79e3d2c32adf332ec9 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -38,6 +38,7 @@ typedef xcb_atom_t Atom;
 #include <vlc_plugin.h>
 #include <vlc_vout_window.h>
 
+#include "xcb_events_vlc.h"
 #include "xcb_vlc.h"
 
 #define DISPLAY_TEXT N_("X11 display")
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 13758ea2edbe3bc090de7311447d8ab8c49dc3a2..c36dcdceb6b2992b164c487115d94cbe39e07caa 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -35,6 +35,7 @@
 #include <vlc_vout_display.h>
 #include <vlc_picture_pool.h>
 
+#include "xcb_events_vlc.h"
 #include "xcb_vlc.h"
 
 static int  Open (vlc_object_t *);
diff --git a/modules/video_output/xcb/xcb_events_vlc.h b/modules/video_output/xcb/xcb_events_vlc.h
new file mode 100644
index 0000000000000000000000000000000000000000..974cdf1d91dfb29502dd80cece30a44398035f75
--- /dev/null
+++ b/modules/video_output/xcb/xcb_events_vlc.h
@@ -0,0 +1,57 @@
+/**
+ * @file xcb_events_vlc.h
+ * @brief X C Bindings VLC module common header
+ */
+/*****************************************************************************
+ * Copyright © 2009 Rémi Denis-Courmont
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ ****************************************************************************/
+
+#ifdef WORDS_BIGENDIAN
+# define ORDER XCB_IMAGE_ORDER_MSB_FIRST
+#else
+# define ORDER XCB_IMAGE_ORDER_LSB_FIRST
+#endif
+
+#ifndef XCB_CURSOR_NONE
+# define XCB_CURSOR_NONE ((xcb_cursor_t) 0U)
+#endif
+
+#include <vlc_picture.h>
+#include <vlc_vout_display.h>
+
+int ManageEvent (vout_display_t *vd, xcb_connection_t *conn, bool *);
+
+/* keys.c */
+typedef struct key_handler_t key_handler_t;
+key_handler_t *CreateKeyHandler (vlc_object_t *, xcb_connection_t *);
+void DestroyKeyHandler (key_handler_t *);
+int ProcessKeyEvent (key_handler_t *, xcb_generic_event_t *);
+
+/* common.c */
+struct vout_window_t *GetWindow (vout_display_t *obj,
+                                 xcb_connection_t **restrict pconn,
+                                 const xcb_screen_t **restrict pscreen,
+                                 uint8_t *restrict pdepth);
+int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
+                   unsigned *restrict width, unsigned *restrict height);
+bool CheckSHM (vlc_object_t *obj, xcb_connection_t *conn);
+xcb_cursor_t CreateBlankCursor (xcb_connection_t *, const xcb_screen_t *);
+void RegisterMouseEvents (vlc_object_t *, xcb_connection_t *, xcb_window_t);
+
+int CheckError (vout_display_t *, xcb_connection_t *conn,
+                const char *str, xcb_void_cookie_t);
+
diff --git a/modules/video_output/xcb/xcb_vlc.h b/modules/video_output/xcb/xcb_vlc.h
index f17c532cd71406d3a1a5b3f88f3f7eb349203790..340db9d92dc26a2f5c4110377574d39fb7530491 100644
--- a/modules/video_output/xcb/xcb_vlc.h
+++ b/modules/video_output/xcb/xcb_vlc.h
@@ -20,43 +20,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  ****************************************************************************/
 
-#ifdef WORDS_BIGENDIAN
-# define ORDER XCB_IMAGE_ORDER_MSB_FIRST
-#else
-# define ORDER XCB_IMAGE_ORDER_LSB_FIRST
-#endif
-
-#ifndef XCB_CURSOR_NONE
-# define XCB_CURSOR_NONE ((xcb_cursor_t) 0U)
-#endif
-
-#include <vlc_picture.h>
-#include <vlc_vout_display.h>
-
-int ManageEvent (vout_display_t *vd, xcb_connection_t *conn, bool *);
-
-/* keys.c */
-typedef struct key_handler_t key_handler_t;
-key_handler_t *CreateKeyHandler (vlc_object_t *, xcb_connection_t *);
-void DestroyKeyHandler (key_handler_t *);
-int ProcessKeyEvent (key_handler_t *, xcb_generic_event_t *);
-
-/* common.c */
-struct vout_window_t *GetWindow (vout_display_t *obj,
-                                 xcb_connection_t **restrict pconn,
-                                 const xcb_screen_t **restrict pscreen,
-                                 uint8_t *restrict pdepth);
-int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
-                   unsigned *restrict width, unsigned *restrict height);
-bool CheckSHM (vlc_object_t *obj, xcb_connection_t *conn);
-xcb_cursor_t CreateBlankCursor (xcb_connection_t *, const xcb_screen_t *);
-void RegisterMouseEvents (vlc_object_t *, xcb_connection_t *, xcb_window_t);
-
-int CheckError (vout_display_t *, xcb_connection_t *conn,
-                const char *str, xcb_void_cookie_t);
-
-/* FIXME
- * maybe it would be better to split this header in 2 */
 #include <xcb/shm.h>
 struct picture_sys_t
 {
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index b7e03391cef6d5f35b6e70d053662ebe2cee309a..7f2e6d5dc182c8187976174868b77f9866e78015 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -37,6 +37,7 @@
 #include <vlc_picture_pool.h>
 #include <vlc_dialog.h>
 
+#include "xcb_events_vlc.h"
 #include "xcb_vlc.h"
 
 #define ADAPTOR_TEXT N_("XVideo adaptor number")