Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit b7cbc7e

Browse files
committed
[19277] Ensure the effective rect is fetched correctly when screen is locked
1 parent ce50a97 commit b7cbc7e

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

engine/src/desktop-stack.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,18 @@ void MCStack::realize(void)
225225

226226
MCRectangle MCStack::view_platform_getwindowrect() const
227227
{
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+
t_diff_rect = MCU_subtract_rect(t_content_rect, t_frame_rect);
235+
return t_diff_rect;
236+
}
237+
238+
return t_frame_rect;
239+
231240
}
232241

233242
bool MCStack::view_platform_dirtyviewonresize() const

engine/src/lnxstack.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,18 @@ MCRectangle MCStack::view_device_getwindowrect(void) const
489489
{
490490
GdkRectangle t_frame;
491491
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+
t_diff_rect = MCU_subtract_rect(t_content_rect, t_frame_rect);
500+
return t_diff_rect;
501+
}
502+
503+
return t_frame_rect;
493504
}
494505

495506
// IM-2014-01-29: [[ HiDPI ]] Placeholder method for Linux HiDPI support

engine/src/w32stack.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,21 @@ MCRectangle MCStack::view_platform_getwindowrect() const
487487
RECT wrect;
488488
GetWindowRect((HWND)window->handle.window, &wrect);
489489

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((HWND)window->handle.window, t_content_rect);
500+
t_diff_rect = MCU_subtract_rect(t_content_rect, t_frame_rect);
501+
return t_diff_rect;
502+
}
503+
504+
return t_frame_rect;
497505
}
498506

499507
// IM-2013-09-23: [[ FullscreenMode ]] Factor out device-specific window sizing

0 commit comments

Comments
 (0)