mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
get_rejected_properties(), etc.
This commit is contained in:
parent
99b5342b5b
commit
4b61f609ed
@ -140,6 +140,37 @@ get_requested_properties() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsWindow::clear_rejected_properties
|
||||
// Access: Published
|
||||
// Description: Empties the set of failed properties that will be
|
||||
// returned by get_rejected_properties().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GraphicsWindow::
|
||||
clear_rejected_properties() {
|
||||
MutexHolder holder(_lock);
|
||||
_rejected_properties.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsWindow::get_rejected_properties
|
||||
// Access: Published
|
||||
// Description: Returns the set of properties that have recently been
|
||||
// requested, but could not be applied to the window for
|
||||
// some reason. This set of properties will remain
|
||||
// unchanged until they are changed by a new failed
|
||||
// request, or clear_rejected_properties() is called.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
WindowProperties GraphicsWindow::
|
||||
get_rejected_properties() const {
|
||||
WindowProperties result;
|
||||
{
|
||||
MutexHolder holder(_lock);
|
||||
result = _rejected_properties;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GraphicsWindow::request_properties
|
||||
// Access: Published
|
||||
@ -700,12 +731,14 @@ process_events() {
|
||||
{
|
||||
MutexHolder holder(_lock);
|
||||
properties = _requested_properties;
|
||||
_requested_properties = WindowProperties();
|
||||
}
|
||||
set_properties_now(properties);
|
||||
if (properties.is_any_specified()) {
|
||||
display_cat.info()
|
||||
<< "Unable to set window properties: " << properties << "\n";
|
||||
_requested_properties.clear();
|
||||
|
||||
set_properties_now(properties);
|
||||
if (properties.is_any_specified()) {
|
||||
display_cat.info()
|
||||
<< "Unable to set window properties: " << properties << "\n";
|
||||
_rejected_properties.add_properties(properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -748,7 +781,14 @@ set_properties_now(WindowProperties &properties) {
|
||||
chan->window_resized(_properties.get_x_size(),
|
||||
_properties.get_y_size());
|
||||
}
|
||||
|
||||
} else {
|
||||
// Since we can't even open the window, tag the
|
||||
// _rejected_properties with all of the window properties that
|
||||
// failed.
|
||||
_rejected_properties.add_properties(_properties);
|
||||
|
||||
// And mark the window closed.
|
||||
_properties.set_open(false);
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,8 @@ PUBLISHED:
|
||||
|
||||
WindowProperties get_properties() const;
|
||||
WindowProperties get_requested_properties() const;
|
||||
void clear_rejected_properties();
|
||||
WindowProperties get_rejected_properties() const;
|
||||
void request_properties(const WindowProperties &requested_properties);
|
||||
INLINE bool is_closed() const;
|
||||
INLINE bool is_active() const;
|
||||
@ -177,6 +179,7 @@ private:
|
||||
bool _display_regions_stale;
|
||||
|
||||
WindowProperties _requested_properties;
|
||||
WindowProperties _rejected_properties;
|
||||
string _window_event;
|
||||
|
||||
public:
|
||||
|
@ -156,6 +156,10 @@ void glxGraphicsWindow::
|
||||
process_events() {
|
||||
GraphicsWindow::process_events();
|
||||
|
||||
if (_xwindow == (Window)0) {
|
||||
return;
|
||||
}
|
||||
|
||||
XEvent event;
|
||||
while (XCheckWindowEvent(_display, _xwindow, _event_mask, &event)) {
|
||||
WindowProperties properties;
|
||||
@ -273,6 +277,7 @@ void glxGraphicsWindow::
|
||||
set_properties_now(WindowProperties &properties) {
|
||||
GraphicsWindow::set_properties_now(properties);
|
||||
if (!properties.is_any_specified()) {
|
||||
// The base class has already handled this case.
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user