ia64/xen-unstable

changeset 13070:96b047d22ad5

Fix pointer encoding in vncfb (middle and right button were swapped).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
author kfraser@localhost.localdomain
date Fri Dec 15 17:30:51 2006 +0000 (2006-12-15)
parents 1b6354023e64
children 040093fa1f9e
files tools/xenfb/vncfb.c
line diff
     1.1 --- a/tools/xenfb/vncfb.c	Fri Dec 15 17:29:25 2006 +0000
     1.2 +++ b/tools/xenfb/vncfb.c	Fri Dec 15 17:30:51 2006 +0000
     1.3 @@ -148,6 +148,10 @@ static int xk2linux[0x10000] = {
     1.4  	[XK_plus] = KEY_EQUAL,
     1.5  };
     1.6  
     1.7 +static int btnmap[] = {
     1.8 +	BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, BTN_FORWARD, BTN_BACK
     1.9 +};
    1.10 +
    1.11  static void on_kbd_event(rfbBool down, rfbKeySym keycode, rfbClientPtr cl)
    1.12  {
    1.13  	/*
    1.14 @@ -184,8 +188,11 @@ static void on_ptr_event(int buttonMask,
    1.15  		down = buttonMask & (1 << i);
    1.16  		if (down == last_down)
    1.17  			continue;
    1.18 -		/* FIXME this assumes buttons are numbered the same; verify they are */
    1.19 -		if (xenfb_send_key(xenfb, down != 0, BTN_MOUSE + i) < 0)
    1.20 +		if (i >= sizeof(btnmap) / sizeof(*btnmap))
    1.21 +			break;
    1.22 +		if (btnmap[i] == 0)
    1.23 +			break;
    1.24 +		if (xenfb_send_key(xenfb, down != 0, btnmap[i]) < 0)
    1.25  			fprintf(stderr, "Button %d %s lost (%s)\n",
    1.26  				i, down ? "down" : "up", strerror(errno));
    1.27  	}