1
/*****************************************************************************
3
*****************************************************************************
4
* Copyright (C) 2003 the VideoLAN team
5
* $Id: 8e3164e0abedfd1f3f5e10020233380e69e8d428 $
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
*****************************************************************************/
28
#include "../src/os_timer.hpp"
32
// Forward declaration
38
class X11Timer: public OSTimer
41
X11Timer( intf_thread_t *pIntf, CmdGeneric &rCmd );
44
/// (Re)start the timer with the given delay (in ms). If oneShot is
45
/// true, stop it after the first execution of the callback.
46
virtual void start( int delay, bool oneShot );
51
mtime_t getNextDate() const;
53
/// Execute the callback.
54
/// Returns false if the timer must be removed after
58
/// Command to execute
59
CmdGeneric &m_rCommand;
61
X11TimerLoop *m_pTimerLoop;
62
/// Delay between two execute
64
/// Next date at which the timer must be executed
66
/// Flag to tell if the timer must be stopped after the first execution
71
/// Class to manage a set of timers
72
class X11TimerLoop: public SkinObject
75
/// Create the timer loop with the communication number of the X11
77
X11TimerLoop( intf_thread_t *pIntf, int connectionNumber );
78
virtual ~X11TimerLoop();
80
/// Add a timer in the manager
81
void addTimer( X11Timer &rTimer );
83
/// Remove a timer from the manager
84
void removeTimer( X11Timer &rTimer );
86
/// Wait for the next timer and execute it
90
/// Connection number of the X11 display
91
int m_connectionNumber;
93
list<X11Timer*> m_timers;
95
/// Sleep for delay milliseconds, unless an X11 event is received.
96
/// Returns true if the sleep has been interupted.
97
bool sleep( int delay );