You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hit testing is wrong for drag areas in frameless window (Windows) #7347
Operating system:
Windows 7 Pro, x64 (with display set to 150%)
Problem description
When using a BrowserWindow with frame: false, electron does not always appear to be doing proper hit testing (mouse over, click, etc) for draggable areas. It works great with my stock Windows settings, but if you scale up your display to 150% it breaks. Unfortunately, some laptops/PCs ship with this setting NOT being 100%.
Dug in some more, here are my current findings:
When at 150% display size, the cursor is reporting the wrong position. Here's a quick screenshot I put together:
Quick overview for the colors / how to read this:
red colored divs are ones w/ -webkit-app-region: drag
yellow colored divs are ones w/ -webkit-app-region: no-drag
blue colored divs are ones I manually plotted (coords obtained by dumping the RECTs out of the draggable_region member variable using an iterator. This change was made in atom/browser/ui/views/frameless_view.cc::NonClientHitTest())
You'll also notice (gotta look close) a brown X in the bottom right. I added some code to electron to write the cursor position and noticed that:
in the above example, I physically put my cursor where the brown X is (bottom right)
electron reports the coordinates for my cursor being where the aqua colored X is (above and left of the brown X). This is off by ~277 pixels on the X axis and 27 on the Y axis.
No progress made, still digging. The hitboxes which exist in draggable_region are correct. However, the mouse coordinates are not. Since my resolution is set to 150%, I can get the proper coordinates by multiplying the x and y by 1.5. I'm trying to find the code which is capturing the mouse coordinates, to understand why it's capturing them wrong.
Activity
bsclifton commentedon Sep 26, 2016
Dug in some more, here are my current findings:

When at 150% display size, the cursor is reporting the wrong position. Here's a quick screenshot I put together:
Quick overview for the colors / how to read this:
-webkit-app-region: drag-webkit-app-region: no-dragatom/browser/ui/views/frameless_view.cc::NonClientHitTest())You'll also notice (gotta look close) a brown X in the bottom right. I added some code to electron to write the cursor position and noticed that:
Looking deeper into the code now...
bsclifton commentedon Sep 26, 2016
No progress made, still digging. The hitboxes which exist in draggable_region are correct. However, the mouse coordinates are not. Since my resolution is set to 150%, I can get the proper coordinates by multiplying the x and y by 1.5. I'm trying to find the code which is capturing the mouse coordinates, to understand why it's capturing them wrong.
bsclifton commentedon Sep 27, 2016
Root cause found and fixed in my fork with https://github.com/bsclifton/electron/commit/f217aa0d588aa2a513e962a94d3b34c87e2b8462
I'll submit an upstream patch soon 😄 Special thanks to @bridiver for digging in with me and finding the missing call
fix: recover from stale mouse hit-testing after closing fullscreen w/…
fix: recover from stale mouse hit-testing after closing fullscreen w/…