summaryrefslogtreecommitdiff
path: root/libwnck/wnck-handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'libwnck/wnck-handle.c')
-rw-r--r--libwnck/wnck-handle.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/libwnck/wnck-handle.c b/libwnck/wnck-handle.c
index e12ff88..710b754 100644
--- a/libwnck/wnck-handle.c
+++ b/libwnck/wnck-handle.c
@@ -29,6 +29,11 @@
#include "config.h"
#include "wnck-handle-private.h"
+#include <X11/Xlib.h>
+#ifdef HAVE_XRES
+#include <X11/extensions/XRes.h>
+#endif
+
#include "private.h"
#include "screen.h"
#include "window.h"
@@ -43,6 +48,8 @@ struct _WnckHandle
WnckClientType client_type;
+ gboolean have_xres;
+
gsize default_icon_size;
gsize default_mini_icon_size;
@@ -165,6 +172,40 @@ filter_func (GdkXEvent *gdkxevent,
}
static void
+init_xres (WnckHandle *self)
+{
+#ifdef HAVE_XRES
+ Display *xdisplay;
+ int event_base;
+ int error_base;
+ int major;
+ int minor;
+
+ xdisplay = _wnck_get_default_display ();
+ event_base = error_base = major = minor = 0;
+
+ if (XResQueryExtension (xdisplay, &event_base, &error_base) &&
+ XResQueryVersion (xdisplay, &major, &minor) == 1)
+ {
+ if (major > 1 || (major == 1 && minor >= 2))
+ self->have_xres = TRUE;
+ }
+#endif
+}
+
+static void
+wnck_handle_constructed (GObject *object)
+{
+ WnckHandle *self;
+
+ self = WNCK_HANDLE (object);
+
+ G_OBJECT_CLASS (wnck_handle_parent_class)->constructed (object);
+
+ init_xres (self);
+}
+
+static void
wnck_handle_finalize (GObject *object)
{
WnckHandle *self;
@@ -290,6 +331,7 @@ wnck_handle_class_init (WnckHandleClass *self_class)
object_class = G_OBJECT_CLASS (self_class);
+ object_class->constructed = wnck_handle_constructed;
object_class->finalize = wnck_handle_finalize;
object_class->get_property = wnck_handle_get_property;
object_class->set_property = wnck_handle_set_property;
@@ -343,6 +385,12 @@ _wnck_handle_get_client_type (WnckHandle *self)
return self->client_type;
}
+gboolean
+_wnck_handle_has_xres (WnckHandle *self)
+{
+ return self->have_xres;
+}
+
/**
* wnck_handle_get_default_screen:
* @self: a #WnckHandle