(svn r3247) - Fix: "[ 1335580 ] sticky windows not sticky anymore"
authorpeter1138
Tue, 29 Nov 2005 22:04:02 +0000
changeset 2703 edd58a233988
parent 2702 e4663e88c530
child 2704 dc9ae68dfd74
(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
player_gui.c
widget.c
window.c
--- a/misc_gui.c	Tue Nov 29 16:06:06 2005 +0000
+++ b/misc_gui.c	Tue Nov 29 22:04:02 2005 +0000
@@ -735,12 +735,7 @@
 
 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);
 }
 
 
--- a/player_gui.c	Tue Nov 29 16:06:06 2005 +0000
+++ b/player_gui.c	Tue Nov 29 22:04:02 2005 +0000
@@ -235,7 +235,6 @@
 		WP(w,def_d).data_1 = mode;
 		if (show_stickied) {
 			w->flags4 |= WF_STICKY;
-			w->click_state ^= (1 << 3);
 		}
 	}
 }
--- a/widget.c	Tue Nov 29 16:06:06 2005 +0000
+++ b/widget.c	Tue Nov 29 22:04:02 2005 +0000
@@ -394,6 +394,8 @@
 
 		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;
--- a/window.c	Tue Nov 29 16:06:06 2005 +0000
+++ b/window.c	Tue Nov 29 22:04:02 2005 +0000
@@ -74,7 +74,6 @@
 		}
 
 		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;