mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
deal with initially hidden windows properly
This commit is contained in:
parent
7978472f00
commit
d280ad2a81
@ -713,9 +713,40 @@ do_reshape_request(int x_origin, int y_origin, bool has_origin,
|
|||||||
void WinGraphicsWindow::
|
void WinGraphicsWindow::
|
||||||
handle_reshape() {
|
handle_reshape() {
|
||||||
RECT view_rect;
|
RECT view_rect;
|
||||||
GetClientRect(_hWnd, &view_rect);
|
if (!GetClientRect(_hWnd, &view_rect)) {
|
||||||
ClientToScreen(_hWnd, (POINT*)&view_rect.left); // translates top,left pnt
|
// Sometimes we get a "reshape" before the window is fully
|
||||||
ClientToScreen(_hWnd, (POINT*)&view_rect.right); // translates right,bottom pnt
|
// created, in which case GetClientRect() ought to fail. Ignore
|
||||||
|
// this.
|
||||||
|
if (windisplay_cat.is_debug()) {
|
||||||
|
windisplay_cat.debug()
|
||||||
|
<< "GetClientRect() failed in handle_reshape. Ignoring.\n";
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// But in practice, GetClientRect() doesn't really fail, but just
|
||||||
|
// returns all zeroes. Ignore this too.
|
||||||
|
if (view_rect.left == 0 && view_rect.right == 0 &&
|
||||||
|
view_rect.bottom == 0 && view_rect.top == 0) {
|
||||||
|
if (windisplay_cat.is_debug()) {
|
||||||
|
windisplay_cat.debug()
|
||||||
|
<< "GetClientRect() returned all zeroes in handle_reshape. Ignoring.\n";
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool result = ClientToScreen(_hWnd, (POINT*)&view_rect.left); // translates top,left pnt
|
||||||
|
if (result) {
|
||||||
|
result = ClientToScreen(_hWnd, (POINT*)&view_rect.right); // translates right,bottom pnt
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
if (windisplay_cat.is_debug()) {
|
||||||
|
windisplay_cat.debug()
|
||||||
|
<< "ClientToScreen() failed in handle_reshape. Ignoring.\n";
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WindowProperties properties;
|
WindowProperties properties;
|
||||||
properties.set_size((view_rect.right - view_rect.left),
|
properties.set_size((view_rect.right - view_rect.left),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user