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')
-rw-r--r--intern/ghost/intern/GHOST_Context.h2
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.mm7
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp14
-rw-r--r--intern/ghost/intern/GHOST_Debug.h2
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerX11.cpp5
-rw-r--r--intern/ghost/intern/GHOST_DropTargetX11.cpp3
-rw-r--r--intern/ghost/intern/GHOST_EventDragnDrop.h1
-rw-r--r--intern/ghost/intern/GHOST_EventPrinter.cpp3
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerX11.cpp2
-rw-r--r--intern/ghost/intern/GHOST_System.cpp4
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm9
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsCocoa.mm9
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsX11.cpp2
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp8
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h2
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp6
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h12
-rw-r--r--intern/ghost/intern/GHOST_Window.cpp2
-rw-r--r--intern/ghost/intern/GHOST_Window.h4
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm9
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp62
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h4
23 files changed, 95 insertions, 79 deletions
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index 0dfea867703..18d36c40e9c 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -99,7 +99,7 @@ public:
* \param interval The swap interval to use.
* \return A boolean success indicator.
*/
- virtual GHOST_TSuccess setSwapInterval(int interval) {
+ virtual GHOST_TSuccess setSwapInterval(int /*interval*/) {
return GHOST_kFailure;
}
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index 0b290c617a5..ae7e7a69854 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -292,14 +292,16 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
[m_openGLView setPixelFormat:pixelFormat];
- m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:s_sharedOpenGLContext];
+ m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:s_sharedOpenGLContext]; // +1 refCount to pixelFormat
if (m_openGLContext == nil)
goto error;
if (s_sharedCount == 0)
s_sharedOpenGLContext = m_openGLContext;
-
+
+ [pixelFormat release]; // -1 refCount to pixelFormat
+
s_sharedCount++;
#ifdef GHOST_MULTITHREADED_OPENGL
@@ -332,6 +334,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
error:
[m_openGLView setOpenGLContext:prev_openGLContext];
+ [pixelFormat release];
[pool drain];
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 055737481ae..4f4cab77602 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -120,9 +120,9 @@ GHOST_ContextWGL::~GHOST_ContextWGL()
#endif
#ifndef NDEBUG
- delete m_dummyRenderer;
- delete m_dummyVendor;
- delete m_dummyVersion;
+ free((void*)m_dummyRenderer);
+ free((void*)m_dummyVendor);
+ free((void*)m_dummyVersion);
#endif
}
@@ -393,9 +393,9 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
// the following are not technially WGLEW, but they also require a context to work
#ifndef NDEBUG
- delete m_dummyRenderer;
- delete m_dummyVendor;
- delete m_dummyVersion;
+ free((void*)m_dummyRenderer);
+ free((void*)m_dummyVendor);
+ free((void*)m_dummyVersion);
m_dummyRenderer = _strdup(reinterpret_cast<const char *>(glGetString(GL_RENDERER)));
m_dummyVendor = _strdup(reinterpret_cast<const char *>(glGetString(GL_VENDOR)));
@@ -888,7 +888,7 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
if (!s_warn_old) {
if ((strcmp(vendor, "Microsoft Corporation") == 0 ||
- strcmp(renderer, "GDI Generic") == 0) && version[0] == '1' && version[0] == '1')
+ strcmp(renderer, "GDI Generic") == 0) && version[0] == '1' && version[2] == '1')
{
MessageBox(m_hWnd, "Your system does not use 3D hardware acceleration.\n"
"Such systems can cause stability problems in Blender and they are unsupported.\n\n"
diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h
index 9292235a9c7..db49627b378 100644
--- a/intern/ghost/intern/GHOST_Debug.h
+++ b/intern/ghost/intern/GHOST_Debug.h
@@ -80,7 +80,7 @@
} \
} (void)0
#else // GHOST_DEBUG
-# define GHOST_ASSERT(x, info)
+# define GHOST_ASSERT(x, info) ((void)0)
#endif // GHOST_DEBUG
#endif // __GHOST_DEBUG_H__
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index 24289e6b006..0cc116292c0 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -90,6 +90,7 @@ getNumDisplaySettings(
numSettings = 1;
#endif
+ (void) display;
return GHOST_kSuccess;
}
@@ -116,6 +117,8 @@ getDisplaySetting(
if (dpy == NULL)
return GHOST_kFailure;
+ (void) display;
+
#ifdef WITH_X11_XF86VMODE
int majorVersion, minorVersion;
@@ -171,7 +174,7 @@ getCurrentDisplaySetting(
GHOST_TSuccess
GHOST_DisplayManagerX11::
setCurrentDisplaySetting(
- GHOST_TUns8 display,
+ GHOST_TUns8 /*display*/,
const GHOST_DisplaySetting& setting)
{
#ifdef WITH_X11_XF86VMODE
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp
index 639fd503759..0efc8a78df5 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp
@@ -132,7 +132,8 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
unsigned int i;
unsigned int len = strlen(encodedIn);
DecodeState_e state = STATE_SEARCH;
- int j, asciiCharacter;
+ int j;
+ unsigned int asciiCharacter;
char tempNumBuf[3] = {0};
bool bothDigits = true;
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index c51f9568087..b7bf37c99d8 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -112,6 +112,7 @@ public:
for (i = 0; i < strArray->count; i++)
free(strArray->strings[i]);
+ free(strArray->strings);
free(strArray);
}
break;
diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp
index 4b7be84ac81..f25f6637cb1 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.cpp
+++ b/intern/ghost/intern/GHOST_EventPrinter.cpp
@@ -179,6 +179,9 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
std::cout << "not found"; handled = false;
break;
}
+
+ std::cout.flush();
+
return handled;
}
diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
index de44b36c73e..75e476c287f 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
@@ -43,7 +43,7 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
#define MAX_LINE_LENGTH 100
/* look for USB devices with Logitech or 3Dconnexion's vendor ID */
- FILE *command_output = popen("lsusb | grep '046d:\|256f:'", "r");
+ FILE *command_output = popen("lsusb | grep '046d:\\|256f:'", "r");
if (command_output) {
char line[MAX_LINE_LENGTH] = {0};
while (fgets(line, MAX_LINE_LENGTH, command_output)) {
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index fef8fda7da3..baa1bdff79a 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -169,7 +169,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
}
-GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window)
+GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow ** /*window*/)
{
GHOST_TSuccess success = GHOST_kFailure;
GHOST_ASSERT(m_windowManager, "GHOST_System::updateFullScreen(): invalid window manager");
@@ -371,7 +371,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const
}
-int GHOST_System::confirmQuit(GHOST_IWindow *window) const
+int GHOST_System::confirmQuit(GHOST_IWindow * /*window*/) const
{
return 1;
}
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 095c738e1e0..bdcaadba2f3 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -73,6 +73,10 @@ static GHOST_TButtonMask convertButton(int button)
return GHOST_kButtonMaskButton4;
case 4:
return GHOST_kButtonMaskButton5;
+ case 5:
+ return GHOST_kButtonMaskButton6;
+ case 6:
+ return GHOST_kButtonMaskButton7;
default:
return GHOST_kButtonMaskLeft;
}
@@ -882,7 +886,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
if (!strArray) return GHOST_kFailure;
strArray->count = [droppedArray count];
- if (strArray->count == 0) return GHOST_kFailure;
+ if (strArray->count == 0) {
+ free(strArray);
+ return GHOST_kFailure;
+ }
strArray->strings = (GHOST_TUns8**) malloc(strArray->count*sizeof(GHOST_TUns8*));
diff --git a/intern/ghost/intern/GHOST_SystemPathsCocoa.mm b/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
index 50ad91eeb99..36ae534da87 100644
--- a/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
@@ -24,14 +24,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#import <Cocoa/Cocoa.h>
-
-/*For the currently not ported to Cocoa keyboard layout functions (64bit & 10.6 compatible)*/
-#include <Carbon/Carbon.h>
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
+#import <Foundation/Foundation.h>
#include "GHOST_SystemPathsCocoa.h"
diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
index e2d9733a9b2..5473e404593 100644
--- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
@@ -121,7 +121,7 @@ const GHOST_TUns8 *GHOST_SystemPathsX11::getBinaryDir() const
return NULL;
}
-void GHOST_SystemPathsX11::addToSystemRecentFiles(const char *filename) const
+void GHOST_SystemPathsX11::addToSystemRecentFiles(const char * /*filename*/) const
{
/* XXXXX TODO: Implementation for X11 if possible */
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 27eb387e9f8..46ed8bbe1fc 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -714,8 +714,8 @@ GHOST_EventWheel *GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window
// zDelta /= WHEEL_DELTA;
// temporary fix below: microsoft now has added more precision, making the above division not work
- if (zDelta <= 0) zDelta = -1; else zDelta = 1;
-
+ zDelta = (zDelta <= 0) ? -1 : 1;
+
// short xPos = (short) LOWORD(lParam); // horizontal position of pointer
// short yPos = (short) HIWORD(lParam); // vertical position of pointer
return new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, zDelta);
@@ -989,6 +989,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
eventHandled = true;
ime->UpdateImeWindow(hwnd);
ime->UpdateInfo(hwnd);
+ if (ime->eventImeData.result_len) {
+ /* remove redundant IME event */
+ eventManager->removeTypeEvents(GHOST_kEventImeComposition, window);
+ }
event = processImeEvent(
GHOST_kEventImeComposition,
window,
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index e615ef164c8..3841ae58b8d 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -182,7 +182,7 @@ public:
GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const;
/**
- * Returns unsinged char from CUT_BUFFER0
+ * Returns unsigned char from CUT_BUFFER0
* \param selection Used by X11 only
* \return Returns the Clipboard
*/
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 241ce9728cc..7a4fb254ce7 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -329,7 +329,7 @@ createWindow(const STR_String& title,
}
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
-static void destroyIMCallback(XIM xim, XPointer ptr, XPointer data)
+static void destroyIMCallback(XIM /*xim*/, XPointer ptr, XPointer /*data*/)
{
GHOST_PRINT("XIM server died\n");
@@ -1882,7 +1882,7 @@ GHOST_TSuccess GHOST_SystemX11::pushDragDropEvent(GHOST_TEventType eventType,
* Basically it will not crash blender now if you have a X device that
* is configured but not plugged in.
*/
-int GHOST_X11_ApplicationErrorHandler(Display *display, XErrorEvent *theEvent)
+int GHOST_X11_ApplicationErrorHandler(Display * /*display*/, XErrorEvent *theEvent)
{
fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
theEvent->error_code, theEvent->request_code);
@@ -1891,7 +1891,7 @@ int GHOST_X11_ApplicationErrorHandler(Display *display, XErrorEvent *theEvent)
return 0;
}
-int GHOST_X11_ApplicationIOErrorHandler(Display *display)
+int GHOST_X11_ApplicationIOErrorHandler(Display * /*display*/)
{
fprintf(stderr, "Ignoring Xlib error: error IO\n");
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 4004bda11cb..f4d4825a12a 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -157,10 +157,6 @@ public:
);
/**
- * \section Interface Inherited from GHOST_ISystem
- */
-
- /**
* Retrieves events from the system and stores them in the queue.
* \param waitForEvent Flag to wait for an event (or return immediately).
* \return Indication of the presence of events.
@@ -170,9 +166,6 @@ public:
bool waitForEvent
);
- /**
- * \section Interface Inherited from GHOST_System
- */
GHOST_TSuccess
getCursorPosition(
GHOST_TInt32& x,
@@ -206,7 +199,6 @@ public:
) const;
/**
- * \section Interface Dirty
* Flag a window as dirty. This will
* generate a GHOST window update event on a call to processEvents()
*/
@@ -241,7 +233,7 @@ public:
unsigned int *context) const;
/**
- * Returns unsinged char from CUT_BUFFER0
+ * Returns unsigned char from CUT_BUFFER0
* \param selection Get selection, X11 only feature
* \return Returns the Clipboard indicated by Flag
*/
@@ -271,7 +263,7 @@ public:
/**
* \see GHOST_ISystem
*/
- int toggleConsole(int action) {
+ int toggleConsole(int /*action*/) {
return 0;
}
diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp
index dd6154a42bb..71fa260f0f2 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -46,7 +46,7 @@ GHOST_Window::GHOST_Window(
GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state,
const bool wantStereoVisual,
- const bool exclusive,
+ const bool /*exclusive*/,
const GHOST_TUns16 wantNumOfAASamples)
: m_drawingContextType(GHOST_kDrawingContextTypeNone),
m_cursorVisible(true),
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index b78a690fcad..d894a30bf25 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -182,7 +182,7 @@ public:
* Sets the progress bar value displayed in the window/application icon
* \param progress The progress % (0.0 to 1.0)
*/
- virtual GHOST_TSuccess setProgressBar(float progress) {
+ virtual GHOST_TSuccess setProgressBar(float /*progress*/) {
return GHOST_kFailure;
}
@@ -329,7 +329,7 @@ protected:
* Sets the cursor grab on the window using
* native window system calls.
*/
- virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) {
+ virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode /*mode*/) {
return GHOST_kSuccess;
}
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 65d371c8ca8..f1f38cc14b3 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -1328,6 +1328,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress)
return GHOST_kSuccess;
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
static void postNotification()
{
NSUserNotification *notification = [[NSUserNotification alloc] init];
@@ -1337,7 +1338,8 @@ static void postNotification()
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
[notification release];
}
-
+#endif
+
GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
{
if (!m_progressBarVisible) return GHOST_kFailure;
@@ -1355,11 +1357,12 @@ GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
// With OSX 10.8 and later, we can use notifications to inform the user when the progress reached 100%
// Atm. just fire this when the progressbar ends, the behavior is controlled in the NotificationCenter
// If Blender is not frontmost window, a message pops up with sound, in any case an entry in notifications
-
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if ([NSUserNotificationCenter respondsToSelector:@selector(defaultUserNotificationCenter)]) {
postNotification();
}
-
+#endif
+
[dockIcon release];
[pool drain];
diff --git a/intern/ghost/intern/GHOST_WindowManager.cpp b/intern/ghost/intern/GHOST_WindowManager.cpp
index 1f20e01ca73..83490cecce5 100644
--- a/intern/ghost/intern/GHOST_WindowManager.cpp
+++ b/intern/ghost/intern/GHOST_WindowManager.cpp
@@ -121,7 +121,7 @@ GHOST_IWindow *GHOST_WindowManager::getFullScreenWindow(void) const
GHOST_TSuccess GHOST_WindowManager::beginFullScreen(GHOST_IWindow *window,
- bool stereoVisual)
+ bool /*stereoVisual*/)
{
GHOST_TSuccess success = GHOST_kFailure;
GHOST_ASSERT(window, "GHOST_WindowManager::beginFullScreen(): invalid window");
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;
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;