[Xfce4-commits] [xfce/xfce4-panel] 01/01: Make panel hide intelligently with shaded windows (bug #11371)
noreply at xfce.org
noreply at xfce.org
Sat Dec 20 01:35:18 CET 2014
This is an automated email from the git hooks/post-receive script.
andrzejr pushed a commit to branch master
in repository xfce/xfce4-panel.
commit 75ed12ce2e4d5d13781fca9179268bce958f9596
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Mon Dec 15 14:30:14 2014 +0100
Make panel hide intelligently with shaded windows (bug #11371)
---
panel/panel-window.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 52f9f09..b2868e5 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -31,6 +31,7 @@
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
+#include <X11/Xatom.h>
#endif
#include <libwnck/libwnck.h>
@@ -136,6 +137,10 @@ static void panel_window_active_window_changed (WnckScreen
PanelWindow *window);
static void panel_window_active_window_geometry_changed (WnckWindow *active_window,
PanelWindow *window);
+static void panel_window_active_window_state_changed (WnckWindow *active_window,
+ WnckWindowState changed,
+ WnckWindowState new,
+ PanelWindow *window);
static void panel_window_autohide_queue (PanelWindow *window,
AutohideState new_state);
static void panel_window_set_autohide_behavior (PanelWindow *window,
@@ -2172,6 +2177,32 @@ panel_window_active_window_geometry_changed (WnckWindow *active_window,
&window_area.x, &window_area.y,
&window_area.width, &window_area.height);
+ /* if a window is shaded, check the height of the window's
+ * decoration as exposed through the _NET_FRAME_EXTENTS application
+ * window property */
+ if (wnck_window_is_shaded (active_window))
+ {
+ Display *display;
+ Atom real_type;
+ int real_format;
+ unsigned long items_read, items_left;
+ guint32 *data;
+
+ display = XOpenDisplay(0);
+ if (XGetWindowProperty (display, wnck_window_get_xid (active_window),
+ XInternAtom(display, "_NET_FRAME_EXTENTS", True),
+ 0, 4, FALSE, AnyPropertyType,
+ &real_type, &real_format, &items_read, &items_left,
+ (unsigned char **) &data) == Success
+ && (items_read >= 4))
+ window_area.height = data[2] + data[3];
+
+ if (data)
+ {
+ XFree (data);
+ }
+ }
+
/* obtain position and dimension from the panel */
panel_window_size_allocate_set_xy (window,
window->alloc.width,
@@ -2207,6 +2238,20 @@ panel_window_active_window_geometry_changed (WnckWindow *active_window,
+static void
+panel_window_active_window_state_changed (WnckWindow *active_window,
+ WnckWindowState changed,
+ WnckWindowState new,
+ PanelWindow *window)
+{
+ panel_return_if_fail (WNCK_IS_WINDOW (active_window));
+
+ if (changed & WNCK_WINDOW_STATE_SHADED)
+ panel_window_active_window_geometry_changed (active_window, window);
+}
+
+
+
static gboolean
panel_window_autohide_timeout (gpointer user_data)
{
@@ -2484,6 +2529,8 @@ panel_window_update_autohide_window (PanelWindow *window,
{
g_signal_handlers_disconnect_by_func (window->wnck_active_window,
panel_window_active_window_geometry_changed, window);
+ g_signal_handlers_disconnect_by_func (window->wnck_active_window,
+ panel_window_active_window_state_changed, window);
}
/* remember the new window */
@@ -2494,6 +2541,8 @@ panel_window_update_autohide_window (PanelWindow *window,
{
g_signal_connect (G_OBJECT (active_window), "geometry-changed",
G_CALLBACK (panel_window_active_window_geometry_changed), window);
+ g_signal_connect (G_OBJECT (active_window), "state-changed",
+ G_CALLBACK (panel_window_active_window_state_changed), window);
/* simulate a geometry change for immediate hiding when the new active
* window already overlaps the panel */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list