baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.76k stars 415 forks source link

Mouse at edge of window in monocle layout causes unwanted switching of focused window #408

Closed vanzomerenc closed 8 years ago

vanzomerenc commented 8 years ago

Sometimes, when there are multiple windows on a desktop with monocle layout, the top window will become unfocused and end up below another window. This only happens for certain windows, such as gtk3-icon-browser, and can be triggered by moving the mouse slowly on the edge of the window.

I am using the following bspwmrc:

#! /bin/bash

# general configuration
bspc config focus_follows_pointer true

# window placement
bspc config top_padding 28
bspc config left_padding 58
bspc config right_padding 0
bspc config bottom_padding 0

# borders
bspc config focused_border_color \#AD3300

# desktops
bspc monitor --reset-desktops Desktop{1,2,3,4,5,6,7,8,9}
eigengrau commented 8 years ago

I’ve also noticed this, but only with some, selected clients. One client that seems to consistently do this is for me is evince (GTK3).

sg3des commented 8 years ago

Similar problem, it appeared after upgrade bspwm, i have problems with chromium...

neeasade commented 8 years ago

So, what appears to be happening here is the pointer is going through the border of GTK3 windows. If you have focus_follows_pointer set, the pointer goes through GTK3 window border to window beneath it and that's why you get the switching. I tested this using large window borders with gedit(GTK3) and leafpad(GTK2), and only gedit had the problem.

EDIT: @sg3des and on chromium, this is only an issue if you haven't checked the 'use system title bar and borders' option by right clicking top bar.

neeasade commented 8 years ago

So, GTK3 manages window decorations from the client side - I'm assuming that bspwm is still having the borders there but they aren't part of the window necassarily (like they are in other programs). My initial thought was to try and have gtk css that made it's client-side borders match your bspwm borders, but then you wouldn't get your focus colors -- then I tried to have gtk manage it's own borders with a width matching bspwm borders, be transparent, and set a negative border_width value on the gtk window in an attempt to inverse into the window. There were 2 problems with that approach:

Here is the ~/.config/gtk-3.0/gtk.css file I was using to attempt the transparent border style (20px bspwm border width is what I was testing with)

.window-frame, .window-frame:backdrop {
    border-style: solid;
    border-width: 20px;
    border-color: rgba(0, 0, 0, 0);

    background-image: none;
    background-color: rgba(0, 0, 0, 0);

    box-shadow: none;
    margin: 0;
    border-radius: 0;
}

edit: I guess the other/possibly simpler solution would be to have bspwm do some sort of handling of cursor on borders in this scenario?

sg3des commented 8 years ago

I do not know, we are talking about the same problem... simple example: you have bind on hotkey open terminal, and setting preselect... 1) open terminal -> now your focus is on this window/node - it`s ok! 2) set preselect on one of side for this window/node, move your mouse cursor on preselect area, 3) and again open terminal... your new terminal window not receive focus, even if you click on this window, focus will be only if you move out the mouse cursor and re-hover on this terminal window.

second example with drag and drop: 1) open text editor(i`m use xfce mousepad) 2) open file manager(i have xfce thunar) 3) drag any text file from file manger to text editor... text editor not recieve focus, and even highlight the text you can! BUT all the action will be made to file manager!

neeasade commented 8 years ago

@sg3des - You are describing a different issue from OP here. I was able to reproduce and have opened https://github.com/baskerville/bspwm/issues/461

EDIT: my browser goofed. sorry for those I may have just email spammed.

sg3des commented 8 years ago

@neeasade - year, thx, my problem is solved! ^^

neeasade commented 8 years ago

This issue can be resolved by removing gtk3 client-side decorations with https://github.com/PCMan/gtk3-nocsd.

Here's a webm demonstrating the issue: https://u.teknik.io/P3Hni.webm

and webm demonstrating fix after installing the above: https://u.teknik.io/SNzQ4.webm

The window switching when my mouse is off the border is me doing bspc node -f next.local.