Implement GTK Emoji Chooser
Categories
(Core :: Widget: Gtk, enhancement, P3)
Tracking
()
People
(Reporter: calestyo, Assigned: stransky)
References
(Blocks 1 open bug)
Details
(Keywords: helpwanted, webcompat:platform-bug)
User Story
user-impact-score:60
Attachments
(3 external files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Steps to reproduce:
GTK supports a native Emoji Chooser, which should already work with GTK 3 used by Firefox (on Linux) and is activated by pressing Ctrl-. or Ctrl-; .
Expected results:
Given that Emojis are used quite often when entering text on websites, it would be nice if Firefox could enable support for that.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 2•3 years ago
|
||
I guess it would be similar to GtkFileDialog implementation:
https://searchfox.org/mozilla-central/source/widget/gtk/nsFilePicker.cpp
It's implemented by GtkEmojiChooser widget.
Comment 3•2 years ago
|
||
On Firefox Nightly, currently 129.0a1 (2024-07-02) (64-bit), pressing control+. for the GTK emoji picker renders Firefox unusable.
It doesn't crash, but everything grinds to a complete halt until killed.
| Assignee | ||
Updated•2 years ago
|
Updated•11 months ago
|
| Assignee | ||
Comment 4•9 months ago
|
||
The problem is that we create the emoji widget as a child of hidden GtkEntry and not the visible one.
| Assignee | ||
Comment 8•9 months ago
|
||
Explicit emoji popover is available in Gtk4. Unfortunately the widget is not exported in gtk3. We'd need to pass correct widget to it but I'm not sure how to handle the emoji position for the GtkWindow.
| Assignee | ||
Comment 9•9 months ago
|
||
Looked at it and there are two issues here. First the popup is popover type and after CTRL+. is invoked but struck in waiting-to-show state. Perhaps due to hidden parent GtkEntry widget. But we may take Gtk3 widget implementation and ship that as embedded widget. But we don't have exact location where the widget may be placed - we use only one nsWindow and GtkEntry is used for key binding only.
| Assignee | ||
Comment 10•9 months ago
|
||
I expected Gtk4 may help here but it can't - the main issue is popup placement which we need to solve.
| Assignee | ||
Comment 11•9 months ago
|
||
| Assignee | ||
Comment 12•9 months ago
|
||
There's a WIP which created keybinding entry as child of mozcontainer which tricks Gtk to show it as a child of nsWindow which makes it visible after CTRL+. But it doesn't insert the selected emoji to entry and also needs to be placed according to focused field.
| Assignee | ||
Comment 13•9 months ago
|
||
Emilio, do you know if we can get position of input field (if that's active?) on widget? I guess we'd need to load it from layout or so?
Thanks.
Comment 14•9 months ago
|
||
Can you add the emoji picker as a child of mShell rather than mContainer? That seems like it would work just as well and probably be simpler, right? But yeah, to your question, we have two kinds of precedent for this, I think:
- The IME popup.
- The context menu shortcut (Shift + F10).
I think this should work similarly to one of the two.
Right now the context menu key event goes through the whole event system, maybe this would be more similar to an IME feature, specially since we only care about this for composition?
Maybe Masayuki has thoughts on which approach might work better?
| Assignee | ||
Comment 15•9 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #14)
Can you add the emoji picker as a child of mShell rather than mContainer? That seems like it would work just as well and probably be simpler, right?
AFIAK mShell is GtkWindow and it implements GtkBin which allows to hold only one child.
But yeah, to your question, we have two kinds of precedent for this, I think:
- The IME popup.
Do you know how the IME popup is issued?
- The context menu shortcut (Shift + F10).
That popup looks great!
Comment 16•9 months ago
|
||
I think the picker should be around the caret. If so, you can get the position with a query content event like this:
https://searchfox.org/firefox-main/rev/133582f487ff8291ec10bd524db52db0b8ed363e/widget/gtk/IMContextWrapper.cpp#2970-3009
And you can get current caret offset in the flattened text content in the editor with:
https://searchfox.org/firefox-main/rev/133582f487ff8291ec10bd524db52db0b8ed363e/widget/gtk/IMContextWrapper.cpp#3315-3326
| Assignee | ||
Comment 17•8 months ago
|
||
Thanks, the patch here works somehow but throws various Gtk related warnings due to GtkEntry put to more containers. I think we may use general GtkEntry/TextView for binding and if the emoji chooser is issues, we may create and put dedicated widgets to focused nsWindow.
That solution ensures we don't create redundant widgets.
| Assignee | ||
Updated•8 months ago
|
Updated•8 months ago
|
| Assignee | ||
Comment 18•8 months ago
|
||
The patch above works but needs to fix one last thing - when emoji picker is selected we hide cursor. The emoji picker is considered as cursor input and we hide cursor for it. Unfortunately emoji picker doesn't have a signal when emoji is not selected - only when it's picked - so I need to find a way how to restore 'hide cursor' state when emoji is not selected.
| Assignee | ||
Comment 19•8 months ago
|
||
We may also add a pref to disable it as it may break some scenarios.
| Assignee | ||
Updated•7 months ago
|
| Assignee | ||
Comment 20•7 months ago
|
||
The patch here implements emoji for toplevel windows only. We may consider to add support for popups too if that's requested.
| Assignee | ||
Comment 21•7 months ago
|
||
| Assignee | ||
Comment 22•7 months ago
|
||
| Assignee | ||
Updated•7 months ago
|
Updated•7 months ago
|
Comment 23•7 months ago
|
||
Updated•7 months ago
|
Comment 24•7 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/1b2b2111d8b5
https://hg.mozilla.org/mozilla-central/rev/8dc6b197b435
https://hg.mozilla.org/mozilla-central/rev/53ae743699cd
Comment 26•7 months ago
|
||
:stransky, could you consider nominating this for a release note? (Process info)
| Assignee | ||
Comment 27•7 months ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Implements Gtk Emoji picker dialog, allows to insert emoji when Gtk key binding is activated (usually CRTL+.)
[Affects Firefox for Android]: none
[Suggested wording]:
[Links (documentation, blog post, etc)]:
Comment 28•7 months ago
|
||
Thanks, added to the Fx150 nightly release notes, please allow 30 minutes for the site to update.
Updated•7 months ago
|
| Reporter | ||
Comment 29•6 months ago
|
||
150 just hit Debian unstable,... while the chooser works in principle. I do see some weird graphic effects every time it appears and disappears, in particular, over the whole size of the chooser widget the background image "shines" through.
May of course be an issue in X, GTK, or Cinnamon's composer,... but at least no such thing would happen with other programs that do support the emoji chooser (like gedit).
Also it seems, that the first time on a window that I make the chooser pop up, it's not only the background that shows through but there's some "flickering" effect. But this is gone when I do it again on the same window (even if it's on another tab of that, as far as I can see).
| Assignee | ||
Comment 30•6 months ago
|
||
Yes, that's correct - and it's due to the fuzzy implementation where custom and X11 rendering is mixed. Only 'fix' is to disable it on X11 but I think it's still worth regardless of the flickering (or we can disable the pref by default on X11 and leave users to turn it on).
| Reporter | ||
Comment 31•6 months ago
|
||
Ah I see. Well please leave it, better that than nothing and X is anyway slowly on it's way out.
I'd even say don't disable it per default. Those people who use it most likely want it, those who don't aren't affected by that graphics glitches anyway.
Description
•