diff options
Diffstat (limited to 'intern')
29 files changed, 491 insertions, 156 deletions
diff --git a/intern/SoundSystem/Makefile b/intern/SoundSystem/Makefile index d00339f351c..051e2643a87 100644 --- a/intern/SoundSystem/Makefile +++ b/intern/SoundSystem/Makefile @@ -47,6 +47,9 @@ ifneq ($(NAN_NO_OPENAL),true) ifeq ($(OS),$(findstring $(OS), "linux freebsd solaris")) DIRS += openal sdl endif + ifeq ($(OS), irix) + DIRS += sdl + endif else export CPPFLAGS += -DNO_SOUND endif diff --git a/intern/SoundSystem/SConscript b/intern/SoundSystem/SConscript index be19c4b7915..2be20a24042 100644 --- a/intern/SoundSystem/SConscript +++ b/intern/SoundSystem/SConscript @@ -17,4 +17,4 @@ else: if not env['WITH_BF_SDL']: defs += ' DISABLE_SDL' -env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [20,140] ) +env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [25,135] ) diff --git a/intern/boolop/SConscript b/intern/boolop/SConscript index bec263f251f..a3f3c0b6433 100644 --- a/intern/boolop/SConscript +++ b/intern/boolop/SConscript @@ -8,7 +8,7 @@ incs += ' ../../source/blender/makesdna ../../intern/guardedalloc' incs += ' ../../source/blender/blenlib' if (env['OURPLATFORM'] == 'win32-mingw'): - env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [30,85] ) + env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [5,50] ) else: env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='common', priority = 5 ) diff --git a/intern/boolop/intern/BOP_Merge2.cpp b/intern/boolop/intern/BOP_Merge2.cpp index bbf3f8ba702..f75fddc554e 100644 --- a/intern/boolop/intern/BOP_Merge2.cpp +++ b/intern/boolop/intern/BOP_Merge2.cpp @@ -294,8 +294,8 @@ void BOP_Merge2::cleanup( void ) BOP_Vertexs v = m_mesh->getVertexs(); for( BOP_IT_Vertexs it = v.begin(); it != v.end(); ++it ) { if( (*it)->getTAG() != BROKEN) { - BOP_Indexs edges = (*it)->getEdges(); - for(BOP_IT_Indexs i = edges.begin();i!=edges.end();i++) + BOP_Indexs iedges = (*it)->getEdges(); + for(BOP_IT_Indexs i = iedges.begin();i!=iedges.end();i++) if( m_mesh->getEdge((*i))->getUsed( ) == false) (*it)->removeEdge( *i ); if( (*it)->getEdges().size() == 0 ) (*it)->setTAG(BROKEN); } @@ -432,8 +432,8 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) vert->setTAG(BROKEN); for(BOP_IT_Indexs it = edges.begin(); it != edges.end(); ++it ) { - BOP_Edge *edge = m_mesh->getEdge(*it); - edge->setUsed(false); + BOP_Edge *tedge = m_mesh->getEdge(*it); + tedge->setUsed(false); } didMerge = true; } diff --git a/intern/bsp/SConscript b/intern/bsp/SConscript index 39f278625a9..0d1b74ea2ca 100644 --- a/intern/bsp/SConscript +++ b/intern/bsp/SConscript @@ -6,7 +6,7 @@ sources = env.Glob('intern/*.cpp') incs = 'intern ../container ../moto/include ../memutil' if (env['OURPLATFORM'] == 'win32-mingw'): - env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,69] ) + env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,26] ) else: - env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=26 ) + env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=20 ) diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript index cf199fb3bc5..2dd2ac38498 100644 --- a/intern/decimation/SConscript +++ b/intern/decimation/SConscript @@ -5,4 +5,4 @@ sources = env.Glob('intern/*.cpp') incs = '. ../moto/include ../container ../memutil' -env.BlenderLib ('bf_decimation', sources, Split(incs) , [], libtype=['core','common','player'], priority = [10, 20, 25] ) +env.BlenderLib ('bf_decimation', sources, Split(incs) , [], libtype=['core','common','player'], priority = [10, 20, 20] ) diff --git a/intern/elbeem/intern/utilities.h b/intern/elbeem/intern/utilities.h index 825e92251fe..a5f63e696a6 100644 --- a/intern/elbeem/intern/utilities.h +++ b/intern/elbeem/intern/utilities.h @@ -154,12 +154,18 @@ int writePng(const char *fileName, unsigned char **rowsp, int w, int h); */ /* minimum */ +#ifdef MIN +#undef MIN +#endif template < class T > inline T MIN( T a, T b ) { return (a < b) ? a : b ; } /* maximum */ +#ifdef MAX +#undef MAX +#endif template < class T > inline T MAX( T a, T b ) diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index 6b1295f649b..b683740247a 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -150,6 +150,9 @@ typedef enum { GHOST_kEventWindowDeactivate, GHOST_kEventWindowUpdate, GHOST_kEventWindowSize, + GHOST_kEventWindowMove, + + GHOST_kEventTimer, GHOST_kNumEventTypes } GHOST_TEventType; diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript index f6283cfc0f2..ad6b4ff51ba 100644 --- a/intern/ghost/SConscript +++ b/intern/ghost/SConscript @@ -29,4 +29,4 @@ else: incs = '. ../string ' + env['BF_OPENGL_INC'] if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross'): incs = env['BF_WINTAB_INC'] + ' ' + incs -env.BlenderLib ('bf_ghost', sources, Split(incs), defines=['_USE_MATH_DEFINES'], libtype=['core','player'], priority = [25,15] ) +env.BlenderLib ('bf_ghost', sources, Split(incs), defines=['_USE_MATH_DEFINES'], libtype=['core','intern','player'], priority = [40,44,5] ) diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index b7643784250..ad5189af0e9 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -48,11 +48,6 @@ #include "GHOST_IEventConsumer.h" #include "intern/GHOST_CallbackEventConsumer.h" -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - - GHOST_SystemHandle GHOST_CreateSystem(void) { GHOST_ISystem::createSystem(); diff --git a/intern/ghost/intern/GHOST_DisplayManager.h b/intern/ghost/intern/GHOST_DisplayManager.h index a707b5aeddd..50c59a6d348 100644 --- a/intern/ghost/intern/GHOST_DisplayManager.h +++ b/intern/ghost/intern/GHOST_DisplayManager.h @@ -35,10 +35,6 @@ #include "GHOST_Types.h" -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif // WIN32 - #include <vector> /** diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp index a8565578967..1a61428bccc 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp +++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp @@ -126,7 +126,7 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerWin32::setCurrentDisplaySetting(): only main display is supported"); GHOST_DisplaySetting match; - GHOST_TSuccess success = findMatch(display, setting, match); + findMatch(display, setting, match); DEVMODE dm; int i = 0; while (::EnumDisplaySettings(NULL, i++, &dm)) { diff --git a/intern/ghost/intern/GHOST_EventManager.h b/intern/ghost/intern/GHOST_EventManager.h index 33e5c2f20ba..c3ec9583c04 100644 --- a/intern/ghost/intern/GHOST_EventManager.h +++ b/intern/ghost/intern/GHOST_EventManager.h @@ -33,10 +33,6 @@ #ifndef _GHOST_EVENT_MANAGER_H_ #define _GHOST_EVENT_MANAGER_H_ -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif // WIN32 - #include <deque> #include <vector> diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp index ae9c0d81a01..b4f5cc96083 100644 --- a/intern/ghost/intern/GHOST_EventPrinter.cpp +++ b/intern/ghost/intern/GHOST_EventPrinter.cpp @@ -48,36 +48,36 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event) if (event->getType() == GHOST_kEventWindowUpdate) return false; - //std::cout << "GHOST_EventPrinter::processEvent, time: " << (GHOST_TInt32)event->getTime() << ", type: "; + std::cout << "GHOST_EventPrinter::processEvent, time: " << (GHOST_TInt32)event->getTime() << ", type: "; switch (event->getType()) { case GHOST_kEventUnknown: - //std::cout << "GHOST_kEventUnknown"; handled = false; + std::cout << "GHOST_kEventUnknown"; handled = false; break; case GHOST_kEventButtonUp: { GHOST_TEventButtonData* buttonData = (GHOST_TEventButtonData*)((GHOST_IEvent*)event)->getData(); - //std::cout << "GHOST_kEventCursorButtonUp, button: " << buttonData->button; + std::cout << "GHOST_kEventCursorButtonUp, button: " << buttonData->button; } break; case GHOST_kEventButtonDown: { GHOST_TEventButtonData* buttonData = (GHOST_TEventButtonData*)((GHOST_IEvent*)event)->getData(); - //std::cout << "GHOST_kEventButtonDown, button: " << buttonData->button; + std::cout << "GHOST_kEventButtonDown, button: " << buttonData->button; } break; case GHOST_kEventWheel: { GHOST_TEventWheelData* wheelData = (GHOST_TEventWheelData*)((GHOST_IEvent*)event)->getData(); - //std::cout << "GHOST_kEventWheel, z: " << wheelData->z; + std::cout << "GHOST_kEventWheel, z: " << wheelData->z; } break; case GHOST_kEventCursorMove: { GHOST_TEventCursorData* cursorData = (GHOST_TEventCursorData*)((GHOST_IEvent*)event)->getData(); - //std::cout << "GHOST_kEventCursorMove, (x,y): (" << cursorData->x << "," << cursorData->y << ")"; + std::cout << "GHOST_kEventCursorMove, (x,y): (" << cursorData->x << "," << cursorData->y << ")"; } break; @@ -86,7 +86,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event) GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData(); STR_String str; getKeyString(keyData->key, str); - //std::cout << "GHOST_kEventKeyUp, key: " << str.Ptr(); + std::cout << "GHOST_kEventKeyUp, key: " << str.Ptr(); } break; case GHOST_kEventKeyDown: @@ -94,34 +94,34 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event) GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData(); STR_String str; getKeyString(keyData->key, str); - //std::cout << "GHOST_kEventKeyDown, key: " << str.Ptr(); + std::cout << "GHOST_kEventKeyDown, key: " << str.Ptr(); } break; case GHOST_kEventQuit: - //std::cout << "GHOST_kEventQuit"; + std::cout << "GHOST_kEventQuit"; break; case GHOST_kEventWindowClose: - //std::cout << "GHOST_kEventWindowClose"; + std::cout << "GHOST_kEventWindowClose"; break; case GHOST_kEventWindowActivate: - //std::cout << "GHOST_kEventWindowActivate"; + std::cout << "GHOST_kEventWindowActivate"; break; case GHOST_kEventWindowDeactivate: - //std::cout << "GHOST_kEventWindowDeactivate"; + std::cout << "GHOST_kEventWindowDeactivate"; break; case GHOST_kEventWindowUpdate: - //std::cout << "GHOST_kEventWindowUpdate"; + std::cout << "GHOST_kEventWindowUpdate"; break; case GHOST_kEventWindowSize: - //std::cout << "GHOST_kEventWindowSize"; + std::cout << "GHOST_kEventWindowSize"; break; default: - //std::cout << "not found"; handled = false; + std::cout << "not found"; handled = false; break; } - //std::cout << "\n"; + std::cout << "\n"; return handled; } diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 067c8deee32..5de00d9ab3e 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -442,17 +442,15 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent) GHOST_TimerManager* timerMgr = getTimerManager(); if (waitForEvent) { - GHOST_TUns64 curtime = getMilliSeconds(); GHOST_TUns64 next = timerMgr->nextFireTime(); double timeOut; if (next == GHOST_kFireTimeNever) { timeOut = kEventDurationForever; } else { - if (next<=curtime) + timeOut = (double)(next - getMilliSeconds())/1000.0; + if (timeOut < 0.0) timeOut = 0.0; - else - timeOut = (double) (next - getMilliSeconds())/1000.0; } ::ReceiveNextEvent(0, NULL, timeOut, false, &event); @@ -959,10 +957,16 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event) * events. By setting m_ignoreWindowSizedMessages these are suppressed. * @see GHOST_SystemCarbon::handleWindowEvent(EventRef event) */ + /* even worse: scale window also generates a load of events, and nothing + is handled (read: client's event proc called) until you release mouse (ton) */ + GHOST_ASSERT(validWindow(ghostWindow), "GHOST_SystemCarbon::handleMouseDown: invalid window"); m_ignoreWindowSizedMessages = true; ::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds); m_ignoreWindowSizedMessages = false; + + pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, ghostWindow) ); + break; case inContent: diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index feb0fe39040..6b5fcfe7705 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -38,8 +38,6 @@ #include <config.h> #endif -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning - #include "GHOST_SystemWin32.h" // win64 doesn't define GWL_USERDATA @@ -202,11 +200,12 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) ::Sleep(1); #else GHOST_TUns64 next = timerMgr->nextFireTime(); + GHOST_TInt64 maxSleep = next - getMilliSeconds(); if (next == GHOST_kFireTimeNever) { ::WaitMessage(); - } else { - ::SetTimer(NULL, 0, next - getMilliSeconds(), NULL); + } else if(maxSleep >= 0.0) { + ::SetTimer(NULL, 0, maxSleep, NULL); ::WaitMessage(); ::KillTimer(NULL, 0); } @@ -232,7 +231,7 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const { POINT point; - bool success = ::GetCursorPos(&point) == TRUE; + ::GetCursorPos(&point); x = point.x; y = point.y; return GHOST_kSuccess; @@ -766,10 +765,23 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * message without calling DefWindowProc. */ event = processWindowEvent(GHOST_kEventWindowSize, window); + break; case WM_CAPTURECHANGED: window->lostMouseCapture(); break; - + case WM_MOVING: + /* The WM_MOVING message is sent to a window that the user is moving. By processing + * this message, an application can monitor the size and position of the drag rectangle + * and, if needed, change its size or position. + */ + case WM_MOVE: + /* The WM_SIZE and WM_MOVE messages are not sent if an application handles the + * WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient + * to perform any move or size change processing during the WM_WINDOWPOSCHANGED + * message without calling DefWindowProc. + */ + event = processWindowEvent(GHOST_kEventWindowMove, window); + break; //////////////////////////////////////////////////////////////////////// // Window events, ignored //////////////////////////////////////////////////////////////////////// @@ -782,12 +794,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * to perform any move or size change processing during the WM_WINDOWPOSCHANGED * message without calling DefWindowProc. */ - case WM_MOVE: - /* The WM_SIZE and WM_MOVE messages are not sent if an application handles the - * WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient - * to perform any move or size change processing during the WM_WINDOWPOSCHANGED - * message without calling DefWindowProc. - */ case WM_ERASEBKGND: /* An application sends the WM_ERASEBKGND message when the window background must be * erased (for example, when a window is resized). The message is sent to prepare an @@ -822,11 +828,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, */ case WM_SETFOCUS: /* The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. */ - case WM_MOVING: - /* The WM_MOVING message is sent to a window that the user is moving. By processing - * this message, an application can monitor the size and position of the drag rectangle - * and, if needed, change its size or position. - */ case WM_ENTERSIZEMOVE: /* The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving * or sizing modal loop. The window enters the moving or sizing modal loop when the user diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 8073756e453..5a145510e54 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -107,6 +107,17 @@ GHOST_SystemX11( m_wm_protocols= XInternAtom(m_display, "WM_PROTOCOLS", False); m_wm_take_focus= XInternAtom(m_display, "WM_TAKE_FOCUS", False); + m_wm_state= XInternAtom(m_display, "WM_STATE", False); + m_wm_change_state= XInternAtom(m_display, "WM_CHANGE_STATE", False); + m_net_state= XInternAtom(m_display, "_NET_WM_STATE", False); + m_net_max_horz= XInternAtom(m_display, + "_NET_WM_STATE_MAXIMIZED_HORZ", False); + m_net_max_vert= XInternAtom(m_display, + "_NET_WM_STATE_MAXIMIZED_VERT", False); + m_net_fullscreen= XInternAtom(m_display, + "_NET_WM_STATE_FULLSCREEN", False); + m_motif= XInternAtom(m_display, "_MOTIF_WM_HINTS", False); + // compute the initial time timeval tv; @@ -308,7 +319,10 @@ processEvents( if (next==GHOST_kFireTimeNever) { SleepTillEvent(m_display, -1); } else { - SleepTillEvent(m_display, next - getMilliSeconds()); + GHOST_TInt64 maxSleep = next - getMilliSeconds(); + + if(maxSleep >= 0) + SleepTillEvent(m_display, next - getMilliSeconds()); } } @@ -537,6 +551,24 @@ GHOST_SystemX11::processEvent(XEvent *xe) // XCrossingEvents pointer leave enter window. break; case MapNotify: + /* + * From ICCCM: + * [ Clients can select for StructureNotify on their + * top-level windows to track transition between + * Normal and Iconic states. Receipt of a MapNotify + * event will indicate a transition to the Normal + * state, and receipt of an UnmapNotify event will + * indicate a transition to the Iconic state. ] + */ + if (window->m_post_init == True) { + /* + * Now we are sure that the window is + * mapped, so only need change the state. + */ + window->setState (window->m_post_state); + window->m_post_init = False; + } + break; case UnmapNotify: break; case MappingNotify: diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index 576577917ba..4b0ddd7a4f9 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -215,7 +215,19 @@ public: */ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const; - /* Atom used for ICCCM. */ + /** + * Atom used for ICCCM, WM-spec and Motif. + * We only need get this atom at the start, it's relative + * to the display not the window and are public for every + * window that need it. + */ + Atom m_wm_state; + Atom m_wm_change_state; + Atom m_net_state; + Atom m_net_max_horz; + Atom m_net_max_vert; + Atom m_net_fullscreen; + Atom m_motif; Atom m_wm_take_focus; Atom m_wm_protocols; Atom m_delete_window_atom; diff --git a/intern/ghost/intern/GHOST_TimerManager.h b/intern/ghost/intern/GHOST_TimerManager.h index 27bbdb1ea1d..b37b5b79c14 100644 --- a/intern/ghost/intern/GHOST_TimerManager.h +++ b/intern/ghost/intern/GHOST_TimerManager.h @@ -33,10 +33,6 @@ #ifndef _GHOST_TIMER_MANAGER_H_ #define _GHOST_TIMER_MANAGER_H_ -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif // WIN32 - #include <vector> #include "GHOST_Types.h" diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp index 9ae9e283b69..b3df566e8aa 100644 --- a/intern/ghost/intern/GHOST_WindowCarbon.cpp +++ b/intern/ghost/intern/GHOST_WindowCarbon.cpp @@ -252,7 +252,9 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const { Rect rect; GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid") - ::GetPortBounds(m_grafPtr, &rect); + //::GetPortBounds(m_grafPtr, &rect); + ::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect); + bounds.m_b = rect.bottom; bounds.m_l = rect.left; bounds.m_r = rect.right; diff --git a/intern/ghost/intern/GHOST_WindowManager.h b/intern/ghost/intern/GHOST_WindowManager.h index 46d8036328e..46e80d2c603 100644 --- a/intern/ghost/intern/GHOST_WindowManager.h +++ b/intern/ghost/intern/GHOST_WindowManager.h @@ -33,10 +33,6 @@ #ifndef _GHOST_WINDOW_MANAGER_H_ #define _GHOST_WINDOW_MANAGER_H_ -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif // WIN32 - #include <vector> #include "GHOST_Rect.h" diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 2094ae87c67..ce1a42176bd 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -111,9 +111,9 @@ GHOST_WindowWin32::GHOST_WindowWin32( m_hasMouseCaptured(false), m_nPressedButtons(0), m_customCursor(0), + m_wintab(NULL), m_tabletData(NULL), m_tablet(0), - m_wintab(NULL), m_maxPressure(0) { if (state != GHOST_kWindowStateFullScreen) { @@ -150,7 +150,7 @@ GHOST_WindowWin32::GHOST_WindowWin32( } if (m_hWnd) { // Store a pointer to this class in the window structure - LONG result = ::SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)this); + ::SetWindowLongPtr(m_hWnd, GWL_USERDATA, (LONG_PTR)this); // Store the device context m_hDC = ::GetDC(m_hWnd); @@ -297,11 +297,20 @@ void GHOST_WindowWin32::getWindowBounds(GHOST_Rect& bounds) const void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const { RECT rect; - ::GetClientRect(m_hWnd, &rect); - bounds.m_b = rect.bottom; - bounds.m_l = rect.left; - bounds.m_r = rect.right; - bounds.m_t = rect.top; + ::GetWindowRect(m_hWnd, &rect); + + LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE); + if((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) { + bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYSIZEFRAME)*2; + bounds.m_l = rect.left; + bounds.m_r = rect.right-GetSystemMetrics(SM_CYSIZEFRAME)*2; + bounds.m_t = rect.top; + } else { + bounds.m_b = rect.bottom; + bounds.m_l = rect.left; + bounds.m_r = rect.right; + bounds.m_t = rect.top; + } } @@ -310,7 +319,7 @@ GHOST_TSuccess GHOST_WindowWin32::setClientWidth(GHOST_TUns32 width) GHOST_TSuccess success; GHOST_Rect cBnds, wBnds; getClientBounds(cBnds); - if (cBnds.getWidth() != width) { + if (cBnds.getWidth() != (GHOST_TInt32)width) { getWindowBounds(wBnds); int cx = wBnds.getWidth() + width - cBnds.getWidth(); int cy = wBnds.getHeight(); @@ -329,7 +338,7 @@ GHOST_TSuccess GHOST_WindowWin32::setClientHeight(GHOST_TUns32 height) GHOST_TSuccess success; GHOST_Rect cBnds, wBnds; getClientBounds(cBnds); - if (cBnds.getHeight() != height) { + if (cBnds.getHeight() != (GHOST_TInt32)height) { getWindowBounds(wBnds); int cx = wBnds.getWidth(); int cy = wBnds.getHeight() + height - cBnds.getHeight(); @@ -348,7 +357,7 @@ GHOST_TSuccess GHOST_WindowWin32::setClientSize(GHOST_TUns32 width, GHOST_TUns32 GHOST_TSuccess success; GHOST_Rect cBnds, wBnds; getClientBounds(cBnds); - if ((cBnds.getWidth() != width) || (cBnds.getHeight() != height)) { + if ((cBnds.getWidth() != (GHOST_TInt32)width) || (cBnds.getHeight() != (GHOST_TInt32)height)) { getWindowBounds(wBnds); int cx = wBnds.getWidth() + width - cBnds.getWidth(); int cy = wBnds.getHeight() + height - cBnds.getHeight(); @@ -369,7 +378,11 @@ GHOST_TWindowState GHOST_WindowWin32::getState() const state = GHOST_kWindowStateMinimized; } else if (::IsZoomed(m_hWnd)) { - state = GHOST_kWindowStateMaximized; + LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE); + if((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) + state = GHOST_kWindowStateMaximized; + else + state = GHOST_kWindowStateFullScreen; } else { state = GHOST_kWindowStateNormal; @@ -406,19 +419,21 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) wp.showCmd = SW_SHOWMINIMIZED; break; case GHOST_kWindowStateMaximized: - ShowWindow(m_hWnd, SW_HIDE); //fe. HACK! - //Solves redraw problems when switching from fullscreen to normal. - + ShowWindow(m_hWnd, SW_HIDE); wp.showCmd = SW_SHOWMAXIMIZED; - SetWindowLong(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); + SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); break; case GHOST_kWindowStateFullScreen: wp.showCmd = SW_SHOWMAXIMIZED; - SetWindowLong(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE); + wp.ptMaxPosition.x = 0; + wp.ptMaxPosition.y = 0; + SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE); break; case GHOST_kWindowStateNormal: default: + ShowWindow(m_hWnd, SW_HIDE); wp.showCmd = SW_SHOWNORMAL; + SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); break; } return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure; @@ -614,7 +629,7 @@ void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor cursor) c } if (success) { - HCURSOR hCursor = ::SetCursor(::LoadCursor(0, id)); + ::SetCursor(::LoadCursor(0, id)); } } } @@ -724,15 +739,15 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam) */ /* convert raw fixed point data to radians */ - altRad = (fabs((float)ort.orAltitude)/(float)m_maxAltitude) * M_PI/2.0; - azmRad = ((float)ort.orAzimuth/(float)m_maxAzimuth) * M_PI*2.0; + altRad = (float)((fabs((float)ort.orAltitude)/(float)m_maxAltitude) * M_PI/2.0); + azmRad = (float)(((float)ort.orAzimuth/(float)m_maxAzimuth) * M_PI*2.0); /* find length of the stylus' projected vector on the XY plane */ vecLen = cos(altRad); /* from there calculate X and Y components based on azimuth */ m_tabletData->Xtilt = sin(azmRad) * vecLen; - m_tabletData->Ytilt = sin(M_PI/2.0 - azmRad) * vecLen; + m_tabletData->Ytilt = (float)(sin(M_PI/2.0 - azmRad) * vecLen); } else { m_tabletData->Xtilt = 0.0f; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 73d61a30977..3785b325eaf 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -55,6 +55,16 @@ typedef struct { #define MWM_HINTS_DECORATIONS (1L << 1) /* + * A Client can't change the window property, that is + * the work of the window manager. In case, we send + * a ClientMessage to the RootWindow with the property + * and the Action (WM-spec define this): + */ +#define _NET_WM_STATE_REMOVE 0 +#define _NET_WM_STATE_ADD 1 +#define _NET_WM_STATE_TOGGLE 2 + +/* import bpy I = bpy.data.images['blender.png'] # the 48x48 icon @@ -258,49 +268,25 @@ GHOST_WindowX11( } - - // Are we in fullscreen mode - then include - // some obscure blut code to remove decorations. - - if (state == GHOST_kWindowStateFullScreen) { - - MotifWmHints hints; - Atom atom; - - atom = XInternAtom(m_display, "_MOTIF_WM_HINTS", False); - - if (atom == None) { - GHOST_PRINT("Could not intern X atom for _MOTIF_WM_HINTS.\n"); - } else { - hints.flags = MWM_HINTS_DECORATIONS; - hints.decorations = 0; /* Absolutely no decorations. */ - // other hints.decorations make no sense - // you can't select individual decorations - - XChangeProperty(m_display, m_window, - atom, atom, 32, - PropModeReplace, (unsigned char *) &hints, 4); - } - } else if (state == GHOST_kWindowStateMaximized) { - // With this, xprop should report the following just after launch - // _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ - // After demaximization the right side is empty, though (maybe not the most correct then?) - Atom state, atomh, atomv; - - state = XInternAtom(m_display, "_NET_WM_STATE", False); - atomh = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); - atomv = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_VERT", False); - if (state == None ) { - GHOST_PRINT("Atom _NET_WM_STATE requested but not avaliable nor created.\n"); - } else { - XChangeProperty(m_display, m_window, - state, XA_ATOM, 32, - PropModeAppend, (unsigned char *) &atomh, 1); - XChangeProperty(m_display, m_window, - state, XA_ATOM, 32, - PropModeAppend, (unsigned char *) &atomv, 1); - } - } + /* + * One of the problem with WM-spec is that can't set a property + * to a window that isn't mapped. That is why we can't "just + * call setState" here. + * + * To fix this, we first need know that the window is really + * map waiting for the MapNotify event. + * + * So, m_post_init indicate that we need wait for the MapNotify + * event and then set the Window state to the m_post_state. + */ + if ((state != GHOST_kWindowStateNormal) && (state != GHOST_kWindowStateMinimized)) { + m_post_init = True; + m_post_state = state; + } + else { + m_post_init = False; + m_post_state = GHOST_kWindowStateNormal; + } // Create some hints for the window manager on how // we want this window treated. @@ -620,7 +606,7 @@ screenToClient( GHOST_TInt32& outX, GHOST_TInt32& outY ) const { - // not sure about this one! + // This is correct! int ax,ay; Window temp; @@ -664,28 +650,299 @@ clientToScreen( outY = ay; } +void GHOST_WindowX11::icccmSetState(int state) +{ + XEvent xev; - GHOST_TWindowState -GHOST_WindowX11:: -getState( -) const { - //FIXME - return GHOST_kWindowStateNormal; + if (state != IconicState) + return; + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.display = m_display; + xev.xclient.window = m_window; + xev.xclient.format = 32; + xev.xclient.message_type = m_system->m_wm_change_state; + xev.xclient.data.l[0] = state; + XSendEvent (m_display, RootWindow(m_display, DefaultScreen(m_display)), + False, SubstructureNotifyMask | SubstructureRedirectMask, &xev); } - GHOST_TSuccess -GHOST_WindowX11:: -setState( - GHOST_TWindowState state -){ - //TODO +int GHOST_WindowX11::icccmGetState(void) const +{ + unsigned char *prop_ret; + unsigned long bytes_after, num_ret; + Atom type_ret; + int format_ret, st; + + prop_ret = NULL; + st = XGetWindowProperty(m_display, m_window, m_system->m_wm_state, 0, + 0x7fffffff, False, m_system->m_wm_state, &type_ret, + &format_ret, &num_ret, &bytes_after, &prop_ret); + + if ((st == Success) && (prop_ret) && (num_ret == 2)) + st = prop_ret[0]; + else + st = NormalState; + + if (prop_ret) + XFree(prop_ret); + return (st); +} + +void GHOST_WindowX11::netwmMaximized(bool set) +{ + XEvent xev; + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.window = m_window; + xev.xclient.message_type = m_system->m_net_state; + xev.xclient.format = 32; + + if (set == True) + xev.xclient.data.l[0] = _NET_WM_STATE_ADD; + else + xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE; + + xev.xclient.data.l[1] = m_system->m_net_max_horz; + xev.xclient.data.l[2] = m_system->m_net_max_vert; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + XSendEvent(m_display, RootWindow(m_display, DefaultScreen(m_display)), + False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); +} + +bool GHOST_WindowX11::netwmIsMaximized(void) const +{ + unsigned char *prop_ret; + unsigned long bytes_after, num_ret; + Atom type_ret; + bool st; + int format_ret, count, i; + + prop_ret = NULL; + st = False; + i = XGetWindowProperty(m_display, m_window, m_system->m_net_state, 0, + 0x7fffffff, False, XA_ATOM, &type_ret, &format_ret, + &num_ret, &bytes_after, &prop_ret); + if ((i == Success) && (prop_ret) && (format_ret == 32)) { + count = 0; + for (i = 0; i < num_ret; i++) { + if (((unsigned long *) prop_ret)[i] == m_system->m_net_max_horz) + count++; + if (((unsigned long *) prop_ret)[i] == m_system->m_net_max_vert) + count++; + if (count == 2) { + st = True; + break; + } + } + } + + if (prop_ret) + XFree(prop_ret); + return (st); +} + +void GHOST_WindowX11::netwmFullScreen(bool set) +{ + XEvent xev; + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.window = m_window; + xev.xclient.message_type = m_system->m_net_state; + xev.xclient.format = 32; + + if (set == True) + xev.xclient.data.l[0] = _NET_WM_STATE_ADD; + else + xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE; + + xev.xclient.data.l[1] = m_system->m_net_fullscreen; + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + XSendEvent(m_display, RootWindow(m_display, DefaultScreen(m_display)), + False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); +} + +bool GHOST_WindowX11::netwmIsFullScreen(void) const +{ + unsigned char *prop_ret; + unsigned long bytes_after, num_ret; + Atom type_ret; + bool st; + int format_ret, i; + + prop_ret = NULL; + st = False; + i = XGetWindowProperty(m_display, m_window, m_system->m_net_state, 0, + 0x7fffffff, False, XA_ATOM, &type_ret, &format_ret, + &num_ret, &bytes_after, &prop_ret); + if ((i == Success) && (prop_ret) && (format_ret == 32)) { + for (i = 0; i < num_ret; i++) { + if (((unsigned long *) prop_ret)[i] == m_system->m_net_fullscreen) { + st = True; + break; + } + } + } + + if (prop_ret) + XFree(prop_ret); + return (st); +} + +void GHOST_WindowX11::motifFullScreen(bool set) +{ + MotifWmHints hints; + + hints.flags = MWM_HINTS_DECORATIONS; + if (set == True) + hints.decorations = 0; + else + hints.decorations = 1; + + XChangeProperty(m_display, m_window, m_system->m_motif, + m_system->m_motif, 32, PropModeReplace, + (unsigned char *) &hints, 4); +} + +bool GHOST_WindowX11::motifIsFullScreen(void) const +{ + unsigned char *prop_ret; + unsigned long bytes_after, num_ret; + MotifWmHints *hints; + Atom type_ret; + bool state; + int format_ret, st; + + prop_ret = NULL; + state = False; + st = XGetWindowProperty(m_display, m_window, m_system->m_motif, 0, + 0x7fffffff, False, m_system->m_motif, + &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret); + if ((st == Success) && (prop_ret)) { + hints = (MotifWmHints *) prop_ret; + if (hints->flags & MWM_HINTS_DECORATIONS) { + if (!hints->decorations) + state = True; + } + } + + if (prop_ret) + XFree(prop_ret); + return (state); +} - if (state == (int)getState()) { +GHOST_TWindowState GHOST_WindowX11::getState() const +{ + GHOST_TWindowState state_ret; + int state; + + state_ret = GHOST_kWindowStateNormal; + state = icccmGetState(); + /* + * In the Iconic and Withdrawn state, the window + * is unmaped, so only need return a Minimized state. + */ + if ((state == IconicState) || (state == WithdrawnState)) + state_ret = GHOST_kWindowStateMinimized; + else if (netwmIsMaximized() == True) + state_ret = GHOST_kWindowStateMaximized; + else if (netwmIsFullScreen() == True) + state_ret = GHOST_kWindowStateFullScreen; + else if (motifIsFullScreen() == True) + state_ret = GHOST_kWindowStateFullScreen; + return (state_ret); +} + +GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state) +{ + GHOST_TWindowState cur_state; + bool is_max, is_full, is_motif_full; + int icccm_state; + + cur_state = getState(); + if (state == (int)cur_state) return GHOST_kSuccess; - } else { - return GHOST_kFailure; + + if (cur_state != GHOST_kWindowStateMinimized) { + /* + * The window don't have this property's + * if it's not mapped. + */ + is_max = netwmIsMaximized(); + is_full = netwmIsFullScreen(); + } + else { + is_max = False; + is_full = False; + } + + is_motif_full = motifIsFullScreen(); + + if (state == GHOST_kWindowStateNormal) { + if (is_max == True) + netwmMaximized(False); + if (is_full == True) + netwmFullScreen(False); + if (is_motif_full == True) + motifFullScreen(False); + icccmSetState(NormalState); + return (GHOST_kSuccess); + } + + if (state == GHOST_kWindowStateFullScreen) { + /* + * We can't change to full screen if the window + * isn't mapped. + */ + if (cur_state == GHOST_kWindowStateMinimized) + return (GHOST_kFailure); + + if (is_max == True) + netwmMaximized(False); + if (is_full == False) + netwmFullScreen(True); + if (is_motif_full == False) + motifFullScreen(True); + return (GHOST_kSuccess); + } + + if (state == GHOST_kWindowStateMaximized) { + /* + * We can't change to Maximized if the window + * isn't mapped. + */ + if (cur_state == GHOST_kWindowStateMinimized) + return (GHOST_kFailure); + + if (is_full == True) + netwmFullScreen(False); + if (is_motif_full == True) + motifFullScreen(False); + if (is_max == False) + netwmMaximized(True); + return (GHOST_kSuccess); + } + + if (state == GHOST_kWindowStateMinimized) { + /* + * The window manager need save the current state of + * the window (maximized, full screen, etc). + */ + icccmSetState(IconicState); + return (GHOST_kSuccess); } + return (GHOST_kFailure); } #include <iostream> diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index abb5c131cb7..1392e2c19a6 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -212,6 +212,15 @@ public: const GHOST_TabletData* GetTabletData() { return &m_xtablet.CommonData; } + + /* + * Need this in case that we want start the window + * in FullScree or Maximized state. + * Check GHOST_WindowX11.cpp + */ + bool m_post_init; + GHOST_TWindowState m_post_state; + protected: /** * Tries to install a rendering context in this window. @@ -327,6 +336,18 @@ private : /* Tablet devices */ XTablet m_xtablet; + + void icccmSetState(int state); + int icccmGetState() const; + + void netwmMaximized(bool set); + bool netwmIsMaximized() const; + + void netwmFullScreen(bool set); + bool netwmIsFullScreen() const; + + void motifFullScreen(bool set); + bool motifIsFullScreen() const; }; diff --git a/intern/guardedalloc/SConscript b/intern/guardedalloc/SConscript index ef6c6b49266..0184ddd9785 100644 --- a/intern/guardedalloc/SConscript +++ b/intern/guardedalloc/SConscript @@ -5,4 +5,4 @@ Import('env') sources = env.Glob('intern/*.c') incs = '.' -env.BlenderLib ('bf_guardedalloc', sources, Split(incs), defines=[], libtype=['intern', 'player'], priority = [10, 175] ) +env.BlenderLib ('bf_guardedalloc', sources, Split(incs), defines=[], libtype=['intern', 'player'], priority = [5, 175] ) diff --git a/intern/moto/SConscript b/intern/moto/SConscript index 636515aa5c5..4152633e393 100644 --- a/intern/moto/SConscript +++ b/intern/moto/SConscript @@ -5,4 +5,4 @@ sources = env.Glob('intern/*.cpp') incs = 'include' -env.BlenderLib ('bf_moto', sources, Split(incs), [], libtype=['intern','game','game2','player'], priority = [15, 55, 100, 135] ) +env.BlenderLib ('bf_moto', sources, Split(incs), [], libtype=['intern','game','game2','player'], priority = [15, 55, 60, 130] ) diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript index e46cefbff58..e5f5d12c7d7 100644 --- a/intern/opennl/SConscript +++ b/intern/opennl/SConscript @@ -8,5 +8,5 @@ incs = 'extern superlu' if (env['OURPLATFORM'] == 'win32-mingw'): env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern','player'], priority=[1,80,22] ) else: - env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','player'], priority=[55,22] ) + env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','player'], priority=[65,22] ) diff --git a/intern/string/SConscript b/intern/string/SConscript index 7f817f82759..292ddf5aa63 100644 --- a/intern/string/SConscript +++ b/intern/string/SConscript @@ -4,4 +4,4 @@ Import ('env') sources = env.Glob('intern/*.cpp') incs = '.' -env.BlenderLib ('bf_string', sources, Split(incs), [], libtype=['core', 'player'], priority = [30,10] ) +env.BlenderLib ('bf_string', sources, Split(incs), [], libtype=['core', 'common','player'], priority = [50,19,0] ) diff --git a/intern/string/STR_String.h b/intern/string/STR_String.h index ec945c80c7c..941430fd976 100644 --- a/intern/string/STR_String.h +++ b/intern/string/STR_String.h @@ -142,7 +142,7 @@ public: inline operator const char *() const { return pData; } inline char *Ptr() { return pData; } inline const char *ReadPtr() const { return pData; } - inline float ToFloat() const { float x=atof(pData); return x; } + inline float ToFloat() const { float x=(float)(atof(pData)); return x; } inline int ToInt() const { return atoi(pData); } // Operators |