Home » U++ Library support » TopWindow&PopUp, TrayIcon » TopWindow::SerializePlacement () on dual-head display
Re: TopWindow::SerializePlacement () on dual-head display [message #36293 is a reply to message #34271] |
Fri, 18 May 2012 15:36 |
Tom1
Messages: 1217 Registered: March 2007
|
Senior Contributor |
|
|
Hi,
I found that having stored maximized window loses the normal size information when restored. Here's the fixed version of SerializePlacement:
void TopWindow::SerializePlacement(Stream& s, bool reminimize)
{
GuiLock __;
#ifndef PLATFORM_WINCE
int version = 0;
s / version;
Rect rect = GetRect();
s % overlapped % rect;
bool mn = state == MINIMIZED;
bool mx = state == MAXIMIZED;
s.Pack(mn, mx);
LLOG("TopWindow::SerializePlacement / " << (s.IsStoring() ? "write" : "read"));
LLOG("minimized = " << mn << ", maximized = " << mx);
LLOG("rect = " << rect << ", overlapped = " << overlapped);
if(s.IsLoading()) {
rect = overlapped;
Rect limit = GetVirtualWorkArea();
Rect outer = rect;
::AdjustWindowRect(outer, WS_OVERLAPPEDWINDOW, FALSE);
limit.left += rect.left - outer.left;
limit.top += rect.top - outer.top;
limit.right += rect.right - outer.right;
limit.bottom += rect.bottom - outer.bottom;
Size sz = min(rect.Size(), limit.Size());
rect = RectC(
minmax(rect.left, limit.left, limit.right - sz.cx),
minmax(rect.top, limit.top, limit.bottom - sz.cy),
sz.cx, sz.cy);
state = OVERLAPPED;
SetRect(rect);
if(mn && reminimize)
state = MINIMIZED;
if(mx)
state = MAXIMIZED;
if(IsOpen()) {
WINDOWPLACEMENT wp;
memset(&wp,0,sizeof(WINDOWPLACEMENT));
wp.length=sizeof(WINDOWPLACEMENT);
wp.showCmd = state==MINIMIZED ? SW_MINIMIZE : state==MAXIMIZED ? SW_MAXIMIZE : SW_RESTORE;
wp.rcNormalPosition.left=rect.left;
wp.rcNormalPosition.top=rect.top;
wp.rcNormalPosition.right=rect.right;
wp.rcNormalPosition.bottom=rect.bottom;
::SetWindowPlacement(GetHWND(),&wp);
}
}
#endif
}
Unfortunately, I'm still unable to fix another problem with FullScreen mode: At this time it is serialized as if it was a maximized window. Additionally, it also loses the normal window position information in the process.
Best regards,
Tom
|
|
|
|
|
TopWindow::SerializePlacement () on dual-head display
By: Tom1 on Mon, 07 November 2011 09:42
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: mirek on Mon, 07 November 2011 09:51
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: Tom1 on Mon, 07 November 2011 10:56
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: Tom1 on Mon, 07 November 2011 15:54
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: Tom1 on Fri, 18 May 2012 15:36
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: Tom1 on Wed, 23 May 2012 12:58
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: mirek on Wed, 23 May 2012 15:40
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: Tom1 on Thu, 24 May 2012 08:53
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: mirek on Thu, 24 May 2012 08:59
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: Tom1 on Thu, 24 May 2012 09:02
|
|
|
Re: TopWindow::SerializePlacement () on dual-head display
By: unodgs on Mon, 07 November 2011 10:52
|
Goto Forum:
Current Time: Sat Jun 08 08:22:34 CEST 2024
Total time taken to generate the page: 0.01952 seconds
|