[dev] [dwm] strange issue with gedit and multiple screens

From: Martti Kühne <mysatyre_AT_gmail.com>
Date: Fri, 13 Apr 2012 19:12:29 +0200

hello there

after whining earlier on irc, I've got to put things straight here.
I have two monitors and most of the time I don't really care where the mouse
pointer is. using dwm with multiple monitors works great, as there is the
focusmon function, which I have assigned to a key to switch between monitors.

The issue I was having with gedit was this: every now and then, gedit would
refuse to display a text cursor when I use the mouse to point, click and, at
the same time, get focus from a different screen. The only way of knowing where
in the text the cursor was, was to blindly type something or press the focusmon
key twice, which worked as a workaround for the issue.

In the course of debugging this I also noticed the same can be achieved when
the focusmon key is used to switch to a window on the other screen and follow
with the mouse and come back again, returning focus to the screen where gedit
runs. Again, input is taken, blue border is drawn, but no text cursor is shown.

Well, I can imagine that it's easy to blame gedit for that inconsistency,
apparently qt applications do not suffer from this.

Anyway, looking at dwm's codebase it isn't really clear when focus() is called,
selmon is set and unfocus is called, and, focus() itself calls unfocus and sets
selmon just in case. Needless to say, it made debugging a horrible task here.

I have tried quite a lot of things which ultimately lead to the desired
behavior, and then tested things hunkwise to find the culprit after all;
turns out it's my regular use of focusmon() which actually triggers the bug in
the first place; the change that solved my issues can be found in [1].

tl:dr; improve focus behavior of at least anjuta and gedit [1]

cheers!
mar77i

[1] http://ix.io/2iT
Received on Fri Apr 13 2012 - 19:12:29 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 13 2012 - 19:24:04 CEST