[Xfce4-commits] <xfce4-panel:master> Improve showing a window a bit.
Nick Schermer
noreply at xfce.org
Sun Jun 13 21:26:04 CEST 2010
Updating branch refs/heads/master
to 0ea9a2db5bf11a50b08db6f1857272e52caf973a (commit)
from 5f5f0eec1aa67463fe71e4e04d6f68e5ec1ce0d9 (commit)
commit 0ea9a2db5bf11a50b08db6f1857272e52caf973a
Author: Nick Schermer <nick at xfce.org>
Date: Sun Jun 13 21:08:58 2010 +0200
Improve showing a window a bit.
Still not there yet, but this makes things a bit easier
to understand.
common/panel-debug.h | 1 +
panel/panel-application.c | 3 ---
panel/panel-base-window.c | 5 +++++
panel/panel-window.c | 21 ++++++++++++++++++++-
4 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/common/panel-debug.h b/common/panel-debug.h
index ac37028..74990c5 100644
--- a/common/panel-debug.h
+++ b/common/panel-debug.h
@@ -26,6 +26,7 @@
#define PANEL_DEBUG_DOMAIN_EXTERNAL "external"
#define PANEL_DEBUG_DOMAIN_EXTERNAL46 "external46"
#define PANEL_DEBUG_DOMAIN_TASKLIST "tasklist"
+#define PANEL_DEBUG_DOMAIN_BASE_WINDOW "base-window"
#define PANEL_DEBUG_BOOL(bool) ((bool) ? "true" : "false")
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 4f9dd73..b49c2b5 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -1250,9 +1250,6 @@ panel_application_new_window (PanelApplication *application,
/* create panel window */
window = panel_window_new ();
- /* realize, else some properties do not apply */
- gtk_widget_realize (window);
-
/* monitor window destruction */
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (panel_application_window_destroyed), application);
diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index ce569ee..5087415 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -28,6 +28,7 @@
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#include <common/panel-private.h>
+#include <common/panel-debug.h>
#include <panel/panel-base-window.h>
#include <panel/panel-window.h>
#include <panel/panel-plugin-external.h>
@@ -657,6 +658,10 @@ panel_base_window_composited_changed (GtkWidget *widget)
gtk_widget_unrealize (widget);
}
+ panel_debug (PANEL_DEBUG_DOMAIN_BASE_WINDOW, "set compositing=%s, was visible=%s",
+ PANEL_DEBUG_BOOL (gtk_widget_is_composited (widget)),
+ PANEL_DEBUG_BOOL (was_visible));
+
/* clear cairo image cache */
if (window->priv->bg_image_cache != NULL)
{
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 5dc9532..f62323c 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -109,6 +109,7 @@ static void panel_window_screen_changed (GtkWidget *w
GdkScreen *previous_screen);
static void panel_window_style_set (GtkWidget *widget,
GtkStyle *previous_style);
+static void panel_window_realize (GtkWidget *widget);
static StrutsEgde panel_window_screen_struts_edge (PanelWindow *window);
static void panel_window_screen_struts_set (PanelWindow *window);
static void panel_window_screen_force_update (PanelWindow *window);
@@ -324,6 +325,7 @@ panel_window_class_init (PanelWindowClass *klass)
gtkwidget_class->size_allocate = panel_window_size_allocate;
gtkwidget_class->screen_changed = panel_window_screen_changed;
gtkwidget_class->style_set = panel_window_style_set;
+ gtkwidget_class->realize = panel_window_realize;
g_object_class_install_property (gobject_class,
PROP_HORIZONTAL,
@@ -1307,6 +1309,20 @@ panel_window_style_set (GtkWidget *widget,
+static void
+panel_window_realize (GtkWidget *widget)
+{
+ PanelWindow *window = PANEL_WINDOW (widget);
+
+ (*GTK_WIDGET_CLASS (panel_window_parent_class)->realize) (widget);
+
+ /* set struts if we snap to an edge */
+ if (window->struts_edge != STRUTS_EDGE_NONE)
+ panel_window_screen_struts_set (window);
+}
+
+
+
static StrutsEgde
panel_window_screen_struts_edge (PanelWindow *window)
{
@@ -1370,10 +1386,12 @@ panel_window_screen_struts_set (PanelWindow *window)
const gchar *strut_xy[] = { "y", "y", "x", "x" };
panel_return_if_fail (PANEL_IS_WINDOW (window));
- panel_return_if_fail (GDK_IS_WINDOW (GTK_WIDGET (window)->window));
panel_return_if_fail (cardinal_atom != 0 && net_wm_strut_partial_atom != 0);
panel_return_if_fail (GDK_IS_SCREEN (window->screen));
+ if (!GTK_WIDGET_REALIZED (window))
+ return;
+
/* set the struts */
/* note that struts are relative to the screen edge! */
if (window->struts_edge == STRUTS_EDGE_TOP)
@@ -1425,6 +1443,7 @@ panel_window_screen_struts_set (PanelWindow *window)
gdk_error_trap_push ();
/* set the wm strut partial */
+ panel_return_if_fail (GDK_IS_WINDOW (GTK_WIDGET (window)->window));
gdk_property_change (GTK_WIDGET (window)->window,
net_wm_strut_partial_atom,
cardinal_atom, 32, GDK_PROP_MODE_REPLACE,
More information about the Xfce4-commits
mailing list