[Xfce4-commits] <xfce4-wmdock-plugin:master> Fix some draw glitches in panel mode (I hope).

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


Updating branch refs/heads/master
         to c1a214c7e557370e87bb3164d43748155793d392 (commit)
       from d4d5da8306e3f12ee9bb80449291971fb6017272 (commit)

commit c1a214c7e557370e87bb3164d43748155793d392
Author: Andre Ellguth <andre at ellguth.com>
Date:   Tue Oct 15 15:01:40 2013 +0200

    Fix some draw glitches in panel mode (I hope).

 panel-plugin/catchwindow.c |    3 +++
 panel-plugin/dockapp.c     |   10 ++++++++--
 panel-plugin/misc.c        |   29 +++++++++++++++++++++++++++++
 panel-plugin/misc.h        |    1 +
 panel-plugin/props.c       |   26 +++++---------------------
 panel-plugin/rcfile.c      |    4 +++-
 6 files changed, 49 insertions(+), 24 deletions(-)

diff --git a/panel-plugin/catchwindow.c b/panel-plugin/catchwindow.c
index a0926bf..76f6b90 100644
--- a/panel-plugin/catchwindow.c
+++ b/panel-plugin/catchwindow.c
@@ -234,6 +234,9 @@ void wmdock_window_open(WnckScreen *s, WnckWindow *w)
 
 			/* Setup the event-after handler for the window. */
 			g_signal_connect(G_OBJECT(dapp->tile), "event-after", G_CALLBACK(wmdock_dockapp_event_after_handler), dapp);
+		} else {
+			/* Setup the event-after handler for the eventbox to fix some glitches. */
+			g_signal_connect(G_OBJECT(dapp->evbox), "event-after", G_CALLBACK(wmdock_dockapp_event_after_handler), dapp);
 		}
 		/* Clear the noisy background. */
 		wmdock_redraw_dockapp(dapp);
diff --git a/panel-plugin/dockapp.c b/panel-plugin/dockapp.c
index e761a25..f474957 100644
--- a/panel-plugin/dockapp.c
+++ b/panel-plugin/dockapp.c
@@ -461,8 +461,8 @@ DockappNode *wmdock_get_primary_anchor_dockapp()
  */
 void wmdock_dockapp_event_after_handler(GtkWidget *window, GdkEvent *ev, DockappNode *dapp)
 {
-	if( ! IS_PANELOFF(wmdock) )
-		return;
+//	if( ! IS_PANELOFF(wmdock) )
+//		return;
 
 	debug("dockapp.c: Window event-after: %d. (dapp: `%s'), dappOnMove: %s", ev->type, dapp->name, dappOnMotion ? "Yes": "No");
 
@@ -806,6 +806,12 @@ void wmdock_set_tile_background(DockappNode *dapp, GdkPixbuf *pb)
 	gdk_draw_pixbuf(dapp->bgimg, gc,
 			pb, 0, 0, 0, 0, DEFAULT_DOCKAPP_WIDTH, DEFAULT_DOCKAPP_HEIGHT,
 			GDK_RGB_DITHER_NONE, 0, 0);
+	if( ! IS_PANELOFF(wmdock) ) {
+		gdk_window_clear(GTK_WIDGET(dapp->evbox)->window);
+		gdk_draw_pixbuf(GTK_WIDGET(dapp->evbox)->window, gc,
+				pb, 0, 0, 0, 0, DEFAULT_DOCKAPP_WIDTH, DEFAULT_DOCKAPP_HEIGHT,
+				GDK_RGB_DITHER_NONE, 0, 0);
+	}
 	gdk_gc_unref(gc);
 
 	if(dapp->bg)
diff --git a/panel-plugin/misc.c b/panel-plugin/misc.c
index 8cea694..4b3d89a 100644
--- a/panel-plugin/misc.c
+++ b/panel-plugin/misc.c
@@ -316,3 +316,32 @@ void wmdock_panel_draw_wmdock_icon (gboolean redraw)
 
 	gtk_widget_show_all(GTK_WIDGET(eventBox));
 }
+
+
+/**
+ * Function destroys the info dialog.
+ *
+ */
+static void wmdock_info_dialog_response (GtkWidget  *gtkDlg, gint response)
+{
+	gtk_widget_destroy (gtkDlg);
+}
+
+
+/**
+ * Function shows an info message (msg) in a dialog box.
+ *
+ * @param msg The info message as null terminated string.
+ */
+void wmdock_info_dialog(const gchar *msg)
+{
+	GtkWidget *gtkDlg = NULL;
+
+	gtkDlg = gtk_message_dialog_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (wmdock->plugin))),
+			GTK_DIALOG_DESTROY_WITH_PARENT,
+			GTK_MESSAGE_INFO,
+			GTK_BUTTONS_OK,
+			msg);
+	g_signal_connect (gtkDlg, "response", G_CALLBACK (wmdock_info_dialog_response), NULL);
+	gtk_widget_show_all (gtkDlg);
+}
diff --git a/panel-plugin/misc.h b/panel-plugin/misc.h
index 9d52ea4..448c2ff 100644
--- a/panel-plugin/misc.h
+++ b/panel-plugin/misc.h
@@ -33,5 +33,6 @@ gboolean comp_str_with_pattern(const gchar *, gchar *, gsize);
 void wmdock_panel_draw_wmdock_icon (gboolean redraw);
 int wmdock_get_instance_count();
 AnchorPostion get_default_anchor_postion();
+void wmdock_info_dialog(const gchar *);
 
 #endif /* __MISC_H__ */
diff --git a/panel-plugin/props.c b/panel-plugin/props.c
index 6bc7f04..4552e96 100644
--- a/panel-plugin/props.c
+++ b/panel-plugin/props.c
@@ -59,12 +59,6 @@ static struct {
 static GtkWidget *btnProperties = NULL;
 
 
-static void wmdock_info_dialog_response (GtkWidget  *gtkDlg, gint response)
-{
-	gtk_widget_destroy (gtkDlg);
-}
-
-
 static void wmdock_properties_fillcmbx(DockappNode *dapp, GtkWidget *gtkComboBox)
 {
 
@@ -81,6 +75,9 @@ static void wmdock_properties_chkdisptile(GtkToggleButton *gtkChkDispTile, gpoin
 
 	g_list_foreach(wmdock->dapps, (GFunc)wmdock_redraw_dockapp, NULL);
 	gtk_widget_show_all(GTK_WIDGET(wmdock->box));
+
+	if( ! IS_PANELOFF(wmdock) )
+		wmdock_info_dialog(_("Changes maybe not work properly until you restart XFCE!"));
 }
 
 
@@ -140,8 +137,6 @@ static void wmdock_properties_radiopaneloff(GtkRadioButton *gtkRadioPanelOff, gp
 
 static void wmdock_properties_chkpaneloff(GtkToggleButton *gtkChkPanelOff, gpointer user_data)
 {
-	GtkWidget *gtkDlg;
-
 	if((rcPanelOff = gtk_toggle_button_get_active(gtkChkPanelOff)) == TRUE) {
 		wmdock->anchorPos = get_default_anchor_postion();
 		gtk_widget_set_sensitive(GTK_WIDGET(prop.radioPanelOffBL), TRUE);
@@ -158,13 +153,7 @@ static void wmdock_properties_chkpaneloff(GtkToggleButton *gtkChkPanelOff, gpoin
 	}
 
 	if(g_list_length(wmdock->dapps)) {
-		gtkDlg = gtk_message_dialog_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (wmdock->plugin))),
-				GTK_DIALOG_DESTROY_WITH_PARENT,
-				GTK_MESSAGE_INFO,
-				GTK_BUTTONS_OK,
-				_("Changes will take effect when you restart XFCE!"));
-		g_signal_connect (gtkDlg, "response", G_CALLBACK (wmdock_info_dialog_response), NULL);
-		gtk_widget_show_all (gtkDlg);
+		wmdock_info_dialog(_("Changes will take effect when you restart XFCE!"));
 	} else {
 		/* If no dockapp is started enable/disable panel off mode. */
 		wmdock->propPanelOff = rcPanelOff;
@@ -539,12 +528,7 @@ void wmdock_properties_dialog(XfcePanelPlugin *plugin)
 	gtk_table_attach_defaults(GTK_TABLE(prop.tblPanelOff), prop.radioPanelOffTR, 1, 2, 0, 1);
 	gtk_table_attach_defaults(GTK_TABLE(prop.tblPanelOff), prop.radioPanelOffBL, 0, 1, 1, 2);
 	gtk_table_attach_defaults(GTK_TABLE(prop.tblPanelOff), prop.radioPanelOffBR, 1, 2, 1, 2);
-	/*
-	gtk_box_pack_start (GTK_BOX (prop.hboxPanelOffOpts), prop.radioPanelOffTL, FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (prop.hboxPanelOffOpts), prop.radioPanelOffTR, FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (prop.hboxPanelOffOpts), prop.radioPanelOffBL, FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (prop.hboxPanelOffOpts), prop.radioPanelOffBR, FALSE, FALSE, 0);
-	*/
+
 	switch(wmdock->anchorPos) {
 	case ANCHOR_TL:
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prop.radioPanelOffTL), TRUE);
diff --git a/panel-plugin/rcfile.c b/panel-plugin/rcfile.c
index 1bd4bd5..99bacd7 100644
--- a/panel-plugin/rcfile.c
+++ b/panel-plugin/rcfile.c
@@ -208,6 +208,8 @@ void wmdock_write_rc_file (XfcePanelPlugin *plugin)
 		if( IS_PANELOFF(wmdock) ) {
 			xfce_rc_write_list_entry(rc, RCKEY_GLUELIST, glueList, RC_LIST_DELIMITER);
 			g_strfreev(glueList);
+		} else if ( ! IS_PANELOFF(wmdock) || rcPanelOff == FALSE ) {
+			xfce_rc_delete_entry(rc, RCKEY_GLUELIST, TRUE);
 		}
 
 		xfce_rc_write_bool_entry (rc, RCKEY_DISPTILE, wmdock->propDispTile);
@@ -216,8 +218,8 @@ void wmdock_write_rc_file (XfcePanelPlugin *plugin)
 		xfce_rc_write_bool_entry (rc, RCKEY_PANELOFF, rcPanelOff);
 		xfce_rc_write_bool_entry (rc, RCKEY_PANELOFFIGNOREOFFSET, wmdock->propPanelOffIgnoreOffset);
 		xfce_rc_write_bool_entry (rc, RCKEY_PANELOFFKEEPABOVE, wmdock->propPanelOffKeepAbove);
-		xfce_rc_write_entry(rc, RCKEY_DAFILTER, wmdock->filterList);
 		xfce_rc_write_int_entry (rc, RCKEY_ANCHORPOS, wmdock->anchorPos);
+		xfce_rc_write_entry(rc, RCKEY_DAFILTER, wmdock->filterList);
 	}
 
 	xfce_rc_close(rc);


More information about the Xfce4-commits mailing list