Notepad2e icon indicating copy to clipboard operation
Notepad2e copied to clipboard

DPI awareness

Open ProgerXP opened this issue 7 years ago • 9 comments
trafficstars

Recent laptops often have high-DPI displays and Windows enables DPI scaling by default. Unlike scaling in XP, scaling in Vista+ (?) applies not to font alone but to all controls. When a program isn't "dpi-aware", Windows resorts to proportional scaling of the entire window which blurs the text. For a text editor, results are awful.

Question: how hard it is to make this program "dpi-aware" so that text and controls are scaled properly and nothing is blurred?

Screenshot of DPI setting in Display settings: dpi1

Screenshot of Notepad 2e with DPI at 125% (note the difference between font used in the main menu and inside the program's window itself): dpi2

(To see the difference clearer open the image in a new tab.)

ProgerXP avatar Feb 21 '18 21:02 ProgerXP

Please check uploaded test build with implemented DPI awareness (per monitor) functionality. Since this feature affects many aspects of the application it would be great to have a detailed test before committing these changes. Here is the list of known limitations in this build (found for Windows 10):

  1. System dialogs are not scaled (when moving them between monitors).
  2. Tool/setting windows captions (e.g. Settings> Tab Settings) are not scaled.
  3. There can be some resource leaks, additional code cleanup is required.

cshnik avatar Mar 01 '18 22:03 cshnik

It seems to work fine. Push your code changes to the repo.

ProgerXP avatar Mar 27 '18 16:03 ProgerXP

Done.

cshnik avatar Apr 17 '18 18:04 cshnik

Feature is broken in R134: Scintilla's content is not properly scaled.

cshnik avatar Aug 18 '20 03:08 cshnik

Is it another problem caused by the Scintilla upgrade?

ProgerXP avatar Aug 18 '20 20:08 ProgerXP

Is it another problem caused by the Scintilla upgrade?

Yes, there was a missing change when upgrading Scintilla. Fixed.

There is another issue: high-DPI scaling is not applied for system dialogs (i.e when running MessageBox()). Please confirm if we should address it.

cshnik avatar Aug 19 '20 17:08 cshnik

There is another issue: high-DPI scaling is not applied for system dialogs (i.e when running MessageBox()). Please confirm if we should address it.

Do you have ideas for how to address it?

ProgerXP avatar Sep 05 '20 13:09 ProgerXP

Fixed bug: DPI scaling is not applied on application start which caused UI looks smaller (than expected) on high-DPI displays.

Steps to reproduce:

  1. Configuration: Display 1 (primary): low resolution Display 2 (secondary): high resolution
  2. Run Notepad2e, move window to Display 2, press F7 (Save settings), quit
  3. Run Notepad2e, note text scaling is not applied

Workaround: Move Notepad2e to Display 1 and then return it back to Display 2.

cshnik avatar Mar 31 '21 17:03 cshnik

Move Notepad2e to Display 1 and then return it back to Display 2.

Is this workaround for the version before c8218bc83b138c262d530dbdbc1e59188a9c1113 only?


It was suggested to fix DPI of system windows by subclassing; this will also make the code cleaner. Let's do this and see if it will work.

ProgerXP avatar Apr 21 '21 12:04 ProgerXP