tFix crash when trying to set dialog box texture - 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 f6e1f6dab594b9695e0e220c8b20ad9184019283
 (DIR) parent 5e1b6dffc76d08b7c479d420b46a66711538632d
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Wed, 11 Nov 2020 18:45:47 -0800
       
       Fix crash when trying to set dialog box texture
       
       Diffstat:
         M configure.ac                        |       2 +-
         M src/gtkport/gtkport.c               |      31 +++----------------------------
       
       2 files changed, 4 insertions(+), 29 deletions(-)
       ---
 (DIR) diff --git a/configure.ac b/configure.ac
       t@@ -113,7 +113,7 @@ if test "$CYGWIN" = "yes" ; then
           dnl Libraries and flags
           CFLAGS="$CFLAGS -mwindows $mscompat $nocyg"
           CPPFLAGS="$CPPFLAGS $nocyg"
       -   LIBS="$LIBS -lwsock32 -lcomctl32 -lmpr"
       +   LIBS="$LIBS -lwsock32 -lcomctl32 -luxtheme -lmpr"
           LDFLAGS="$LDFLAGS $nocyg"
        
           AM_PATH_GLIB_2_0(2.0.0, , [AC_MSG_ERROR(GLib is required)])
 (DIR) diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c
       t@@ -58,6 +58,7 @@ const gchar *GTK_STOCK_HELP = N_("_Help");
        #include <windows.h>
        #include <commctrl.h>
        #include <richedit.h>
       +#include <uxtheme.h>
        #include <shlwapi.h>
        
        #define LISTITEMVPACK  0
       t@@ -78,8 +79,6 @@ static const gchar *WC_GTKHPANED = "WC_GTKHPANED";
        static const gchar *WC_GTKDIALOG = "WC_GTKDIALOG";
        static const gchar *WC_GTKURL    = "WC_GTKURL";
        
       -static const int ETDT_ENABLETAB     = 0x6;
       -
        static void gtk_button_size_request(GtkWidget *widget,
                                            GtkRequisition *requisition);
        static void gtk_entry_size_request(GtkWidget *widget,
       t@@ -1204,30 +1203,6 @@ static gboolean CheckForXPControls(void)
          return retval;
        }
        
       -/*
       - * On systems with suitable DLLs, sets the background texture of the
       - * given dialog. dwFlags can be one or more of the ETDT_ constants.
       - */
       -static void myEnableThemeDialogTexture(HWND hWnd, DWORD dwFlags)
       -{
       -  typedef HRESULT (*ENABLETHEMEDIALOGTEXTUREPROC)(HWND hWnd, DWORD dwFlags);
       -  HINSTANCE module;
       -
       -  /* Dialog textures are only worth setting when using XP common controls */
       -  if (!HaveXPControls) return;
       -
       -  module = LoadLibrary("UXTHEME.DLL");
       -  if (module) {
       -    ENABLETHEMEDIALOGTEXTUREPROC func;
       -    func = (ENABLETHEMEDIALOGTEXTUREPROC)
       -               GetProcAddress(module, "EnableThemeDialogTexture");
       -    if (func) {
       -      func(hWnd, dwFlags);
       -    }
       -    FreeLibrary(module);
       -  }
       -}
       -
        void win32_init(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        char *MainIcon)
        {
       t@@ -4168,7 +4143,7 @@ void gtk_notebook_insert_page(GtkNotebook *notebook, GtkWidget *child,
          note_child->tabpage = myCreateDialog(hInst, "tabpage",
                                               gtk_get_parent_hwnd(widget->parent),
                                               MainDlgProc);
       -  myEnableThemeDialogTexture(note_child->tabpage, ETDT_ENABLETAB);
       +  EnableThemeDialogTexture(note_child->tabpage, ETDT_ENABLETAB);
          notebook->children =
              g_slist_insert(notebook->children, note_child, position);
          child->parent = GTK_WIDGET(notebook);
       t@@ -4240,7 +4215,7 @@ void gtk_notebook_realize(GtkWidget *widget)
              note_child->tabpage = myCreateDialog(hInst, "tabpage",
                                                   gtk_get_parent_hwnd(widget->parent),
                                                   MainDlgProc);
       -      myEnableThemeDialogTexture(note_child->tabpage, ETDT_ENABLETAB);
       +      EnableThemeDialogTexture(note_child->tabpage, ETDT_ENABLETAB);
              if (note_child->child) {
                gtk_widget_realize(note_child->child);
              }