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
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-05-28 11:23:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-05-28 11:46:15 +0300
commitf3161c97a6eea885a9f162599d42d7ca85e2cfe3 (patch)
tree4fb6f6a4ad32a31e8676ef3e0142291c82796a19 /intern
parent4be7258f003ea6894bfe28173246279393ea19ec (diff)
Ghost/X11: allow creating windows to fail
Would exit, problematic for setting stereo3d modes which aren't always supported.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp56
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h4
2 files changed, 33 insertions, 27 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index a2d7303243a..bd0d6829e27 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -291,11 +291,17 @@ GHOST_WindowX11(
m_visualInfo(NULL),
m_normal_state(GHOST_kWindowStateNormal),
m_system(system),
- m_valid_setup(false),
m_invalid_window(false),
m_empty_cursor(None),
m_custom_cursor(None),
- m_visible_cursor(None)
+ m_visible_cursor(None),
+#ifdef WITH_XDND
+ m_dropTarget(NULL),
+#endif
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+ m_xic(NULL),
+#endif
+ m_valid_setup(false)
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
m_visualInfo = x11_visualinfo_from_glx(m_display, stereoVisual, &m_wantNumOfAASamples);
@@ -306,10 +312,10 @@ GHOST_WindowX11(
m_visualInfo = XGetVisualInfo(m_display, 0, &tmp, &n);
}
- /* exit if this is the first window */
+ /* caller needs to check 'getValid()' */
if (m_visualInfo == NULL) {
- fprintf(stderr, "initial window could not find the GLX extension, exit!\n");
- exit(EXIT_FAILURE);
+ fprintf(stderr, "initial window could not find the GLX extension\n");
+ return;
}
unsigned int xattributes_valuemask = 0;
@@ -486,11 +492,6 @@ GHOST_WindowX11(
}
}
-#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
- m_xic = NULL;
-#endif
-
-
/* Set the window hints */
{
XWMHints *xwmhints = XAllocWMHints();
@@ -1216,15 +1217,6 @@ validate()
GHOST_WindowX11::
~GHOST_WindowX11()
{
- static Atom Primary_atom, Clipboard_atom;
- Window p_owner, c_owner;
- /*Change the owner of the Atoms to None if we are the owner*/
- Primary_atom = XInternAtom(m_display, "PRIMARY", False);
- Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False);
-
- p_owner = XGetSelectionOwner(m_display, Primary_atom);
- c_owner = XGetSelectionOwner(m_display, Clipboard_atom);
-
std::map<unsigned int, Cursor>::iterator it = m_standard_cursors.begin();
for (; it != m_standard_cursors.end(); ++it) {
XFreeCursor(m_display, it->second);
@@ -1237,11 +1229,23 @@ GHOST_WindowX11::
XFreeCursor(m_display, m_custom_cursor);
}
- if (p_owner == m_window) {
- XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime);
- }
- if (c_owner == m_window) {
- XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime);
+ if (m_valid_setup) {
+ static Atom Primary_atom, Clipboard_atom;
+ Window p_owner, c_owner;
+ /*Change the owner of the Atoms to None if we are the owner*/
+ Primary_atom = XInternAtom(m_display, "PRIMARY", False);
+ Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False);
+
+
+ p_owner = XGetSelectionOwner(m_display, Primary_atom);
+ c_owner = XGetSelectionOwner(m_display, Clipboard_atom);
+
+ if (p_owner == m_window) {
+ XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime);
+ }
+ if (c_owner == m_window) {
+ XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime);
+ }
}
if (m_visualInfo) {
@@ -1260,7 +1264,9 @@ GHOST_WindowX11::
releaseNativeHandles();
- XDestroyWindow(m_display, m_window);
+ if (m_valid_setup) {
+ XDestroyWindow(m_display, m_window);
+ }
}
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index eaa8a5327f7..277afe38e19 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -327,8 +327,6 @@ private:
/** A pointer to the typed system class. */
GHOST_SystemX11 *m_system;
- bool m_valid_setup;
-
/** Used to concatenate calls to invalidate() on this window. */
bool m_invalid_window;
@@ -356,6 +354,8 @@ private:
XIC m_xic;
#endif
+ bool m_valid_setup;
+
void icccmSetState(int state);
int icccmGetState() const;