tFixes for compilation under Win32. - vaccinewars - be a doctor and try to vacc… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 64b99d4dfee7b87fb0018d5525dbf16d4fe6cde7 | |
parent 0ac889465a748a4c92a1718dbb3d8618811838de | |
Author: Ben Webb <[email protected]> | |
Date: Mon, 25 Mar 2002 16:52:46 +0000 | |
Fixes for compilation under Win32. | |
Diffstat: | |
M src/Makefile.am | 1 + | |
M src/Makefile.in | 49 +----------------------------… | |
M src/gtkport/gtkport.c | 54 +++++++++++++++++++++++++++--… | |
M src/gtkport/gtkport.h | 62 +++++++++++++++++++++++++----… | |
4 files changed, 100 insertions(+), 66 deletions(-) | |
--- | |
diff --git a/src/Makefile.am b/src/Makefile.am | |
t@@ -20,6 +20,7 @@ endif | |
SUBDIRS = $(GUISUBDIR) $(CURSESSUBDIR) $(GTKPORTSUBDIR) $(CURSESPORTSUBDIR) | |
dopewars_LDADD = $(GUILIB) $(CURSESLIB) $(GTKPORTLIB) $(CURSESPORTLIB) @GTK_LI… | |
+dopewars_DEPENDENCIES = @WNDRES@ | |
bin_PROGRAMS = dopewars | |
dopewars_SOURCES = admin.c admin.h AIPlayer.c AIPlayer.h util.c util.h \ | |
diff --git a/src/Makefile.in b/src/Makefile.in | |
t@@ -111,6 +111,7 @@ localedir = @localedir@ | |
SUBDIRS = $(GUISUBDIR) $(CURSESSUBDIR) $(GTKPORTSUBDIR) $(CURSESPORTSUBDIR) | |
dopewars_LDADD = $(GUILIB) $(CURSESLIB) $(GTKPORTLIB) $(CURSESPORTLIB) @GTK_LI… | |
+dopewars_DEPENDENCIES = @WNDRES@ | |
bin_PROGRAMS = dopewars | |
dopewars_SOURCES = admin.c admin.h AIPlayer.c AIPlayer.h util.c util.h \ | |
t@@ -136,54 +137,6 @@ LDFLAGS = @LDFLAGS@ | |
LIBS = @LIBS@ | |
dopewars_OBJECTS = admin.o AIPlayer.o util.o dopewars.o error.o \ | |
message.o network.o serverside.o tstring.o winmain.o | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@dopewar… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@cursesp… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@dopewars… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@curses_c… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@cursespo… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewar… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_cli… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewars… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_clie… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@curses_c… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars_D… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_client… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@curses_cli… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/li… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@cursesport… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewars_… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_clien… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@curses_cl… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@cursespor… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@dopewar… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@curses_… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewars… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport/… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@cursespo… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_clie… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars_… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_clien… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/l… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@cursespor… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewar… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@dopewa… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewars… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@curses_c… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport/… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewars_… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@curses_cl… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport/l… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@cursespor… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewars… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_clie… | |
-@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@cursespo… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars_… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_clien… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@curses_cl… | |
-@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/l… | |
dopewars_LDFLAGS = | |
CFLAGS = @CFLAGS@ | |
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(… | |
diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c | |
t@@ -1609,12 +1609,16 @@ void gtk_window_set_size(GtkWidget *widget, GtkAllocat… | |
void gtk_button_size_request(GtkWidget *widget, | |
GtkRequisition *requisition) | |
{ | |
- SIZE size; | |
+ SIZE size, minsize; | |
GtkButton *but = GTK_BUTTON(widget); | |
gtk_container_size_request(widget, requisition); | |
- if (GetTextSize(widget->hWnd, but->text, &size, defFont)) { | |
+ /* Without minsize, an unexpanded "OK" button looks silly... */ | |
+ if (GetTextSize(widget->hWnd, but->text, &size, defFont) | |
+ && GetTextSize(widget->hWnd, "Cancel", &minsize, defFont)) { | |
+ size.cx = MAX(size.cx, minsize.cx); | |
+ size.cy = MAX(size.cy, minsize.cy); | |
requisition->width = size.cx + 15; | |
requisition->height = size.cy + 10; | |
} | |
t@@ -1999,6 +2003,11 @@ void gtk_box_pack_start(GtkBox *box, GtkWidget *child, … | |
} | |
} | |
+void gtk_box_pack_start_defaults(GtkBox *box, GtkWidget *child) | |
+{ | |
+ gtk_box_pack_start(box, child, FALSE, FALSE, 0); | |
+} | |
+ | |
void gtk_button_destroy(GtkWidget *widget) | |
{ | |
g_free(GTK_BUTTON(widget)->text); | |
t@@ -2295,16 +2304,16 @@ void gtk_window_realize(GtkWidget *widget) | |
resize = WS_SIZEBOX; | |
Parent = gtk_get_parent_hwnd(widget->parent); | |
- if (win->type == GTK_WINDOW_TOPLEVEL) { | |
+ if (Parent) { | |
+ widget->hWnd = CreateDialog(hInst, "gtkdialog", Parent, MainDlgProc); | |
+ SetWindowText(widget->hWnd, win->title); | |
+ } else { | |
widget->hWnd = CreateWindow("mainwin", win->title, | |
WS_OVERLAPPEDWINDOW | CS_HREDRAW | | |
CS_VREDRAW | resize, CW_USEDEFAULT, 0, 0, | |
0, Parent, NULL, hInst, NULL); | |
if (!TopLevel) | |
TopLevel = widget->hWnd; | |
- } else { | |
- widget->hWnd = CreateDialog(hInst, "gtkdialog", Parent, MainDlgProc); | |
- SetWindowText(widget->hWnd, win->title); | |
} | |
WindowList = g_slist_append(WindowList, (gpointer)win); | |
gtk_set_default_font(widget->hWnd); | |
t@@ -4980,6 +4989,39 @@ void gtk_timeout_remove(guint timeout_handler_id) | |
} | |
} | |
+GtkWidget *gtk_button_new_from_stock(const gchar *label) | |
+{ | |
+ return gtk_button_new_with_label(label); | |
+} | |
+ | |
+/* We don't really handle styles, so these are just placeholder functions */ | |
+static GtkStyle statstyle; | |
+GtkStyle *gtk_style_new(void) | |
+{ | |
+ return &statstyle; | |
+} | |
+ | |
+void gtk_widget_set_style(GtkWidget *widget, GtkStyle *style) | |
+{ | |
+} | |
+ | |
+static gint hbbox_spacing = 0; | |
+ | |
+GtkWidget *gtk_hbutton_box_new() | |
+{ | |
+ GtkWidget *hbbox, *spacer; | |
+ | |
+ hbbox = gtk_hbox_new(TRUE, hbbox_spacing); | |
+ spacer = gtk_label_new(""); | |
+ gtk_box_pack_start(GTK_BOX(hbbox), spacer, TRUE, TRUE, 0); | |
+ return hbbox; | |
+} | |
+ | |
+void gtk_hbutton_box_set_spacing_default(gint spacing) | |
+{ | |
+ hbbox_spacing = spacing; | |
+} | |
+ | |
#else /* CYGWIN */ | |
guint SetAccelerator(GtkWidget *labelparent, gchar *Text, | |
GtkWidget *sendto, gchar *signal, | |
diff --git a/src/gtkport/gtkport.h b/src/gtkport/gtkport.h | |
t@@ -41,6 +41,8 @@ | |
#define MYWM_TASKBAR (WM_USER+101) | |
#define MYWM_SERVICE (WM_USER+102) | |
+#define GDK_MOD1_MASK 0 | |
+ | |
extern HICON mainIcon; | |
typedef enum { | |
t@@ -53,6 +55,21 @@ typedef enum { | |
} GtkAccelFlags; | |
typedef enum { | |
+ GTK_BUTTONBOX_SPREAD, | |
+ GTK_BUTTONBOX_EDGE, | |
+ GTK_BUTTONBOX_START, | |
+ GTK_BUTTONBOX_END | |
+} GtkButtonBoxStyle; | |
+ | |
+typedef enum { | |
+ GTK_STATE_NORMAL, | |
+ GTK_STATE_ACTIVE, | |
+ GTK_STATE_PRELIGHT, | |
+ GTK_STATE_SELECTED, | |
+ GTK_STATE_INSENSITIVE | |
+} GtkStateType; | |
+ | |
+typedef enum { | |
GTK_VISIBILITY_NONE, | |
GTK_VISIBILITY_PARTIAL, | |
GTK_VISIBILITY_FULL | |
t@@ -128,6 +145,8 @@ typedef void (*GtkSignalMarshaller) (GtkObject *object, GS… | |
GtkSignalFunc default_action, | |
va_list args); | |
+typedef struct _GdkColor GdkColor; | |
+typedef struct _GtkStyle GtkStyle; | |
typedef struct _GtkMenuShell GtkMenuShell; | |
typedef struct _GtkMenuBar GtkMenuBar; | |
typedef struct _GtkMenuItem GtkMenuItem; | |
t@@ -156,6 +175,18 @@ struct _GtkSignalType { | |
GtkSignalFunc default_action; | |
}; | |
+struct _GdkColor { | |
+ gulong pixel; | |
+ gushort red; | |
+ gushort green; | |
+ gushort blue; | |
+}; | |
+ | |
+struct _GtkStyle { | |
+ GdkColor fg[5]; | |
+ GdkColor bg[5]; | |
+}; | |
+ | |
typedef gboolean (*GtkWndProc) (GtkWidget *widget, UINT msg, | |
WPARAM wParam, LPARAM lParam, gboolean *dodef); | |
t@@ -591,6 +622,7 @@ void gtk_table_set_row_spacings(GtkTable *table, guint spa… | |
void gtk_table_set_col_spacings(GtkTable *table, guint spacing); | |
void gtk_box_pack_start(GtkBox *box, GtkWidget *child, gboolean Expand, | |
gboolean Fill, gint Padding); | |
+void gtk_box_pack_start_defaults(GtkBox *box, GtkWidget *child); | |
void gtk_toggle_button_toggled(GtkToggleButton *toggle_button); | |
gboolean gtk_toggle_button_get_active(GtkToggleButton *toggle_button); | |
void gtk_toggle_button_set_active(GtkToggleButton *toggle_button, | |
t@@ -673,9 +705,13 @@ void gtk_paned_pack2(GtkPaned *paned, GtkWidget *child, g… | |
void gtk_paned_set_position(GtkPaned *paned, gint position); | |
#define gtk_container_border_width gtk_container_set_border_width | |
-#define gtk_hbutton_box_new() gtk_hbox_new(TRUE, 5) | |
+GtkWidget *gtk_hbutton_box_new(); | |
+void gtk_hbutton_box_set_spacing_default(gint spacing); | |
#define gtk_vbutton_box_new() gtk_vbox_new(TRUE, 5) | |
-GtkWidget *gtk_option_menu_new(); | |
+#define gtk_hbutton_box_set_layout_default(layout) {} | |
+#define gtk_vbutton_box_set_spacing_default(spacing) {} | |
+#define gtk_vbutton_box_set_layout_default(layout) {} | |
+GtkWidget *gtk_option_menu_new(void); | |
GtkWidget *gtk_option_menu_get_menu(GtkOptionMenu *option_menu); | |
void gtk_option_menu_set_menu(GtkOptionMenu *option_menu, GtkWidget *menu); | |
void gtk_option_menu_set_history(GtkOptionMenu *option_menu, guint index); | |
t@@ -703,6 +739,8 @@ BOOL GetTextSize(HWND hWnd, char *text, LPSIZE lpSize, HFO… | |
void gtk_container_realize(GtkWidget *widget); | |
void gtk_set_default_font(HWND hWnd); | |
HWND gtk_get_parent_hwnd(GtkWidget *widget); | |
+GtkStyle *gtk_style_new(void); | |
+void gtk_widget_set_style(GtkWidget *widget, GtkStyle *style); | |
/* Functions for handling emitted signals */ | |
void gtk_marshal_BOOL__GPOIN(GtkObject *object, GSList *actions, | |
t@@ -759,7 +797,16 @@ void gtk_container_set_size(GtkWidget *widget, GtkAllocat… | |
/* Other flags */ | |
#define MB_IMMRETURN 16 | |
-#ifndef HAVE_GLIB2 | |
+typedef struct _GtkUrl GtkUrl; | |
+ | |
+struct _GtkUrl { | |
+ GtkLabel *label; | |
+ gchar *target, *bin; | |
+}; | |
+ | |
+#endif /* CYGWIN */ | |
+ | |
+#if CYGWIN || !HAVE_GLIB2 | |
#define GTK_STOCK_OK _("OK") | |
#define GTK_STOCK_CLOSE _("Close") | |
#define GTK_STOCK_CANCEL _("Cancel") | |
t@@ -778,15 +825,6 @@ typedef enum | |
} GtkMessageType; | |
#endif | |
-typedef struct _GtkUrl GtkUrl; | |
- | |
-struct _GtkUrl { | |
- GtkLabel *label; | |
- gchar *target, *bin; | |
-}; | |
- | |
-#endif /* CYGWIN */ | |
- | |
/* Global functions */ | |
gint GtkMessageBox(GtkWidget *parent, const gchar *Text, | |
const gchar *Title, GtkMessageType type, gint Options); |