e_dnd: Cancel drag when rotation changed 69/293669/1
authorJunseok Kim <juns.kim@samsung.com>
Wed, 24 May 2023 05:53:26 +0000 (14:53 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 2 Jun 2023 02:13:40 +0000 (11:13 +0900)
Change-Id: Ia8c8ad475f1b3a146e44b78e8f065458fc0dc389

src/bin/e_dnd.c

index c6a4317..07057b0 100644 (file)
@@ -10,6 +10,9 @@ static void           _e_drag_free(E_Drag *drag);
 
 static Eina_Bool      _e_dnd_cb_mouse_up(void *data, int type, void *event);
 static Eina_Bool      _e_dnd_cb_mouse_move(void *data, int type, void *event);
+#ifdef _F_ZONE_WINDOW_ROTATION_
+static Eina_Bool      _e_dnd_cb_zone_display_rotation_change_end(void *data, int type, void *event);
+#endif
 
 /* local subsystem globals */
 typedef struct _XDnd XDnd;
@@ -22,6 +25,7 @@ struct _XDnd
 };
 
 static Eina_List *_event_handlers = NULL;
+static Eina_List *_zone_event_handlers = NULL;
 static Eina_List *_drop_handlers = NULL;
 static Eina_List *_active_handlers = NULL;
 static Eina_Hash *_drop_win_hash = NULL;
@@ -132,6 +136,13 @@ e_dnd_init(void)
         E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_MOVE, _e_dnd_cb_mouse_move, NULL);
      }
 
+   if (!_zone_event_handlers)
+     {
+#if _F_ZONE_WINDOW_ROTATION_
+       E_LIST_HANDLER_APPEND(_zone_event_handlers, E_EVENT_ZONE_ROTATION_CHANGE_END, _e_dnd_cb_zone_display_rotation_change_end, NULL);
+#endif
+     }
+
    return 1;
 }
 
@@ -144,6 +155,7 @@ e_dnd_shutdown(void)
    E_FREE_LIST(_drop_handlers, e_drop_handler_del);
 
    E_FREE_LIST(_event_handlers, ecore_event_handler_del);
+   E_FREE_LIST(_zone_event_handlers, ecore_event_handler_del);
 
    eina_hash_free(_drop_win_hash);
 
@@ -640,3 +652,21 @@ _e_dnd_cb_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 
    return ECORE_CALLBACK_PASS_ON;
 }
+
+#ifdef _F_ZONE_WINDOW_ROTATION_
+static Eina_Bool
+_e_dnd_cb_zone_display_rotation_change_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
+{
+   E_Comp_Wl_Data_Source *source;
+
+   if (!_drag_current) return ECORE_CALLBACK_PASS_ON;
+   if (!e_comp_wl->drag_source) return ECORE_CALLBACK_PASS_ON;
+
+   source = e_comp_wl->drag_source;
+   source->accepted = EINA_FALSE;
+   _e_drag_end(-1, -1);
+   E_FREE(e_comp_wl->drag);
+
+   return ECORE_CALLBACK_PASS_ON;
+}
+#endif
\ No newline at end of file