You are not logged in.

#1 2013-02-26 16:36:07

Beg
Member
Registered: 2013-02-24
Posts: 18

[SOLVED] DWM mouse focus issue

The windows don't switch focus on what the mouse is pointing at if you go from an empty tab to another one. You need to move the mouse outside and back the window you have the mouse on currently to be able to get focus on it.

How to reproduce the effect:
Open 2-3 windows in tab 1, keep tab 2 empty.
focus window 1
switch to tab 2(pref with hotkeys),
move mouse to where window 2 is located in tab 1,
switch back to tab 1, now you will still have window 1 focused.

Has anyone been able to fix this?

Last edited by Beg (2013-03-01 09:28:02)

Offline

#2 2013-02-26 17:12:10

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] DWM mouse focus issue


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-02-26 17:24:44

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

I do believe so, thanks. I will try it out.

Offline

#4 2013-02-26 17:40:18

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

I'm sorry but I'm pretty new where do I find the file I should patch? I tried grabbing xorg-server and gtk with ABS but none of those contain the file I need to patch.

Offline

#5 2013-02-26 18:29:08

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [SOLVED] DWM mouse focus issue

See the enternotify patch on my github.


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#6 2013-02-26 18:50:47

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

illusionist, this did the opposite of what I wanted.

I want it to focus whatever I have my mouse over, even when I switch tabs..

The issue I have is that when I switch tabs it doesn't focus what is on my mouse, but rather what was last focused in that window before the switch.

both fixes did not fix it. Unsolving this

Offline

#7 2013-02-26 19:45:20

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

http://www.twitch.tv/iambeg/b/371625138 Here you have a video demostration

Basically, when I switch tabs, the focus stays on the focus even if the mouse is located on a new location hovering over a new window.

The blue oversized border shows the current focus.

Last edited by Beg (2013-02-26 19:50:24)

Offline

#8 2013-02-28 09:00:27

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [SOLVED] DWM mouse focus issue

I think you need  to write a patch by yourself if you need that functionality. Combine something like 'ClkClientWin' and 'view(&arg)'. You may want to add a new atom too but I am not sure.
Little off topic: If you see yourself too much patching/modifying dwm then IMHO it may not be the right choice for you. It is a keyboard driven WM and mouse functionality is optional. There are other alternatives around; like ratpoison. You may give them a try.


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#9 2013-02-28 12:36:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] DWM mouse focus issue

If you want to patch dwm, it would only take two or three lines added to the tag function.

At the end of the function just add an XQueryPointer to get the window the pointer is over, then wintoclient on that window, then focus that client.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2013-02-28 20:25:50

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

Illusionist I do understand your PoV and I do agree that it is a keyboard oriented WM. But I have closed down endlessly many windows because the illusion I get from having the mouse over an window.

Altough after making this post I did configure my DWM to behave "differently" I added an oversized border which helps me notice what window is actually focused. I do have very bad eyes and a 1px border is to small for me to notice. Now in conjunction with both adding the border and also noticing what my problem actually is I have started to take notice of where my focus is at and I have started to use alt+k/j to manouver around windows instead of relying on the mouse.

But I would still like to solve this.

@Trilby Thanks for the instructions. I will see if I can manage it on my own! smile

I did as you asked Trilby

	int di;
	unsigned int dui;
	Window win,dummy;
	XQueryPointer(dpy, root, &win, &dummy, &di, &di, &di, &di, &dui);
	focus(wintoclient(win));
        XFlush(dpy);

It does not seem to work. I get no errors or crashes. As I have no experience in WM's, linux or C, I sadly don't know how to debug this, would appreciate some help! smile

Last edited by Beg (2013-03-02 01:07:03)

Offline

#11 2013-02-28 21:23:26

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] DWM mouse focus issue

That looks pretty good to me - for no experience in C you seem to have interpreted my suggestion quite well into the exact commands I was thinking.  I no longer have dwm on this computer - I may dabble with this over the weekend, but my main suspicious would be that it may need an XFlush(dpy) after the call to focus.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#12 2013-02-28 21:57:20

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

Nope. Still acts the same after I added XFlush(dpy);
, I am restarting the dwm each time. Just to verify it's not human error.

Edit: I'll keep the previous post up to date to my patch fix.

Last edited by Beg (2013-02-28 21:57:57)

Offline

#13 2013-03-01 03:18:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] DWM mouse focus issue

Beg wrote:

I am restarting the dwm each time

Restarting?  This would definitely be necesary, but not sufficient.  Are you recompiling it?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#14 2013-03-01 06:24:20

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

Trilby wrote:
Beg wrote:

I am restarting the dwm each time

Restarting?  This would definitely be necesary, but not sufficient.  Are you recompiling it?

Yes. Ofcourse! smile

Offline

#15 2013-03-01 08:44:30

Vain
Member
Registered: 2008-10-19
Posts: 179
Website

Re: [SOLVED] DWM mouse focus issue

Hi,

you need to add it to 'view()' instead of 'tag()', I think. Plus, 'win' and 'dummy' are mixed up. Here you go:

https://github.com/vain/dwm-vain/commit … b15a7ae03d

Cheers!

Offline

#16 2013-03-01 09:16:15

Beg
Member
Registered: 2013-02-24
Posts: 18

Re: [SOLVED] DWM mouse focus issue

Many thanks to you kind sir!
Thank you all! smile

Last edited by Beg (2013-03-02 01:07:38)

Offline

Board footer

Powered by FluxBB