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




commit edd0bf4037ff576d906e415ef75c88ed9b2fad4e
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 416a013351..5f6a5513ea 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -678,6 +678,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));
@@ -688,6 +689,10 @@ var EmojiPager = GObject.registerClass({
         this.add_action_full('pan', Clutter.EventPhase.CAPTURE, panAction);
     }
 
+    get curSection() {
+        return this._curSection;
+    }
+
     get delta() {
         return this._delta;
     }
@@ -923,6 +928,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) {
@@ -995,10 +1001,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]