More stuff from JonoF

git-svn-id: https://svn.eduke32.com/eduke32@197 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-01 12:00:26 +00:00
parent 12d768d9fd
commit 7c05f3eea6
18 changed files with 276 additions and 71 deletions

View file

@ -137,7 +137,7 @@ ifeq ($(RENDERTYPE),SDL)
ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)gtkbits.$o
ENGINEOBJS+= $(OBJ)gtkbits.$o $(OBJ)dynamicgtk.$o
EDITOROBJS+= $(OBJ)startgtk.editor.$o
GAMEEXEOBJS+= $(OBJ)game_banner.$o $(OBJ)startgtk.game.$o
EDITOREXEOBJS+= $(OBJ)editor_banner.$o

View file

@ -27,7 +27,8 @@ $(OBJ)scriptfile.$o: $(SRC)scriptfile.c $(INC)scriptfile.h $(INC)cache1d.h $(INC
$(OBJ)sdlayer.$o: $(SRC)sdlayer.c $(INC)compat.h $(INC)sdlayer.h $(INC)baselayer.h $(INC)cache1d.h $(INC)pragmas.h $(INC)a.h $(INC)build.h $(INC)osd.h $(INC)glbuild.h
$(OBJ)sound.$o: $(SRC)sound.c $(INC)osd.h $(INC)compat.h $(INC)cache1d.h
$(OBJ)winlayer.$o: $(SRC)winlayer.c $(INC)compat.h $(INC)winlayer.h $(INC)baselayer.h $(INC)pragmas.h $(INC)build.h $(INC)a.h $(INC)osd.h $(INC)dxdidf.h $(INC)glbuild.h
$(OBJ)gtkbits.$o: $(SRC)gtkbits.c $(INC)baselayer.h $(INC)build.h
$(OBJ)gtkbits.$o: $(SRC)gtkbits.c $(INC)baselayer.h $(INC)build.h $(INC)dynamicgtk.h
$(OBJ)dynamicgtk.$o: $(SRC)dynamicgtk.c $(INC)dynamicgtk.h
$(OBJ)gameres.$(res): $(SRC)misc/gameres.rc $(SRC)startwin.game.h
$(OBJ)buildres.$(res): $(SRC)misc/buildres.rc $(INC)startwin.editor.h

View file

@ -52,7 +52,10 @@ ifeq ($(PLATFORM),LINUX)
# on my 64bit Gentoo these are the 32bit emulation libs
LIBS+= -m32 -L/emul/linux/x86/usr/lib
BUILDCFLAGS+= -m32
override WITHOUT_GTK=1
#override WITHOUT_GTK=0
GTKCOMPAT32=1
else
GTKCOMPAT32=0
endif
endif
ifeq ($(PLATFORM),WINDOWS)
@ -108,7 +111,14 @@ ifeq ($(RENDERTYPE),SDL)
else
ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No))
HAVE_GTK2=1
LIBS+= $(shell pkg-config --libs gtk+-2.0)
# on my 64bit Gentoo box I have Cairo enabled which means the libs list includes
# -lpangocairo-1.0 and -lcairo, however the 32bit compatibility libraries don't
# include cairo, so we need to filter out those -l switches in order to link
ifeq ($(GTKCOMPAT32),1)
# LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g')
else
# LIBS+= $(shell pkg-config --libs gtk+-2.0)
endif
else
HAVE_GTK2=0
endif

View file

@ -307,7 +307,7 @@ int app_main(int argc, char **argv)
if ((i = ExtInit()) < 0) return -1;
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
if (i || forcesetup || cmdsetup) {
if (!startwin_run()) return -1;
if (quitevent || !startwin_run()) return -1;
}
#endif

View file

@ -140,7 +140,7 @@ if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i);
if (Batoi(val) != 0) glusetexcachecompression = 1;
else glusetexcachecompression = 0;
}
if(glusetexcache == -1 && glusetexcachecompression == -1)
if(glusetexcache == -1 || glusetexcachecompression == -1)
{
i=wm_ynbox("Texture caching",
"Would you like to enable the on-disk texture cache? "

146
polymer/build/src/dynamicgtk.c Executable file
View file

@ -0,0 +1,146 @@
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#define __dynamicgtkfoo__
#include "dynamicgtk.h"
static void *handle = NULL;
struct _dynamicgtksyms dynamicgtksyms;
#define GETDLSYM(x) { \
dynamicgtksyms.x = dlsym(handle, (failsym = (const char *)#x)); \
if (!dynamicgtksyms.x ) { err = 1; break; } \
}
int dynamicgtk_init(void)
{
int err = 0;
const char *failsym = NULL;
if (handle) return 1;
handle = dlopen("libgtk-x11-2.0.so", RTLD_NOW|RTLD_GLOBAL);
if (!handle) return 0;
memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms));
do {
GETDLSYM(g_object_get_data)
GETDLSYM(g_object_set_data)
GETDLSYM(g_object_set_data_full)
GETDLSYM(g_object_unref)
GETDLSYM(g_signal_connect_data)
GETDLSYM(g_signal_handlers_block_matched)
GETDLSYM(g_signal_handlers_unblock_matched)
GETDLSYM(g_type_check_instance_cast)
GETDLSYM(gdk_pixbuf_from_pixdata)
GETDLSYM(gdk_pixbuf_new_from_data)
GETDLSYM(gtk_accel_group_new)
GETDLSYM(gtk_alignment_new)
GETDLSYM(gtk_box_get_type)
GETDLSYM(gtk_box_pack_start)
GETDLSYM(gtk_button_box_get_type)
GETDLSYM(gtk_button_box_set_layout)
GETDLSYM(gtk_button_new)
GETDLSYM(gtk_cell_layout_get_type)
GETDLSYM(gtk_cell_layout_pack_start)
GETDLSYM(gtk_cell_layout_set_attributes)
GETDLSYM(gtk_cell_renderer_text_new)
GETDLSYM(gtk_check_button_new_with_mnemonic)
GETDLSYM(gtk_combo_box_get_active_iter)
GETDLSYM(gtk_combo_box_get_model)
GETDLSYM(gtk_combo_box_get_type)
GETDLSYM(gtk_combo_box_new_text)
GETDLSYM(gtk_combo_box_new_with_model)
GETDLSYM(gtk_combo_box_set_active_iter)
GETDLSYM(gtk_container_add)
GETDLSYM(gtk_container_foreach)
GETDLSYM(gtk_container_get_type)
GETDLSYM(gtk_container_set_border_width)
GETDLSYM(gtk_dialog_get_type)
GETDLSYM(gtk_dialog_run)
GETDLSYM(gtk_fixed_get_type)
GETDLSYM(gtk_fixed_new)
GETDLSYM(gtk_fixed_put)
GETDLSYM(gtk_hbox_new)
GETDLSYM(gtk_hbutton_box_new)
GETDLSYM(gtk_image_new_from_pixbuf)
GETDLSYM(gtk_image_new_from_stock)
GETDLSYM(gtk_init_check)
GETDLSYM(gtk_label_get_type)
GETDLSYM(gtk_label_new)
GETDLSYM(gtk_label_new_with_mnemonic)
GETDLSYM(gtk_label_set_mnemonic_widget)
GETDLSYM(gtk_list_store_append)
GETDLSYM(gtk_list_store_clear)
GETDLSYM(gtk_list_store_get_type)
GETDLSYM(gtk_list_store_new)
GETDLSYM(gtk_list_store_set)
GETDLSYM(gtk_main)
GETDLSYM(gtk_main_iteration_do)
GETDLSYM(gtk_main_quit)
GETDLSYM(gtk_message_dialog_new)
GETDLSYM(gtk_misc_get_type)
GETDLSYM(gtk_misc_set_alignment)
GETDLSYM(gtk_notebook_get_nth_page)
GETDLSYM(gtk_notebook_get_type)
GETDLSYM(gtk_notebook_new)
GETDLSYM(gtk_notebook_set_current_page)
GETDLSYM(gtk_notebook_set_tab_label)
GETDLSYM(gtk_object_get_type)
GETDLSYM(gtk_scrolled_window_get_type)
GETDLSYM(gtk_scrolled_window_new)
GETDLSYM(gtk_scrolled_window_set_policy)
GETDLSYM(gtk_text_buffer_backspace)
GETDLSYM(gtk_text_buffer_create_mark)
GETDLSYM(gtk_text_buffer_delete_mark)
GETDLSYM(gtk_text_buffer_get_end_iter)
GETDLSYM(gtk_text_buffer_insert)
GETDLSYM(gtk_text_view_get_buffer)
GETDLSYM(gtk_text_view_get_type)
GETDLSYM(gtk_text_view_new)
GETDLSYM(gtk_text_view_scroll_to_mark)
GETDLSYM(gtk_text_view_set_cursor_visible)
GETDLSYM(gtk_text_view_set_editable)
GETDLSYM(gtk_text_view_set_left_margin)
GETDLSYM(gtk_text_view_set_right_margin)
GETDLSYM(gtk_text_view_set_wrap_mode)
GETDLSYM(gtk_toggle_button_get_active)
GETDLSYM(gtk_toggle_button_get_type)
GETDLSYM(gtk_toggle_button_set_active)
GETDLSYM(gtk_tree_model_get)
GETDLSYM(gtk_tree_model_get_type)
GETDLSYM(gtk_vbox_new)
GETDLSYM(gtk_widget_add_accelerator)
GETDLSYM(gtk_widget_destroy)
GETDLSYM(gtk_widget_ref)
GETDLSYM(gtk_widget_set_sensitive)
GETDLSYM(gtk_widget_set_size_request)
GETDLSYM(gtk_widget_show)
GETDLSYM(gtk_widget_unref)
GETDLSYM(gtk_window_add_accel_group)
GETDLSYM(gtk_window_get_type)
GETDLSYM(gtk_window_new)
GETDLSYM(gtk_window_set_default_icon)
GETDLSYM(gtk_window_set_position)
GETDLSYM(gtk_window_set_resizable)
GETDLSYM(gtk_window_set_title)
GETDLSYM(gtk_window_set_type_hint)
} while (0);
if (err) {
//printf("Failed fetching symbol %s from GTK lib\n", failsym);
dlclose(handle);
handle = NULL;
return -1;
}
return 0;
}
void dynamicgtk_uninit(void)
{
if (handle) dlclose(handle);
handle = NULL;
memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms));
}

View file

@ -434,7 +434,7 @@ long app_main(long argc, char *argv[])
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
if (i || forcesetup || cmdsetup) {
if (!startwin_run()) return -1;
if (quitevent || !startwin_run()) return -1;
}
#endif
writesetup("game.cfg");

View file

@ -13,6 +13,10 @@
#include "baselayer.h"
#include "build.h"
#ifndef LINKED_GTK
# include "dynamicgtk.h"
#endif
int gtkenabled = 0;
static GdkPixbuf *appicon = NULL;
@ -61,6 +65,13 @@ extern struct sdlappicon sdlappicon;
#endif
void gtkbuild_init(int *argc, char ***argv)
{
#ifndef LINKED_GTK
gtkenabled = dynamicgtk_init();
if (gtkenabled < 0) {
gtkenabled = 0;
return;
}
#endif
gtkenabled = gtk_init_check(argc, argv);
if (!gtkenabled) return;
#ifdef RENDERTYPESDL
@ -73,7 +84,10 @@ void gtkbuild_init(int *argc, char ***argv)
void gtkbuild_exit(int r)
{
if (!gtkenabled) return;
if (gtkenabled) {
if (appicon) g_object_unref((gpointer)appicon);
//gtk_exit(r);
}
#ifndef LINKED_GTK
dynamicgtk_uninit();
#endif
}

View file

@ -295,6 +295,7 @@
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_cancelbutton_clicked" last_modification_time="Fri, 30 Jun 2006 05:13:27 GMT"/>
<accelerator key="C" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
<accelerator key="Escape" modifiers="0" signal="clicked"/>
<child>
<widget class="GtkAlignment" id="cancelbuttonalign">
@ -367,6 +368,7 @@
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_startbutton_clicked" last_modification_time="Fri, 30 Jun 2006 05:13:37 GMT"/>
<accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
<accelerator key="Return" modifiers="0" signal="clicked"/>
<child>
<widget class="GtkAlignment" id="startbuttonalign">

View file

@ -15,6 +15,10 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#ifndef LINKED_GTK
# include "dynamicgtk.h"
#endif
#include "baselayer.h"
#include "compat.h"
#include "build.h"
@ -33,7 +37,7 @@ static struct {
extern int gtkenabled;
static GtkWidget *startwin = NULL;
static int retval = -1, mode = 0;
static int retval = -1, mode = TAB_MESSAGES;
// -- SUPPORT FUNCTIONS -------------------------------------------------------
@ -56,17 +60,14 @@ static GdkPixbuf *load_banner(void)
static void SetPage(int n)
{
if (!gtkenabled || !startwin) return;
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
}
static void EnableConfig(int n)
{
// each control in the config page vertical layout plus the dialogue buttons should be made (in)sensitive
mode = n;
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"buttons")),
(GtkCallback)gtk_widget_set_sensitive, (gpointer)mode);
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
// each control in the config page vertical layout plus the start button should be made (in)sensitive
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
(GtkCallback)gtk_widget_set_sensitive, (gpointer)mode);
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
}
static void on_vmode2dcombo_changed(GtkComboBox *, gpointer);
@ -168,8 +169,8 @@ static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer u
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
{
retval = 0;
gtk_main_quit();
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
}
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
@ -180,7 +181,8 @@ static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
//quitevent++;
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
}
@ -373,6 +375,9 @@ static GtkWidget *create_window(void)
gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group,
GDK_C, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
GDK_Escape, 0,
GTK_ACCEL_VISIBLE);
cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (cancelbuttonalign);
@ -398,6 +403,9 @@ static GtkWidget *create_window(void)
gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group,
GDK_S, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
GDK_Return, 0,
GTK_ACCEL_VISIBLE);
startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (startbuttonalign);
@ -487,7 +495,6 @@ int startwin_open(void)
startwin = create_window();
if (startwin) {
SetPage(TAB_MESSAGES);
EnableConfig(FALSE);
gtk_widget_show(startwin);
gtk_main_iteration_do(FALSE);
return 0;
@ -577,7 +584,6 @@ int startwin_run(void)
if (!startwin) return 1;
SetPage(TAB_CONFIG);
EnableConfig(TRUE);
settings.fullscreen = fullscreen;
settings.xdim2d = xdim2d;
@ -591,7 +597,6 @@ int startwin_run(void)
gtk_main();
SetPage(TAB_MESSAGES);
EnableConfig(FALSE);
if (retval) {
fullscreen = settings.fullscreen;
xdim2d = settings.xdim2d;

View file

@ -15,6 +15,10 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#ifndef LINKED_GTK
# include "dynamicgtk.h"
#endif
#include "baselayer.h"
#include "compat.h"
#include "build.h"
@ -31,7 +35,7 @@ static struct {
extern int gtkenabled;
static GtkWidget *startwin = NULL;
static int retval = -1, mode = 0;
static int retval = -1, mode = TAB_MESSAGES;
// -- SUPPORT FUNCTIONS -------------------------------------------------------
@ -54,17 +58,14 @@ static GdkPixbuf *load_banner(void)
static void SetPage(int n)
{
if (!gtkenabled || !startwin) return;
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
}
static void EnableConfig(int n)
{
// each control in the config page vertical layout plus the dialogue buttons should be made (in)sensitive
mode = n;
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"buttons")),
(GtkCallback)gtk_widget_set_sensitive, (gpointer)mode);
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
// each control in the config page vertical layout plus the start button should be made (in)sensitive
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
(GtkCallback)gtk_widget_set_sensitive, (gpointer)mode);
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
}
static void on_vmode3dcombo_changed(GtkComboBox *, gpointer);
@ -137,8 +138,8 @@ static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer u
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
{
retval = 0;
gtk_main_quit();
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
}
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
@ -149,7 +150,8 @@ static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
//quitevent++;
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
}
@ -314,6 +316,9 @@ static GtkWidget *create_window(void)
gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group,
GDK_C, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
GDK_Escape, 0,
GTK_ACCEL_VISIBLE);
cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (cancelbuttonalign);
@ -339,6 +344,9 @@ static GtkWidget *create_window(void)
gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group,
GDK_S, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
GDK_Return, 0,
GTK_ACCEL_VISIBLE);
startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (startbuttonalign);
@ -422,7 +430,6 @@ int startwin_open(void)
startwin = create_window();
if (startwin) {
SetPage(TAB_MESSAGES);
EnableConfig(FALSE);
gtk_widget_show(startwin);
gtk_main_iteration_do(FALSE);
return 0;
@ -514,7 +521,6 @@ int startwin_run(void)
if (!startwin) return 1;
SetPage(TAB_CONFIG);
EnableConfig(TRUE);
settings.fullscreen = fullscreen;
settings.xdim3d = xdimgame;
@ -526,7 +532,6 @@ int startwin_run(void)
gtk_main();
SetPage(TAB_MESSAGES);
EnableConfig(FALSE);
if (retval) {
fullscreen = settings.fullscreen;
xdimgame = settings.xdim3d;

View file

@ -28,7 +28,7 @@ static struct {
static HWND startupdlg = NULL;
static HWND pages[2] = { NULL, NULL};
static int done = -1;
static int done = -1, mode = TAB_CONFIG;
static void PopulateForm(void)
{
@ -131,13 +131,14 @@ static void SetPage(int n)
ShowWindow(pages[cur],SW_HIDE);
SendMessage(tab, TCM_SETCURSEL, n, 0);
ShowWindow(pages[n],SW_SHOW);
mode = n;
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
}
static void EnableConfig(int n)
{
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE), n);
@ -271,7 +272,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
}
case WM_CLOSE:
done = 0;
if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE;
case WM_DESTROY:
@ -290,7 +292,10 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
case WM_COMMAND:
switch (LOWORD(wParam)) {
case WIN_STARTWIN_CANCEL: done = 0; return TRUE;
case WIN_STARTWIN_CANCEL:
if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE;
case WIN_STARTWIN_START: done = 1; return TRUE;
}
return FALSE;

View file

@ -26,7 +26,7 @@ static struct {
static HWND startupdlg = NULL;
static HWND pages[2] = { NULL, NULL};
static int done = -1;
static int done = -1, mode = TAB_CONFIG;
static void PopulateForm(void)
{
@ -107,13 +107,14 @@ static void SetPage(int n)
ShowWindow(pages[cur],SW_HIDE);
SendMessage(tab, TCM_SETCURSEL, n, 0);
ShowWindow(pages[n],SW_SHOW);
mode = n;
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
}
static void EnableConfig(int n)
{
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE), n);
@ -246,7 +247,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
}
case WM_CLOSE:
done = 0;
if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE;
case WM_DESTROY:
@ -265,7 +267,10 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
case WM_COMMAND:
switch (LOWORD(wParam)) {
case WIN_STARTWIN_CANCEL: done = 0; return TRUE;
case WIN_STARTWIN_CANCEL:
if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE;
case WIN_STARTWIN_START: done = 1; return TRUE;
}
return FALSE;

View file

@ -623,7 +623,7 @@ int32 CONFIG_ReadSetup( void )
glusetexcache = glusetexcachecompression = -1;
SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache);
SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLUseTextureCacheCompression", &glusetexcachecompression);
if(glusetexcache == -1 && glusetexcachecompression == -1)
if(glusetexcache == -1 || glusetexcachecompression == -1)
{
i=wm_ynbox("Texture caching",
"Would you like to enable the on-disk texture cache? "

View file

@ -8535,8 +8535,8 @@ void Startup(void)
}
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
if (i < 0 || ForceSetup || CommandSetup) {
if (!startwin_run()) {
if (i < 0 || (netparamcount == 0 && ForceSetup) || CommandSetup) {
if (quitevent | !startwin_run()) {
uninitengine();
freeconmem();
exit(0);

View file

@ -396,6 +396,7 @@
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_cancelbutton_clicked" last_modification_time="Fri, 30 Jun 2006 05:13:27 GMT"/>
<accelerator key="C" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
<accelerator key="Escape" modifiers="0" signal="clicked"/>
<child>
<widget class="GtkAlignment" id="cancelbuttonalign">
@ -468,6 +469,7 @@
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_startbutton_clicked" last_modification_time="Fri, 30 Jun 2006 05:13:37 GMT"/>
<accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
<accelerator key="Return" modifiers="0" signal="clicked"/>
<child>
<widget class="GtkAlignment" id="startbuttonalign">

View file

@ -15,6 +15,10 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#ifndef LINKED_GTK
# include "dynamicgtk.h"
#endif
#include "duke3d.h"
#include "build.h"
#include "compat.h"
@ -33,7 +37,7 @@ static struct {
extern int gtkenabled;
static GtkWidget *startwin = NULL;
static int retval = -1, mode = 0;
static int retval = -1, mode = TAB_MESSAGES;
// -- SUPPORT FUNCTIONS -------------------------------------------------------
@ -56,17 +60,14 @@ static GdkPixbuf *load_banner(void)
static void SetPage(int n)
{
if (!gtkenabled || !startwin) return;
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
}
static void EnableConfig(int n)
{
// each control in the config page vertical layout plus the dialogue buttons should be made (in)sensitive
mode = n;
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"buttons")),
(GtkCallback)gtk_widget_set_sensitive, (gpointer)mode);
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
// each control in the config page vertical layout plus the start button should be made (in)sensitive
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
(GtkCallback)gtk_widget_set_sensitive, (gpointer)mode);
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
}
static void on_vmode3dcombo_changed(GtkComboBox *, gpointer);
@ -142,8 +143,8 @@ static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer u
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
{
retval = 0;
gtk_main_quit();
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
}
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
@ -172,7 +173,8 @@ static void on_inputjoycheck_toggled(GtkToggleButton *togglebutton, gpointer use
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
//quitevent++;
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
else quitevent++;
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
}
@ -391,6 +393,9 @@ static GtkWidget *create_window(void)
gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group,
GDK_C, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
GDK_Escape, 0,
GTK_ACCEL_VISIBLE);
cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (cancelbuttonalign);
@ -416,6 +421,9 @@ static GtkWidget *create_window(void)
gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group,
GDK_S, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
GDK_Return, 0,
GTK_ACCEL_VISIBLE);
startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (startbuttonalign);
@ -520,7 +528,6 @@ int startwin_open(void)
startwin = create_window();
if (startwin) {
SetPage(TAB_MESSAGES);
EnableConfig(FALSE);
gtk_widget_show(startwin);
gtk_main_iteration_do(FALSE);
return 0;
@ -612,7 +619,6 @@ int startwin_run(void)
if (!startwin) return 1;
SetPage(TAB_CONFIG);
EnableConfig(TRUE);
settings.fullscreen = ScreenMode;
settings.xdim3d = ScreenWidth;
@ -626,7 +632,6 @@ int startwin_run(void)
gtk_main();
SetPage(TAB_MESSAGES);
EnableConfig(FALSE);
if (retval) {
ScreenMode = settings.fullscreen;
ScreenWidth = settings.xdim3d;

View file

@ -29,7 +29,7 @@ static struct {
static HWND startupdlg = NULL;
static HWND pages[2] = { NULL, NULL};
static int done = -1;
static int done = -1, mode = TAB_CONFIG;
static void PopulateForm(void)
{
@ -119,13 +119,14 @@ static void SetPage(int n)
ShowWindow(pages[cur],SW_HIDE);
SendMessage(tab, TCM_SETCURSEL, n, 0);
ShowWindow(pages[n],SW_SHOW);
mode = n;
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
}
static void EnableConfig(int n)
{
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCVMODE), n);
@ -260,7 +261,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
}
case WM_CLOSE:
done = 0;
if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE;
case WM_DESTROY:
@ -279,7 +281,10 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
case WM_COMMAND:
switch (LOWORD(wParam)) {
case WIN_STARTWIN_CANCEL: done = 0; return TRUE;
case WIN_STARTWIN_CANCEL:
if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE;
case WIN_STARTWIN_START: done = 1; return TRUE;
}
return FALSE;