[polari] chatView: Also load history when scrolling via keyboard
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] chatView: Also load history when scrolling via keyboard
- Date: Mon, 21 Dec 2015 15:46:22 +0000 (UTC)
commit 452017147ddb35d37e5368b461005eee75cb6462
Author: Isabella Ribeiro <belinhacbr gmail com>
Date: Mon Dec 21 16:37:13 2015 +0100
chatView: Also load history when scrolling via keyboard
When available, we fetch more messages from the history when scrolling past
the top of the view. However as we currently only consider scroll events,
this will only work when scrolling with a pointer device; add appropriate
key event handling to make the functionality also available via keyboard.
https://bugzilla.gnome.org/show_bug.cgi?id=755547
src/chatView.js | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 9412111..e7e52d8 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -312,6 +312,7 @@ const ChatView = new Lang.Class({
Lang.bind(this, this._onValueChanged));
this.widget.vadjustment.connect('changed',
Lang.bind(this, this._updateScroll));
+ this._view.connect('key-press-event', Lang.bind(this, this._onKeyPress));
this._view.connect('button-release-event',
Lang.bind(this, this._handleLinkClicks));
this._view.connect('button-press-event',
@@ -451,6 +452,21 @@ const ChatView = new Lang.Class({
if (hasDeltas && dy >= 0)
return Gdk.EVENT_PROPAGATE;
+ return this._fetchBacklog();
+ },
+
+ _onKeyPress: function(w, event) {
+ let [, keyval] = event.get_keyval();
+ if (keyval != Gdk.KEY_Up &&
+ keyval != Gdk.KEY_KP_Up &&
+ keyval != Gdk.KEY_Page_Up &&
+ keyval != Gdk.KEY_KP_Page_Up)
+ return Gdk.EVENT_PROPAGATE;
+
+ return this._fetchBacklog();
+ },
+
+ _fetchBacklog: function() {
if (this.widget.vadjustment.value != 0 ||
this._logWalker.is_end())
return Gdk.EVENT_PROPAGATE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]