- implemented absolute x/y mouse position mode in the X11 gui
- minor fixes in the USB tablet HID report descriptor
This commit is contained in:
parent
c6ea1482b0
commit
a9f27d029c
@ -114,6 +114,7 @@ static bx_bool mouse_captured = 0;
|
||||
static int prev_x=-1, prev_y=-1;
|
||||
static int current_x=-1, current_y=-1, current_z=0;
|
||||
static unsigned mouse_button_state = 0;
|
||||
static bx_bool x11_mouse_mode_absxy = 0;
|
||||
|
||||
static int warp_home_x = 200;
|
||||
static int warp_home_y = 200;
|
||||
@ -994,13 +995,23 @@ void bx_x_gui_c::handle_events(void)
|
||||
|
||||
void send_keyboard_mouse_status(void)
|
||||
{
|
||||
BX_DEBUG(("XXX: prev=(%d,%d) curr=(%d,%d)",
|
||||
prev_x, prev_y, current_x, current_y));
|
||||
int dx, dy, dz;
|
||||
BX_DEBUG(("XXX: prev=(%d,%d) curr=(%d,%d)",
|
||||
prev_x, prev_y, current_x, current_y));
|
||||
|
||||
if (x11_mouse_mode_absxy) {
|
||||
if ((current_y > bx_headerbar_y) && (current_y < (dimension_y + bx_headerbar_y))) {
|
||||
dx = current_x * 0x7fff / (dimension_x - 1);
|
||||
dy = (current_y - bx_headerbar_y) * 0x7fff / (dimension_y - 1);
|
||||
dz = current_z;
|
||||
DEV_mouse_motion(dx, dy, dz, mouse_button_state, 1);
|
||||
}
|
||||
prev_x = current_x;
|
||||
prev_y = current_y;
|
||||
return;
|
||||
}
|
||||
if (((prev_x!=-1) && (current_x!=-1) && (prev_y!=-1) && (current_y!=-1)) ||
|
||||
(current_z != 0)) {
|
||||
int dx, dy, dz;
|
||||
|
||||
// (mch) consider warping here
|
||||
dx = current_x - prev_x - warp_dx;
|
||||
dy = -(current_y - prev_y - warp_dy);
|
||||
@ -2037,7 +2048,7 @@ void bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
|
||||
|
||||
void bx_x_gui_c::set_mouse_mode_absxy(bx_bool mode)
|
||||
{
|
||||
// TODO
|
||||
x11_mouse_mode_absxy = mode;
|
||||
}
|
||||
|
||||
#if BX_SHOW_IPS
|
||||
|
@ -203,7 +203,7 @@ static const Bit8u bx_tablet_hid_descriptor[] = {
|
||||
|
||||
static const Bit8u bx_tablet_hid_report_descriptor[] = {
|
||||
0x05, 0x01, /* Usage Page Generic Desktop */
|
||||
0x09, 0x01, /* Usage Mouse */
|
||||
0x09, 0x01, /* Usage Pointer */
|
||||
0xA1, 0x01, /* Collection Application */
|
||||
0x09, 0x01, /* Usage Pointer */
|
||||
0xA1, 0x00, /* Collection Physical */
|
||||
@ -224,7 +224,7 @@ static const Bit8u bx_tablet_hid_report_descriptor[] = {
|
||||
0x15, 0x00, /* Logical Minimum 0 */
|
||||
0x26, 0xFF, 0x7F, /* Logical Maximum 0x7fff */
|
||||
0x35, 0x00, /* Physical Minimum 0 */
|
||||
0x46, 0xFE, 0x7F, /* Physical Maximum 0x7fff */
|
||||
0x46, 0xFF, 0x7F, /* Physical Maximum 0x7fff */
|
||||
0x75, 0x10, /* Report Size 16 */
|
||||
0x95, 0x02, /* Report Count 2 */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
@ -236,7 +236,7 @@ static const Bit8u bx_tablet_hid_report_descriptor[] = {
|
||||
0x45, 0x00, /* Physical Maximum 0 (same as logical) */
|
||||
0x75, 0x08, /* Report Size 8 */
|
||||
0x95, 0x01, /* Report Count 1 */
|
||||
0x81, 0x02, /* Input (Data, Var, Rel) */
|
||||
0x81, 0x06, /* Input (Data, Var, Rel) */
|
||||
0xC0, /* End Collection */
|
||||
0xC0, /* End Collection */
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user