Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#3470) don't scroll if the user is reading the backlog
Home

[Freeciv-Dev] (PR#3470) don't scroll if the user is reading the backlog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: a-l@xxxxxxx
Subject: [Freeciv-Dev] (PR#3470) don't scroll if the user is reading the backlog
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Wed, 31 Mar 2004 17:27:45 -0800
Reply-to: rt@xxxxxxxxxxx

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

> [ali - Wed Feb 19 02:47:44 2003]:
> 
> When you scroll back to read previous messages, focus should stay there
> until you move the scrollbar near the bottom, at which point the 
> scrolling resumes. Just like in a KDE terminal window.

Minor style changes.

Index: client/gui-gtk/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/chatline.c,v
retrieving revision 1.20
diff -u -r1.20 chatline.c
--- client/gui-gtk/chatline.c   18 Jul 2003 22:02:24 -0000      1.20
+++ client/gui-gtk/chatline.c   1 Apr 2004 01:27:10 -0000
@@ -67,14 +67,23 @@
 **************************************************************************/
 void real_append_output_window(const char *astring)
 {
+  bool scroll;
+  GtkAdjustment *slider =
+    gtk_range_get_adjustment(GTK_RANGE(text_scrollbar));
+
+  /* scroll forward only if slider is near the bottom */
+  scroll = ((slider->value + slider->page_size) >=
+           (slider->upper - slider->step_increment));
+
   gtk_text_freeze(GTK_TEXT(main_message_area));
   gtk_text_insert(GTK_TEXT(main_message_area), NULL, NULL, NULL, "\n", -1);
   gtk_text_insert(GTK_TEXT(main_message_area), NULL, NULL, NULL, astring,
                  -1);
   gtk_text_thaw(GTK_TEXT(main_message_area));
 
-  /* move the scrollbar forward by a ridiculous amount */
-  gtk_range_default_vmotion(GTK_RANGE(text_scrollbar), 0, 10000);
+  if (scroll) {
+    gtk_range_default_vmotion(GTK_RANGE(text_scrollbar), 0, 10000);
+  }
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#3470) don't scroll if the user is reading the backlog, Vasco Alexandre da Silva Costa <=