61
Window / mouse coord out until resize by any amount
« on: June 27, 2008, 05:55:53 am »
Yeap you're right, it shouldn't =p
e.g. i use 1280x1024, with getDesktopMode VideoMode is at 1280x1024, and Rect from AdjustRect is at 1288x1058 (window area) but the final window size (include border and title) is 1288x1036. That's why your final client area is shrinked (requested : 1280x1024 real : 1280x1002).
Some tests with differents window size :
800x600 (OK) :
1024x768 (OK) :
1280x1024 (desktop resolution) :
1280x1024 (with sfNone instead of sfResize | sfClose)
Requested client : 1280x1024 Real client : 1280x1024
Requested window : 1280x1024 Real client : 1280x1024
I don't know why CreateWindow reduce your window size (maybe there is a maximum window size ?) but it does. =)
e.g. i use 1280x1024, with getDesktopMode VideoMode is at 1280x1024, and Rect from AdjustRect is at 1288x1058 (window area) but the final window size (include border and title) is 1288x1036. That's why your final client area is shrinked (requested : 1280x1024 real : 1280x1002).
Some tests with differents window size :
Code: [Select]
// Create the window
if (HasUnicodeSupport())
{
wchar_t WTitle[256];
int NbChars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Title.c_str(), static_cast<int>(Title.size()), WTitle, sizeof(WTitle) / sizeof(*WTitle));
WTitle[NbChars] = L'\0';
myHandle = CreateWindowW(ourClassNameW, WTitle, Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this);
}
else
{
myHandle = CreateWindowA(ourClassNameA, Title.c_str(), Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this);
}
{
if (!Fullscreen)
{
RECT clientRect , windowRect = {0, 0, 0, 0};
GetClientRect(myHandle, &clientRect);
GetWindowRect(myHandle, &windowRect);
myWidth = clientRect.right - clientRect.left;
myHeight = clientRect.bottom - clientRect.top;
int realWidth = windowRect.right - windowRect.left;
int realHeight = windowRect.bottom - windowRect.top;
std::cout << "Requested client : " << Mode.Width << "x" << Mode.Height << " Real client : " << myWidth << "x" << myHeight << std::endl;
std::cout << "Requested window : " << Width << "x" << Height << " Real client : " << realWidth << "x" << realHeight << std::endl;
}
}
800x600 (OK) :
Quote
Requested client : 800x600 Real client : 800x600
Requested window : 808x634 Real client : 808x634
1024x768 (OK) :
Quote
Requested client : 1024x768 Real client : 1024x768
Requested window : 1032x802 Real client : 1032x802
1280x1024 (desktop resolution) :
Quote
Requested client : 1280x1024 Real client : 1280x1002
Requested window : 1288x1058 Real client : 1288x1036
1280x1024 (with sfNone instead of sfResize | sfClose)
Quote
Requested window : 1280x1024 Real client : 1280x1024
I don't know why CreateWindow reduce your window size (maybe there is a maximum window size ?) but it does. =)