[vlc-commits] GLX: cache XCB connection pointer (no functional changes)
Rémi Denis-Courmont
git at videolan.org
Mon Feb 6 20:34:15 CET 2012
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Feb 6 20:39:42 2012 +0200| [466e8075abf7fdbc53f0825c36dc5094d27e842e] | committer: Rémi Denis-Courmont
GLX: cache XCB connection pointer (no functional changes)
(cherry picked from commit b8bec8eb9217e5a525f78777962c10b40838bc4b)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=466e8075abf7fdbc53f0825c36dc5094d27e842e
---
modules/video_output/xcb/glx.c | 27 +++++++++++----------------
1 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index e396c0f..ed13341 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -63,6 +63,7 @@ vlc_module_end ()
struct vout_display_sys_t
{
Display *display; /* Xlib instance */
+ xcb_connection_t *conn; /**< XCB connection */
vout_window_t *embed; /* VLC window (when windowed) */
xcb_cursor_t cursor; /* blank cursor */
@@ -245,7 +246,8 @@ static int Open (vlc_object_t *obj)
goto error;
xcb_connection_t *conn = XGetXCBConnection (dpy);
- assert (conn);
+ assert (conn != NULL);
+ sys->conn = conn;
RegisterMouseEvents (obj, conn, sys->embed->handle.xid);
/* Find window parameters */
@@ -428,10 +430,9 @@ static void Close (vlc_object_t *obj)
}
/* show the default cursor */
- xcb_change_window_attributes (XGetXCBConnection (sys->display),
- sys->embed->handle.xid, XCB_CW_CURSOR,
- &(uint32_t) { XCB_CURSOR_NONE });
- xcb_flush (XGetXCBConnection (sys->display));
+ xcb_change_window_attributes (sys->conn, sys->embed->handle.xid,
+ XCB_CW_CURSOR, &(uint32_t) { XCB_CURSOR_NONE });
+ xcb_flush (sys->conn);
XCloseDisplay (dpy);
vout_display_DeleteWindow (vd, sys->embed);
@@ -497,7 +498,6 @@ 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->display);
const vout_display_cfg_t *cfg;
const video_format_t *source;
bool is_forced = false;
@@ -532,11 +532,11 @@ static int Control (vout_display_t *vd, int query, va_list ap)
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_configure_window_checked (sys->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))
+ if (CheckError (vd, sys->conn, "cannot resize X11 window", ck))
return VLC_EGENERIC;
glViewport (0, 0, place.width, place.height);
@@ -546,14 +546,10 @@ 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:
- {
- xcb_connection_t *conn = XGetXCBConnection (sys->display);
-
- xcb_change_window_attributes (conn, sys->embed->handle.xid,
+ xcb_change_window_attributes (sys->conn, sys->embed->handle.xid,
XCB_CW_CURSOR, &(uint32_t){ sys->cursor });
- xcb_flush (conn);
+ xcb_flush (sys->conn);
return VLC_SUCCESS;
- }
case VOUT_DISPLAY_GET_OPENGL:
{
@@ -573,7 +569,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
static void Manage (vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- xcb_connection_t *conn = XGetXCBConnection (sys->display);
- ManageEvent (vd, conn, &sys->visible);
+ ManageEvent (vd, sys->conn, &sys->visible);
}
More information about the vlc-commits
mailing list