[passepartout] abort fullscreen mode on escape
- From: Sven Herzberg <herzi src gnome org>
- To: svn-commits-list gnome org
- Subject: [passepartout] abort fullscreen mode on escape
- Date: Mon, 13 Apr 2009 09:17:30 -0400 (EDT)
commit 9569fd43be20c9fc922dc2dea2afb8819097dda8
Author: Sven Herzberg <herzi lanedo com>
Date: Sun Apr 12 21:46:48 2009 +0200
abort fullscreen mode on escape
* src/pptout/window.cc,
* src/pptout/window.h: close the fullscreen mode when Escape is pressed (but
not if it was used for cancelling an operation); this is to comply with the
GNOME HIG 2.0 (Introduction of the Menus chapter)
---
src/pptout/window.cc | 22 ++++++++++++++++++----
src/pptout/window.h | 1 +
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/pptout/window.cc b/src/pptout/window.cc
index 9bf2038..4be07bc 100644
--- a/src/pptout/window.cc
+++ b/src/pptout/window.cc
@@ -54,11 +54,25 @@ FrameWindow::FrameWindow(const Glib::ustring &filename, DocRef document)
constructor_common();
}
-void FrameWindow::constructor_common() {
- // key presses are forwarded to the view
- signal_key_press_event().connect
- (sigc::mem_fun(document_view, &DocumentView::on_key_press_event));
+bool FrameWindow::on_key_press_event (GdkEventKey* event)
+{
+ // key presses are forwarded to the view first
+ if (document_view.on_key_press_event (event))
+ {
+ return true;
+ }
+
+ if (event->keyval == GDK_Escape &&
+ (get_window()->get_state() & Gdk::WINDOW_STATE_FULLSCREEN) != 0)
+ {
+ unfullscreen ();
+ return true;
+ }
+
+ return Gtk::Window::on_key_press_event (event);
+}
+void FrameWindow::constructor_common() {
open_dialog.reset(new Filesel(*this, _("Open")));
save_dialog.reset(new Filesel(*this, _("Save As"),
Gtk::FILE_CHOOSER_ACTION_SAVE));
diff --git a/src/pptout/window.h b/src/pptout/window.h
index b53bafe..38ee541 100644
--- a/src/pptout/window.h
+++ b/src/pptout/window.h
@@ -49,6 +49,7 @@ private:
bool on_delete_event(GdkEventAny*);
bool on_focus_in_event(GdkEventFocus*);
+ bool on_key_press_event(GdkEventKey*);
void constructor_common();
void set_filename(const Glib::ustring&);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]