Author: cazfi
Date: Fri Nov 27 09:30:37 2015
New Revision: 30799

URL: http://svn.gna.org/viewcvs/freeciv?rev=30799&view=rev
Log:
Gtk3-client main window tries not to be bigger than dimensions given as 
resolution request. 

See patch #6618

Modified:
    trunk/client/gui-gtk-3.0/gui_main.c
    trunk/client/gui-gtk-3.0/gui_main.h
    trunk/client/gui-gtk-3.0/pages.c

Modified: trunk/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.c?rev=30799&r1=30798&r2=30799&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/gui_main.c (original)
+++ trunk/client/gui-gtk-3.0/gui_main.c Fri Nov 27 09:30:37 2015
@@ -1643,6 +1643,9 @@
 
   toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_window_set_position(GTK_WINDOW(toplevel), GTK_WIN_POS_CENTER);
+  if (vmode.width > 0 && vmode.height > 0) {
+    gtk_window_resize(GTK_WINDOW(toplevel), vmode.width, vmode.height);
+  }
   g_signal_connect(toplevel, "key_press_event",
                    G_CALLBACK(toplevel_handler), NULL);
 
@@ -2271,6 +2274,18 @@
 }
 
 /**************************************************************************
+  Give resolution requested by user, if any.
+**************************************************************************/
+struct video_mode *resolution_request_get(void)
+{
+  if (vmode.width > 0 && vmode.height > 0) {
+    return &vmode;
+  }
+
+  return NULL;
+}
+
+/**************************************************************************
   Make dynamic adjustments to first-launch default options.
 **************************************************************************/
 void adjust_default_options(void)

Modified: trunk/client/gui-gtk-3.0/gui_main.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.h?rev=30799&r1=30798&r2=30799&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/gui_main.h (original)
+++ trunk/client/gui-gtk-3.0/gui_main.h Fri Nov 27 09:30:37 2015
@@ -84,6 +84,7 @@
 
 int screen_width(void);
 int screen_height(void);
+struct video_mode *resolution_request_get(void);
 
 bool is_gui_up(void);
 

Modified: trunk/client/gui-gtk-3.0/pages.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/pages.c?rev=30799&r1=30798&r2=30799&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/pages.c    (original)
+++ trunk/client/gui-gtk-3.0/pages.c    Fri Nov 27 09:30:37 2015
@@ -3157,8 +3157,14 @@
   case PAGE_LOAD:
     break;
   case PAGE_GAME:
-    enable_menus(FALSE);
-    gtk_window_unmaximize(GTK_WINDOW(toplevel));
+    {
+      struct video_mode *vmode = resolution_request_get();
+
+      enable_menus(FALSE);
+      if (vmode == NULL) {
+        gtk_window_unmaximize(GTK_WINDOW(toplevel));
+      }
+    }
     break;
   default:
     break;
@@ -3182,11 +3188,17 @@
     conn_list_dialog_update();
     break;
   case PAGE_GAME:
-    reset_unit_table();
-    enable_menus(TRUE);
-    gtk_window_maximize(GTK_WINDOW(toplevel));
-    voteinfo_gui_update();
-    mapview_freeze();
+    {
+      struct video_mode *vmode = resolution_request_get();
+
+      reset_unit_table();
+      enable_menus(TRUE);
+      if (vmode == NULL) {
+        gtk_window_maximize(GTK_WINDOW(toplevel));
+      }
+      voteinfo_gui_update();
+      mapview_freeze();
+    }
     break;
   case PAGE_LOAD:
     update_load_page();


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to