[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34343] branches/merwin-tablet-2: sync to previous work on Linux/Mac tablet

Mike Erwin significant.bit at gmail.com
Sun Jan 16 05:27:36 CET 2011


Revision: 34343
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34343
Author:   merwin
Date:     2011-01-16 04:27:32 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
sync to previous work on Linux/Mac tablet

Modified Paths:
--------------
    branches/merwin-tablet-2/intern/ghost/GHOST_C-api.h
    branches/merwin-tablet-2/intern/ghost/GHOST_IWindow.h
    branches/merwin-tablet-2/intern/ghost/GHOST_Types.h
    branches/merwin-tablet-2/intern/ghost/SConscript
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_C-api.cpp
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventButton.h
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventCursor.h
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_SystemCocoa.h
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_SystemCocoa.mm
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_SystemX11.cpp
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_SystemX11.h
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_WindowCocoa.h
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_WindowCocoa.mm
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_WindowX11.cpp
    branches/merwin-tablet-2/intern/ghost/intern/GHOST_WindowX11.h
    branches/merwin-tablet-2/source/blender/windowmanager/intern/wm_cursors.c
    branches/merwin-tablet-2/source/blender/windowmanager/intern/wm_event_system.c

Modified: branches/merwin-tablet-2/intern/ghost/GHOST_C-api.h
===================================================================
--- branches/merwin-tablet-2/intern/ghost/GHOST_C-api.h	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/GHOST_C-api.h	2011-01-16 04:27:32 UTC (rev 34343)
@@ -671,13 +671,6 @@
 extern GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle);
 
 /**
- * Returns the status of the tablet
- * @param windowhandle The handle to the window
- * @return Status of tablet
- */
-extern const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle);
-
-/**
  * Access to rectangle width.
  * @param rectanglehandle The handle to the rectangle
  * @return	width of the rectangle

Modified: branches/merwin-tablet-2/intern/ghost/GHOST_IWindow.h
===================================================================
--- branches/merwin-tablet-2/intern/ghost/GHOST_IWindow.h	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/GHOST_IWindow.h	2011-01-16 04:27:32 UTC (rev 34343)
@@ -228,12 +228,6 @@
 	 */
 	virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
 	
-	/**
-	 * Returns the tablet data (pressure etc).
-	 * @return The tablet data (pressure etc).
-	 */
-	virtual const GHOST_TabletData* GetTabletData() = 0;
-	
 	/***************************************************************************************
 	 ** Progress bar functionality
 	 ***************************************************************************************/

Modified: branches/merwin-tablet-2/intern/ghost/GHOST_Types.h
===================================================================
--- branches/merwin-tablet-2/intern/ghost/GHOST_Types.h	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/GHOST_Types.h	2011-01-16 04:27:32 UTC (rev 34343)
@@ -370,11 +370,15 @@
 	GHOST_TInt32 x;
 	/** The y-coordinate of the cursor position. */
 	GHOST_TInt32 y;
+	/** tablet-specific data (tablet.tool = None otherwise) */
+	GHOST_TabletData tablet;
 } GHOST_TEventCursorData;
 
 typedef struct {
 	/** The mask of the mouse button. */
 	GHOST_TButtonMask button;
+	/** tablet-specific data (tablet.tool = None otherwise) */
+	GHOST_TabletData tablet;
 } GHOST_TEventButtonData;
 
 typedef struct {

Modified: branches/merwin-tablet-2/intern/ghost/SConscript
===================================================================
--- branches/merwin-tablet-2/intern/ghost/SConscript	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/SConscript	2011-01-16 04:27:32 UTC (rev 34343)
@@ -6,64 +6,69 @@
 
 window_system = env['OURPLATFORM']
 
+print window_system
+
 sources = env.Glob('intern/*.cpp')
 if window_system == 'darwin':
-    sources += env.Glob('intern/*.mm')
+	sources += env.Glob('intern/*.mm')
 
+pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget', 'GHOST_TabletManager']
+defs = ['_USE_MATH_DEFINES']
 
-pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget']
-defs=['_USE_MATH_DEFINES']
-
 if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'irix6', 'aix4', 'aix5'):
-    for f in pf:
-        try:
-            sources.remove('intern' + os.sep + f + 'Win32.cpp')
-            sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-        except ValueError:
-            pass
-    defs += ['PREFIX=\\"/usr/local/\\"']
+	for f in pf:
+		try:
+			sources.remove('intern' + os.sep + f + 'Win32.cpp')
+			sources.remove('intern' + os.sep + f + 'Carbon.cpp')
+		except ValueError:
+			pass
+	defs += ['PREFIX=\\"/usr/local/\\"']
 
 elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
-    for f in pf:
-        try:
-            sources.remove('intern' + os.sep + f + 'X11.cpp')
-            sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-        except ValueError:
-            pass
+	for f in pf:
+		try:
+			sources.remove('intern' + os.sep + f + 'X11.cpp')
+			sources.remove('intern' + os.sep + f + 'Carbon.cpp')
+		except ValueError:
+			pass
+
 elif window_system == 'darwin':
-    if env['WITH_GHOST_COCOA']:
-        if env['WITH_BF_QUICKTIME']:
-            defs.append('WITH_QUICKTIME')
-        if env['USE_QTKIT']:
-            defs.append('USE_QTKIT')
-        for f in pf:
-            try:
-                sources.remove('intern' + os.sep + f + 'Win32.cpp')
-                sources.remove('intern' + os.sep + f + 'X11.cpp')
-                sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-            except ValueError:
-                pass
-    else:
-        for f in pf:
-            try:
-                sources.remove('intern' + os.sep + f + 'Win32.cpp')
-                sources.remove('intern' + os.sep + f + 'X11.cpp')
-                sources.remove('intern' + os.sep + f + 'Cocoa.mm')
-            except ValueError:
-                pass
+#	if env['WITH_GHOST_COCOA']:
+	sources.remove('intern/GHOST_TabletManagerX11.cpp') # why does this not "just work"?
+	for f in pf:
+		try:
+			sources.remove('intern' + os.sep + f + 'Win32.cpp')
+			sources.remove('intern' + os.sep + f + 'X11.cpp')
+			sources.remove('intern' + os.sep + f + 'Carbon.cpp')
+		except ValueError:
+			pass
+	if env['WITH_BF_QUICKTIME']:
+		defs.append('WITH_QUICKTIME')
+	if env['USE_QTKIT']:
+		defs.append('USE_QTKIT')
 
+# ancient Carbon code
+#     else:
+#         for f in pf:
+#             try:
+#                 sources.remove('intern' + os.sep + f + 'Win32.cpp')
+#                 sources.remove('intern' + os.sep + f + 'X11.cpp')
+#                 sources.remove('intern' + os.sep + f + 'Cocoa.mm')
+#             except ValueError:
+#                 pass
+
 else:
-    print "Unknown window system specified."
-    Exit()
+	print "Unknown window system specified."
+	Exit()
 
 if env['BF_GHOST_DEBUG']:
-    defs.append('BF_GHOST_DEBUG')
+	defs.append('BF_GHOST_DEBUG')
 
 incs = '. ../string #extern/glew/include #source/blender/imbuf #source/blender/makesdna ' + env['BF_OPENGL_INC']
 if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
-    incs = env['BF_WINTAB_INC'] + ' ' + incs
+	incs = env['BF_WINTAB_INC'] + ' ' + incs
 
 if window_system in ('win32-vc', 'win64-vc'):
-    env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15]) #, cc_compileflags=env['CCFLAGS'].append('/WX') ) 
+	env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15]) #, cc_compileflags=env['CCFLAGS'].append('/WX') ) 
 else:
-    env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15] ) 
+	env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15])

Modified: branches/merwin-tablet-2/intern/ghost/intern/GHOST_C-api.cpp
===================================================================
--- branches/merwin-tablet-2/intern/ghost/intern/GHOST_C-api.cpp	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/intern/GHOST_C-api.cpp	2011-01-16 04:27:32 UTC (rev 34343)
@@ -702,12 +702,7 @@
 }
 
 
-extern const GHOST_TabletData* GHOST_GetTabletData(GHOST_WindowHandle windowhandle)
-{
-	return ((GHOST_IWindow*)windowhandle)->GetTabletData();
-}
 
-
 GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
 {
 	return ((GHOST_Rect*)rectanglehandle)->getWidth();

Modified: branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventButton.h
===================================================================
--- branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventButton.h	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventButton.h	2011-01-16 04:27:32 UTC (rev 34343)
@@ -55,6 +55,7 @@
 		: GHOST_Event(time, type, window)
 	{
 		m_buttonEventData.button = button;
+		m_buttonEventData.tablet.Active = GHOST_kTabletModeNone;
 		m_data = &m_buttonEventData;
 	}
 

Modified: branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventCursor.h
===================================================================
--- branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventCursor.h	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/intern/GHOST_EventCursor.h	2011-01-16 04:27:32 UTC (rev 34343)
@@ -55,6 +55,7 @@
 	{
 		m_cursorEventData.x = x;
 		m_cursorEventData.y = y;
+		m_cursorEventData.tablet.Active = GHOST_kTabletModeNone;
 		m_data = &m_cursorEventData;
 	}
 

Modified: branches/merwin-tablet-2/intern/ghost/intern/GHOST_SystemCocoa.h
===================================================================
--- branches/merwin-tablet-2/intern/ghost/intern/GHOST_SystemCocoa.h	2011-01-16 02:28:08 UTC (rev 34342)
+++ branches/merwin-tablet-2/intern/ghost/intern/GHOST_SystemCocoa.h	2011-01-16 04:27:32 UTC (rev 34343)
@@ -236,15 +236,35 @@
 	 */
 	virtual GHOST_TSuccess init();
 
-    /**
-     * Handles a tablet event.
-     * @param eventPtr	An NSEvent pointer (casted to void* to enable compilation in standard C++)
-	 * @param eventType The type of the event. It needs to be passed separately as it can be either directly in the event type, or as a subtype if combined with a mouse button event
-     * @return Indication whether the event was handled. 
-     */
-    GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType);
+	/**
+	 * Handles a tablet event.
+	 * @param eventPtr  An NSEvent pointer (casted to void* to enable compilation in standard C++)
+	 * @return          Indication whether the event was handled. 
+	 */
+	GHOST_TSuccess handleTabletEvent(void *eventPtr);
+
+	/**
+	 * Helps handleTabletEvent function.
+	 */
+	void fillTabletData(GHOST_TabletData& tablet, void* event_ptr);
     
 	/**
+	 * Handles a tablet proximity event. Sets pen or mouse ID for later events.
+	 * @param eventPtr  An NSEvent pointer (casted to void* to enable compilation in standard C++)
+	 * @return          Indication whether the event was handled. 
+	 */
+    GHOST_TSuccess handleTabletProximity(void *eventPtr);
+
+	/** Tablet Mouse and Pen IDs, used to correlate events with the tool that caused them. */
+	int m_tablet_mouse_id;
+	int m_tablet_pen_id;
+
+	static const int TOOL_ID_NONE = -1;
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list