From 6994e1ad1095b775aa9aa5d28fcf1d0600487f52 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 11 Aug 2012 14:56:22 +0000 Subject: [PATCH] gtk: added framework for gtk window resize handling --- src/drivers/sdl/gui.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/drivers/sdl/gui.cpp b/src/drivers/sdl/gui.cpp index 97b7ee94..d30c80ee 100644 --- a/src/drivers/sdl/gui.cpp +++ b/src/drivers/sdl/gui.cpp @@ -2351,6 +2351,21 @@ gint handleMouseClick(GtkWidget* widget, GdkEvent *event, gpointer callback_data return 0; } +void handle_resize(GtkWindow* win, GdkEvent* event, gpointer data) +{ + // TODO this is a stub atm + // this should handle resizing so the emulation takes up as much + // of the GTK window as possible + + // get new window width/height + int width, height; + width = event->configure.width; + height = event->configure.height; + //printf("DEBUG: new window size: %dx%d\n", width, height); + + return; +} + int InitGTKSubsystem(int argc, char** argv) { GtkWidget* Menubar; @@ -2410,10 +2425,12 @@ int InitGTKSubsystem(int argc, char** argv) g_signal_connect(G_OBJECT(evbox), "button-press-event", G_CALLBACK(handleMouseClick), NULL); g_signal_connect(G_OBJECT(evbox), "button-release-event", G_CALLBACK(handleMouseClick), NULL); - g_signal_connect(MainWindow, "destroy-event", quit, NULL); // signal handlers g_signal_connect(MainWindow, "delete-event", quit, NULL); + g_signal_connect(MainWindow, "destroy-event", quit, NULL); + // resize handler + g_signal_connect(MainWindow, "configure-event", G_CALLBACK(handle_resize), NULL); gtk_widget_show_all(MainWindow);