Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Borghetti <bdiego@gmail.com>2009-07-28 23:14:25 +0400
committerDiego Borghetti <bdiego@gmail.com>2009-07-28 23:14:25 +0400
commit00e92c4d8c27bad7405155df1fe26ee87d887485 (patch)
tree03a938ff77a49804e372405af6278db078171ec4
parent8cf4ef091c91fa4666aa9b017ddba61b52c02806 (diff)
Fix crash on Linux with some WM.
This is fixed on trunk but was remove in some merge (give conflict).
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index fcf78d9ad20..e5e88502f45 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -534,11 +534,28 @@ GHOST_SystemX11::processEvent(XEvent *xe)
window, data);
}
} else if (((Atom)xcme.data.l[0]) == m_wm_take_focus) {
+ XWindowAttributes attr;
+ Window fwin;
+ int revert_to;
+
/* as ICCCM say, we need reply this event
* with a SetInputFocus, the data[1] have
* the valid timestamp (send by the wm).
+ *
+ * Some WM send this event before the
+ * window is really mapped (for example
+ * change from virtual desktop), so we need
+ * to be sure that our windows is mapped
+ * or this call fail and close blender.
*/
- XSetInputFocus(m_display, xcme.window, RevertToParent, xcme.data.l[1]);
+ if (XGetWindowAttributes(m_display, xcme.window, &attr) == True) {
+ if (XGetInputFocus(m_display, &fwin, &revert_to) == True) {
+ if (attr.map_state == IsViewable) {
+ if (fwin != xcme.window)
+ XSetInputFocus(m_display, xcme.window, RevertToParent, xcme.data.l[1]);
+ }
+ }
+ }
} else {
/* Unknown client message, ignore */
}