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




commit a8219211be0ccadcaced39c7e574b5fe544142ef
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 47d2acc3a9..e58a60e3f3 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -673,6 +673,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));
@@ -683,6 +684,10 @@ var EmojiPager = GObject.registerClass({
         this.add_action_full('pan', Clutter.EventPhase.CAPTURE, panAction);
     }
 
+    get curSection() {
+        return this._curSection;
+    }
+
     get delta() {
         return this._delta;
     }
@@ -918,6 +923,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) {
@@ -990,10 +996,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]