[Xfce4-commits] <xfce4-wmdock-plugin:master> Free positioning of first dockapp now working. Fixed some bugs trigger panel on/off.

Andre Ellguth noreply at xfce.org
Mon Nov 4 13:36:38 CET 2013


Updating branch refs/heads/master
         to 492cf84ee4cbf44dc760d48ed4df999fc4e49a92 (commit)
       from 1dc25d2ff953e6869df442a27e0a0f347730c23d (commit)

commit 492cf84ee4cbf44dc760d48ed4df999fc4e49a92
Author: Andre Ellguth <andre at ellguth.com>
Date:   Thu Oct 17 23:00:48 2013 +0200

    Free positioning of first dockapp now working. Fixed some bugs trigger panel on/off.

 panel-plugin/dockapp.c |   45 +++++++++++++++++++++++++++---------
 panel-plugin/props.c   |   59 +++++++++++++++++++++++++-----------------------
 panel-plugin/rcfile.c  |   32 ++++++++++++++++++--------
 panel-plugin/rcfile.h  |   13 +++++++++++
 panel-plugin/wmdock.c  |   35 ++++++++++++++--------------
 panel-plugin/wmdock.h  |    2 ++
 6 files changed, 121 insertions(+), 65 deletions(-)

diff --git a/panel-plugin/dockapp.c b/panel-plugin/dockapp.c
index cd15145..c14ed46 100644
--- a/panel-plugin/dockapp.c
+++ b/panel-plugin/dockapp.c
@@ -41,6 +41,7 @@
 #include "debug.h"
 #include "dnd.h"
 #include "misc.h"
+#include "rcfile.h"
 #include "props.h"
 
 #define DEFAULT_XPANEL_NAME "xfce4-panel"
@@ -296,8 +297,12 @@ static void wmdock_dockapp_button_release_handler(GtkWidget *window, GdkEventBut
 		debug("dockapp.c: Replaceable dummy tile found.");
 		wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp() ? wmdock_get_primary_anchor_dockapp() : dapp);
 	} else {
+		if(dapp == wmdock_get_primary_anchor_dockapp())
+			gtk_window_get_position(GTK_WINDOW(dapp->tile), &wmdock->panelOffFpX, &wmdock->panelOffFpY);
 		wmdock_remove_anchors_tile_dummy();
 		wmdock_set_autoposition_dockapp(dapp, wmdock_get_parent_dockapp(dapp));
+		if(dapp == wmdock_get_primary_anchor_dockapp())
+			wmdock_order_dockapps(dapp);
 	}
 	if(dappDummy) {
 		gtk_widget_hide(dappDummy->tile);
@@ -318,7 +323,7 @@ static void wmdock_dockapp_button_release_handler(GtkWidget *window, GdkEventBut
  */
 static void wmdock_dockapp_motion_notify_handler(GtkWidget *window, GdkEventMotion *ev, DockappNode *dapp)
 {
-	gint gluepos, x, y, posx, posy;
+	gint gluepos, x, y, posx, posy, movex, movey;
 	DockappNode *dappSnap = NULL;
 	GdkModifierType m;
 
@@ -332,7 +337,20 @@ static void wmdock_dockapp_motion_notify_handler(GtkWidget *window, GdkEventMoti
 		gtk_window_get_position(GTK_WINDOW(dapp->tile), &posx, &posy);
 		debug("dockapp.c: Mouse x: %d,  Mouse y: %d,  Dapp x: %d, Dapp y: %d,  Msx: %d,  Msy: %d",
 				x, y, posx, posy, motionstartx, motionstarty);
-		gtk_window_move(GTK_WINDOW(dapp->tile), posx - (motionstartx - x), posy - (motionstarty - y));
+
+		movex = posx - (motionstartx - x);
+		movey = posy - (motionstarty - y);
+		if(wmdock->propPanelOffFreePositioning == TRUE && dapp == wmdock_get_primary_anchor_dockapp()) {
+			if (movex <= 0)
+				movex = 0;
+			if (movex >= gdk_screen_get_width(get_current_gdkscreen()) - DEFAULT_DOCKAPP_WIDTH)
+				movex = gdk_screen_get_width(get_current_gdkscreen()) - DEFAULT_DOCKAPP_WIDTH;
+			if (movey <= 0)
+				movey = 0;
+			if (movey >= gdk_screen_get_height(get_current_gdkscreen()) - DEFAULT_DOCKAPP_HEIGHT)
+				movey = gdk_screen_get_height(get_current_gdkscreen()) - DEFAULT_DOCKAPP_HEIGHT;
+		}
+		gtk_window_move(GTK_WINDOW(dapp->tile), movex, movey);
 	}
 
 	if(dappOnMotion == dapp) {
@@ -854,6 +872,10 @@ GtkWidget *wmdock_create_tile_from_socket(DockappNode *dapp)
 	gtk_widget_set_size_request(GTK_WIDGET(dapp->bg), DEFAULT_DOCKAPP_WIDTH, DEFAULT_DOCKAPP_HEIGHT);
 	gtk_container_add(GTK_CONTAINER(_evbox), GTK_WIDGET(dapp->bg));
 
+	/* Set the background style of the tile window like the XFCE panel. */
+	gtk_widget_set_style(GTK_WIDGET(dapp->evbox), gtk_widget_get_style(GTK_WIDGET(wmdock->plugin)));
+	gtk_widget_set_style(GTK_WIDGET(_evbox), gtk_widget_get_style(GTK_WIDGET(wmdock->plugin)));
+
 	if( IS_PANELOFF(wmdock) ) {
 		/* If propDispPanelOff is true create a separate window with the
 		 * Dockapp in it. It's emulates WindowMaker much more.
@@ -879,9 +901,6 @@ GtkWidget *wmdock_create_tile_from_socket(DockappNode *dapp)
 		/* Hide window from the taskbar and the pager. */
 		gtk_window_set_skip_taskbar_hint(GTK_WINDOW(tile), TRUE);
 		gtk_window_set_skip_pager_hint(GTK_WINDOW(tile), TRUE);
-		/* Set the background style of the tile window like the XFCE panel. */
-		gtk_widget_set_style(GTK_WIDGET(dapp->evbox), gtk_widget_get_style(GTK_WIDGET(wmdock->plugin)));
-		gtk_widget_set_style(GTK_WIDGET(_evbox), gtk_widget_get_style(GTK_WIDGET(wmdock->plugin)));
 
 		gtk_container_add(GTK_CONTAINER(tile), _fixed);
 
@@ -913,9 +932,7 @@ void wmdock_set_autoposition_dockapp(DockappNode *dapp, DockappNode *prevDapp)
 	/* Setup the position of the first dockapp. */
 	panelx = panely = plugx = plugy = x = y = 0;
 
-	gtk_window_get_position(
-			GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (wmdock->plugin))),
-			&panelx, &panely);
+	gtk_window_get_position(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (wmdock->plugin))), &panelx, &panely);
 	gdk_window_get_position (GDK_WINDOW (GTK_WIDGET (wmdock->plugin)->window), &plugx, &plugy);
 
 	for(i = 0; prevDapp && i < GLUE_MAX; i++) {
@@ -1019,6 +1036,14 @@ void wmdock_set_autoposition_dockapp(DockappNode *dapp, DockappNode *prevDapp)
 				x = y = 0;
 				break;
 			}
+
+			if(wmdock->propPanelOffFreePositioning == TRUE) {
+				/* If panelOffFpX, panelOffFpy uninitialized (G_MININT) set the determined value,
+				 * otherwise set the stored value to x and y.
+				 */
+				x = wmdock->panelOffFpX == RCDEFAULT_PANELOFFFPX ? x : wmdock->panelOffFpX;
+				y = wmdock->panelOffFpY == RCDEFAULT_PANELOFFFPY ? y : wmdock->panelOffFpY;
+			}
 		} /* else */
 	}
 
@@ -1043,9 +1068,7 @@ void wmdock_order_dockapps(DockappNode *dapp)
 		return;
 
 	for(i = 0; i < GLUE_MAX; i++) {
-		if(wmdock->propPanelOffFreePositioning == FALSE ||
-				(wmdock->propPanelOffFreePositioning == TRUE && dapp != wmdock_get_primary_anchor_dockapp()))
-			wmdock_set_autoposition_dockapp(dapp, wmdock_get_parent_dockapp(dapp));
+		wmdock_set_autoposition_dockapp(dapp, wmdock_get_parent_dockapp(dapp));
 
 		debug("dockapp.c: Order dockapp %s", dapp->name);
 		/* Recurse calling wmdock_order_dockapps, to walk the hole tree. */
diff --git a/panel-plugin/props.c b/panel-plugin/props.c
index e4ae223..a770a40 100644
--- a/panel-plugin/props.c
+++ b/panel-plugin/props.c
@@ -59,6 +59,20 @@ static struct {
 static GtkWidget *btnProperties = NULL;
 
 
+static void wmdock_set_prop_paneloff(gboolean enabled)
+{
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBL), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBR), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTL), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTR), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffKeepAbove), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffFreePositioning), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffIgnoreOffset), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffPlacement), enabled);
+	gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffHint), enabled);
+}
+
+
 static void wmdock_properties_fillcmbx(DockappNode *dapp, GtkWidget *gtkComboBox)
 {
 
@@ -115,6 +129,14 @@ static void wmdock_properties_chkpaneloffkeepabove(GtkToggleButton *gtkChkPanelO
 }
 
 
+static void wmdock_properties_chkpanelofffreepositioning(GtkToggleButton *gtkChkPanelOffFreePositioning, gpointer user_data)
+{
+	wmdock->propPanelOffFreePositioning = gtk_toggle_button_get_active(gtkChkPanelOffFreePositioning);
+	wmdock->panelOffFpY = wmdock->panelOffFpX = G_MININT;
+	wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
+}
+
+
 static void wmdock_properties_radiopaneloff(GtkRadioButton *gtkRadioPanelOff, gpointer user_data)
 {
 	gint _anchorPos = wmdock->anchorPos;
@@ -128,6 +150,7 @@ static void wmdock_properties_radiopaneloff(GtkRadioButton *gtkRadioPanelOff, gp
 	else if(gtkRadioPanelOff == GTK_RADIO_BUTTON(prop.radioPanelOffBR))
 		_anchorPos = ANCHOR_BR;
 
+	wmdock->panelOffFpX = wmdock->panelOffFpY = G_MININT;
 	wmdock_set_new_anchorpos(_anchorPos);
 	wmdock->anchorPos = _anchorPos;
 	wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
@@ -138,25 +161,9 @@ static void wmdock_properties_chkpaneloff(GtkToggleButton *gtkChkPanelOff, gpoin
 {
 	if((rcPanelOff = gtk_toggle_button_get_active(gtkChkPanelOff)) == TRUE) {
 		wmdock->anchorPos = get_default_anchor_postion();
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBL), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBR), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTL), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTR), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffKeepAbove), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffFreePositioning), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffIgnoreOffset), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffPlacement), TRUE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffHint), TRUE);
+		wmdock_set_prop_paneloff(TRUE);
 	} else {
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBL), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBR), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTL), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTR), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffKeepAbove), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffFreePositioning), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffIgnoreOffset), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffPlacement), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffHint), FALSE);
+		wmdock_set_prop_paneloff(FALSE);
 	}
 
 	if(g_list_length(wmdock->dapps)) {
@@ -510,6 +517,7 @@ void wmdock_properties_dialog(XfcePanelPlugin *plugin)
 	gtk_toggle_button_set_active((GtkToggleButton *) prop.chkPanelOff, rcPanelOff);
 	gtk_toggle_button_set_active((GtkToggleButton *) prop.chkPanelOffIgnoreOffset, wmdock->propPanelOffIgnoreOffset);
 	gtk_toggle_button_set_active((GtkToggleButton *) prop.chkPanelOffKeepAbove, wmdock->propPanelOffKeepAbove);
+	gtk_toggle_button_set_active((GtkToggleButton *) prop.chkPanelOffFreePositioning, wmdock->propPanelOffFreePositioning);
 
 	gtk_container_add(GTK_CONTAINER(prop.frmGeneral), prop.vboxGeneral);
 	gtk_container_add(GTK_CONTAINER(prop.frmDetect), prop.vboxDetect);
@@ -560,17 +568,11 @@ void wmdock_properties_dialog(XfcePanelPlugin *plugin)
 		break;
 	}
 
-	if ( ! IS_PANELOFF(wmdock) ) {
+	if ( rcPanelOff == FALSE ) {
 		/* Disable advanced panel options is the panel used. */
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBL), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBR), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTL), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffTR), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffKeepAbove), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffFreePositioning), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.chkPanelOffIgnoreOffset), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffPlacement), FALSE);
-		gtk_widget_set_sensitive(GTK_WIDGET(prop.lblPanelOffHint), FALSE);
+		wmdock_set_prop_paneloff(FALSE);
+	} else {
+		wmdock_set_prop_paneloff(TRUE);
 	}
 
 	/* Fill the dockapp chooser with entries. */
@@ -585,6 +587,7 @@ void wmdock_properties_dialog(XfcePanelPlugin *plugin)
 	g_signal_connect(G_OBJECT(prop.chkPanelOff), "toggled", G_CALLBACK(wmdock_properties_chkpaneloff), NULL);
 	g_signal_connect(G_OBJECT(prop.chkPanelOffIgnoreOffset), "toggled", G_CALLBACK(wmdock_properties_chkpaneloffignoreoffset), NULL);
 	g_signal_connect(G_OBJECT(prop.chkPanelOffKeepAbove), "toggled", G_CALLBACK(wmdock_properties_chkpaneloffkeepabove), NULL);
+	g_signal_connect(G_OBJECT(prop.chkPanelOffFreePositioning), "toggled", G_CALLBACK(wmdock_properties_chkpanelofffreepositioning), NULL);
 	g_signal_connect(G_OBJECT(prop.radioPanelOffTL), "toggled", G_CALLBACK(wmdock_properties_radiopaneloff), NULL);
 	g_signal_connect(G_OBJECT(prop.radioPanelOffTR), "toggled", G_CALLBACK(wmdock_properties_radiopaneloff), NULL);
 	g_signal_connect(G_OBJECT(prop.radioPanelOffBL), "toggled", G_CALLBACK(wmdock_properties_radiopaneloff), NULL);
diff --git a/panel-plugin/rcfile.c b/panel-plugin/rcfile.c
index aa3ae63..1515777 100644
--- a/panel-plugin/rcfile.c
+++ b/panel-plugin/rcfile.c
@@ -64,18 +64,19 @@ void wmdock_read_rc_file (XfcePanelPlugin *plugin)
 		return;
 
 	rcCmds                     = xfce_rc_read_list_entry(rc, RCKEY_CMDLIST, RC_LIST_DELIMITER);
-	wmdock->propDispTile       = xfce_rc_read_bool_entry (rc, RCKEY_DISPTILE, TRUE);
-	wmdock->propDispPropButton = xfce_rc_read_bool_entry (rc, RCKEY_DISPPROPBTN, FALSE);
-	wmdock->propDispAddOnlyWM  = xfce_rc_read_bool_entry (rc, RCKEY_DISPADDONLYWM, TRUE);
+	wmdock->propDispTile       = xfce_rc_read_bool_entry (rc, RCKEY_DISPTILE, RCDEFAULT_DISPTILE);
+	wmdock->propDispPropButton = xfce_rc_read_bool_entry (rc, RCKEY_DISPPROPBTN, RCDEFAULT_DISPPROPBTN);
+	wmdock->propDispAddOnlyWM  = xfce_rc_read_bool_entry (rc, RCKEY_DISPADDONLYWM, RCDEFAULT_DISPADDONLYWM);
 	if(wmdock->filterList) g_free(wmdock->filterList);
 	wmdock->filterList         = g_strdup(xfce_rc_read_entry (rc, RCKEY_DAFILTER, DOCKAPP_FILTER_PATTERN));
-	/* TODO: Set panel off to FALSE. */
-	rcPanelOff                 = wmdock->propPanelOff = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFF, TRUE);
-	wmdock->propPanelOffIgnoreOffset = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFFIGNOREOFFSET, FALSE);
-	wmdock->propPanelOffKeepAbove    = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFFKEEPABOVE, FALSE);
-	wmdock->propPanelOffFreePositioning = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFFFREEPOSITIONING, FALSE);
+	rcPanelOff                 = wmdock->propPanelOff = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFF, RCDEFAULT_PANELOFF);
+	wmdock->propPanelOffIgnoreOffset = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFFIGNOREOFFSET, RCDEFAULT_PANELOFFIGNOREOFFSET);
+	wmdock->propPanelOffKeepAbove    = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFFKEEPABOVE, RCDEFAULT_PANELOFFKEEPABOVE);
+	wmdock->propPanelOffFreePositioning = xfce_rc_read_bool_entry (rc, RCKEY_PANELOFFFREEPOSITIONING, RCDEFAULT_PANELOFFFREEPOSITIONING);
+	wmdock->panelOffFpX        = xfce_rc_read_int_entry(rc, RCKEY_PANELOFFFPX, RCDEFAULT_PANELOFFFPX);
+	wmdock->panelOffFpY        = xfce_rc_read_int_entry(rc, RCKEY_PANELOFFFPY, RCDEFAULT_PANELOFFFPY);
 	glueList                   = IS_PANELOFF(wmdock) ? xfce_rc_read_list_entry(rc, RCKEY_GLUELIST, RC_LIST_DELIMITER) : NULL;
-	wmdock->anchorPos          = xfce_rc_read_int_entry(rc, RCKEY_ANCHORPOS, -1);
+	wmdock->anchorPos          = xfce_rc_read_int_entry(rc, RCKEY_ANCHORPOS, RCDEFAULT_ANCHORPOS);
 	xfce_rc_close (rc);
 
 	if(G_LIKELY(rcCmds != NULL)) {
@@ -209,9 +210,22 @@ void wmdock_write_rc_file (XfcePanelPlugin *plugin)
 		xfce_rc_write_bool_entry (rc, RCKEY_DISPPROPBTN, wmdock->propDispPropButton);
 		xfce_rc_write_bool_entry (rc, RCKEY_DISPADDONLYWM, wmdock->propDispAddOnlyWM);
 		xfce_rc_write_bool_entry (rc, RCKEY_PANELOFF, rcPanelOff);
+		if(rcPanelOff == FALSE) {
+			/* Reset the options to default. */
+			wmdock->propPanelOffFreePositioning = RCDEFAULT_PANELOFFFREEPOSITIONING;
+			wmdock->propPanelOffIgnoreOffset = RCDEFAULT_PANELOFFIGNOREOFFSET;
+			wmdock->propPanelOffKeepAbove = RCDEFAULT_PANELOFFKEEPABOVE;
+		}
 		xfce_rc_write_bool_entry (rc, RCKEY_PANELOFFIGNOREOFFSET, wmdock->propPanelOffIgnoreOffset);
 		xfce_rc_write_bool_entry (rc, RCKEY_PANELOFFKEEPABOVE, wmdock->propPanelOffKeepAbove);
 		xfce_rc_write_bool_entry (rc, RCKEY_PANELOFFFREEPOSITIONING, wmdock->propPanelOffFreePositioning);
+		if(wmdock->propPanelOffFreePositioning == TRUE) {
+			xfce_rc_write_int_entry (rc, RCKEY_PANELOFFFPX, wmdock->panelOffFpX);
+			xfce_rc_write_int_entry (rc, RCKEY_PANELOFFFPY, wmdock->panelOffFpY);
+		} else {
+			xfce_rc_delete_entry(rc, RCKEY_PANELOFFFPX, TRUE);
+			xfce_rc_delete_entry(rc, RCKEY_PANELOFFFPY, TRUE);
+		}
 		xfce_rc_write_int_entry (rc, RCKEY_ANCHORPOS, wmdock->anchorPos);
 		xfce_rc_write_entry(rc, RCKEY_DAFILTER, wmdock->filterList);
 	}
diff --git a/panel-plugin/rcfile.h b/panel-plugin/rcfile.h
index d68174b..c1c26cc 100644
--- a/panel-plugin/rcfile.h
+++ b/panel-plugin/rcfile.h
@@ -32,6 +32,8 @@
 #define RCKEY_PANELOFFIGNOREOFFSET     (const gchar *) "paneloffignoreoffset"
 #define RCKEY_PANELOFFKEEPABOVE        (const gchar *) "paneloffkeepabove"
 #define RCKEY_PANELOFFFREEPOSITIONING  (const gchar *) "panelofffreepositioning"
+#define RCKEY_PANELOFFFPX              (const gchar *) "panelofffpx"
+#define RCKEY_PANELOFFFPY              (const gchar *) "panelofffpy"
 #define RCKEY_DAFILTER                 (const gchar *) "dafilter"
 #define RCKEY_ANCHORPOS                (const gchar *) "anchorpos"
 #define RCKEY_GLUELIST                 (const gchar *) "glues"
@@ -39,6 +41,17 @@
 #define RC_LIST_DELIMITER   (const gchar *) ";"
 #define RC_GLUE_DELIMITER   (const gchar *) ","
 
+#define RCDEFAULT_DISPTILE                (gboolean) TRUE
+#define RCDEFAULT_DISPPROPBTN             (gboolean) FALSE
+#define RCDEFAULT_DISPADDONLYWM           (gboolean) TRUE
+#define RCDEFAULT_PANELOFF                (gboolean) FALSE
+#define RCDEFAULT_PANELOFFIGNOREOFFSET    (gboolean) FALSE
+#define RCDEFAULT_PANELOFFKEEPABOVE       (gboolean) FALSE
+#define RCDEFAULT_PANELOFFFREEPOSITIONING (gboolean) FALSE
+#define RCDEFAULT_PANELOFFFPX             (gint) G_MININT
+#define RCDEFAULT_PANELOFFFPY             (gint) G_MININT
+#define RCDEFAULT_ANCHORPOS               (gint) -1
+
 /* Prototypes */
 void wmdock_read_rc_file (XfcePanelPlugin *);
 void wmdock_write_rc_file (XfcePanelPlugin *);
diff --git a/panel-plugin/wmdock.c b/panel-plugin/wmdock.c
index 3fefefa..b2b729c 100644
--- a/panel-plugin/wmdock.c
+++ b/panel-plugin/wmdock.c
@@ -67,21 +67,21 @@ static void wmdock_orientation_changed (XfcePanelPlugin *plugin, GtkOrientation
 	gtk_widget_show(GTK_WIDGET(wmdock->panelBox));
 	gtk_widget_show(GTK_WIDGET(wmdock->box));
 
-	if( IS_PANELOFF(wmdock) )
+	if( IS_PANELOFF(wmdock) && wmdock->propPanelOffFreePositioning == FALSE )
 		wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
 }
 
 
 static void wmdock_resolution_changed (GdkScreen *screen, gpointer data)
 {
-	if( IS_PANELOFF(wmdock) )
+	if( IS_PANELOFF(wmdock) && wmdock->propPanelOffFreePositioning == FALSE )
 		wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
 }
 
 
 static void wmdock_monitors_changed (GdkScreen *screen, gpointer data)
 {
-	if( IS_PANELOFF(wmdock) )
+	if( IS_PANELOFF(wmdock) && wmdock->propPanelOffFreePositioning == FALSE )
 		wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
 }
 
@@ -97,7 +97,7 @@ static gboolean wmdock_size_changed (XfcePanelPlugin *plugin, int size)
 
 	if(wmdockIcon)
 		wmdock_panel_draw_wmdock_icon(TRUE);
-	if( IS_PANELOFF(wmdock) )
+	if( IS_PANELOFF(wmdock) && wmdock->propPanelOffFreePositioning == FALSE )
 		wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
 
 	return TRUE;
@@ -127,19 +127,20 @@ static void wmdock_free_data(XfcePanelPlugin *plugin)
 
 static WmdockPlugin *wmdock_plugin_new (XfcePanelPlugin* plugin)
 {
-	wmdock                     = g_new0(WmdockPlugin, 1);
-	wmdock->plugin             = plugin;
-	wmdock->dapps              = NULL;
-	wmdock->propDispTile       = TRUE;
-	wmdock->propDispPropButton = FALSE;
-	wmdock->propDispAddOnlyWM  = TRUE;
-	/* TODO: Set panel off to FALSE. */
-	wmdock->propPanelOff       = TRUE;
-	wmdock->propPanelOffIgnoreOffset = FALSE;
-	wmdock->propPanelOffKeepAbove    = FALSE;
-	wmdock->propPanelOffFreePositioning = FALSE;
-	wmdock->filterList         = g_strdup(DOCKAPP_FILTER_PATTERN);
-	wmdock->anchorPos          = get_default_anchor_postion();
+	wmdock                              = g_new0(WmdockPlugin, 1);
+	wmdock->plugin                      = plugin;
+	wmdock->dapps                       = NULL;
+	wmdock->propDispTile                = RCDEFAULT_DISPTILE;
+	wmdock->propDispPropButton          = RCDEFAULT_DISPPROPBTN;
+	wmdock->propDispAddOnlyWM           = RCDEFAULT_DISPADDONLYWM;
+	wmdock->propPanelOff                = RCDEFAULT_PANELOFF;
+	wmdock->propPanelOffIgnoreOffset    = RCDEFAULT_PANELOFFIGNOREOFFSET;
+	wmdock->propPanelOffKeepAbove       = RCDEFAULT_PANELOFFKEEPABOVE;
+	wmdock->propPanelOffFreePositioning = RCDEFAULT_PANELOFFKEEPABOVE;
+	wmdock->panelOffFpX                 = RCDEFAULT_PANELOFFFPX;
+	wmdock->panelOffFpY                 = RCDEFAULT_PANELOFFFPY;
+	wmdock->filterList                  = g_strdup(DOCKAPP_FILTER_PATTERN);
+	wmdock->anchorPos                   = get_default_anchor_postion();
 
 	wmdock->eventBox = gtk_event_box_new ();
 	gtk_widget_show(GTK_WIDGET(wmdock->eventBox));
diff --git a/panel-plugin/wmdock.h b/panel-plugin/wmdock.h
index a3ad67a..0475a9e 100644
--- a/panel-plugin/wmdock.h
+++ b/panel-plugin/wmdock.h
@@ -52,6 +52,8 @@ typedef struct {
  gboolean            propPanelOffIgnoreOffset;
  gboolean            propPanelOffKeepAbove;
  gboolean            propPanelOffFreePositioning;
+ gint                panelOffFpX;
+ gint                panelOffFpY;
  AnchorPostion       anchorPos;
  gchar               *filterList;
 


More information about the Xfce4-commits mailing list