[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] Program stealing focus when clicked
From: |
Will Storey |
Subject: |
[RP] Program stealing focus when clicked |
Date: |
Thu, 14 Jul 2016 17:49:27 -0700 |
Hello,
I have a program that steals my keyboard focus when I click inside it. I've
found most programs don't do this, so this one doing so threw me off. I
prefer to change focus through ratpoison.
I looked into it a bit and created a patch that stops it happening. I am
not sure what I came up with is the best way to resolve the problem though.
Background: The program is written using Qt 5. I found if I wrote a small
program using Qt 5 that I could reproduce it. Qt 5 itself has code to grab
the focus in this condition, not just the specific program I first
encountered.
I'm not sure if changing Qt 5's behaviour would be better than my patch to
ratpoison. It seems to me clicking into a window would give keyboard focus
usually anyway (if not using ratpoison that is) so I am wondering if Qt 5
is being too aggressive and I should look at it from that angle.
My patch works by keeping track in a variable the last window given focus
(by ratpoison). Then when an X FocusIn event happens, I switch focus back
if it is not the window ratpoison last gave focus to. This means the
problem program grabs focus, but ratpoison immediately grabs it back.
>From using this patch for a couple days it has worked well. It does seem
like it could be hacky though and I'm worried there could be side effects I
haven't encountered yet. I've attached it (applies to the git HEAD).
I wonder if anyone would have any insight about this issue or any
alternative ideas I should look at, or any feedback on my patch.
Thanks for reading.
ratpoison.diff
Description: Text Data
- [RP] Program stealing focus when clicked,
Will Storey <=