Noticed that I forgot to get the x11 and win32 specific display files into the cmake build, so moved them into src/ and added them depending on the target
--- a/src/CMakeLists.txt Thu May 23 05:36:49 2013 -0500
+++ b/src/CMakeLists.txt Thu May 23 23:44:20 2013 -0500
@@ -48,6 +48,12 @@
+ list(APPEND SOURCES gf_win32_display.c) + list(APPEND SOURCES gf_x11_display.c) add_library(guifications MODULE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gf_win32_display.c Thu May 23 23:44:20 2013 -0500
@@ -0,0 +1,159 @@
+ * 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. +# define WINVER 0x0500 /* This is Windows 2000 */ +typedef HMONITOR WINAPI GF_MonitorFromRect(LPCRECT,DWORD); +typedef BOOL WINAPI GF_GetMonitorInfo(HMONITOR,LPMONITORINFO); +/******************************************************************************* + * Uses _NET_WORKAREA or SPI_GETWORKAREA to get the geometry of a screen + ******************************************************************************/ +win32_get_workarea_fallback(GdkRectangle *rect) { + if (SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, FALSE)) { + rect->width = rcWork.right - rcWork.left; + rect->height = rcWork.bottom - rcWork.top; + * This will only work on Win98+ and Win2K+ +win32_adjust_workarea_multi_monitor(GdkRectangle *rect) { + GF_GetMonitorInfo *the_GetMonitorInfo; + GF_MonitorFromRect *the_MonitorFromRect; + 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"))) { + if (!(the_MonitorFromRect = (GF_MonitorFromRect*) + GetProcAddress(hmod, "MonitorFromRect"))) { + if (!(the_GetMonitorInfo = (GF_GetMonitorInfo*) + GetProcAddress(hmod, "GetMonitorInfoA"))) { + monitor = the_MonitorFromRect(&monitorRect, MONITOR_DEFAULTTONEAREST); + info.cbSize = sizeof(info); + if (!the_GetMonitorInfo(monitor, &info)) { + 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; +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->height = GetSystemMetrics(SM_CXSCREEN); + rect->width = GetSystemMetrics(SM_CYSCREEN); +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); +gf_display_screen_saver_is_running(void) { + if(!SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, (unsigned int) NULL, --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gf_x11_display.c Thu May 23 23:44:20 2013 -0500
@@ -0,0 +1,164 @@
+ * 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. +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; + gulong *workareas, len, fill; + /* get the gdk display */ + g_display = gdk_display_get_default(); + /* get the x display from the gdk display */ + x_display = gdk_x11_display_get_xdisplay(g_display); + /* get the screen according to the prefs */ + g_screen = gdk_display_get_screen(g_display, gf_display_get_screen()); + /* get the x screen from the gdk screen */ + x_screen = gdk_x11_screen_get_xscreen(g_screen); + /* 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_desktops == None) + /* find the _NET_CURRENT_DESKTOP atom */ + xa_current = XInternAtom(x_display, "_NET_CURRENT_DESKTOP", True); + /* get the current desktop */ + if(XGetWindowProperty(x_display, x_root, xa_current, 0, 1, False, + XA_CARDINAL, &xa_type, &format, &len, &fill, + current = *(guint32 *)data; + /* find the _NET_WORKAREA atom */ + xa_workarea = XInternAtom(x_display, "_NET_WORKAREA", True); + if(xa_workarea == None) + if(XGetWindowProperty(x_display, x_root, xa_workarea, 0, (glong)(4 * 32), + False, AnyPropertyType, &xa_type, &format, &len, + &fill, &data) != Success) + /* make sure the type and format are good */ + if(xa_type == None || format == 0) + /* make sure we don't have any leftovers */ + /* make sure len divides evenly by 4 */ + /* 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 */ +gf_display_screen_saver_is_running(void) { + GdkDisplay *g_display = NULL; + Display *x_display = NULL; + static Atom xss, locked, blanked; + static gboolean init = FALSE; + g_display = gdk_display_get_default(); + x_display = gdk_x11_display_get_xdisplay(g_display); + xss = XInternAtom(x_display,"_SCREENSAVER_STATUS", FALSE); + locked = XInternAtom(x_display, "LOCK", FALSE); + blanked = XInternAtom(x_display, "BLANK", FALSE); + if(XGetWindowProperty(x_display, GDK_ROOT_WINDOW(), xss, 0, 999, FALSE, + XA_INTEGER, &ratom, &rtatom, &items, &padding, &data) + if(ratom == XA_INTEGER || items >= 3) { + guint *item_data = (guint *)data; + if(item_data[0] == locked || item_data[0] == blanked) --- a/src/win32/gf_win32_display.c Thu May 23 05:36:49 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
- * 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.
-# define WINVER 0x0500 /* This is Windows 2000 */
-typedef HMONITOR WINAPI GF_MonitorFromRect(LPCRECT,DWORD);
-typedef BOOL WINAPI GF_GetMonitorInfo(HMONITOR,LPMONITORINFO);
-/*******************************************************************************
- * Uses _NET_WORKAREA or SPI_GETWORKAREA to get the geometry of a screen
- ******************************************************************************/
-win32_get_workarea_fallback(GdkRectangle *rect) {
- if (SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, FALSE)) {
- rect->width = rcWork.right - rcWork.left;
- rect->height = rcWork.bottom - rcWork.top;
- * This will only work on Win98+ and Win2K+
-win32_adjust_workarea_multi_monitor(GdkRectangle *rect) {
- GF_GetMonitorInfo *the_GetMonitorInfo;
- GF_MonitorFromRect *the_MonitorFromRect;
- 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"))) {
- if (!(the_MonitorFromRect = (GF_MonitorFromRect*)
- GetProcAddress(hmod, "MonitorFromRect"))) {
- if (!(the_GetMonitorInfo = (GF_GetMonitorInfo*)
- GetProcAddress(hmod, "GetMonitorInfoA"))) {
- monitor = the_MonitorFromRect(&monitorRect, MONITOR_DEFAULTTONEAREST);
- info.cbSize = sizeof(info);
- if (!the_GetMonitorInfo(monitor, &info)) {
- 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;
-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->height = GetSystemMetrics(SM_CXSCREEN);
- rect->width = GetSystemMetrics(SM_CYSCREEN);
-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);
-gf_display_screen_saver_is_running(void) {
- if(!SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, (unsigned int) NULL,
--- a/src/x11/gf_x11_display.c Thu May 23 05:36:49 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
- * 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.
-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;
- gulong *workareas, len, fill;
- /* get the gdk display */
- g_display = gdk_display_get_default();
- /* get the x display from the gdk display */
- x_display = gdk_x11_display_get_xdisplay(g_display);
- /* get the screen according to the prefs */
- g_screen = gdk_display_get_screen(g_display, gf_display_get_screen());
- /* get the x screen from the gdk screen */
- x_screen = gdk_x11_screen_get_xscreen(g_screen);
- /* 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_desktops == None)
- /* find the _NET_CURRENT_DESKTOP atom */
- xa_current = XInternAtom(x_display, "_NET_CURRENT_DESKTOP", True);
- /* get the current desktop */
- if(XGetWindowProperty(x_display, x_root, xa_current, 0, 1, False,
- XA_CARDINAL, &xa_type, &format, &len, &fill,
- current = *(guint32 *)data;
- /* find the _NET_WORKAREA atom */
- xa_workarea = XInternAtom(x_display, "_NET_WORKAREA", True);
- if(xa_workarea == None)
- if(XGetWindowProperty(x_display, x_root, xa_workarea, 0, (glong)(4 * 32),
- False, AnyPropertyType, &xa_type, &format, &len,
- &fill, &data) != Success)
- /* make sure the type and format are good */
- if(xa_type == None || format == 0)
- /* make sure we don't have any leftovers */
- /* make sure len divides evenly by 4 */
- /* 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 */
-gf_display_screen_saver_is_running(void) {
- GdkDisplay *g_display = NULL;
- Display *x_display = NULL;
- static Atom xss, locked, blanked;
- static gboolean init = FALSE;
- g_display = gdk_display_get_default();
- x_display = gdk_x11_display_get_xdisplay(g_display);
- xss = XInternAtom(x_display,"_SCREENSAVER_STATUS", FALSE);
- locked = XInternAtom(x_display, "LOCK", FALSE);
- blanked = XInternAtom(x_display, "BLANK", FALSE);
- if(XGetWindowProperty(x_display, GDK_ROOT_WINDOW(), xss, 0, 999, FALSE,
- XA_INTEGER, &ratom, &rtatom, &items, &padding, &data)
- if(ratom == XA_INTEGER || items >= 3) {
- guint *item_data = (guint *)data;
- if(item_data[0] == locked || item_data[0] == blanked)