Support for i586-mingw32msvc target win32
authorHugo Villeneuve <hugo@hugovil.com>
Tue, 23 Jul 2013 17:25:21 +0000 (13:25 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Sun, 24 Apr 2016 22:32:29 +0000 (18:32 -0400)
Replace gdkx.h include with gdkwin32.h

configure.ac
src/Makefile.am
src/clock.c
src/dockapp.c

index 85b50b0..f32cf2b 100644 (file)
@@ -1,5 +1,8 @@
 # configure.ac -- Process this file with autoconf to produce configure.
 
+# For WIN32 cross-compilation:
+# ./configure --host=i586-mingw32msvc
+
 dnl Initialization stuff.
 AC_INIT(hvclock, 1.1.2)
 AC_CONFIG_AUX_DIR([build-aux])
@@ -22,16 +25,12 @@ AC_TYPE_SIZE_T
 dnl Basic warning CFLAGS values
 WARNINGCFLAGS="-Wall -Wextra -Wformat -Wformat-security"
 
-dnl Trying to locate the X window system's includes and libraries, and sets the
-dnl variables x_includes and x_libraries to their locations. Also adds the
-dnl required include flags to X_CFLAGS and required linking flags to X_LIBS.
-AC_PATH_XTRA
-CFLAGS="${CFLAGS} ${X_CFLAGS}"
-LIBS="${LIBS} ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}"
-
-dnl Checking for X11 library.
-AC_CHECK_LIB(X11, XOpenDisplay, LIBS="${LIBS} -lX11",
-             echo "Can't find X11 library" ; exit 1, "${X_LIBS}")
+case "${host}" in
+        i[[3456789]]86-pc-mingw32*) WIN32="yes" ;;
+        *cygwin*) WIN32="yes" ;;
+        *) WIN32="no" ;;
+esac
+AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
 
 dnl --with-gtk3 option
 with_gtk3=no
index a7203f3..5969886 100644 (file)
@@ -16,6 +16,14 @@ hvclock_SOURCES = \
 
 LDADD = $(GTK_LIBS)
 
+if WIN32
+hvclock_CPPFLAGS += \
+    -mms-bitfields
+
+hvclock_LDFLAGS = \
+    -Wl,-subsystem,windows
+endif
+
 CLEANFILES = *~
 
 MAINTAINERCLEANFILES = Makefile.in
index 3045047..7f78008 100644 (file)
@@ -36,8 +36,6 @@
 #include "clock.h"
 #include "hvclock.h"
 #include "dockapp.h"
-#include "clock-mask.xpm"
-#include "calendar-mask.xpm"
 
 /* Constants */
 #define CLOCK_MODE    0
@@ -407,11 +405,9 @@ draw_handler(GtkWidget *clock, cairo_t *cr, gpointer d G_GNUC_UNUSED)
 #endif
 
        if (hvclock_mode == CLOCK_MODE) {
-               dockapp_set_mask(clock, clock_mask_xpm);
                draw_clock_background(clock, cr);
                draw_clock_hands(clock, cr);
        } else {
-               dockapp_set_mask(clock, calendar_mask_xpm);
                draw_calendar(clock, cr);
        }
 
index f01c9f9..8ef6412 100644 (file)
 #include <ctype.h>
 #include <stdarg.h>
 #include <gtk/gtk.h>
-#include <gdk/gdkx.h>
+#ifdef WIN32
+#  include <gdk/gdkwin32.h>
+#else
+#  include <gdk/gdkx.h>
+#endif /* WIN32 */
 
 #include "common.h"
 #include "clock.h"
 #include "hvclock.h"
 #include "dockapp.h"
 
+#ifndef WIN32
 #define GTK_WITHDRAWN_HACK 1
+#endif /* WIN32 */
 
 /* Width and height in pixels of Window Maker icons. */
 #define ICON_SIZE 64
@@ -160,7 +166,12 @@ dockapp_init(int argc, char *argv[])
        gtk_init(&argc, &argv);
 
        dockwin = dockapp_win_init(GTK_WINDOW_TOPLEVEL);
+
+#ifdef WIN32
+       iconwin = dockapp_win_init(GTK_WINDOW_TOPLEVEL);
+#else
        iconwin = dockapp_win_init(GTK_WINDOW_POPUP);
+#endif /* WIN32 */
 
        gtk_window_set_default_size(GTK_WINDOW(dockwin), ICON_SIZE, ICON_SIZE);
        g_signal_connect(dockwin, "destroy", G_CALLBACK(gtk_main_quit), NULL);