changeset 5835:104fce2b92b6

fix fullscreen (?)
author pontscho
date Thu, 25 Apr 2002 21:52:47 +0000
parents ece3a19677b9
children dcb0a2bf3345
files libvo/vo_x11.c libvo/vo_xmga.c libvo/vo_xv.c libvo/x11_common.c libvo/x11_common.h
diffstat 5 files changed, 30 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Thu Apr 25 20:59:12 2002 +0000
+++ b/libvo/vo_x11.c	Thu Apr 25 21:52:47 2002 +0000
@@ -362,7 +362,7 @@
     vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv );
 
     // we cannot grab mouse events on root window :(
-    XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | 
+    XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask |
 	((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)) );
 
 #ifdef HAVE_XF86VM
--- a/libvo/vo_xmga.c	Thu Apr 25 20:59:12 2002 +0000
+++ b/libvo/vo_xmga.c	Thu Apr 25 21:52:47 2002 +0000
@@ -278,7 +278,7 @@
    xWAttribs.colormap=XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ),vinfo.visual,AllocNone );
    xWAttribs.background_pixel=0;
    xWAttribs.border_pixel=0;
-   xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask | 
+   xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask | PropertyChangeMask |
        ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask));
    xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
 
@@ -296,7 +296,6 @@
      vinfo.visual,xswamask,&xWAttribs );
    vo_x11_classhint( mDisplay,vo_window,"xmga" );
    vo_hidecursor(mDisplay,vo_window);
-   vo_x11_sizehint( wndX,wndY,wndWidth,wndHeight );
 
    if ( vo_fs ) vo_x11_decoration( mDisplay,vo_window,0 );
 
--- a/libvo/vo_xv.c	Thu Apr 25 20:59:12 2002 +0000
+++ b/libvo/vo_xv.c	Thu Apr 25 21:52:47 2002 +0000
@@ -417,7 +417,7 @@
    vo_x11_classhint( mDisplay,vo_window,"xv" );
    vo_hidecursor(mDisplay,vo_window);
 
-   XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | 
+   XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask |
 	((WinID==0) ? 0 : (PointerMotionMask
 #ifdef HAVE_NEW_INPUT
 		| ButtonPressMask | ButtonReleaseMask
--- a/libvo/x11_common.c	Thu Apr 25 20:59:12 2002 +0000
+++ b/libvo/x11_common.c	Thu Apr 25 21:52:47 2002 +0000
@@ -453,6 +453,7 @@
 
        int vo_mouse_timer_const = 30;
 static int vo_mouse_counter = 30;
+       int vo_wm_type = 1;
 
 int vo_x11_check_events(Display *mydisplay){
  int ret=0;
@@ -497,8 +498,9 @@
 		&vo_dx, &vo_dy, (Window *)&foo);
 	    }
 #endif
-	   if (verbose)
+//	   if (verbose)
 	    printf("X11 Window %dx%d-%dx%d\n", vo_dx, vo_dy, vo_dwidth, vo_dheight);
+	    printf("============================================================\n" );
            ret|=VO_EVENT_RESIZE;
            break;
       case KeyPress:
@@ -539,32 +541,42 @@
            mplayer_put_key(MOUSE_BTN0+Event.xbutton.button-1);
            break;
 #endif
+      case PropertyNotify: 
+	   if ( !strcmp( XGetAtomName( mydisplay,Event.xproperty.atom ),"_ICEWM_TRAY" ) ||
+		!strncmp( XGetAtomName( mydisplay,Event.xproperty.atom ),"_KDE_",5 ) ||
+	        !strcmp( XGetAtomName( mydisplay,Event.xproperty.atom ),"KWM_WIN_DESKTOP" ) ) vo_wm_type=0;
+		
+ 	     fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",
+	      vo_window,XGetAtomName( mydisplay,Event.xproperty.atom ),Event.xproperty.atom );
+
+	   break;
      }
   }
 
   return ret;
 }
 
-void vo_x11_sizehint( int x, int y, int width, int height )
+void vo_x11_sizehint( int x, int y, int width, int height, int max )
 {
- vo_hint.flags=PPosition | PSize | PWinGravity;
+ vo_hint.flags=PPosition | PSize | PWinGravity | PBaseSize;
  vo_hint.x=x; vo_hint.y=y; vo_hint.width=width; vo_hint.height=height;
+ if ( max )
+  {
+   vo_hint.max_width=width; vo_hint.max_height=height;
+   vo_hint.flags|=PMaxSize;
+  } else { vo_hint.max_width=0; vo_hint.max_height=0; }
+ vo_hint.base_width=width; vo_hint.base_height=height;
  vo_hint.win_gravity=StaticGravity;
  XSetWMNormalHints( mDisplay,vo_window,&vo_hint );
 }
 
 void vo_x11_fullscreen( void )
 {
- XUnmapWindow( mDisplay,vo_window );
+ if ( vo_wm_type ) XUnmapWindow( mDisplay,vo_window );
  if ( !vo_fs )
   {
    vo_fs=VO_TRUE;
    vo_old_x=vo_dx; vo_old_y=vo_dy; vo_old_width=vo_dwidth;   vo_old_height=vo_dheight;
-//   {
-//    Window root; int foo, foo2;
-//    XGetGeometry( mDisplay,vo_window,&root,&vo_old_x,&vo_old_y,&vo_old_width,vo_old_height,&foo,&foo2 );
-//    XTranslateCoordinates( mDisplay,vo_window,root,0,0,&vo_old_x,&vo_old_y,(Window *)&foo);
-//   }
    vo_dx=0;        vo_dy=0;        vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight;
    vo_x11_decoration( mDisplay,vo_window,0 );
   }
@@ -574,10 +586,12 @@
     vo_dx=vo_old_x; vo_dy=vo_old_y; vo_dwidth=vo_old_width; vo_dheight=vo_old_height;
     vo_x11_decoration( mDisplay,vo_window,1 );
    }
- vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight );
+ vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
  XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
- XMapWindow( mDisplay,vo_window );
- XSync( mDisplay,False );
+ XMapRaised( mDisplay,vo_window );
+ 
+ XRaiseWindow( mDisplay,vo_window );
+ XFlush( mDisplay );
 }
 
 void saver_on(Display *mDisplay) {
--- a/libvo/x11_common.h	Thu Apr 25 20:59:12 2002 +0000
+++ b/libvo/x11_common.h	Thu Apr 25 21:52:47 2002 +0000
@@ -28,7 +28,7 @@
 extern void vo_showcursor( Display *disp, Window win );
 void vo_x11_decoration( Display * vo_Display,Window w,int d );
 void vo_x11_classhint( Display * display,Window window,char *name );
-void vo_x11_sizehint( int x, int y, int width, int height );
+void vo_x11_sizehint( int x, int y, int width, int height, int max );
 int vo_x11_check_events(Display *mydisplay);
 void vo_x11_fullscreen( void );
 #endif