tudurom / windowchef

Window Chef is a stacking window manager that cooks windows with orders from the Waitron
https://tudorr.ro/software/windowchef/
ISC License
203 stars 14 forks source link

border width and firefox right click menu #38

Closed dialuplama closed 6 years ago

dialuplama commented 6 years ago

Border width is effect on cursor position in firefox right click menu. With border width more than 1px the cursor is placed inside menu. So when you do right click on some page it's always perform "go to previous page". There is no similar issue with other applications.

tudurom commented 6 years ago

ooooooh so that was it! i always wondered why does it happen! thank you so much for reporting!

i will investigate tomorrow

Basrandir commented 6 years ago

Any update on this? I have the same issue where any border_width over 2 causes the top left item on a firefox right-click context menu to be automatically selected. Kind of sucks because I like me a thick border :)

tudurom commented 6 years ago

I too experience the issue so I know how much it sucks. I spent waaay too many hours trying to fix the issue, but with no luck. The issue is still not abandoned and I will continue the search for a fix.

Basrandir commented 6 years ago

So I was testing with some other WMs and I have the same issue with bspwm, i3, and spectrwm with border sizes greater than 2 px. This seems like an issue with Firefox itself.

I don't remember having this issue in the past so I tested both pre-quantum Firefox and Waterfox (based on Firefox 56). The issue is still there. The tolerance seems to be higher by about a pixel though, any border size greater than 3 px starts to have the same issue.

Edit: Just tested in herbstluftwm and this doesn't seem to be an issue. No matter how big I've made the border, it's not automatically selected.

vain commented 6 years ago

Just a few thoughts:

A few years back, I had this issue with dwm and Java applications. I then proceeded to read Java's source code and found that Java simply didn't care about plain X11 window borders. You know, the ones you set with XSetWindowBorderWidth() (or whatever xcb's equivalent of this function is). This resulted in all menus being misaligned because menus are implemented as top-level windows in Java (using override_redirect) and this requires Java to use absolute screen coordinates. It calculates these coordinates by using the window's X/Y coordinates and it then accounts for window frames of reparenting window managers, but it didn't check for a border set by XSetWindowBorderWidth(). Thus, all menus were off by a few pixels.

Long story short, there was no way to get this right. Applications must play along and they must be prepared to handle borders -- just as they should be prepared to handle reparenting. Maybe there are ugly hacks, but you don't want that in a sane WM.

(By the way, Java checked for multiple cases, even triple reparenting. They tried to get this right. They just forgot about one case.)

No idea about the current situation. This was about 5 years ago.

I suspect that Firefox might suffer from the same problem. Since Firefox's code base is so massively huge, I have not read its source code. But I can easily reproduce the bug in my old dwm.

herbstluftwm does reparenting and sets the window border to a size of 0, so that probably explains why hlwm doesn't show the problem:

https://github.com/herbstluftwm/herbstluftwm/blob/917322bfc585b5db3adf725a2cf2eaf2a6000c55/src/clientlist.cpp#L335

Basrandir commented 6 years ago

I suspect you might be right. Did some tests with a few Wayland compositors (Sway and GNOME). Neither of them had an issue with thick borders.

tudurom commented 6 years ago

That seems to be the issue. It's even weirder that in the past I had this issue with windowchef but not with bspwm, now it also affects bspwm.

Thank you all for participation, I'm going to close the issue for now.