mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
better window resize handling
This commit is contained in:
parent
c5574929e8
commit
d244387ec3
@ -232,7 +232,6 @@ static pascal OSStatus windowEvtHndlr (EventHandlerCallRef myHandler, EventRef e
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void osxGraphicsWindow::DoResize(void)
|
void osxGraphicsWindow::DoResize(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
osxdisplay_cat.debug() << "In Resize Out....." << _properties << "\n";
|
osxdisplay_cat.debug() << "In Resize Out....." << _properties << "\n";
|
||||||
// only in window mode .. not full screen
|
// only in window mode .. not full screen
|
||||||
if(_osx_window != NULL && _is_fullsreen == false && _properties.has_size())
|
if(_osx_window != NULL && _is_fullsreen == false && _properties.has_size())
|
||||||
@ -1388,32 +1387,19 @@ if (osxdisplay_cat.is_debug())
|
|||||||
|
|
||||||
bool osxGraphicsWindow::do_reshape_request(int x_origin, int y_origin, bool has_origin,int x_size, int y_size)
|
bool osxGraphicsWindow::do_reshape_request(int x_origin, int y_origin, bool has_origin,int x_size, int y_size)
|
||||||
{
|
{
|
||||||
if(_osx_window == NULL)
|
if (_properties.get_fullscreen()) {
|
||||||
|
// Can't resize fullscreen windows that easily.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (osxdisplay_cat.is_debug())
|
|
||||||
osxdisplay_cat.debug() << "do_reshape_request " << x_origin <<" "<< y_origin <<" "<< has_origin<< " " << x_size <<" "<< y_size <<"\n";
|
|
||||||
|
|
||||||
|
|
||||||
// location is optional
|
|
||||||
Rect rect;
|
|
||||||
if(has_origin)
|
|
||||||
{
|
|
||||||
rect.left = x_origin;
|
|
||||||
rect.top = y_origin;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GetWindowPortBounds (_osx_window, &rect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok set size .. not oprional
|
// For now, ignore the origin, since we seem to be getting a bogus
|
||||||
rect.left = rect.left + x_size;
|
// origin of (0, 0).
|
||||||
rect.bottom = rect.top + y_size;
|
/*
|
||||||
|
if (has_origin) {
|
||||||
SetWindowUserState(_osx_window, &rect);
|
MoveWindow(_osx_window, x_origin, y_origin, false);
|
||||||
SetWindowStandardState (_osx_window, &rect );
|
}
|
||||||
|
*/
|
||||||
|
SizeWindow(_osx_window, x_size, y_size, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1458,7 +1444,6 @@ void osxGraphicsWindow::set_properties_now(WindowProperties &properties)
|
|||||||
osxdisplay_cat.debug() << "set_properties_now After Base Class" << properties << "\n";
|
osxdisplay_cat.debug() << "set_properties_now After Base Class" << properties << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if(_osx_window == NULL)
|
// if(_osx_window == NULL)
|
||||||
// {
|
// {
|
||||||
// cerr<< "-------------------------------------set_properties_now out(not Window) Request=[" <<properties <<"]\n";
|
// cerr<< "-------------------------------------set_properties_now out(not Window) Request=[" <<properties <<"]\n";
|
||||||
@ -1491,24 +1476,41 @@ void osxGraphicsWindow::set_properties_now(WindowProperties &properties)
|
|||||||
need_full_rebuild = true;
|
need_full_rebuild = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we are fullscreen and requesting a size change
|
||||||
|
if (_properties.get_fullscreen() &&
|
||||||
|
(properties.has_size() &&
|
||||||
|
(properties.get_x_size() != _properties.get_x_size() ||
|
||||||
|
properties.get_y_size() != _properties.get_y_size()))) {
|
||||||
|
need_full_rebuild = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(need_full_rebuild)
|
if(need_full_rebuild)
|
||||||
{
|
{
|
||||||
// Login here is .. tage a union of the properties .. with the new allowed to overwrite the old states.
|
// Logic here is .. take a union of the properties .. with the
|
||||||
// and start a bootstrap of a new window ..
|
// new allowed to overwrite the old states. and start a bootstrap
|
||||||
|
// of a new window ..
|
||||||
|
|
||||||
|
if (properties.has_size()) {
|
||||||
|
// Make sure the DisplayRegions, etc., will be updated.
|
||||||
|
system_changed_size(properties.get_x_size(), properties.get_y_size());
|
||||||
|
}
|
||||||
|
|
||||||
// get a copy of my properties..
|
// get a copy of my properties..
|
||||||
WindowProperties req_properties(_properties);
|
WindowProperties req_properties(_properties);
|
||||||
cerr<< "-------------------------------------Lets Go Full Rebuild Request=[" <<properties <<"]\n";
|
// cerr<< "-------------------------------------Lets Go Full Rebuild Request=[" <<properties <<"]\n";
|
||||||
ReleaseSystemResources();
|
ReleaseSystemResources();
|
||||||
_properties.clear();
|
_properties.clear();
|
||||||
req_properties.add_properties(properties);
|
req_properties.add_properties(properties);
|
||||||
// put back in the request bucket..
|
|
||||||
properties = req_properties;
|
|
||||||
|
|
||||||
OSOpenWindow(properties);
|
OSOpenWindow(req_properties);
|
||||||
|
|
||||||
|
// Now we've handled all of the requested properties.
|
||||||
|
properties.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1546,55 +1548,6 @@ if(properties.has_cursor_hidden())
|
|||||||
properties.clear_cursor_hidden();
|
properties.clear_cursor_hidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// icons
|
|
||||||
if(properties.has_icon_filename())
|
|
||||||
{
|
|
||||||
_properties.set_icon_filename(properties.get_icon_filename());
|
|
||||||
properties.clear_icon_filename();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(properties.has_cursor_filename())
|
|
||||||
{
|
|
||||||
_properties.set_cursor_filename(properties.get_cursor_filename());
|
|
||||||
properties.clear_cursor_filename();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(properties.has_minimized())
|
|
||||||
{
|
|
||||||
_properties.set_minimized(properties.get_minimized());
|
|
||||||
properties.clear_minimized();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(properties.has_foreground())
|
|
||||||
{
|
|
||||||
_properties.set_foreground(properties.get_foreground());
|
|
||||||
properties.clear_foreground();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if(properties.has_size())
|
|
||||||
{
|
|
||||||
_properties.set_size(properties.get_size());
|
|
||||||
properties.clear_size();
|
|
||||||
|
|
||||||
do_reshape_request(_properties.
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if(properties.has_open())
|
|
||||||
{
|
|
||||||
|
|
||||||
// cerr << " properties Has Open Flag \n";
|
|
||||||
properties.clear_open();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// cerr<< "-------------------------------------- out request=[" <<properties <<"]\n";
|
// cerr<< "-------------------------------------- out request=[" <<properties <<"]\n";
|
||||||
if (osxdisplay_cat.is_debug())
|
if (osxdisplay_cat.is_debug())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user