[vlc-commits] vout: xcb: remove mouse cursor handling from displays

Thomas Guillem git at videolan.org
Wed Nov 30 17:23:32 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Nov 30 12:12:13 2016 +0100| [34821277637646a6416a731b76716d0fedad39cd] | committer: Thomas Guillem

vout: xcb: remove mouse cursor handling from displays

Ref #9787

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=34821277637646a6416a731b76716d0fedad39cd
---

 modules/hw/vdpau/display.c        |  9 +--------
 modules/video_output/xcb/events.c | 11 -----------
 modules/video_output/xcb/events.h | 14 --------------
 modules/video_output/xcb/x11.c    | 12 +-----------
 modules/video_output/xcb/xvideo.c | 14 +-------------
 5 files changed, 3 insertions(+), 57 deletions(-)

diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index 41bbe63..b9a8d72 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -60,7 +60,6 @@ struct vout_display_sys_t
     picture_t *current; /**< Currently visible picture */
 
     xcb_window_t window; /**< target window (owned by VDPAU back-end) */
-    xcb_cursor_t cursor; /**< blank cursor */
     VdpDevice device; /**< VDPAU device handle */
     VdpPresentationQueueTarget target; /**< VDPAU presentation queue target */
     VdpPresentationQueue queue; /**< VDPAU presentation queue */
@@ -329,9 +328,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
     switch (query)
     {
     case VOUT_DISPLAY_HIDE_MOUSE:
-        xcb_change_window_attributes(sys->conn, sys->embed->handle.xid,
-                                    XCB_CW_CURSOR, &(uint32_t){ sys->cursor });
-        break;
+        return VLC_EGENERIC;
     case VOUT_DISPLAY_RESET_PICTURES:
     {
         msg_Dbg(vd, "resetting pictures");
@@ -648,7 +645,6 @@ static int Open(vlc_object_t *obj)
         goto error;
     }
 
-    sys->cursor = vlc_xcb_cursor_Create(sys->conn, screen);
     sys->pool = NULL;
 
     /* */
@@ -678,9 +674,6 @@ static void Close(vlc_object_t *obj)
     vout_display_t *vd = (vout_display_t *)obj;
     vout_display_sys_t *sys = vd->sys;
 
-    /* Restore cursor explicitly (parent window connection will survive) */
-    xcb_change_window_attributes(sys->conn, sys->embed->handle.xid,
-                               XCB_CW_CURSOR, &(uint32_t) { XCB_CURSOR_NONE });
     xcb_flush(sys->conn);
 
     vdp_presentation_queue_destroy(sys->vdp, sys->queue);
diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index 9bde532..695cc53 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -142,17 +142,6 @@ error:
     return NULL;
 }
 
-xcb_cursor_t vlc_xcb_cursor_Create(xcb_connection_t *conn,
-                                   const xcb_screen_t *scr)
-{
-    xcb_cursor_t cur = xcb_generate_id (conn);
-    xcb_pixmap_t pix = xcb_generate_id (conn);
-
-    xcb_create_pixmap (conn, 1, pix, scr->root, 1, 1);
-    xcb_create_cursor (conn, cur, pix, pix, 0, 0, 0, 0, 0, 0, 1, 1);
-    return cur;
-}
-
 /* NOTE: we assume no other thread will be _setting_ our video output events
  * variables. Afterall, only this plugin is supposed to know when these occur.
   * Otherwise, we'd var_OrInteger() and var_NandInteger() functions...
diff --git a/modules/video_output/xcb/events.h b/modules/video_output/xcb/events.h
index 83f7fe3..a71d266 100644
--- a/modules/video_output/xcb/events.h
+++ b/modules/video_output/xcb/events.h
@@ -49,20 +49,6 @@ int vlc_xcb_error_Check(vout_display_t *, xcb_connection_t *conn,
 struct vout_window_t *vlc_xcb_parent_Create(vout_display_t *obj,
                                             xcb_connection_t **connp,
                                             const xcb_screen_t **screenp);
-
-/**
- * Creates a blank cursor.
- *
- * \note Pixmaps are leaked until disconnection from the X server. Hence, this
- * function should be called no more than once per X connection.
- *
- * @param conn XCB connection
- * @param scr target XCB screen
- * @return cursor XID
- */
-xcb_cursor_t vlc_xcb_cursor_Create(xcb_connection_t *conn,
-                                   const xcb_screen_t *scr);
-
 /**
  * Processes XCB events.
  */
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 6003cff..c0b3781 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -66,7 +66,6 @@ struct vout_display_sys_t
     xcb_connection_t *conn;
     vout_window_t *embed; /* VLC window */
 
-    xcb_cursor_t cursor; /* blank cursor */
     xcb_window_t window; /* drawable X window */
     xcb_gcontext_t gc; /* context to put images */
     xcb_shm_seg_t seg_base; /**< shared memory segment XID base */
@@ -288,7 +287,6 @@ found_format:;
     msg_Dbg (vd, "using X11 window %08"PRIx32, sys->window);
     msg_Dbg (vd, "using X11 graphic context %08"PRIx32, sys->gc);
 
-    sys->cursor = vlc_xcb_cursor_Create(conn, scr);
     sys->visible = false;
     if (XCB_shm_Check (obj, conn))
     {
@@ -327,9 +325,6 @@ static void Close (vlc_object_t *obj)
 
     ResetPictures (vd);
 
-    /* show the default cursor */
-    xcb_change_window_attributes (sys->conn, sys->embed->handle.xid, XCB_CW_CURSOR,
-                                  &(uint32_t) { XCB_CURSOR_NONE });
     xcb_flush (sys->conn);
 
     /* colormap, window and context are garbage-collected by X */
@@ -511,13 +506,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         return VLC_SUCCESS;
     }
 
-    /* Hide the mouse. It will be send when
-     * vout_display_t::info.b_hide_mouse is false */
     case VOUT_DISPLAY_HIDE_MOUSE:
-        xcb_change_window_attributes (sys->conn, sys->embed->handle.xid,
-                                  XCB_CW_CURSOR, &(uint32_t){ sys->cursor });
-        xcb_flush (sys->conn);
-        return VLC_SUCCESS;
+        return VLC_EGENERIC;
 
     default:
         msg_Err (vd, "Unknown request in XCB vout display");
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 58f98d3..fa7d2ea 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -82,7 +82,6 @@ struct vout_display_sys_t
     xcb_connection_t *conn;
     vout_window_t *embed;/* VLC window */
 
-    xcb_cursor_t cursor; /* blank cursor */
     xcb_window_t window; /* drawable X window */
     xcb_gcontext_t gc;   /* context to put images */
     xcb_xv_port_t port;  /* XVideo port */
@@ -549,9 +548,6 @@ static int Open (vlc_object_t *obj)
         free(r);
     }
 
-    /* Create cursor */
-    p_sys->cursor = vlc_xcb_cursor_Create(conn, screen);
-
     p_sys->shm = XCB_shm_Check (obj, conn);
     p_sys->visible = false;
 
@@ -592,9 +588,6 @@ static void Close (vlc_object_t *obj)
     if (p_sys->pool)
         picture_pool_Release (p_sys->pool);
 
-    /* show the default cursor */
-    xcb_change_window_attributes (p_sys->conn, p_sys->embed->handle.xid, XCB_CW_CURSOR,
-                                  &(uint32_t) { XCB_CURSOR_NONE });
     xcb_flush (p_sys->conn);
 
     free (p_sys->att);
@@ -762,13 +755,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         return VLC_SUCCESS;
     }
 
-    /* Hide the mouse. It will be send when
-     * vout_display_t::info.b_hide_mouse is false */
     case VOUT_DISPLAY_HIDE_MOUSE:
-        xcb_change_window_attributes (p_sys->conn, p_sys->embed->handle.xid,
-                                  XCB_CW_CURSOR, &(uint32_t){ p_sys->cursor });
-        xcb_flush (p_sys->conn);
-        return VLC_SUCCESS;
+        return VLC_EGENERIC;
     case VOUT_DISPLAY_RESET_PICTURES:
         vlc_assert_unreachable();
     default:



More information about the vlc-commits mailing list