Closed Bug 1197497 Opened 9 years ago Closed 7 years ago

HiDPI breaks the standard Windows7 mechanism "Automatically move the pointer to the default button in a dialog box" (SnapToDefaultButton)

Categories

(Core :: Widget: Win32, defect, P3)

22 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox43 --- affected
firefox50 --- affected
firefox51 --- affected
firefox55 --- fixed

People

(Reporter: arni2033, Assigned: emk, Mentored)

References

(Blocks 1 open bug)

Details

(Whiteboard: [lang=c++][regression from bug 844604], tpi:+)

Attachments

(3 files)

STR:   (Nightly (2015-08-20))
1. Set font size in Windows = 125% (or you can try setting layout.css.devPixelsPerPx -> 1.25)
2. Make sure you have default Windows setting "place mouse over default button when confirm window opens" (I don't know how it's called in English)
3. Open Scratchpad (Shift+F4)
4. Type "asdf" in Scratchpad
5. Click close button

Result:       Mouse cursor is placed wrong
Expectations: Mouse cursor should place over the "Save" button

Note:         That happens with every browser's prompt/alert/confirm. Even when using profile manager (the last one obviously refers to 125% in Windows, not layout.css.devPixelsPerPx pref)
(In reply to arni2033 from comment #0)
> Created attachment 8651384 [details]
> 2015.08.22 16-42-59.webm
> 
> STR:   (Nightly (2015-08-20))
> 1. Set font size in Windows = 125% (or you can try setting
> layout.css.devPixelsPerPx -> 1.25)
> 2. Make sure you have default Windows setting "place mouse over default
> button when confirm window opens" (I don't know how it's called in English)

"Automatically move the pointer to the default button in a dialog box"

It's stored in the "SnapToDefaultButton" registry setting.



We don't really do anything based on the registry setting, as far as I can tell from searching our codebase, so if this problem doesn't occur with other applications when using non-default Windows zoom settings, then I'm not sure what we'd be doing differently, if anything, that would be causing this. Jim, do you have ideas?
Component: General → Widget: Win32
Flags: needinfo?(jmathies)
Product: Firefox → Core
Summary: HiDPI breaks the standard Windows7 mechanism "Place mouse over default button when confirm window opens" → HiDPI breaks the standard Windows7 mechanism "Automatically move the pointer to the default button in a dialog box" (SnapToDefaultButton)
Yes, other applications don't show this behavior
> (or you can try setting layout.css.devPixelsPerPx -> 1.25)
That's bad suggestion actually(!). What may be important is that I see the same issue with profile manager - that means that layout.css.devPixelsPerPx isn't doesn't break anything... Well, it does break things "back to normal" when I set it to 1.0 . It sort of compensates the actual bug.

So now I think that there're 2 bugs actually:
1) Firefox works bad on HiDPI
2) Pref layout.css.devPixelsPerPx affects coordinates which are transmitted to OS
  (I guess that's how the pointer gets the actual coordinates)
> screenshot:   https://dl.dropboxusercontent.com/s/7pb6frzithqm3xa/screenshot%20-%20HiDPI%20breaks%20the%20standard%20Windows7%20mechanism%20%27Automatically%20move%20the%20pointer%20to%20the%20default%20button%20in%20a%20dialog%20box%27%20%28SnapToDefaultButton%29.png?dl=0

This bug has nothing to do with the save dialog. I just filed bug 1214688 about it [the dialog].
(In reply to arni2033 from comment #2)
> Yes, other applications don't show this behavior
> > (or you can try setting layout.css.devPixelsPerPx -> 1.25)
> That's bad suggestion actually(!). What may be important is that I see the
> same issue with profile manager - that means that layout.css.devPixelsPerPx
> isn't doesn't break anything... Well, it does break things "back to normal"
> when I set it to 1.0 . It sort of compensates the actual bug.
> 
> So now I think that there're 2 bugs actually:
> 1) Firefox works bad on HiDPI
> 2) Pref layout.css.devPixelsPerPx affects coordinates which are transmitted

You really shouldn't need to set that pref anyway, on Windows. It is an internal pref and I would advise you not to touch it.
> It is an internal pref and I would advise you not to touch it.
Oh, you're really provoking me. Do you advise me to eat the blurry buggy **** firefox UI has become from 28+? I've always used Windows on 125%, and firefox was OK before "yet another improvement".
> screenshot:   https://dl.dropboxusercontent.com/s/huk01oz08dt7nta/del%20screenshot%20-%20HiDPI%20regression.png?dl=0
Attached image mousesettings.jpg
This Windows pref is exposed via Mouse Settings. We implemented support in bug 76053, but apparently the code needs to be updated to support highdpi displays. This bug should probably get added to a backlog of some sort so we get to it.
Flags: needinfo?(jmathies)
Flags: firefox-backlog?
Blocks: 76053
From the duplicate:

nsGlobalWindow::NotifyDefaultButtonLoaded needs to convert the coordinates of buttonRect from css pixels to device pixels.

nsWindow::OnDefaultButtonLoaded should take a LayoutDeviceIntRect as well to make this clearer.
Mentor: enndeakin
Whiteboard: [lang=c++]
Hi, can you give me some direction in solving this bug please?
Flags: needinfo?(enndeakin)
The nsWindow::OnDefaultButtonLoaded (declared in the nsIWidget interface) should take a LayoutDeviceIntRect instead of an nsIntRect.

The one caller of this is nsGlobalWindow::NotifyDefaultButtonLoaded, which supplies coordinates from the rectagle 'buttonRect' in the wrong rectangle unit type. The coordinates (x, y, width, height) will need to be converted into the right type using 
nsPresContext::DevPixelsToIntCSSPixels or some similar method.

A similar change for a point was made in http://hg.mozilla.org/mozilla-central/rev/fd0e8165c50f

Thanks for helping out!
Flags: needinfo?(enndeakin)
Has STR: --- → yes
Blocks: win-hidpi
Reproducible on:   Win7_64, Nightly 51, 32bit, ID 20160801074053 (2016-08-01)

Assuming that users don't usually switch about:config prefs, this became user-visible after bug 844604
This is "regression" from bug 844604. Regression range:
> http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b672877ed046&tochange=0f7261e288f2
Blocks: 844604
Whiteboard: [lang=c++] → [lang=c++][regression from bug 844604]
Version: Trunk → 22 Branch
Priority: -- → P3
Whiteboard: [lang=c++][regression from bug 844604] → [lang=c++][regression from bug 844604], tpi:+
Is this option still supported at all?

I checked the "Automatically move pointer to the default button in a dialog box" option, but pointer did not move at all even with DPI scaling 100%, even with Notepad.
(In reply to Masatoshi Kimura [:emk] from comment #11)
> Is this option still supported at all?
> 
> I checked the "Automatically move pointer to the default button in a dialog
> box" option, but pointer did not move at all even with DPI scaling 100%,
> even with Notepad.

I can see it doing something with the default file > open... dialog on notepad on non-100% dpi scaling on Windows 10. It automatically moves to the [Open] button.
Windows 10 + Notepad + file picker didn't work for me (pointer did not move at all). That's strange...
Ah, I got it. VMware Tools prevented this option from working.
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Blocks: 1358758
Comment on attachment 8860570 [details]
Bug 1197497 - Convert the button rect to device coordinates correctly instead of casting CSS coordinates.

https://reviewboard.mozilla.org/r/132578/#review135516

Thanks for fixing this (and various other recent dpi-related fixes)...  great to get these tidied up!
Attachment #8860570 - Flags: review?(jfkthame) → review+
Pushed by VYV03354@nifty.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/777eaa1593f7
Convert the button rect to device coordinates correctly instead of casting CSS coordinates. r=jfkthame
https://hg.mozilla.org/mozilla-central/rev/777eaa1593f7
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: