[Xfce4-commits] [apps/xfdashboard] 01/03: Revert commit 2e676ddf96b378ad758fe2724c9830359529044f and add signal handler which also tracks if the stage window was closed to reconnect the signal handler for "window-opened" to find new stage window. This way the XfdashboardStage object should always know its window regardless if just hidden or destroyed and recreated.

noreply at xfce.org noreply at xfce.org
Fri May 12 08:38:11 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 370f1060c201acc4ccb33fc54939594a3e3d65ba
Author: Stephan Haller <nomad at froevel.de>
Date:   Fri May 12 07:15:16 2017 +0200

    Revert commit 2e676ddf96b378ad758fe2724c9830359529044f and add signal handler which also tracks if the stage window was closed to reconnect the signal handler for "window-opened" to find new stage window. This way the XfdashboardStage object should always know its window regardless if just hidden or destroyed and recreated.
---
 libxfdashboard/stage.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/libxfdashboard/stage.c b/libxfdashboard/stage.c
index 585cd7f..f0593ab 100644
--- a/libxfdashboard/stage.c
+++ b/libxfdashboard/stage.c
@@ -133,6 +133,12 @@ enum
 static guint XfdashboardStageSignals[SIGNAL_LAST]={ 0, };
 
 
+/* Forward declaration */
+static void _xfdashboard_stage_on_window_opened(XfdashboardStage *self,
+													XfdashboardWindowTrackerWindow *inWindow,
+													gpointer inUserData);
+
+
 /* IMPLEMENTATION: Private variables and methods */
 #define NOTIFICATION_TIMEOUT_XFCONF_PROP				"/min-notification-timeout"
 #define DEFAULT_NOTIFICATION_TIMEOUT					3000
@@ -618,6 +624,40 @@ static void _xfdashboard_stage_on_view_activated(XfdashboardStage *self, Xfdashb
 	}
 }
 
+/* A window was closed
+ * Check if stage window was closed then unset up window properties and reinstall
+ * signal handler to find new stage window.
+ */
+static void _xfdashboard_stage_on_window_closed(XfdashboardStage *self,
+												XfdashboardWindowTrackerWindow *inWindow,
+												gpointer inUserData)
+{
+	XfdashboardStagePrivate				*priv;
+
+	g_return_if_fail(XFDASHBOARD_IS_STAGE(self));
+	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW(inWindow));
+
+	priv=self->priv;
+
+	/* Check if window closed is this stage window */
+	if(priv->stageWindow!=inWindow) return;
+
+	/* Forget stage window as it was closed */
+	priv->stageWindow=NULL;
+
+	/* Disconnect this signal handler as this stage window was closed*/
+	XFDASHBOARD_DEBUG(self, ACTOR, "Stage window was closed. Removing signal handler");
+	g_signal_handlers_disconnect_by_func(priv->windowTracker, G_CALLBACK(_xfdashboard_stage_on_window_closed), self);
+
+	/* Instead reconnect signal handler to find new stage window */
+	XFDASHBOARD_DEBUG(self, ACTOR, "Reconnecting signal to find new stage window as this one as closed");
+	g_signal_connect_swapped(priv->windowTracker, "window-opened", G_CALLBACK(_xfdashboard_stage_on_window_opened), self);
+
+	/* Set focus */
+	_xfdashboard_stage_set_focus(self);
+}
+
+
 /* A window was created
  * Check for stage window and set up window properties
  */
@@ -641,10 +681,17 @@ static void _xfdashboard_stage_on_window_opened(XfdashboardStage *self,
 	priv->stageWindow=inWindow;
 	xfdashboard_window_tracker_window_show_stage(priv->stageWindow);
 
-	/* Disconnect signal handler as this is a one-time setup of stage window */
+	/* Disconnect this signal handler as this is a one-time setup of stage window */
 	XFDASHBOARD_DEBUG(self, ACTOR, "Stage window was opened and set up. Removing signal handler");
 	g_signal_handlers_disconnect_by_func(priv->windowTracker, G_CALLBACK(_xfdashboard_stage_on_window_opened), self);
 
+	/* Instead connect signal handler to get notified when this stage window was
+	 * destroyed as we need to forget this window and to reinstall this signal
+	 * handler again.
+	 */
+	XFDASHBOARD_DEBUG(self, ACTOR, "Connecting signal signal handler to get notified about destruction of stage window");
+	g_signal_connect_swapped(priv->windowTracker, "window-closed", G_CALLBACK(_xfdashboard_stage_on_window_closed), self);
+
 	/* Set focus */
 	_xfdashboard_stage_set_focus(self);
 }
@@ -1524,10 +1571,14 @@ static void _xfdashboard_stage_show(ClutterActor *inActor)
 		xfdashboard_viewpad_set_active_view(XFDASHBOARD_VIEWPAD(priv->viewpad), switchView);
 	}
 
+	/* Set stage to fullscreen as it may will be a newly created window */
+	clutter_stage_set_fullscreen(CLUTTER_STAGE(self), TRUE);
+
 	/* If we do not know the stage window connect signal to find it */
 	if(!priv->stageWindow)
 	{
 		/* Connect signals */
+		XFDASHBOARD_DEBUG(self, ACTOR, "Connecting signal to find stage window");
 		g_signal_connect_swapped(priv->windowTracker, "window-opened", G_CALLBACK(_xfdashboard_stage_on_window_opened), self);
 	}
 

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


More information about the Xfce4-commits mailing list