From 9def83f7e0795f11201af96cb64b4fb192e721d4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 17 Feb 2012 20:51:39 +0000 Subject: XDND support now can be disabled using WITH_GHOST_XDND=OFF with CMake and WITH_GHOST_XDND=False with SCons Disabled on FreeBSD platforms due to some linking errors. --- intern/ghost/CMakeLists.txt | 18 +++++++++++++----- intern/ghost/SConscript | 7 ++++++- intern/ghost/intern/GHOST_SystemX11.cpp | 11 ++++++++++- intern/ghost/intern/GHOST_SystemX11.h | 2 ++ intern/ghost/intern/GHOST_WindowX11.cpp | 11 +++++++++-- intern/ghost/intern/GHOST_WindowX11.h | 7 +++++++ 6 files changed, 47 insertions(+), 9 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 3d65f4972c4..5693aea0865 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -220,18 +220,26 @@ elseif(UNIX) intern/GHOST_SystemX11.cpp intern/GHOST_SystemPathsX11.cpp intern/GHOST_WindowX11.cpp - intern/GHOST_DropTargetX11.cpp intern/GHOST_DisplayManagerX11.h intern/GHOST_SystemX11.h intern/GHOST_SystemPathsX11.h intern/GHOST_WindowX11.h - intern/GHOST_DropTargetX11.h ) - list(APPEND INC - ../../extern/xdnd - ) + if(WITH_GHOST_XDND) + add_definitions(-DWITH_XDND) + + list(APPEND INC + ../../extern/xdnd + ) + + list(APPEND SRC + intern/GHOST_DropTargetX11.cpp + + intern/GHOST_DropTargetX11.h + ) + endif() if(X11_XF86keysym_INCLUDE_PATH) add_definitions(-DWITH_XF86KEYSYM) diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript index d83107717fc..3410f11a971 100644 --- a/intern/ghost/SConscript +++ b/intern/ghost/SConscript @@ -42,7 +42,12 @@ elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'f # defs += ['PREFIX=\\"/usr/local/\\"'] # XXX, make an option defs += ['WITH_X11_XINPUT'] # XXX, make an option - incs += ' #/extern/xdnd' + # freebsd doesn't seem to support XDND protocol + if env['WITH_GHOST_XDND'] and window_system not in ('freebsd7', 'freebsd8', 'freebsd9'): + incs += ' #/extern/xdnd' + defs += ['WITH_XDND'] + else: + sources.remove('intern' + os.sep + 'GHOST_DropTargetX11.cpp') elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'): for f in pf: diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 7261770771a..857d9e79e57 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -42,12 +42,15 @@ #include "GHOST_EventButton.h" #include "GHOST_EventWheel.h" #include "GHOST_DisplayManagerX11.h" -#include "GHOST_DropTargetX11.h" #include "GHOST_EventDragnDrop.h" #ifdef WITH_INPUT_NDOF #include "GHOST_NDOFManagerX11.h" #endif +#ifdef WITH_XDND +#include "GHOST_DropTargetX11.h" +#endif + #include "GHOST_Debug.h" #include @@ -711,10 +714,14 @@ GHOST_SystemX11::processEvent(XEvent *xe) } } } else { +#ifdef WITH_XDND /* try to handle drag event (if there's no such events, GHOST_HandleClientMessage will return zero) */ if (window->getDropTarget()->GHOST_HandleClientMessage(xe) == false) { /* Unknown client message, ignore */ } +#else + /* Unknown client message, ignore */ +#endif } break; @@ -1485,6 +1492,7 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const } } +#ifdef WITH_XDND GHOST_TSuccess GHOST_SystemX11::pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_IWindow* window, @@ -1498,3 +1506,4 @@ GHOST_TSuccess GHOST_SystemX11::pushDragDropEvent(GHOST_TEventType eventType, window,mouseX,mouseY,data) ); } +#endif diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index 1aec218d6f1..62f5ba341d4 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -235,6 +235,7 @@ public: */ void putClipboard(GHOST_TInt8 *buffer, bool selection) const; +#if WITH_XDND /** * Creates a drag'n'drop event and pushes it immediately onto the event queue. * Called by GHOST_DropTargetX11 class. @@ -246,6 +247,7 @@ public: * @return Indication whether the event was handled. */ static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,GHOST_IWindow* window, int mouseX, int mouseY, void* data); +#endif /** * @see GHOST_ISystem diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index ea99a9ea7b4..3ceafcab3ce 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -32,10 +32,13 @@ #include "GHOST_WindowX11.h" #include "GHOST_SystemX11.h" -#include "GHOST_DropTargetX11.h" #include "STR_String.h" #include "GHOST_Debug.h" +#ifdef WITH_XDND +#include "GHOST_DropTargetX11.h" +#endif + // For standard X11 cursors #include #include @@ -326,10 +329,12 @@ GHOST_WindowX11( XSelectInput(m_display , parentWindow, SubstructureNotifyMask); } - + +#ifdef WITH_XDND /* initialize drop target for newly created window */ m_dropTarget = new GHOST_DropTargetX11(this, m_system); GHOST_PRINT("Set drop target\n"); +#endif /* * One of the problem with WM-spec is that can't set a property @@ -1323,7 +1328,9 @@ GHOST_WindowX11:: } #endif +#ifdef WITH_XDND delete m_dropTarget; +#endif XDestroyWindow(m_display, m_window); XFree(m_visual); diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index eae6cad5a6d..5430c5916fc 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -45,7 +45,10 @@ class STR_String; class GHOST_SystemX11; + +#ifdef WITH_XDND class GHOST_DropTargetX11; +#endif /** * X11 implementation of GHOST_IWindow. @@ -225,8 +228,10 @@ public: XIC getX11_XIC() { return m_xic; } #endif +#ifdef WITH_XDND GHOST_DropTargetX11* getDropTarget() { return m_dropTarget; } +#endif /* * Need this in case that we want start the window @@ -365,7 +370,9 @@ private : /** Cache of XC_* ID's to XCursor structures */ std::map m_standard_cursors; +#ifdef WITH_XDND GHOST_DropTargetX11 * m_dropTarget; +#endif #ifdef WITH_X11_XINPUT /* Tablet devices */ -- cgit v1.2.3