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 679819 - 3.6: fallback and keyboard configuration
3.6: fallback and keyboard configuration
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: keyboard
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2012-07-12 19:36 UTC by Colin Walters
Modified: 2012-08-29 11:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
keyboard: Don't use IBus if running in fallback mode (4.29 KB, patch)
2012-08-25 20:09 UTC, Rui Matos
reviewed Details | Review
keyboard: Don't use IBus if running in fallback mode (4.73 KB, patch)
2012-08-26 19:07 UTC, Rui Matos
needs-work Details | Review
keyboard: Don't use IBus if running in fallback mode (5.80 KB, patch)
2012-08-28 18:13 UTC, Rui Matos
needs-work Details | Review
keyboard: Don't use IBus if running in fallback mode (7.55 KB, patch)
2012-08-29 09:30 UTC, Rui Matos
committed Details | Review

Description Colin Walters 2012-07-12 19:36:05 UTC
As I understand it, http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=b6e011ad16311e2985aa523cf9bceef74168f95e means that there's not a UI for switching between input methods and keyboard layouts in fallback 3.6.

For non-English fallback mode users, this could be a serious regression.  What to do about it an open question:

1) Implement the new UI design in fallback
2) Resurrect the old keyboard plugin, only use it in fallback
3) Do nothing, document the regression, and move on
Comment 1 Matthias Clasen 2012-07-12 20:37:25 UTC
How is the control-center panel affected by fallback mode ?
Is that not 'a UI for switching between input methods and keyboard layouts' ?
Comment 2 Matthias Clasen 2012-07-12 23:42:44 UTC
I guess what you are saying is that there will no longer be a status icon to switch keyboard layouts. I'm assuming that the ibus statusicon will work fine for input methods.

One idea would be to take the statusicon code from the old keyboard plugin and make it a standalone binary.
Comment 3 Rui Matos 2012-08-25 20:09:45 UTC
Created attachment 222432 [details] [review]
keyboard: Don't use IBus if running in fallback mode

In fallback mode we don't want to touch IBus since the gnome-shell UI
isn't there to provide the full integrated user experience.

We expect users to continue using existing IBus UIs and configurations
in fallback mode.

--

Besides this, we will also need a status icon and menu for keyboard
layouts (i.e. XKB input sources) when running in fallback mode. Patch
for that will come later.
Comment 4 Colin Walters 2012-08-26 18:16:29 UTC
Review of attachment 222432 [details] [review]:

Thanks for looking at this Rui!  So my main concern at this point is whether we're opening up any startup race conditions.  gnome-settings-daemon and gnome-shell are started in parallel, so the org.gnome.Shell name may or may not be there. 

The current code looks safe in that it won't crash, but would it be possible to not have ibus set up?
Comment 5 Rui Matos 2012-08-26 18:50:05 UTC
(In reply to comment #4)
> Thanks for looking at this Rui!  So my main concern at this point is whether
> we're opening up any startup race conditions.  gnome-settings-daemon and
> gnome-shell are started in parallel, so the org.gnome.Shell name may or may not
> be there. 

Actually g-s-d starts before the shell because gnome-session has this concept of phases and g-s-d starts in phase INITIALIZATION while the shell starts in WINDOW_MANAGER. Nonetheless, the race exists because g-s-d's plugins are initialized in idles after g-s-d has registered with gnome-session and thus gnome-session has advanced to the WINDOW_MANAGER phase.

> The current code looks safe in that it won't crash, but would it be possible to
> not have ibus set up?

There's no way for that to happen since we always apply the settings when the shell shows up on the bus. Actually in many cases we apply the same settings twice which is correct but inefficient. There's even an easy fix for that which is calling apply_input_sources_settings() on the shell name vanished handler instead of directly on initialization. New patch coming for that.
Comment 6 Rui Matos 2012-08-26 19:07:49 UTC
Created attachment 222492 [details] [review]
keyboard: Don't use IBus if running in fallback mode

--

This applies the settings both on the shell name showing up and
vanishing instead of directly on plugin init which avoids sometimes
applying the same configuration twice during startup.
Comment 7 Rui Matos 2012-08-27 11:18:23 UTC
(In reply to comment #6)
> Created an attachment (id=222492) [details] [review]
> keyboard: Don't use IBus if running in fallback mode
> 
> --
> 
> This applies the settings both on the shell name showing up and
> vanishing instead of directly on plugin init which avoids sometimes
> applying the same configuration twice during startup.

Hmm, well, this will apply the same settings twice when g-s-d's plugin init wins the race. I guess we can't win here :-(
Comment 8 Colin Walters 2012-08-27 21:42:50 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Created an attachment (id=222492) [details] [review] [details] [review]
> > keyboard: Don't use IBus if running in fallback mode
> > 
> > --
> > 
> > This applies the settings both on the shell name showing up and
> > vanishing instead of directly on plugin init which avoids sometimes
> > applying the same configuration twice during startup.
> 
> Hmm, well, this will apply the same settings twice when g-s-d's plugin init
> wins the race. I guess we can't win here :-(

If it's just an efficiency and not correctness thing, let's go forward with this patch now.  It's worth noting in a comment in the source code at least though that there's a race condition that leads to non-optimal behavior.
Comment 9 Ray Strode [halfline] 2012-08-28 15:13:35 UTC
I thought the plan was to look at the session name property (for name != gnome) on the session manager interface ?
Comment 10 Rui Matos 2012-08-28 15:20:36 UTC
(In reply to comment #9)
> I thought the plan was to look at the session name property (for name != gnome)
> on the session manager interface ?

That was for bug 680313. But now that you mention it, it's probably OK to also use that here instead of the shell name. That way this wouldn't be racy anymore.
Comment 11 Bastien Nocera 2012-08-28 17:39:08 UTC
Comment on attachment 222492 [details] [review]
keyboard: Don't use IBus if running in fallback mode

As mentioned in the comments, let's use the session name instead.
Comment 12 Rui Matos 2012-08-28 18:13:15 UTC
Created attachment 222673 [details] [review]
keyboard: Don't use IBus if running in fallback mode

--

It's a bit more code but it's not racy and more efficient.

I think I covered all the error cases so that we don't end up in a
situation where we don't apply the settings. Also, didn't use a
cancellable but it should be safe against the GsdKeyboardManager being
destroyed. Nonetheless, please review carefully.
Comment 13 Bastien Nocera 2012-08-28 18:20:36 UTC
Review of attachment 222673 [details] [review]:

::: plugins/keyboard/gsd-keyboard-manager.c
@@ +295,3 @@
+
+        if (!GSD_IS_KEYBOARD_MANAGER (manager))
+                goto out;

There's a single line in the out branch, just do it here.

FWIW, this is broken though, as the manager pointer could be pointing at anything it wanted. You'll need to use a cancellable, or just ignore the problem.

@@ +328,3 @@
+        GError *error = NULL;
+
+        if (!GSD_IS_KEYBOARD_MANAGER (manager))

As above.
Comment 14 Rui Matos 2012-08-29 09:30:17 UTC
Created attachment 222726 [details] [review]
keyboard: Don't use IBus if running in fallback mode

--

Right, here it is now using the cancellable.

I'm also now deferring the ibus object creation only to when we are
sure we need it since I'm using the same variable to hold the
cancellable for the async ibus calls.
Comment 15 Bastien Nocera 2012-08-29 10:01:58 UTC
Review of attachment 222726 [details] [review]:

Apart from the couple of misuses of GErrors

::: plugins/keyboard/gsd-keyboard-manager.c
@@ +306,3 @@
+
+        result = g_dbus_connection_call_finish (connection, res, &error);
+        if (!result && error) {

if (!result)

error should be set, otherwise that means that g_dbus_connection_call_finish() is broken.

@@ +338,3 @@
+
+        connection = g_bus_get_finish (res, &error);
+        if (!connection && error) {

Ditto with the error.
Comment 16 Rui Matos 2012-08-29 11:38:06 UTC
Amended and pushed. Thanks

Attachment 222726 [details] pushed as fe3f85f - keyboard: Don't use IBus if running in fallback mode