- fixed 'imps2' mouse emulation - wheel data is okay now
- wheel mouse support for the 'x' display library added
This commit is contained in:
parent
202734a5a3
commit
1d5eb60ec8
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: win32.cc,v 1.87 2004-12-05 20:23:38 vruppert Exp $
|
||||
// $Id: win32.cc,v 1.88 2004-12-06 21:12:06 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -88,8 +88,8 @@ static QueueEvent keyevents[SCANCODE_BUFSIZE];
|
||||
static unsigned head=0, tail=0;
|
||||
static int mouse_button_state = 0;
|
||||
static int ms_xdelta=0, ms_ydelta=0, ms_zdelta=0;
|
||||
static int ms_lastx=0, ms_lasty=0, ms_lastz=0;
|
||||
static int ms_savedx=0, ms_savedy=0, ms_savedz=0;
|
||||
static int ms_lastx=0, ms_lasty=0;
|
||||
static int ms_savedx=0, ms_savedy=0;
|
||||
static BOOL mouseCaptureMode, mouseCaptureNew, mouseToggleReq;
|
||||
static unsigned long workerThread = 0;
|
||||
static DWORD workerThreadID = 0;
|
||||
@ -479,10 +479,9 @@ static void processMouseXY( int x, int y, int z, int windows_state, int implied_
|
||||
}
|
||||
ms_ydelta=ms_savedy-y;
|
||||
ms_xdelta=x-ms_savedx;
|
||||
ms_zdelta=z-ms_savedz;
|
||||
ms_zdelta=z;
|
||||
ms_lastx=x;
|
||||
ms_lasty=y;
|
||||
ms_lastz=z;
|
||||
if ( bx_state!=mouse_button_state)
|
||||
{
|
||||
EnterCriticalSection( &stInfo.keyCS);
|
||||
@ -499,7 +498,6 @@ static void resetDelta()
|
||||
EnterCriticalSection( &stInfo.mouseCS);
|
||||
ms_savedx=ms_lastx;
|
||||
ms_savedy=ms_lasty;
|
||||
ms_savedz=ms_lastz;
|
||||
ms_ydelta=ms_xdelta=ms_zdelta=0;
|
||||
LeaveCriticalSection( &stInfo.mouseCS);
|
||||
}
|
||||
@ -514,7 +512,6 @@ static void cursorWarped()
|
||||
ms_lasty=stretched_y/2;
|
||||
ms_savedx=ms_lastx;
|
||||
ms_savedy=ms_lasty;
|
||||
ms_savedz=ms_lastz;
|
||||
LeaveCriticalSection( &stInfo.mouseCS);
|
||||
}
|
||||
|
||||
@ -995,7 +992,11 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
if (!mouseModeChange) {
|
||||
processMouseXY( 0, 0, HIWORD(wParam), 0, 0);
|
||||
// WM_MOUSEWHEEL returns x and y relative to the main screen.
|
||||
// WM_MOUSEMOVE below returns x and y relative to the current view.
|
||||
RECT rect;
|
||||
GetWindowRect(stInfo.simWnd, &rect);
|
||||
processMouseXY( LOWORD(lParam) - rect.left, HIWORD(lParam) - rect.top, (Bit16s) HIWORD(wParam) / 120, LOWORD(wParam), 0);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: x.cc,v 1.86 2004-11-06 17:03:43 vruppert Exp $
|
||||
// $Id: x.cc,v 1.87 2004-12-06 21:12:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -104,7 +104,7 @@ static unsigned imDepth, imWide, imBPP;
|
||||
|
||||
// current cursor coordinates
|
||||
static int prev_x=-1, prev_y=-1;
|
||||
static int current_x=-1, current_y=-1;
|
||||
static int current_x=-1, current_y=-1, current_z=0;
|
||||
static unsigned mouse_button_state = 0;
|
||||
static bx_bool CTRL_pressed = 0;
|
||||
|
||||
@ -753,6 +753,7 @@ bx_x_gui_c::handle_events(void)
|
||||
|
||||
while (XPending(bx_x_display) > 0) {
|
||||
XNextEvent(bx_x_display, &report);
|
||||
current_z = 0;
|
||||
switch (report.type) {
|
||||
|
||||
case Expose:
|
||||
@ -860,6 +861,16 @@ bx_x_gui_c::handle_events(void)
|
||||
send_keyboard_mouse_status();
|
||||
mouse_update = 0;
|
||||
break;
|
||||
case Button4:
|
||||
current_z = 1;
|
||||
send_keyboard_mouse_status();
|
||||
mouse_update = 0;
|
||||
break;
|
||||
case Button5:
|
||||
current_z = -1;
|
||||
send_keyboard_mouse_status();
|
||||
mouse_update = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -923,16 +934,17 @@ send_keyboard_mouse_status(void)
|
||||
BX_DEBUG(("XXX: prev=(%d,%d) curr=(%d,%d)",
|
||||
prev_x, prev_y, current_x, current_y));
|
||||
|
||||
if ( (prev_x!=-1) && (current_x!=-1) && (prev_y!=-1) && (current_y!=-1)) {
|
||||
int dx, dy;
|
||||
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);
|
||||
dz = current_z;
|
||||
warp_cursor(warp_home_x-current_x, warp_home_y-current_y);
|
||||
|
||||
//BX_INFO(("xxx: MOUSE_MOTION: dx=%d, dy=%d", (int) dx, (int) dy));
|
||||
DEV_mouse_motion (dx, dy, mouse_button_state);
|
||||
DEV_mouse_motion_ext (dx, dy, dz, mouse_button_state);
|
||||
//if (warped) {
|
||||
// prev_x = current_x = -1;
|
||||
// prev_y = current_y = -1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: keyboard.cc,v 1.93 2004-12-05 20:23:38 vruppert Exp $
|
||||
// $Id: keyboard.cc,v 1.94 2004-12-06 21:12:11 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -125,7 +125,7 @@ bx_keyb_c::resetinternals(bx_bool powerup)
|
||||
void
|
||||
bx_keyb_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.93 2004-12-05 20:23:38 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.94 2004-12-06 21:12:11 vruppert Exp $"));
|
||||
Bit32u i;
|
||||
|
||||
DEV_register_irq(1, "8042 Keyboard controller");
|
||||
@ -1488,9 +1488,7 @@ bx_keyb_c::create_mouse_packet(bool force_enq) {
|
||||
BX_KEY_THIS s.mouse.delayed_dy+=256;
|
||||
}
|
||||
|
||||
b4 = (Bit8u) BX_KEY_THIS s.mouse.delayed_dz & 0x07;
|
||||
if (BX_KEY_THIS s.mouse.delayed_dz < 0)
|
||||
b4 |= 0xF8;
|
||||
b4 = (Bit8u) -BX_KEY_THIS s.mouse.delayed_dz;
|
||||
|
||||
mouse_enQ_packet(b1, b2, b3, b4);
|
||||
}
|
||||
@ -1555,7 +1553,7 @@ bx_keyb_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_s
|
||||
return;
|
||||
}
|
||||
|
||||
if(BX_KEY_THIS s.mouse.button_status != (button_state & 0x7)) {
|
||||
if ((BX_KEY_THIS s.mouse.button_status != (button_state & 0x7)) || delta_z) {
|
||||
force_enq=1;
|
||||
}
|
||||
|
||||
@ -1565,12 +1563,10 @@ bx_keyb_c::mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_s
|
||||
if(delta_y>255) delta_y=255;
|
||||
if(delta_x<-256) delta_x=-256;
|
||||
if(delta_y<-256) delta_y=-256;
|
||||
if(delta_z == 120) delta_z = 1;
|
||||
if(delta_z == 65416) delta_z = -1;
|
||||
|
||||
BX_KEY_THIS s.mouse.delayed_dx+=delta_x;
|
||||
BX_KEY_THIS s.mouse.delayed_dy+=delta_y;
|
||||
BX_KEY_THIS s.mouse.delayed_dz+=delta_z;
|
||||
BX_KEY_THIS s.mouse.delayed_dz = delta_z;
|
||||
|
||||
if((BX_KEY_THIS s.mouse.delayed_dx>255)||
|
||||
(BX_KEY_THIS s.mouse.delayed_dx<-256)||
|
||||
|
Loading…
x
Reference in New Issue
Block a user