Emulate browser-style scroll-on-spacebar.
This commit is contained in:
parent
6009916e0b
commit
1c6745256e
2 changed files with 25 additions and 0 deletions
|
|
@ -705,6 +705,13 @@ public class ConversationViewer : Gtk.Stack {
|
|||
return true;
|
||||
});
|
||||
|
||||
// Capture key events on the email's web views to allow
|
||||
// scrolling on Space, etc.
|
||||
conversation_message.web_view.key_press_event.connect(on_conversation_key_press);
|
||||
foreach (ConversationMessage attached in conversation_email.attached_messages) {
|
||||
attached.web_view.key_press_event.connect(on_conversation_key_press);
|
||||
}
|
||||
|
||||
Gtk.ListBoxRow row = new Gtk.ListBoxRow();
|
||||
row.show();
|
||||
row.add(conversation_email);
|
||||
|
|
@ -846,6 +853,22 @@ public class ConversationViewer : Gtk.Stack {
|
|||
return SearchState.SEARCH_FOLDER;
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
private bool on_conversation_key_press(Gtk.Widget widget, Gdk.EventKey event) {
|
||||
// Override some key bindings to get something that works more
|
||||
// like a browser page.
|
||||
if (event.keyval == Gdk.Key.space) {
|
||||
Gtk.ScrollType dir = Gtk.ScrollType.PAGE_DOWN;
|
||||
if ((event.state & Gdk.ModifierType.SHIFT_MASK) ==
|
||||
Gdk.ModifierType.SHIFT_MASK) {
|
||||
dir = Gtk.ScrollType.PAGE_UP;
|
||||
}
|
||||
conversation_page.scroll_child(dir, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ConversationEmail? conversation_email_for_id(Geary.EmailIdentifier id) {
|
||||
return (ConversationEmail) email_to_row.get(id).get_child();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,10 @@
|
|||
<object class="GtkScrolledWindow" id="conversation_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_KEY_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<signal name="key-press-event" handler="on_conversation_key_press" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue