summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2015-08-07 17:27:30 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-08-07 17:34:20 +0900
commit2e73e2224a970f023ae217bdfc606d3ddd397374 (patch)
tree35f4264f2c5f7e07493a11a28bd62b14b8c173d5
parent2686516f3c46af8ec5339dd00f9d1b42cce66d6c (diff)
intf scroll: handle wheel logic in post event cb.
Summary: @Fix Resolves: T2216 Reviewers: seoz, raster, JackDanielZ, Hermet Reviewed By: Hermet Subscribers: cedric, eagleeye, SanghyeonLee, seoz, sachin.dev Maniphest Tasks: T2216 Differential Revision: https://phab.enlightenment.org/D2393 Conflicts: src/lib/elm_interface_scrollable.c
-rw-r--r--src/lib/elm_interface_scrollable.c73
-rw-r--r--src/lib/elm_interface_scrollable.h1
2 files changed, 47 insertions, 27 deletions
diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c
index 594685bfc..5bc5509e1 100644
--- a/src/lib/elm_interface_scrollable.c
+++ b/src/lib/elm_interface_scrollable.c
@@ -1858,46 +1858,29 @@ _elm_scroll_wanted_region_set(Evas_Object *obj)
1858 eo_do(obj, elm_interface_scrollable_content_region_set(wx, sid->wy, ww, wh)); 1858 eo_do(obj, elm_interface_scrollable_content_region_set(wx, sid->wy, ww, wh));
1859} 1859}
1860 1860
1861static void 1861
1862_elm_scroll_wheel_event_cb(void *data, 1862static Eina_Bool
1863 Evas *e EINA_UNUSED, 1863_scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED)
1864 Evas_Object *obj EINA_UNUSED,
1865 void *event_info)
1866{ 1864{
1867 Elm_Scrollable_Smart_Interface_Data *sid; 1865 Elm_Scrollable_Smart_Interface_Data *sid = data;
1868 Evas_Event_Mouse_Wheel *ev; 1866 Evas_Event_Mouse_Wheel *ev = sid->event_info;
1867
1869 Evas_Coord x = 0, y = 0, vw = 0, vh = 0, cw = 0, ch = 0; 1868 Evas_Coord x = 0, y = 0, vw = 0, vh = 0, cw = 0, ch = 0;
1870 int direction = 0;
1871 int pagenumber_h = 0, pagenumber_v = 0; 1869 int pagenumber_h = 0, pagenumber_v = 0;
1872 int mx = 0, my = 0, minx = 0, miny = 0; 1870 int mx = 0, my = 0, minx = 0, miny = 0;
1873 Evas_Coord pwx, pwy; 1871 Evas_Coord pwx, pwy;
1874 double t; 1872 double t;
1873 int direction;
1875 1874
1876 sid = data;
1877 ev = event_info;
1878 direction = ev->direction; 1875 direction = ev->direction;
1879 1876
1880 if (direction)
1881 {
1882 if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) return;
1883 }
1884 else
1885 {
1886 if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) return;
1887 }
1888
1889 pwx = sid->wx; 1877 pwx = sid->wx;
1890 pwy = sid->wy; 1878 pwy = sid->wy;
1891 1879
1892 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; 1880 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
1893 if ((evas_key_modifier_is_set(ev->modifiers, "Control")) || 1881 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
1894 (evas_key_modifier_is_set(ev->modifiers, "Alt")) ||
1895 (evas_key_modifier_is_set(ev->modifiers, "Meta")) ||
1896 (evas_key_modifier_is_set(ev->modifiers, "Hyper")) ||
1897 (evas_key_modifier_is_set(ev->modifiers, "Super")))
1898 return;
1899 else if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
1900 direction = !direction; 1882 direction = !direction;
1883
1901 eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&x, &y)); 1884 eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&x, &y));
1902 if (sid->scrollto.x.animator) x = sid->scrollto.x.end; 1885 if (sid->scrollto.x.animator) x = sid->scrollto.x.end;
1903 if (sid->scrollto.y.animator) y = sid->scrollto.y.end; 1886 if (sid->scrollto.y.animator) y = sid->scrollto.y.end;
@@ -2012,6 +1995,42 @@ _elm_scroll_wheel_event_cb(void *data,
2012 else sid->down.last_hold_y_wheel = EINA_FALSE; 1995 else sid->down.last_hold_y_wheel = EINA_FALSE;
2013 sid->down.last_time_y_wheel = t; 1996 sid->down.last_time_y_wheel = t;
2014 } 1997 }
1998
1999 return EINA_TRUE;
2000}
2001
2002static void
2003_elm_scroll_wheel_event_cb(void *data,
2004 Evas *e,
2005 Evas_Object *obj EINA_UNUSED,
2006 void *event_info)
2007{
2008 Elm_Scrollable_Smart_Interface_Data *sid;
2009 Evas_Event_Mouse_Wheel *ev;
2010 int direction;
2011
2012 sid = data;
2013 ev = event_info;
2014 sid->event_info = event_info;
2015 direction = ev->direction;
2016
2017 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
2018 if ((evas_key_modifier_is_set(ev->modifiers, "Control")) ||
2019 (evas_key_modifier_is_set(ev->modifiers, "Alt")) ||
2020 (evas_key_modifier_is_set(ev->modifiers, "Meta")) ||
2021 (evas_key_modifier_is_set(ev->modifiers, "Hyper")) ||
2022 (evas_key_modifier_is_set(ev->modifiers, "Super")))
2023 return;
2024 if (direction)
2025 {
2026 if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) return;
2027 }
2028 else
2029 {
2030 if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) return;
2031 }
2032
2033 evas_post_event_callback_push(e, _scroll_wheel_post_event_cb, sid);
2015} 2034}
2016 2035
2017static Eina_Bool 2036static Eina_Bool
diff --git a/src/lib/elm_interface_scrollable.h b/src/lib/elm_interface_scrollable.h
index 748a9caee..4038eb94e 100644
--- a/src/lib/elm_interface_scrollable.h
+++ b/src/lib/elm_interface_scrollable.h
@@ -193,6 +193,7 @@ struct _Elm_Scrollable_Smart_Interface_Data
193 193
194 unsigned char size_adjust_recurse; 194 unsigned char size_adjust_recurse;
195 unsigned char size_count; 195 unsigned char size_count;
196 void *event_info;
196 Eina_Bool size_adjust_recurse_abort : 1; 197 Eina_Bool size_adjust_recurse_abort : 1;
197 198
198 Eina_Bool momentum_animator_disabled : 1; 199 Eina_Bool momentum_animator_disabled : 1;