xorg driver, keyboard / mouse cleanup

ulab-next
Jay Sorg 11 years ago
parent f0a91c444d
commit a8c3a05e50

@ -35,10 +35,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define RDPMIN(_val1, _val2) ((_val1) < (_val2) ? (_val1) : (_val2)) #define RDPMIN(_val1, _val2) ((_val1) < (_val2) ? (_val1) : (_val2))
#define RDPMAX(_val1, _val2) ((_val1) < (_val2) ? (_val2) : (_val1)) #define RDPMAX(_val1, _val2) ((_val1) < (_val2) ? (_val2) : (_val1))
#define RDPCLAMP(_val, _lo, _hi) \
(_val) < (_lo) ? (_lo) : (_val) > (_hi) ? (_hi) : (_val)
/* defined in rdpClientCon.h */ /* defined in rdpClientCon.h */
typedef struct _rdpClientCon rdpClientCon; typedef struct _rdpClientCon rdpClientCon;
struct _rdpPointer
{
int cursor_x;
int cursor_y;
int old_button_mask;
int button_mask;
DeviceIntPtr device;
};
typedef struct _rdpPointer rdpPointer;
struct _rdpKeyboard
{
int pause_spe;
int ctrl_down;
int alt_down;
int shift_down;
int tab_down;
/* this is toggled every time num lock key is released, not like the
above *_down vars */
int scroll_lock_down;
DeviceIntPtr device;
};
typedef struct _rdpKeyboard rdpKeyboard;
/* move this to common header */ /* move this to common header */
struct _rdpRec struct _rdpRec
{ {
@ -63,7 +89,12 @@ struct _rdpRec
CompositeProcPtr Composite; CompositeProcPtr Composite;
GlyphsProcPtr Glyphs; GlyphsProcPtr Glyphs;
/* keyboard and mouse */
miPointerScreenFuncPtr pCursorFuncs; miPointerScreenFuncPtr pCursorFuncs;
/* mouse */
rdpPointer pointer;
/* keyboard */
rdpKeyboard keyboard;
/* RandR */ /* RandR */
RRSetConfigProcPtr rrSetConfig; RRSetConfigProcPtr rrSetConfig;

@ -91,7 +91,14 @@ rdpGetDevFromScreen(ScreenPtr pScreen)
ScrnInfoPtr pScrn; ScrnInfoPtr pScrn;
rdpPtr dev; rdpPtr dev;
if (pScreen == NULL)
{
pScrn = xf86Screens[0];
}
else
{
pScrn = xf86Screens[pScreen->myNum]; pScrn = xf86Screens[pScreen->myNum];
}
dev = XRDPPTR(pScrn); dev = XRDPPTR(pScrn);
return dev; return dev;
} }

@ -44,3 +44,6 @@ sudo mknod -m 666 /dev/vc/7 c 7 7
----input ----input
xrdpkeyb_drv.so xrdpkeyb_drv.so
xrdpmouse_drv.so xrdpmouse_drv.so
dpkg -S /usr/lib/xorg/modules/extensions/libglx.so
xserver-xorg-core

@ -45,15 +45,7 @@ xrdp keyboard module
#include "rdp.h" #include "rdp.h"
#include "rdpInput.h" #include "rdpInput.h"
#include "rdpDraw.h"
static int g_pause_spe = 0;
static int g_ctrl_down = 0;
static int g_alt_down = 0;
static int g_shift_down = 0;
static int g_tab_down = 0;
/* this is toggled every time num lock key is released, not like the
above *_down vars */
static int g_scroll_lock_down = 0;
/******************************************************************************/ /******************************************************************************/
#define LOG_LEVEL 1 #define LOG_LEVEL 1
@ -92,8 +84,6 @@ static int g_scroll_lock_down = 0;
#define N_PREDEFINED_KEYS \ #define N_PREDEFINED_KEYS \
(sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY)) (sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY))
static DeviceIntPtr g_keyboard = 0;
static KeySym g_kbdMap[] = static KeySym g_kbdMap[] =
{ {
NoSymbol, NoSymbol, /* 8 */ NoSymbol, NoSymbol, /* 8 */
@ -214,55 +204,55 @@ static KeySym g_kbdMap[] =
/******************************************************************************/ /******************************************************************************/
static void static void
rdpEnqueueKey(int type, int scancode) rdpEnqueueKey(DeviceIntPtr device, int type, int scancode)
{ {
if (type == KeyPress) if (type == KeyPress)
{ {
xf86PostKeyboardEvent(g_keyboard, scancode, TRUE); xf86PostKeyboardEvent(device, scancode, TRUE);
} }
else else
{ {
xf86PostKeyboardEvent(g_keyboard, scancode, FALSE); xf86PostKeyboardEvent(device, scancode, FALSE);
} }
} }
/******************************************************************************/ /******************************************************************************/
static void static void
sendDownUpKeyEvent(int type, int x_scancode) sendDownUpKeyEvent(DeviceIntPtr device, int type, int x_scancode)
{ {
/* need this cause rdp and X11 repeats are different */ /* need this cause rdp and X11 repeats are different */
/* if type is keydown, send keyup + keydown */ /* if type is keydown, send keyup + keydown */
if (type == KeyPress) if (type == KeyPress)
{ {
rdpEnqueueKey(KeyRelease, x_scancode); rdpEnqueueKey(device, KeyRelease, x_scancode);
rdpEnqueueKey(KeyPress, x_scancode); rdpEnqueueKey(device, KeyPress, x_scancode);
} }
else else
{ {
rdpEnqueueKey(KeyRelease, x_scancode); rdpEnqueueKey(device, KeyRelease, x_scancode);
} }
} }
/******************************************************************************/ /******************************************************************************/
static void static void
check_keysa(void) check_keysa(rdpKeyboard *keyboard)
{ {
if (g_ctrl_down != 0) if (keyboard->ctrl_down != 0)
{ {
rdpEnqueueKey(KeyRelease, g_ctrl_down); rdpEnqueueKey(keyboard->device, KeyRelease, keyboard->ctrl_down);
g_ctrl_down = 0; keyboard->ctrl_down = 0;
} }
if (g_alt_down != 0) if (keyboard->alt_down != 0)
{ {
rdpEnqueueKey(KeyRelease, g_alt_down); rdpEnqueueKey(keyboard->device, KeyRelease, keyboard->alt_down);
g_alt_down = 0; keyboard->alt_down = 0;
} }
if (g_shift_down != 0) if (keyboard->shift_down != 0)
{ {
rdpEnqueueKey(KeyRelease, g_shift_down); rdpEnqueueKey(keyboard->device, KeyRelease, keyboard->shift_down);
g_shift_down = 0; keyboard->shift_down = 0;
} }
} }
@ -274,7 +264,8 @@ check_keysa(void)
* @param param4 - * @param param4 -
******************************************************************************/ ******************************************************************************/
static void static void
KbdAddEvent(int down, int param1, int param2, int param3, int param4) KbdAddEvent(rdpKeyboard *keyboard, int down, int param1, int param2,
int param3, int param4)
{ {
int rdp_scancode; int rdp_scancode;
int x_scancode; int x_scancode;
@ -298,7 +289,7 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
if (x_scancode > 0) if (x_scancode > 0)
{ {
rdpEnqueueKey(type, x_scancode); rdpEnqueueKey(keyboard->device, type, x_scancode);
} }
break; break;
@ -314,21 +305,22 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
x_scancode = 64; /* left alt button */ x_scancode = 64; /* left alt button */
} }
rdpEnqueueKey(type, x_scancode); rdpEnqueueKey(keyboard->device, type, x_scancode);
break; break;
case 15: /* tab */ case 15: /* tab */
if (!down && !g_tab_down) if (!down && !keyboard->tab_down)
{ {
check_keysa(); /* leave x_scancode 0 here, we don't want the tab key up */ /* leave x_scancode 0 here, we don't want the tab key up */
check_keysa(keyboard);
} }
else else
{ {
sendDownUpKeyEvent(type, 23); sendDownUpKeyEvent(keyboard->device, type, 23);
} }
g_tab_down = down; keyboard->tab_down = down;
break; break;
case 29: /* left or right ctrl */ case 29: /* left or right ctrl */
@ -338,113 +330,113 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
{ {
if (down) if (down)
{ {
g_pause_spe = 1; keyboard->pause_spe = 1;
/* leave x_scancode 0 here, we don't want the control key down */ /* leave x_scancode 0 here, we don't want the control key down */
} }
} }
else else
{ {
x_scancode = is_ext ? 109 : 37; x_scancode = is_ext ? 109 : 37;
g_ctrl_down = down ? x_scancode : 0; keyboard->ctrl_down = down ? x_scancode : 0;
rdpEnqueueKey(type, x_scancode); rdpEnqueueKey(keyboard->device, type, x_scancode);
} }
break; break;
case 69: /* Pause or Num Lock */ case 69: /* Pause or Num Lock */
if (g_pause_spe) if (keyboard->pause_spe)
{ {
x_scancode = 110; x_scancode = 110;
if (!down) if (!down)
{ {
g_pause_spe = 0; keyboard->pause_spe = 0;
} }
} }
else else
{ {
x_scancode = g_ctrl_down ? 110 : 77; x_scancode = keyboard->ctrl_down ? 110 : 77;
} }
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 28: /* Enter or Return */ case 28: /* Enter or Return */
x_scancode = is_ext ? 108 : 36; x_scancode = is_ext ? 108 : 36;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 53: /* / */ case 53: /* / */
x_scancode = is_ext ? 112 : 61; x_scancode = is_ext ? 112 : 61;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 55: /* * on KP or Print Screen */ case 55: /* * on KP or Print Screen */
x_scancode = is_ext ? 111 : 63; x_scancode = is_ext ? 111 : 63;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 71: /* 7 or Home */ case 71: /* 7 or Home */
x_scancode = is_ext ? 97 : 79; x_scancode = is_ext ? 97 : 79;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 72: /* 8 or Up */ case 72: /* 8 or Up */
x_scancode = is_ext ? 98 : 80; x_scancode = is_ext ? 98 : 80;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 73: /* 9 or PgUp */ case 73: /* 9 or PgUp */
x_scancode = is_ext ? 99 : 81; x_scancode = is_ext ? 99 : 81;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 75: /* 4 or Left */ case 75: /* 4 or Left */
x_scancode = is_ext ? 100 : 83; x_scancode = is_ext ? 100 : 83;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 77: /* 6 or Right */ case 77: /* 6 or Right */
x_scancode = is_ext ? 102 : 85; x_scancode = is_ext ? 102 : 85;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 79: /* 1 or End */ case 79: /* 1 or End */
x_scancode = is_ext ? 103 : 87; x_scancode = is_ext ? 103 : 87;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 80: /* 2 or Down */ case 80: /* 2 or Down */
x_scancode = is_ext ? 104 : 88; x_scancode = is_ext ? 104 : 88;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 81: /* 3 or PgDn */ case 81: /* 3 or PgDn */
x_scancode = is_ext ? 105 : 89; x_scancode = is_ext ? 105 : 89;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 82: /* 0 or Insert */ case 82: /* 0 or Insert */
x_scancode = is_ext ? 106 : 90; x_scancode = is_ext ? 106 : 90;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 83: /* . or Delete */ case 83: /* . or Delete */
x_scancode = is_ext ? 107 : 91; x_scancode = is_ext ? 107 : 91;
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
break; break;
case 91: /* left win key */ case 91: /* left win key */
rdpEnqueueKey(type, 115); rdpEnqueueKey(keyboard->device, type, 115);
break; break;
case 92: /* right win key */ case 92: /* right win key */
rdpEnqueueKey(type, 116); rdpEnqueueKey(keyboard->device, type, 116);
break; break;
case 93: /* menu key */ case 93: /* menu key */
rdpEnqueueKey(type, 117); rdpEnqueueKey(keyboard->device, type, 117);
break; break;
default: default:
@ -452,7 +444,7 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
if (x_scancode > 0) if (x_scancode > 0)
{ {
sendDownUpKeyEvent(type, x_scancode); sendDownUpKeyEvent(keyboard->device, type, x_scancode);
} }
break; break;
@ -464,31 +456,31 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
scroll lock doesn't seem to be a modifier in X scroll lock doesn't seem to be a modifier in X
*/ */
static void static void
KbdSync(int param1) KbdSync(rdpKeyboard *keyboard, int param1)
{ {
int xkb_state; int xkb_state;
xkb_state = XkbStateFieldFromRec(&(g_keyboard->key->xkbInfo->state)); xkb_state = XkbStateFieldFromRec(&(keyboard->device->key->xkbInfo->state));
if ((!(xkb_state & 0x02)) != (!(param1 & 4))) /* caps lock */ if ((!(xkb_state & 0x02)) != (!(param1 & 4))) /* caps lock */
{ {
LLOGLN(0, ("KbdSync: toggling caps lock")); LLOGLN(0, ("KbdSync: toggling caps lock"));
KbdAddEvent(1, 58, 0, 58, 0); KbdAddEvent(keyboard, 1, 58, 0, 58, 0);
KbdAddEvent(0, 58, 49152, 58, 49152); KbdAddEvent(keyboard, 0, 58, 49152, 58, 49152);
} }
if ((!(xkb_state & 0x10)) != (!(param1 & 2))) /* num lock */ if ((!(xkb_state & 0x10)) != (!(param1 & 2))) /* num lock */
{ {
LLOGLN(0, ("KbdSync: toggling num lock")); LLOGLN(0, ("KbdSync: toggling num lock"));
KbdAddEvent(1, 69, 0, 69, 0); KbdAddEvent(keyboard, 1, 69, 0, 69, 0);
KbdAddEvent(0, 69, 49152, 69, 49152); KbdAddEvent(keyboard, 0, 69, 49152, 69, 49152);
} }
if ((!(g_scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */ if ((!(keyboard->scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */
{ {
LLOGLN(0, ("KbdSync: toggling scroll lock")); LLOGLN(0, ("KbdSync: toggling scroll lock"));
KbdAddEvent(1, 70, 0, 70, 0); KbdAddEvent(keyboard, 1, 70, 0, 70, 0);
KbdAddEvent(0, 70, 49152, 70, 49152); KbdAddEvent(keyboard, 0, 70, 49152, 70, 49152);
} }
} }
@ -497,15 +489,18 @@ static int
rdpInputKeyboard(rdpPtr dev, int msg, long param1, long param2, rdpInputKeyboard(rdpPtr dev, int msg, long param1, long param2,
long param3, long param4) long param3, long param4)
{ {
rdpKeyboard *keyboard;
keyboard = &(dev->keyboard);
LLOGLN(0, ("rdpInputKeyboard:")); LLOGLN(0, ("rdpInputKeyboard:"));
switch (msg) switch (msg)
{ {
case 15: /* key down */ case 15: /* key down */
case 16: /* key up */ case 16: /* key up */
KbdAddEvent(msg == 15, param1, param2, param3, param4); KbdAddEvent(keyboard, msg == 15, param1, param2, param3, param4);
break; break;
case 17: /* from RDP_INPUT_SYNCHRONIZE */ case 17: /* from RDP_INPUT_SYNCHRONIZE */
KbdSync(param1); KbdSync(keyboard, param1);
break; break;
} }
return 0; return 0;
@ -598,6 +593,7 @@ rdpkeybControl(DeviceIntPtr device, int what)
CARD8 modMap[MAP_LENGTH]; CARD8 modMap[MAP_LENGTH];
DevicePtr pDev; DevicePtr pDev;
XkbRMLVOSet set; XkbRMLVOSet set;
rdpPtr dev;
LLOGLN(0, ("rdpkeybControl: what %d", what)); LLOGLN(0, ("rdpkeybControl: what %d", what));
pDev = (DevicePtr)device; pDev = (DevicePtr)device;
@ -614,7 +610,8 @@ rdpkeybControl(DeviceIntPtr device, int what)
set.options = ""; set.options = "";
InitKeyboardDeviceStruct(device, &set, rdpkeybBell, InitKeyboardDeviceStruct(device, &set, rdpkeybBell,
rdpkeybChangeKeyboardControl); rdpkeybChangeKeyboardControl);
g_keyboard = device; dev = rdpGetDevFromScreen(NULL);
dev->keyboard.device = device;
rdpRegisterInputCallback(0, rdpInputKeyboard); rdpRegisterInputCallback(0, rdpInputKeyboard);
break; break;
case DEVICE_ON: case DEVICE_ON:

@ -43,6 +43,7 @@ xrdp mouse module
#include "rdp.h" #include "rdp.h"
#include "rdpInput.h" #include "rdpInput.h"
#include "rdpDraw.h"
/******************************************************************************/ /******************************************************************************/
#define LOG_LEVEL 1 #define LOG_LEVEL 1
@ -57,14 +58,6 @@ xrdp mouse module
#define PACKAGE_VERSION_MINOR 0 #define PACKAGE_VERSION_MINOR 0
#define PACKAGE_VERSION_PATCHLEVEL 0 #define PACKAGE_VERSION_PATCHLEVEL 0
static DeviceIntPtr g_pointer = 0;
static int g_cursor_x = 0;
static int g_cursor_y = 0;
static int g_old_button_mask = 0;
static int g_button_mask = 0;
/******************************************************************************/ /******************************************************************************/
static void static void
rdpmouseDeviceInit(void) rdpmouseDeviceInit(void)
@ -97,67 +90,58 @@ rdpmouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl)
static int static int
l_bound_by(int val, int low, int high) l_bound_by(int val, int low, int high)
{ {
if (val > high) val = RDPCLAMP(val, low, high);
{
val = high;
}
if (val < low)
{
val = low;
}
return val; return val;
} }
/******************************************************************************/ /******************************************************************************/
static void static void
rdpEnqueueMotion(int x, int y) rdpEnqueueMotion(DeviceIntPtr device, int x, int y)
{ {
int valuators[2]; int valuators[2];
valuators[0] = x; valuators[0] = x;
valuators[1] = y; valuators[1] = y;
xf86PostMotionEvent(g_pointer, TRUE, 0, 2, valuators); xf86PostMotionEvent(device, TRUE, 0, 2, valuators);
} }
/******************************************************************************/ /******************************************************************************/
static void static void
rdpEnqueueButton(int type, int buttons) rdpEnqueueButton(DeviceIntPtr device, int type, int buttons)
{ {
xf86PostButtonEvent(g_pointer, FALSE, buttons, type, 0, 0); xf86PostButtonEvent(device, FALSE, buttons, type, 0, 0);
} }
/******************************************************************************/ /******************************************************************************/
void static void
PtrAddEvent(int buttonMask, int x, int y) PtrAddEvent(rdpPointer *pointer)
{ {
int i; int i;
int type; int type;
int buttons; int buttons;
rdpEnqueueMotion(x, y); rdpEnqueueMotion(pointer->device, pointer->cursor_x, pointer->cursor_y);
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
if ((buttonMask ^ g_old_button_mask) & (1 << i)) if ((pointer->button_mask ^ pointer->old_button_mask) & (1 << i))
{ {
if (buttonMask & (1 << i)) if (pointer->button_mask & (1 << i))
{ {
type = ButtonPress; type = ButtonPress;
buttons = i + 1; buttons = i + 1;
rdpEnqueueButton(type, buttons); rdpEnqueueButton(pointer->device, type, buttons);
} }
else else
{ {
type = ButtonRelease; type = ButtonRelease;
buttons = i + 1; buttons = i + 1;
rdpEnqueueButton(type, buttons); rdpEnqueueButton(pointer->device, type, buttons);
} }
} }
} }
g_old_button_mask = buttonMask; pointer->old_button_mask = pointer->button_mask;
} }
/******************************************************************************/ /******************************************************************************/
@ -166,56 +150,58 @@ rdpInputMouse(rdpPtr dev, int msg,
long param1, long param2, long param1, long param2,
long param3, long param4) long param3, long param4)
{ {
LLOGLN(0, ("rdpInputMouse:")); rdpPointer *pointer;
LLOGLN(0, ("rdpInputMouse:"));
pointer = &(dev->pointer);
switch (msg) switch (msg)
{ {
case 100: case 100:
/* without the minus 2, strange things happen when dragging /* without the minus 2, strange things happen when dragging
past the width or height */ past the width or height */
g_cursor_x = l_bound_by(param1, 0, dev->width - 2); pointer->cursor_x = l_bound_by(param1, 0, dev->width - 2);
g_cursor_y = l_bound_by(param2, 0, dev->height - 2); pointer->cursor_y = l_bound_by(param2, 0, dev->height - 2);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 101: case 101:
g_button_mask = g_button_mask & (~1); pointer->button_mask = pointer->button_mask & (~1);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 102: case 102:
g_button_mask = g_button_mask | 1; pointer->button_mask = pointer->button_mask | 1;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 103: case 103:
g_button_mask = g_button_mask & (~4); pointer->button_mask = pointer->button_mask & (~4);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 104: case 104:
g_button_mask = g_button_mask | 4; pointer->button_mask = pointer->button_mask | 4;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 105: case 105:
g_button_mask = g_button_mask & (~2); pointer->button_mask = pointer->button_mask & (~2);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 106: case 106:
g_button_mask = g_button_mask | 2; pointer->button_mask = pointer->button_mask | 2;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 107: case 107:
g_button_mask = g_button_mask & (~8); pointer->button_mask = pointer->button_mask & (~8);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 108: case 108:
g_button_mask = g_button_mask | 8; pointer->button_mask = pointer->button_mask | 8;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 109: case 109:
g_button_mask = g_button_mask & (~16); pointer->button_mask = pointer->button_mask & (~16);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
case 110: case 110:
g_button_mask = g_button_mask | 16; pointer->button_mask = pointer->button_mask | 16;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); PtrAddEvent(pointer);
break; break;
} }
return 0; return 0;
@ -229,6 +215,7 @@ rdpmouseControl(DeviceIntPtr device, int what)
DevicePtr pDev; DevicePtr pDev;
Atom btn_labels[6]; Atom btn_labels[6];
Atom axes_labels[2]; Atom axes_labels[2];
rdpPtr dev;
LLOGLN(0, ("rdpmouseControl: what %d", what)); LLOGLN(0, ("rdpmouseControl: what %d", what));
pDev = (DevicePtr)device; pDev = (DevicePtr)device;
@ -255,7 +242,8 @@ rdpmouseControl(DeviceIntPtr device, int what)
InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpmouseCtrl, InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpmouseCtrl,
GetMotionHistorySize(), 2, axes_labels); GetMotionHistorySize(), 2, axes_labels);
g_pointer = device; dev = rdpGetDevFromScreen(NULL);
dev->pointer.device = device;
rdpRegisterInputCallback(1, rdpInputMouse); rdpRegisterInputCallback(1, rdpInputMouse);
break; break;
case DEVICE_ON: case DEVICE_ON:

Loading…
Cancel
Save