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

* event broadcasting should work

parent 949b4349
......@@ -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;
}
//---------------------------------------------------------------------------
......
......@@ -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 )
......
......@@ -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
......
......@@ -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 );
......
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