ProgerXP / Notepad2e

Word highlighting, simultaneous editing, split views, math evaluation, un/grep, comment reformatting, UAC elevation, complete regexps (PCRE), Lua lexers, DPI awareness and more (XP+)
Other
371 stars 52 forks source link

DPI awareness #154

Open ProgerXP opened 6 years ago

ProgerXP commented 6 years ago

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.)

cshnik commented 6 years ago

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.
ProgerXP commented 6 years ago

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

cshnik commented 6 years ago

Done.

cshnik commented 4 years ago

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

ProgerXP commented 4 years ago

Is it another problem caused by the Scintilla upgrade?

cshnik commented 4 years ago

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.

ProgerXP commented 3 years ago

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?

cshnik commented 3 years ago

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.

ProgerXP commented 3 years ago

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.