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:
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowX11.cpp')
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp62
1 files changed, 34 insertions, 28 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 613b4dfe4be..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();
@@ -561,7 +562,7 @@ GHOST_WindowX11(
}
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
-static void destroyICCallback(XIC xic, XPointer ptr, XPointer data)
+static void destroyICCallback(XIC /*xic*/, XPointer ptr, XPointer /*data*/)
{
GHOST_PRINT("XIM input context destroyed\n");
@@ -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);
+ }
}
@@ -1536,8 +1542,8 @@ setWindowCustomCursorShape(
int sizey,
int hotX,
int hotY,
- int fg_color,
- int bg_color)
+ int /*fg_color*/,
+ int /*bg_color*/)
{
Colormap colormap = DefaultColormap(m_display, m_visualInfo->screen);
Pixmap bitmap_pix, mask_pix;