grim/guifications2

Parents 4d1202a4fe19
Children 3a8f4f41e93b
the start of breaking out the win32 and x11 stuff into separate helper libraries...
--- a/.hgignore Sat Dec 03 23:17:21 2011 -0600
+++ b/.hgignore Sun Dec 04 00:41:53 2011 -0600
@@ -26,7 +26,6 @@
po/Makefile.in.in
po/POTFILES
po/stamp-it
-src/.deps
src/.libs
stamp-h1
@@ -34,3 +33,4 @@
(pre|gf)_config.h(\.in)?$
config.(guess|log|status|sub)
^pre_config\.h\.in~?$
+\.deps\/
--- a/configure.ac Sat Dec 03 23:17:21 2011 -0600
+++ b/configure.ac Sun Dec 04 00:41:53 2011 -0600
@@ -118,13 +118,17 @@
# check for freetype 2
#
-PKG_CHECK_MODULES(PANGOFT2, pangoft2 >= 1.1.0,
+PKG_CHECK_MODULES(PANGOFT2, pangoft2 >= 1.1.0,
[
AC_DEFINE(HAVE_PANGOFT2, 1, [Define if we have found pangoft2.])
])
AC_SUBST(PANGOFT2_CFLAGS)
AC_SUBST(PANGOFT2_LIBS)
+dnl This is a hack since the win32 build doesn't use autotools
+AM_CONDITIONAL(USE_X11, true)
+AM_CONDITIONAL(USE_WIN32, false)
+
dnl #######################################################################
dnl # Disable installation of translation files
dnl #######################################################################
@@ -158,6 +162,8 @@
pixmaps/Makefile
po/Makefile.in
src/Makefile
+ src/win32/Makefile
+ src/x11/Makefile
themes/Makefile
])
--- a/src/Makefile.am Sat Dec 03 23:17:21 2011 -0600
+++ b/src/Makefile.am Sun Dec 04 00:41:53 2011 -0600
@@ -1,3 +1,5 @@
+DIST_SUBDIRS = win32 x11
+
EXTRA_DIST = \
gf_action.h \
gf_blist.h \
@@ -62,6 +64,14 @@
$(PIDGIN_LIBS) \
$(PURPLE_LIBS)
+if USE_X11
+guifications_la_LIBADD += x11/libguifications-x11.la
+endif
+
+if USE_WIN32
+guifications_la_LIBADD += win32/libguifications-win32.la
+endif
+
AM_CPPFLAGS = \
-DVERSION=\"$(VERSION)\" \
-DDATADIR=\"$(PIDGIN_DATADIR)\" \
--- a/src/gf_display.c Sat Dec 03 23:17:21 2011 -0600
+++ b/src/gf_display.c Sun Dec 04 00:41:53 2011 -0600
@@ -16,12 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
*/
-#ifndef _WIN32
-# include <gdk/gdkx.h>
-# include <X11/Xlib.h>
-# include <X11/Xutil.h>
-# include <X11/Xatom.h>
-#else
+#ifdef _WIN32
# ifndef WINVER
# define WINVER 0x0500 /* This is Windows 2000 */
# endif /* WINVER */
@@ -163,243 +158,6 @@
}
/*******************************************************************************
- * Uses _NET_WORKAREA or SPI_GETWORKAREA to get the geometry of a screen
- ******************************************************************************/
-#ifdef _WIN32
-static gboolean
-win32_get_workarea_fallback(GdkRectangle *rect) {
- RECT rcWork;
- if (SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, FALSE)) {
- rect->x = rcWork.left;
- rect->y = rcWork.top;
- rect->width = rcWork.right - rcWork.left;
- rect->height = rcWork.bottom - rcWork.top;
-
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * This will only work on Win98+ and Win2K+
- */
-static gboolean
-win32_adjust_workarea_multi_monitor(GdkRectangle *rect) {
- GF_GetMonitorInfo *the_GetMonitorInfo;
- GF_MonitorFromRect *the_MonitorFromRect;
- HMODULE hmod;
- HMONITOR monitor;
- MONITORINFO info;
- RECT monitorRect;
- gint virtual_screen_x, virtual_screen_y;
-
- monitorRect.left = rect->x;
- monitorRect.right = rect->x + rect->width;
- monitorRect.top = rect->y;
- monitorRect.bottom = rect->y + rect->height;
-
- /* Convert the coordinates so that 0, 0 is the top left of the Primary
- * Monitor, not the top left of the virtual screen
- */
- virtual_screen_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
- virtual_screen_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
-
- if (virtual_screen_x != 0) {
- monitorRect.left += virtual_screen_x;
- monitorRect.right += virtual_screen_x;
- }
-
- if (virtual_screen_y != 0) {
- monitorRect.top += virtual_screen_y;
- monitorRect.bottom += virtual_screen_y;
- }
-
- if (!(hmod = GetModuleHandle("user32"))) {
- return FALSE;
- }
-
- if (!(the_MonitorFromRect = (GF_MonitorFromRect*)
- GetProcAddress(hmod, "MonitorFromRect"))) {
- return FALSE;
- }
-
- if (!(the_GetMonitorInfo = (GF_GetMonitorInfo*)
- GetProcAddress(hmod, "GetMonitorInfoA"))) {
- return FALSE;
- }
-
- monitor = the_MonitorFromRect(&monitorRect, MONITOR_DEFAULTTONEAREST);
-
- info.cbSize = sizeof(info);
- if (!the_GetMonitorInfo(monitor, &info)) {
- return FALSE;
- }
-
- rect->x = info.rcWork.left;
- rect->y = info.rcWork.top;
- rect->width = info.rcWork.right - info.rcWork.left;
- rect->height = info.rcWork.bottom - info.rcWork.top;
-
- /** Convert the coordinates so that 0, 0 is the top left of the virtual screen,
- * not the top left of the primary monitor */
- if (virtual_screen_x != 0) {
- rect->x += -virtual_screen_x;
- }
- if (virtual_screen_y != 0) {
- rect->y += -virtual_screen_y;
- }
-
- return TRUE;
-}
-
-static void
-win32_adjust_workarea(GdkRectangle *rect) {
- if (!win32_adjust_workarea_multi_monitor(rect)) {
- if (!win32_get_workarea_fallback(rect)) {
- /* I don't think this will ever happen */
- rect->x = 0;
- rect->y = 0;
- rect->height = GetSystemMetrics(SM_CXSCREEN);
- rect->width = GetSystemMetrics(SM_CYSCREEN);
- }
- }
-}
-#endif /** _WIN32 */
-
-gboolean
-gf_display_get_workarea(GdkRectangle *rect) {
-#ifndef _WIN32
- Atom xa_desktops, xa_current, xa_workarea, xa_type;
- Display *x_display;
- Window x_root;
- guint32 desktops = 0, current = 0;
- gulong *workareas, len, fill;
- guchar *data;
- gint format;
-
-# if !GTK_CHECK_VERSION(2,2,0)
-
- x_display = GDK_DISPLAY();
- x_root = XDefaultRootWindow(x_display);
-
-# else /* GTK 2.2.0 and up */
-
- GdkDisplay *g_display;
- GdkScreen *g_screen;
- Screen *x_screen;
-
- /* get the gdk display */
- g_display = gdk_display_get_default();
- if(!g_display)
- return FALSE;
-
- /* get the x display from the gdk display */
- x_display = gdk_x11_display_get_xdisplay(g_display);
- if(!x_display)
- return FALSE;
-
- /* get the screen according to the prefs */
- g_screen = gdk_display_get_screen(g_display, disp_screen);
- if(!g_screen)
- return FALSE;
-
- /* get the x screen from the gdk screen */
- x_screen = gdk_x11_screen_get_xscreen(g_screen);
- if(!x_screen)
- return FALSE;
-
- /* get the root window from the screen */
- x_root = XRootWindowOfScreen(x_screen);
-
-# endif /* !GTK_CHECK_VERSION(2,2,0) */
-
- /* find the _NET_NUMBER_OF_DESKTOPS atom */
- xa_desktops = XInternAtom(x_display, "_NET_NUMBER_OF_DESKTOPS", True);
- if(xa_desktops == None)
- return FALSE;
-
- /* get the number of desktops */
- if(XGetWindowProperty(x_display, x_root, xa_desktops, 0, 1, False,
- XA_CARDINAL, &xa_type, &format, &len, &fill,
- &data) != Success)
- {
- return FALSE;
- }
-
- if(!data)
- return FALSE;
-
- desktops = *(guint32 *)data;
- XFree(data);
-
- /* find the _NET_CURRENT_DESKTOP atom */
- xa_current = XInternAtom(x_display, "_NET_CURRENT_DESKTOP", True);
- if(xa_current == None)
- return FALSE;
-
- /* get the current desktop */
- if(XGetWindowProperty(x_display, x_root, xa_current, 0, 1, False,
- XA_CARDINAL, &xa_type, &format, &len, &fill,
- &data) != Success)
- {
- return FALSE;
- }
-
- if(!data)
- return FALSE;
-
- current = *(guint32 *)data;
- XFree(data);
-
- /* find the _NET_WORKAREA atom */
- xa_workarea = XInternAtom(x_display, "_NET_WORKAREA", True);
- if(xa_workarea == None)
- return FALSE;
-
- if(XGetWindowProperty(x_display, x_root, xa_workarea, 0, (glong)(4 * 32),
- False, AnyPropertyType, &xa_type, &format, &len,
- &fill, &data) != Success)
- {
- return FALSE;
- }
-
- /* make sure the type and format are good */
- if(xa_type == None || format == 0)
- return FALSE;
-
- /* make sure we don't have any leftovers */
- if(fill)
- return FALSE;
-
- /* make sure len divides evenly by 4 */
- if(len % 4)
- return FALSE;
-
- /* it's good, lets use it */
- workareas = (gulong *)(guint32 *)data;
-
- rect->x = (guint32)workareas[current * 4];
- rect->y = (guint32)workareas[current * 4 + 1];
- rect->width = (guint32)workareas[current * 4 + 2];
- rect->height = (guint32)workareas[current * 4 + 3];
-
- /* clean up our memory */
- XFree(data);
-#else
- GdkDisplay *display;
- GdkScreen *screen;
-
- display = gdk_display_get_default();
- screen = gdk_display_get_screen(display, disp_screen);
- gdk_screen_get_monitor_geometry(screen, disp_monitor, rect);
-
- win32_adjust_workarea(rect);
-#endif /* _WIN32 */
-
- return TRUE;
-}
-
-/*******************************************************************************
* Gtk 2.0.0 stuff
*
* This is the default behavior of 2.0 and 1.x
@@ -1001,7 +759,7 @@
} G_STMT_END
/* Yes this big ugly function... isn't so big and ugly anymore...
- * It checks for existing notification from the same buddy, or conv with
+ * It checks for existing notification from the same buddy, or conv with
* with the same target, and condenses contacts by the use of helper funcs.
*
* It returns TRUE if the new notification/event should be destroyed because
@@ -1061,46 +819,6 @@
return ret;
}
-gboolean
-gf_display_screen_saver_is_running() {
- gboolean ret = FALSE;
-#ifndef _WIN32
- static Atom xss, locked, blanked;
- static gboolean init = FALSE;
- Atom ratom;
- gint rtatom;
- guchar *data = NULL;
- gulong items, padding;
-
- if(!init) {
- xss = XInternAtom(GDK_DISPLAY(),"_SCREENSAVER_STATUS", FALSE);
- locked = XInternAtom(GDK_DISPLAY(), "LOCK", FALSE);
- blanked = XInternAtom(GDK_DISPLAY(), "BLANK", FALSE);
- init = TRUE;
- }
-
- if(XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(), xss, 0, 999, FALSE,
- XA_INTEGER, &ratom, &rtatom, &items, &padding, &data)
- == Success)
- {
- if(ratom == XA_INTEGER || items >= 3) {
- guint *item_data = (guint *)data;
-
- if(item_data[0] == locked || item_data[0] == blanked)
- ret = TRUE;
- }
- XFree(data);
- }
-#else
- if(!SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, (unsigned int) NULL,
- &ret, FALSE))
- {
- ret = FALSE;
- }
-#endif /* _WIN32 */
- return ret;
-}
-
void
gf_display_show_event(GfEventInfo *info, GfNotification *notification) {
GfDisplay *display = NULL;
--- a/src/gf_display.h Sat Dec 03 23:17:21 2011 -0600
+++ b/src/gf_display.h Sun Dec 04 00:41:53 2011 -0600
@@ -71,6 +71,10 @@
gboolean gf_display_screen_saver_is_running();
+/* private stuff, implemented in the x11/win32 static libraries */
+gboolean gf_display_get_workarea(GdkRectangle *rect);
+gboolean gf_display_screen_saver_is_running(void);
+
G_END_DECLS
#endif /* GF_DISPLAY_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/win32/Makefile.am Sun Dec 04 00:41:53 2011 -0600
@@ -0,0 +1,11 @@
+AM_CPPFLAGS = \
+ $(DEBUG_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(GLIB_CFLAGS)
+
+noinst_LTLIBRARIES = libguifications-win32.la
+
+libguifications_win32_la_SOURCES = \
+ gf_win32_display.c
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/win32/gf_win32_display.c Sun Dec 04 00:41:53 2011 -0600
@@ -0,0 +1,148 @@
+/*
+ * Guifications - The end all, be all, toaster popup plugin
+ * Copyright (C) 2003-2011 Gary Kramlich
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+
+/*******************************************************************************
+ * Uses _NET_WORKAREA or SPI_GETWORKAREA to get the geometry of a screen
+ ******************************************************************************/
+static gboolean
+win32_get_workarea_fallback(GdkRectangle *rect) {
+ RECT rcWork;
+ if (SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, FALSE)) {
+ rect->x = rcWork.left;
+ rect->y = rcWork.top;
+ rect->width = rcWork.right - rcWork.left;
+ rect->height = rcWork.bottom - rcWork.top;
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * This will only work on Win98+ and Win2K+
+ */
+static gboolean
+win32_adjust_workarea_multi_monitor(GdkRectangle *rect) {
+ GF_GetMonitorInfo *the_GetMonitorInfo;
+ GF_MonitorFromRect *the_MonitorFromRect;
+ HMODULE hmod;
+ HMONITOR monitor;
+ MONITORINFO info;
+ RECT monitorRect;
+ gint virtual_screen_x, virtual_screen_y;
+
+ monitorRect.left = rect->x;
+ monitorRect.right = rect->x + rect->width;
+ monitorRect.top = rect->y;
+ monitorRect.bottom = rect->y + rect->height;
+
+ /* Convert the coordinates so that 0, 0 is the top left of the Primary
+ * Monitor, not the top left of the virtual screen
+ */
+ virtual_screen_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
+ virtual_screen_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ if (virtual_screen_x != 0) {
+ monitorRect.left += virtual_screen_x;
+ monitorRect.right += virtual_screen_x;
+ }
+
+ if (virtual_screen_y != 0) {
+ monitorRect.top += virtual_screen_y;
+ monitorRect.bottom += virtual_screen_y;
+ }
+
+ if (!(hmod = GetModuleHandle("user32"))) {
+ return FALSE;
+ }
+
+ if (!(the_MonitorFromRect = (GF_MonitorFromRect*)
+ GetProcAddress(hmod, "MonitorFromRect"))) {
+ return FALSE;
+ }
+
+ if (!(the_GetMonitorInfo = (GF_GetMonitorInfo*)
+ GetProcAddress(hmod, "GetMonitorInfoA"))) {
+ return FALSE;
+ }
+
+ monitor = the_MonitorFromRect(&monitorRect, MONITOR_DEFAULTTONEAREST);
+
+ info.cbSize = sizeof(info);
+ if (!the_GetMonitorInfo(monitor, &info)) {
+ return FALSE;
+ }
+
+ rect->x = info.rcWork.left;
+ rect->y = info.rcWork.top;
+ rect->width = info.rcWork.right - info.rcWork.left;
+ rect->height = info.rcWork.bottom - info.rcWork.top;
+
+ /** Convert the coordinates so that 0, 0 is the top left of the virtual screen,
+ * not the top left of the primary monitor */
+ if (virtual_screen_x != 0) {
+ rect->x += -virtual_screen_x;
+ }
+ if (virtual_screen_y != 0) {
+ rect->y += -virtual_screen_y;
+ }
+
+ return TRUE;
+}
+
+static void
+win32_adjust_workarea(GdkRectangle *rect) {
+ if(!win32_adjust_workarea_multi_monitor(rect)) {
+ if(!win32_get_workarea_fallback(rect)) {
+ /* I don't think this will ever happen */
+ rect->x = 0;
+ rect->y = 0;
+ rect->height = GetSystemMetrics(SM_CXSCREEN);
+ rect->width = GetSystemMetrics(SM_CYSCREEN);
+ }
+ }
+}
+
+gboolean
+gf_display_get_workarea(GdkRectangle *rect) {
+ GdkDisplay *display = NULL;
+ GdkScreen *screen = NULL;
+
+ display = gdk_display_get_default();
+ screen = gdk_display_get_screen(display, disp_screen);
+ gdk_screen_get_monitor_geometry(screen, disp_monitor, rect);
+
+ win32_adjust_workarea(rect);
+
+ return TRUE;
+}
+
+gboolean
+gf_display_screen_saver_is_running(void) {
+ gboolean ret = FALSE;
+
+ if(!SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, (unsigned int) NULL,
+ &ret, FALSE))
+ {
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/x11/Makefile.am Sun Dec 04 00:41:53 2011 -0600
@@ -0,0 +1,11 @@
+AM_CPPFLAGS = \
+ $(DEBUG_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(GLIB_CFLAGS)
+
+noinst_LTLIBRARIES = libguifications-x11.la
+
+libguifications_x11_la_SOURCES = \
+ gf_x11_display.c
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/x11/gf_x11_display.c Sun Dec 04 00:41:53 2011 -0600
@@ -0,0 +1,169 @@
+/*
+ * Guifications - The end all, be all, toaster popup plugin
+ * Copyright (C) 2003-2011 Gary Kramlich
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+#include <gdk/gdkx.h>
+#include <x11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+gboolean
+gf_display_get_workarea(GdkRectangle *rect) {
+ GdkDisplay *g_display = NULL;
+ GdkScreen *g_screen = NULL;
+ Screen *x_screen = NULL;
+ Atom xa_desktops, xa_current, xa_workarea, xa_type;
+ Display *x_display = NULL;
+ Window x_root;
+ guint32 desktops = 0, current = 0;
+ gulong *workareas, len, fill;
+ guchar *data;
+ gint format;
+
+ /* get the gdk display */
+ g_display = gdk_display_get_default();
+ if(!g_display)
+ return FALSE;
+
+ /* get the x display from the gdk display */
+ x_display = gdk_x11_display_get_xdisplay(g_display);
+ if(!x_display)
+ return FALSE;
+
+ /* get the screen according to the prefs */
+ g_screen = gdk_display_get_screen(g_display, disp_screen);
+ if(!g_screen)
+ return FALSE;
+
+ /* get the x screen from the gdk screen */
+ x_screen = gdk_x11_screen_get_xscreen(g_screen);
+ if(!x_screen)
+ return FALSE;
+
+ /* get the root window from the screen */
+ x_root = XRootWindowOfScreen(x_screen);
+
+ /* find the _NET_NUMBER_OF_DESKTOPS atom */
+ xa_desktops = XInternAtom(x_display, "_NET_NUMBER_OF_DESKTOPS", True);
+ if(xa_desktop == None)
+ return FALSE;
+
+ /* get the number of desktops */
+ if(XGetWindowProperty(x_display, x_root, xa_desktops, 0, 1, False,
+ XA_CARDINAL, &xa_type, &format, &len, &fill,
+ &data) != Success)
+ {
+ return FALSE;
+ }
+
+ if(!data)
+ return FALSE;
+
+ desktops = *(guint32 *)data;
+ XFree(data);
+
+ /* find the _NET_CURRENT_DESKTOP atom */
+ xa_current = XInternAtom(x_display, "_NET_CURRENT_DESKTOP", True);
+ if(xa_current == None)
+ return FALSE;
+
+ /* get the current desktop */
+ if(XGetWindowProperty(x_display, x_root, xa_current, 0, 1, False,
+ XA_CARDINAL, &xa_type, &format, &len, &fill,
+ &data) != Success)
+ {
+ return FALSE;
+ }
+
+ if(!data)
+ return FALSE;
+
+ current = *(guint32 *)data;
+ XFree(data);
+
+ /* find the _NET_WORKAREA atom */
+ xa_workarea = XInternAtom(x_display, "_NET_WORKAREA", True);
+ if(xa_workarea == None)
+ return FALSE;
+
+ if(XGetWindowProperty(x_display, x_root, xa_workarea, 0, (glong)(4 * 32),
+ False, AnyPropertyType, &xa_type, &format, &len,
+ &fill, &data) != Success)
+ {
+ return FALSE;
+ }
+
+ /* make sure the type and format are good */
+ if(xa_type == None || format == 0)
+ return FALSE;
+
+ /* make sure we don't have any leftovers */
+ if(fill)
+ return FALSE;
+
+ /* make sure len divides evenly by 4 */
+ if(len % 4 != 0)
+ return FALSE;
+
+ /* it's good, lets use it */
+ workareas = (gulong *)(guint32 *)data;
+
+ rect->x = (guint32)workareas[current * 4];
+ rect->y = (guint32)workareas[current * 4 + 1];
+ rect->width = (guint32)workareas[current * 4 + 2];
+ rect->height = (guint32)workareas[current * 4 + 3];
+
+ /* clean up our memory */
+ XFree(data);
+
+ return TRUE;
+}
+
+gboolean
+gf_display_screen_saver_is_running(void) {
+ static Atom xss, locked, blanked;
+ static gboolean init = FALSE;
+ Atom ratom;
+ gint rtatom;
+ guchar *data = NULL;
+ gulong items, padding;
+ gboolean ret = FALSE;
+
+ if(!init) {
+ xss = XInternAtom(GDK_DISPLAY(),"_SCREENSAVER_STATUS", FALSE);
+ locked = XInternAtom(GDK_DISPLAY(), "LOCK", FALSE);
+ blanked = XInternAtom(GDK_DISPLAY(), "BLANK", FALSE);
+ init = TRUE;
+ }
+
+ if(XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(), xss, 0, 999, FALSE,
+ XA_INTEGER, &ratom, &rtatom, &items, &padding, &data)
+ == Success)
+ {
+ if(ratom == XA_INTEGER || items >= 3) {
+ guint *item_data = (guint *)data;
+
+ if(item_data[0] == locked || item_data[0] == blanked)
+ ret = TRUE;
+ }
+
+ XFree(data);
+ }
+ return ret;
+
+}
+