Hi

I'm having troubles with focus when I use GTK3 applications
(particularly sakura terminal emulator and transmission bittorrent
client).

It's very easy to reproduce the problem. Launch sakura, move mouse
pointer over the terminal window, switch to other workspace with
keyboard and return to original workspace. After this steps, sakura
stops to receive the focus events and cursor is always shown as
inactive. (When you try, make sure you're using gtk3 version of sakura).

I investigated the problem. It's because gtk3 use xinput protocol by
default (gtk2 use core protocol). And I noticed one subtle difference
in event handling while switching workspaces:

1. Core protocol

   When workspace switched, LeaveNotify event is generated and
   xevent->xcrossing.focus is true (which is correct, window has focus
   before switching).

2. XInput

   When workspace switched, XI_Leave event is generated, but
   focus member of XILeaveEvent is false (but window actually has focus)

So because of this issue gtk misbehaves and starts to ignore focus
events at all.

My supposition is following: XInput focus and сore protocol focus notion
is orthogonal, i.e. XSetInputFocus(3) does not affect XInput focus and
XISetFocus(3) does not affect core protocol. So if focus was not set
with XISetFocus by window manager it can't be detected by XI_Leave
event. (I'm not an expert in X protocol, it's just my thoughts. If you
know more you may tell better).

If I right, solution is to modify window manager to set both focuses
(use XSetInputFocus as well as XISetFocus).

If I'm wrong, and problem is not in window manager, I'm wondering how so
obvious bug got unnoticed by other people, which are using other window
managers.

Also Matthew Hague has similar problem with Awesome window manager:

https://bugzilla.gnome.org/show_bug.cgi?id=677329

It may also confirm that problem is window manager related.

PS. The workaround for this bug is to force gtk3 to use core protcol:

    export GDK_CORE_DEVICE_EVENTS=1

PPS. https://bugzilla.gnome.org/show_bug.cgi?id=677329

-- 
Si vis pacem, para iustitiam.


--
To unsubscribe, send mail to [email protected].

Reply via email to