Skip to content

Commit 4aa802b

Browse files
committed
[[ Bug 12590 ]] Lock screen around menu update messages.
1 parent 8d4a581 commit 4aa802b

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

docs/notes/bugfix-12590.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Screen updates occur during 'menu update' mouseDown message causing pauses when updating menus on first click.

engine/src/button.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,11 @@ Boolean MCButton::mfocus(int2 x, int2 y)
859859
menu->close();
860860
menudepth--;
861861
MCdispatcher->addmenu(bptr);
862+
// MW-2014-06-10: [[ Bug 12590 ]] Make sure we lock screen around the menu update message.
863+
MCRedrawLockScreen();
862864
bptr->state |= CS_MFOCUSED;
863865
bptr->message_with_args(MCM_mouse_down, menubutton);
866+
MCRedrawUnlockScreen();
864867
bptr->findmenu();
865868
bptr->openmenu(False);
866869
return True;

engine/src/desktop-menu.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "stack.h"
3737
#include "card.h"
3838
#include "graphics_util.h"
39+
#include "redraw.h"
3940

4041
#include "platform.h"
4142

@@ -892,9 +893,12 @@ void MCPlatformHandleMenuUpdate(MCPlatformMenuRef p_menu)
892893
// from updates as we mustn't fiddle about with it too much in this case!
893894
if (s_menubar_targets[t_parent_menu_index] -> Exists())
894895
{
896+
// MW-2014-06-10: [[ Bug 12590 ]] Make sure we lock screen around the menu update message.
897+
MCRedrawLockScreen();
895898
s_menubar_lock_count += 1;
896899
s_menubar_targets[t_parent_menu_index] -> Get() -> message_with_args(MCM_mouse_down, "1");
897900
s_menubar_lock_count -= 1;
901+
MCRedrawUnlockScreen();
898902
}
899903

900904
// Now we've got the menu to update, process the new menu spec, but only if the

engine/src/desktop-stack.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,19 @@ void MCStack::updateignoremouseevents(void)
289289
MCPlatformSetWindowBoolProperty(window, kMCPlatformWindowPropertyIgnoreMouseEvents, getextendedstate(ECS_IGNORE_MOUSE_EVENTS) == True);
290290
}
291291

292-
293292
// MW-2011-09-11: [[ Redraw ]] Force an immediate update of the window within the given
294293
// region. The actual rendering is done by deferring to the 'redrawwindow' method.
295294
void MCStack::view_platform_updatewindow(MCRegionRef p_region)
296295
{
297296
if (window == nil)
298297
return;
299-
298+
299+
if (!opened)
300+
return;
301+
302+
if (!isvisible())
303+
return;
304+
300305
MCPlatformInvalidateWindow(window, p_region);
301306
MCPlatformUpdateWindow(window);
302307
}

engine/src/stacklst.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
3131
#include "stacklst.h"
3232
#include "sellst.h"
3333
#include "util.h"
34+
#include "redraw.h"
3435

3536
#include "globals.h"
3637

@@ -308,6 +309,9 @@ Boolean MCStacklist::doaccelerator(KeySym key)
308309

309310
if (t_menubar != NULL)
310311
{
312+
// MW-2014-06-10: [[ Bug 12590 ]] Make sure we lock screen around the menu update message.
313+
MCRedrawLockScreen();
314+
311315
// OK-2008-03-20 : Bug 6153. Don't send a mouse button number if the mouseDown is due to
312316
// a menu accelerator.
313317
// MW-2008-08-27: [[ Bug 6995 ]] Slowdown caused by repeated invocation of mouseDown even if
@@ -326,6 +330,7 @@ Boolean MCStacklist::doaccelerator(KeySym key)
326330
{
327331
MCmodifierstate &= t_mod_mask;
328332
accelerators[i] . button -> activate(True, (uint2)key);
333+
MCRedrawUnlockScreen();
329334
return True;
330335
}
331336
}
@@ -335,6 +340,8 @@ Boolean MCStacklist::doaccelerator(KeySym key)
335340
break;
336341
}
337342
}
343+
344+
MCRedrawUnlockScreen();
338345
}
339346

340347
// IM-2008-09-05: Reorganize loop to be more efficient - only loop through stacks once we've

0 commit comments

Comments
 (0)