[Xfce4-commits] [apps/xfdashboard] 01/01: Fix serveral signal signatures (closures, marshal, signal handlers/callbacks) for XfdashboardWindowTrackerWindow and its derived sub-classes (e.g. XfdashboardWindowTrackerWindowX11).

noreply at xfce.org noreply at xfce.org
Fri Jul 13 07:25:55 CEST 2018


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

n   o   m   a   d       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfdashboard.

commit 51715621ccb230669fe38d50ac03b732880508e1
Author: Stephan Haller <nomad at froevel.de>
Date:   Fri Jul 13 07:24:38 2018 +0200

    Fix serveral signal signatures (closures, marshal, signal handlers/callbacks) for XfdashboardWindowTrackerWindow and its derived sub-classes (e.g. XfdashboardWindowTrackerWindowX11).
    
    Another fix for issue GH #149
---
 libxfdashboard/live-window-simple.c            |  3 ++-
 libxfdashboard/live-window.c                   |  3 +--
 libxfdashboard/window-tracker-window.c         | 10 +++-----
 libxfdashboard/window-tracker-window.h         |  6 ++---
 libxfdashboard/x11/window-tracker-window-x11.c | 12 +++++++--
 libxfdashboard/x11/window-tracker-x11.c        | 34 +++++++++++++++++---------
 6 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/libxfdashboard/live-window-simple.c b/libxfdashboard/live-window-simple.c
index 36ab738..5846690 100644
--- a/libxfdashboard/live-window-simple.c
+++ b/libxfdashboard/live-window-simple.c
@@ -132,6 +132,7 @@ static void _xfdashboard_live_window_simple_on_geometry_changed(XfdashboardLiveW
 
 /* Window's state has changed */
 static void _xfdashboard_live_window_simple_on_state_changed(XfdashboardLiveWindowSimple *self,
+																XfdashboardWindowTrackerWindowState inOldState,
 																gpointer inUserData)
 {
 	XfdashboardLiveWindowSimplePrivate		*priv;
@@ -649,7 +650,7 @@ void xfdashboard_live_window_simple_set_window(XfdashboardLiveWindowSimple *self
 
 		/* Set up this actor and child actor by calling each signal handler now */
 		_xfdashboard_live_window_simple_on_geometry_changed(self, priv->window);
-		_xfdashboard_live_window_simple_on_state_changed(self, priv->window);
+		_xfdashboard_live_window_simple_on_state_changed(self, 0, priv->window);
 		_xfdashboard_live_window_simple_on_workspace_changed(self, priv->window);
 
 		/* Connect signal handlers */
diff --git a/libxfdashboard/live-window.c b/libxfdashboard/live-window.c
index cc049ab..6937017 100644
--- a/libxfdashboard/live-window.c
+++ b/libxfdashboard/live-window.c
@@ -235,8 +235,7 @@ static void _xfdashboard_live_window_on_subwindow_actor_workspace_changed(Xfdash
  * shown anymore and find associated actor to destroy it
  */
 static void _xfdashboard_live_window_on_subwindow_actor_state_changed(XfdashboardLiveWindow *self,
-																		gint inChangedMask,
-																		gint inNewState,
+																		XfdashboardWindowTrackerWindowState inOldState,
 																		gpointer inUserData)
 {
 	XfdashboardWindowTrackerWindow		*window;
diff --git a/libxfdashboard/window-tracker-window.c b/libxfdashboard/window-tracker-window.c
index 0be0343..9b66a5a 100644
--- a/libxfdashboard/window-tracker-window.c
+++ b/libxfdashboard/window-tracker-window.c
@@ -220,10 +220,9 @@ static void xfdashboard_window_tracker_window_default_init(XfdashboardWindowTrac
 							G_STRUCT_OFFSET(XfdashboardWindowTrackerWindowInterface, state_changed),
 							NULL,
 							NULL,
-							_xfdashboard_marshal_VOID__FLAGS_FLAGS,
+							g_cclosure_marshal_VOID__FLAGS,
 							G_TYPE_NONE,
-							2,
-							XFDASHBOARD_TYPE_WINDOW_TRACKER_WINDOW_STATE,
+							1,
 							XFDASHBOARD_TYPE_WINDOW_TRACKER_WINDOW_STATE);
 
 		XfdashboardWindowTrackerWindowSignals[SIGNAL_ACTIONS_CHANGED]=
@@ -233,10 +232,9 @@ static void xfdashboard_window_tracker_window_default_init(XfdashboardWindowTrac
 							G_STRUCT_OFFSET(XfdashboardWindowTrackerWindowInterface, actions_changed),
 							NULL,
 							NULL,
-							_xfdashboard_marshal_VOID__FLAGS_FLAGS,
+							g_cclosure_marshal_VOID__FLAGS,
 							G_TYPE_NONE,
-							2,
-							XFDASHBOARD_TYPE_WINDOW_TRACKER_WINDOW_ACTION,
+							1,
 							XFDASHBOARD_TYPE_WINDOW_TRACKER_WINDOW_ACTION);
 
 		XfdashboardWindowTrackerWindowSignals[SIGNAL_ICON_CHANGED]=
diff --git a/libxfdashboard/window-tracker-window.h b/libxfdashboard/window-tracker-window.h
index 4d6d289..cf4ac4b 100644
--- a/libxfdashboard/window-tracker-window.h
+++ b/libxfdashboard/window-tracker-window.h
@@ -132,11 +132,9 @@ struct _XfdashboardWindowTrackerWindowInterface
 	/* Signals */
 	void (*name_changed)(XfdashboardWindowTrackerWindow *self);
 	void (*state_changed)(XfdashboardWindowTrackerWindow *self,
-							XfdashboardWindowTrackerWindowState inChangedStates,
-							XfdashboardWindowTrackerWindowState inNewState);
+							XfdashboardWindowTrackerWindowState inOldStates);
 	void (*actions_changed)(XfdashboardWindowTrackerWindow *self,
-							XfdashboardWindowTrackerWindowAction inChangedActions,
-							XfdashboardWindowTrackerWindowAction inNewActions);
+							XfdashboardWindowTrackerWindowAction inOldActions);
 	void (*icon_changed)(XfdashboardWindowTrackerWindow *self);
 	void (*workspace_changed)(XfdashboardWindowTrackerWindow *self,
 								XfdashboardWindowTrackerWorkspace *inOldWorkspace);
diff --git a/libxfdashboard/x11/window-tracker-window-x11.c b/libxfdashboard/x11/window-tracker-window-x11.c
index d5ec7b0..ebbf28b 100644
--- a/libxfdashboard/x11/window-tracker-window-x11.c
+++ b/libxfdashboard/x11/window-tracker-window-x11.c
@@ -250,6 +250,7 @@ static void _xfdashboard_window_tracker_window_x11_on_wnck_state_changed(Xfdashb
 {
 	XfdashboardWindowTrackerWindowX11Private	*priv;
 	WnckWindow									*window;
+	XfdashboardWindowTrackerWindowState			oldStates;
 
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW_X11(self));
 	g_return_if_fail(WNCK_IS_WINDOW(inUserData));
@@ -264,11 +265,14 @@ static void _xfdashboard_window_tracker_window_x11_on_wnck_state_changed(Xfdashb
 		return;
 	}
 
+	/* Remember current states as old ones for signal emission before updating them */
+	oldStates=priv->state;
+
 	/* Update state before emitting signal */
 	_xfdashboard_window_tracker_window_x11_update_state(self);
 
 	/* Proxy signal */
-	g_signal_emit_by_name(self, "state-changed", inChangedStates, inNewState);
+	g_signal_emit_by_name(self, "state-changed", oldStates);
 }
 
 /* Proxy signal for mapped wnck window which changed actions */
@@ -279,6 +283,7 @@ static void _xfdashboard_window_tracker_window_x11_on_wnck_actions_changed(Xfdas
 {
 	XfdashboardWindowTrackerWindowX11Private	*priv;
 	WnckWindow									*window;
+	XfdashboardWindowTrackerWindowAction		oldActions;
 
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW_X11(self));
 	g_return_if_fail(WNCK_IS_WINDOW(inUserData));
@@ -293,11 +298,14 @@ static void _xfdashboard_window_tracker_window_x11_on_wnck_actions_changed(Xfdas
 		return;
 	}
 
+	/* Remember current actions as old ones for signal emission before updating them */
+	oldActions=priv->actions;
+
 	/* Update actions before emitting signal */
 	_xfdashboard_window_tracker_window_x11_update_actions(self);
 
 	/* Proxy signal */
-	g_signal_emit_by_name(self, "actions-changed", inChangedActions, inNewActions);
+	g_signal_emit_by_name(self, "actions-changed", oldActions);
 }
 
 /* Proxy signal for mapped wnck window which changed icon */
diff --git a/libxfdashboard/x11/window-tracker-x11.c b/libxfdashboard/x11/window-tracker-x11.c
index 51ca473..96cf907 100644
--- a/libxfdashboard/x11/window-tracker-x11.c
+++ b/libxfdashboard/x11/window-tracker-x11.c
@@ -428,43 +428,53 @@ static void _xfdashboard_window_tracker_x11_on_window_geometry_changed(Xfdashboa
 
 /* Action items of window has changed */
 static void _xfdashboard_window_tracker_x11_on_window_actions_changed(XfdashboardWindowTrackerX11 *self,
-																		XfdashboardWindowTrackerWindowAction inChangedMask,
-																		XfdashboardWindowTrackerWindowAction inNewValue,
+																		XfdashboardWindowTrackerWindowAction inOldActions,
 																		gpointer inUserData)
 {
-	XfdashboardWindowTrackerWindowX11	*window;
+	XfdashboardWindowTrackerWindowX11		*window;
+	XfdashboardWindowTrackerWindowAction	newActions;
+	XfdashboardWindowTrackerWindowAction	changedActions;
 
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER(self));
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW_X11(inUserData));
 
 	window=XFDASHBOARD_WINDOW_TRACKER_WINDOW_X11(inUserData);
 
-	/* Emit signal */
+	/* Debugging information */
+	newActions=xfdashboard_window_tracker_window_get_state(XFDASHBOARD_WINDOW_TRACKER_WINDOW(window));
+	changedActions=inOldActions ^ newActions;
 	XFDASHBOARD_DEBUG(self, WINDOWS,
-						"Window '%s' changed actions to %u with mask %u",
+						"Window '%s' changed actions from %u to %u with mask %u",
 						xfdashboard_window_tracker_window_get_name(XFDASHBOARD_WINDOW_TRACKER_WINDOW(window)),
-						inNewValue, inChangedMask);
+						inOldActions, newActions, changedActions);
+
+	/* Emit signal */
 	g_signal_emit_by_name(self, "window-actions-changed", window);
 }
 
 /* State of window has changed */
 static void _xfdashboard_window_tracker_x11_on_window_state_changed(XfdashboardWindowTrackerX11 *self,
-																	XfdashboardWindowTrackerWindowState inChangedMask,
-																	XfdashboardWindowTrackerWindowState inNewValue,
+																	XfdashboardWindowTrackerWindowState inOldState,
 																	gpointer inUserData)
 {
-	XfdashboardWindowTrackerWindowX11	*window;
+	XfdashboardWindowTrackerWindowX11		*window;
+	XfdashboardWindowTrackerWindowState		newState;
+	XfdashboardWindowTrackerWindowState		changedStates;
 
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER(self));
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW_X11(inUserData));
 
 	window=XFDASHBOARD_WINDOW_TRACKER_WINDOW_X11(inUserData);
 
-	/* Emit signal */
+	/* Debugging information */
+	newState=xfdashboard_window_tracker_window_get_state(XFDASHBOARD_WINDOW_TRACKER_WINDOW(window));
+	changedStates=inOldState ^ newState;
 	XFDASHBOARD_DEBUG(self, WINDOWS,
-						"Window '%s' changed state to %u with mask %u",
+						"Window '%s' changed state from %u to %u with mask %u",
 						xfdashboard_window_tracker_window_get_name(XFDASHBOARD_WINDOW_TRACKER_WINDOW(window)),
-						inNewValue, inChangedMask);
+						inOldState, newState, changedStates);
+
+	/* Emit signal */
 	g_signal_emit_by_name(self, "window-state-changed", window);
 }
 

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


More information about the Xfce4-commits mailing list