Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] Re: (PR#10879) Merge raise_*_dialog() and popup_*_dialog()
Home

[Freeciv-Dev] Re: (PR#10879) Merge raise_*_dialog() and popup_*_dialog()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: use_less@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#10879) Merge raise_*_dialog() and popup_*_dialog()
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Mon, 8 Nov 2004 10:17:56 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10879 >

On Mon, 8 Nov 2004
Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx> wrote:

> > [use_less - Fri Nov 05 03:29:05 2004]:
> >
> > This patch merges the various raise_*_dialog() functions with their
> > corresponding popup_*_dialog() functions, by adding a raise flag.
> >
> > GTK2 and Win32 have been changed and tested, and all other clients have
> > most likely been broken. :)
[skipped]
> For other guis it looks like this will break things pretty badly.  Egor,
> can you update gui-xaw for this?

1. Attached patch allows to compile xaw client with mergeraise patch. Can't
test it in game now due to X Error: BadPixmap. Patch and error are for
CVS HEAD 20041108 18:31 +0300.

2. Patch is in minimal form (there are make_modal parameteres inside cityrep
and repodlgs). I want to bring these dialogs to common style. However (or
because of this), I still need a common dialog model/concept/...
There are several styles of writing dialogs now (in gui-xaw, at least), which
differ not so small.

Thanks, evyscr.

Index: actions.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/actions.c,v
retrieving revision 1.22
diff -u -r1.22 actions.c
--- actions.c   23 Aug 2004 23:24:45 -0000      1.22
+++ actions.c   8 Nov 2004 18:04:44 -0000
@@ -244,14 +244,14 @@
 {
   if (can_client_change_view() &&
      is_menu_item_active(MENU_REPORT, MENU_REPORT_MESSAGES))
-    popup_meswin_dialog();
+    popup_meswin_dialog(FALSE);
 }
 
 static void xaw_key_open_players(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
 {
   if (can_client_change_view() &&
      is_menu_item_active(MENU_REPORT, MENU_REPORT_PLAYERS))
-    popup_players_dialog();
+    popup_players_dialog(FALSE);
 }
 
 /****************************************************************************
Index: menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.69
diff -u -r1.69 menu.c
--- menu.c      29 Sep 2004 02:24:22 -0000      1.69
+++ menu.c      8 Nov 2004 18:04:44 -0000
@@ -779,7 +779,7 @@
     popup_activeunits_report_dialog(0);
     break;
   case MENU_REPORT_PLAYERS:
-    popup_players_dialog();
+    popup_players_dialog(FALSE);
     break;
    case MENU_REPORT_ECONOMY:
     popup_economy_report_dialog(0);
@@ -794,7 +794,7 @@
     send_report_request(REPORT_TOP_5_CITIES);
     break;
   case MENU_REPORT_MESSAGES:
-    popup_meswin_dialog();
+    popup_meswin_dialog(FALSE);
     break;
    case MENU_REPORT_DEMOGRAPHIC:
     send_report_request(REPORT_DEMOGRAPHIC);
Index: messagewin.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/messagewin.c,v
retrieving revision 1.26
diff -u -r1.26 messagewin.c
--- messagewin.c        10 Oct 2004 11:37:43 -0000      1.26
+++ messagewin.c        8 Nov 2004 18:04:44 -0000
@@ -52,8 +52,9 @@
 static Widget meswin_close_command;
 static Widget meswin_goto_command;
 static Widget meswin_popcity_command;
+static bool meswin_dialog_shell_is_raised;
 
-static void create_meswin_dialog(void);
+static void create_meswin_dialog(bool raise);
 static void meswin_scroll_down(void);
 static void meswin_close_callback(Widget w, XtPointer client_data,
                                  XtPointer call_data);
@@ -72,15 +73,21 @@
 /****************************************************************
 popup the dialog 10% inside the main-window 
 *****************************************************************/
-void popup_meswin_dialog(void)
+void popup_meswin_dialog(bool raise)
 {
   int updated = 0;
   
+  meswin_dialog_shell_is_raised = raise;
+
   if(!meswin_dialog_shell) {
-    create_meswin_dialog();
+    create_meswin_dialog(raise);
     updated = 1;               /* create_ calls update_ */
   }
 
+  if (raise) {
+    XtSetSensitive(main_form, FALSE);
+  }
+
   xaw_set_relative_position(toplevel, meswin_dialog_shell, 25, 25);
   XtPopup(meswin_dialog_shell, XtGrabNone);
   if(!updated) 
@@ -102,6 +109,9 @@
 void popdown_meswin_dialog(void)
 {
   if (meswin_dialog_shell) {
+    if (meswin_dialog_shell_is_raised) {
+      XtSetSensitive(main_form, TRUE);
+    }
     XtDestroyWidget(meswin_dialog_shell);
     meswin_dialog_shell = 0;
   }
@@ -122,12 +132,14 @@
 /****************************************************************
 ...
 *****************************************************************/
-static void create_meswin_dialog(void)
+static void create_meswin_dialog(bool raise)
 {
   creating = TRUE;
 
   meswin_dialog_shell =
-    I_IN(I_T(XtCreatePopupShell("meswinpopup", topLevelShellWidgetClass,
+    I_IN(I_T(XtCreatePopupShell("meswinpopup",
+                               raise ? transientShellWidgetClass
+                               : topLevelShellWidgetClass,
                                toplevel, NULL, 0)));
 
   meswin_form = XtVaCreateManagedWidget("meswinform", 
Index: plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/plrdlg.c,v
retrieving revision 1.40
diff -u -r1.40 plrdlg.c
--- plrdlg.c    23 Sep 2004 18:17:23 -0000      1.40
+++ plrdlg.c    8 Nov 2004 18:04:44 -0000
@@ -55,11 +55,12 @@
 static Widget players_war_command;
 static Widget players_vision_command;
 static Widget players_sship_command;
+static bool players_dialog_shell_is_raised;
 
 static int list_index_to_player_index[MAX_NUM_PLAYERS];
 
 
-static void create_players_dialog(void);
+static void create_players_dialog(bool raise);
 static void players_close_callback(Widget w, XtPointer client_data, 
                                   XtPointer call_data);
 static void players_meet_callback(Widget w, XtPointer client_data, 
@@ -81,10 +82,16 @@
 /****************************************************************
 popup the dialog somewhat inside the main-window 
 *****************************************************************/
-void popup_players_dialog(void)
+void popup_players_dialog(bool raise)
 {
+  players_dialog_shell_is_raised = raise;
+
   if(!players_dialog_shell)
-    create_players_dialog();
+    create_players_dialog(raise);
+
+  if (raise) {
+    XtSetSensitive(main_form, FALSE);
+  }
 
   xaw_set_relative_position(toplevel, players_dialog_shell, 5, 25);
   XtPopup(players_dialog_shell, XtGrabNone);
@@ -96,6 +103,9 @@
 void popdown_players_dialog(void)
 {
   if (players_dialog_shell) {
+    if (players_dialog_shell_is_raised) {
+      XtSetSensitive(main_form, TRUE);
+    }
     XtDestroyWidget(players_dialog_shell);
     players_dialog_shell = 0;
   }
@@ -104,11 +114,12 @@
 /****************************************************************
 ...
 *****************************************************************/
-void create_players_dialog(void)
+void create_players_dialog(bool raise)
 {
   players_dialog_shell =
     I_IN(I_T(XtCreatePopupShell("playerspopup", 
-                               topLevelShellWidgetClass,
+                               raise ? transientShellWidgetClass
+                               : topLevelShellWidgetClass,
                                toplevel, NULL, 0)));
 
   players_form = XtVaCreateManagedWidget("playersform", 

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