[gnome-shell/wip/grab-helper-top-panel: 13/20] searchDisplay, appDisplay: Use ClutterPanAction for re-swipe scrolling
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/grab-helper-top-panel: 13/20] searchDisplay, appDisplay: Use ClutterPanAction for re-swipe scrolling
- Date: Mon, 26 Nov 2012 21:40:29 +0000 (UTC)
commit 32502af6527e9f8bcaa2aa1d6dc5d0013cac5d6e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Nov 25 23:33:44 2012 -0500
searchDisplay, appDisplay: Use ClutterPanAction for re-swipe scrolling
The sooner we can kill off the custom overview swipe scroll code, the
better.
https://bugzilla.gnome.org/show_bug.cgi?id=689062
js/ui/appDisplay.js | 20 +++++++++-----------
js/ui/searchDisplay.js | 19 ++++++++++---------
2 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 300c7e7..6ff8cb1 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -48,18 +48,16 @@ const AlphabeticalView = new Lang.Class({
style_class: 'vfade' });
this.actor.add_actor(box);
this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
- this.actor.connect('notify::mapped', Lang.bind(this,
- function() {
- if (!this.actor.mapped)
- return;
-
- let adjustment = this.actor.vscroll.adjustment;
- let direction = Overview.SwipeScrollDirection.VERTICAL;
- Main.overview.setScrollAdjustment(adjustment, direction);
+ let action = new Clutter.PanAction({ interpolate: true });
+ action.connect('pan', Lang.bind(this, this._onPan));
+ this.actor.add_action(action);
+ },
- // Reset scroll on mapping
- adjustment.value = 0;
- }));
+ _onPan: function(action) {
+ let [dist, dx, dy] = action.get_motion_delta(0);
+ let adjustment = this.actor.vscroll.adjustment;
+ adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
+ return false;
},
removeAll: function() {
diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js
index 5a914bd..7460310 100644
--- a/js/ui/searchDisplay.js
+++ b/js/ui/searchDisplay.js
@@ -194,15 +194,9 @@ const SearchResults = new Lang.Class({
expand: true,
x_align: St.Align.START,
y_align: St.Align.START });
- this.actor.connect('notify::mapped', Lang.bind(this,
- function() {
- if (!this.actor.mapped)
- return;
-
- let adjustment = scrollView.vscroll.adjustment;
- let direction = Overview.SwipeScrollDirection.VERTICAL;
- Main.overview.setScrollAdjustment(adjustment, direction);
- }));
+ let action = new Clutter.PanAction({ interpolate: true });
+ action.connect('pan', Lang.bind(this, this._onPan));
+ this.actor.add_action(action);
this._statusText = new St.Label({ style_class: 'search-statustext' });
this._statusBin = new St.Bin({ x_align: St.Align.MIDDLE,
@@ -219,6 +213,13 @@ const SearchResults = new Lang.Class({
this._defaultResult = null;
},
+ _onPan: function(action) {
+ let [dist, dx, dy] = action.get_motion_delta(0);
+ let adjustment = this.actor.vscroll.adjustment;
+ adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
+ return false;
+ },
+
createProviderMeta: function(provider) {
let providerBox = new St.BoxLayout({ style_class: 'search-section',
vertical: true });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]