1 |
/* -*- c-basic-offset: 8 -*- |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
User interface services - X Window System |
User interface services - X Window System |
4 |
Copyright (C) Matthew Chapman 1999-2007 |
Copyright (C) Matthew Chapman 1999-2008 |
5 |
Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB |
Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
110 |
static XModifierKeymap *g_mod_map; |
static XModifierKeymap *g_mod_map; |
111 |
/* Maps logical (xmodmap -pp) pointing device buttons (0-based) back |
/* Maps logical (xmodmap -pp) pointing device buttons (0-based) back |
112 |
to physical (1-based) indices. */ |
to physical (1-based) indices. */ |
113 |
static unsigned char g_pointer_log_to_phys_map[16]; |
static unsigned char g_pointer_log_to_phys_map[32]; |
114 |
static Cursor g_current_cursor; |
static Cursor g_current_cursor; |
115 |
static RD_HCURSOR g_null_cursor = NULL; |
static RD_HCURSOR g_null_cursor = NULL; |
116 |
static Atom g_protocol_atom, g_kill_atom; |
static Atom g_protocol_atom, g_kill_atom; |
1525 |
int i, pointer_buttons; |
int i, pointer_buttons; |
1526 |
|
|
1527 |
pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map)); |
pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map)); |
1528 |
for (i = 0; i < pointer_buttons; ++i) |
if (pointer_buttons > sizeof(phys_to_log_map)) |
1529 |
{ |
pointer_buttons = sizeof(phys_to_log_map); |
1530 |
/* This might produce multiple logical buttons mapping |
|
1531 |
to a single physical one, but hey, that's |
/* if multiple physical buttons map to the same logical button, then |
1532 |
life... */ |
* use the lower numbered physical one */ |
1533 |
|
for (i = pointer_buttons-1; i >= 0; i--) |
1534 |
|
{ |
1535 |
|
/* a user could specify arbitrary values for the logical button |
1536 |
|
* number, ignore any that are abnormally large */ |
1537 |
|
if (phys_to_log_map[i] > sizeof(g_pointer_log_to_phys_map)) |
1538 |
|
continue; |
1539 |
g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1; |
g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1; |
1540 |
} |
} |
1541 |
} |
} |