Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sony's changes for snap-1.2.2

  • Loading branch information...
commit 1585bf9896fbeaf7237dfe0b2bde0da44e2d6def 1 parent b2b0f0a
@thezerobit thezerobit authored
Showing with 9,134 additions and 949 deletions.
  1. +0 −7 .cvsignore
  2. +0 −2  ColorPickers/.cvsignore
  3. +36 −0 ColorPickers/GNUmakefile.preamble
  4. +0 −31 Documentation/.cvsignore
  5. +0 −1  Documentation/GuiUser/.cvsignore
  6. +3 −1 GNUmakefile
  7. +36 −0 GNUmakefile.preamble
  8. +0 −2  Headers/Additions/GNUstepGUI/.cvsignore
  9. +7 −0 Headers/Additions/GNUstepGUI/GSDragView.h
  10. +7 −0 Headers/Additions/GNUstepGUI/GSTitleView.h
  11. +60 −2 Headers/AppKit/NSAnimation.h
  12. +2 −1  Headers/AppKit/NSApplication.h
  13. +14 −0 Headers/AppKit/NSCell.h
  14. +5 −0 Headers/AppKit/NSComboBoxCell.h
  15. +12 −0 Headers/AppKit/NSControl.h
  16. +8 −0 Headers/AppKit/NSDownRightGestureRecognizer.h
  17. +56 −9 Headers/AppKit/NSEvent.h
  18. +7 −0 Headers/AppKit/NSMenuView.h
  19. +7 −0 Headers/AppKit/NSResponder.h
  20. +1 −0  Headers/AppKit/NSScroller.h
  21. +7 −0 Headers/AppKit/NSSplitView.h
  22. +18 −0 Headers/AppKit/NSTableView.h
  23. +10 −0 Headers/AppKit/NSTextView.h
  24. +69 −0 Headers/AppKit/NSView.h
  25. +20 −0 Headers/AppKit/NSWindow.h
  26. +12 −0 Headers/AppKit/SNCheckmarkGestureRecognizer.h
  27. +99 −0 Headers/AppKit/SNGestureRecognizer.h
  28. +66 −0 Headers/AppKit/SNLassoGestureRecognizer.h
  29. +33 −0 Headers/AppKit/SNLongPressGestureRecognizer.h
  30. +31 −0 Headers/AppKit/SNPanGestureRecognizer.h
  31. +32 −0 Headers/AppKit/SNPinchGestureRecognizer.h
  32. +33 −0 Headers/AppKit/SNRotationGestureRecognizer.h
  33. +45 −0 Headers/AppKit/SNSwipeGestureRecognizer.h
  34. +30 −0 Headers/AppKit/SNTapGestureRecognizer.h
  35. +78 −0 Headers/AppKit/SNTouch.h
  36. +0 −2  Images/.cvsignore
  37. +0 −9 Model/.cvsignore
  38. +1 −1  Model/GNUmakefile
  39. +1 −1  Model/GNUmakefile.postamble
  40. +36 −0 Model/GNUmakefile.preamble
  41. +1 −1  Printing/GSCUPS/GNUmakefile.preamble
  42. +1 −1  Printing/GSLPR/GNUmakefile.preamble
  43. +1 −1  Resources/Esperanto.lproj/Localizable.strings
  44. +0 −1  Source/.cvsignore
  45. +22 −2 Source/GNUmakefile
  46. +3 −3 Source/GNUmakefile.preamble
  47. +5 −0 Source/GSDisplayServer.m
  48. +305 −178 Source/GSDragView.m
  49. +41 −2 Source/GSTitleView.m
  50. +390 −17 Source/NSAnimation.m
  51. +351 −20 Source/NSApplication.m
  52. +500 −0 Source/NSCell.m
  53. +24 −0 Source/NSComboBox.m
  54. +244 −46 Source/NSComboBoxCell.m
  55. +261 −12 Source/NSControl.m
  56. +62 −0 Source/NSDownRightGestureRecognizer.m
  57. +342 −26 Source/NSEvent.m
  58. +2 −0  Source/NSMatrix.m
  59. +1 −0  Source/NSMenu.m
  60. +65 −2 Source/NSMenuView.m
  61. +2 −0  Source/NSPopUpButton.m
  62. +41 −1 Source/NSResponder.m
  63. +134 −31 Source/NSScroller.m
  64. +18 −0 Source/NSSlider.m
  65. +78 −41 Source/NSSliderCell.m
  66. +104 −2 Source/NSSplitView.m
  67. +267 −201 Source/NSTableView.m
  68. +490 −260 Source/NSTextView.m
  69. +241 −0 Source/NSView.m
  70. +769 −20 Source/NSWindow.m
  71. +101 −0 Source/SNCheckmarkGestureRecognizer.m
  72. +310 −0 Source/SNGestureRecognizer.m
  73. +603 −0 Source/SNLassoGestureRecognizer.m
  74. +422 −0 Source/SNLongPressGestureRecognizer.m
  75. +382 −0 Source/SNPanGestureRecognizer.m
  76. +338 −0 Source/SNPinchGestureRecognizer.m
  77. +389 −0 Source/SNRotationGestureRecognizer.m
  78. +396 −0 Source/SNSwipeGestureRecognizer.m
  79. +412 −0 Source/SNTapGestureRecognizer.m
  80. +130 −0 Source/SNTouch.m
  81. +0 −6 TextConverters/RTF/.cvsignore
  82. +1 −1  TextConverters/RTF/GNUmakefile.preamble
  83. +0 −2  Tools/.cvsignore
  84. +3 −3 Tools/GNUmakefile.preamble
View
7 .cvsignore
@@ -1,7 +0,0 @@
-config.log
-config.status
-config.cache
-config.make
-gnustep-gui.spec
-gnustep-gui-debug.spec
-gui.make
View
2  ColorPickers/.cvsignore
@@ -1,2 +0,0 @@
-*.bundle
-*obj
View
36 ColorPickers/GNUmakefile.preamble
@@ -0,0 +1,36 @@
+#
+# GNUmakefile.preamble - Generated by ProjectCenter
+#
+#include ../../../../../../target/defs.mk
+#include $(BASE_DIR)/src/defs.mk
+# Additional flags to pass to the preprocessor
+ADDITIONAL_CPPFLAGS +=
+
+# Additional flags to pass to Objective C compiler
+ADDITIONAL_OBJCFLAGS +=
+
+# Additional flags to pass to C compiler
+ADDITIONAL_CFLAGS +=
+
+# Additional flags to pass to the linker
+ADDITIONAL_LDFLAGS += -lapplication_manager
+
+# Additional include directories the compiler should search
+ADDITIONAL_INCLUDE_DIRS += -I$(WORKSPACE_ROOT)/src/include
+
+# Additional library directories the linker should search
+#ADDITIONAL_LIB_DIRS += /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libmedia_player.so /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libgstreamer-0.10.so /usr/local/lib/libglib-2.0.so
+
+#ADDITIONAL_LIB_DIRS += /Home/hul/Desktop/CHG-USERS/premv/SNMoviePlayer/libmedia_player.so /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libgstreamer-0.10.so /usr/local/lib/libglib-2.0.so
+
+
+ADDITIONAL_LIB_DIRS += -L$(TARGET_ROOT)/lib
+#ADDITIONAL_LIB_DIRS += $(TARGET_ROOT)/lib/libospl.so
+#ADDITIONAL_LIB_DIRS += $(TARGET_ROOT)/lib/libdebug.so
+
+#ADDITIONAL_LIB_DIRS += `PKG_CONFIG_LIBDIR=$(TARGET_ROOT)/lib/pkgconfig pkg-config --libs gstreamer-0.10 glib-2.0`
+
+
+# Additional GUI libraries to link
+ADDITIONAL_GUI_LIBS +=
+
View
31 Documentation/.cvsignore
@@ -1,31 +0,0 @@
-gnustep-gui.texi
-version.texi
-version.tmpl.texi
-install.texi
-news.texi
-readme.texi
-announce.texi
-todo.texi
-*.log
-*.dvi
-*.ps
-*.html
-*.info
-*.aux
-*.toc
-*.cp
-*.fn
-*.vr
-*.tp
-*.ky
-*.pg
-*.ps
-*.vrs
-*.cl
-*.pr
-ANNOUNCE
-BUGS
-INSTALL
-NEWS
-README
-
View
1  Documentation/GuiUser/.cvsignore
@@ -1 +0,0 @@
-*.html
View
4 GNUmakefile
@@ -22,6 +22,8 @@
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
+include ../../../../../../target/defs.mk
+include $(BASE_DIR)/src/defs.mk
ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
@@ -68,7 +70,7 @@ ifeq ($(doc), yes)
SUBPROJECTS += Documentation
endif
--include GNUmakefile.preamble
+include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
View
36 GNUmakefile.preamble
@@ -0,0 +1,36 @@
+#
+# GNUmakefile.preamble - Generated by ProjectCenter
+#
+#include ../../../../../../target/defs.mk
+#include $(BASE_DIR)/src/defs.mk
+# Additional flags to pass to the preprocessor
+# ADDITIONAL_CPPFLAGS +=
+
+# Additional flags to pass to Objective C compiler
+# ADDITIONAL_OBJCFLAGS +=
+
+# Additional flags to pass to C compiler
+# ADDITIONAL_CFLAGS +=
+
+# Additional flags to pass to the linker
+ADDITIONAL_LDFLAGS += -lapplication_manager
+
+# Additional include directories the compiler should search
+ADDITIONAL_INCLUDE_DIRS += -I$(WORKSPACE_ROOT)/src/include
+
+# Additional library directories the linker should search
+#ADDITIONAL_LIB_DIRS += /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libmedia_player.so /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libgstreamer-0.10.so /usr/local/lib/libglib-2.0.so
+
+#ADDITIONAL_LIB_DIRS += /Home/hul/Desktop/CHG-USERS/premv/SNMoviePlayer/libmedia_player.so /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libgstreamer-0.10.so /usr/local/lib/libglib-2.0.so
+
+
+ADDITIONAL_LIB_DIRS += -L$(TARGET_ROOT)/lib
+#ADDITIONAL_LIB_DIRS += $(TARGET_ROOT)/lib/libospl.so
+#ADDITIONAL_LIB_DIRS += $(TARGET_ROOT)/lib/libdebug.so
+
+#ADDITIONAL_LIB_DIRS += `PKG_CONFIG_LIBDIR=$(TARGET_ROOT)/lib/pkgconfig pkg-config --libs gstreamer-0.10 glib-2.0`
+
+
+# Additional GUI libraries to link
+# ADDITIONAL_GUI_LIBS +=
+
View
2  Headers/Additions/GNUstepGUI/.cvsignore
@@ -1,2 +0,0 @@
-config.h
-GSVersion.h
View
7 Headers/Additions/GNUstepGUI/GSDragView.h
@@ -104,6 +104,13 @@
// Cache for cursors
NSMutableDictionary *cursors;
+
+ // Instance variables to store state info for loop-free event handling
+ NSCursor *_cursorBeforeDrag;
+ NSPoint _slidePoint;
+
+ // for sliding dragged image
+ NSEvent *_eventCausingSlide;
}
+ (id) sharedDragView;
View
7 Headers/Additions/GNUstepGUI/GSTitleView.h
@@ -60,6 +60,13 @@
- (id) owner;
- (NSSize) titleSize;
+//
+// Handling touch events... for testing purpose
+//
+- (void) touchesBeganWithEvent: (NSEvent *) theEvent;
+- (void) touchesMovedWithEvent: (NSEvent *) theEvent;
+- (void) touchesEndedWithEvent: (NSEvent *) theEvent;
+
// ============================================================================
// ==== Buttons
// ============================================================================
View
62 Headers/AppKit/NSAnimation.h
@@ -36,6 +36,7 @@
#include <Foundation/NSObject.h>
#include <AppKit/AppKitDefines.h>
#include <GNUstepGUI/GSAnimator.h>
+#include <Foundation/NSGeometry.h>
@class NSString;
@class NSArray;
@@ -51,7 +52,52 @@ typedef enum _NSAnimationCurve
NSAnimationEaseIn,
NSAnimationEaseOut,
NSAnimationLinear,
- NSAnimationSpeedInOut // GNUstep only
+ NSAnimationSpeedInOut, // GNUstep only
+/*SN FEA 002*/
+ NSBackNone,
+ NSBackEaseIn,
+ NSBackEaseOut,
+ NSBackEaseInOut,
+ NSBounceNone,
+ NSBounceEaseIn,
+ NSBounceEaseOut,
+ NSBounceEaseInOut,
+ NSElasticNone,
+ NSElasticEaseIn,
+ NSElasticEaseOut,
+ NSElasticEaseInOut,
+ NSCircNone,
+ NSCircEaseIn,
+ NSCircEaseOut,
+ NSCircEaseInOut,
+ NSCubicNone,
+ NSCubicEaseIn,
+ NSCubicEaseOut,
+ NSCubicEaseInOut,
+ NSExpoNone,
+ NSExpoEaseIn,
+ NSExpoEaseOut,
+ NSExpoEaseInOut,
+ NSLinearNone,
+ NSLinearEaseIn,
+ NSLinearEaseOut,
+ NSLinearEaseInOut,
+ NSQuadNone,
+ NSQuadEaseIn,
+ NSQuadEaseOut,
+ NSQuadEaseInOut,
+ NSQuartNone,
+ NSQuartEaseIn,
+ NSQuartEaseOut,
+ NSQuartEaseInOut,
+ NSQuintNone,
+ NSQuintEaseIn,
+ NSQuintEaseOut,
+ NSQuintEaseInOut,
+ NSSineNone,
+ NSSineEaseIn,
+ NSSineEaseOut,
+ NSSineEaseInOut
} NSAnimationCurve;
/** These constants indicate the blocking mode of an NSAnimation object when it is running. */
@@ -288,7 +334,7 @@ APPKIT_EXPORT NSString *NSViewAnimationTargetKey;
APPKIT_EXPORT NSString *NSViewAnimationStartFrameKey;
APPKIT_EXPORT NSString *NSViewAnimationEndFrameKey;
APPKIT_EXPORT NSString *NSViewAnimationEffectKey;
-
+APPKIT_EXPORT NSString *NSViewAnimationPathKey;
APPKIT_EXPORT NSString *NSViewAnimationFadeInEffect;
APPKIT_EXPORT NSString *NSViewAnimationFadeOutEffect;
@@ -315,6 +361,18 @@ APPKIT_EXPORT NSString *NSViewAnimationFadeOutEffect;
@end
+
+/* Animation path - bezier*/
+/*SNE FEA 001*/
+@interface NSAnimationPath:NSObject
+{
+@public
+NSPoint start;
+NSPoint end;
+NSPoint cp1;
+NSPoint cp2;
+}
+@end
#endif /* OS_API_VERSION */
#endif /* _GNUstep_H_NSAnimation_ */
View
3  Headers/AppKit/NSApplication.h
@@ -38,7 +38,8 @@
#ifndef _GNUstep_H_NSApplication
#define _GNUstep_H_NSApplication
#import <GNUstepBase/GSVersionMacros.h>
-
+#include "application_manager.h"
+//static void event_handler(application_event_t);
#include <AppKit/NSResponder.h>
@class NSArray;
View
14 Headers/AppKit/NSCell.h
@@ -172,6 +172,8 @@ enum {
NSMenu *_menu;
id _represented_object;
void *_reserved1;
+ unsigned periodCount;
+ NSPoint _temp_last_point;
}
//
@@ -399,6 +401,18 @@ enum {
ofView:(NSView *)controlView
untilMouseUp:(BOOL)flag;
+- (BOOL) trackMouseOriginal: (NSEvent*)theEvent
+ inRect: (NSRect)cellFrame
+ ofView: (NSView*)controlView
+ untilMouseUp: (BOOL)flag;
+
+/***** NOT USING MODEL 4 *****
+- (BOOL)trackTouch:(NSEvent *)theEvent
+ inRect:(NSRect)cellFrame
+ ofView:(NSView *)controlView
+ untilTouchEnded:(BOOL)flag;
+***** NOT USING MODEL 4 *****/
+
//
// Managing the Cursor
//
View
5 Headers/AppKit/NSComboBoxCell.h
@@ -51,6 +51,11 @@
int _selectedItem;
NSRect _lastValidFrame;
NSRange _prevSelectedRange;
+ BOOL _shouldOpenPopUp;
+ NSTimeInterval _popUpCloseTime; //last popup close time
+
+ // Instance variables for maintaining states in trackMouse
+ BOOL _mouseBeganInButtonCell;
@private
id _popup;
View
12 Headers/AppKit/NSControl.h
@@ -182,9 +182,21 @@
// Tracking the Mouse
//
- (void)mouseDown:(NSEvent *)theEvent;
+- (void)mouseUp:(NSEvent *)theEvent;
+- (void)mouseDragged:(NSEvent *)theEvent;
- (BOOL)ignoresMultiClick;
- (void)setIgnoresMultiClick:(BOOL)flag;
+//
+// Handling touch events
+//
+/***** NOT USING MODEL 4 *****
+- (void) handleSingleTouch: (NSEvent *) theEvent;
+- (void) touchesBeganWithEvent: (NSEvent *) theEvent;
+- (void) touchesMovedWithEvent: (NSEvent *) theEvent;
+- (void) touchesEndedWithEvent: (NSEvent *) theEvent;
+***** NOT USING MODEL 4 *****/
+
@end
APPKIT_EXPORT NSString *NSControlTextDidBeginEditingNotification;
View
8 Headers/AppKit/NSDownRightGestureRecognizer.h
@@ -0,0 +1,8 @@
+#import <AppKit/NSGestureRecognizer.h>
+
+@interface NSDownRightGestureRecognizer : NSGestureRecognizer {
+ NSPoint initialPoint;
+}
+
+- (float) distanceFrom: (NSPoint) p1 to: (NSPoint) p2;
+@end
View
65 Headers/AppKit/NSEvent.h
@@ -30,10 +30,13 @@
#ifndef _GNUstep_H_NSEvent
#define _GNUstep_H_NSEvent
#import <GNUstepBase/GSVersionMacros.h>
+#import <AppKit/SNTouch.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSGeometry.h>
#include <Foundation/NSDate.h>
+#include <Foundation/NSSet.h>
+#include <Foundation/NSArray.h>
@class NSString;
@class NSWindow;
@@ -77,15 +80,15 @@ typedef enum _NSEventType {
NSLeftMouseUp,
NSRightMouseDown,
NSRightMouseUp,
- NSMouseMoved,
- NSLeftMouseDragged,
+ NSMouseMoved, // 5
+ NSLeftMouseDragged, // 6
NSRightMouseDragged,
NSMouseEntered,
NSMouseExited,
NSKeyDown,
NSKeyUp,
NSFlagsChanged,
- NSAppKitDefined,
+ NSAppKitDefined, // = 13
NSSystemDefined,
NSApplicationDefined,
NSPeriodic,
@@ -97,7 +100,8 @@ typedef enum _NSEventType {
#endif
NSOtherMouseDown = 25,
NSOtherMouseUp,
- NSOtherMouseDragged
+ NSOtherMouseDragged,
+ SNTouched // 28
} NSEventType;
enum {
@@ -127,6 +131,8 @@ enum {
NSOtherMouseUpMask = (1 << NSOtherMouseUp),
NSOtherMouseDraggedMask = (1 << NSOtherMouseDragged),
+ SNTouchedMask = (1 << SNTouched),
+
NSAnyEventMask = 0xffffffffU,
// key events
@@ -136,6 +142,7 @@ enum {
| NSRightMouseDownMask | NSRightMouseUpMask | NSRightMouseDraggedMask
| NSOtherMouseDownMask | NSOtherMouseUpMask | NSOtherMouseDraggedMask
| NSMouseMovedMask | NSScrollWheelMask
+ | SNTouchedMask // touches also generate mouse events
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
| NSTabletPointMask | NSTabletProximityMask
#endif
@@ -153,7 +160,8 @@ enum {
// tracking loops may need to add NSPeriodicMask
GSTrackingLoopMask = (NSLeftMouseDownMask | NSLeftMouseUpMask
| NSLeftMouseDraggedMask | NSMouseMovedMask
- | NSRightMouseUpMask | NSOtherMouseUpMask)
+ | NSRightMouseUpMask | NSOtherMouseUpMask),
+
};
/*
@@ -201,7 +209,8 @@ enum
{
NSMouseEventSubtype,
NSTabletPointEventSubtype,
- NSTabletProximityEventSubtype
+ NSTabletProximityEventSubtype,
+ SNTouchEventSubtype
};
enum {
@@ -222,12 +231,19 @@ enum
@interface NSEvent : NSObject <NSCoding, NSCopying>
{
- NSEventType event_type;
- NSPoint location_point;
+ @public NSEventType event_type;
+ @public NSPoint location_point;
unsigned int modifier_flags;
NSTimeInterval event_time;
int window_num;
+ //@public NSMutableSet *window_num_set;
NSGraphicsContext *event_context;
+ @public NSMutableArray *touches;
+ @public NSUInteger mouse_id;
+ @public NSView *view;
+ @public short sub_type; // This is used to indicate mouse events generated by a different device (e.g. touch screen)
+ // There is also a sub_type declared in union structure below but I don't understand why it is declared in union
+ // -- can't it get overwritten?
union _MB_event_data
{
struct
@@ -255,7 +271,7 @@ enum
} tracking;
struct
{
- short sub_type;
+ short sub_type; //why declare sub_type in a union struct?
int data1;
int data2;
} misc;
@@ -309,6 +325,13 @@ enum
deltaZ: (float)deltaZ;
#endif
++ (NSEvent*) touchEventWithType: (NSEventType)type
+ touches: (NSArray*)touchArray
+ modifierFlags: (unsigned int)flags
+ timestamp: (NSTimeInterval)time
+ windowNumber: (int)windowNum
+ context: (NSGraphicsContext*)context;
+
+ (NSPoint)mouseLocation;
+ (NSEvent*) otherEventWithType: (NSEventType)type
@@ -321,9 +344,26 @@ enum
data1: (int)data1
data2: (int)data2;
++ (NSEvent*) otherEventWithType: (NSEventType)type
+ location: (NSPoint)location
+ modifierFlags: (unsigned int)flags
+ timestamp: (NSTimeInterval)time
+ windowNumber: (int)windowNum
+ view: (NSView*)view
+ mouse: (NSUInteger)mouseId
+ context: (NSGraphicsContext*)context
+ subtype: (short)subType
+ data1: (int)data1
+ data2: (int)data2;
+
+ (void) startPeriodicEventsAfterDelay: (NSTimeInterval)delaySeconds
withPeriod: (NSTimeInterval)periodSeconds;
++ (void) startPeriodicEventsAfterDelay: (NSTimeInterval)delaySeconds
+ withPeriod: (NSTimeInterval)periodSeconds
+ event: (NSEvent*)triggerEvent;
+
+ (void) stopPeriodicEvents;
++ (void) stopPeriodicEventsWithTrigger: (NSEvent*)triggerEvent;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
@@ -353,6 +393,13 @@ enum
- (void *) userData;
- (NSWindow *) window;
- (int) windowNumber;
+- (NSView *) view;
+- (NSUInteger) mouse;
+- (NSSet *) touchesMatchingPhase: (SNTouchPhase)phase inView: (NSView *)aView;
+- (NSSet *) allTouches;
+- (NSSet *) touchesForWindow: (NSWindow *)aWindow;
+- (NSSet *) touchesForView: (NSView *)aView;
+- (int) touchCount;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
- (int) absoluteX;
View
7 Headers/AppKit/NSMenuView.h
@@ -117,6 +117,13 @@
*/
- (id) initAsTearOff;
+//
+// Handling touch events... for testing purpose
+//
+- (void) touchesBeganWithEvent: (NSEvent *) theEvent;
+- (void) touchesMovedWithEvent: (NSEvent *) theEvent;
+- (void) touchesEndedWithEvent: (NSEvent *) theEvent;
+
/***********************************************************************
* Getting and setting menu view attributes
***********************************************************************/
View
7 Headers/AppKit/NSResponder.h
@@ -32,6 +32,7 @@
#import <GNUstepBase/GSVersionMacros.h>
#include <Foundation/NSObject.h>
+#include <Foundation/NSSet.h>
#include <AppKit/NSInterfaceStyle.h>
#include <AppKit/AppKitDefines.h>
@@ -112,6 +113,12 @@
- (void) scrollWheel: (NSEvent *)theEvent;
#endif
+- (void) periodicEvent: (NSEvent*)theEvent;
+- (void) touchesBegan: (NSSet *) touches withEvent: (NSEvent *) theEvent;
+- (void) touchesMoved: (NSSet *) touches withEvent: (NSEvent *) theEvent;
+- (void) touchesEnded: (NSSet *) touches withEvent: (NSEvent *) theEvent;
+- (void) touchesCancelled: (NSSet *) touches withEvent: (NSEvent *) theEvent;
+
/*
* Services menu support
*/
View
1  Headers/AppKit/NSScroller.h
@@ -77,6 +77,7 @@ typedef enum _NSScrollerArrow {
NSScrollArrowPosition _arrowsPosition;
NSUsableScrollerParts _usableParts;
BOOL _cacheValid;
+ float _trackKnob_offset;
}
//
View
7 Headers/AppKit/NSSplitView.h
@@ -54,6 +54,13 @@
- (void) drawDividerInRect: (NSRect)aRect;
- (CGFloat) dividerThickness;
+//
+// Handling touch events
+//
+- (void) touchesBeganWithEvent: (NSEvent *) theEvent;
+- (void) touchesMovedWithEvent: (NSEvent *) theEvent;
+- (void) touchesEndedWithEvent: (NSEvent *) theEvent;
+
/* Vertical splitview has a vertical split bar */
- (void) setVertical: (BOOL)flag;
- (BOOL) isVertical;
View
18 Headers/AppKit/NSTableView.h
@@ -105,6 +105,24 @@ typedef enum _NSTableViewColumnAutoresizingStyle
NSString *_autosaveName;
BOOL _verticalMotionDrag;
+ // Instance variables to keep state info for loop-free event handling
+ NSPoint _initialLocation;
+ unsigned _selectionMode;
+ NSIndexSet *_mouseDownOldSelectedRows;
+ BOOL _startedPeriodicEvents;
+ BOOL _mouseBelowView;
+ BOOL _mouseMoved;
+ BOOL _dragOperationPossible;
+ float _minYVisible;
+ float _maxYVisible;
+ float _oldPeriod;
+ int _originalRow;
+ int _oldRow;
+ int _currentRow;
+ //BOOL _getNextEvent; //to be removed
+ BOOL _sendAction;
+
+
/*
* Ivars Acting as Cache
*/
View
10 Headers/AppKit/NSTextView.h
@@ -169,6 +169,16 @@ therefore be stored in the NSLayoutManager to avoid problems.
NSSize _minSize;
NSSize _maxSize;
+ // Instance variables for maintaining mouseDown states
+ BOOL _canDrag;
+ BOOL _gettingPeriodic;
+ NSSelectionAffinity _affinity;
+ NSSelectionGranularity _granularity;
+ NSRange _chosenRange, _proposedRange;
+ unsigned _startIndex;
+ NSEvent *_lastEvent; /* Last non-periodic event. */
+ BOOL _dragStarted;
+
/* The following is the object used when posting notifications.
It is usually `self' - but in the case of multiple textviews
View
69 Headers/AppKit/NSView.h
@@ -51,6 +51,7 @@
@class NSScrollView;
@class NSView;
@class NSWindow;
+@class SNGestureRecognizer;
typedef int NSTrackingRectTag;
typedef int NSToolTipTag;
@@ -114,6 +115,23 @@ typedef enum _NSFocusRingType {
void *_nextKeyView;
void *_previousKeyView;
+ short _mouseCount; // Number of mice (including mice generated by touches) currently holding down on this view
+ short _touchCount; // Number of touches currently on this view
+ NSUInteger _first_mouse_id;
+ NSUInteger _first_touch_id;
+ NSPoint _first_mouse_location_in_view;
+ NSPoint _first_touch_location_in_view;
+ BOOL _supportsMultiTouch;
+ BOOL _multipleTouchEnabled;
+ BOOL _exclusiveTouch;
+ BOOL _userInteractionEnabled;
+
+ NSMutableArray *_gesture_recognizers;
+ BOOL _allowsNextResponderToRecognizeGestures;
+
+ // for demo purpose only..
+ BOOL _zoomMode;
+
@public
/*
* Flags for internal use by NSView and it's subclasses.
@@ -494,6 +512,57 @@ typedef enum _NSFocusRingType {
#endif
/*
+ * Mouse/touch count
+ */
+- (void) incrementMouseCount;
+- (void) decrementMouseCount;
+- (void) incrementTouchCount;
+- (void) decrementTouchCount;
+- (short) mouseCount;
+- (short) touchCount;
+
+/*
+ * First mouse/touch
+ */
+- (void) setFirstMouse: (NSUInteger)mouse_id;
+- (NSUInteger) firstMouse;
+- (void) setFirstTouch: (NSUInteger)touch_id;
+- (NSUInteger) firstTouch;
+- (void) setFirstMouseLocationInView: (NSPoint)location;
+- (NSPoint) firstMouseLocationInView;
+- (void) setFirstTouchLocationInView: (NSPoint)location;
+- (NSPoint) firstTouchLocationInView;
+
+/*
+ * Touch related
+ */
+- (BOOL) userInteractionEnabled;
+- (void) setUserInteractionEnabled: (BOOL)value;
+- (BOOL) supportsMultiTouch;
+- (void) setSupportsMultiTouch: (BOOL)value;
+- (BOOL) multipleTouchEnabled;
+- (void) setMultipleTouchEnabled: (BOOL)value;
+- (BOOL) exclusiveTouch;
+- (void) setExclusiveTouch: (BOOL)value;
+
+/*
+ * Managing gesture recognizers
+ */
+- (void) addGestureRecognizer: (SNGestureRecognizer *)gestureRecognizer;
+- (void) removeGestureRecognizer: (SNGestureRecognizer *)gestureRecognizer;
+- (NSArray*) gestureRecognizers;
+- (BOOL) allowsNextResponderToRecognizeGestures;
+- (void) setAllowsNextResponderToRecognizeGestures: (BOOL)aValue;
+
+
+// for demo purpose only...
+- (BOOL) zoomMode;
+- (void) setZoomMode: (BOOL)aValue;
+
+
+- (void) setFrameRotationOnPoint: (float)angle andPoint: (NSPoint) point;
+
+/*
* Printing
*/
- (void) fax: (id)sender;
View
20 Headers/AppKit/NSWindow.h
@@ -38,11 +38,14 @@
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSResponder.h>
+#include <AppKit/SNTouch.h>
@class NSArray;
@class NSData;
@class NSDate;
@class NSDictionary;
+@class SNGestureRecognizer;
+@class NSMutableDictionary;
@class NSMutableArray;
@class NSNotification;
@class NSString;
@@ -179,6 +182,9 @@ APPKIT_EXPORT NSSize NSTokenSize;
int _gstate;
id _defaultButtonCell;
NSGraphicsContext *_context;
+ //NSMutableDictionary *_touchViewDictionary;
+ NSMutableDictionary *_mouseViewDictionary;
+ NSView *_firstViewTouched; //First view touched in multi-touch sequence
NSScreen *_screen;
NSColor *_backgroundColor;
@@ -193,6 +199,8 @@ APPKIT_EXPORT NSSize NSTokenSize;
NSRect _rectNeedingFlush;
NSMutableArray *_rectsBeingDrawn;
unsigned _disableFlushWindow;
+
+ id _dragView;
NSWindowDepth _depthLimit;
NSWindowController *_windowController;
@@ -328,6 +336,11 @@ APPKIT_EXPORT NSSize NSTokenSize;
- (NSRect) frame;
/**
+ * Returns the window number
+ */
+- (int) windowNum;
+
+/**
* <p>Sets the frame for the receiver to frameRect and if flag is YES causes
* the window contents to be refreshed. The value of frameRect is the
* desired on-screen size and position of the window including all
@@ -341,6 +354,9 @@ APPKIT_EXPORT NSSize NSTokenSize;
- (void) setFrame: (NSRect)frameRect
display: (BOOL)flag;
+- (void) cleanMouseViewDictionary;
+- (NSView*) viewForMouseEvent: (NSEvent*)theEvent;
+
/**
* Sets the origin (bottom left corner) of the receiver's frame to be the
* specified point (in screen coordinates).
@@ -545,6 +561,10 @@ APPKIT_EXPORT NSSize NSTokenSize;
beforeEvent: (NSEvent*)lastEvent;
- (void) postEvent: (NSEvent*)event
atStart: (BOOL)flag;
+- (void) sendTouchesToGestureRecognizers: (NSSet *)touches
+ withEvent: (NSEvent *)theEvent
+ inPhase: (SNTouchPhase)phase
+ inView: (NSView *)aView;
- (void) sendEvent: (NSEvent*)theEvent;
- (BOOL) tryToPerform: (SEL)anAction with: (id)anObject;
- (void) keyDown: (NSEvent*)theEvent;
View
12 Headers/AppKit/SNCheckmarkGestureRecognizer.h
@@ -0,0 +1,12 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+@interface SNCheckmarkGestureRecognizer : SNGestureRecognizer {
+ BOOL strokeDown;
+ BOOL strokeUp;
+ NSPoint midPoint;
+ NSPoint cachedPoint;
+}
+
+- (NSPoint) midpointInView:(NSView *)view;
+
+@end
View
99 Headers/AppKit/SNGestureRecognizer.h
@@ -0,0 +1,99 @@
+#include "Foundation/NSObject.h"
+#include <AppKit/AppKit.h>
+
+//@class NSView, NSSet, NSEvent;
+
+typedef enum {
+ SNGestureRecognizerStatePossible,
+ SNGestureRecognizerStateBegan,
+ SNGestureRecognizerStateChanged,
+ SNGestureRecognizerStateEnded,
+ SNGestureRecognizerStateCancelled,
+ SNGestureRecognizerStateFailed,
+ SNGestureRecognizerStateRecognized = SNGestureRecognizerStateEnded
+} SNGestureRecognizerState;
+
+@interface LastTouch : NSObject {
+ @public NSTimeInterval timestamp;
+ @public NSPoint location;
+ @public unsigned int tapCount;
+}
+@end
+
+@interface SNGestureRecognizer : NSObject {
+ id _target;
+ SEL _action;
+
+ /*
+ * Note: _view and _hitTestedView may not point to the same view.
+ * This is true when a view allows its next responder's GRs to analyze touches.
+ * In that case, _view is the parent view and _hitTestedView is the child view
+ */
+ NSView* _view; //view to which this GR is attached
+ NSView* _hitTestedView; //the hit tested view
+ int _state;
+
+ //NSMutableArray* _delayedTouches;
+ //NSEvent* _updateEvent;
+ NSMutableSet* _obstacles; //recognizers I'm waiting to fail
+ NSMutableSet* _currentObstacles;
+ NSMutableSet* _vultures; //recognizers waiting for me to fail
+ //NSMutableSet* _friends; //recognizers for simultaneous recognition?
+
+ NSTimer *_timer;
+
+ BOOL _enabled;
+ BOOL _cancelsTouchesInView;
+ BOOL _delaysTouchesBegan;
+ BOOL _delaysTouchesEnded;
+ BOOL _actionSent;
+ BOOL _hasBegun;
+}
+
+// Initializing a gesture recognizer
+- (id)initWithTarget:(id)target action:(SEL)action;
+
+// Adding and removing targets and actions
+//- (void)addTarget:(id)targetaction:(SEL)action;
+//- (void)removeTarget:(id)targetaction:(SEL)action;
+
+// Getting the touches and location of a gesture
+- (NSPoint)locationInView:(NSView *)view;
+//- (NSPoint)locationOfTouch:(NSUInteger)touchIndex inView:(NSView *)view;
+//- (NSUInteger)numberOfTouches;
+
+// Getting the recognizer's state and view
+- (int)state;
+- (void)changeState:(SNGestureRecognizerState)aState;
+- (id)view;
+- (void)setView:(NSView*)aView;
+- (id)hitTestedView;
+- (BOOL)enabled;
+- (void)setEnabled:(BOOL)aValue;
+- (BOOL)hasBegun;
+
+// Cancelling and delaying touches
+- (BOOL)cancelsTouchesInView;
+- (BOOL)delaysTouchesBegan;
+- (BOOL)delaysTouchesEnded;
+
+// Specifying dependencies between gesture recognizers
+- (void)requireGestureRecognizerToFail:(SNGestureRecognizer *)otherGestureRecognizer;
+- (void)addObstacle:(SNGestureRecognizer *)otherGestureRecognizer;
+- (void)removeObstacle:(SNGestureRecognizer *)otherGestureRecognizer;
+- (void)addVulture:(SNGestureRecognizer *)otherGestureRecognizer;
+- (void)tryToSendAction;
+- (void)notifyFailure;
+- (void)notifySuccess;
+
+// Methods for subclasses
+- (void)reset;
+- (void)touchesBegan:(NSSet*)touches withEvent:(NSEvent*)event;
+- (void)touchesMoved:(NSSet*)touches withEvent:(NSEvent*)event;
+- (void)touchesEnded:(NSSet*)touches withEvent:(NSEvent*)event;
+- (void)touchesCancelled:(NSSet*)touches withEvent:(NSEvent*)event;
+
+// Common geometric calculations
+- (NSPoint) centroidOfTouchesInWindow: (NSSet*)touches;
+
+@end
View
66 Headers/AppKit/SNLassoGestureRecognizer.h
@@ -0,0 +1,66 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+/***
+typedef enum {
+ Undecided = 0,
+ Clockwise = 1 << 0,
+ CounterClockwise = 1 << 1,
+} RotationDirection;
+***/
+
+@interface SNLassoGestureRecognizer : SNGestureRecognizer {
+
+ NSMutableArray *vertices;
+ NSPoint initialPoint;
+ NSPoint currentPoint;
+ NSPoint previousPoint;
+
+ float granularity;
+ float maxEndToBeginDistance;
+
+ float currentTangent;
+ float previousTangent;
+
+ /***
+ float currentRotation;
+ float previousRotation;
+ float totalRotation;
+ float rotationBeganThreshold;
+ float minTotalRotation;
+ float maxTotalRotation;
+ float rotationStepCeiling;
+ float rotationStepFloor;
+ float currentStepFloor;
+ ***/
+
+ float totalRotation;
+ float minRotation;
+ BOOL minRotationReached;
+
+ float maxX;
+ float maxY;
+ float minX;
+ float minY;
+
+ float winding;
+ //RotationDirection rotationDirection;
+
+}
+
+
+- (void) setGranularity: (float) aGranularity;
+- (void) setMaxEndToBeginDistance: (float) distance;
+- (void) setMinRotation: (float) rotation;
+- (float) windingNumber;
+//- (float) rotation;
+//- (RotationDirection) direction;
+//- (void) setRotationBeganThreshold: (float) rotation;
+//- (void) setMinTotalRotation: (float) minRotation;
+//- (void) setMaxTotalRotation: (float) maxRotation;
+- (float) distanceFrom: (NSPoint) p1 to: (NSPoint) p2;
+- (float) angleFrom: (NSPoint) p1 to: (NSPoint) p2;
+- (float) rotationFrom: (float) angle1 to: (float) angle2;
+- (BOOL) pointInLasso: (NSPoint) point inView: (NSView *) view;
+- (float) calculateWindingNumberFrom: (NSPoint) v1 to: (NSPoint) v2;
+
+@end
View
33 Headers/AppKit/SNLongPressGestureRecognizer.h
@@ -0,0 +1,33 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+@interface SNLongPressGestureRecognizer : SNGestureRecognizer {
+ NSUInteger numberOfTapsRequired;
+ NSUInteger numberOfTouchesRequired;
+ NSTimeInterval minimumPressDuration;
+ float allowableMovement;
+ NSPoint initialCentroid;
+
+ // # of touches remaining on screen; must be equal to numberOfTouchesRequired
+ // when verifyLongPress is called
+ NSUInteger touchesOnScreen;
+
+ NSMutableDictionary *tapCountDictionary;
+ NSTimeInterval maximumTimeBetweenTaps;
+ float maximumMovementBetweenTaps;
+
+ NSTimer *cleanDictionaryTimer;
+}
+
+- (void) setNumberOfTapsRequired: (NSUInteger)num;
+- (void) setNumberOfTouchesRequired: (NSUInteger)num;
+- (void) setMaximumTimeBetweenTaps: (NSTimeInterval)time;
+- (void) setMaximumMovementBetweenTaps: (float)move;
+- (void) setMinimumPressDuration: (NSTimeInterval)duration;
+- (void) setAllowableMovement: (float)movement;
+- (void) verifyLongPress: (NSTimer*)timer;
+- (void) failLongPress: (NSTimer*)timer;
+- (BOOL) testTapCount: (NSSet*)touches withEvent:(NSEvent*)event;
+- (BOOL) allTouchesHaveTapCount: (NSUInteger)tap;
+- (void) cleanDictionary: (NSTimer*)timer;
+
+@end
View
31 Headers/AppKit/SNPanGestureRecognizer.h
@@ -0,0 +1,31 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+@interface SNPanGestureRecognizer : SNGestureRecognizer {
+ NSUInteger numberOfTouchesRequired;
+ float minimumPanMovement;
+ NSPoint translationInWindow;
+
+ NSPoint initialCentroid;
+ NSPoint currentCentroid;
+ NSPoint previousCentroid;
+ NSPoint endCentroid;
+
+ NSTimeInterval initialTimestamp;
+ NSTimeInterval currentTimestamp;
+ NSTimeInterval previousTimestamp;
+ NSTimeInterval endTimestamp;
+
+ // # of touches of the pan; must be equal to numberOfTouchesRequired
+ NSUInteger touchCount;
+
+ // # of touches remaining on screen when touchesEnded is called
+ NSUInteger touchesOnScreen;
+}
+
+- (void) setNumberOfTouchesRequired: (NSUInteger)num;
+- (void) setMinimumPanMovement: (float)movement;
+- (void) touchesNotSynchronized: (NSTimer*)timer;
+- (NSPoint) translationInWindow;
+- (NSPoint) velocityInWindow;
+
+@end
View
32 Headers/AppKit/SNPinchGestureRecognizer.h
@@ -0,0 +1,32 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+@interface SNPinchGestureRecognizer : SNGestureRecognizer {
+
+ float minimumPinchMovement;
+ float scale;
+ float movement;
+
+ //NSPoint initialCentroid;
+ NSPoint currentCentroid;
+ //NSPoint previousCentroid;
+ //NSPoint endCentroid;
+
+ float initialDistance;
+ float currentDistance;
+ float previousDistance;
+ float endDistance;
+
+ NSTimeInterval initialTimestamp;
+ NSTimeInterval currentTimestamp;
+ NSTimeInterval previousTimestamp;
+ NSTimeInterval endTimestamp;
+}
+
+- (void) setMinimumPinchMovement: (float)minMovement;
+- (float) movement;
+- (float) scale;
+- (float) distanceFrom: (NSPoint) p1 to: (NSPoint) p2;
+- (float) velocityOfMovement;
+- (float) velocityOfScale;
+
+@end
View
33 Headers/AppKit/SNRotationGestureRecognizer.h
@@ -0,0 +1,33 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+@interface SNRotationGestureRecognizer : SNGestureRecognizer {
+
+ NSUInteger identity1;
+ NSUInteger identity2;
+
+ float minimumRotation;
+ float rotation;
+
+ //NSPoint initialCentroid;
+ NSPoint currentCentroid;
+ //NSPoint previousCentroid;
+ //NSPoint endCentroid;
+
+ float initialAngle;
+ float currentAngle;
+ float previousAngle;
+ float endAngle;
+
+ NSTimeInterval initialTimestamp;
+ NSTimeInterval currentTimestamp;
+ NSTimeInterval previousTimestamp;
+ NSTimeInterval endTimestamp;
+}
+
+- (void) setMinimumRotation: (float)minRotation;
+- (float) rotation;
+- (float) velocity;
+- (float) angleFrom: (NSPoint) p1 to: (NSPoint) p2;
+- (float) rotationFrom: (float) angle1 to: (float) angle2;
+
+@end
View
45 Headers/AppKit/SNSwipeGestureRecognizer.h
@@ -0,0 +1,45 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+typedef enum {
+ SNSwipeGestureRecognizerDirectionRight = 1 << 0,
+ SNSwipeGestureRecognizerDirectionLeft = 1 << 1,
+ SNSwipeGestureRecognizerDirectionUp = 1 << 2,
+ SNSwipeGestureRecognizerDirectionDown = 1 << 3
+} SNSwipeGestureRecognizerDirection;
+
+@interface SNSwipeGestureRecognizer : SNGestureRecognizer {
+ NSUInteger numberOfTouchesRequired;
+ SNSwipeGestureRecognizerDirection direction;
+ SNSwipeGestureRecognizerDirection recognizedDirection;
+ float minimumSwipeDistance;
+ NSTimeInterval maximumSwipeDuration;
+ float allowableAngleDeviation;
+
+ NSPoint initialCentroid;
+
+ // Fingers can touch down & lift up at different times
+ // This timer is used so that all required fingers must touch down
+ // within 0.3 second, and when ending the gesture, all of them
+ // must lift up within 0.3 second too
+ NSTimer *_touchCountTimer;
+
+ // # of touches of the swipe; must be equal to numberOfTouchesRequired
+ NSUInteger touchCount;
+
+ // # of touches remaining on screen when touchesEnded is called
+ NSUInteger touchesOnScreen;
+}
+
+- (void) setNumberOfTouchesRequired: (NSUInteger)num;
+- (void) setDirection: (SNSwipeGestureRecognizerDirection)dir;
+- (void) setMinimumSwipeDistance: (float)distance;
+- (void) setMaximumSwipeDuration: (NSTimeInterval)duration;
+- (void) setAllowableAngleDeviation: (float)angle;
+- (SNSwipeGestureRecognizerDirection) direction;
+
+- (void) durationExceeded: (NSTimer*)timer;
+- (void) touchesNotSynchronized: (NSTimer*)timer;
+- (float) angleFrom: (NSPoint) p1 to: (NSPoint) p2;
+- (BOOL) directionPermitted: (float)currentAngle;
+
+@end
View
30 Headers/AppKit/SNTapGestureRecognizer.h
@@ -0,0 +1,30 @@
+#import <AppKit/SNGestureRecognizer.h>
+
+@interface SNTapGestureRecognizer : SNGestureRecognizer {
+ NSUInteger numberOfTapsRequired;
+ NSUInteger numberOfTouchesRequired;
+ NSPoint initialCentroid;
+ float allowableMovement;
+
+ // # of touches remaining on screen when verifyTap is called
+ // must be equal to zero for the tap to be recognized
+ NSUInteger touchesOnScreen;
+
+ NSMutableDictionary *tapCountDictionary;
+ NSTimeInterval maximumTimeBetweenTaps;
+ float maximumMovementBetweenTaps;
+
+ NSTimer *cleanDictionaryTimer;
+}
+
+- (void) setNumberOfTapsRequired: (NSUInteger)num;
+- (void) setNumberOfTouchesRequired: (NSUInteger)num;
+- (void) setMaximumTimeBetweenTaps: (NSTimeInterval)time;
+- (void) setMaximumMovementBetweenTaps: (float)move;
+- (void) setAllowableMovement: (float)movement;
+- (void) verifyTap: (NSTimer*)timer;
+- (BOOL) testTapCount: (NSSet*)touches withEvent:(NSEvent*)event;
+- (BOOL) allTouchesHaveTapCount: (NSUInteger)tap;
+- (void) cleanDictionary: (NSTimer*)timer;
+
+@end
View
78 Headers/AppKit/SNTouch.h
@@ -0,0 +1,78 @@
+#include "Foundation/NSObject.h"
+#include <Foundation/NSGeometry.h>
+//#include "AppKit/NSWindow.h"
+//#include "AppKit/NSView.h"
+
+@class NSWindow;
+@class NSView;
+
+enum {
+ SNTouchPhaseBegan = 1U << 0,
+ SNTouchPhaseMoved = 1U << 1,
+ SNTouchPhaseStationary = 1U << 2,
+ SNTouchPhaseEnded = 1U << 3,
+ SNTouchPhaseCancelled = 1U << 4,
+
+ SNTouchPhaseTouching = SNTouchPhaseBegan | SNTouchPhaseMoved | SNTouchPhaseStationary,
+ SNTouchPhaseAny = 0xffffffffU
+
+};
+typedef NSUInteger SNTouchPhase;
+
+@interface SNTouch : NSObject /*<NSCopying>*/
+{
+ //double _timestamp;
+ @public NSUInteger identity;
+ @public SNTouchPhase phase;
+ @public unsigned int tapCount;
+ NSWindow *window;
+ NSView *view;
+ @public NSPoint locationInWindow;
+
+ //struct CGPoint _previousLocationInWindow;
+ /**
+ struct {
+ unsigned int _firstTouchForView:1;
+ unsigned int _isTap:1;
+ unsigned int _isWarped:1;
+ } _touchFlags;
+ **/
+}
+
++ (SNTouch*) touchWithIdentity: (NSUInteger)iden
+ phase: (SNTouchPhase) pha
+ window: (NSWindow*) win
+ view: (NSView*) vi
+ locationInWindow: (NSPoint)loc;
+
++ (SNTouch*) touchWithIdentity: (NSUInteger)iden
+ phase: (SNTouchPhase) pha
+ window: (NSWindow*) win
+ locationInWindow: (NSPoint)loc;
+
++ (SNTouch*) touchWithIdentity: (NSUInteger)iden
+ phase: (SNTouchPhase)pha
+ tapCount: (unsigned int)tap
+ windowNumber: (int)windowNum
+ locationInWindow: (NSPoint)loc;
+
+- (void)dealloc;
+//- (double)timestamp;
+- (NSUInteger)identity;
+- (NSUInteger)phase;
+//- (int)info;
+- (unsigned int)tapCount;
+//- (BOOL)isTap;
+//- (BOOL)isWarped;
+- (id)window;
+- (id)view;
+- (void)setView: (NSView*) v;
+//- (struct CGPoint)locationInView:(id)fp8;
+
+- (NSPoint) locationInWindow;
+- (NSPoint) locationInView;
+
+//- (struct CGPoint)previousLocationInView:(id)fp8;
+
+@end
+
View
2  Images/.cvsignore
@@ -1,2 +0,0 @@
-.xvpics
-Makefile
View
9 Model/.cvsignore
@@ -1,9 +0,0 @@
-GNUmakefile.local
-*obj
-*.app
-*.debug
-*.profile
-.gdbinit
-*.nib~
-*.iconheader
-*.bundle
View
2  Model/GNUmakefile
@@ -93,5 +93,5 @@ endif
include $(GNUSTEP_MAKEFILES)/library.make
include $(GNUSTEP_MAKEFILES)/tool.make
include $(GNUSTEP_MAKEFILES)/application.make
-
+include GNUmakefile.preamble
include GNUmakefile.postamble
View
2  Model/GNUmakefile.postamble
@@ -27,7 +27,7 @@ before-libgmodel-all:: \
$(addprefix ../Headers/Additions/GNUstepGUI/, $(libgmodel_HEADER_FILES))
../Headers/Additions/GNUstepGUI/%.h: %.h
- cp $^ $@
+ cp -f $^ $@
# Additional dependencies
$(GNUSTEP_OBJ_DIR)/GMArchiver.o: GMArchiveObjects.m
View
36 Model/GNUmakefile.preamble
@@ -0,0 +1,36 @@
+#
+# GNUmakefile.preamble - Generated by ProjectCenter
+#
+#include ../../../../../../target/defs.mk
+#include $(BASE_DIR)/src/defs.mk
+# Additional flags to pass to the preprocessor
+# ADDITIONAL_CPPFLAGS +=
+
+# Additional flags to pass to Objective C compiler
+# ADDITIONAL_OBJCFLAGS +=
+
+# Additional flags to pass to C compiler
+# ADDITIONAL_CFLAGS +=
+
+# Additional flags to pass to the linker
+ ADDITIONAL_LDFLAGS += -lapplication_manager
+
+# Additional include directories the compiler should search
+ADDITIONAL_INCLUDE_DIRS += -I$(WORKSPACE_ROOT)/src/include
+
+# Additional library directories the linker should search
+#ADDITIONAL_LIB_DIRS += /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libmedia_player.so /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libgstreamer-0.10.so /usr/local/lib/libglib-2.0.so
+
+#ADDITIONAL_LIB_DIRS += /Home/hul/Desktop/CHG-USERS/premv/SNMoviePlayer/libmedia_player.so /home/hul/oryza/target/X86_LINUX_PC/rootfs/devel-rootfs/usr/local/lib/libgstreamer-0.10.so /usr/local/lib/libglib-2.0.so
+
+
+ADDITIONAL_LIB_DIRS += -L$(TARGET_ROOT)/lib
+#ADDITIONAL_LIB_DIRS += $(TARGET_ROOT)/lib/libospl.so
+#ADDITIONAL_LIB_DIRS += $(TARGET_ROOT)/lib/libdebug.so
+
+#ADDITIONAL_LIB_DIRS += `PKG_CONFIG_LIBDIR=$(TARGET_ROOT)/lib/pkgconfig pkg-config --libs gstreamer-0.10 glib-2.0`
+
+
+# Additional GUI libraries to link
+# ADDITIONAL_GUI_LIBS +=
+
View
2  Printing/GSCUPS/GNUmakefile.preamble
@@ -15,7 +15,7 @@ ADDITIONAL_CFLAGS += $(GSCUPS_CFLAGS)
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../Headers/Additions -I../../Headers \
- -I../../Source/$(GNUSTEP_TARGET_DIR)
+ -I../../Source/$(GNUSTEP_TARGET_DIR) -I$(WORKSPACE_ROOT)/src/include
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS += $(GSCUPS_LDFLAGS)
View
2  Printing/GSLPR/GNUmakefile.preamble
@@ -15,7 +15,7 @@ ADDITIONAL_CFLAGS +=
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../Headers/Additions -I../../Headers \
- -I../../Source/$(GNUSTEP_TARGET_DIR)
+ -I../../Source/$(GNUSTEP_TARGET_DIR) -I$(WORKSPACE_ROOT)/src/include
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS +=
View
2  Resources/Esperanto.lproj/Localizable.strings
@@ -1,4 +1,4 @@
-/* Translator: Ingolf Jandt, <i.jandt@web.de>
+/* Translator: Ingolf Jandt, <i.jandt@web.de>
* Date: April 2006
*/
View
1  Source/.cvsignore
@@ -1 +0,0 @@
-*obj
View
24 Source/GNUmakefile
@@ -231,7 +231,17 @@ GSModelLoaderFactory.m \
GSGormLoader.m \
GSGModelLoader.m \
GSNibLoader.m \
-NSManagedObjectContext.m
+NSManagedObjectContext.m \
+SNTouch.m \
+SNGestureRecognizer.m \
+SNTapGestureRecognizer.m \
+SNLongPressGestureRecognizer.m \
+SNSwipeGestureRecognizer.m \
+SNPanGestureRecognizer.m \
+SNPinchGestureRecognizer.m \
+SNRotationGestureRecognizer.m \
+SNCheckmarkGestureRecognizer.m \
+SNLassoGestureRecognizer.m
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
# but does not implement <NSObject>'s methods itself (it inherits
@@ -392,7 +402,17 @@ NSNib.h \
NSSpellProtocol.h \
NSUserInterfaceValidation.h \
DPSOperators.h \
-PSOperators.h
+PSOperators.h \
+SNTouch.h \
+SNGestureRecognizer.h \
+SNTapGestureRecognizer.h \
+SNLongPressGestureRecognizer.h \
+SNSwipeGestureRecognizer.h \
+SNPanGestureRecognizer.h \
+SNPinchGestureRecognizer.h \
+SNRotationGestureRecognizer.h \
+SNCheckmarkGestureRecognizer.h \
+SNLassoGestureRecognizer.h
GUI_HEADERS = \
GSVersion.h \
View
6 Source/GNUmakefile.preamble
@@ -55,13 +55,13 @@ ADDITIONAL_OBJCFLAGS = -Wall
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../Headers/Additions -I../Headers \
- -I./$(GNUSTEP_TARGET_DIR)
+ -I./$(GNUSTEP_TARGET_DIR) -I$(WORKSPACE_ROOT)/src/include
# Additional LDFLAGS to pass to the linker
-# ADDITIONAL_LDFLAGS =
+ ADDITIONAL_LDFLAGS = -lapplication_manager
# Additional library directories the linker should search
-# ADDITIONAL_LIB_DIRS =
+ ADDITIONAL_LIB_DIRS = -L$(TARGET_ROOT)/lib
#
# Sparc systems cannot load tiff files due to some problem compiling
View
5 Source/GSDisplayServer.m
@@ -826,6 +826,7 @@ - (void) setShadow: (BOOL)hasShadow : (int)win
*/
- (NSPoint) mouselocation
{
+ //printf("GSDisplayServer mouseLocation\n"); //never printed...
[self subclassResponsibility: _cmd];
return NSZeroPoint;
}
@@ -840,6 +841,7 @@ - (NSPoint) mouselocation
*/
- (NSPoint) mouseLocationOnScreen: (int)aScreen window: (int *)win
{
+ //printf("GSDisplayServer mouseLocationOnScreen\n"); //never printed...
[self subclassResponsibility: _cmd];
return NSZeroPoint;
}
@@ -929,6 +931,7 @@ - (NSEvent*) getEventMatchingMask: (unsigned)mask
unsigned pos = 0; /* Position in queue scanned so far */
NSRunLoop *loop = nil;
+ //printf("GSDisplayServer getEventMatchingMask\n");
do
{
unsigned count = [event_queue count];
@@ -945,6 +948,7 @@ - (NSEvent*) getEventMatchingMask: (unsigned)mask
* Special case - if the mask matches any event, we just get the
* first event on the queue.
*/
+ //printf("GSDisplayServer mask == NSAnyEventMask\n");
event = [event_queue objectAtIndex: 0];
}
else
@@ -1046,6 +1050,7 @@ - (void) discardEventsMatchingMask: (unsigned)mask
*/
- (void) postEvent: (NSEvent*)anEvent atStart: (BOOL)flag
{
+ //printf("GSDisplayServer postEvent\n");
if (flag)
[event_queue insertObject: anEvent atIndex: 0];
else
View
483 Source/GSDragView.m
@@ -33,6 +33,7 @@
#include <Foundation/NSDebug.h>
#include <Foundation/NSThread.h>
+#include <Foundation/NSRunLoop.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSCell.h>
@@ -235,47 +236,61 @@ - (void) dragImage: (NSImage*)anImage
source: (id)sourceObject
slideBack: (BOOL)slideFlag
{
- NSPoint eventPoint;
- NSPoint imagePoint;
-
- ASSIGN(dragPasteboard, pboard);
- ASSIGN(dragSource, sourceObject);
- dragSequence = [event timestamp];
- slideBack = slideFlag;
-
- // Unset the target window
- targetWindowRef = 0;
- targetMask = NSDragOperationAll;
- destExternal = NO;
-
- NSDebugLLog(@"NSDragging", @"Start drag with %@", [pboard types]);
-
- /*
- * The position of the mouse is the event location plus any offset
- * provided. We convert this from window coordinates to screen
- * coordinates.
- */
- eventPoint = [event locationInWindow];
- eventPoint = [[event window] convertBaseToScreen: eventPoint];
- eventPoint.x += initialOffset.width;
- eventPoint.y += initialOffset.height;
-
- /*
- * Adjust image location to match the mose adjustment.
- */
- imagePoint = screenLocation;
- imagePoint.x += initialOffset.width;
- imagePoint.y += initialOffset.height;
-
- [self _setupWindowFor: anImage
- mousePosition: eventPoint
- imagePosition: imagePoint];
-
- isDragging = YES;
+ //printf("GSDragView dragImage\n");
+ NSEventType eventType = [event type];
+
+ if (eventType == NSLeftMouseDown)
+ {
+ NSPoint eventPoint;
+ NSPoint imagePoint;
+
+ printf("pboard = %s\n", [[pboard description] cString]);
+ ASSIGN(dragPasteboard, pboard);
+ ASSIGN(dragSource, sourceObject);
+ dragSequence = [event timestamp];
+ slideBack = slideFlag;
+
+ // Unset the target window
+ printf("setting targetWindowRef to 0!!!\n");
+ targetWindowRef = 0;
+ targetMask = NSDragOperationAll;
+ destExternal = NO;
+
+ NSDebugLLog(@"NSDragging", @"Start drag with %@", [pboard types]);
+
+ /*
+ * The position of the mouse is the event location plus any offset
+ * provided. We convert this from window coordinates to screen
+ * coordinates.
+ */
+ eventPoint = [event locationInWindow];
+ eventPoint = [[event window] convertBaseToScreen: eventPoint];
+ eventPoint.x += initialOffset.width;
+ eventPoint.y += initialOffset.height;
+
+ /*
+ * Adjust image location to match the mose adjustment.
+ */
+ imagePoint = screenLocation;
+ imagePoint.x += initialOffset.width;
+ imagePoint.y += initialOffset.height;
+
+ [self _setupWindowFor: anImage
+ mousePosition: eventPoint
+ imagePosition: imagePoint];
+
+ isDragging = YES;
+ }
+
+ //printf("dragPasteboard = %s\n", [[dragPasteboard description] cString]);
[self _handleDrag: event slidePoint: screenLocation];
- isDragging = NO;
- DESTROY(dragSource);
- DESTROY(dragPasteboard);
+
+ if (eventType == NSLeftMouseUp)
+ {
+ isDragging = NO;
+ DESTROY(dragSource);
+ DESTROY(dragPasteboard);
+ }
}
- (void) slideDraggedImageTo: (NSPoint)point
@@ -602,146 +617,204 @@ - (void) _sendLocalEvent: (GSAppKitSubtype)subtype
*/
- (void) _handleDrag: (NSEvent*)theEvent slidePoint: (NSPoint)slidePoint
{
- // Caching some often used values. These values do not
- // change in this method.
- // Use eWindow for coordination transformation
- NSWindow *eWindow = [theEvent window];
- NSDate *theDistantFuture = [NSDate distantFuture];
- unsigned int eventMask = NSLeftMouseDownMask | NSLeftMouseUpMask
- | NSLeftMouseDraggedMask | NSMouseMovedMask
- | NSPeriodicMask | NSAppKitDefinedMask | NSFlagsChangedMask;
- NSPoint startPoint;
- // Storing values, to restore after we have finished.
- NSCursor *cursorBeforeDrag = [NSCursor currentCursor];
- BOOL deposited;
-
- startPoint = [eWindow convertBaseToScreen: [theEvent locationInWindow]];
- startPoint.x -= offset.width;
- startPoint.y -= offset.height;
- NSDebugLLog(@"NSDragging", @"Drag window origin %d %d\n", startPoint.x, startPoint.y);
-
- // Notify the source that dragging has started
- if ([dragSource respondsToSelector:
- @selector(draggedImage:beganAt:)])
- {
- [dragSource draggedImage: [self draggedImage]
- beganAt: startPoint];
- }
+ NSEventType eventType = [theEvent type];
+
+ //NSDate *theDistantFuture = [NSDate distantFuture];
+ //unsigned int eventMask = NSLeftMouseDownMask | NSLeftMouseUpMask
+ // | NSLeftMouseDraggedMask | NSMouseMovedMask
+ // | NSPeriodicMask | NSAppKitDefinedMask | NSFlagsChangedMask
+ // | NSTouchedMask | NSRightMouseDownMask | NSRightMouseUpMask | NSRightMouseDraggedMask; //<p>FIXME</p> right mouse down/up/dragged
+ // added temporarily for testing purpose only
+ if (eventType == NSLeftMouseDown)
+ {
+ // Caching some often used values. These values do not
+ // change in this method.
+ // Use eWindow for coordination transformation
+ NSWindow *eWindow = [theEvent window];
+ NSPoint startPoint;
+ // Storing values, to restore after we have finished.
+ _cursorBeforeDrag = [NSCursor currentCursor]; //instance var
+ _slidePoint = slidePoint;
+
+ //BOOL gotMultiTouch = NO;
+
+ startPoint = [eWindow convertBaseToScreen: [theEvent locationInWindow]];
+ startPoint.x -= offset.width;
+ startPoint.y -= offset.height;
+ NSDebugLLog(@"NSDragging", @"Drag window origin %d %d\n", startPoint.x, startPoint.y);
+
+ // Notify the source that dragging has started
+ if ([dragSource respondsToSelector:
+ @selector(draggedImage:beganAt:)])
+ {
+ [dragSource draggedImage: [self draggedImage]
+ beganAt: startPoint];
+ }
+
+ // --- Setup up the masks for the drag operation ---------------------
+ if ([dragSource respondsToSelector:
+ @selector(ignoreModifierKeysWhileDragging)]
+ && [dragSource ignoreModifierKeysWhileDragging])
+ {
+ operationMask = NSDragOperationIgnoresModifiers;
+ }
+ else
+ {
+ operationMask = 0;
+ [self _updateOperationMask: theEvent];
+ }
+
+ dragMask = [dragSource draggingSourceOperationMaskForLocal: !destExternal];
+
+ // --- Setup the event loop ------------------------------------------
+ [self _updateAndMoveImageToCorrectPosition];
+ //[NSEvent startPeriodicEventsAfterDelay: 0.02 withPeriod: 0.03];
+ [NSEvent startPeriodicEventsAfterDelay: 0.02
+ withPeriod: 0.03
+ event: theEvent];
+ }
- // --- Setup up the masks for the drag operation ---------------------
- if ([dragSource respondsToSelector:
- @selector(ignoreModifierKeysWhileDragging)]
- && [dragSource ignoreModifierKeysWhileDragging])
- {
- operationMask = NSDragOperationIgnoresModifiers;
- }
- else
- {
- operationMask = 0;
- [self _updateOperationMask: theEvent];
- }
- dragMask = [dragSource draggingSourceOperationMaskForLocal: !destExternal];
-
- // --- Setup the event loop ------------------------------------------
- [self _updateAndMoveImageToCorrectPosition];
- [NSEvent startPeriodicEventsAfterDelay: 0.02 withPeriod: 0.03];
// --- Loop that handles all events during drag operation -----------
- while ([theEvent type] != NSLeftMouseUp)
- {
+ //while ([theEvent type] != NSLeftMouseUp)
+ // {
[self _handleEventDuringDragging: theEvent];
-
- theEvent = [NSApp nextEventMatchingMask: eventMask
- untilDate: theDistantFuture
- inMode: NSEventTrackingRunLoopMode
- dequeue: YES];
- }
-
- // --- Event loop for drag operation stopped ------------------------
- [NSEvent stopPeriodicEvents];
- [self _updateAndMoveImageToCorrectPosition];
-
- NSDebugLLog(@"NSDragging", @"dnd ending %d\n", targetWindowRef);
-
- // --- Deposit the drop ----------------------------------------------
- if ((targetWindowRef != 0)
- && ((targetMask & dragMask & operationMask) != NSDragOperationNone))
- {
- /* FIXME:
- * We remove the dragged image from the screen before
- * sending the dnd drop event to the destination.
- * This code should actually be rewritten, because
- * the depositing of the drop consist of three steps
- * - prepareForDragOperation
- * - performDragOperation
- * - concludeDragOperation.
- * The dragged image should be removed from the screen
- * between the prepare and the perform operation.
- * The three steps are now executed in the NSWindow class
- * and the NSWindow class does not have access to
- * the image.
- */
- [self _clearupWindow];
- [cursorBeforeDrag set];
- NSDebugLLog(@"NSDragging", @"sending dnd drop\n");
- if (!destExternal)
- {
- [self _sendLocalEvent: GSAppKitDraggingDrop
- action: 0
- position: NSZeroPoint
- timestamp: [theEvent timestamp]
- toWindow: destWindow];
- }
- else
- {
- [self sendExternalEvent: GSAppKitDraggingDrop
- action: 0
- position: NSZeroPoint
- timestamp: [theEvent timestamp]
- toWindow: targetWindowRef];
- }
- deposited = YES;
- }
- else
- {
- if (slideBack)
+
+ //printf("GSDragView loop.. event type = %i\n", [theEvent type]);
+ //theEvent = [NSApp nextEventMatchingMask: eventMask
+ // untilDate: theDistantFuture
+ // inMode: NSEventTrackingRunLoopMode
+ // dequeue: YES];
+
+ /***
+ while ([theEvent type] == NSTouched) {
+ // We trapped a touch event, re-deliver it
+ [NSApp sendEvent: theEvent];
+ if ([theEvent touchCount] > 1) { // We have a multi-touch event, cancel tracking
+ gotMultiTouch = YES;
+ slideBack = YES; // Since we're cancelling the drag, image should slide back
+ newPosition = startPoint; // Need to reset newPosition b/c it's been changed by _handleEventDuringDragging
+ printf("GSDragView loop ending... \n");
+ break;
+ }
+ theEvent = [NSApp nextEventMatchingMask: eventMask
+ untilDate: theDistantFuture
+ inMode: NSEventTrackingRunLoopMode
+ dequeue: YES];
+ }
+ if (gotMultiTouch)
+ break;
+ ***/
+
+ // }
+
+ //eventType = [theEvent type];
+ if (eventType == NSLeftMouseUp)
+ {
+ BOOL deposited;
+
+ // --- Event loop for drag operation stopped ------------------------
+ //[NSEvent stopPeriodicEvents];
+ [NSEvent stopPeriodicEventsWithTrigger: theEvent];
+ [self _updateAndMoveImageToCorrectPosition];
+
+ NSDebugLLog(@"NSDragging", @"dnd ending %d\n", targetWindowRef);
+
+ // --- Deposit the drop ----------------------------------------------
+ //if (!gotMultiTouch && ((targetWindowRef != 0)
+ // && ((targetMask & dragMask & operationMask) != NSDragOperationNone)))
+ if ((targetWindowRef != 0)
+ && ((targetMask & dragMask & operationMask) != NSDragOperationNone))
+ {
+ printf("deposit the drop\n");
+ /* FIXME:
+ * We remove the dragged image from the screen before
+ * sending the dnd drop event to the destination.
+ * This code should actually be rewritten, because
+ * the depositing of the drop consist of three steps
+ * - prepareForDragOperation
+ * - performDragOperation
+ * - concludeDragOperation.
+ * The dragged image should be removed from the screen
+ * between the prepare and the perform operation.
+ * The three steps are now executed in the NSWindow class
+ * and the NSWindow class does not have access to
+ * the image.
+ */
+ [self _clearupWindow];
+ [_cursorBeforeDrag set];
+ NSDebugLLog(@"NSDragging", @"sending dnd drop\n");
+ if (!destExternal)
+ {
+ [self _sendLocalEvent: GSAppKitDraggingDrop
+ action: 0
+ position: NSZeroPoint
+ timestamp: [theEvent timestamp]
+ toWindow: destWindow];
+ }
+ else
+ {
+ [self sendExternalEvent: GSAppKitDraggingDrop
+ action: 0
+ position: NSZeroPoint
+ timestamp: [theEvent timestamp]
+ toWindow: targetWindowRef];
+ }
+ deposited = YES;
+ }
+ else
+ {
+ printf("not deposited\n");
+ if (slideBack)
+ {
+ printf("slideBack is YES\n");
+
+ // Release last event before assigning a new one
+ // This event is used for generating periodic events when sliding image
+ if (_eventCausingSlide != nil) {
+ RELEASE(_eventCausingSlide);
+ }
+ _eventCausingSlide = RETAIN(theEvent);
+
+ [self slideDraggedImageTo: _slidePoint];
+ }
+ [self _clearupWindow];
+ [_cursorBeforeDrag set];
+ deposited = NO;
+ }
+
+ if ([dragSource respondsToSelector:
+ @selector(draggedImage:endedAt:operation:)])
{
- [self slideDraggedImageTo: slidePoint];
- }
- [self _clearupWindow];
- [cursorBeforeDrag set];
- deposited = NO;
- }
-
- if ([dragSource respondsToSelector:
- @selector(draggedImage:endedAt:operation:)])
- {
- NSPoint point;
+ printf("dragSource respondes to... #1\n");
+ NSPoint point;
- point = [theEvent locationInWindow];
- // Convert from mouse cursor coordinate to image coordinate
- point.x -= offset.width;
- point.y -= offset.height;
- point = [[theEvent window] convertBaseToScreen: point];
- [dragSource draggedImage: [self draggedImage]
- endedAt: point
- operation: targetMask & dragMask & operationMask];
- }
- else if ([dragSource respondsToSelector:
- @selector(draggedImage:endedAt:deposited:)])
- {
- NSPoint point;
+ point = [theEvent locationInWindow];
+ // Convert from mouse cursor coordinate to image coordinate
+ point.x -= offset.width;
+ point.y -= offset.height;
+ point = [[theEvent window] convertBaseToScreen: point];
+ [dragSource draggedImage: [self draggedImage]
+ endedAt: point
+ operation: targetMask & dragMask & operationMask];
+ }
+ else if ([dragSource respondsToSelector:
+ @selector(draggedImage:endedAt:deposited:)])
+ {
+ printf("dragSource respondes to... #2\n");
+ NSPoint point;
- point = [theEvent locationInWindow];
- // Convert from mouse cursor coordinate to image coordinate
- point.x -= offset.width;
- point.y -= offset.height;
- point = [[theEvent window] convertBaseToScreen: point];
- [dragSource draggedImage: [self draggedImage]
- endedAt: point
- deposited: deposited];
- }
+ point = [theEvent locationInWindow];
+ // Convert from mouse cursor coordinate to image coordinate
+ point.x -= offset.width;
+ point.y -= offset.height;
+ point = [[theEvent window] convertBaseToScreen: point];
+ [dragSource draggedImage: [self draggedImage]
+ endedAt: point
+ deposited: deposited];
+ }
+ }
}
/*
@@ -749,8 +822,11 @@ - (void) _handleDrag: (NSEvent*)theEvent slidePoint: (NSPoint)slidePoint
*/
- (void) _handleEventDuringDragging: (NSEvent *)theEvent
{
+ //printf("_handleEventDuringDragging, event type = %i\n", [theEvent type]);
switch ([theEvent type])
{
+ // NSAppKitDefined events will never get here since we're
+ // no longer hijacking events in a loop. Remove case?
case NSAppKitDefined:
{
GSAppKitSubtype sub = [theEvent subtype];
@@ -766,7 +842,10 @@ - (void) _handleEventDuringDragging: (NSEvent *)theEvent
[NSApp sendEvent: theEvent];
break;
+ // FIXME Now GSAppKitDraggingStatus events will not get here because
+ // they get dropped by NSWindow. How can we get them to the view?
case GSAppKitDraggingStatus:
+ //printf("GSDragView got GSAppKitDraggingStatus event!\n");
NSDebugLLog(@"NSDragging", @"got GSAppKitDraggingStatus\n");
if ((int)[theEvent data1] == targetWindowRef)
{
@@ -805,6 +884,7 @@ - (void) _handleEventDuringDragging: (NSEvent *)theEvent
[theEvent locationInWindow]];
break;
case NSFlagsChanged:
+ printf("GSDragView got NSFlagsChanged event!\n");
if ([self _updateOperationMask: theEvent])
{
// If flags change, send update to allow
@@ -830,6 +910,7 @@ - (void) _handleEventDuringDragging: (NSEvent *)theEvent
break;
case NSPeriodic:
newPosition = [NSEvent mouseLocation];
+ //printf("newPosition.x = %f, dragPosition.x = %f\n", newPosition.x, dragPosition.x);
if (newPosition.x != dragPosition.x || newPosition.y != dragPosition.y)
{
[self _updateAndMoveImageToCorrectPosition];
@@ -871,6 +952,9 @@ - (void) _updateAndMoveImageToCorrectPosition
[self _moveDraggedImageToNewPosition];
//--- Determine target window ---------------------------------------------
+ // Actually calls gnustep-back-0.17.1/Source/x11/xGDragView.m:305
+ // which sets mouseWindowRef to zero if we don't pass in a pasteboard
+ // to dragImage
destWindow = [self windowAcceptingDnDunder: dragPosition
windowRef: &mouseWindowRef];
@@ -971,6 +1055,7 @@ - (void) _updateAndMoveImageToCorrectPosition
}
}
+ //printf("targetWindowRef = %i, mouseWindowRef = %i\n", targetWindowRef, mouseWindowRef);
if (targetWindowRef != mouseWindowRef)
{
targetWindowRef = mouseWindowRef;
@@ -1001,14 +1086,26 @@ - (void) _moveDraggedImageToNewPosition
/*
* NB. screenPoint here is the position of the mouse cursor.
*/
+// 5/21/2010
+// We're not supposed to hijack events from the event queue, but since the
+// sliding operation completes rather quickly (loop won't last for long),
+// and to avoid major rework for all the function calls along the event
+// delivery path, we will keep the loop for now and see how it works out
- (void) _slideDraggedImageTo: (NSPoint)screenPoint
numberOfSteps: (int)steps
delay: (float)delay
waitAfterSlide: (BOOL)waitFlag
{
+ NSView *parentView = nil;
+
+ if (_eventCausingSlide != nil)
+ parentView = [_eventCausingSlide view];
+
/* If we do not need multiple redrawing, just move the image immediately
* to its desired spot.
*/
+ //printf("steps = %i\n", steps);
+ //steps = 5;
if (steps < 2)
{
newPosition = screenPoint;
@@ -1016,17 +1113,30 @@ - (void) _slideDraggedImageTo: (NSPoint)screenPoint
}
else
{
- [NSEvent startPeriodicEventsAfterDelay: delay withPeriod: delay];
+ if (_eventCausingSlide != nil)
+ [NSEvent startPeriodicEventsAfterDelay: delay withPeriod: delay event: _eventCausingSlide];
+ else
+ [NSEvent startPeriodicEventsAfterDelay: delay withPeriod: delay];
// Use the event loop to redraw the image repeatedly.
// Using the event loop to allow the application to process
// expose events.
while (steps)
{
- NSEvent *theEvent = [NSApp nextEventMatchingMask: NSPeriodicMask
- untilDate: [NSDate distantFuture]
- inMode: NSEventTrackingRunLoopMode
- dequeue: YES];
+ NSEvent *theEvent;
+
+ // modified version of startPeriodicEvents uses default runloop mode
+ if (_eventCausingSlide != nil)
+ theEvent = [NSApp nextEventMatchingMask: NSPeriodicMask
+ untilDate: [NSDate distantFuture]
+ //inMode: NSEventTrackingRunLoopMode
+ inMode: NSDefaultRunLoopMode
+ dequeue: YES];
+ else
+ theEvent = [NSApp nextEventMatchingMask: NSPeriodicMask
+ untilDate: [NSDate distantFuture]
+ inMode: NSEventTrackingRunLoopMode
+ dequeue: YES];
if ([theEvent type] != NSPeriodic)
{
@@ -1034,6 +1144,14 @@ - (void) _slideDraggedImageTo: (NSPoint)screenPoint
@"Unexpected event type: %d during slide",
[theEvent type]);
}
+
+ // Re-send events which are apparently not ours
+ if ([theEvent view] != nil && parentView != nil && [theEvent view] != parentView)
+ {
+ [NSApp sendEvent: theEvent];
+ continue;
+ }
+
newPosition.x = (screenPoint.x + ((float) steps - 1.0)
* dragPosition.x) / ((float) steps);
newPosition.y = (screenPoint.y + ((float) steps - 1.0)
@@ -1042,9 +1160,18 @@ - (void) _slideDraggedImageTo: (NSPoint)screenPoint
[self _moveDraggedImageToNewPosition];
steps--;
}
- [NSEvent stopPeriodicEvents];
+
+ if (_eventCausingSlide != nil)
+ [NSEvent stopPeriodicEventsWithTrigger: _eventCausingSlide];
+ else
+ [NSEvent stopPeriodicEvents];
}
+ if (_eventCausingSlide != nil) {
+ RELEASE(_eventCausingSlide);
+ _eventCausingSlide = nil;
+ }
+
if (waitFlag)
{
[NSThread sleepUntilDate:
View
43 Source/GSTitleView.m
@@ -52,6 +52,24 @@ + (float) height
return [NSMenuView menuBarHeight] + 1;
}
+//
+// Handling touch events... for testing purpose
+//
+- (void) touchesBeganWithEvent: (NSEvent *) theEvent
+{
+ printf("GSTitleView: touchesBeganWithEvent, touch count = %i\n", [theEvent touchCount]);
+}
+
+- (void) touchesMovedWithEvent: (NSEvent *) theEvent
+{