diff options
author | Adam Patterson <adam@adamrt.com> | 2022-03-31 17:34:45 -0500 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-04-02 11:07:29 -0700 |
commit | 2ecc608dea3dbe201bb85c89edeeaefd59826188 (patch) | |
tree | 3605882b46e5cfa86c769b94de3846d71b78170b | |
parent | 659a7a5da711ef46edef17e2f0152d2b114d3bc8 (diff) | |
download | serenity-2ecc608dea3dbe201bb85c89edeeaefd59826188.zip |
3DFileViewer: Allow escape key to exit fullscreen mode
I went into fullscreen mode, via the View menu, before looking at the
associated key (F11). I had to kill Qemu to be able to escape.
Escape is an intuitive way to exit most fullscreen modes.
-rw-r--r-- | Userland/Applications/3DFileViewer/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index e434be23b5..c1c61fec1a 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -97,6 +97,7 @@ private: virtual void timer_event(Core::TimerEvent&) override; virtual void mousemove_event(GUI::MouseEvent&) override; virtual void mousewheel_event(GUI::MouseEvent&) override; + virtual void keydown_event(GUI::KeyEvent&) override; private: RefPtr<Mesh> m_mesh; @@ -183,6 +184,14 @@ void GLContextWidget::mousewheel_event(GUI::MouseEvent& event) m_zoom *= 1.1f; } +void GLContextWidget::keydown_event(GUI::KeyEvent& event) +{ + if (event.key() == Key_Escape && window()->is_fullscreen()) { + window()->set_fullscreen(false); + return; + } +} + void GLContextWidget::timer_event(Core::TimerEvent&) { auto timer = Core::ElapsedTimer::start_new(); |