[gnome-shell/wip/carlosg/osk-updates: 4/8] keyboard: Make page indicators in emoji selection reactive




commit d340169c493a50363b43ec2f3cf8a131fc5e2d2e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 28 22:08:05 2022 +0200

    keyboard: Make page indicators in emoji selection reactive
    
    This has been a nuisance to mouse users, make the page indicators
    reactive so it is possible to change page that way.

 js/ui/keyboard.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 86a67bebd0..952aef14bd 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -679,6 +679,7 @@ var EmojiPager = GObject.registerClass({
         this._currentKey = null;
         this._delta = 0;
         this._width = null;
+        this._curSection = 0;
 
         let panAction = new Clutter.PanAction({ interpolate: false });
         panAction.connect('pan', this._onPan.bind(this));
@@ -689,6 +690,10 @@ var EmojiPager = GObject.registerClass({
         this.add_action_full('pan', Clutter.EventPhase.CAPTURE, panAction);
     }
 
+    get curSection() {
+        return this._curSection;
+    }
+
     get delta() {
         return this._delta;
     }
@@ -924,6 +929,7 @@ var EmojiPager = GObject.registerClass({
 
         let page = this._pages[nPage];
         this.emit('page-changed', page.section.label, page.page, page.nPages);
+        this._curSection = page.section;
     }
 
     setCurrentSection(section, nPage) {
@@ -996,10 +1002,12 @@ var EmojiSelection = GObject.registerClass({
 
         this._pageIndicator = new PageIndicators.PageIndicators(
             Clutter.Orientation.HORIZONTAL);
+        this._pageIndicator.connect('page-activated', (_pageIndicator, pageIndex) => {
+            this._emojiPager.setCurrentSection(this._emojiPager.curSection, pageIndex);
+        });
         this._pageIndicator.y_expand = false;
         this._pageIndicator.y_align = Clutter.ActorAlign.START;
         this._pagerBox.add_child(this._pageIndicator);
-        this._pageIndicator.setReactive(false);
 
         this._emojiPager.connect('notify::delta', () => {
             this._updateIndicatorPosition();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]