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.
This commit is contained in:
Mark Liversedge
2011-11-01 15:48:13 +00:00
parent a09e2d1348
commit 8e92efbaf7

View File

@@ -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<QKeyEvent *>(event)->key() == Qt::Key_Escape ||
(static_cast<QKeyEvent *>(event)->key() == Qt::Key_F &&
static_cast<QKeyEvent *>(event)->modifiers() == (Qt::MetaModifier|Qt::ControlModifier)))) {
static_cast<QKeyEvent *>(event)->key() == Qt::Key_F &&
static_cast<QKeyEvent *>(event)->modifiers() == (Qt::MetaModifier|Qt::ControlModifier)) {
toggle();
return false;
}
// ESC cancels fullscreen
if (event->type() == QEvent::KeyPress && static_cast<QKeyEvent *>(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