win32: minimally handle lcd layouts in fullscreen
This commit is contained in:
parent
56c4cbc679
commit
c9e117452f
|
@ -506,6 +506,12 @@ void SetMinWindowSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetNdsScreenRect(RECT* r)
|
static void GetNdsScreenRect(RECT* r)
|
||||||
|
{
|
||||||
|
RECT zero;
|
||||||
|
SetRect(&zero,0,0,0,0);
|
||||||
|
if(zero == MainScreenRect) *r = SubScreenRect;
|
||||||
|
else if(zero == SubScreenRect) *r = MainScreenRect;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
RECT* dstRects [2] = {&MainScreenRect, &SubScreenRect};
|
RECT* dstRects [2] = {&MainScreenRect, &SubScreenRect};
|
||||||
int left = min(dstRects[0]->left,dstRects[1]->left);
|
int left = min(dstRects[0]->left,dstRects[1]->left);
|
||||||
|
@ -514,6 +520,7 @@ static void GetNdsScreenRect(RECT* r)
|
||||||
int bottom = max(dstRects[0]->bottom,dstRects[1]->bottom);
|
int bottom = max(dstRects[0]->bottom,dstRects[1]->bottom);
|
||||||
SetRect(r,left,top,right,bottom);
|
SetRect(r,left,top,right,bottom);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UnscaleScreenCoords(s32& x, s32& y)
|
void UnscaleScreenCoords(s32& x, s32& y)
|
||||||
{
|
{
|
||||||
|
@ -1074,11 +1081,17 @@ void LCDsSwap(int swapVal)
|
||||||
|
|
||||||
void doLCDsLayout()
|
void doLCDsLayout()
|
||||||
{
|
{
|
||||||
|
HWND hwnd = MainWindow->getHWnd();
|
||||||
|
|
||||||
|
bool maximized = IsZoomed(hwnd)==TRUE;
|
||||||
|
|
||||||
|
if(maximized) ShowWindow(hwnd,SW_NORMAL);
|
||||||
|
|
||||||
if(video.layout != 0)
|
if(video.layout != 0)
|
||||||
{
|
{
|
||||||
// rotation is not supported in the alternate layouts
|
// rotation is not supported in the alternate layouts
|
||||||
if(video.rotation != 0)
|
if(video.rotation != 0)
|
||||||
SetRotate(MainWindow->getHWnd(), 0, false);
|
SetRotate(hwnd, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
osd->singleScreen = (video.layout == 2);
|
osd->singleScreen = (video.layout == 2);
|
||||||
|
@ -1087,7 +1100,7 @@ void doLCDsLayout()
|
||||||
int oldheight, oldwidth;
|
int oldheight, oldwidth;
|
||||||
int newheight, newwidth;
|
int newheight, newwidth;
|
||||||
|
|
||||||
GetClientRect(MainWindow->getHWnd(), &rc);
|
GetClientRect(hwnd, &rc);
|
||||||
oldwidth = (rc.right - rc.left);
|
oldwidth = (rc.right - rc.left);
|
||||||
oldheight = (rc.bottom - rc.top);
|
oldheight = (rc.bottom - rc.top);
|
||||||
newwidth = oldwidth;
|
newwidth = oldwidth;
|
||||||
|
@ -1201,16 +1214,19 @@ void doLCDsLayout()
|
||||||
newwidth = newheight;
|
newwidth = newheight;
|
||||||
newheight = temp;
|
newheight = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow->setClientSize(newwidth, newheight);
|
MainWindow->setClientSize(newwidth, newheight);
|
||||||
FixAspectRatio();
|
FixAspectRatio();
|
||||||
UpdateWndRects(MainWindow->getHWnd());
|
UpdateWndRects(hwnd);
|
||||||
|
|
||||||
if(video.layout == 0)
|
if(video.layout == 0)
|
||||||
{
|
{
|
||||||
// restore user-set rotation if we forcibly disabled it before
|
// restore user-set rotation if we forcibly disabled it before
|
||||||
if(video.rotation != video.rotation_userset)
|
if(video.rotation != video.rotation_userset)
|
||||||
SetRotate(MainWindow->getHWnd(), video.rotation_userset, false);
|
SetRotate(hwnd, video.rotation_userset, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(maximized) ShowWindow(hwnd,SW_MAXIMIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
|
@ -1338,11 +1354,14 @@ static void DD_DoDisplay()
|
||||||
{
|
{
|
||||||
RECT fullScreen;
|
RECT fullScreen;
|
||||||
GetWindowRect(MainWindow->getHWnd(),&fullScreen);
|
GetWindowRect(MainWindow->getHWnd(),&fullScreen);
|
||||||
int left = min(dstRects[0]->left,dstRects[1]->left);
|
RECT r;
|
||||||
int top = min(dstRects[0]->top,dstRects[1]->top);
|
GetNdsScreenRect(&r);
|
||||||
int right = max(dstRects[0]->right,dstRects[1]->right);
|
int left = r.left;
|
||||||
int bottom = max(dstRects[0]->bottom,dstRects[1]->bottom);
|
int top = r.top;
|
||||||
|
int right = r.right;
|
||||||
|
int bottom = r.bottom;
|
||||||
//printf("%d %d %d %d / %d %d %d %d\n",fullScreen.left,fullScreen.top,fullScreen.right,fullScreen.bottom,left,top,right,bottom);
|
//printf("%d %d %d %d / %d %d %d %d\n",fullScreen.left,fullScreen.top,fullScreen.right,fullScreen.bottom,left,top,right,bottom);
|
||||||
|
//printf("%d %d %d %d / %d %d %d %d\n",MainScreenRect.left,MainScreenRect.top,MainScreenRect.right,MainScreenRect.bottom,SubScreenRect.left,SubScreenRect.top,SubScreenRect.right,SubScreenRect.bottom);
|
||||||
DD_FillRect(lpPrimarySurface,0,0,left,top,RGB(255,0,0)); //topleft
|
DD_FillRect(lpPrimarySurface,0,0,left,top,RGB(255,0,0)); //topleft
|
||||||
DD_FillRect(lpPrimarySurface,left,0,right,top,RGB(128,0,0)); //topcenter
|
DD_FillRect(lpPrimarySurface,left,0,right,top,RGB(128,0,0)); //topcenter
|
||||||
DD_FillRect(lpPrimarySurface,right,0,fullScreen.right,top,RGB(0,255,0)); //topright
|
DD_FillRect(lpPrimarySurface,right,0,fullScreen.right,top,RGB(0,255,0)); //topright
|
||||||
|
|
|
@ -31,4 +31,9 @@ void GetINIPath();
|
||||||
void PreventScreensaver();
|
void PreventScreensaver();
|
||||||
void DesEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, bool enable);
|
void DesEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, bool enable);
|
||||||
|
|
||||||
|
inline bool operator==(const RECT& lhs, const RECT& rhs)
|
||||||
|
{
|
||||||
|
return lhs.left == rhs.left && lhs.top == rhs.top && lhs.right == rhs.right && lhs.bottom == rhs.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue