- prepared support for sending absolute x/y values from the gui to the mouse emulation
- new gui method set_mouse_mode_absxy() should switch the gui to absolute x/y mode - new DEV_mouse_motion() argument 'absxy' indicates whether or not the gui sends absolute x/y values - USB tablet code prepared to use the new feature - TODO: implement this feature for each gui (sdl, win32, wx, x, ...)
This commit is contained in:
parent
40f33ff8c2
commit
9189105a0b
@ -74,35 +74,35 @@ struct InputEvent *MyInputHandler(void)
|
|||||||
case IECODE_LBUTTON:
|
case IECODE_LBUTTON:
|
||||||
{
|
{
|
||||||
mouse_button_state |= 0x01;
|
mouse_button_state |= 0x01;
|
||||||
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, mouse_button_state);
|
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, 0, mouse_button_state, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
case (IECODE_LBUTTON | IECODE_UP_PREFIX):
|
case (IECODE_LBUTTON | IECODE_UP_PREFIX):
|
||||||
{
|
{
|
||||||
mouse_button_state &= ~0x01;
|
mouse_button_state &= ~0x01;
|
||||||
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, mouse_button_state);
|
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, 0, mouse_button_state, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IECODE_RBUTTON:
|
case IECODE_RBUTTON:
|
||||||
{
|
{
|
||||||
mouse_button_state |= 0x02;
|
mouse_button_state |= 0x02;
|
||||||
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, mouse_button_state);
|
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, 0, mouse_button_state, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
case (IECODE_RBUTTON | IECODE_UP_PREFIX):
|
case (IECODE_RBUTTON | IECODE_UP_PREFIX):
|
||||||
{
|
{
|
||||||
mouse_button_state &= 0x01;
|
mouse_button_state &= 0x01;
|
||||||
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, mouse_button_state);
|
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, 0, mouse_button_state, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->ie_Class == IECLASS_RAWMOUSE)
|
if (event->ie_Class == IECLASS_RAWMOUSE)
|
||||||
{
|
{
|
||||||
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, mouse_button_state);
|
DEV_mouse_motion(event->ie_position.ie_xy.ie_x, -event->ie_position.ie_xy.ie_y, 0, mouse_button_state, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1052,7 +1052,7 @@ void bx_carbon_gui_c::handle_events(void)
|
|||||||
dy = 0;
|
dy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEV_mouse_motion(dx, dy, mouse_button_state);
|
DEV_mouse_motion(dx, dy, 0, mouse_button_state, 0);
|
||||||
|
|
||||||
if (!cursorVisible && mouseMoved)
|
if (!cursorVisible && mouseMoved)
|
||||||
{
|
{
|
||||||
|
@ -136,6 +136,7 @@ public:
|
|||||||
virtual void beep_on(float frequency);
|
virtual void beep_on(float frequency);
|
||||||
virtual void beep_off();
|
virtual void beep_off();
|
||||||
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
|
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
|
||||||
|
virtual void set_mouse_mode_absxy(bx_bool mode) {}
|
||||||
|
|
||||||
// The following function(s) are defined already, and your
|
// The following function(s) are defined already, and your
|
||||||
// GUI code calls them
|
// GUI code calls them
|
||||||
|
@ -815,7 +815,7 @@ void bx_macintosh_gui_c::handle_events(void)
|
|||||||
dx = mousePt.h - prevPt.h;
|
dx = mousePt.h - prevPt.h;
|
||||||
dy = prevPt.v - mousePt.v;
|
dy = prevPt.v - mousePt.v;
|
||||||
|
|
||||||
DEV_mouse_motion(dx, dy, mouse_button_state);
|
DEV_mouse_motion(dx, dy, 0, mouse_button_state, 0);
|
||||||
|
|
||||||
if (!cursorVisible)
|
if (!cursorVisible)
|
||||||
{
|
{
|
||||||
|
@ -1646,7 +1646,7 @@ void rfbMouseMove(int x, int y, int bmask)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(y > rfbHeaderbarY) {
|
if(y > rfbHeaderbarY) {
|
||||||
DEV_mouse_motion(x - oldx, oldy - y, bmask);
|
DEV_mouse_motion(x - oldx, oldy - y, 0, bmask, 0);
|
||||||
oldx = x;
|
oldx = x;
|
||||||
oldy = y;
|
oldy = y;
|
||||||
} else {
|
} else {
|
||||||
|
@ -987,11 +987,11 @@ void bx_sdl_gui_c::handle_events(void)
|
|||||||
//fprintf (stderr, "processing relative mouse event\n");
|
//fprintf (stderr, "processing relative mouse event\n");
|
||||||
new_mousebuttons = ((sdl_event.motion.state & 0x01)|((sdl_event.motion.state>>1)&0x02)
|
new_mousebuttons = ((sdl_event.motion.state & 0x01)|((sdl_event.motion.state>>1)&0x02)
|
||||||
|((sdl_event.motion.state<<1)&0x04));
|
|((sdl_event.motion.state<<1)&0x04));
|
||||||
DEV_mouse_motion_ext(
|
DEV_mouse_motion(
|
||||||
sdl_event.motion.xrel,
|
sdl_event.motion.xrel,
|
||||||
-sdl_event.motion.yrel,
|
-sdl_event.motion.yrel,
|
||||||
wheel_status,
|
wheel_status,
|
||||||
new_mousebuttons);
|
new_mousebuttons, 0);
|
||||||
old_mousebuttons = new_mousebuttons;
|
old_mousebuttons = new_mousebuttons;
|
||||||
old_mousex = (int)(sdl_event.motion.x);
|
old_mousex = (int)(sdl_event.motion.x);
|
||||||
old_mousey = (int)(sdl_event.motion.y);
|
old_mousey = (int)(sdl_event.motion.y);
|
||||||
@ -1047,11 +1047,11 @@ void bx_sdl_gui_c::handle_events(void)
|
|||||||
if(sdl_fullscreen_toggle == 0)
|
if(sdl_fullscreen_toggle == 0)
|
||||||
new_mousebuttons &= 0x07;
|
new_mousebuttons &= 0x07;
|
||||||
// send motion information
|
// send motion information
|
||||||
DEV_mouse_motion_ext(
|
DEV_mouse_motion(
|
||||||
new_mousex - old_mousex,
|
new_mousex - old_mousex,
|
||||||
-(new_mousey - old_mousey),
|
-(new_mousey - old_mousey),
|
||||||
wheel_status,
|
wheel_status,
|
||||||
new_mousebuttons);
|
new_mousebuttons, 0);
|
||||||
// mark current state to diff with next packet
|
// mark current state to diff with next packet
|
||||||
old_mousebuttons = new_mousebuttons;
|
old_mousebuttons = new_mousebuttons;
|
||||||
old_mousex = new_mousex;
|
old_mousex = new_mousex;
|
||||||
|
@ -417,7 +417,7 @@ void mouse_handler(int button, int dx, int dy, int dz,
|
|||||||
bx_bool old = SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get();
|
bx_bool old = SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get();
|
||||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->set(!old);
|
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->set(!old);
|
||||||
} else {
|
} else {
|
||||||
DEV_mouse_motion((int) (0.25 * dx), (int) -(0.25 * dy), buttons);
|
DEV_mouse_motion((int) (0.25 * dx), (int) -(0.25 * dy), 0, buttons, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1433,12 +1433,12 @@ void bx_win32_gui_c::handle_events(void)
|
|||||||
key = queue_event->key_event;
|
key = queue_event->key_event;
|
||||||
if (key==MOUSE_MOTION)
|
if (key==MOUSE_MOTION)
|
||||||
{
|
{
|
||||||
DEV_mouse_motion_ext(queue_event->mouse_x,
|
DEV_mouse_motion(queue_event->mouse_x, queue_event->mouse_y,
|
||||||
queue_event->mouse_y, queue_event->mouse_z, queue_event->mouse_button_state);
|
queue_event->mouse_z, queue_event->mouse_button_state, 0);
|
||||||
}
|
}
|
||||||
// Check for mouse buttons first
|
// Check for mouse buttons first
|
||||||
else if (key & MOUSE_PRESSED) {
|
else if (key & MOUSE_PRESSED) {
|
||||||
DEV_mouse_motion_ext(0, 0, 0, LOWORD(key));
|
DEV_mouse_motion(0, 0, 0, LOWORD(key), 0);
|
||||||
}
|
}
|
||||||
else if (key & HEADERBAR_CLICKED) {
|
else if (key & HEADERBAR_CLICKED) {
|
||||||
headerbar_click(LOWORD(key));
|
headerbar_click(LOWORD(key));
|
||||||
|
@ -1081,7 +1081,8 @@ void bx_wx_gui_c::handle_events(void)
|
|||||||
DEV_mouse_motion(
|
DEV_mouse_motion(
|
||||||
event_queue[i].u.mouse.dx,
|
event_queue[i].u.mouse.dx,
|
||||||
event_queue[i].u.mouse.dy,
|
event_queue[i].u.mouse.dy,
|
||||||
event_queue[i].u.mouse.buttons);
|
0,
|
||||||
|
event_queue[i].u.mouse.buttons, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wxLogError (wxT ("handle_events received unhandled event type %d in queue"), (int)event_queue[i].type);
|
wxLogError (wxT ("handle_events received unhandled event type %d in queue"), (int)event_queue[i].type);
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
virtual void beep_off();
|
virtual void beep_off();
|
||||||
virtual void statusbar_setitem_specific(int element, bx_bool active, bx_bool w);
|
virtual void statusbar_setitem_specific(int element, bx_bool active, bx_bool w);
|
||||||
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
|
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
|
||||||
|
virtual void set_mouse_mode_absxy(bx_bool mode);
|
||||||
#if BX_SHOW_IPS
|
#if BX_SHOW_IPS
|
||||||
virtual void show_ips(Bit32u ips_count);
|
virtual void show_ips(Bit32u ips_count);
|
||||||
#endif
|
#endif
|
||||||
@ -1006,7 +1007,7 @@ void send_keyboard_mouse_status(void)
|
|||||||
dz = current_z;
|
dz = current_z;
|
||||||
warp_cursor(warp_home_x-current_x, warp_home_y-current_y);
|
warp_cursor(warp_home_x-current_x, warp_home_y-current_y);
|
||||||
|
|
||||||
DEV_mouse_motion_ext(dx, dy, dz, mouse_button_state);
|
DEV_mouse_motion(dx, dy, dz, mouse_button_state, 0);
|
||||||
prev_x = current_x;
|
prev_x = current_x;
|
||||||
prev_y = current_y;
|
prev_y = current_y;
|
||||||
} else {
|
} else {
|
||||||
@ -2034,6 +2035,11 @@ void bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
|
|||||||
*bpp = 32;
|
*bpp = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bx_x_gui_c::set_mouse_mode_absxy(bx_bool mode)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
#if BX_SHOW_IPS
|
#if BX_SHOW_IPS
|
||||||
void bx_x_gui_c::show_ips(Bit32u ips_count)
|
void bx_x_gui_c::show_ips(Bit32u ips_count)
|
||||||
{
|
{
|
||||||
|
@ -977,7 +977,7 @@ void bx_devices_c::mouse_enabled_changed(bx_bool enabled)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bx_devices_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state)
|
void bx_devices_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy)
|
||||||
{
|
{
|
||||||
// If mouse events are disabled on the GUI headerbar, don't
|
// If mouse events are disabled on the GUI headerbar, don't
|
||||||
// generate any mouse data
|
// generate any mouse data
|
||||||
@ -986,13 +986,13 @@ void bx_devices_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned
|
|||||||
|
|
||||||
// if a removable mouse is connected, redirect mouse data to the device
|
// if a removable mouse is connected, redirect mouse data to the device
|
||||||
if (bx_mouse[1].dev != NULL) {
|
if (bx_mouse[1].dev != NULL) {
|
||||||
bx_mouse[1].enq_event(bx_mouse[1].dev, delta_x, delta_y, delta_z, button_state);
|
bx_mouse[1].enq_event(bx_mouse[1].dev, delta_x, delta_y, delta_z, button_state, absxy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a mouse is connected, direct mouse data to the device
|
// if a mouse is connected, direct mouse data to the device
|
||||||
if (bx_mouse[0].dev != NULL) {
|
if (bx_mouse[0].dev != NULL) {
|
||||||
bx_mouse[0].enq_event(bx_mouse[0].dev, delta_x, delta_y, delta_z, button_state);
|
bx_mouse[0].enq_event(bx_mouse[0].dev, delta_x, delta_y, delta_z, button_state, absxy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ typedef Bit32u (*bx_read_handler_t)(void *, Bit32u, unsigned);
|
|||||||
typedef void (*bx_write_handler_t)(void *, Bit32u, Bit32u, unsigned);
|
typedef void (*bx_write_handler_t)(void *, Bit32u, Bit32u, unsigned);
|
||||||
|
|
||||||
typedef bx_bool (*bx_keyb_enq_t)(void *, Bit8u *);
|
typedef bx_bool (*bx_keyb_enq_t)(void *, Bit8u *);
|
||||||
typedef void (*bx_mouse_enq_t)(void *, int, int, int, unsigned);
|
typedef void (*bx_mouse_enq_t)(void *, int, int, int, unsigned, bx_bool);
|
||||||
typedef void (*bx_mouse_enabled_changed_t)(void *, bx_bool);
|
typedef void (*bx_mouse_enabled_changed_t)(void *, bx_bool);
|
||||||
|
|
||||||
#if BX_USE_DEV_SMF
|
#if BX_USE_DEV_SMF
|
||||||
@ -449,7 +449,7 @@ public:
|
|||||||
void unregister_removable_mouse(void *dev);
|
void unregister_removable_mouse(void *dev);
|
||||||
bx_bool optional_key_enq(Bit8u *scan_code);
|
bx_bool optional_key_enq(Bit8u *scan_code);
|
||||||
void mouse_enabled_changed(bx_bool enabled);
|
void mouse_enabled_changed(bx_bool enabled);
|
||||||
void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||||
|
|
||||||
static void timer_handler(void *);
|
static void timer_handler(void *);
|
||||||
void timer(void);
|
void timer(void);
|
||||||
|
@ -1620,12 +1620,12 @@ void bx_keyb_c::mouse_enabled_changed(bx_bool enabled)
|
|||||||
BX_DEBUG(("PS/2 mouse %s", enabled?"enabled":"disabled"));
|
BX_DEBUG(("PS/2 mouse %s", enabled?"enabled":"disabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bx_keyb_c::mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state)
|
void bx_keyb_c::mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy)
|
||||||
{
|
{
|
||||||
((bx_keyb_c*)dev)->mouse_motion(delta_x, delta_y, delta_z, button_state);
|
((bx_keyb_c*)dev)->mouse_motion(delta_x, delta_y, delta_z, button_state, absxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bx_keyb_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state)
|
void bx_keyb_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy)
|
||||||
{
|
{
|
||||||
bx_bool force_enq=0;
|
bx_bool force_enq=0;
|
||||||
|
|
||||||
|
@ -222,8 +222,8 @@ private:
|
|||||||
|
|
||||||
static void mouse_enabled_changed_static(void *dev, bx_bool enabled);
|
static void mouse_enabled_changed_static(void *dev, bx_bool enabled);
|
||||||
void mouse_enabled_changed(bx_bool enabled);
|
void mouse_enabled_changed(bx_bool enabled);
|
||||||
static void mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state);
|
static void mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||||
void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||||
|
|
||||||
static void timer_handler(void *);
|
static void timer_handler(void *);
|
||||||
void timer(void);
|
void timer(void);
|
||||||
|
@ -1641,12 +1641,12 @@ void bx_serial_c::fifo_timer(void)
|
|||||||
raise_interrupt(port, BX_SER_INT_FIFO);
|
raise_interrupt(port, BX_SER_INT_FIFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bx_serial_c::mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state)
|
void bx_serial_c::mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy)
|
||||||
{
|
{
|
||||||
((bx_serial_c*)dev)->mouse_enq(delta_x, delta_y, delta_z, button_state);
|
((bx_serial_c*)dev)->mouse_enq(delta_x, delta_y, delta_z, button_state, absxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bx_serial_c::mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state)
|
void bx_serial_c::mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy)
|
||||||
{
|
{
|
||||||
Bit8u b1, b2, b3, mouse_data[5];
|
Bit8u b1, b2, b3, mouse_data[5];
|
||||||
int bytes, tail;
|
int bytes, tail;
|
||||||
|
@ -235,8 +235,8 @@ private:
|
|||||||
static void fifo_timer_handler(void *);
|
static void fifo_timer_handler(void *);
|
||||||
BX_SER_SMF void fifo_timer(void);
|
BX_SER_SMF void fifo_timer(void);
|
||||||
|
|
||||||
static void mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state);
|
static void mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||||
void mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
void mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||||
|
|
||||||
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
||||||
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
||||||
|
@ -398,6 +398,7 @@ usb_hid_device_c::usb_hid_device_c(usbdev_type type)
|
|||||||
} else if (d.type == USB_DEV_TYPE_TABLET) {
|
} else if (d.type == USB_DEV_TYPE_TABLET) {
|
||||||
strcpy(d.devname, "USB Tablet");
|
strcpy(d.devname, "USB Tablet");
|
||||||
DEV_register_removable_mouse((void*)this, mouse_enq_static, mouse_enabled_changed);
|
DEV_register_removable_mouse((void*)this, mouse_enq_static, mouse_enabled_changed);
|
||||||
|
bx_gui->set_mouse_mode_absxy(1);
|
||||||
} else if (d.type == USB_DEV_TYPE_KEYPAD) {
|
} else if (d.type == USB_DEV_TYPE_KEYPAD) {
|
||||||
strcpy(d.devname, "USB/PS2 Keypad");
|
strcpy(d.devname, "USB/PS2 Keypad");
|
||||||
DEV_register_removable_keyboard((void*)this, key_enq_static);
|
DEV_register_removable_keyboard((void*)this, key_enq_static);
|
||||||
@ -412,6 +413,7 @@ usb_hid_device_c::~usb_hid_device_c(void)
|
|||||||
{
|
{
|
||||||
if ((d.type == USB_DEV_TYPE_MOUSE) ||
|
if ((d.type == USB_DEV_TYPE_MOUSE) ||
|
||||||
(d.type == USB_DEV_TYPE_TABLET)) {
|
(d.type == USB_DEV_TYPE_TABLET)) {
|
||||||
|
bx_gui->set_mouse_mode_absxy(0);
|
||||||
DEV_unregister_removable_mouse((void*)this);
|
DEV_unregister_removable_mouse((void*)this);
|
||||||
} else if (d.type == USB_DEV_TYPE_KEYPAD) {
|
} else if (d.type == USB_DEV_TYPE_KEYPAD) {
|
||||||
DEV_unregister_removable_keyboard((void*)this);
|
DEV_unregister_removable_keyboard((void*)this);
|
||||||
@ -703,7 +705,7 @@ int usb_hid_device_c::mouse_poll(Bit8u *buf, int len)
|
|||||||
(d.type == USB_DEV_TYPE_KEYPAD)) {
|
(d.type == USB_DEV_TYPE_KEYPAD)) {
|
||||||
if (!s.mouse_x && !s.mouse_y) {
|
if (!s.mouse_x && !s.mouse_y) {
|
||||||
// if there's no new movement, handle delayed one
|
// if there's no new movement, handle delayed one
|
||||||
mouse_enq(0, 0, s.mouse_z, s.b_state);
|
mouse_enq(0, 0, s.mouse_z, s.b_state, 0);
|
||||||
}
|
}
|
||||||
buf[0] = (Bit8u) s.b_state;
|
buf[0] = (Bit8u) s.b_state;
|
||||||
buf[1] = (Bit8s) s.mouse_x;
|
buf[1] = (Bit8s) s.mouse_x;
|
||||||
@ -734,12 +736,12 @@ void usb_hid_device_c::mouse_enabled_changed(void *dev, bx_bool enabled)
|
|||||||
if (enabled) ((usb_hid_device_c*)dev)->handle_reset();
|
if (enabled) ((usb_hid_device_c*)dev)->handle_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_hid_device_c::mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state)
|
void usb_hid_device_c::mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy)
|
||||||
{
|
{
|
||||||
((usb_hid_device_c*)dev)->mouse_enq(delta_x, delta_y, delta_z, button_state);
|
((usb_hid_device_c*)dev)->mouse_enq(delta_x, delta_y, delta_z, button_state, absxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_hid_device_c::mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state)
|
void usb_hid_device_c::mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy)
|
||||||
{
|
{
|
||||||
if (d.type == USB_DEV_TYPE_MOUSE) {
|
if (d.type == USB_DEV_TYPE_MOUSE) {
|
||||||
// scale down the motion
|
// scale down the motion
|
||||||
@ -780,9 +782,13 @@ void usb_hid_device_c::mouse_enq(int delta_x, int delta_y, int delta_z, unsigned
|
|||||||
s.mouse_x = (Bit8s) delta_x;
|
s.mouse_x = (Bit8s) delta_x;
|
||||||
s.mouse_y = (Bit8s) delta_y;
|
s.mouse_y = (Bit8s) delta_y;
|
||||||
} else if (d.type == USB_DEV_TYPE_TABLET) {
|
} else if (d.type == USB_DEV_TYPE_TABLET) {
|
||||||
// FIXME: Bochs gui should generate absolute x/y values if tablet connected
|
if (absxy) {
|
||||||
|
s.mouse_x = delta_x;
|
||||||
|
s.mouse_y = delta_y;
|
||||||
|
} else {
|
||||||
s.mouse_x += delta_x;
|
s.mouse_x += delta_x;
|
||||||
s.mouse_y -= delta_y;
|
s.mouse_y -= delta_y;
|
||||||
|
}
|
||||||
if (s.mouse_x < 0)
|
if (s.mouse_x < 0)
|
||||||
s.mouse_x = 0;
|
s.mouse_x = 0;
|
||||||
if (s.mouse_y < 0)
|
if (s.mouse_y < 0)
|
||||||
|
@ -51,8 +51,8 @@ private:
|
|||||||
static bx_bool key_enq_static(void *dev, Bit8u *scan_code);
|
static bx_bool key_enq_static(void *dev, Bit8u *scan_code);
|
||||||
bx_bool key_enq(Bit8u *scan_code);
|
bx_bool key_enq(Bit8u *scan_code);
|
||||||
static void mouse_enabled_changed(void *dev, bx_bool enabled);
|
static void mouse_enabled_changed(void *dev, bx_bool enabled);
|
||||||
static void mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state);
|
static void mouse_enq_static(void *dev, int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||||
void mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state);
|
void mouse_enq(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||||
int mouse_poll(Bit8u *buf, int len);
|
int mouse_poll(Bit8u *buf, int len);
|
||||||
int keypad_poll(Bit8u *buf, int len);
|
int keypad_poll(Bit8u *buf, int len);
|
||||||
};
|
};
|
||||||
|
@ -135,8 +135,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define DEV_register_timer(a,b,c,d,e,f) bx_pc_system.register_timer(a,b,c,d,e,f)
|
#define DEV_register_timer(a,b,c,d,e,f) bx_pc_system.register_timer(a,b,c,d,e,f)
|
||||||
#define DEV_mouse_enabled_changed(en) (bx_devices.mouse_enabled_changed(en))
|
#define DEV_mouse_enabled_changed(en) (bx_devices.mouse_enabled_changed(en))
|
||||||
#define DEV_mouse_motion(dx, dy, state) (bx_devices.mouse_motion(dx, dy, 0, state))
|
#define DEV_mouse_motion(dx, dy, dz, bs, absxy) (bx_devices.mouse_motion(dx, dy, dz, bs, absxy))
|
||||||
#define DEV_mouse_motion_ext(dx, dy, dz, state) (bx_devices.mouse_motion(dx, dy, dz, state))
|
|
||||||
|
|
||||||
///////// Removable devices macros
|
///////// Removable devices macros
|
||||||
#define DEV_optional_key_enq(a) (bx_devices.optional_key_enq(a))
|
#define DEV_optional_key_enq(a) (bx_devices.optional_key_enq(a))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user