landfound / welly

Automatically exported from code.google.com/p/welly
GNU General Public License v2.0
0 stars 0 forks source link

Swipe gesture support #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Index: WLMouseBehaviorManager.m
===================================================================
--- WLMouseBehaviorManager.m    (revision 832)
+++ WLMouseBehaviorManager.m    (working copy)
@@ -175,7 +175,24 @@

        return nil;
 }
-
+- (void)swipeWithEvent:(NSEvent *)event {
+    CGFloat x = [event deltaX];
+    CGFloat y = [event deltaY];
+    BOOL directionHori = fabs(x)>fabs(y);
+    if (directionHori) {
+        if (x > 0) {
+            [_view sendText:termKeyLeft];
+        } else {
+            [_view sendText:termKeyRight];
+        }
+    } else {
+        if (y > 0) {
+            [_view sendText:termKeyPageUp];
+        } else {
+            [_view sendText:termKeyPageDown];
+        }
+    }
+}
 #pragma mark -
 #pragma mark Add/Remove Tracking Area
 - (BOOL)isMouseInsideRect:(NSRect)rect {
Index: WLTerminalView.m
===================================================================
--- WLTerminalView.m    (revision 832)
+++ WLTerminalView.m    (working copy)
@@ -492,6 +492,11 @@

 #pragma mark -
 #pragma mark Event Handling
+- (void)swipeWithEvent:(NSEvent *)event {
+    [self hasMouseActivity];
+    [self clearSelection];
+    [_mouseBehaviorDelegate swipeWithEvent:event];
+}
 - (void)selectWordAtPoint:(NSPoint)point {
        NSRange range = [self rangeForWordAtPoint:point];
        _selectionLocation = range.location;
@@ -896,7 +901,7 @@
     } else if (aSelector == @selector(insertTabIgnoringFieldEditor:)) { // Now
do URL mode switching
                [self switchURL];
        } else {
-        NSLog(@"Unprocessed selector: %s", aSelector);
+        NSLog(@"Unprocessed selector: %@", NSStringFromSelector(aSelector));
     }
 }

Original issue reported on code.google.com by zhangchnxp on 10 Nov 2011 at 8:14