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

Commit 13e32bc

Browse files
committed
compute width rather than use right/bottom edges as width
1 parent 06467eb commit 13e32bc

File tree

2 files changed

+44
-13
lines changed

2 files changed

+44
-13
lines changed

appshell/cef_dark_aero_window.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -517,18 +517,18 @@ BOOL cef_dark_aero_window::HandleNcMouseMove(UINT uHitTest, LPPOINT pt)
517517
// WM_GETMINMAXINFO handler
518518
BOOL cef_dark_aero_window::HandleGetMinMaxInfo(LPMINMAXINFO mmi)
519519
{
520-
if (CanUseAeroGlass()) {
521-
HMONITOR hm = ::MonitorFromWindow(mWnd, MONITOR_DEFAULTTONEAREST);
522-
MONITORINFO mi = {0};
523-
mi.cbSize = sizeof (mi);
520+
if (CanUseAeroGlass()) {
521+
HMONITOR hm = ::MonitorFromWindow(mWnd, MONITOR_DEFAULTTONEAREST);
522+
MONITORINFO mi = {0};
523+
mi.cbSize = sizeof (mi);
524524

525-
::GetMonitorInfo(hm, &mi);
525+
::GetMonitorInfo(hm, &mi);
526+
mmi->ptMaxSize.x = ::RectWidth(mi.rcWork) + ::kWindowFrameSize;
527+
mmi->ptMaxSize.y = ::RectHeight(mi.rcWork) + ::kWindowFrameSize;
526528

527-
mmi->ptMaxSize.x = mi.rcWork.right + ::kWindowFrameSize;
528-
mmi->ptMaxSize.y = mi.rcWork.bottom + ::kWindowFrameSize;
529-
mmi->ptMaxPosition.x = -::kWindowFrameSize;
530-
mmi->ptMaxPosition.y = -::kWindowFrameSize;
531-
}
529+
mmi->ptMaxPosition.x = -::kWindowFrameSize;
530+
mmi->ptMaxPosition.y = -::kWindowFrameSize;
531+
}
532532

533533
return TRUE;
534534
}

appshell/cef_window.h

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,47 @@ class cef_window;
2828
class cef_menu;
2929

3030
// RECT helpers
31-
static __inline int RectWidth(const RECT &r) { return r.right - r.left; }
32-
static __inline int RectHeight(const RECT &r) { return r.bottom - r.top; }
33-
3431
static __inline void RectSwapLeftRight(RECT &r)
3532
{
3633
LONG temp = r.left;
3734
r.left = r.right;
3835
r.right = temp;
3936
}
4037

38+
static __inline void NormalizeRect(RECT& r)
39+
{
40+
int nTemp;
41+
if (r.left > r.right)
42+
{
43+
nTemp = r.left;
44+
r.left = r.right;
45+
r.right = nTemp;
46+
}
47+
if (r.top > r.bottom)
48+
{
49+
nTemp = r.top;
50+
r.top = r.bottom;
51+
r.bottom = nTemp;
52+
}
53+
}
54+
55+
static __inline int RectWidth(const RECT &rIn)
56+
{
57+
RECT r;
58+
::CopyRect(&r, &rIn);
59+
::NormalizeRect(r);
60+
return r.right - r.left;
61+
}
62+
63+
static __inline int RectHeight(const RECT &rIn)
64+
{
65+
RECT r;
66+
::CopyRect(&r, &rIn);
67+
::NormalizeRect(r);
68+
return r.bottom - r.top;
69+
}
70+
71+
4172
// Undocumented Flags for GetDCEx()
4273
#ifndef DCX_USESTYLE
4374
#define DCX_USESTYLE 0x00010000

0 commit comments

Comments
 (0)