This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +80
-11
lines changed
Filter options
Expand file tree Collapse file tree 5 files changed +80
-11
lines changed
Original file line number Diff line number Diff line change
1
+ # Ensure the effective rect is fetched correctly when screen is locked
Original file line number Diff line number Diff line change @@ -225,9 +225,23 @@ void MCStack::realize(void)
225
225
226
226
MCRectangle MCStack::view_platform_getwindowrect () const
227
227
{
228
- MCRectangle t_rect;
229
- MCPlatformGetWindowFrameRect (window, t_rect);
230
- return t_rect;
228
+ MCRectangle t_frame_rect;
229
+ MCPlatformGetWindowFrameRect (window, t_frame_rect);
230
+ if (MClockscreen != 0 )
231
+ {
232
+ MCRectangle t_content_rect, t_diff_rect;
233
+ MCscreen->platform_getwindowgeometry (window, t_content_rect);
234
+ // the content rect of a window should always be contained (or equal) to the frame rect
235
+ // so compute these 4 margins and then apply them to the rect of the stack
236
+ t_diff_rect.x = rect.x - (t_content_rect.x - t_frame_rect.x );
237
+ t_diff_rect.y = rect.y - (t_content_rect.y - t_frame_rect.y );
238
+ t_diff_rect.width = rect.width + (t_frame_rect.width - t_content_rect.width );
239
+ t_diff_rect.height = rect.height + (t_frame_rect.height - t_content_rect.height );
240
+ return t_diff_rect;
241
+ }
242
+
243
+ return t_frame_rect;
244
+
231
245
}
232
246
233
247
bool MCStack::view_platform_dirtyviewonresize () const
Original file line number Diff line number Diff line change @@ -489,7 +489,23 @@ MCRectangle MCStack::view_device_getwindowrect(void) const
489
489
{
490
490
GdkRectangle t_frame;
491
491
gdk_window_get_frame_extents (window, &t_frame);
492
- return MCRectangleMake (t_frame . x, t_frame . y, t_frame . width, t_frame . height);
492
+ MCRectangle t_frame_rect;
493
+ t_frame_rect = MCRectangleMake (t_frame . x, t_frame . y, t_frame . width, t_frame . height);
494
+
495
+ if (MClockscreen != 0 )
496
+ {
497
+ MCRectangle t_content_rect, t_diff_rect;
498
+ MCscreen->platform_getwindowgeometry (window, t_content_rect);
499
+ // the content rect of a window should always be contained (or equal) to the frame rect
500
+ // so compute these 4 margins and then apply them to the rect of the stack
501
+ t_diff_rect.x = rect.x - (t_content_rect.x - t_frame_rect.x );
502
+ t_diff_rect.y = rect.y - (t_content_rect.y - t_frame_rect.y );
503
+ t_diff_rect.width = rect.width + (t_frame_rect.width - t_content_rect.width );
504
+ t_diff_rect.height = rect.height + (t_frame_rect.height - t_content_rect.height );
505
+ return t_diff_rect;
506
+ }
507
+
508
+ return t_frame_rect;
493
509
}
494
510
495
511
// IM-2014-01-29: [[ HiDPI ]] Placeholder method for Linux HiDPI support
Original file line number Diff line number Diff line change @@ -487,13 +487,26 @@ MCRectangle MCStack::view_platform_getwindowrect() const
487
487
RECT wrect;
488
488
GetWindowRect ((HWND)window->handle .window , &wrect);
489
489
490
- MCRectangle t_rect;
491
- t_rect = MCRectangleFromWin32RECT (wrect);
492
-
493
- // IM-2014-01-28: [[ HiDPI ]] Convert screen to logical coords
494
- t_rect = MCscreen->screentologicalrect (t_rect);
495
-
496
- return t_rect;
490
+ MCRectangle t_frame_rect;
491
+ t_frame_rect = MCRectangleFromWin32RECT (wrect);
492
+
493
+ // IM-2014-01-28: [[ HiDPI ]] Convert screen to logical coords
494
+ t_frame_rect = MCscreen->screentologicalrect (t_frame_rect);
495
+
496
+ if (MClockscreen != 0 )
497
+ {
498
+ MCRectangle t_content_rect, t_diff_rect;
499
+ MCscreen->platform_getwindowgeometry (window, t_content_rect);
500
+ // the content rect of a window should always be contained (or equal) to the frame rect
501
+ // so compute these 4 margins and then apply them to the rect of the stack
502
+ t_diff_rect.x = rect.x - (t_content_rect.x - t_frame_rect.x );
503
+ t_diff_rect.y = rect.y - (t_content_rect.y - t_frame_rect.y );
504
+ t_diff_rect.width = rect.width + (t_frame_rect.width - t_content_rect.width );
505
+ t_diff_rect.height = rect.height + (t_frame_rect.height - t_content_rect.height );
506
+ return t_diff_rect;
507
+ }
508
+
509
+ return t_frame_rect;
497
510
}
498
511
499
512
// IM-2013-09-23: [[ FullscreenMode ]] Factor out device-specific window sizing
Original file line number Diff line number Diff line change @@ -501,6 +501,31 @@ wait 2 ticks
501
501
TestAssert "the ticks change with time" , the ticks - tTime >= 2
502
502
end TestTicks
503
503
504
+ on TestEffectiveRectIsUpdatedWhileScreenIsLocked
505
+ local tRectBefore , tRectAfter , tEffectiveRectBefore , tEffectiveRectAfter
506
+
507
+ local tLeft ,tTop
508
+ put 100 into tLeft
509
+ put 200 into tTop
510
+
511
+ create stack "TestStack"
512
+ put the rect of stack "TestStack" into tRectBefore
513
+ lock screen
514
+ set the top of stack "TestStack" to the top of stack "TestStack" + tTop
515
+ set the left of stack "TestStack" to the left of stack "TestStack" + tLeft
516
+ put the effective rect of stack "TestStack" into tEffectiveRectBefore
517
+ put the rect of stack "TestStack" into tRectAfter
518
+ unlock screen
519
+ put the effective rect of stack "TestStack" into tEffectiveRectAfter
520
+ add tTop to item 2 of tRectBefore
521
+ add tTop to item 4 of tRectBefore
522
+ add tLeft to item 1 of tRectBefore
523
+ add tLeft to item 3 of tRectBefore
524
+ TestAssert "rect of stack is updated while screen is locked" , tRectBefore is tRectAfter
525
+ TestAssert "effective rect of stack is updated while screen is locked" , tEffectiveRectBefore is tEffectiveRectAfter
526
+ delete stack "TestStack"
527
+ end TestEffectiveRectIsUpdatedWhileScreenIsLocked
528
+
504
529
on TestUngroupAndQuit
505
530
-- Bug 21500: run a subprocess in which we ungroup a group and
506
531
-- then quit, to test that it no longer crashes
You can’t perform that action at this time.
0 commit comments