summaryrefslogtreecommitdiff
path: root/cocoa
diff options
context:
space:
mode:
authorSven Weidauer <sven.weidauer@gmail.com>2011-02-27 20:41:17 +0000
committerSven Weidauer <sven.weidauer@gmail.com>2011-02-27 20:41:17 +0000
commit6d118815756c1433b6ef815300c2950379d02de7 (patch)
tree19737032824b5be77ab2bb12ba61392821fff998 /cocoa
parent86a2e0076d0789247a28f370d16583ee4fc87f05 (diff)
downloadnetsurf-6d118815756c1433b6ef815300c2950379d02de7.tar.gz
netsurf-6d118815756c1433b6ef815300c2950379d02de7.tar.bz2
Handling keyboard events for local history view.
svn path=/trunk/netsurf/; revision=11851
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/BrowserView.m6
-rw-r--r--cocoa/LocalHistoryController.h2
-rw-r--r--cocoa/LocalHistoryController.m15
3 files changed, 22 insertions, 1 deletions
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m
index 241add229..5676086e6 100644
--- a/cocoa/BrowserView.m
+++ b/cocoa/BrowserView.m
@@ -274,7 +274,11 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
- (void) keyDown: (NSEvent *)theEvent;
{
- [self interpretKeyEvents: [NSArray arrayWithObject: theEvent]];
+ if (!historyVisible) {
+ [self interpretKeyEvents: [NSArray arrayWithObject: theEvent]];
+ } else {
+ [history keyDown: theEvent];
+ }
}
- (void) insertText: (id)string;
diff --git a/cocoa/LocalHistoryController.h b/cocoa/LocalHistoryController.h
index 14a9abcdb..8b8018c88 100644
--- a/cocoa/LocalHistoryController.h
+++ b/cocoa/LocalHistoryController.h
@@ -35,4 +35,6 @@
- (void) detach;
- (void) redraw;
+- (void) keyDown: (NSEvent *)theEvent;
+
@end
diff --git a/cocoa/LocalHistoryController.m b/cocoa/LocalHistoryController.m
index 322e44d55..b3992b614 100644
--- a/cocoa/LocalHistoryController.m
+++ b/cocoa/LocalHistoryController.m
@@ -18,6 +18,7 @@
#import "cocoa/LocalHistoryController.h"
+#import "cocoa/BrowserView.h"
#import "cocoa/HistoryView.h"
#import "cocoa/ArrowWindow.h"
@@ -101,4 +102,18 @@
[history setNeedsDisplay: YES];
}
+- (void) keyDown: (NSEvent *)theEvent;
+{
+ unichar key = [[theEvent characters] characterAtIndex: 0];
+ switch (key) {
+ case 27:
+ [browser setHistoryVisible: NO];
+ break;
+
+ default:
+ NSBeep();
+ break;
+ };
+}
+
@end