Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemWin32.cpp
| Context not available. | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| GHOST_EventWheel *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 | int direction = (accum >= 0) ? 1 : -1; | ||||
| if (zDelta <= 0) zDelta = -1; else zDelta = 1; | accum = abs(accum); | ||||
| // short xPos = (short) LOWORD(lParam); // horizontal position of pointer | GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); | ||||
| // short yPos = (short) HIWORD(lParam); // vertical position of pointer | |||||
| return new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, zDelta); | while (accum >= WHEEL_DELTA) { | ||||
| } | system->pushEvent(new GHOST_EventWheel(system->getMilliSeconds(), window, direction)); | ||||
| accum -= WHEEL_DELTA; | |||||
| } | |||||
brecht: Same here, better use `int`. | |||||
| accum *= direction; | |||||
| return 0; | |||||
elubieUnsubmitted 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. | ||||
| */ | */ | ||||
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. | |||||
| event = processWheelEvent(window, wParam, lParam); | event = processWheelEvent(window, wParam, lParam); | ||||
| if (!event) | |||||
elubieUnsubmitted 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… | |||||
| eventHandled = true; | |||||
| break; | break; | ||||
| 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 | ||||
| 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.