[Xfce4-commits] [apps/xfdashboard] 01/03: Allow and handle dragging window from XfdashboardLiveWorkspace to XfdashboardWindowsView

noreply at xfce.org noreply at xfce.org
Tue May 2 17:02:09 CEST 2017


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit 99bdeab12f1a082591ef4e2b757fffb8b2632942
Author: Stephan Haller <nomad at froevel.de>
Date:   Tue May 2 16:40:59 2017 +0200

    Allow and handle dragging window from XfdashboardLiveWorkspace to XfdashboardWindowsView
    
    This commit is also part of fixing issue GH #79
---
 libxfdashboard/windows-view.c | 61 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 56 insertions(+), 5 deletions(-)

diff --git a/libxfdashboard/windows-view.c b/libxfdashboard/windows-view.c
index b7ae993..43d4ec9 100644
--- a/libxfdashboard/windows-view.c
+++ b/libxfdashboard/windows-view.c
@@ -44,6 +44,7 @@
 #include <libxfdashboard/marshal.h>
 #include <libxfdashboard/enums.h>
 #include <libxfdashboard/stage-interface.h>
+#include <libxfdashboard/live-workspace.h>
 #include <libxfdashboard/compat.h>
 #include <libxfdashboard/debug.h>
 
@@ -489,19 +490,33 @@ static gboolean _xfdashboard_windows_view_on_drop_begin(XfdashboardWindowsView *
 	dragSource=xfdashboard_drag_action_get_source(inDragAction);
 	draggedActor=xfdashboard_drag_action_get_actor(inDragAction);
 
-	/* Check if we can handle dragged actor from given source */
+	/* We can handle dragged actor if it is an application button and its source
+	 * is quicklaunch.
+	 */
 	if(XFDASHBOARD_IS_QUICKLAUNCH(dragSource) &&
 		XFDASHBOARD_IS_APPLICATION_BUTTON(draggedActor))
 	{
 		canHandle=TRUE;
 	}
 
+	/* We can handle dragged actor if it is a live window and its source
+	 * is windows view.
+	 */
 	if(XFDASHBOARD_IS_WINDOWS_VIEW(dragSource) &&
 		XFDASHBOARD_IS_LIVE_WINDOW(draggedActor))
 	{
 		canHandle=TRUE;
 	}
 
+	/* We can handle dragged actor if it is a live window and its source
+	 * is a live workspace
+	 */
+	if(XFDASHBOARD_IS_LIVE_WORKSPACE(dragSource) &&
+		XFDASHBOARD_IS_LIVE_WINDOW_SIMPLE(draggedActor))
+	{
+		canHandle=TRUE;
+	}
+
 	/* Return TRUE if we can handle dragged actor in this drop target
 	 * otherwise FALSE
 	 */
@@ -548,7 +563,7 @@ static void _xfdashboard_windows_view_on_drop_drop(XfdashboardWindowsView *self,
 		XFDASHBOARD_IS_LIVE_WINDOW(draggedActor))
 	{
 		XfdashboardWindowsView			*sourceWindowsView;
-		XfdashboardLiveWindow			*liveWindow;
+		XfdashboardLiveWindow			*liveWindowActor;
 
 		/* Get source windows view */
 		sourceWindowsView=XFDASHBOARD_WINDOWS_VIEW(dragSource);
@@ -566,10 +581,46 @@ static void _xfdashboard_windows_view_on_drop_drop(XfdashboardWindowsView *self,
 		}
 
 		/* Get dragged window */
-		liveWindow=XFDASHBOARD_LIVE_WINDOW(draggedActor);
+		liveWindowActor=XFDASHBOARD_LIVE_WINDOW(draggedActor);
+
+		/* Move dragged window to monitor of this window view */
+		_xfdashboard_windows_view_move_live_to_view(self, liveWindowActor);
+
+		/* Drop action handled so return here */
+		return;
+	}
+
+	/* Handle drop of an window from a live workspace */
+	if(XFDASHBOARD_IS_LIVE_WORKSPACE(dragSource) &&
+		XFDASHBOARD_IS_LIVE_WINDOW_SIMPLE(draggedActor))
+	{
+		XfdashboardLiveWorkspace			*sourceLiveWorkspace;
+		XfdashboardWindowTrackerWorkspace*	sourceWorkspace;
+		XfdashboardLiveWindowSimple			*liveWindowActor;
+		XfdashboardWindowTrackerWindow		*window;
+
+		/* Get source live workspace and its workspace */
+		sourceLiveWorkspace=XFDASHBOARD_LIVE_WORKSPACE(dragSource);
+		sourceWorkspace=xfdashboard_live_workspace_get_workspace(sourceLiveWorkspace);
+
+		/* Do nothing if source and destination workspaces are the same as nothing
+		 * is to do in this case.
+		 */
+		if(xfdashboard_window_tracker_workspace_is_equal(sourceWorkspace, priv->workspace))
+		{
+			XFDASHBOARD_DEBUG(self, ACTOR,
+						"Will not handle drop of %s at %s because source and target workspaces are the same.",
+						G_OBJECT_TYPE_NAME(draggedActor),
+						G_OBJECT_TYPE_NAME(dragSource));
+			return;
+		}
+
+		/* Get dragged window */
+		liveWindowActor=XFDASHBOARD_LIVE_WINDOW_SIMPLE(draggedActor);
+		window=xfdashboard_live_window_simple_get_window(liveWindowActor);
 
-		/* Move window to monitor of this window view */
-		_xfdashboard_windows_view_move_live_to_view(self, liveWindow);
+		/* Move dragged window to workspace of this window view */
+		xfdashboard_window_tracker_window_move_to_workspace(window, priv->workspace);
 
 		/* Drop action handled so return here */
 		return;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list