Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemWin32.cpp
| Context not available. | |||||
| #endif | #endif | ||||
| #include <stdio.h> // [mce] temporary debug, remove soon! | #include <stdio.h> // [mce] temporary debug, remove soon! | ||||
| #include <stdlib.h> | |||||
| #include "GHOST_SystemWin32.h" | #include "GHOST_SystemWin32.h" | ||||
| #include "GHOST_EventDragnDrop.h" | #include "GHOST_EventDragnDrop.h" | ||||
elubie: See below, since always 0 is returned, you can get rid of the return value for this method… | |||||
Not Done Inline ActionsSame here, better use int. brecht: Same here, better use `int`. | |||||
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); | |||||
| if (getenv("BLENDER_WHEEL") && atoi(getenv("BLENDER_WHEEL")) > 0 ) { | |||||
| static int accum = 0; | |||||
brechtUnsubmitted 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. | |||||
| int zDelta = (short) HIWORD(wParam); // wheel rotation | |||||
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… | |||||
| accum += zDelta; | |||||
| int n = abs(accum) / WHEEL_DELTA; | |||||
| int direction = (accum >= 0) ? 1 : -1; | |||||
| const int N_MAX = 5; | |||||
| accum = (abs(accum) % WHEEL_DELTA) * direction; | |||||
| if (n > N_MAX) | |||||
| n = N_MAX; | |||||
brechtUnsubmitted 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… | |||||
| for (int i=0; i<n; i++) { | |||||
| system->pushEvent(new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, direction)); | |||||
| } | |||||
| event = 0; | |||||
| eventHandled = true; | |||||
| } | |||||
| else | |||||
| { | |||||
| event = processWheelEvent(window, wParam, lParam); | |||||
| } | |||||
| 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. | |||||
See below, since always 0 is returned, you can get rid of the return value for this method alltogether