allow for the client to be validated.
don't manage override_redirect windows. don't manage windows for whome get attributes fails. validate the client before managing it. validate the client in functions that query stuff off it: propertyHandler and clientMessageHandler
This commit is contained in:
parent
58dc93abb9
commit
39c6969de2
2 changed files with 31 additions and 0 deletions
|
@ -49,6 +49,8 @@ Client::Client(int screen, Window window)
|
|||
_layer = Layer_Normal;
|
||||
// default to not urgent
|
||||
_urgent = false;
|
||||
// not positioned unless specified
|
||||
_positioned = false;
|
||||
|
||||
getArea();
|
||||
getDesktop();
|
||||
|
@ -115,6 +117,21 @@ Client::~Client()
|
|||
}
|
||||
|
||||
|
||||
bool Client::validate() const
|
||||
{
|
||||
XSync(**otk::display, false); // get all events on the server
|
||||
|
||||
XEvent e;
|
||||
if (XCheckTypedWindowEvent(**otk::display, _window, DestroyNotify, &e) ||
|
||||
XCheckTypedWindowEvent(**otk::display, _window, UnmapNotify, &e)) {
|
||||
XPutBackEvent(**otk::display, &e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Client::getGravity()
|
||||
{
|
||||
XWindowAttributes wattrib;
|
||||
|
@ -636,6 +653,9 @@ void Client::updateTransientFor()
|
|||
void Client::propertyHandler(const XPropertyEvent &e)
|
||||
{
|
||||
otk::EventHandler::propertyHandler(e);
|
||||
|
||||
// validate cuz we query stuff off the client here
|
||||
if (!validate()) return;
|
||||
|
||||
// compress changes to a single property into a single change
|
||||
XEvent ce;
|
||||
|
@ -910,6 +930,9 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
|
|||
{
|
||||
otk::EventHandler::clientMessageHandler(e);
|
||||
|
||||
// validate cuz we query stuff off the client here
|
||||
if (!validate()) return;
|
||||
|
||||
if (e.format != 32) return;
|
||||
|
||||
if (e.message_type == otk::Property::atoms.wm_change_state) {
|
||||
|
|
|
@ -602,6 +602,14 @@ BB @param window The window id that the Client class should handle
|
|||
//! Remove focus from the client window
|
||||
void unfocus() const;
|
||||
|
||||
//! Validate client, by making sure no Destroy or Unmap events exist in
|
||||
//! the event queue for the window.
|
||||
/*!
|
||||
@return true if the client is valid; false if the client has already
|
||||
been unmapped/destroyed, and so is invalid.
|
||||
*/
|
||||
bool validate() const;
|
||||
|
||||
virtual void focusHandler(const XFocusChangeEvent &e);
|
||||
virtual void unfocusHandler(const XFocusChangeEvent &e);
|
||||
virtual void propertyHandler(const XPropertyEvent &e);
|
||||
|
|
Loading…
Reference in a new issue