From d5df7dbd6b15ba513f6320d0c24b42c67d7842fd Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Tue, 23 Jul 2013 13:25:21 -0400 Subject: [PATCH] Support for i586-mingw32msvc target Replace gdkx.h include with gdkwin32.h --- configure.ac | 19 +++++++++---------- src/Makefile.am | 8 ++++++++ src/clock.c | 4 ---- src/dockapp.c | 13 ++++++++++++- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 85b50b0..f32cf2b 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index a7203f3..5969886 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/clock.c b/src/clock.c index 3045047..7f78008 100644 --- a/src/clock.c +++ b/src/clock.c @@ -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); } diff --git a/src/dockapp.c b/src/dockapp.c index f01c9f9..8ef6412 100644 --- a/src/dockapp.c +++ b/src/dockapp.c @@ -23,14 +23,20 @@ #include #include #include -#include +#ifdef WIN32 +# include +#else +# include +#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); -- 2.20.1