From a346acfccbb47efc4c87dbfea58775108628b5e9 Mon Sep 17 00:00:00 2001 From: plagman Date: Fri, 2 Jul 2010 01:26:56 +0000 Subject: [PATCH] Make the "Start" button of the GTK start-up window the default button of the window, which means pressing Enter now works at you'd expect. git-svn-id: https://svn.eduke32.com/eduke32@1664 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/dynamicgtk.h | 3 +++ polymer/eduke32/build/src/dynamicgtk.c | 1 + polymer/eduke32/source/startgtk.game.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/polymer/eduke32/build/include/dynamicgtk.h b/polymer/eduke32/build/include/dynamicgtk.h index e16c5bd9e..fd9ab1f8c 100644 --- a/polymer/eduke32/build/include/dynamicgtk.h +++ b/polymer/eduke32/build/include/dynamicgtk.h @@ -388,6 +388,8 @@ void (*gtk_window_set_title) (GtkWindow *window, const gchar *title); void (*gtk_window_set_type_hint) (GtkWindow *window, GdkWindowTypeHint hint); +void (*gtk_window_set_default) (GtkWindow *window, + GtkWidget *default_widget); // gunicode.h gint (*g_utf8_collate) (const gchar *str1, @@ -614,6 +616,7 @@ void dynamicgtk_uninit(void); #define gtk_window_set_resizable dynamicgtksyms.gtk_window_set_resizable #define gtk_window_set_title dynamicgtksyms.gtk_window_set_title #define gtk_window_set_type_hint dynamicgtksyms.gtk_window_set_type_hint +#define gtk_window_set_default dynamicgtksyms.gtk_window_set_default // gunicode.h #define g_utf8_collate dynamicgtksyms.g_utf8_collate diff --git a/polymer/eduke32/build/src/dynamicgtk.c b/polymer/eduke32/build/src/dynamicgtk.c index 82d213998..c8df161a7 100644 --- a/polymer/eduke32/build/src/dynamicgtk.c +++ b/polymer/eduke32/build/src/dynamicgtk.c @@ -159,6 +159,7 @@ int32_t dynamicgtk_init(void) GETDLSYM(gtk_window_set_resizable) GETDLSYM(gtk_window_set_title) GETDLSYM(gtk_window_set_type_hint) + GETDLSYM(gtk_window_set_default) GETDLSYM(g_utf8_collate) } while (0); diff --git a/polymer/eduke32/source/startgtk.game.c b/polymer/eduke32/source/startgtk.game.c index 4ecf60faf..680e656ea 100644 --- a/polymer/eduke32/source/startgtk.game.c +++ b/polymer/eduke32/source/startgtk.game.c @@ -691,6 +691,8 @@ static GtkWidget *create_window(void) gtk_container_add(GTK_CONTAINER(stwidgets.buttons), stwidgets.startbutton); GTK_WIDGET_SET_FLAGS(stwidgets.startbutton, GTK_CAN_DEFAULT); + gtk_window_set_default(GTK_WINDOW(stwidgets.startwin), stwidgets.startbutton); + stwidgets.startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_container_add(GTK_CONTAINER(stwidgets.startbutton), stwidgets.startbuttonalign);