Skip to content

Commit 7d6de59

Browse files
committed
[[ Bug 17737 ]] Screen should be force unlocked after window resize
This patch ensures that the screen is force unlocked after a system resize window event is processed. This ensures that using 'lock screen' inside resizeStack does not cause a resize gesture to only be processed for the first resize. The reason an explicit force unlock is needed in this instance is that the system resize events occur in a modal system loop meaning that the root wait loop is not touched (which does force unlock the screen). The MCDispatch::configure() method has been removed, and replaced by MCDispatch::wreshape() - this makes sure the behavior is the same on all platforms.
1 parent 8008e7e commit 7d6de59

8 files changed

Lines changed: 22 additions & 25 deletions

File tree

docs/notes/bugfix-17737.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Screen should be force unlocked after resizeStack message is sent

engine/src/desktop-stack.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "resolution.h"
3535
#include "player.h"
3636
#include "dispatch.h"
37+
#include "redraw.h"
3738

3839
////////////////////////////////////////////////////////////////////////////////
3940

@@ -453,16 +454,6 @@ void MCDispatch::wredraw(Window p_window, MCPlatformSurfaceRef p_surface, MCGReg
453454
s_update_callback(&t_stack_surface, (MCRegionRef)p_update_rgn, s_update_context);
454455
}
455456

456-
void MCDispatch::wreshape(Window p_window)
457-
{
458-
MCStack *t_stack;
459-
t_stack = findstackd(p_window);
460-
if (t_stack == nil)
461-
return;
462-
463-
t_stack -> view_configure(true);
464-
}
465-
466457
void MCDispatch::wiconify(Window p_window)
467458
{
468459
MCStack *t_stack;

engine/src/dispatch.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,11 +1671,22 @@ void MCDispatch::property(Window w, Atom atom)
16711671
{
16721672
}
16731673

1674-
void MCDispatch::configure(Window w)
1674+
void MCDispatch::wreshape(Window p_window)
16751675
{
1676-
MCStack *target = findstackd(w);
1677-
if (target != NULL)
1678-
target->view_configure(true);
1676+
MCStack *t_stack;
1677+
t_stack = findstackd(p_window);
1678+
if (t_stack == nil)
1679+
return;
1680+
1681+
t_stack -> view_configure(true);
1682+
1683+
// The wreshape() invocation occurs as a direct result of a system resize window
1684+
// request. These can occur whilst nested inside a system modal loop thus the normal
1685+
// force unlock which occurs at the root loop does not happen. Therefore we
1686+
// do that here to ensure that a 'lock screen' inside a resizeStack does not cause
1687+
// subsequent resize requests (in the same user resizing action) to not have an
1688+
// effect.
1689+
MCRedrawForceUnlockScreen();
16791690
}
16801691

16811692
void MCDispatch::enter(Window w)

engine/src/dispatch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ class MCDispatch : public MCObject
174174

175175
void kfocusset(Window w);
176176
void property(Window w, Atom atom);
177-
void configure(Window w);
178177
void enter(Window w);
179178
void redraw(Window w, MCRegionRef dirty_region);
180179
MCFontlist *getfontlist();

engine/src/lnxdclnx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ Boolean MCScreenDC::handle(Boolean dispatch, Boolean anyevent, Boolean& abort, B
781781
gdk_window_resize(t_event->configure.window, t_new_width, t_new_height);
782782
}
783783

784-
MCdispatcher->configure(t_event->configure.window);
784+
MCdispatcher->wreshape(t_event->configure.window);
785785
break;
786786
}
787787

engine/src/stack2.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ void MCStack::resize(uint2 oldw, uint2 oldh)
148148
curcard->message_with_args(MCM_resize_stack, rect.width, rect.height + newy, oldw, oldh);
149149
}
150150
MCRedrawUnlockScreen();
151-
152-
// MW-2011-08-18: [[ Redraw ]] For now, update the screen here. This should
153-
// really be done 'in general' after event dispatch, but things don't work
154-
// in a suitable way for that... Yet...
155-
MCRedrawUpdateScreen();
156151
}
157152

158153
static bool _MCStackConfigureCallback(MCStack *p_stack, void *p_context)

engine/src/stackview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void MCStack::view_configure(bool p_user)
504504

505505
// IM-2014-10-29: [[ Bug 13812 ]] Remove need resize check and unset flag
506506
m_view_need_resize = false;
507-
507+
508508
if (!MCU_equal_rect(t_view_rect, m_view_rect))
509509
{
510510
// IM-2014-02-13: [[ StackScale ]] Test if the view size has changed

engine/src/w32dcw32.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,12 +1319,12 @@ LRESULT CALLBACK MCWindowProc(HWND hwnd, UINT msg, WPARAM wParam,
13191319
if (target->isiconic())
13201320
{
13211321
MCstacks->restack(target);
1322-
target->view_configure(true);
1322+
target->wreshape(dw);
13231323
target->uniconify();
13241324
SetWindowPos((HWND)target -> getwindow() -> handle . window, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
13251325
}
13261326
else
1327-
target->view_configure(true);
1327+
target->wreshape(dw);
13281328
curinfo->handled = True;
13291329
}
13301330
}
@@ -1340,7 +1340,7 @@ LRESULT CALLBACK MCWindowProc(HWND hwnd, UINT msg, WPARAM wParam,
13401340
}
13411341
else
13421342
{
1343-
MCdispatcher->configure(dw);
1343+
MCdispatcher->wreshape(dw);
13441344
curinfo->handled = True;
13451345
}
13461346
break;

0 commit comments

Comments
 (0)