2
* @file geis_grail_xsync.h
3
* @brief Handles XSync lib usage for the GEIS grail backend
6
* Copyright 2012 Canonical Ltd.
8
* This file is part of UTouch GEIS.
10
* UTouch GEIS is free software: you can redistribute it and/or modify it
11
* under the terms of the GNU Lesser General Public License as published by the
12
* Free Software Foundation, either version 3 of the License, or (at your
13
* option) any later version.
15
* UTouch GEIS is distributed in the hope that it will be useful, but WITHOUT
16
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with UTouch GEIS. If not, see <http://www.gnu.org/licenses/>.
24
#ifndef GEIS_BACKEND_GRAIL_XSYNC_H_
25
#define GEIS_BACKEND_GRAIL_XSYNC_H_
27
#include <X11/Xlib.h> // For Display and XEvent
28
#include <stdint.h> // For uint64_t
29
#include "geis/geisimpl.h" // For GeisBoolean
32
* The opaque "X Synchronization Extension Library" handler
34
* It facilitates and encapsulates the use of the XSync extension. Specially
35
* by managing the XSyncAlarm instances needed to implement timeouts.
37
typedef struct GeisGrailXSync *GeisGrailXSync;
40
* Constructs a new GeisGrailXSync instance.
42
* It returns NULL if the initialization wasn't successful.
44
* OBS: Having multiple GeisGrailXSync instances is not supported and doesn't
48
geis_grail_xsync_new(Display *display);
51
* Destroys the given GeisGrailXSync
54
geis_grail_xsync_delete(GeisGrailXSync xsync);
58
* Creates an XSyncAlarm with the given timeout
60
* If there's already an XSyncAlarm with that timeout,
63
* An XSyncAlarmNotifyEvent will be sent once that timeout
64
* is reached on the server.
67
geis_grail_xsync_set_timeout(GeisGrailXSync xsync, uint64_t timeout);
70
* Returns true if the given XEvent is an XSyncAlarmNotifyEvent for
71
* one of the existing XSyncAlarm instances and false otherwise.
73
* It also takes care of destroying the XSyncAlarm that had its
77
geis_grail_xsync_is_timeout(GeisGrailXSync xsync, const XEvent *event);
80
* Gets the server time contained in the given event.
82
* That event must be an XSyncAlarmNotifyEvent. It will be the case when
83
* geis_grail_xsync_is_timeout() returns GeisTrue for it.
87
geis_grail_xsync_get_server_time(const XEvent *event);
89
#endif // GEIS_BACKEND_GRAIL_XSYNC_H_