--- a/.hgignore Sat Dec 03 23:17:21 2011 -0600
+++ b/.hgignore Sun Dec 04 00:41:53 2011 -0600
@@ -26,7 +26,6 @@
@@ -34,3 +33,4 @@
(pre|gf)_config.h(\.in)?$
config.(guess|log|status|sub)
--- 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 @@
-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)
+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 @@
--- 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 @@ -62,6 +64,14 @@
+guifications_la_LIBADD += x11/libguifications-x11.la +guifications_la_LIBADD += win32/libguifications-win32.la -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.
# define WINVER 0x0500 /* This is Windows 2000 */
@@ -163,243 +158,6 @@
/*******************************************************************************
- * 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) {
- Atom xa_desktops, xa_current, xa_workarea, xa_type;
- guint32 desktops = 0, current = 0;
- gulong *workareas, len, fill;
-# if !GTK_CHECK_VERSION(2,2,0)
- x_display = GDK_DISPLAY();
- x_root = XDefaultRootWindow(x_display);
-# else /* GTK 2.2.0 and up */
- /* 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, disp_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);
-# 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)
- /* get the number of desktops */
- if(XGetWindowProperty(x_display, x_root, xa_desktops, 0, 1, False,
- XA_CARDINAL, &xa_type, &format, &len, &fill,
- desktops = *(guint32 *)data;
- /* 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 */
- 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);
-/*******************************************************************************
* This is the default behavior of 2.0 and 1.x
@@ -1001,7 +759,7 @@
/* 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 @@
-gf_display_screen_saver_is_running() {
- static Atom xss, locked, blanked;
- static gboolean init = FALSE;
- xss = XInternAtom(GDK_DISPLAY(),"_SCREENSAVER_STATUS", FALSE);
- locked = XInternAtom(GDK_DISPLAY(), "LOCK", FALSE);
- blanked = XInternAtom(GDK_DISPLAY(), "BLANK", FALSE);
- if(XGetWindowProperty(GDK_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)
- if(!SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, (unsigned int) NULL,
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); #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 @@
+noinst_LTLIBRARIES = libguifications-win32.la +libguifications_win32_la_SOURCES = \ --- /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 + ******************************************************************************/ +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/x11/Makefile.am Sun Dec 04 00:41:53 2011 -0600
@@ -0,0 +1,11 @@
+noinst_LTLIBRARIES = libguifications-x11.la +libguifications_x11_la_SOURCES = \ --- /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. +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; + guint32 desktops = 0, current = 0; + 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, disp_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); + /* get the number of desktops */ + if(XGetWindowProperty(x_display, x_root, xa_desktops, 0, 1, False, + XA_CARDINAL, &xa_type, &format, &len, &fill, + desktops = *(guint32 *)data; + /* 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) { + static Atom xss, locked, blanked; + static gboolean init = FALSE; + xss = XInternAtom(GDK_DISPLAY(),"_SCREENSAVER_STATUS", FALSE); + locked = XInternAtom(GDK_DISPLAY(), "LOCK", FALSE); + blanked = XInternAtom(GDK_DISPLAY(), "BLANK", FALSE); + if(XGetWindowProperty(GDK_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)