]> git.sesse.net Git - vlc/blobdiff - plugins/x11/vout_x11.c
* Fixed the BeOS compile typo.
[vlc] / plugins / x11 / vout_x11.c
index 5ab0b4960d14e1d97cd78ddec06602d4a4c91917..eb7c2a3c3778507ad446cd37f9a39ea006ac9dcf 100644 (file)
@@ -2,10 +2,11 @@
  * vout_x11.c: X11 video output display method
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout_x11.c,v 1.16 2001/03/16 22:37:06 massiot 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>
+ *          David Kennedy <dkennedy@tinytoad.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #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>
@@ -52,7 +57,6 @@
 #include "threads.h"
 #include "mtime.h"
 #include "tests.h"
-#include "modules.h"
 
 #include "video.h"
 #include "video_output.h"
 #include "interface.h"
 #include "intf_msg.h"
 
+#include "netutils.h"                                 /* network_ChannelJoin */
+
 #include "main.h"
 
+#include "modules.h"
+#include "modules_export.h"
+
 /*****************************************************************************
  * vout_sys_t: video output X11 method descriptor
  *****************************************************************************
@@ -100,11 +109,26 @@ typedef struct vout_sys_s
     int                 i_ss_blanking;                      /* blanking mode */
     int                 i_ss_exposure;                      /* exposure mode */
 
+    /* Auto-hide cursor */
+    mtime_t     i_lastmoved;
+    
     /* Mouse pointer properties */
     boolean_t           b_mouse;         /* is the mouse pointer displayed ? */
 
 } vout_sys_t;
 
+/* Fullscreen needs to be able to hide the wm decorations */
+#define MWM_HINTS_DECORATIONS   (1L << 1)
+#define PROP_MWM_HINTS_ELEMENTS 5
+typedef struct mwmhints_s
+{
+    u32 flags;
+    u32 functions;
+    u32 decorations;
+    s32 input_mode;
+    u32 status;
+} mwmhints_t;
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -178,7 +202,7 @@ static int vout_Create( vout_thread_t *p_vout )
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
     {
-        intf_ErrMsg("error: %s", strerror(ENOMEM) );
+        intf_ErrMsg( "vout error: %s", strerror(ENOMEM) );
         return( 1 );
     }
 
@@ -188,17 +212,21 @@ static int vout_Create( vout_thread_t *p_vout )
 
     if( p_vout->p_sys->p_display == NULL )                          /* error */
     {
-        intf_ErrMsg("error: can't open display %s\n", psz_display );
+        intf_ErrMsg( "vout error: cannot open display %s", psz_display );
         free( p_vout->p_sys );
         return( 1 );
     }
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
 
+    p_vout->b_fullscreen
+        = main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT );
+
     /* Spawn base window - this window will include the video output window,
      * but also command buttons, subtitles and other indicators */
+
     if( X11CreateWindow( p_vout ) )
     {
-        intf_ErrMsg("error: can't create interface window\n" );
+        intf_ErrMsg( "vout error: cannot create X11 window" );
         XCloseDisplay( p_vout->p_sys->p_display );
         free( p_vout->p_sys );
         return( 1 );
@@ -210,7 +238,7 @@ static int vout_Create( vout_thread_t *p_vout )
      * id is still valid. */
     if( X11InitDisplay( p_vout, psz_display ) )
     {
-        intf_ErrMsg("error: can't initialize X11 display" );
+        intf_ErrMsg( "vout error: cannot initialize X11 display" );
         XCloseDisplay( p_vout->p_sys->p_display );
         free( p_vout->p_sys );
         return( 1 );
@@ -259,7 +287,7 @@ static int vout_Init( vout_thread_t *p_vout )
         }
         if( i_err )                                      /* an error occured */
         {
-            intf_Msg("vout: XShm video extension unavailable" );
+            intf_Msg( "vout: XShm video extension unavailable" );
             p_vout->p_sys->b_shm = 0;
         }
     }
@@ -269,14 +297,14 @@ static int vout_Init( vout_thread_t *p_vout )
     {
         if( X11CreateImage( p_vout, &p_vout->p_sys->p_ximage[0] ) )
         {
-            intf_ErrMsg("error: can't create images");
+            intf_ErrMsg( "vout error: cannot create images" );
             p_vout->p_sys->p_ximage[0] = NULL;
             p_vout->p_sys->p_ximage[1] = NULL;
             return( 1 );
         }
         if( X11CreateImage( p_vout, &p_vout->p_sys->p_ximage[1] ) )
         {
-            intf_ErrMsg("error: can't create images");
+            intf_ErrMsg( "vout error: cannot create images" );
             X11DestroyImage( p_vout->p_sys->p_ximage[0] );
             p_vout->p_sys->p_ximage[0] = NULL;
             p_vout->p_sys->p_ximage[1] = NULL;
@@ -286,8 +314,12 @@ 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();
+    
     return( 0 );
 }
 
@@ -352,15 +384,18 @@ static int vout_Manage( vout_thread_t *p_vout )
     XEvent      xevent;                                         /* X11 event */
     boolean_t   b_resized;                        /* window has been resized */
     char        i_key;                                    /* ISO Latin-1 key */
+    KeySym      x_key_symbol;
 
     /* Handle X11 events: ConfigureNotify events are parsed to know if the
      * 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;
     while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
                               StructureNotifyMask | KeyPressMask |
-                              ButtonPressMask | ButtonReleaseMask, &xevent )
+                              ButtonPressMask | ButtonReleaseMask | 
+                              PointerMotionMask | Button1MotionMask , &xevent )
            == True )
     {
         /* ConfigureNotify event: prepare  */
@@ -394,16 +429,77 @@ static int vout_Manage( vout_thread_t *p_vout )
         /* Keyboard event */
         else if( xevent.type == KeyPress )
         {
-            if( XLookupString( &xevent.xkey, &i_key, 1, NULL, NULL ) )
+            /* We may have keys like F1 trough F12, ESC ... */
+            x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
+                                             xevent.xkey.keycode, 0 );
+            switch( x_key_symbol )
             {
-                /* FIXME: handle stuff here */
-                switch( i_key )
-                {
-                case 'q':
-                    /* FIXME: need locking ! */
-                    p_main->p_intf->b_die = 1;
-                    break;
-                }
+                 case XK_Escape:
+                     p_main->p_intf->b_die = 1;
+                     break;
+                 case XK_Menu:
+                     p_main->p_intf->b_menu_change = 1;
+                     break;
+                 default:
+                     /* "Normal Keys"
+                      * The reason why I use this instead of XK_0 is that 
+                      * with XLookupString, we don't have to care about
+                      * keymaps. */
+
+                    if( XLookupString( &xevent.xkey, &i_key, 1, NULL, NULL ) )
+                    {
+                        /* FIXME: handle stuff here */
+                        switch( i_key )
+                        {
+                        case 'q':
+                        case 'Q':
+                            p_main->p_intf->b_die = 1;
+                            break;
+                        case 'f':
+                        case 'F':
+                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+                            break;
+                        case '0':
+                            network_ChannelJoin( 0 );
+                            break;
+                        case '1':
+                            network_ChannelJoin( 1 );
+                            break;
+                        case '2':
+                            network_ChannelJoin( 2 );
+                            break;
+                        case '3':
+                            network_ChannelJoin( 3 );
+                            break;
+                        case '4':
+                            network_ChannelJoin( 4 );
+                            break;
+                        case '5':
+                            network_ChannelJoin( 5 );
+                            break;
+                        case '6':
+                            network_ChannelJoin( 6 );
+                            break;
+                        case '7':
+                            network_ChannelJoin( 7 );
+                            break;
+                        case '8':
+                            network_ChannelJoin( 8 );
+                            break;
+                        case '9':
+                            network_ChannelJoin( 9 );
+                            break;
+                        default:
+                            if( intf_ProcessKey( p_main->p_intf, 
+                                                 (char )i_key ) )
+                            {
+                               intf_DbgMsg( "vout: unhandled key '%c' (%i)", 
+                                            (char)i_key, i_key );
+                            }
+                            break;
+                        }
+                    }
+                break;
             }
         }
         /* Mouse click */
@@ -415,10 +511,6 @@ static int vout_Manage( vout_thread_t *p_vout )
                     /* in this part we will eventually manage
                      * clicks for DVD navigation for instance */
                     break;
-
-                case Button2:
-                    X11TogglePointer( p_vout );
-                    break;
             }
         }
         /* Mouse release */
@@ -432,14 +524,20 @@ static int vout_Manage( vout_thread_t *p_vout )
                     break;
             }
         }
-#ifdef DEBUG
+        /* Mouse move */
+        else if( xevent.type == MotionNotify )
+        {
+            p_vout->p_sys->i_lastmoved = mdate();
+            if( ! p_vout->p_sys->b_mouse )
+            {
+                X11TogglePointer( p_vout ); 
+            }
+        }
         /* Other event */
         else
         {
-            intf_DbgMsg( "%p -> unhandled event type %d received",
-                         p_vout, xevent.type );
+            intf_WarnMsg( 3, "vout: unhandled event %d received", xevent.type );
         }
-#endif
     }
 
     /* ClientMessage event - only WM_PROTOCOLS with WM_DELETE_WINDOW data
@@ -455,8 +553,45 @@ static int vout_Manage( vout_thread_t *p_vout )
         }
         else
         {
-            intf_DbgMsg( "%p -> unhandled ClientMessage received", p_vout );
+            intf_DbgMsg( "vout: unhandled ClientMessage received" );
+        }
+    }
+
+    if ( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
+    {
+        char *psz_display;
+        /* 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->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 );
+        XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->gc );
+
+        /* And create a new one */
+        if( X11CreateWindow( p_vout ) )
+        {
+            intf_ErrMsg( "vout error: cannot create X11 window" );
+            XCloseDisplay( p_vout->p_sys->p_display );
+
+            free( p_vout->p_sys );
+            return( 1 );
+        }
+
+        if( X11InitDisplay( p_vout, psz_display ) )
+        {
+            intf_ErrMsg( "vout error: cannot initialize X11 display" );
+            XCloseDisplay( p_vout->p_sys->p_display );
+            free( p_vout->p_sys );
+            return( 1 );
         }
+        /* We've changed the size, update it */
+        p_vout->i_changes |= VOUT_SIZE_CHANGE;
     }
 
     /*
@@ -465,7 +600,7 @@ static int vout_Manage( vout_thread_t *p_vout )
     if( b_resized )
     {
         /* If interface window has been resized, change vout size */
-        intf_DbgMsg( "resizing output window" );
+        intf_DbgMsg( "vout: resizing output window" );
         p_vout->i_width =  p_vout->p_sys->i_width;
         p_vout->i_height = p_vout->p_sys->i_height;
         p_vout->i_changes |= VOUT_SIZE_CHANGE;
@@ -474,7 +609,7 @@ static int vout_Manage( vout_thread_t *p_vout )
              (p_vout->i_height != p_vout->p_sys->i_height) )
     {
         /* If video output size has changed, change interface window size */
-        intf_DbgMsg( "resizing output window" );
+        intf_DbgMsg( "vout: resizing output window" );
         p_vout->p_sys->i_width =    p_vout->i_width;
         p_vout->p_sys->i_height =   p_vout->i_height;
         XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
@@ -494,7 +629,7 @@ static int vout_Manage( vout_thread_t *p_vout )
      */
     if( p_vout->i_changes & VOUT_SIZE_CHANGE )
     {
-        intf_DbgMsg("resizing window");
+        intf_DbgMsg( "vout info: resizing window" );
         p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
 
         /* Resize window */
@@ -507,7 +642,7 @@ static int vout_Manage( vout_thread_t *p_vout )
         /* Recreate XImages. If SysInit failed, the thread can't go on. */
         if( vout_Init( p_vout ) )
         {
-            intf_ErrMsg("error: can't resize display");
+            intf_ErrMsg( "vout error: cannot resize display" );
             return( 1 );
        }
 
@@ -515,9 +650,21 @@ static int vout_Manage( vout_thread_t *p_vout )
          * tables. This is needed since conversion buffer size may have
          * changed */
         p_vout->i_changes |= VOUT_YUV_CHANGE;
-        intf_Msg("vout: video display resized (%dx%d)", p_vout->i_width, p_vout->i_height);
+        intf_Msg( "vout: video display resized (%dx%d)",
+                  p_vout->i_width, p_vout->i_height);
+    }
+
+    /* Autohide Cursour */
+    if( mdate() - p_vout->p_sys->i_lastmoved > 2000000 )
+    {
+        /* Hide the mouse automatically */
+        if( p_vout->p_sys->b_mouse )
+        {
+            X11TogglePointer( p_vout ); 
+        }
     }
 
+    
     return 0;
 }
 
@@ -567,7 +714,7 @@ static void vout_SetPalette( p_vout_thread_t p_vout,
     int i, j;
     XColor p_colors[255];
 
-    intf_DbgMsg( "Palette change called" );
+    intf_DbgMsg( "vout: Palette change called" );
 
     /* allocate palette */
     for( i = 0, j = 255; i < 255; i++, j-- )
@@ -597,15 +744,33 @@ static int X11CreateWindow( vout_thread_t *p_vout )
     XSetWindowAttributes    xwindow_attributes;
     XGCValues               xgcvalues;
     XEvent                  xevent;
+    Atom                    prop;
+    mwmhints_t              mwmhints;
+
     boolean_t               b_expose;
     boolean_t               b_configure_notify;
     boolean_t               b_map_notify;
 
-    /* Set main window's size */
-    p_vout->p_sys->i_width =  main_GetIntVariable( VOUT_WIDTH_VAR,
-                                                   VOUT_WIDTH_DEFAULT );
-    p_vout->p_sys->i_height = main_GetIntVariable( VOUT_HEIGHT_VAR,
-                                                   VOUT_HEIGHT_DEFAULT );
+    /* If we're full screen, we're full screen! */
+    if( p_vout->b_fullscreen ) 
+    {
+        p_vout->p_sys->i_width = DisplayWidth( p_vout->p_sys->p_display, 
+                                               p_vout->p_sys->i_screen );
+        p_vout->p_sys->i_height =  DisplayHeight( p_vout->p_sys->p_display, 
+                                                  p_vout->p_sys->i_screen ); 
+        p_vout->i_width =  p_vout->p_sys->i_width;
+        p_vout->i_height = p_vout->p_sys->i_height;
+    }
+    else
+    {
+        /* Set main window's size */
+        p_vout->p_sys->i_width =  main_GetIntVariable( VOUT_WIDTH_VAR,
+                                                       VOUT_WIDTH_DEFAULT );
+        p_vout->p_sys->i_height = main_GetIntVariable( VOUT_HEIGHT_VAR,
+                                                       VOUT_HEIGHT_DEFAULT );
+        p_vout->i_width =  p_vout->p_sys->i_width;
+        p_vout->i_height = p_vout->p_sys->i_height;
+    }
 
     /* Prepare window manager hints and properties */
     xsize_hints.base_width          = p_vout->p_sys->i_width;
@@ -618,21 +783,36 @@ static int X11CreateWindow( vout_thread_t *p_vout )
 
     /* Prepare window attributes */
     xwindow_attributes.backing_store = Always;       /* save the hidden part */
-    xwindow_attributes.background_pixel = WhitePixel( p_vout->p_sys->p_display,
+    xwindow_attributes.background_pixel = BlackPixel( p_vout->p_sys->p_display,
                                                       p_vout->p_sys->i_screen );
-
     xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
+    
 
     /* Create the window and set hints - the window must receive ConfigureNotify
      * events, and, until it is displayed, Expose and MapNotify events. */
+
     p_vout->p_sys->window =
-            XCreateWindow( p_vout->p_sys->p_display,
-                           DefaultRootWindow( p_vout->p_sys->p_display ),
-                           0, 0,
-                           p_vout->p_sys->i_width, p_vout->p_sys->i_height, 1,
-                           0, InputOutput, 0,
-                           CWBackingStore | CWBackPixel | CWEventMask,
-                           &xwindow_attributes );
+        XCreateWindow( p_vout->p_sys->p_display,
+                       DefaultRootWindow( p_vout->p_sys->p_display ),
+                       0, 0,
+                       p_vout->p_sys->i_width, p_vout->p_sys->i_height, 0,
+                       0, InputOutput, 0,
+                       CWBackingStore | CWBackPixel | CWEventMask,
+                       &xwindow_attributes );
+
+    if ( p_vout->b_fullscreen )
+    {
+        prop = XInternAtom(p_vout->p_sys->p_display, "_MOTIF_WM_HINTS", False);
+        mwmhints.flags = MWM_HINTS_DECORATIONS;
+        mwmhints.decorations = 0;
+        XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                         prop, prop, 32, PropModeReplace,
+                         (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS );
+
+        XSetTransientForHint( p_vout->p_sys->p_display,
+                              p_vout->p_sys->window, None );
+        XRaiseWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
+    }
 
     /* Set window manager hints and properties: size hints, command,
      * window's name, and accepted protocols */
@@ -649,7 +829,7 @@ static int X11CreateWindow( vout_thread_t *p_vout )
                              &p_vout->p_sys->wm_delete_window, 1 ) )
     {
         /* WM_DELETE_WINDOW is not supported by window manager */
-        intf_Msg( "intf error: missing or bad window manager" );
+        intf_Msg( "vout error: missing or bad window manager" );
     }
 
     /* Creation of a graphic context that doesn't generate a GraphicsExpose
@@ -692,7 +872,8 @@ static int X11CreateWindow( vout_thread_t *p_vout )
 
     XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window,
                   StructureNotifyMask | KeyPressMask |
-                  ButtonPressMask | ButtonReleaseMask );
+                  ButtonPressMask | ButtonReleaseMask | 
+                  PointerMotionMask );
 
     if( XDefaultDepth(p_vout->p_sys->p_display, p_vout->p_sys->i_screen) == 8 )
     {
@@ -710,8 +891,16 @@ static int X11CreateWindow( vout_thread_t *p_vout )
                                  CWColormap, &xwindow_attributes );
     }
 
+    if( p_vout->b_fullscreen )
+    {
+        XSetInputFocus( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                        RevertToNone, CurrentTime );
+        XMoveWindow( p_vout->p_sys->p_display, p_vout->p_sys->window, 0, 0 );
+    }
+
     /* At this stage, the window is open, displayed, and ready to
      * receive data */
+
     return( 0 );
 }
 
@@ -728,13 +917,15 @@ static int X11InitDisplay( vout_thread_t *p_vout, char *psz_display )
     XVisualInfo                 xvisual_template;         /* visual template */
     int                         i_count;                       /* array size */
 
+
+
     /* Initialize structure */
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
     p_vout->p_sys->b_shm    = ( XShmQueryExtension( p_vout->p_sys->p_display )
                                  == True );
     if( !p_vout->p_sys->b_shm )
     {
-        intf_Msg("vout: XShm video extension is not available");
+        intf_Msg( "vout: XShm video extension is not available" );
     }
 
     /* Get screen depth */
@@ -753,7 +944,7 @@ static int X11InitDisplay( vout_thread_t *p_vout, char *psz_display )
                                     &xvisual_template, &i_count );
         if( p_xvisual == NULL )
         {
-            intf_ErrMsg("vout error: no PseudoColor visual available");
+            intf_ErrMsg( "vout error: no PseudoColor visual available" );
             return( 1 );
         }
         p_vout->i_bytes_per_pixel = 1;
@@ -772,7 +963,7 @@ static int X11InitDisplay( vout_thread_t *p_vout, char *psz_display )
                                     &xvisual_template, &i_count );
         if( p_xvisual == NULL )
         {
-            intf_ErrMsg("vout error: no TrueColor visual available");
+            intf_ErrMsg( "vout error: no TrueColor visual available" );
             return( 1 );
         }
         p_vout->i_red_mask =        p_xvisual->red_mask;
@@ -822,7 +1013,7 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
     pb_data = (byte_t *) malloc( p_vout->i_bytes_per_line * p_vout->i_height );
     if( !pb_data )                                                  /* error */
     {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
+        intf_ErrMsg( "vout error: %s", strerror(ENOMEM));
         return( 1 );
     }
 
@@ -851,7 +1042,7 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
                                p_vout->i_width, p_vout->i_height, i_quantum, 0);
     if(! *pp_ximage )                                               /* error */
     {
-        intf_ErrMsg( "error: XCreateImage() failed" );
+        intf_ErrMsg( "vout error: XCreateImage() failed" );
         free( pb_data );
         return( 1 );
     }
@@ -877,7 +1068,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
                          p_shm_info, p_vout->i_width, p_vout->i_height );
     if(! *pp_ximage )                                               /* error */
     {
-        intf_ErrMsg("error: XShmCreateImage() failed");
+        intf_ErrMsg( "vout error: XShmCreateImage() failed" );
         return( 1 );
     }
 
@@ -888,7 +1079,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
                                  * (*pp_ximage)->height, IPC_CREAT | 0777);
     if( p_shm_info->shmid < 0)                                      /* error */
     {
-        intf_ErrMsg("error: can't allocate shared image data (%s)",
+        intf_ErrMsg( "vout error: cannot allocate shared image data (%s)",
                     strerror(errno));
         XDestroyImage( *pp_ximage );
         return( 1 );
@@ -898,7 +1089,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
     p_shm_info->shmaddr = (*pp_ximage)->data = shmat(p_shm_info->shmid, 0, 0);
     if(! p_shm_info->shmaddr )
     {                                                               /* error */
-        intf_ErrMsg("error: can't attach shared memory (%s)",
+        intf_ErrMsg( "vout error: cannot attach shared memory (%s)",
                     strerror(errno));
         shmctl( p_shm_info->shmid, IPC_RMID, 0 );      /* free shared memory */
         XDestroyImage( *pp_ximage );
@@ -914,7 +1105,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
     if( XShmAttach( p_vout->p_sys->p_display, p_shm_info )
          == False )                                                 /* error */
     {
-        intf_ErrMsg("error: can't attach shared memory to X11 server");
+        intf_ErrMsg( "vout error: cannot attach shared memory to X11 server" );
         shmdt( p_shm_info->shmaddr );   /* detach shared memory from process
                                          * and automatic free */
         XDestroyImage( *pp_ximage );
@@ -962,7 +1153,7 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
 
     if( shmdt( p_shm_info->shmaddr ) )  /* detach shared memory from process */
     {                                   /* also automatic freeing...         */
-        intf_ErrMsg( "error: can't detach shared memory (%s)",
+        intf_ErrMsg( "vout error: cannot detach shared memory (%s)",
                      strerror(errno) );
     }
 }
@@ -981,7 +1172,7 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
  *****************************************************************************/
 void X11EnableScreenSaver( vout_thread_t *p_vout )
 {
-    intf_DbgMsg( "intf: enabling screen saver" );
+    intf_DbgMsg( "vout: enabling screen saver" );
     XSetScreenSaver( p_vout->p_sys->p_display, p_vout->p_sys->i_ss_timeout,
                      p_vout->p_sys->i_ss_interval,
                      p_vout->p_sys->i_ss_blanking,
@@ -1002,7 +1193,7 @@ void X11DisableScreenSaver( vout_thread_t *p_vout )
                      &p_vout->p_sys->i_ss_exposure );
 
     /* Disable screen saver */
-    intf_DbgMsg("intf: disabling screen saver");
+    intf_DbgMsg( "vout: disabling screen saver" );
     XSetScreenSaver( p_vout->p_sys->p_display, 0,
                      p_vout->p_sys->i_ss_interval,
                      p_vout->p_sys->i_ss_blanking,