1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
29 #include "../src/os_loop.hpp"
36 /// Main event loop for X11 (singleton)
37 class X11Loop: public OSLoop
40 /// Get the instance of X11Loop
41 static OSLoop *instance( intf_thread_t *pIntf, X11Display &rDisplay );
43 /// Destroy the instance of X11Loop
44 static void destroy( intf_thread_t *pIntf );
46 /// Enter the event loop
49 /// Exit the main loop
54 X11Display &m_rDisplay;
57 /// Date and position of the last left-click
58 mtime_t m_lastClickTime;
59 int m_lastClickPosX, m_lastClickPosY;
60 /// Maximum interval between clicks for a double-click (in microsec)
61 static int m_dblClickDelay;
62 /// Map associating special (i.e. non ascii) virtual key codes with
63 /// internal vlc key codes
64 typedef std::map<KeySym, int> keymap_t;
65 static keymap_t m_keymap;
66 /// Translate X11 KeySyms to VLC key codes.
67 static int keysymToVlcKey( KeySym keysym )
69 keymap_t::const_iterator i=m_keymap.find(keysym);
70 return i!=m_keymap.end() ? (i->second) : keysym;
72 static int X11ModToMod( unsigned state );
74 // Private because it's a singleton
75 X11Loop( intf_thread_t *pIntf, X11Display &rDisplay );
78 /// Handle the next X11 event
79 void handleX11Event();