]> git.sesse.net Git - vlc/commitdiff
* event broadcasting should work
authorOlivier Teulière <ipkiss@videolan.org>
Tue, 15 Apr 2003 17:55:49 +0000 (17:55 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Tue, 15 Apr 2003 17:55:49 +0000 (17:55 +0000)
modules/gui/skins/gtk2/gtk2_api.cpp
modules/gui/skins/gtk2/gtk2_event.cpp
modules/gui/skins/gtk2/gtk2_run.cpp
modules/gui/skins/gtk2/gtk2_window.cpp

index 8a7533226b21e1379494885162da3a623c10bcdc..89ab893b63144c3e626d6079a342c3b51debc97b 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_api.cpp: Various gtk2-specific functions
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_api.cpp,v 1.5 2003/04/14 21:38:31 asmax Exp $
+ * $Id: gtk2_api.cpp,v 1.6 2003/04/15 17:55:49 ipkiss Exp $
  *
  * Authors: Cyril Deguet  <asmax@videolan.org>
  *
@@ -34,6 +34,7 @@
 #include "os_api.h"
 #include "event.h"         // for MAX_PARAM_SIZE
 
+#include <stdio.h>
 
 //---------------------------------------------------------------------------
 // Event API
@@ -51,11 +52,24 @@ void OSAPI_SendMessage( Window *win, unsigned int message, unsigned int param1,
 void OSAPI_PostMessage( Window *win, unsigned int message, unsigned int param1,
                         long param2 )
 {
-/*    if( win == NULL )
-        PostMessage( NULL, message, param1, param2 );
+    GdkEventClient *event = new GdkEventClient;
+    event->type = GDK_CLIENT_EVENT;
+    if( win == NULL )
+        event->window = NULL;
     else
-        PostMessage( ( (Win32Window *)win )->GetHandle(), message, param1,
-                     param2 );*/
+        event->window = ((GTK2Window *)win)->GetHandle();
+    event->send_event = 0;
+    event->message_type = NULL;
+    event->data_format = 32;
+    event->data.l[0] = message;
+    event->data.l[1] = param1;
+    event->data.l[2] = param2;
+
+    fprintf( stderr, "======= message %i\n", message );
+
+    gdk_event_put( (GdkEvent *)event );
+
+    delete event;
 }
 //---------------------------------------------------------------------------
 
index 703bd37af652ea7498a15f4123a1d6d2e146f919..cd887aab50493dee33fb70629ab32a49e38c0c8d 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_event.cpp: GTK2 implementation of the Event class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_event.cpp,v 1.4 2003/04/13 19:09:59 asmax Exp $
+ * $Id: gtk2_event.cpp,v 1.5 2003/04/15 17:55:49 ipkiss Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -31,6 +31,7 @@
 #include <vlc/intf.h>
 
 //--- SKIN ------------------------------------------------------------------
+#include "os_api.h"
 #include "event.h"
 #include "os_event.h"
 #include "window.h"
@@ -67,15 +68,25 @@ GTK2Event::~GTK2Event()
 //---------------------------------------------------------------------------
 bool GTK2Event::SendEvent()
 {
-/*    if( Message != VLC_NOTHING )
+    fprintf( stderr, "++++++++++++++++ %i\n", Message );
+    if( Message != VLC_NOTHING )
     {
-        PostMessage( hWnd, Message, Param1, Param2 );
-        PostSynchroMessage();
-        return true;
+        // Find window matching with gwnd
+        list<Window *>::const_iterator win;
+        for( win = p_intf->p_sys->p_theme->WindowList.begin();
+             win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+        {
+            // If it is the correct window
+            if( gWnd == ( (GTK2Window *)(*win) )->GetHandle() )
+            {
+                OSAPI_PostMessage( *win, Message, Param1, Param2 );
+                PostSynchroMessage();
+            }
+        }
     }
-*/
-    return true;
 
+    OSAPI_PostMessage( NULL, Message, Param1, Param2 );
+    return true;
 }
 //---------------------------------------------------------------------------
 bool GTK2Event::IsEqual( Event *evt )
index be2652b6e13cddc9fffae92480d728ccb6140ccf..f3269ef76b1c83340c7c8651e3b144def726e1a7 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_run.cpp,v 1.5 2003/04/15 01:19:11 ipkiss Exp $
+ * $Id: gtk2_run.cpp,v 1.6 2003/04/15 17:55:49 ipkiss Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -68,10 +68,14 @@ int  SkinManage( intf_thread_t *p_intf );
 //---------------------------------------------------------------------------
 void GTK2Proc( GdkEvent *event, gpointer data )
 {
-    GdkWindow *gwnd = ((GdkEventAny *)event)->window;
-
     // Get pointer to thread info
     intf_thread_t *p_intf = (intf_thread_t *)data;
+    VlcProc *Proc = new VlcProc( p_intf );
+
+    list<Window *>::const_iterator win;
+    GdkWindow *gwnd = ((GdkEventAny *)event)->window;
+
+    fprintf( stderr, "------ %li\n", (long int)gwnd );
 
     // If doesn't exist, treat windows message normally
 //    if( p_intf == NULL )
@@ -81,27 +85,44 @@ void GTK2Proc( GdkEvent *event, gpointer data )
     Event *evt = (Event *)new OSEvent( p_intf, ((GdkEventAny *)event)->window,
                                        event->type, 0, (long)event );
 
-    // Find window matching with gwnd
-    list<Window *>::const_iterator win;
-    for( win = p_intf->p_sys->p_theme->WindowList.begin();
-         win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+    if( IsVLCEvent( event->type ) )
+    {
+        if( !Proc->EventProc( evt ) )
+            return;      // Exit VLC !
+    }
+    else if( gwnd == NULL )
     {
-        // If it is the correct window
-        if( gwnd == ( (GTK2Window *)(*win) )->GetHandle() )
+        for( win = p_intf->p_sys->p_theme->WindowList.begin();
+             win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
         {
-            // Send event and check if processed
-            if( (*win)->ProcessEvent( evt ) )
-            {
-                delete (OSEvent *)evt;
-                return;
-            }
-            else
+            (*win)->ProcessEvent( evt );
+        }
+    }
+    else
+    {
+        // Find window matching with gwnd
+        for( win = p_intf->p_sys->p_theme->WindowList.begin();
+             win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+        {
+            // If it is the correct window
+            if( gwnd == ( (GTK2Window *)(*win) )->GetHandle() )
             {
-                break;
+                // Send event and check if processed
+                if( (*win)->ProcessEvent( evt ) )
+                {
+                    delete (OSEvent *)evt;
+                    return;
+                }
+                else
+                {
+                    break;
+                }
             }
         }
     }
+
     delete (OSEvent *)evt;
+    delete Proc;
 
 #if 0
     // If Window is parent window
index e28bb33f1eade637580d48a87050ce609824bdcb..69e17a9f11c3caa3ac373022125d226a2d7f9526 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_window.cpp: GTK2 implementation of the Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_window.cpp,v 1.13 2003/04/15 16:49:45 karibu Exp $
+ * $Id: gtk2_window.cpp,v 1.14 2003/04/15 17:55:49 ipkiss Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -170,7 +170,6 @@ bool GTK2Window::ProcessOSEvent( Event *evt )
 
 
         case GDK_MOTION_NOTIFY:
-            fpprintf( stderr, "Mouse move (%i)", (int)evt );
             if( LButtonDown )
                 MouseMove( (int)( (GdkEventButton *)p2 )->x,
                            (int)( (GdkEventButton *)p2 )->y, 1 );