From 8e92efbaf74c76f2b5a4f3f52c9258acba045fd2 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 1 Nov 2011 15:48:13 +0000 Subject: [PATCH] Ctrl-Cmd-F *toggles* fullscreen Previous commit only cancelled fullscreen mode when Ctrl-Cmd-F is pressed, but the common usage is for the key sequence to toggle fullscreen on and off. --- src/LionFullScreen.mm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/LionFullScreen.mm b/src/LionFullScreen.mm index 695a81850..3285cba9d 100644 --- a/src/LionFullScreen.mm +++ b/src/LionFullScreen.mm @@ -36,16 +36,24 @@ LionFullScreen::eventFilter(QObject *obj, QEvent *event) { if (obj != main) return false; + // Ctrl-Cmd-F toggles if (event->type() == QEvent::KeyPress && - (static_cast(event)->key() == Qt::Key_Escape || - (static_cast(event)->key() == Qt::Key_F && - static_cast(event)->modifiers() == (Qt::MetaModifier|Qt::ControlModifier)))) { + static_cast(event)->key() == Qt::Key_F && + static_cast(event)->modifiers() == (Qt::MetaModifier|Qt::ControlModifier)) { + toggle(); + return false; + + } + + // ESC cancels fullscreen + if (event->type() == QEvent::KeyPress && static_cast(event)->key() == Qt::Key_Escape) { // if in full screen then toggle, otherwise do nothing NSView *nsview = (NSView *) main->winId(); NSWindow *nswindow = [nsview window]; NSUInteger masks = [nswindow styleMask]; if (masks & NSFullScreenWindowMask) toggle(); + return false; } return false; // always pass thru, just in case