Commit 33eaee68 authored by Olivier Teulière's avatar Olivier Teulière

* event broadcasting should work

parent 949b4349
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_api.cpp: Various gtk2-specific functions * gtk2_api.cpp: Various gtk2-specific functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "os_api.h" #include "os_api.h"
#include "event.h" // for MAX_PARAM_SIZE #include "event.h" // for MAX_PARAM_SIZE
#include <stdio.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Event API // Event API
...@@ -51,11 +52,24 @@ void OSAPI_SendMessage( Window *win, unsigned int message, unsigned int param1, ...@@ -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, void OSAPI_PostMessage( Window *win, unsigned int message, unsigned int param1,
long param2 ) long param2 )
{ {
/* if( win == NULL ) GdkEventClient *event = new GdkEventClient;
PostMessage( NULL, message, param1, param2 ); event->type = GDK_CLIENT_EVENT;
if( win == NULL )
event->window = NULL;
else else
PostMessage( ( (Win32Window *)win )->GetHandle(), message, param1, event->window = ((GTK2Window *)win)->GetHandle();
param2 );*/ 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;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_event.cpp: GTK2 implementation of the Event class * gtk2_event.cpp: GTK2 implementation of the Event class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc/intf.h> #include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------ //--- SKIN ------------------------------------------------------------------
#include "os_api.h"
#include "event.h" #include "event.h"
#include "os_event.h" #include "os_event.h"
#include "window.h" #include "window.h"
...@@ -67,15 +68,25 @@ GTK2Event::~GTK2Event() ...@@ -67,15 +68,25 @@ GTK2Event::~GTK2Event()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool GTK2Event::SendEvent() bool GTK2Event::SendEvent()
{ {
/* if( Message != VLC_NOTHING ) fprintf( stderr, "++++++++++++++++ %i\n", Message );
if( Message != VLC_NOTHING )
{ {
PostMessage( hWnd, Message, Param1, Param2 ); // Find window matching with gwnd
PostSynchroMessage(); list<Window *>::const_iterator win;
return true; 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 ) bool GTK2Event::IsEqual( Event *evt )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_run.cpp: * gtk2_run.cpp:
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -68,10 +68,14 @@ int SkinManage( intf_thread_t *p_intf ); ...@@ -68,10 +68,14 @@ int SkinManage( intf_thread_t *p_intf );
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GTK2Proc( GdkEvent *event, gpointer data ) void GTK2Proc( GdkEvent *event, gpointer data )
{ {
GdkWindow *gwnd = ((GdkEventAny *)event)->window;
// Get pointer to thread info // Get pointer to thread info
intf_thread_t *p_intf = (intf_thread_t *)data; 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 doesn't exist, treat windows message normally
// if( p_intf == NULL ) // if( p_intf == NULL )
...@@ -81,27 +85,44 @@ void GTK2Proc( GdkEvent *event, gpointer data ) ...@@ -81,27 +85,44 @@ void GTK2Proc( GdkEvent *event, gpointer data )
Event *evt = (Event *)new OSEvent( p_intf, ((GdkEventAny *)event)->window, Event *evt = (Event *)new OSEvent( p_intf, ((GdkEventAny *)event)->window,
event->type, 0, (long)event ); event->type, 0, (long)event );
// Find window matching with gwnd if( IsVLCEvent( event->type ) )
list<Window *>::const_iterator win; {
for( win = p_intf->p_sys->p_theme->WindowList.begin(); if( !Proc->EventProc( evt ) )
win != p_intf->p_sys->p_theme->WindowList.end(); win++ ) return; // Exit VLC !
}
else if( gwnd == NULL )
{ {
// If it is the correct window for( win = p_intf->p_sys->p_theme->WindowList.begin();
if( gwnd == ( (GTK2Window *)(*win) )->GetHandle() ) win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{ {
// Send event and check if processed (*win)->ProcessEvent( evt );
if( (*win)->ProcessEvent( evt ) ) }
{ }
delete (OSEvent *)evt; else
return; {
} // Find window matching with gwnd
else 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 (OSEvent *)evt;
delete Proc;
#if 0 #if 0
// If Window is parent window // If Window is parent window
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_window.cpp: GTK2 implementation of the Window class * gtk2_window.cpp: GTK2 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -170,7 +170,6 @@ bool GTK2Window::ProcessOSEvent( Event *evt ) ...@@ -170,7 +170,6 @@ bool GTK2Window::ProcessOSEvent( Event *evt )
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
fpprintf( stderr, "Mouse move (%i)", (int)evt );
if( LButtonDown ) if( LButtonDown )
MouseMove( (int)( (GdkEventButton *)p2 )->x, MouseMove( (int)( (GdkEventButton *)p2 )->x,
(int)( (GdkEventButton *)p2 )->y, 1 ); (int)( (GdkEventButton *)p2 )->y, 1 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment