X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Femugtk.c;h=4b256f96c08ad9b00b81b8caf3c36b38b793e141;hb=a38ca01fb692688a3579630649fe43162df5990f;hp=224bc938a9f974d7658b2379c23bdb4dc6f613c1;hpb=696410ca8d43542b2a1cd19e00498e9532495623;p=emu8051.git diff --git a/src/emugtk.c b/src/emugtk.c index 224bc93..4b256f9 100644 --- a/src/emugtk.c +++ b/src/emugtk.c @@ -49,20 +49,10 @@ static int running; static int running_function_tag; -static GtkWidget *mainwin; -extern struct app_config_t *cfg; +GtkWidget *mainwin; -/* Signal DestroyEvent */ -static void -WindowDestroyEvent(GtkWidget *widget, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_DestroyEvent(...)\n"); -#endif - - gtk_main_quit(); -} +extern struct app_config_t *cfg; /* Step out of running state */ static void @@ -245,18 +235,21 @@ AddMenu(void) /* Adding the 'Help' submenu */ HelpAddMenu(menu_bar); - gtk_widget_show_all(GTK_WIDGET(menu_bar)); - return menu_bar; } -static void +static int mainwin_configure_event(GtkWindow *window, GdkEvent *event, gpointer data) { - //event->configure.x; - //event->configure.y; cfg->win_width = event->configure.width; cfg->win_height = event->configure.height; + + /* + * Important: + * Returning false allows event to propagate to children. If not, they + * will not be resized when we resize the main window. + */ + return FALSE; } static void @@ -342,7 +335,7 @@ emugtk_window_init(void) /* Window DESTROY event. */ g_signal_connect(mainwin, "destroy", - G_CALLBACK(WindowDestroyEvent), NULL); + G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(mainwin), "configure-event", G_CALLBACK(mainwin_configure_event), NULL); @@ -455,6 +448,8 @@ main(int argc, char **argv) if (hex_file != NULL) emugtk_new_file(hex_file); + else + emugtk_Reset(); gtk_main();