summaryrefslogtreecommitdiffstats
path: root/libvo/x11_common.c
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-22 19:36:21 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-22 19:36:21 +0000
commitfa966b71df6c7e0fa9d06bc147a7b1e4f1e0644e (patch)
tree28846b2936345b45d608a5579446cb1e9e444eac /libvo/x11_common.c
parent41803844bafaff06383f8da927a3d6e0e5fc7494 (diff)
downloadmpv-fa966b71df6c7e0fa9d06bc147a7b1e4f1e0644e.tar.bz2
mpv-fa966b71df6c7e0fa9d06bc147a7b1e4f1e0644e.tar.xz
setting vo_dx and vo_dy in event handling
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4813 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r--libvo/x11_common.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 408687605e..b0e20ae8fc 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -47,7 +47,7 @@
#define SCAN_VISUALS
-extern verbose;
+extern int verbose;
static int dpms_disabled=0;
static int timeout_save=0;
@@ -144,7 +144,7 @@ static void x11_errorhandler(Display *display, XErrorEvent *event)
#define MSGLEN 60
char msg[MSGLEN];
- XGetErrorText(display, event->error_code, &msg, MSGLEN);
+ XGetErrorText(display, event->error_code, (char *)&msg, MSGLEN);
printf("X11 error: %s\n", msg);
@@ -173,9 +173,18 @@ int vo_init( void )
if(vo_depthonscreen) return 1; // already called
+ XSetErrorHandler(x11_errorhandler);
+
+#if 0
if (!mDisplayName)
if (!(mDisplayName=getenv("DISPLAY")))
mDisplayName=strdup(":0.0");
+#else
+ mDisplayName = XDisplayName(mDisplayName);
+#endif
+
+ if (verbose)
+ printf("X11 opening display: %s\n", mDisplayName);
mDisplay=XOpenDisplay(mDisplayName);
if ( !mDisplay )
@@ -264,8 +273,6 @@ int vo_init( void )
vo_screenwidth,vo_screenheight,
depth, vo_depthonscreen,
mDisplayName,mLocalDisplay?"local":"remote");
-
- XSetErrorHandler(x11_errorhandler);
return 1;
}
@@ -445,6 +452,22 @@ int vo_x11_check_events(Display *mydisplay){
case ConfigureNotify:
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;
+ XGetGeometry(mydisplay, vo_window, &root, &foo, &foo,
+ &foo/*width*/, &foo/*height*/, &foo, &foo);
+ XTranslateCoordinates(mydisplay, vo_window, root, 0, 0,
+ &vo_dx, &vo_dy, (Window *)&foo);
+ }
+#endif
+ if (verbose)
+ printf("X11 Window %dx%d-%dx%d\n", vo_dx, vo_dy, vo_dwidth, vo_dheight);
ret|=VO_EVENT_RESIZE;
break;
case KeyPress: