tFixes for compilation under Win32. - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 64b99d4dfee7b87fb0018d5525dbf16d4fe6cde7
 (DIR) parent 0ac889465a748a4c92a1718dbb3d8618811838de
 (HTM) Author: Ben Webb <ben@salilab.org>
       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(-)
       ---
 (DIR) 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_LIBS@ @INTLLIBS@ @WNDRES@
       +dopewars_DEPENDENCIES = @WNDRES@
        
        bin_PROGRAMS = dopewars
        dopewars_SOURCES = admin.c admin.h AIPlayer.c AIPlayer.h util.c util.h \
 (DIR) 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_LIBS@ @INTLLIBS@ @WNDRES@
       +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@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@cursesport/libcursesport.a
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@curses_client/libcursesclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@cursesport/libcursesport.a
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_client/libguiclient.a
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_client/libguiclient.a \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@curses_client/libcursesclient.a
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_client/libguiclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@curses_client/libcursesclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/libgtkport.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@cursesport/libcursesport.a
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_client/libguiclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@curses_client/libcursesclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@cursesport/libcursesport.a
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@curses_client/libcursesclient.a
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport/libgtkport.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@cursesport/libcursesport.a
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_client/libguiclient.a \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/libgtkport.a
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_client/libguiclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/libgtkport.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@cursesport/libcursesport.a
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport/libgtkport.a
       -@CURSESPORT_FALSE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_FALSE@@GTKPORT_FALSE@dopewars_DEPENDENCIES = 
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@curses_client/libcursesclient.a \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport/libgtkport.a
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@curses_client/libcursesclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@gtkport/libgtkport.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_FALSE@@GTKPORT_TRUE@cursesport/libcursesport.a
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@gui_client/libguiclient.a \
       -@CURSESPORT_TRUE@@CURSES_CLIENT_FALSE@@GUI_CLIENT_TRUE@@GTKPORT_FALSE@cursesport/libcursesport.a
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@dopewars_DEPENDENCIES =  \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gui_client/libguiclient.a \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@curses_client/libcursesclient.a \
       -@CURSESPORT_FALSE@@CURSES_CLIENT_TRUE@@GUI_CLIENT_TRUE@@GTKPORT_TRUE@gtkport/libgtkport.a
        dopewars_LDFLAGS = 
        CFLAGS = @CFLAGS@
        COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 (DIR) diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c
       t@@ -1609,12 +1609,16 @@ void gtk_window_set_size(GtkWidget *widget, GtkAllocation *allocation)
        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, gboolean Expand,
          }
        }
        
       +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,
 (DIR) 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, GSList *actions,
                                             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 spacing);
        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, gboolean resize,
        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, HFONT hFont);
        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, GtkAllocation *allocation);
        /* 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);