After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747274 - keyboard: Add a way to use the OSK on shell chrome in wayland sessions
keyboard: Add a way to use the OSK on shell chrome in wayland sessions
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on: 747273
Blocks:
 
 
Reported: 2015-04-02 22:43 UTC by Rui Matos
Modified: 2015-06-04 11:20 UTC
See Also:
GNOME target: 3.16
GNOME version: ---


Attachments
keyboard: Add a way to use the OSK on shell chrome in wayland sessions (3.27 KB, patch)
2015-04-02 22:43 UTC, Rui Matos
none Details | Review
keyboard: Add a way to use the OSK on shell chrome in wayland sessions (3.31 KB, patch)
2015-04-13 14:56 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2015-04-02 22:43:04 UTC
I'd like to include something like this as a short term hack for
3.16.1 so that we at least allow logging in with the OSK now that gdm
runs in a wayland session by default.

It requires an API addition to libcaribou but I added a check for it
at runtime so that at least we don't break badly if that function
isn't there.

As the commit message says, a proper solution would be a lot more
invasive and in fact, we need to consider the text protocol for
wayland instead of generating key events but that also requires
clients to have support for it.

Anyway, comments welcome
Comment 1 Rui Matos 2015-04-02 22:43:10 UTC
Created attachment 300864 [details] [review]
keyboard: Add a way to use the OSK on shell chrome in wayland sessions

libcaribou was designed to generate X events which works under wayland
sessions for X clients but obviously doesn't work for wayland clients
and for shell chrome.

This patch adds a simple caribou display adapter which inherits from
its X display adapter and allows us to continue to work for X clients
and at the same time makes the OSK work on shell text entries by
sending key events directly to the focused text actor.

Making the OSK work for wayland clients requires much bigger changes
at various levels in the stack and either not using libcaribou or
re-working it substantially so that's left for future work.
Comment 2 Florian Müllner 2015-04-13 08:56:28 UTC
Review of attachment 300864 [details] [review]:

::: js/ui/keyboard.js
@@ +736,3 @@
+
+    vfunc_keyval_press: function(keyval) {
+        if (Main.modalCount == 0) {

Can't we do better than that? A modalCount greater 0 is sufficient for chrome input focus, but not necessary. At least chat notifications allow input without pushing a modal (though that functionality isn't really accessible on touch atm)
Comment 3 Rui Matos 2015-04-13 14:56:32 UTC
Created attachment 301464 [details] [review]
keyboard: Add a way to use the OSK on shell chrome in wayland sessions

--

> Can't we do better than that? A modalCount greater 0 is sufficient
> for chrome input focus, but not necessary.

True. In practice it seems like checking that the stage's key focus is
on a ClutterText instance is enough since it gets reset to the stage
itself when focus is on a client.
Comment 4 Florian Müllner 2015-04-14 16:37:36 UTC
Review of attachment 301464 [details] [review]:

OK

::: js/ui/keyboard.js
@@ +749,3 @@
+        if (!(focus instanceof Clutter.Text)) {
+            this.parent(keyval);
+            return;

The "early" return in the only branch that actually does something is stylistically odd - this would make more sense to me as

  if (focus instanceof Clutter.Text)
      return; // do nothing

  this.parent(keyval);

(to a lesser extent this applies above as well, where a simple if-else statement could be used)
Comment 5 Rui Matos 2015-04-14 17:39:51 UTC
Pushed with the style change, thanks

Attachment 301464 [details] pushed as 5afd047 - keyboard: Add a way to use the OSK on shell chrome in wayland sessions
Comment 6 Bastien Nocera 2015-05-23 01:15:59 UTC
This doesn't seem to work for me, using gnome-shell 3.16.2. Do I need a specific version of caribou?
Comment 7 Rui Matos 2015-05-23 19:18:52 UTC
(In reply to Bastien Nocera from comment #6)
> This doesn't seem to work for me, using gnome-shell 3.16.2. Do I need a
> specific version of caribou?

Ugh, yes, just realized that there was no caribou release yet including the needed patch. I pinged Ueno now, and will do it myself first thing on monday if one hasn't appeared yet.
Comment 8 Bastien Nocera 2015-06-04 11:20:46 UTC
This didn't work with touchscreens, but was fixed in the follow-up:
https://bugzilla.gnome.org/show_bug.cgi?id=750287