Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] (PR#137) modal client dialogs
Home

[Freeciv-Dev] (PR#137) modal client dialogs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: schaefer@xxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#137) modal client dialogs
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Thu, 16 Jan 2003 22:58:41 -0800
Reply-to: rt@xxxxxxxxxxxxxx

[schaefer@xxxxxx - Wed Sep 22 20:10:45 1999]:

> No dialog of freeciv should be modal, i.e. lock up access
> to all other windows (like a standard windows95 yes nor or cancel box).
> The game doesn't stand still while the dialog is up either !

The attached patch provides a make_modal parameter for
popup_notify_dialog (used for demographics and history reports, and some
miscellaneous other popups).  The parameter is always FALSE.

I've only written GTK support, though.  The question is: why was this
dialog modal in the first place, and does it need to remain that way? 
Vasco: I remember you mentioning something about the end-of-game dialog
needing to be modal - why is that?

jason

Index: client//packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.275
diff -u -r1.275 packhand.c
--- client//packhand.c  2003/01/16 18:23:35     1.275
+++ client//packhand.c  2003/01/17 06:54:54
@@ -791,7 +791,7 @@
 
   if (!game.player_ptr->ai.control || ai_popup_windows ||
       packet->event != E_BROADCAST_REPORT) {
-    popup_notify_dialog(caption, headline, lines);
+    popup_notify_dialog(caption, headline, lines, FALSE);
     play_sound_for_event(packet->event);
   }
 }
Index: client//gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.118
diff -u -r1.118 dialogs.c
--- client//gui-gtk/dialogs.c   2003/01/14 03:55:12     1.118
+++ client//gui-gtk/dialogs.c   2003/01/17 06:54:55
@@ -75,6 +75,7 @@
                                              as the races_dialog is
                                              poped up. */
 /******************************************************************/
+bool               notify_dialog_is_modal;
 static GtkWidget  *notify_dialog_shell;
 
 /******************************************************************/
@@ -170,11 +171,15 @@
 /****************************************************************
 ...
 *****************************************************************/
-void popup_notify_dialog(char *caption, char *headline, char *lines)
+void popup_notify_dialog(char *caption, char *headline, char *lines,
+                        bool make_modal)
 {
   GtkWidget *notify_command;
   GtkWidget *notify_label, *notify_headline, *notify_scrolled;
   GtkAccelGroup *accel=gtk_accel_group_new();
+
+  /* Close old dialog. */
+  popdown_notify_dialog();
   
   notify_dialog_shell = gtk_dialog_new();
   gtk_signal_connect( GTK_OBJECT(notify_dialog_shell),"delete_event",
@@ -230,7 +235,10 @@
   gtk_set_relative_position (toplevel, notify_dialog_shell, 10, 10);
   gtk_widget_show( notify_dialog_shell );
 
-  gtk_widget_set_sensitive( top_vbox, FALSE );
+  notify_dialog_is_modal = make_modal;
+  if (make_modal) {
+    gtk_widget_set_sensitive(top_vbox, FALSE);
+  }
 }
 
 /****************************************************************
@@ -240,7 +248,9 @@
 {
   if (notify_dialog_shell) {
     gtk_widget_destroy(notify_dialog_shell);
-    gtk_widget_set_sensitive(top_vbox, TRUE);
+    if (notify_dialog_is_modal) {
+      gtk_widget_set_sensitive(top_vbox, TRUE);
+    }
     notify_dialog_shell = NULL;
   }
 }
@@ -335,7 +345,7 @@
   GtkWidget *notify_label;
   
   if (!is_real_tile(x, y)) {
-    popup_notify_dialog(_("Message:"), headline, lines);
+    popup_notify_dialog(_("Message:"), headline, lines, FALSE);
     return;
   }
   notify_dialog_shell = gtk_dialog_new();
Index: client//gui-gtk/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v
retrieving revision 1.69
diff -u -r1.69 repodlgs.c
--- client//gui-gtk/repodlgs.c  2003/01/13 23:27:03     1.69
+++ client//gui-gtk/repodlgs.c  2003/01/17 06:54:55
@@ -713,7 +713,7 @@
                get_improvement_name(i));
   }
   gtk_clist_unselect_row(GTK_CLIST(economy_list),row,0);
-  popup_notify_dialog(_("Sell-Off:"),_("Results"),str);
+  popup_notify_dialog(_("Sell-Off:"), _("Results"), str, FALSE);
   }
   return;
 }
Index: client//include/dialogs_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/dialogs_g.h,v
retrieving revision 1.12
diff -u -r1.12 dialogs_g.h
--- client//include/dialogs_g.h 2002/11/28 19:09:58     1.12
+++ client//include/dialogs_g.h 2003/01/17 06:54:56
@@ -22,7 +22,8 @@
 struct packet_nations_used;
 
 void popup_notify_goto_dialog(char *headline, char *lines, int x, int y);
-void popup_notify_dialog(char *caption, char *headline, char *lines);
+void popup_notify_dialog(char *caption, char *headline, char *lines,
+                        bool make_modal);
 
 void popup_races_dialog(void);
 void popdown_races_dialog(void);

[Prev in Thread] Current Thread [Next in Thread]