[vlc-devel] commit: skins2(Linux): support clean exit when user closes vlc via the taskbar (Erwan Tulou )

git version control git at videolan.org
Fri Feb 26 23:57:59 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Feb 25 22:28:39 2010 +0100| [cfcad6458ccd9ba173d0c43fbd5811e22f4a7816] | committer: Erwan Tulou 

skins2(Linux): support clean exit when user closes vlc via the taskbar

if not managed, vlc terminates with a "vlc: Fatal IO error: client killed"

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cfcad6458ccd9ba173d0c43fbd5811e22f4a7816
---

 modules/gui/skins2/x11/x11_display.cpp |    4 ++++
 modules/gui/skins2/x11/x11_loop.cpp    |   14 ++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_display.cpp b/modules/gui/skins2/x11/x11_display.cpp
index 0a4b954..27adb1e 100644
--- a/modules/gui/skins2/x11/x11_display.cpp
+++ b/modules/gui/skins2/x11/x11_display.cpp
@@ -209,6 +209,10 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
         m_mainWindow = XCreateWindow( m_pDisplay, root, 0, 0, 1, 1, 0, 0,
                                       InputOutput, CopyFromParent, 0, &attr );
 
+        // Receive WM_DELETE_WINDOW
+        Atom wm_delete = XInternAtom( m_pDisplay, "WM_DELETE_WINDOW", False);
+        XSetWMProtocols( m_pDisplay, m_mainWindow, &wm_delete, 1);
+
         // Changing decorations
         struct {
             unsigned long flags;
diff --git a/modules/gui/skins2/x11/x11_loop.cpp b/modules/gui/skins2/x11/x11_loop.cpp
index d03cf08..2436c69 100644
--- a/modules/gui/skins2/x11/x11_loop.cpp
+++ b/modules/gui/skins2/x11/x11_loop.cpp
@@ -180,6 +180,20 @@ void X11Loop::handleX11Event()
                 // pTheme->getWindowManager().synchVisibility();
             }
         }
+        if( event.type == ClientMessage )
+        {
+            Atom wm_protocols =
+                XInternAtom( XDISPLAY, "WM_PROTOCOLS", False);
+            Atom wm_delete =
+                XInternAtom( XDISPLAY, "WM_DELETE_WINDOW", False);
+
+            if( event.xclient.message_type == wm_protocols &&
+                event.xclient.data.l[0] == wm_delete )
+            {
+                msg_Dbg( getIntf(), "Received WM_DELETE_WINDOW message" );
+                libvlc_Quit( getIntf()->p_libvlc );
+            }
+        }
         return;
     }
 




More information about the vlc-devel mailing list