From: devilhorns Date: Tue, 3 Jan 2012 20:41:49 +0000 (+0000) Subject: Elm (wayland): Add ability to actually move windows around in wayland. X-Git-Tag: REL_F_I9500_20120323_1~17^2~956 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb4501ac1d810ca3207105e71f9d9fc0c920fedd;p=framework%2Fuifw%2Felementary.git Elm (wayland): Add ability to actually move windows around in wayland. Remove __UNUSED__ on a variable that is actually used (in callback_show). git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66809 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 354c7b6..09f4af9 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -26,6 +26,7 @@ struct _Elm_Win } shot; Eina_Bool autodel : 1; Eina_Bool constrain : 1; + Eina_Bool moving : 1; int *autodel_clear, rot; int show_count; struct { @@ -75,6 +76,10 @@ static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win); static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source); static void _elm_win_focus_highlight_reconfigure(Elm_Win *win); +static void _elm_win_frame_callback_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _elm_win_frame_callback_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _elm_win_frame_callback_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); + static const char SIG_DELETE_REQUEST[] = "delete,request"; static const char SIG_FOCUS_OUT[] = "focus,out"; static const char SIG_FOCUS_IN[] = "focus,in"; @@ -445,7 +450,7 @@ _deferred_ecore_evas_free(void *data) } static void -_elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Elm_Win *win = data; @@ -1296,6 +1301,51 @@ the_end: win->focus_highlight.prev = win->focus_highlight.cur; } +static void +_elm_win_frame_callback_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Win *win; + Evas_Event_Mouse_Down *ev; + + if (!(win = data)) return; + ev = event_info; + if (ev->button == 1) + { + win->moving = EINA_TRUE; + /* FIXME: Change Mouse Pointer */ + } +} + +static void +_elm_win_frame_callback_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Win *win; + Evas_Event_Mouse_Move *ev; + + if (!(win = data)) return; + ev = event_info; + if (win->moving) + { + /* NB: 0, 0 are bogus values and not used */ + ecore_evas_move(win->ee, 0, 0); + } +} + +static void +_elm_win_frame_callback_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Win *win; + Evas_Event_Mouse_Up *ev; + + if (!(win = data)) return; + ev = event_info; + if (ev->button == 1) + { + win->moving = EINA_FALSE; + /* FIXME: Change Mouse Pointer */ + } +} + #ifdef ELM_DEBUG static void _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) @@ -1305,7 +1355,6 @@ _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, voi if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; - if ((strcmp(ev->keyname, "F12")) || (!evas_key_modifier_is_set(ev->modifiers, "Control"))) return; @@ -1555,6 +1604,19 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE); evas_object_move(win->frame_obj, 0, 0); evas_object_resize(win->frame_obj, 1, 1); + + evas_object_event_callback_add(win->frame_obj, + EVAS_CALLBACK_MOUSE_DOWN, + _elm_win_frame_callback_mouse_down, + win); + evas_object_event_callback_add(win->frame_obj, + EVAS_CALLBACK_MOUSE_MOVE, + _elm_win_frame_callback_mouse_move, + win); + evas_object_event_callback_add(win->frame_obj, + EVAS_CALLBACK_MOUSE_UP, + _elm_win_frame_callback_mouse_up, + win); } else if (!strncmp(_elm_config->engine, "shot:", 5)) {