2
Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com>
5
This file is part of x11vnc.
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.
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.
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/>.
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.
1
33
/* -- pointer.c -- */
23
55
void initialize_pointer_map(char *pointer_remap);
24
56
void do_button_mask_change(int mask, int button);
25
void pointer(int mask, int x, int y, rfbClientPtr client);
57
void pointer_event(int mask, int x, int y, rfbClientPtr client);
26
58
void initialize_pipeinput(void);
27
59
int check_pipeinput(void);
28
60
void update_x11_pointer_position(int x, int y);
232
261
if (!raw_fb_str) {
234
266
num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS);
268
rfbLog("The X server says there are %d mouse buttons.\n", num_buttons);
272
rfbLog("Manually set num_buttons to: %d\n", num_buttons);
240
275
if (num_buttons < 0) {
559
595
uinput_pointer_command(mask, x, y, client);
560
596
} else if (pipeinput_int == PIPEINPUT_MACOSX) {
561
597
macosx_pointer_command(mask, x, y, client);
562
/* } else if (pipeinput_int == PIPEINPUT_VNC) {
563
vnc_reflect_send_pointer(x, y, mask);*/
598
} else if (pipeinput_int == PIPEINPUT_VNC) {
599
vnc_reflect_send_pointer(x, y, mask);
565
601
if (pipeinput_fh == NULL) {
623
659
* This may queue pointer events rather than sending them immediately
624
660
* to the X server. (see update_x11_pointer*())
626
void pointer(int mask, int x, int y, rfbClientPtr client) {
662
void pointer_event(int mask, int x, int y, rfbClientPtr client) {
627
663
allowed_input_t input;
628
664
int sent = 0, buffer_it = 0;
667
if (threads_drop_input) {
632
672
got_pointer_calls++;
750
800
if ((use_threads && pointer_mode != 1) || pointer_flush_delay > 0.0) {
752
802
/* storage for the event queue */
753
static int mutex_init = 0;
754
803
static int nevents = 0;
755
804
static int ev[NEV][3];
757
806
/* timer things */
758
807
static double dt = 0.0, tmr = 0.0, maxwait = 0.4;
761
INIT_MUTEX(pointerMutex);
765
809
if (pointer_flush_delay > 0.0) {
766
810
maxwait = pointer_flush_delay;
987
1034
rfbLog("pipeinput: could not open: %s\n", dev);
988
1035
rfbLogPerror("open");
1036
rfbLog("You may need to be root to open %s.\n", dev);
991
1040
} else if (strstr(p, "UINPUT") == p) {