]> git.sesse.net Git - vlc/blob - modules/gui/skins2/x11/x11_loop.hpp
2f4b4d65de3ed31af0c8fb504458ecf6d1fed0c4
[vlc] / modules / gui / skins2 / x11 / x11_loop.hpp
1 /*****************************************************************************
2  * x11_loop.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
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.
14  *
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.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef X11_LOOP_HPP
26 #define X11_LOOP_HPP
27
28 #include <X11/Xlib.h>
29 #include "../src/os_loop.hpp"
30
31 #include <map>
32
33 class X11Display;
34 class GenericWindow;
35
36 /// Main event loop for X11 (singleton)
37 class X11Loop: public OSLoop
38 {
39     public:
40         /// Get the instance of X11Loop
41         static OSLoop *instance( intf_thread_t *pIntf, X11Display &rDisplay );
42
43         /// Destroy the instance of X11Loop
44         static void destroy( intf_thread_t *pIntf );
45
46         /// Enter the event loop
47         virtual void run();
48
49         /// Exit the main loop
50         virtual void exit();
51
52     private:
53         /// X11 Display
54         X11Display &m_rDisplay;
55         /// Flag set on exit
56         bool m_exit;
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         map<KeySym, int> keysymToVlcKey;
65
66         // Private because it's a singleton
67         X11Loop( intf_thread_t *pIntf, X11Display &rDisplay );
68         virtual ~X11Loop();
69
70         /// Handle the next X11 event
71         void handleX11Event();
72 };
73
74 #endif