Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10280) Xaw: buttons in messages window are moved out o
Home

[Freeciv-Dev] (PR#10280) Xaw: buttons in messages window are moved out o

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10280) Xaw: buttons in messages window are moved out of window
From: "Egor Vyscrebentsov via RT" <evyscr@xxxxxxxxx>
Date: Wed, 6 Oct 2004 13:32:00 -0700
Reply-to: RT_CorrespondAddressNotSet@xxxxxxxxxxxxxx

<URL: http://RT::WebBaseURL.not.configured:80/Ticket/Display.html?id=10280 >

> [evyscr - Sep 29 21:53:39 2004]:
>
> > [evyscr - Sep 23 19:09:04 2004]:
> >
> > CVS 2004 09 22, Xaw client.
> >
> > If Messages window is updated, buttons are moved down, so
> > they are semiinvisible.
>
> Attached patch:
> - seems to fix this problem by resizing not viewport but form
> (except we have zero-height viewport)

While testing patch i have found another problem with message window:
in empty message window we have one-line heighted list.
Clicking on it will cause an assert in get_message(). (This is for both
modified and unmodified code.)
So in new version of patch condition in meswin_list_callback
is expanded: check for `get_num_message() != 0` added.
This fixes problem to me.

Thanks, evyscr.
diff -urN freeciv-orig/client/gui-xaw/messagewin.c 
freeciv/client/gui-xaw/messagewin.c
--- freeciv-orig/client/gui-xaw/messagewin.c    2004-09-30 10:34:17 +0400
+++ freeciv/client/gui-xaw/messagewin.c 2004-10-07 00:01:51 +0400
@@ -221,17 +221,18 @@
 **************************************************************************/
 void real_update_meswin_dialog(void)
 {
-  Dimension height, iheight, width;
-  int i;
+  Dimension height, iheight, width, oldheight, newheight;
+  int i, num = get_num_messages();
 
   XawFormDoLayout(meswin_form, False);
 
-  if (get_num_messages() == 0) {
+  XtVaGetValues(meswin_viewport, XtNheight, &oldheight, NULL);
+
+  if (num == 0) {
     XawListChange(meswin_list, dummy_message_list, 1, 0, True);
   } else {
     /* strings will not be freed */
     static char **strings = NULL;
-    int i, num = get_num_messages();
 
     strings = fc_realloc(strings, num * sizeof(char *));
 
@@ -239,7 +240,7 @@
       strings[i] = get_message(i)->descr;
     }
 
-    XawListChange(meswin_list, strings, get_num_messages(), 0, True);
+    XawListChange(meswin_list, strings, num, 0, True);
   }
 
   /* Much of the following copied from city_report_dialog_update() */
@@ -253,19 +254,33 @@
   /* Seems have to do this here so we get the correct height below. */
   XawFormDoLayout(meswin_form, True);
 
-  if (get_num_messages() <= N_MSG_VIEW) {
+  if (num <= N_MSG_VIEW) {
     XtVaGetValues(meswin_list, XtNheight, &height, NULL);
-    XtVaSetValues(meswin_viewport, XtNheight, height, NULL);
+    if ((oldheight == 0) || (num == 0)) {
+      XtVaSetValues(meswin_viewport, XtNheight, height, NULL);
+    } else {
+      XtVaGetValues(meswin_form, XtNheight, &newheight, NULL);
+      newheight = newheight + height - oldheight;
+      XtVaSetValues(meswin_form, XtNheight, newheight, NULL);
+    }
   } else {
     XtVaGetValues(meswin_list, XtNheight, &height, NULL);
     XtVaGetValues(meswin_list, XtNinternalHeight, &iheight, NULL);
     height -= (iheight * 2);
-    height /= get_num_messages();
+    height /= num;
     height *= N_MSG_VIEW;
     height += (iheight * 2);
-    XtVaSetValues(meswin_viewport, XtNheight, height, NULL);
+    if (height != oldheight) {
+      if (oldheight == 0) {
+       XtVaSetValues(meswin_viewport, XtNheight, height, NULL);
+      } else {
+       XtVaGetValues(meswin_form, XtNheight, &newheight, NULL);
+       newheight = newheight + height - oldheight;
+       XtVaSetValues(meswin_form, XtNheight, newheight, NULL);
+      }
+    }
+    meswin_scroll_down();
   }
-  meswin_scroll_down();
 
   XtSetSensitive(meswin_goto_command, FALSE);
   XtSetSensitive(meswin_popcity_command, FALSE);
@@ -279,7 +294,7 @@
 {
   XawListReturnStruct *ret = XawListShowCurrent(meswin_list);
 
-  if (ret->list_index != XAW_LIST_NONE) {
+  if ((ret->list_index != XAW_LIST_NONE) && (get_num_messages() != 0)) {
     struct message *message = get_message(ret->list_index);
 
     XtSetSensitive(meswin_goto_command, message->location_ok ? True : False);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10280) Xaw: buttons in messages window are moved out of window, Egor Vyscrebentsov via RT <=