Search
lxdream.org :: lxdream/src/gui/main_win.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gui/main_win.c
changeset 497:cd6e10c2e96b
prev486:9af294489aad
author nkeynes
date Thu Nov 08 10:46:41 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Tweak fullscreen handling to ensure safety in the event of wm misbehaviour
file annotate diff log raw
1.1 --- a/src/gui/main_win.c Fri Nov 02 08:22:33 2007 +0000
1.2 +++ b/src/gui/main_win.c Thu Nov 08 10:46:41 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: main_win.c,v 1.9 2007-11-02 08:22:33 nkeynes Exp $
1.6 + * $Id: main_win.c,v 1.10 2007-11-08 10:46:41 nkeynes Exp $
1.7 *
1.8 * Define the main (emu) GTK window, along with its menubars,
1.9 * toolbars, etc.
1.10 @@ -48,10 +48,29 @@
1.11 static void on_main_window_state_changed( GtkWidget *widget, GdkEventWindowState *state,
1.12 gpointer userdata )
1.13 {
1.14 + main_window_t win = (main_window_t)userdata;
1.15 if( state->changed_mask & GDK_WINDOW_STATE_FULLSCREEN ) {
1.16 gboolean fs = (state->new_window_state & GDK_WINDOW_STATE_FULLSCREEN);
1.17 + GtkWidget *frame = gtk_widget_get_parent(win->video);
1.18 + if( frame->style == NULL ) {
1.19 + gtk_widget_set_style( frame, gtk_style_new() );
1.20 + }
1.21 + if( fs ) {
1.22 + gtk_widget_hide( win->menubar );
1.23 + gtk_widget_hide( win->toolbar );
1.24 + gtk_widget_hide( win->statusbar );
1.25 +
1.26 + frame->style->xthickness = 0;
1.27 + frame->style->ythickness = 0;
1.28 + } else {
1.29 + frame->style->xthickness = 2;
1.30 + frame->style->ythickness = 2;
1.31 + gtk_widget_show( win->menubar );
1.32 + gtk_widget_show( win->toolbar );
1.33 + gtk_widget_show( win->statusbar );
1.34 + }
1.35 + gtk_widget_queue_draw( win->window );
1.36 }
1.37 - return FALSE;
1.38 }
1.39
1.40 main_window_t main_window_new( const gchar *title, GtkWidget *menubar, GtkWidget *toolbar,
1.41 @@ -132,24 +151,9 @@
1.42
1.43 void main_window_set_fullscreen( main_window_t win, gboolean fullscreen )
1.44 {
1.45 - GtkWidget *frame = gtk_widget_get_parent(win->video);
1.46 - if( frame->style == NULL ) {
1.47 - gtk_widget_set_style( frame, gtk_style_new() );
1.48 - }
1.49 if( fullscreen ) {
1.50 gtk_window_fullscreen( GTK_WINDOW(win->window) );
1.51 - gtk_widget_hide( win->menubar );
1.52 - gtk_widget_hide( win->toolbar );
1.53 - gtk_widget_hide( win->statusbar );
1.54 -
1.55 - frame->style->xthickness = 0;
1.56 - frame->style->ythickness = 0;
1.57 } else {
1.58 gtk_window_unfullscreen( GTK_WINDOW(win->window) );
1.59 - frame->style->xthickness = 2;
1.60 - frame->style->ythickness = 2;
1.61 - gtk_widget_show( win->menubar );
1.62 - gtk_widget_show( win->toolbar );
1.63 - gtk_widget_show( win->statusbar );
1.64 }
1.65 }
.