]> git.sesse.net Git - vlc/blobdiff - plugins/x11/vout_x11.c
* Fixed the BeOS compile typo.
[vlc] / plugins / x11 / vout_x11.c
index e10bd686320a97161f883341fa73fe99260c75e4..eb7c2a3c3778507ad446cd37f9a39ea006ac9dcf 100644 (file)
@@ -2,7 +2,7 @@
  * vout_x11.c: X11 video output display method
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout_x11.c,v 1.20 2001/04/21 22:49:24 sam Exp $
+ * $Id: vout_x11.c,v 1.26 2001/05/30 17:03:12 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 #include <sys/ipc.h>
 #endif
 
+#ifndef WIN32
+#include <netinet/in.h>                               /* BSD: struct in_addr */
+#endif
+
 #include <sys/shm.h>                                   /* shmget(), shmctl() */
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -53,7 +57,6 @@
 #include "threads.h"
 #include "mtime.h"
 #include "tests.h"
-#include "modules.h"
 
 #include "video.h"
 #include "video_output.h"
@@ -65,6 +68,9 @@
 
 #include "main.h"
 
+#include "modules.h"
+#include "modules_export.h"
+
 /*****************************************************************************
  * vout_sys_t: video output X11 method descriptor
  *****************************************************************************
@@ -109,9 +115,6 @@ typedef struct vout_sys_s
     /* Mouse pointer properties */
     boolean_t           b_mouse;         /* is the mouse pointer displayed ? */
 
-    /* Displaying fullscreen */
-    boolean_t           b_fullscreen;
-
 } vout_sys_t;
 
 /* Fullscreen needs to be able to hide the wm decorations */
@@ -215,7 +218,7 @@ static int vout_Create( vout_thread_t *p_vout )
     }
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
 
-    p_vout->p_sys->b_fullscreen
+    p_vout->b_fullscreen
         = main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT );
 
     /* Spawn base window - this window will include the video output window,
@@ -311,8 +314,8 @@ static int vout_Init( vout_thread_t *p_vout )
 
     /* Set bytes per line and initialize buffers */
     p_vout->i_bytes_per_line = p_vout->p_sys->p_ximage[0]->bytes_per_line;
-    vout_SetBuffers( p_vout, p_vout->p_sys->p_ximage[ 0 ]->data,
-                     p_vout->p_sys->p_ximage[ 1 ]->data );
+    p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_ximage[ 0 ]->data,
+                                   p_vout->p_sys->p_ximage[ 1 ]->data );
 
     /* Set date for autohiding cursor */
     p_vout->p_sys->i_lastmoved = mdate();
@@ -380,7 +383,6 @@ static int vout_Manage( vout_thread_t *p_vout )
 {
     XEvent      xevent;                                         /* X11 event */
     boolean_t   b_resized;                        /* window has been resized */
-    boolean_t   b_gofullscreen;                    /* user wants full-screen */
     char        i_key;                                    /* ISO Latin-1 key */
     KeySym      x_key_symbol;
 
@@ -388,9 +390,8 @@ static int vout_Manage( vout_thread_t *p_vout )
      * output window's size changed, MapNotify and UnmapNotify to know if the
      * window is mapped (and if the display is useful), and ClientMessages
      * to intercept window destruction requests */
-    b_resized = 0;
-    b_gofullscreen = 0;
 
+    b_resized = 0;
     while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
                               StructureNotifyMask | KeyPressMask |
                               ButtonPressMask | ButtonReleaseMask | 
@@ -456,7 +457,7 @@ static int vout_Manage( vout_thread_t *p_vout )
                             break;
                         case 'f':
                         case 'F':
-                            b_gofullscreen = 1;
+                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
                             break;
                         case '0':
                             network_ChannelJoin( 0 );
@@ -532,13 +533,11 @@ static int vout_Manage( vout_thread_t *p_vout )
                 X11TogglePointer( p_vout ); 
             }
         }
-#ifdef DEBUG
         /* Other event */
         else
         {
-            intf_DbgMsg( "vout: unhandled event %d received", xevent.type );
+            intf_WarnMsg( 3, "vout: unhandled event %d received", xevent.type );
         }
-#endif
     }
 
     /* ClientMessage event - only WM_PROTOCOLS with WM_DELETE_WINDOW data
@@ -558,15 +557,17 @@ static int vout_Manage( vout_thread_t *p_vout )
         }
     }
 
-    if ( b_gofullscreen )
+    if ( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
     {
         char *psz_display;
-        /* Open display, unsing 'vlc_display' or DISPLAY environment variable */
+        /* Open display, unsing 'vlc_display' or the DISPLAY
+         * environment variable */
         psz_display = XDisplayName( main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) );
 
         intf_DbgMsg( "vout: changing full-screen status" );
 
-        p_vout->p_sys->b_fullscreen = !p_vout->p_sys->b_fullscreen;
+        p_vout->b_fullscreen = !p_vout->b_fullscreen;
+        p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
 
         /* Get rid of the old window */
         XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
@@ -751,7 +752,7 @@ static int X11CreateWindow( vout_thread_t *p_vout )
     boolean_t               b_map_notify;
 
     /* If we're full screen, we're full screen! */
-    if( p_vout->p_sys->b_fullscreen ) 
+    if( p_vout->b_fullscreen ) 
     {
         p_vout->p_sys->i_width = DisplayWidth( p_vout->p_sys->p_display, 
                                                p_vout->p_sys->i_screen );
@@ -799,7 +800,7 @@ static int X11CreateWindow( vout_thread_t *p_vout )
                        CWBackingStore | CWBackPixel | CWEventMask,
                        &xwindow_attributes );
 
-    if ( p_vout->p_sys->b_fullscreen )
+    if ( p_vout->b_fullscreen )
     {
         prop = XInternAtom(p_vout->p_sys->p_display, "_MOTIF_WM_HINTS", False);
         mwmhints.flags = MWM_HINTS_DECORATIONS;
@@ -890,7 +891,7 @@ static int X11CreateWindow( vout_thread_t *p_vout )
                                  CWColormap, &xwindow_attributes );
     }
 
-    if( p_vout->p_sys->b_fullscreen )
+    if( p_vout->b_fullscreen )
     {
         XSetInputFocus( p_vout->p_sys->p_display, p_vout->p_sys->window,
                         RevertToNone, CurrentTime );