aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2003-03-28 14:22:11 +0000
committerStefan Monnier2003-03-28 14:22:11 +0000
commit3c671a56725a173046be2d8907464ea5f68747b5 (patch)
tree528ea455524e874b2aed4711649f0580c74ad426 /src
parent9a08d928f14cd19a0d35045d92752cad538488e4 (diff)
downloademacs-3c671a56725a173046be2d8907464ea5f68747b5.tar.gz
emacs-3c671a56725a173046be2d8907464ea5f68747b5.zip
(take_vertical_position_into_account): Remove.
(xt_action_hook): Call set_vertical_scroll_bar if needed. (XM_SB_MIN, XM_SB_RANGE): Remove (min is now set to 0). (xm_scroll_callback, x_create_toolkit_scroll_bar) (x_set_toolkit_scroll_bar_thumb): Simplify. (x_scroll_bar_expose): Only compile if !USE_TOOLKIT_SCROLL_BARS. (XTread_socket): Remove unused var. (x_make_frame_invisible): Replace goto with else.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/xterm.c40
2 files changed, 32 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 54cfc69a208..f31d177a49a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12003-03-28 Stefan Monnier <monnier@cs.yale.edu>
2
3 * xterm.c (take_vertical_position_into_account): Remove.
4 (xt_action_hook): Call set_vertical_scroll_bar if needed.
5 (XM_SB_MIN, XM_SB_RANGE): Remove (min is now set to 0).
6 (xm_scroll_callback, x_create_toolkit_scroll_bar)
7 (x_set_toolkit_scroll_bar_thumb): Simplify.
8 (x_scroll_bar_expose): Only compile if !USE_TOOLKIT_SCROLL_BARS.
9 (XTread_socket): Remove unused var.
10 (x_make_frame_invisible): Replace goto with else.
11
12 * xdisp.c (set_vertical_scroll_bar): New fun.
13 (redisplay_window): Use it.
14
12003-03-26 Richard M. Stallman <rms@gnu.org> 152003-03-26 Richard M. Stallman <rms@gnu.org>
2 16
3 * xdisp.c (update_tool_bar): Recompute tool bar if 17 * xdisp.c (update_tool_bar): Recompute tool bar if
diff --git a/src/xterm.c b/src/xterm.c
index d414271091e..40ddaa0d345 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -351,7 +351,6 @@ static void x_flush P_ ((struct frame *f));
351static void x_update_begin P_ ((struct frame *)); 351static void x_update_begin P_ ((struct frame *));
352static void x_update_window_begin P_ ((struct window *)); 352static void x_update_window_begin P_ ((struct window *));
353static void x_after_update_window_line P_ ((struct glyph_row *)); 353static void x_after_update_window_line P_ ((struct glyph_row *));
354static INLINE void take_vertical_position_into_account P_ ((struct it *));
355static struct scroll_bar *x_window_to_scroll_bar P_ ((Window)); 354static struct scroll_bar *x_window_to_scroll_bar P_ ((Window));
356static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, 355static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *,
357 enum scroll_bar_part *, 356 enum scroll_bar_part *,
@@ -3950,6 +3949,7 @@ static Boolean xaw3d_arrow_scroll;
3950 3949
3951static Boolean xaw3d_pick_top; 3950static Boolean xaw3d_pick_top;
3952 3951
3952extern void set_vertical_scroll_bar P_ ((struct window *));
3953 3953
3954/* Action hook installed via XtAppAddActionHook when toolkit scroll 3954/* Action hook installed via XtAppAddActionHook when toolkit scroll
3955 bars are used.. The hook is responsible for detecting when 3955 bars are used.. The hook is responsible for detecting when
@@ -3986,6 +3986,11 @@ xt_action_hook (widget, client_data, action_name, event, params,
3986 x_send_scroll_bar_event (window_being_scrolled, 3986 x_send_scroll_bar_event (window_being_scrolled,
3987 scroll_bar_end_scroll, 0, 0); 3987 scroll_bar_end_scroll, 0, 0);
3988 w = XWINDOW (window_being_scrolled); 3988 w = XWINDOW (window_being_scrolled);
3989
3990 if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging))
3991 /* The thumb size is incorrect while dragging: fix it. */
3992 set_vertical_scroll_bar (w);
3993
3989 XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; 3994 XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil;
3990 window_being_scrolled = Qnil; 3995 window_being_scrolled = Qnil;
3991 last_scroll_bar_part = -1; 3996 last_scroll_bar_part = -1;
@@ -4105,9 +4110,7 @@ x_scroll_bar_to_input_event (event, ievent)
4105 4110
4106/* Minimum and maximum values used for Motif scroll bars. */ 4111/* Minimum and maximum values used for Motif scroll bars. */
4107 4112
4108#define XM_SB_MIN 1
4109#define XM_SB_MAX 10000000 4113#define XM_SB_MAX 10000000
4110#define XM_SB_RANGE (XM_SB_MAX - XM_SB_MIN)
4111 4114
4112 4115
4113/* Scroll bar callback for Motif scroll bars. WIDGET is the scroll 4116/* Scroll bar callback for Motif scroll bars. WIDGET is the scroll
@@ -4158,16 +4161,14 @@ xm_scroll_callback (widget, client_data, call_data)
4158 case XmCR_DRAG: 4161 case XmCR_DRAG:
4159 { 4162 {
4160 int slider_size; 4163 int slider_size;
4161 int dragging_down_p = (INTEGERP (bar->dragging)
4162 && XINT (bar->dragging) <= cs->value);
4163 4164
4164 /* Get the slider size. */ 4165 /* Get the slider size. */
4165 BLOCK_INPUT; 4166 BLOCK_INPUT;
4166 XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); 4167 XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL);
4167 UNBLOCK_INPUT; 4168 UNBLOCK_INPUT;
4168 4169
4169 whole = XM_SB_RANGE - slider_size; 4170 whole = XM_SB_MAX;
4170 portion = min (cs->value - XM_SB_MIN, whole); 4171 portion = min (cs->value, whole);
4171 part = scroll_bar_handle; 4172 part = scroll_bar_handle;
4172 bar->dragging = make_number (cs->value); 4173 bar->dragging = make_number (cs->value);
4173 } 4174 }
@@ -4382,7 +4383,7 @@ x_create_toolkit_scroll_bar (f, bar)
4382#ifdef USE_MOTIF 4383#ifdef USE_MOTIF
4383 /* Set resources. Create the widget. */ 4384 /* Set resources. Create the widget. */
4384 XtSetArg (av[ac], XtNmappedWhenManaged, False); ++ac; 4385 XtSetArg (av[ac], XtNmappedWhenManaged, False); ++ac;
4385 XtSetArg (av[ac], XmNminimum, XM_SB_MIN); ++ac; 4386 XtSetArg (av[ac], XmNminimum, 0); ++ac;
4386 XtSetArg (av[ac], XmNmaximum, XM_SB_MAX); ++ac; 4387 XtSetArg (av[ac], XmNmaximum, XM_SB_MAX); ++ac;
4387 XtSetArg (av[ac], XmNorientation, XmVERTICAL); ++ac; 4388 XtSetArg (av[ac], XmNorientation, XmVERTICAL); ++ac;
4388 XtSetArg (av[ac], XmNprocessingDirection, XmMAX_ON_BOTTOM), ++ac; 4389 XtSetArg (av[ac], XmNprocessingDirection, XmMAX_ON_BOTTOM), ++ac;
@@ -4607,14 +4608,13 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
4607 /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX 4608 /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX
4608 is the scroll bar's maximum and MIN is the scroll bar's minimum 4609 is the scroll bar's maximum and MIN is the scroll bar's minimum
4609 value. */ 4610 value. */
4610 size = shown * XM_SB_RANGE; 4611 size = shown * XM_SB_MAX;
4611 size = min (size, XM_SB_RANGE); 4612 size = min (size, XM_SB_MAX);
4612 size = max (size, 1); 4613 size = max (size, 1);
4613 4614
4614 /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ 4615 /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */
4615 value = top * XM_SB_RANGE; 4616 value = top * XM_SB_MAX;
4616 value = min (value, XM_SB_MAX - size); 4617 value = min (value, XM_SB_MAX - size);
4617 value = max (value, XM_SB_MIN);
4618 4618
4619 XmScrollBarSetValues (widget, value, size, 0, 0, False); 4619 XmScrollBarSetValues (widget, value, size, 0, 0, False);
4620 } 4620 }
@@ -5240,6 +5240,7 @@ XTjudge_scroll_bars (f)
5240} 5240}
5241 5241
5242 5242
5243#ifndef USE_TOOLKIT_SCROLL_BARS
5243/* Handle an Expose or GraphicsExpose event on a scroll bar. This 5244/* Handle an Expose or GraphicsExpose event on a scroll bar. This
5244 is a no-op when using toolkit scroll bars. 5245 is a no-op when using toolkit scroll bars.
5245 5246
@@ -5251,8 +5252,6 @@ x_scroll_bar_expose (bar, event)
5251 struct scroll_bar *bar; 5252 struct scroll_bar *bar;
5252 XEvent *event; 5253 XEvent *event;
5253{ 5254{
5254#ifndef USE_TOOLKIT_SCROLL_BARS
5255
5256 Window w = SCROLL_BAR_X_WINDOW (bar); 5255 Window w = SCROLL_BAR_X_WINDOW (bar);
5257 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5256 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5258 GC gc = f->output_data.x->normal_gc; 5257 GC gc = f->output_data.x->normal_gc;
@@ -5272,8 +5271,8 @@ x_scroll_bar_expose (bar, event)
5272 5271
5273 UNBLOCK_INPUT; 5272 UNBLOCK_INPUT;
5274 5273
5275#endif /* not USE_TOOLKIT_SCROLL_BARS */
5276} 5274}
5275#endif /* not USE_TOOLKIT_SCROLL_BARS */
5277 5276
5278/* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind 5277/* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind
5279 is set to something other than NO_EVENT, it is enqueued. 5278 is set to something other than NO_EVENT, it is enqueued.
@@ -7043,7 +7042,6 @@ XTread_socket (sd, bufp, numchars, expected)
7043 int expected; 7042 int expected;
7044{ 7043{
7045 int count = 0; 7044 int count = 0;
7046 int nbytes = 0;
7047 XEvent event; 7045 XEvent event;
7048 int event_found = 0; 7046 int event_found = 0;
7049 struct x_display_info *dpyinfo; 7047 struct x_display_info *dpyinfo;
@@ -8859,12 +8857,10 @@ x_make_frame_invisible (f)
8859 8857
8860#ifdef USE_GTK 8858#ifdef USE_GTK
8861 if (FRAME_GTK_OUTER_WIDGET (f)) 8859 if (FRAME_GTK_OUTER_WIDGET (f))
8862 { 8860 gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f));
8863 gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f)); 8861 else
8864 goto out;
8865 }
8866#endif 8862#endif
8867 8863 {
8868#ifdef HAVE_X11R4 8864#ifdef HAVE_X11R4
8869 8865
8870 if (! XWithdrawWindow (FRAME_X_DISPLAY (f), window, 8866 if (! XWithdrawWindow (FRAME_X_DISPLAY (f), window,
@@ -8898,8 +8894,8 @@ x_make_frame_invisible (f)
8898 /* Unmap the window ourselves. Cheeky! */ 8894 /* Unmap the window ourselves. Cheeky! */
8899 XUnmapWindow (FRAME_X_DISPLAY (f), window); 8895 XUnmapWindow (FRAME_X_DISPLAY (f), window);
8900#endif /* ! defined (HAVE_X11R4) */ 8896#endif /* ! defined (HAVE_X11R4) */
8897 }
8901 8898
8902 out:
8903 /* We can't distinguish this from iconification 8899 /* We can't distinguish this from iconification
8904 just by the event that we get from the server. 8900 just by the event that we get from the server.
8905 So we can't win using the usual strategy of letting 8901 So we can't win using the usual strategy of letting