mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 08:49:50 +00:00
(svn r20577) -Fix [FS#4043]: scroll button flickering when pressed
This commit is contained in:
parent
1231dc7b57
commit
3e3cd47222
@ -85,8 +85,8 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
|
|||||||
if (pos <= mi + 9) {
|
if (pos <= mi + 9) {
|
||||||
/* Pressing the upper button? */
|
/* Pressing the upper button? */
|
||||||
SetBit(sb->disp_flags, NDB_SCROLLBAR_UP);
|
SetBit(sb->disp_flags, NDB_SCROLLBAR_UP);
|
||||||
if (_scroller_click_timeout == 0) {
|
if (_scroller_click_timeout <= 1) {
|
||||||
_scroller_click_timeout = 6;
|
_scroller_click_timeout = 3;
|
||||||
sb->UpdatePosition(rtl ? 1 : -1);
|
sb->UpdatePosition(rtl ? 1 : -1);
|
||||||
}
|
}
|
||||||
_left_button_clicked = false;
|
_left_button_clicked = false;
|
||||||
@ -94,8 +94,8 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
|
|||||||
/* Pressing the lower button? */
|
/* Pressing the lower button? */
|
||||||
SetBit(sb->disp_flags, NDB_SCROLLBAR_DOWN);
|
SetBit(sb->disp_flags, NDB_SCROLLBAR_DOWN);
|
||||||
|
|
||||||
if (_scroller_click_timeout == 0) {
|
if (_scroller_click_timeout <= 1) {
|
||||||
_scroller_click_timeout = 6;
|
_scroller_click_timeout = 3;
|
||||||
sb->UpdatePosition(rtl ? -1 : 1);
|
sb->UpdatePosition(rtl ? -1 : 1);
|
||||||
}
|
}
|
||||||
_left_button_clicked = false;
|
_left_button_clicked = false;
|
||||||
|
@ -54,7 +54,7 @@ Point _cursorpos_drag_start;
|
|||||||
|
|
||||||
int _scrollbar_start_pos;
|
int _scrollbar_start_pos;
|
||||||
int _scrollbar_size;
|
int _scrollbar_size;
|
||||||
byte _scroller_click_timeout;
|
byte _scroller_click_timeout = 0;
|
||||||
|
|
||||||
bool _scrolling_viewport; ///< A viewport is being scrolled with the mouse.
|
bool _scrolling_viewport; ///< A viewport is being scrolled with the mouse.
|
||||||
bool _mouse_hovering; ///< The mouse is hovering over the same point.
|
bool _mouse_hovering; ///< The mouse is hovering over the same point.
|
||||||
@ -1373,14 +1373,16 @@ static void DecreaseWindowCounters()
|
|||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
||||||
/* Unclick scrollbar buttons if they are pressed. */
|
if (_scroller_click_timeout == 0) {
|
||||||
for (uint i = 0; i < w->nested_array_size; i++) {
|
/* Unclick scrollbar buttons if they are pressed. */
|
||||||
NWidgetBase *nwid = w->nested_array[i];
|
for (uint i = 0; i < w->nested_array_size; i++) {
|
||||||
if (nwid != NULL && (nwid->type == NWID_HSCROLLBAR || nwid->type == NWID_VSCROLLBAR)) {
|
NWidgetBase *nwid = w->nested_array[i];
|
||||||
NWidgetScrollbar *sb = static_cast<NWidgetScrollbar*>(nwid);
|
if (nwid != NULL && (nwid->type == NWID_HSCROLLBAR || nwid->type == NWID_VSCROLLBAR)) {
|
||||||
if (sb->disp_flags & (ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN)) {
|
NWidgetScrollbar *sb = static_cast<NWidgetScrollbar*>(nwid);
|
||||||
sb->disp_flags &= ~(ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN);
|
if (sb->disp_flags & (ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN)) {
|
||||||
sb->SetDirty(w);
|
sb->disp_flags &= ~(ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN);
|
||||||
|
sb->SetDirty(w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2500,11 +2502,7 @@ void InvalidateWindowClassesData(WindowClass cls, int data)
|
|||||||
*/
|
*/
|
||||||
void CallWindowTickEvent()
|
void CallWindowTickEvent()
|
||||||
{
|
{
|
||||||
if (_scroller_click_timeout > 3) {
|
if (_scroller_click_timeout != 0) _scroller_click_timeout--;
|
||||||
_scroller_click_timeout -= 3;
|
|
||||||
} else {
|
|
||||||
_scroller_click_timeout = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Window *w;
|
Window *w;
|
||||||
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
||||||
|
Loading…
Reference in New Issue
Block a user