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_ContextSDL.cpp20
-rw-r--r--intern/ghost/intern/GHOST_ContextSDL.h1
-rw-r--r--intern/ghost/intern/GHOST_System.cpp6
-rw-r--r--intern/ghost/intern/GHOST_SystemNULL.h2
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp29
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.h6
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp4
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp2
-rw-r--r--intern/ghost/intern/GHOST_TaskbarX11.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm28
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp4
12 files changed, 84 insertions, 22 deletions
diff --git a/intern/ghost/intern/GHOST_ContextSDL.cpp b/intern/ghost/intern/GHOST_ContextSDL.cpp
index 1ba591bd0b2..3b3cf7a2962 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.cpp
+++ b/intern/ghost/intern/GHOST_ContextSDL.cpp
@@ -55,6 +55,7 @@ GHOST_ContextSDL::GHOST_ContextSDL(
int contextResetNotificationStrategy)
: GHOST_Context(stereoVisual, numOfAASamples),
m_window(window),
+ m_hidden_window(NULL),
m_contextProfileMask(contextProfileMask),
m_contextMajorVersion(contextMajorVersion),
m_contextMinorVersion(contextMinorVersion),
@@ -62,7 +63,7 @@ GHOST_ContextSDL::GHOST_ContextSDL(
m_contextResetNotificationStrategy(contextResetNotificationStrategy),
m_context(NULL)
{
- assert(m_window != NULL);
+ // assert(m_window != NULL);
}
@@ -70,7 +71,7 @@ GHOST_ContextSDL::~GHOST_ContextSDL()
{
if (m_context != NULL) {
if (m_window != NULL && m_context == SDL_GL_GetCurrentContext())
- SDL_GL_MakeCurrent(m_window, m_context);
+ SDL_GL_MakeCurrent(m_window, NULL);
if (m_context != s_sharedContext || s_sharedCount == 1) {
assert(s_sharedCount > 0);
@@ -82,6 +83,9 @@ GHOST_ContextSDL::~GHOST_ContextSDL()
SDL_GL_DeleteContext(m_context);
}
+
+ if (m_hidden_window != NULL)
+ SDL_DestroyWindow(m_hidden_window);
}
}
@@ -160,6 +164,18 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, m_numOfAASamples);
}
+ if (m_window == NULL) {
+ m_hidden_window = SDL_CreateWindow(
+ "Offscreen Context Windows",
+ SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED,
+ 1, 1,
+ SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_HIDDEN
+ );
+
+ m_window = m_hidden_window;
+ }
+
m_context = SDL_GL_CreateContext(m_window);
GHOST_TSuccess success;
diff --git a/intern/ghost/intern/GHOST_ContextSDL.h b/intern/ghost/intern/GHOST_ContextSDL.h
index 681d24bb7c6..1829819300c 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.h
+++ b/intern/ghost/intern/GHOST_ContextSDL.h
@@ -120,6 +120,7 @@ public:
private:
SDL_Window *m_window;
+ SDL_Window *m_hidden_window;
const int m_contextProfileMask;
const int m_contextMajorVersion;
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index 0629eacc3ff..4a8a8c48018 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -219,10 +219,12 @@ bool GHOST_System::getFullScreen(void)
void GHOST_System::dispatchEvents()
{
#ifdef WITH_INPUT_NDOF
+ #ifndef WIN32
// NDOF Motion event is sent only once per dispatch, so do it now:
if (m_ndofManager) {
m_ndofManager->sendMotionEvent();
}
+ #endif
#endif
if (m_eventManager) {
@@ -297,7 +299,9 @@ GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool& isDown
#ifdef WITH_INPUT_NDOF
void GHOST_System::setNDOFDeadZone(float deadzone)
{
- this->m_ndofManager->setDeadZone(deadzone);
+ if (this->m_ndofManager) {
+ this->m_ndofManager->setDeadZone(deadzone);
+ }
}
#endif
diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h
index 7c8d26d7486..ac3dfd71d63 100644
--- a/intern/ghost/intern/GHOST_SystemNULL.h
+++ b/intern/ghost/intern/GHOST_SystemNULL.h
@@ -53,6 +53,8 @@ public:
void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const { /* nop */ }
void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const { /* nop */ }
bool supportsNativeDialogs(void) { return false;}
+ GHOST_IContext *createOffscreenContext() { return NULL; }
+ GHOST_TSuccess disposeContext(GHOST_IContext *context) { return GHOST_kFailure; }
GHOST_TSuccess init() {
GHOST_TSuccess success = GHOST_System::init();
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index d7860577338..094cbe76cb2 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -26,6 +26,7 @@
#include <assert.h>
+#include "GHOST_ContextSDL.h"
#include "GHOST_SystemSDL.h"
#include "GHOST_WindowSDL.h"
@@ -149,6 +150,34 @@ GHOST_SystemSDL::getNumDisplays() const
return SDL_GetNumVideoDisplays();
}
+GHOST_IContext *
+GHOST_SystemSDL::createOffscreenContext()
+{
+ GHOST_Context *context = new GHOST_ContextSDL(
+ 0,
+ 0,
+ NULL,
+ 0, // profile bit
+ 3, 3,
+ GHOST_OPENGL_SDL_CONTEXT_FLAGS,
+ GHOST_OPENGL_SDL_RESET_NOTIFICATION_STRATEGY);
+
+ if (context->initializeDrawingContext())
+ return context;
+ else
+ delete context;
+
+ return NULL;
+}
+
+GHOST_TSuccess
+GHOST_SystemSDL::disposeContext(GHOST_IContext *context)
+{
+ delete context;
+
+ return GHOST_kSuccess;
+}
+
GHOST_TSuccess
GHOST_SystemSDL::getModifierKeys(GHOST_ModifierKeys& keys) const
{
diff --git a/intern/ghost/intern/GHOST_SystemSDL.h b/intern/ghost/intern/GHOST_SystemSDL.h
index 41f110ed15d..0610a80ea5f 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.h
+++ b/intern/ghost/intern/GHOST_SystemSDL.h
@@ -95,6 +95,12 @@ public:
getMainDisplayDimensions(GHOST_TUns32& width,
GHOST_TUns32& height) const;
+ GHOST_IContext *
+ createOffscreenContext();
+
+ GHOST_TSuccess
+ disposeContext(GHOST_IContext *context);
+
/**
* Informs if the system provides native dialogs (eg. confirm quit)
*/
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 17c41e96be4..924173a6c68 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1110,8 +1110,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
#ifdef WITH_INPUT_NDOF
case RIM_TYPEHID:
- if (system->processNDOF(raw))
+ if (system->processNDOF(raw)) {
+ system->m_ndofManager->sendMotionEvent();
eventHandled = true;
+ }
break;
#endif
}
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index fcda5d8b72d..5d383f68e9d 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -261,7 +261,7 @@ GHOST_SystemX11::
#endif /* WITH_X11_XINPUT */
if (m_xkb_descr) {
- XkbFreeNames(m_xkb_descr, XkbKeyNamesMask, false);
+ XkbFreeKeyboard (m_xkb_descr, XkbAllComponentsMask, true);
}
XCloseDisplay(m_display);
diff --git a/intern/ghost/intern/GHOST_TaskbarX11.cpp b/intern/ghost/intern/GHOST_TaskbarX11.cpp
index 2ef82dc6636..9826ccdfa37 100644
--- a/intern/ghost/intern/GHOST_TaskbarX11.cpp
+++ b/intern/ghost/intern/GHOST_TaskbarX11.cpp
@@ -44,7 +44,7 @@ static unity_event_loop_t unity_event_loop;
static bool libunity_initialized = false;
static bool libunity_available = false;
-void* libunity_handle = NULL;
+static void *libunity_handle = NULL;
void GHOST_TaskBarX11::free()
{
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 2b986428fd3..22dc772fff0 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -865,30 +865,30 @@ void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
{
- NSPoint screenCoord;
- NSPoint baseCoord;
+ NSRect screenCoord;
+ NSRect baseCoord;
- screenCoord.x = inX;
- screenCoord.y = inY;
+ screenCoord.origin.x = inX;
+ screenCoord.origin.y = inY;
- baseCoord = [m_window convertScreenToBase:screenCoord];
+ baseCoord = [m_window convertRectFromScreen:screenCoord];
- outX = baseCoord.x;
- outY = baseCoord.y;
+ outX = baseCoord.origin.x;
+ outY = baseCoord.origin.y;
}
void GHOST_WindowCocoa::clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
{
- NSPoint screenCoord;
- NSPoint baseCoord;
+ NSRect screenCoord;
+ NSRect baseCoord;
- baseCoord.x = inX;
- baseCoord.y = inY;
+ baseCoord.origin.x = inX;
+ baseCoord.origin.y = inY;
- screenCoord = [m_window convertBaseToScreen:baseCoord];
+ screenCoord = [m_window convertRectToScreen:baseCoord];
- outX = screenCoord.x;
- outY = screenCoord.y;
+ outX = screenCoord.origin.x;
+ outY = screenCoord.origin.y;
}
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index aeb6188daef..9c41087bd59 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -93,7 +93,7 @@ GHOST_WindowSDL::newDrawingContext(GHOST_TDrawingContextType type)
m_wantNumOfAASamples,
m_sdl_win,
0, // profile bit
- 0, 0,
+ 3, 3,
GHOST_OPENGL_SDL_CONTEXT_FLAGS,
GHOST_OPENGL_SDL_RESET_NOTIFICATION_STRATEGY);
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index e740542961e..11aa2094997 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -598,13 +598,15 @@ GHOST_WindowX11(GHOST_SystemX11 *system,
}
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
-static void destroyICCallback(XIC /*xic*/, XPointer ptr, XPointer /*data*/)
+static Bool destroyICCallback(XIC /*xic*/, XPointer ptr, XPointer /*data*/)
{
GHOST_PRINT("XIM input context destroyed\n");
if (ptr) {
*(XIC *)ptr = NULL;
}
+ /* Ignored by X11. */
+ return True;
}
bool GHOST_WindowX11::createX11_XIC()