Camino only - Bug 426739: Add (undocumented) trackpad swipe support. r/sr=pink

This commit is contained in:
stuart.morgan%alumni.case.edu 2008-04-03 19:51:13 +00:00
Родитель 8f41294fad
Коммит 7fce915cec
3 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -684,6 +684,23 @@ public:
mMoveReentrant = NO;
}
// Undocumented method for handling multi-touch swipe events in 10.5.
// The worst that's likely to happen is that this would just stop being
// called if the gesture system changes in a future version.
- (void)swipeWithEvent:(NSEvent*)event
{
// Map forward and back to history; left is positive, right is negative (!)
if ([event deltaX] > 0.5)
[self back:nil];
else if ([event deltaX] < -0.5)
[self forward:nil];
// Map up and down to page up/down
else if ([event deltaY] > 0.5)
[[mBrowserView browserView] pageUp];
else if ([event deltaY] < -0.5)
[[mBrowserView browserView] pageDown];
}
-(void)autosaveWindowFrame
{
if (mShouldAutosave) {

Просмотреть файл

@ -255,6 +255,9 @@ typedef enum {
- (BOOL)canMakeTextSmaller;
- (BOOL)isTextDefaultSize;
- (void)pageUp;
- (void)pageDown;
// Verifies that the browser view can be unloaded (e.g., validates
// onbeforeunload handlers). Should be called before any action that would
// destroy the browser view.

Просмотреть файл

@ -1274,6 +1274,16 @@ const char kDirServiceContractID[] = "@mozilla.org/file/directory_service;1";
return (fabsf([self textZoom] - DEFAULT_TEXT_ZOOM) < .001);
}
- (void)pageUp
{
[self doCommand:"cmd_scrollPageUp"];
}
- (void)pageDown
{
[self doCommand:"cmd_scrollPageDown"];
}
- (BOOL)shouldUnload
{
nsCOMPtr<nsIContentViewer> contentViewer = dont_AddRef([self contentViewer]);