Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemWin32.cpp
| Context not available. | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| void GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) | |||||
| GHOST_EventWheel *GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) | |||||
| { | { | ||||
| // short fwKeys = LOWORD(wParam); // key flags | static int accum = 0; | ||||
| int zDelta = (short) HIWORD(wParam); // wheel rotation | |||||
| accum += (short)HIWORD(wParam); | |||||
| // zDelta /= WHEEL_DELTA; | |||||
| // temporary fix below: microsoft now has added more precision, making the above division not work | |||||
| if (zDelta <= 0) zDelta = -1; else zDelta = 1; | |||||
| // short xPos = (short) LOWORD(lParam); // horizontal position of pointer | |||||
| // short yPos = (short) HIWORD(lParam); // vertical position of pointer | |||||
| return new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, zDelta); | |||||
| } | |||||
| int direction = (accum >= 0) ? 1 : -1; | |||||
| accum = abs(accum); | |||||
| GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); | |||||
| while (accum >= WHEEL_DELTA) { | |||||
| system->pushEvent(new GHOST_EventWheel(system->getMilliSeconds(), window, direction)); | |||||
| accum -= WHEEL_DELTA; | |||||
| } | |||||
brecht: Same here, better use `int`. | |||||
| accum *= direction; | |||||
| } | |||||
Not Done Inline ActionsSee below, since always 0 is returned, you can get rid of the return value for this method alltogether elubie: See below, since always 0 is returned, you can get rid of the return value for this method… | |||||
| GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINPUT const& raw) | GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINPUT const& raw) | ||||
| { | { | ||||
Not Done Inline ActionsAnd here as well. brecht: And here as well. | |||||
| Context not available. | |||||
| * since DefWindowProc propagates it up the parent chain | * since DefWindowProc propagates it up the parent chain | ||||
| * until it finds a window that processes it. | * until it finds a window that processes it. | ||||
| */ | */ | ||||
| event = processWheelEvent(window, wParam, lParam); | processWheelEvent(window, wParam, lParam); | ||||
| // already handled inside the method | |||||
| eventHandled = true; | |||||
Not Done Inline ActionsThis could be a member variable of GHOST_SystemWin32 I think. brecht: This could be a member variable of GHOST_SystemWin32 I think. | |||||
| break; | break; | ||||
Not Done Inline ActionsWith the new behavior only, this check is not necessary since all events are now handled in processWheelEvent. In this case you can probably also get rid of the return value alltogether elubie: With the new behavior only, this check is not necessary since all events are now handled in… | |||||
| case WM_SETCURSOR: | case WM_SETCURSOR: | ||||
| /* The WM_SETCURSOR message is sent to a window if the mouse causes the cursor | /* The WM_SETCURSOR message is sent to a window if the mouse causes the cursor | ||||
| * to move within a window and mouse input is not captured. | * to move within a window and mouse input is not captured. | ||||
| Context not available. | |||||
Not Done Inline ActionsWhy is there a maximum here, to avoid a very high number of mouse wheel events? 5 seems a bit low. brecht: Why is there a maximum here, to avoid a very high number of mouse wheel events? 5 seems a bit… | |||||
Same here, better use int.