From 87bee02b191b7400532ff40c21da8dd43c15d289 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 15 Nov 2008 17:45:55 +0000 Subject: Replace some of the different inconsistent XGetGeometry uses by a vo_x11_update_geometry function. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27919 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/x11_common.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'libvo/x11_common.c') diff --git a/libvo/x11_common.c b/libvo/x11_common.c index ed58a6134c..c70e83352f 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -1040,25 +1040,7 @@ int vo_x11_check_events(Display * mydisplay) // if (vo_fs && Event.xconfigure.width != vo_screenwidth && Event.xconfigure.height != vo_screenheight) break; if (vo_window == None) break; - vo_dwidth = Event.xconfigure.width; - vo_dheight = Event.xconfigure.height; -#if 0 - /* when resizing, x and y are zero :( */ - vo_dx = Event.xconfigure.x; - vo_dy = Event.xconfigure.y; -#else - { - Window root; - int foo; - Window win; - - XGetGeometry(mydisplay, vo_window, &root, &foo, &foo, - &foo /*width */ , &foo /*height */ , &foo, - &foo); - XTranslateCoordinates(mydisplay, vo_window, root, 0, 0, - &vo_dx, &vo_dy, &win); - } -#endif + vo_x11_update_geometry(); ret |= VO_EVENT_RESIZE; break; case KeyPress: @@ -1496,6 +1478,22 @@ static int vo_x11_get_fs_type(int supported) return type; } +/** + * \brief update vo_dx, vo_dy, vo_dwidth and vo_dheight with current values of vo_window + * \return returns current color depth of vo_window + */ +int vo_x11_update_geometry(void) { + unsigned depth, w, h; + int dummy_int; + Window dummy_win; + XGetGeometry(mDisplay, vo_window, &dummy_win, &dummy_int, &dummy_int, + &w, &h, &dummy_int, &depth); + if (w <= INT_MAX && h <= INT_MAX) { vo_dwidth = w; vo_dheight = h; } + XTranslateCoordinates(mDisplay, vo_window, mRootWin, 0, 0, &vo_dx, &vo_dy, + &dummy_win); + return depth <= INT_MAX ? depth : 0; +} + void vo_x11_fullscreen(void) { int x, y, w, h; -- cgit v1.2.3