~ubuntu-branches/debian/jessie/italc/jessie

« back to all changes in this revision

Viewing changes to ica/x11/x11vnc/util.h

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Winnertz
  • Date: 2011-02-11 14:50:22 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110211145022-sn173siax6lywjus
Tags: upstream-1.0.13
ImportĀ upstreamĀ versionĀ 1.0.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com> 
 
3
   All rights reserved.
 
4
 
 
5
This file is part of x11vnc.
 
6
 
 
7
x11vnc is free software; you can redistribute it and/or modify
 
8
it under the terms of the GNU General Public License as published by
 
9
the Free Software Foundation; either version 2 of the License, or (at
 
10
your option) any later version.
 
11
 
 
12
x11vnc is distributed in the hope that it will be useful,
 
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
GNU General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU General Public License
 
18
along with x11vnc; if not, write to the Free Software
 
19
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
 
20
or see <http://www.gnu.org/licenses/>.
 
21
 
 
22
In addition, as a special exception, Karl J. Runge
 
23
gives permission to link the code of its release of x11vnc with the
 
24
OpenSSL project's "OpenSSL" library (or with modified versions of it
 
25
that use the same license as the "OpenSSL" library), and distribute
 
26
the linked executables.  You must obey the GNU General Public License
 
27
in all respects for all of the code used other than "OpenSSL".  If you
 
28
modify this file, you may extend this exception to your version of the
 
29
file, but you are not obligated to do so.  If you do not wish to do
 
30
so, delete this exception statement from your version.
 
31
*/
 
32
 
1
33
#ifndef _X11VNC_UTIL_H
2
34
#define _X11VNC_UTIL_H
3
35
 
31
63
extern double rnow(void);
32
64
extern double rfac(void);
33
65
 
34
 
extern void rfbPE(long usec);
 
66
extern int rfbPE(long usec);
35
67
extern void rfbCFD(long usec);
36
68
extern double rect_overlap(int x1, int y1, int x2, int y2, int X1, int Y1,
37
69
    int X2, int Y2);
40
72
 
41
73
#define NONUL(x) ((x) ? (x) : "")
42
74
 
 
75
/*
 
76
        Put this in usleep2() for debug printout.
 
77
        fprintf(stderr, "_mysleep: %08d %10.6f %s:%d\n", (x), dnow() - x11vnc_start, __FILE__, __LINE__); \
 
78
 */
 
79
 
43
80
/* XXX usleep(3) is not thread safe on some older systems... */
44
81
extern struct timeval _mysleep;
45
82
#define usleep2(x) \
64
101
 */
65
102
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
66
103
extern MUTEX(x11Mutex);
 
104
extern MUTEX(scrollMutex);
 
105
MUTEX(clientMutex);
 
106
MUTEX(inputMutex);
 
107
MUTEX(pointerMutex);
67
108
#endif
68
109
 
69
110
#define X_INIT INIT_MUTEX(x11Mutex)
73
114
#define X_UNLOCK   UNLOCK(x11Mutex)
74
115
#else
75
116
extern int hxl;
76
 
#define X_LOCK       fprintf(stderr, "*** X_LOCK**[%05d]  %d%s\n", \
77
 
        __LINE__, hxl, hxl ? "  BAD-PRE-LOCK":""); LOCK(x11Mutex); hxl = 1;
78
 
#define X_UNLOCK     fprintf(stderr, "    x_unlock[%05d]  %d%s\n", \
79
 
        __LINE__, hxl, !hxl ? "  BAD-PRE-UNLOCK":""); UNLOCK(x11Mutex); hxl = 0;
 
117
#define X_LOCK       fprintf(stderr, "*** X_LOCK**  %d%s  %s:%d\n", \
 
118
        hxl, hxl  ? "  BAD-PRE-LOCK":"",   __FILE__, __LINE__);   LOCK(x11Mutex); hxl = 1;
 
119
#define X_UNLOCK     fprintf(stderr, "    x_unlock  %d%s  %s:%d\n", \
 
120
        hxl, !hxl ? "  BAD-PRE-UNLOCK":"", __FILE__, __LINE__); UNLOCK(x11Mutex); hxl = 0;
80
121
#endif
81
122
 
82
 
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
83
 
extern MUTEX(scrollMutex);
84
 
#endif
85
123
#define SCR_LOCK   if (use_threads) {LOCK(scrollMutex);}
86
124
#define SCR_UNLOCK if (use_threads) {UNLOCK(scrollMutex);}
87
125
#define SCR_INIT INIT_MUTEX(scrollMutex)
88
126
 
 
127
#define CLIENT_LOCK   if (use_threads) {LOCK(clientMutex);}
 
128
#define CLIENT_UNLOCK if (use_threads) {UNLOCK(clientMutex);}
 
129
#define CLIENT_INIT INIT_MUTEX(clientMutex)
 
130
 
 
131
#if 1
 
132
#define INPUT_LOCK   if (use_threads) {LOCK(inputMutex);}
 
133
#define INPUT_UNLOCK if (use_threads) {UNLOCK(inputMutex);}
 
134
#else
 
135
#define INPUT_LOCK
 
136
#define INPUT_UNLOCK
 
137
#endif
 
138
#define INPUT_INIT INIT_MUTEX(inputMutex)
 
139
 
 
140
#define POINTER_LOCK   if (use_threads) {LOCK(pointerMutex);}
 
141
#define POINTER_UNLOCK if (use_threads) {UNLOCK(pointerMutex);}
 
142
#define POINTER_INIT INIT_MUTEX(pointerMutex)
 
143
 
 
144
/*
 
145
 * The sendMutex member was added to libvncserver 0.9.8
 
146
 * rfb/rfb.h sets LIBVNCSERVER_SEND_MUTEX if present.
 
147
 */
 
148
#if LIBVNCSERVER_HAVE_LIBPTHREAD && defined(LIBVNCSERVER_SEND_MUTEX)
 
149
#define SEND_LOCK(cl)   if (use_threads)   LOCK((cl)->sendMutex);
 
150
#define SEND_UNLOCK(cl) if (use_threads) UNLOCK((cl)->sendMutex);
 
151
#else
 
152
#define SEND_LOCK(cl)
 
153
#define SEND_UNLOCK(cl)
 
154
#endif
 
155
 
89
156
#endif /* _X11VNC_UTIL_H */