[Xfce4-commits] <xfce4-wmdock-plugin:0.6.x> Some changes for rc startup and dockapp placement.
Andre Ellguth
noreply at xfce.org
Wed Oct 2 18:34:01 CEST 2013
Updating branch refs/heads/0.6.x
to f6da1dc354d06d901c97b82f56a27e3171c5fc18 (commit)
from b55aaf8bcf20cd68c0349023b40cd972794580d4 (commit)
commit f6da1dc354d06d901c97b82f56a27e3171c5fc18
Author: Andre Ellguth <andre at ellguth.com>
Date: Wed Oct 2 18:31:46 2013 +0200
Some changes for rc startup and dockapp placement.
panel-plugin/catchwindow.c | 12 +-----------
panel-plugin/dockapp.c | 22 +++++++++++++++++-----
panel-plugin/dockapp.h | 1 +
panel-plugin/rcfile.c | 19 ++++++++++++-------
4 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/panel-plugin/catchwindow.c b/panel-plugin/catchwindow.c
index a9e48ac..28559b2 100644
--- a/panel-plugin/catchwindow.c
+++ b/panel-plugin/catchwindow.c
@@ -105,7 +105,6 @@ void wmdock_window_open(WnckScreen *s, WnckWindow *w)
XWMHints *h = NULL;
XWindowAttributes attr;
DockappNode *dapp = NULL;
- GList *_dapps = NULL;
gchar *cmd = NULL;
gboolean rcDapp = FALSE;
@@ -231,16 +230,7 @@ void wmdock_window_open(WnckScreen *s, WnckWindow *w)
g_list_foreach(wmdock->dapps, (GFunc) wmdock_dockapp_tofront, NULL);
if( IS_PANELOFF(wmdock) ) {
- if(rcDapp == TRUE) {
- if(!wmdock_get_parent_dockapp(dapp)) {
- _dapps = g_list_find(wmdock->dapps, (gconstpointer) dapp);
-
- wmdock_set_autoposition_dockapp( dapp ,
- (DOCKAPP(g_list_first(wmdock->dapps)->data) != dapp && _dapps) ? DOCKAPP(((GList *) g_list_previous(_dapps))->data) : NULL);
- }
-
- wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
- }
+ wmdock_order_dockapps(wmdock_get_primary_anchor_dockapp());
/* Setup the event handler for the window. */
g_signal_connect(G_OBJECT(dapp->tile), "event-after", G_CALLBACK(wmdock_dockapp_event_after_handler), dapp);
diff --git a/panel-plugin/dockapp.c b/panel-plugin/dockapp.c
index 754e24e..61a8872 100644
--- a/panel-plugin/dockapp.c
+++ b/panel-plugin/dockapp.c
@@ -666,7 +666,8 @@ void wmdock_update_tile_background(DockappNode *dapp)
* @param dapp Child dockapp.
* @return DockAppNode Parent dockapp or null.
*/
-DockappNode *wmdock_get_parent_dockapp(DockappNode *dapp) {
+DockappNode *wmdock_get_parent_dockapp(DockappNode *dapp)
+{
gint i;
GList *dapps;
DockappNode *_dapp;
@@ -689,6 +690,20 @@ DockappNode *wmdock_get_parent_dockapp(DockappNode *dapp) {
/**
+ * Get the default glue position of the dockapps.
+ *
+ * @return Default glue postion.
+ */
+gint wmdock_get_default_gluepos()
+{
+ if(wmdock->anchorPos == ANCHOR_TL || wmdock->anchorPos == ANCHOR_TR)
+ return (GLUE_B);
+ else
+ return (GLUE_T);
+}
+
+
+/**
* This set the tile background image to the DockApp.
*
* @param dapp The DockApp to set.
@@ -833,10 +848,7 @@ void wmdock_set_autoposition_dockapp(DockappNode *dapp, DockappNode *prevDapp)
/* Align a new dockapp. */
if(prevDapp) {
/* If a parent dockapp already exists. */
- if(wmdock->anchorPos == ANCHOR_TL || wmdock->anchorPos == ANCHOR_TR)
- gluepos = GLUE_B;
- else
- gluepos = GLUE_T;
+ gluepos = wmdock_get_default_gluepos();
wmdock_dockapp_child_pos(prevDapp, gluepos, &x, &y);
prevDapp->glue[gluepos] = dapp;
diff --git a/panel-plugin/dockapp.h b/panel-plugin/dockapp.h
index ffae656..5ed850e 100644
--- a/panel-plugin/dockapp.h
+++ b/panel-plugin/dockapp.h
@@ -74,5 +74,6 @@ void wmdock_dockapp_motion_notify_handler(GtkWidget *, GdkEventMotion *, Dockapp
void wmdock_remove_anchor_dockapp(DockappNode *, DockappNode *);
void wmdock_order_dockapps(DockappNode *);
GtkWidget *wmdock_create_tile_dummy();
+gint wmdock_get_default_gluepos();
#endif /* __DOCKAPP_H__ */
diff --git a/panel-plugin/rcfile.c b/panel-plugin/rcfile.c
index 99caf87..71008fe 100644
--- a/panel-plugin/rcfile.c
+++ b/panel-plugin/rcfile.c
@@ -74,9 +74,9 @@ void wmdock_read_rc_file (XfcePanelPlugin *plugin)
g_usleep(5 * G_USEC_PER_SEC);
for (i = 0; i <= rcCmdcnt; i++) {
- debug("rcfile.c: config will start: %s\n", rcCmds[i]);
-
if(!rcCmds[i]) continue;
+ debug("rcfile.c: Setup `%s'\n", rcCmds[i]);
+
if(wmdock_startup_dockapp(rcCmds[i]) != TRUE) {
gtkDlg = gtk_message_dialog_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -90,7 +90,6 @@ void wmdock_read_rc_file (XfcePanelPlugin *plugin)
/* Create some dummy widget entries to locate the right position on
* window swallow up.
*/
-
dapp = g_new0(DockappNode, 1);
dapp->name = NULL;
dapp->cmd = rcCmds[i];
@@ -98,12 +97,18 @@ void wmdock_read_rc_file (XfcePanelPlugin *plugin)
dapp->s = GTK_SOCKET(gtk_socket_new());
dapp->tile = wmdock_create_tile_from_socket(dapp);
+ wmdock->dapps = g_list_append(wmdock->dapps, dapp);
+
if( ! IS_PANELOFF(wmdock) ) {
- gtk_box_pack_start(GTK_BOX(wmdock->box), GTK_WIDGET(dapp->tile),
- FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(wmdock->box), GTK_WIDGET(dapp->tile), FALSE, FALSE, 0);
+ } else {
+ /* If is possible, restore the old position of the dockapps in panel off mode. */
+ if(! wmdock_get_parent_dockapp(dapp) ) {
+ if(g_list_previous(g_list_last(wmdock->dapps))) {
+ DOCKAPP(((GList *) g_list_previous(g_list_last(wmdock->dapps)))->data)->glue[wmdock_get_default_gluepos()] = dapp;
+ }
+ }
}
-
- wmdock->dapps=g_list_append(wmdock->dapps, dapp);
}
}
}
More information about the Xfce4-commits
mailing list