[vlc-commits] GLX: cache XCB connection pointer (no functional changes)
Rémi Denis-Courmont
git at videolan.org
Mon Feb 6 21:07:14 CET 2012
vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Feb 6 20:39:42 2012 +0200| [0c8f84cc05516c065aaf21897089b120e361cd37] | 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-2.0.git/?a=commit;h=0c8f84cc05516c065aaf21897089b120e361cd37
---
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 b0db476..7ff3f18 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -62,6 +62,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 */
@@ -241,7 +242,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 */
@@ -450,10 +452,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);
@@ -530,7 +531,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;
@@ -565,11 +565,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);
@@ -579,14 +579,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:
{
@@ -606,7 +602,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