Mercurial > emacs
comparison src/xterm.c @ 36772:a5012395e839
(x_set_toolkit_scroll_bar_thumb) [USE_MOTIF]: Don't
access private scroll bar data; it's no longer necessary with
contemporary LessTif.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 13 Mar 2001 14:09:33 +0000 |
parents | 3f4b8c812d5d |
children | a7358dadd49b |
comparison
equal
deleted
inserted
replaced
36771:6d432526b84f | 36772:a5012395e839 |
---|---|
8143 BLOCK_INPUT; | 8143 BLOCK_INPUT; |
8144 XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); | 8144 XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); |
8145 UNBLOCK_INPUT; | 8145 UNBLOCK_INPUT; |
8146 | 8146 |
8147 /* At the max position of the scroll bar, do a line-wise | 8147 /* At the max position of the scroll bar, do a line-wise |
8148 movement. Without doing anything, the LessTif scroll bar | 8148 movement. Without doing anything, we would be called with |
8149 calls us with the same cs->value again and again. If we | 8149 the same cs->value again and again. If we want to make |
8150 want to make sure that we can reach the end of the buffer, | 8150 sure that we can reach the end of the buffer, we have to do |
8151 we have to do something. | 8151 something. |
8152 | 8152 |
8153 Implementation note: setting bar->dragging always to | 8153 Implementation note: setting bar->dragging always to |
8154 cs->value gives a smoother movement at the max position. | 8154 cs->value gives a smoother movement at the max position. |
8155 Setting it to nil when doing line-wise movement gives | 8155 Setting it to nil when doing line-wise movement gives |
8156 a better slider behavior. */ | 8156 a better slider behavior. */ |
8288 unsigned long pixel; | 8288 unsigned long pixel; |
8289 | 8289 |
8290 BLOCK_INPUT; | 8290 BLOCK_INPUT; |
8291 | 8291 |
8292 #ifdef USE_MOTIF | 8292 #ifdef USE_MOTIF |
8293 /* LessTif 0.85, problems: | |
8294 | |
8295 1. When the mouse if over the scroll bar, the scroll bar will | |
8296 get keyboard events. I didn't find a way to turn this off. | |
8297 | |
8298 2. Do we have to explicitly set the cursor to get an arrow | |
8299 cursor (see below)? */ | |
8300 | |
8301 /* Set resources. Create the widget. */ | 8293 /* Set resources. Create the widget. */ |
8302 XtSetArg (av[ac], XtNmappedWhenManaged, False); ++ac; | 8294 XtSetArg (av[ac], XtNmappedWhenManaged, False); ++ac; |
8303 XtSetArg (av[ac], XmNminimum, XM_SB_MIN); ++ac; | 8295 XtSetArg (av[ac], XmNminimum, XM_SB_MIN); ++ac; |
8304 XtSetArg (av[ac], XmNmaximum, XM_SB_MAX); ++ac; | 8296 XtSetArg (av[ac], XmNmaximum, XM_SB_MAX); ++ac; |
8305 XtSetArg (av[ac], XmNorientation, XmVERTICAL); ++ac; | 8297 XtSetArg (av[ac], XmNorientation, XmVERTICAL); ++ac; |
8437 BLOCK_INPUT; | 8429 BLOCK_INPUT; |
8438 | 8430 |
8439 #ifdef USE_MOTIF | 8431 #ifdef USE_MOTIF |
8440 { | 8432 { |
8441 int size, value; | 8433 int size, value; |
8442 Boolean arrow1_selected, arrow2_selected; | |
8443 unsigned char flags; | |
8444 XmScrollBarWidget sb; | 8434 XmScrollBarWidget sb; |
8445 | 8435 |
8446 /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX | 8436 /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX |
8447 is the scroll bar's maximum and MIN is the scroll bar's minimum | 8437 is the scroll bar's maximum and MIN is the scroll bar's minimum |
8448 value. */ | 8438 value. */ |
8453 /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ | 8443 /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ |
8454 value = top * XM_SB_RANGE; | 8444 value = top * XM_SB_RANGE; |
8455 value = min (value, XM_SB_MAX - size); | 8445 value = min (value, XM_SB_MAX - size); |
8456 value = max (value, XM_SB_MIN); | 8446 value = max (value, XM_SB_MIN); |
8457 | 8447 |
8458 /* LessTif: Calling XmScrollBarSetValues after an increment or | |
8459 decrement turns off auto-repeat LessTif-internally. This can | |
8460 be seen in ScrollBar.c which resets Arrow1Selected and | |
8461 Arrow2Selected. It also sets internal flags so that LessTif | |
8462 believes the mouse is in the slider. We either have to change | |
8463 our code, or work around that by accessing private data. */ | |
8464 | |
8465 sb = (XmScrollBarWidget) widget; | |
8466 arrow1_selected = sb->scrollBar.arrow1_selected; | |
8467 arrow2_selected = sb->scrollBar.arrow2_selected; | |
8468 flags = sb->scrollBar.flags; | |
8469 | |
8470 if (NILP (bar->dragging)) | 8448 if (NILP (bar->dragging)) |
8471 XmScrollBarSetValues (widget, value, size, 0, 0, False); | 8449 XmScrollBarSetValues (widget, value, size, 0, 0, False); |
8472 else if (last_scroll_bar_part == scroll_bar_down_arrow) | 8450 else if (last_scroll_bar_part == scroll_bar_down_arrow) |
8473 /* This has the negative side effect that the slider value is | 8451 /* This has the negative side effect that the slider value is |
8474 not what it would be if we scrolled here using line-wise or | 8452 not what it would be if we scrolled here using line-wise or |
8484 &increment, &page_increment); | 8462 &increment, &page_increment); |
8485 XmScrollBarSetValues (widget, old_value, | 8463 XmScrollBarSetValues (widget, old_value, |
8486 min (size, XM_SB_RANGE - old_value), | 8464 min (size, XM_SB_RANGE - old_value), |
8487 0, 0, False); | 8465 0, 0, False); |
8488 } | 8466 } |
8489 | |
8490 sb->scrollBar.arrow1_selected = arrow1_selected; | |
8491 sb->scrollBar.arrow2_selected = arrow2_selected; | |
8492 sb->scrollBar.flags = flags; | |
8493 } | 8467 } |
8494 #else /* !USE_MOTIF i.e. use Xaw */ | 8468 #else /* !USE_MOTIF i.e. use Xaw */ |
8495 { | 8469 { |
8496 float old_top, old_shown; | 8470 float old_top, old_shown; |
8497 Dimension height; | 8471 Dimension height; |