[PATCH weston] libinput: Restore keyboard focus after VT switch

Peter Hutterer peter.hutterer at who-t.net
Thu Aug 2 05:39:54 UTC 2018


for the archives, this had a short discusson on IRC but then fell under the
radar again

On Sun, Jul 22, 2018 at 06:53:56AM -0700, Jamey Sharp wrote:
> Hey Daniel, thanks for taking a look! It turns out that this patch worked
> in Weston 3, but in Weston 4, commit
> 85d55540cb64bf97a08b40f79dc66843f8295d3 broke it. I didn't investigate
> carefully enough to understand what that commit was for or why it broke
> this, but my patch plus a revert of that commit makes Weston 4 work without
> side effects we've been able to observe, so that combo is what we've been
> using for the last month.

20:41 < whot> SardemFF7: afaict, the problem is that vt switching causes a
  libinput_suspend() call. that generates DEVICE_REMOVED events which
  eventually trigger  weston_seat_release_keyboard(). That calls
  weston_keyboard_set_focus() and because of 85d55540cb6 we're guaranteed
  that the saved_kbd_focus is now NULL
20:41 < whot> so on vt switch back, we don't know what to restore the focus
  to
20:45 < SardemFF7> I see
20:46 < ongy> does weston remove the seat when the last device got removed?
  I had that issue before when working on waymonad.
20:47 < whot> I don't think so, from a quick check
20:53 < SardemFF7> I think I see another solution to my issue that would
  (hopefully) not conflict like the current one
20:54 < SardemFF7> in set_focus(), early: if (saved != NULL && new != NULL)
  { saved = new; return; /* let set_focus do its thing when weston is back
  on focus */}
20:56 < SardemFF7> so if you change focus when weston-not-focused, it’s
  updated, if you reset focus/unfocus (set to NULL), saved focus is not
  touched, and in other cases saved should be NULL I think…
[...]
21:02 < whot> SardemFF7: I think that should work, yes

Cheers,
   Peter

> I hope that's useful information…
> Jamey
> 
> On Sun, Jul 22, 2018, 3:09 AM Daniel Stone <daniel at fooishbar.org> wrote:
> 
> > Hi Jamey,
> >
> > On Wed, 23 May 2018 at 14:16, Jamey Sharp <jamey at minilop.net> wrote:
> > > Under Weston's drm-backend, after returning to Weston from another VT,
> > > no window has focus.
> > >
> > > There's already code in notify_keyboard_focus_out and
> > > notify_keyboard_focus_in to save and restore focus, respectively; and
> > > udev_input_enable eventually calls notify_keyboard_focus_in, by way of
> > > evdev_notify_keyboard_focus. But udev_input_disable doesn't currently
> > > call notify_keyboard_focus_out.
> > >
> > > This patch makes udev_input_disable symmetric with udev_input_enable by
> > > calling notify_keyboard_focus_out on every seat, to save focus before
> > > suspending libinput. In my testing this successfully resolved my issue.
> > > However, I don't have a multi-seat setup to verify that it works there
> > > too.
> >
> > This seems correct to me. Peter, any thoughts/comments?
> >
> > Cheers,
> > Daniel
> >


More information about the wayland-devel mailing list