diff options
author | pierre lamot <pierre.lamot@openwide.fr> | 2015-04-02 15:44:45 +0200 |
---|---|---|
committer | Nicolas Aguirre <aguirre.nicolas@gmail.com> | 2015-04-07 19:05:55 +0200 |
commit | 869ed025a2eca5f4d2b808fe456ddc65a40b508a (patch) | |
tree | 98c2b98b71d2db3f94875c0f039cc7b1af817280 /src/lib/ecore_cocoa | |
parent | 35f47f43af016c516c4d8e73fcec45f511afa240 (diff) |
ecore_cocoa: fix scrollwheel behavior
- prioritize vertical scroll over horizontal
- set amount to either -1 or 1, since EFL doesn't handle other value properly
- fix wheel bouncing with some devices (X:0,Y:0 scrolling events)
@fix
Diffstat (limited to 'src/lib/ecore_cocoa')
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa.m | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 1da3ed5b57..64eda41fbd 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m | |||
@@ -324,16 +324,40 @@ ecore_cocoa_feed_events(void *anEvent) | |||
324 | 324 | ||
325 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; | 325 | EcoreCocoaWindow *window = (EcoreCocoaWindow *)[event window]; |
326 | Ecore_Event_Mouse_Wheel *ev; | 326 | Ecore_Event_Mouse_Wheel *ev; |
327 | float dx, dy = 0; | ||
327 | 328 | ||
328 | ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); | 329 | ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); |
329 | if (!ev) return pass; | 330 | if (!ev) return pass; |
330 | 331 | ||
332 | if ([event hasPreciseScrollingDeltas]) | ||
333 | { | ||
334 | dx = -[event scrollingDeltaX]; | ||
335 | dy = -[event scrollingDeltaY]; | ||
336 | } | ||
337 | else | ||
338 | { | ||
339 | dx = -[event deltaX]; | ||
340 | dy = -[event deltaY]; | ||
341 | } | ||
342 | |||
343 | if (dx == 0 && dy == 0) | ||
344 | { | ||
345 | break; | ||
346 | } | ||
347 | |||
331 | ev->window = (Ecore_Window)window.ecore_window_data; | 348 | ev->window = (Ecore_Window)window.ecore_window_data; |
332 | ev->event_window = ev->window; | 349 | ev->event_window = ev->window; |
333 | ev->modifiers = 0; /* FIXME: keep modifier around. */ | 350 | ev->modifiers = 0; /* FIXME: keep modifier around. */ |
334 | ev->timestamp = time; | 351 | ev->timestamp = time; |
335 | ev->z = [event deltaX] != 0 ? [event deltaX] : -([event deltaY]); | 352 | if (dy != 0) |
336 | ev->direction = [event deltaX] != 0 ? 1 : 0; | 353 | { |
354 | ev->z = (dy > 0) ? 1 : -1; | ||
355 | } | ||
356 | else | ||
357 | { | ||
358 | ev->z = (dx > 0) ? 1 : -1; | ||
359 | } | ||
360 | ev->direction = (dy != 0) ? 0 : 1; | ||
337 | 361 | ||
338 | ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); | 362 | ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); |
339 | 363 | ||