Elm: Fix ticket #1245. Mouse cursor does not change before window
authorChristopher Michael <cpmichael1@comcast.net>
Mon, 6 Aug 2012 12:05:53 +0000 (12:05 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Mon, 6 Aug 2012 12:05:53 +0000 (12:05 +0000)
resizing.

Previously, we only changed the mouse cursor when the border frame was
actually clicked. Now we can change it when the mouse moves over the
border/frame areas (like in X11). This adds a callback from the edc to
know when and where the mouse moves (with respect to the frame border
only). (IE: When the user moves the mouse over the bottom portion of
the border, the edc will let us know and we can change pointer
accordingly).

SVN revision: 74925

src/lib/elm_win.c

index bdfb70a..005afcb 100644 (file)
@@ -1,4 +1,5 @@
 #include <Elementary.h>
+#include <Elementary_Cursor.h>
 #include "elm_priv.h"
 
 static const char WIN_SMART_NAME[] = "elm_win";
@@ -1802,6 +1803,43 @@ _elm_win_frame_cb_move_start(void *data,
 }
 
 static void
+_elm_win_frame_cb_resize_show(void *data,
+                              Evas_Object *obj __UNUSED__,
+                              const char *sig __UNUSED__,
+                              const char *source)
+{
+   Elm_Win_Smart_Data *sd;
+
+   if (!(sd = data)) return;
+   if (sd->resizing) return;
+
+#ifdef HAVE_ELEMENTARY_WAYLAND
+   if (!strcmp(source, "elm.event.resize.t"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_TOP_SIDE);
+   else if (!strcmp(source, "elm.event.resize.b"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_BOTTOM_SIDE);
+   else if (!strcmp(source, "elm.event.resize.l"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_LEFT_SIDE);
+   else if (!strcmp(source, "elm.event.resize.r"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_RIGHT_SIDE);
+   else if (!strcmp(source, "elm.event.resize.tl"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, 
+                                          ELM_CURSOR_TOP_LEFT_CORNER);
+   else if (!strcmp(source, "elm.event.resize.tr"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, 
+                                          ELM_CURSOR_TOP_RIGHT_CORNER);
+   else if (!strcmp(source, "elm.event.resize.bl"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, 
+                                          ELM_CURSOR_BOTTOM_LEFT_CORNER);
+   else if (!strcmp(source, "elm.event.resize.br"))
+     ecore_wl_window_cursor_from_name_set(sd->wl.win, 
+                                          ELM_CURSOR_BOTTOM_RIGHT_CORNER);
+   else
+     ecore_wl_window_cursor_default_restore(sd->wl.win);
+#endif
+}
+
+static void
 _elm_win_frame_cb_resize_start(void *data,
                                Evas_Object *obj __UNUSED__,
                                const char *sig __UNUSED__,
@@ -1814,8 +1852,6 @@ _elm_win_frame_cb_resize_start(void *data,
 
    sd->resizing = EINA_TRUE;
 
-   /* FIXME: Change mouse pointer */
-
    if (!strcmp(source, "elm.event.resize.t"))
      sd->resize_location = 1;
    else if (!strcmp(source, "elm.event.resize.b"))
@@ -1896,6 +1932,9 @@ _elm_win_frame_add(Elm_Win_Smart_Data *sd,
      (sd->frame_obj, "elm,action,move,start", "elm",
      _elm_win_frame_cb_move_start, sd);
    edje_object_signal_callback_add
+     (sd->frame_obj, "elm,action,resize,show", "*",
+     _elm_win_frame_cb_resize_show, sd);
+   edje_object_signal_callback_add
      (sd->frame_obj, "elm,action,resize,start", "*",
      _elm_win_frame_cb_resize_start, sd);
    edje_object_signal_callback_add