From 627dd10451c904e32d873b50eebe9f8ca935c7a5 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 29 Nov 2005 22:04:02 +0000 Subject: (svn r3247) - Fix: "[ 1335580 ] sticky windows not sticky anymore" Determine clicked status of sticky icon from window flags rather than the widget click state. This keeps the status in one place where it can't get out of sync. --- misc_gui.c | 5 ----- player_gui.c | 1 - widget.c | 2 ++ window.c | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/misc_gui.c b/misc_gui.c index 8e9bfbb86..c3dc9dc9e 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -735,12 +735,7 @@ void UnclickSomeWindowButtons(Window *w, uint32 mask) void UnclickWindowButtons(Window *w) { - bool sticky = false; - if (w->desc_flags & WDF_STICKY_BUTTON && HASBIT(w->click_state, 2)) sticky = true; - UnclickSomeWindowButtons(w, (uint32)-1); - - if (sticky) SETBIT(w->click_state, 2); } diff --git a/player_gui.c b/player_gui.c index 67fa40041..26561b8a1 100644 --- a/player_gui.c +++ b/player_gui.c @@ -235,7 +235,6 @@ static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_sti WP(w,def_d).data_1 = mode; if (show_stickied) { w->flags4 |= WF_STICKY; - w->click_state ^= (1 << 3); } } } diff --git a/widget.c b/widget.c index 8d0d3ad58..9e1c4a213 100644 --- a/widget.c +++ b/widget.c @@ -394,6 +394,8 @@ void DrawWindowWidgets(const Window *w) case WWT_STICKYBOX: { assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! + + clicked = !!(w->flags4 & WF_STICKY); DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, r.left + 2 + clicked, r.top + 3 + clicked); break; diff --git a/window.c b/window.c index be2f8d408..3398081a8 100644 --- a/window.c +++ b/window.c @@ -74,7 +74,6 @@ static void DispatchLeftClickEvent(Window* w, int x, int y) } if (w->desc_flags & WDF_STICKY_BUTTON && wi->type == WWT_STICKYBOX) { - TOGGLEBIT(w->click_state, e.click.widget); w->flags4 ^= WF_STICKY; InvalidateWidget(w, e.click.widget); return; -- cgit v1.2.3-70-g09d2