1 /*****************************************************************************
2 * x11_event.cpp: x11 implementation of the Event class
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
5 * $Id: x11_event.cpp,v 1.5 2003/06/22 12:54:03 asmax Exp $
7 * Authors: Cyril Deguet <asmax@videolan.org>
8 * Emmanuel Puig <karibu@via.ecp.fr>
9 * Olivier Teulière <ipkiss@via.ecp.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
25 *****************************************************************************/
29 //--- X11 -------------------------------------------------------------------
32 //--- VLC -------------------------------------------------------------------
35 //--- SKIN ------------------------------------------------------------------
36 #include "../os_api.h"
37 #include "../src/event.h"
38 #include "../os_event.h"
39 #include "../src/window.h"
40 #include "../os_window.h"
41 #include "../src/theme.h"
42 #include "../os_theme.h"
43 #include "../src/skin_common.h"
46 //---------------------------------------------------------------------------
48 //---------------------------------------------------------------------------
49 X11Event::X11Event( intf_thread_t *p_intf, string Desc, string shortcut )
50 : Event( p_intf, Desc, shortcut )
54 //---------------------------------------------------------------------------
55 X11Event::X11Event( intf_thread_t *p_intf, Window wnd, unsigned int msg,
56 unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
60 //---------------------------------------------------------------------------
61 X11Event::X11Event( intf_thread_t *p_intf, SkinWindow *win, unsigned int msg,
62 unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
64 Wnd = ( (X11Window *)win )->GetHandle();
66 //---------------------------------------------------------------------------
70 //---------------------------------------------------------------------------
71 bool X11Event::SendEvent()
73 if( Message != VLC_NOTHING )
75 // Find window matching with Wnd
76 list<SkinWindow *>::const_iterator win;
77 for( win = p_intf->p_sys->p_theme->WindowList.begin();
78 win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
80 // If it is the correct window
81 if( Wnd == ( (X11Window *)(*win) )->GetHandle() )
83 OSAPI_PostMessage( *win, Message, Param1, Param2 );
88 OSAPI_PostMessage( NULL, Message, Param1, Param2 );
94 //---------------------------------------------------------------------------
95 bool X11Event::IsEqual( Event *evt )
97 X11Event *XEvt = (X11Event *)evt;
98 return( XEvt->GetWindow() == Wnd && XEvt->GetMessage() == Message &&
99 XEvt->GetParam1() == Param1 && XEvt->GetParam2() == Param2 );
101 //---------------------------------------------------------------------------
102 void X11Event::CreateOSEvent( string para1, string para2, string para3 )
108 Wnd = GetWindowFromName( para1 );
112 Wnd = GetWindowFromName( para1 );
116 Wnd = GetWindowFromName( para1 );
121 //---------------------------------------------------------------------------
122 Window X11Event::GetWindowFromName( string name )
124 X11Window *win = (X11Window *)
125 p_intf->p_sys->p_theme->GetWindow( name );
133 return win->GetHandle();
136 //---------------------------------------------------------------------------