[Xfce4-commits] <xfce4-wmdock-plugin:0.6.x> Fixed some bugs at dockapp restore.

Andre Ellguth noreply at xfce.org
Wed Oct 9 23:58:01 CEST 2013


Updating branch refs/heads/0.6.x
         to 609eb8096e79a5d8c13b2377585a5a77d852c058 (commit)
       from 79f73db43ddd64ac4224286ef9abc53f526dd898 (commit)

commit 609eb8096e79a5d8c13b2377585a5a77d852c058
Author: Andre Ellguth <andre at ellguth.com>
Date:   Wed Oct 9 23:55:58 2013 +0200

    Fixed some bugs at dockapp restore.

 panel-plugin/dockapp.c |    8 ++++----
 panel-plugin/rcfile.c  |   20 ++++++++++++--------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/panel-plugin/dockapp.c b/panel-plugin/dockapp.c
index fc2535a..e6f4aaa 100644
--- a/panel-plugin/dockapp.c
+++ b/panel-plugin/dockapp.c
@@ -120,19 +120,19 @@ static DockappNode *wmdock_get_snapable_dockapp(DockappNode *dapp, gint *gluepos
 	/* Remove not possible snap positions for the dragging dockapp. */
 	case ANCHOR_TR:
 		possible^= (GLUE_T | GLUE_L);
-		possible^= prim == TRUE ? (GLUE_T | GLUE_L | GLUE_R) : 0;
+		possible^= prim == TRUE ? GLUE_R : 0;
 		break;
 	case ANCHOR_BR:
 		possible^= (GLUE_B | GLUE_R);
-		possible^= prim == TRUE ? (GLUE_B | GLUE_L | GLUE_R): 0;
+		possible^= prim == TRUE ? GLUE_L: 0;
 		break;
 	case ANCHOR_TL:
 		possible^= (GLUE_T | GLUE_R);
-		possible^= prim == TRUE ? (GLUE_T | GLUE_L | GLUE_R) : 0;
+		possible^= prim == TRUE ? GLUE_L : 0;
 		break;
 	case ANCHOR_BL:
 		possible^= (GLUE_B | GLUE_L);
-		possible^= prim == TRUE ? (GLUE_B | GLUE_L | GLUE_R) : 0;
+		possible^= prim == TRUE ? GLUE_R : 0;
 		break;
 	}
 
diff --git a/panel-plugin/rcfile.c b/panel-plugin/rcfile.c
index 771cb51..0a24da2 100644
--- a/panel-plugin/rcfile.c
+++ b/panel-plugin/rcfile.c
@@ -55,7 +55,7 @@ void wmdock_read_rc_file (XfcePanelPlugin *plugin)
 	DockappNode *dapp = NULL;
 	DockappNode **launched = NULL;
 	gchar     **glueList = NULL;
-	gchar     **tokens = NULL;
+	gchar     **glueInfo = NULL;
 
 	if (!(file = xfce_panel_plugin_lookup_rc_file (plugin))) return;
 
@@ -122,25 +122,29 @@ void wmdock_read_rc_file (XfcePanelPlugin *plugin)
 			}
 		}
 
-		if( IS_PANELOFF(wmdock ) && g_strv_length(rcCmds) == g_strv_length(glueList) ) {
+		if( IS_PANELOFF( wmdock ) && g_strv_length(rcCmds) == g_strv_length(glueList) ) {
 			for (i = 0; glueList[i]; i++) {
-				if(!launched[i] || glueList[i][0] == '\0' || !(tokens = g_strsplit(glueList[i], ",", 0)))
+				if(!launched[i] || glueList[i][0] == '\0' || !(glueInfo = g_strsplit(glueList[i], ",", 0)))
 					continue;
 
-				for (j = 0; tokens[j]; j++) {
-					n = g_ascii_strtoll(tokens[j], &glueName, 10);
-					if(n > G_MAXINT || n < 0 || n > g_strv_length(rcCmds)-1 || glueName == tokens[j])
+				for (j = 0; glueInfo[j]; j++) {
+					n = g_ascii_strtoll(glueInfo[j], &glueName, 10);
+					if(n > G_MAXINT || n < 0 || n > g_strv_length(rcCmds)-1 || glueName == glueInfo[j] || glueName[0] != ':')
 						continue;
-					if((gluePos = wmdock_get_glue_position(glueName) == -1))
+					if((gluePos = wmdock_get_glue_position(&glueName[1])) == -1)
 						continue;
+					if(j == 0) /* Cleanup the default anchors. */
+						memset(launched[i]->glue, 0, sizeof(DockappNode *) * GLUE_MAX);
 
 					launched[i]->glue[gluePos] = launched[(gint) n];
+					debug("rcfile.c: Restored panel off position. (`%s', %s = %d)", launched[i]->cmd, &glueName[1], gluePos);
 				}
-				g_strfreev(tokens);
+				g_strfreev(glueInfo);
 			}
 
 			g_strfreev(glueList);
 		}
+
 		g_free(launched);
 	} /* rcCmds != NULL */
 }


More information about the Xfce4-commits mailing list