Author: dannym
Date: 2007-02-03 14:18:55 +0000 (Sat, 03 Feb 2007)
New Revision: 24826
Modified:
libxfcegui4/trunk/libxfcegui4/netk-window.c
libxfcegui4/trunk/libxfcegui4/netk-xutils.c
libxfcegui4/trunk/libxfcegui4/netk-xutils.h
Log:
add p_netk_get_icon_geometry
Modified: libxfcegui4/trunk/libxfcegui4/netk-window.c
===================================================================
--- libxfcegui4/trunk/libxfcegui4/netk-window.c 2007-02-03 13:29:17 UTC (rev
24825)
+++ libxfcegui4/trunk/libxfcegui4/netk-window.c 2007-02-03 14:18:55 UTC (rev
24826)
@@ -135,6 +135,7 @@
guint need_update_transient_for:1;
guint need_update_wmclass : 1;
guint need_update_wmhints : 1;
+ guint need_update_icon_geometry : 1;
/* if available */
char *client_machine;
@@ -384,6 +385,7 @@
window->priv->need_update_transient_for = TRUE;
window->priv->need_update_wmclass = TRUE;
window->priv->need_update_wmhints = TRUE;
+ window->priv->need_update_icon_geometry = TRUE;
force_update_now (window);
return window;
@@ -1273,6 +1275,42 @@
}
/**
+ * netk_window_get_icon_geometry:
+ * @window: a #NetkWindow
+ * @xp: return location for X coordinate of icon
+ * @yp: return location for Y coordinate of icon
+ * @widthp: return location for width of icon
+ * @heightp: return location for height of icon
+ *
+ * Gets the size and position of the icon.
+ * returns %TRUE if there was one.
+ *
+ **/
+gboolean
+netk_window_get_icon_geometry (NetkWindow * window, int *xp, int *yp, int
*widthp, int *heightp)
+{
+ g_return_if_fail (NETK_IS_WINDOW (window));
+
+ if (window->priv->icon_geometry.width == -1) {
+ return FALSE;
+ }
+
+ if (xp != NULL)
+ *xp = window->priv->icon_geometry.x;
+
+ if (yp != NULL)
+ *yp = window->priv->icon_geometry.y;
+
+ if (widthp != NULL)
+ *widthp = window->priv->icon_geometry.width;
+
+ if (heightp != NULL)
+ *heightp = window->priv->icon_geometry.height;
+
+ return TRUE;
+}
+
+/**
* netk_window_set_icon_geometry:
* @window: a #NetkWindow
* @x: x coordinate in pixels
@@ -1452,6 +1490,11 @@
window->priv->need_update_wmhints = TRUE;
queue_update (window);
}
+ else if (xevent->xproperty.atom == p_netk_atom_get
("_NET_WM_ICON_GEOMETRY"))
+ {
+ window->priv->need_update_icon_geometry = TRUE;
+ queue_update (window);
+ }
}
void
@@ -1882,6 +1925,18 @@
&window->priv->res_name);
}
+static void
+update_icon_geometry (NetkWindow *window)
+{
+ if (!window->priv->need_update_icon_geometry)
+ return;
+
+ window->priv->need_update_icon_geometry = FALSE;
+ if (!p_netk_get_icon_geometry(window->priv->xwindow,
&window->priv->icon_geometry.x, &window->priv->icon_geometry.y,
&window->priv->icon_geometry.width, &window->priv->icon_geometry.height)) {
+ window->priv->icon_geometry.width = -1;
+ }
+}
+
static void
update_wmhints (NetkWindow *window)
{
@@ -1952,13 +2007,13 @@
update_wmhints (window);
update_transient_for (window); /* wintype needs this to be first */
update_wintype (window);
+ update_icon_geometry (window);
update_wm_state (window);
update_state (window); /* must come after the above, since they affect
* our calculated state
*/
update_workspace (window); /* emits signals */
update_actions (window);
-
get_icons (window);
Modified: libxfcegui4/trunk/libxfcegui4/netk-xutils.c
===================================================================
--- libxfcegui4/trunk/libxfcegui4/netk-xutils.c 2007-02-03 13:29:17 UTC (rev
24825)
+++ libxfcegui4/trunk/libxfcegui4/netk-xutils.c 2007-02-03 14:18:55 UTC (rev
24826)
@@ -2177,6 +2177,40 @@
p_netk_error_trap_pop ();
}
+gboolean
+p_netk_get_icon_geometry (Window xwindow, int* x, int* y, int* width, int*
height)
+{
+ Atom type;
+ int format;
+ gulong nitems;
+ gulong bytes_after;
+ gulong *data;
+ int err, result;
+
+ p_netk_error_trap_push ();
+ type = None;
+ result = XGetWindowProperty (gdk_display, xwindow, p_netk_atom_get
("_NET_WM_ICON_GEOMETRY"), 0, 4, False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (guchar **)&data);
+ err = p_netk_error_trap_pop ();
+
+ if (err != Success || result != Success)
+ return FALSE;
+
+ if (type != XA_CARDINAL || nitems != 4)
+ {
+ XFree (data);
+ return FALSE;
+ }
+
+ *x = data[0];
+ *y = data[1];
+ *width = data[2];
+ *height = data[3];
+
+ XFree (data);
+
+ return TRUE;
+}
+
void
p_netk_set_type_hint (Window xwindow, NetkWindowType type)
{
Modified: libxfcegui4/trunk/libxfcegui4/netk-xutils.h
===================================================================
--- libxfcegui4/trunk/libxfcegui4/netk-xutils.h 2007-02-03 13:29:17 UTC (rev
24825)
+++ libxfcegui4/trunk/libxfcegui4/netk-xutils.h 2007-02-03 14:18:55 UTC (rev
24826)
@@ -140,6 +140,8 @@
void p_netk_set_icon_geometry (Window xwindow, int x, int y, int width,
int height);
+gboolean p_netk_get_icon_geometry (Window xwindow, int* x, int* y, int* width,
int* height);
+
/* p_netk_set_dock_type_hint() kept for backward compat */
#define p_netk_set_dock_type_hint (w) \
p_netk_set_type_hint (w, NETK_WINDOW_DOCK)
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits