rnd-20030708-1-src
[rocksndiamonds.git] / src / libgame / gadgets.c
index b80910d8822ec7ae12fc2503fe5b6355c8720f85..619039aa2b1114ddb6979f140d996a198242b77d 100644 (file)
@@ -1131,6 +1131,13 @@ void HandleGadgets(int mx, int my, int button)
   if (gadget_list_first_entry == NULL)
     return;
 
+  /* simulated release of mouse button over last gadget */
+  if (mx == -1 && my == -1 && button == 0)
+  {
+    mx = last_mx;
+    my = last_my;
+  }
+
   /* check which gadget is under the mouse pointer */
   new_gi = getGadgetInfoFromMousePosition(mx, my);
 
@@ -1547,6 +1554,10 @@ void HandleGadgets(int mx, int my, int button)
        gi->event_mask & GD_EVENT_OFF_BORDERS)
       gi->callback_action(gi);
   }
+
+  /* handle gadgets unmapped/mapped between pressing and releasing */
+  if (release_event && !gadget_released && new_gi)
+    new_gi->state = GD_BUTTON_UNPRESSED;
 }
 
 void HandleGadgetsKeyInput(Key key)