Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPI] Elements required works to properly support hiDPI #14959

Open
28 of 34 tasks
ozone10 opened this issue Apr 8, 2024 · 80 comments · May be fixed by #13533
Open
28 of 34 tasks

[DPI] Elements required works to properly support hiDPI #14959

ozone10 opened this issue Apr 8, 2024 · 80 comments · May be fixed by #13533
Assignees

Comments

@ozone10
Copy link
Contributor

ozone10 commented Apr 8, 2024

This issue is for tracking issues with hiDPI environment and works on it.
Testing PR #13533

Main window

Dialogs

More complex

Panels

  • Title
  • Tab control
  • Main field
  • Splitter
  • Plugin support

MISC

donho pushed a commit that referenced this issue Apr 11, 2024
-  prepare static dialog for hiDPI

ref: #14959

Close #14947
donho pushed a commit that referenced this issue Apr 14, 2024
- process WM_DPICHANGED_AFTERPARENT message
- remove unused function
- tweak 2 switches, which use enums to avoid warnings

ref #14959

Close #14980
donho pushed a commit that referenced this issue Apr 18, 2024
donho pushed a commit that referenced this issue Apr 18, 2024
- About
- DebugInfo
- Save All
- Close All

ref #14959

Close #14989
donho pushed a commit that referenced this issue Apr 20, 2024
donho pushed a commit that referenced this issue Apr 20, 2024
- Run
- Run a Macro Multiple Times...
- Shortcut

- code enhancement
    - add override in shortcut.h
    - modify switches in WM_COMMAND
    - optimize dark mode for shortcut
    - avoid potential multiple subclassing for Run dialog

ref #14959

Close #15017
donho pushed a commit that referenced this issue Apr 20, 2024
- fix leak because of font.

ref #14959

Close  #15018
donho pushed a commit that referenced this issue Apr 21, 2024
- FindInFinder
- GoToLine
- ColumnEditor
- FindCharsInRange
- ProjectPanel FileRelocalizerDlg

ref #14959

Close #15020
donho pushed a commit that referenced this issue Apr 21, 2024
donho pushed a commit that referenced this issue Apr 21, 2024
@donho
Copy link
Member

donho commented Apr 21, 2024

@ozone10

Just found 2 dialogs (Preferences & Find Replace) partially working & 1 (Shortcut mapper) totally not working:

image

donho pushed a commit that referenced this issue Apr 21, 2024
- StringDlg (Rename Current Tab, ...)
- UDL Styler
- UDL in undock state

- UDL allow tab switching between main dialog and subdialogs
- make controls spacing and size consistent

ref #14959

Close #15024
@donho donho self-assigned this Apr 21, 2024
@ozone10
Copy link
Contributor Author

ozone10 commented Apr 21, 2024

@donho
I will be away for 2 weeks.

For preference add DPIManagerV2::setDpiWithParent(_hSelf); before line

const int cpDynamicalSize = DPIManagerV2::scale(25);

Shortcut mapper, Find&Replace and Windows dialogs are sizeable which require more works.

EDIT
Replacing old NppParameters::getInstance()._dpiManager.scaleX and Y variant with DPIManagerV2::scale will help with initial looks.

Old dpiManager is scaling with dpi from primary monitor.

btw
While working on toolbar I noticed some issue with custom icons for toolbar
Could you check it:

  1. Have custom icons for toolbar enabled.
  2. Open preference and change between large and small icons several times.

@donho
Copy link
Member

donho commented Apr 21, 2024

Just found 2 dialogs (Preferences & Find Replace) partially working & 1 (Shortcut mapper) totally not working:

@ozone10
Sorry, I wasn't clear. What I meant is:
After changing <dpiAwareness>system, unaware</dpiAwareness> to <dpiAwareness>PerMonitorV2, system, unaware</dpiAwareness>, 2 dialogs (Preferences & Find Replace) partially working & 1 (Shortcut mapper) totally not working under a multi-monitor environment. With <dpiAwareness>system, unaware</dpiAwareness> under the multi-monitor environment, Notepad++ is just blurry.

Replacing old NppParameters::getInstance()._dpiManager.scaleX and Y variant with DPIManagerV2::scale will help with initial looks.

So it's not necessary I guess. The old dpiManager is supposed to be replaced by DPIManagerV2, isn't it? All I wanted to point out is, if <dpiAwareness>PerMonitorV2, system, unaware</dpiAwareness> is used, there are some issue in these 3 dialogs - and it's needed to rework in PerMonitorV2 mode.

Can you reproduce what I've shown you in the screenshot with <dpiAwareness>PerMonitorV2, system, unaware</dpiAwareness>? If yes, that's a good news, all we need is fix the bugs.

@donho
Copy link
Member

donho commented Apr 21, 2024

BTW, the provided screenshot is Notepad++ dragged from a scale 225% laptop screen to a scale 100% external monitor.

@ozone10
Copy link
Contributor Author

ozone10 commented Apr 21, 2024

@donho

Can you reproduce what I've shown you in the screenshot with <dpiAwareness>PerMonitorV2, system, unaware</dpiAwareness>? If yes, that's a good news, all we need is fix the bugs.

Yes that is right, because they are using dpi scaling from main monitor.

For preferences dialog for some reason subdialogs when initializing will use dpi scaling from main monitor or system wide.
So adding DPIManagerV2::setDpiWithParent(_hSelf); to subdialogs or DPIManagerV2::setDpi(_hSelf); in main dialog in WM_INITDIALOG will fix it.

@WildByDesign
Copy link
Contributor

As per @ozone10 's great suggestions, I am upsizing the toolbar icons for much better sharpness and clarity. Particularly at the smaller sizes. Please understand that it might take me up to a week to do this. I have to grab 3 SVG's (16px, 20px, and 24px) and manually edit each one. Multiply that by 46 icons. So I have to manually edit 138 SVG files if we want this to be the absolute best. Then I can automatically create inverted copies for the other 138 needed to dark mode.

I have done the process with two icons so far. But trust me when I say that this will be worth while. The difference is night and day.

@ozone10
Copy link
Contributor Author

ozone10 commented May 30, 2024

@WildByDesign
could you provide some svg files for testing, some which have disabled state like save all, cut, or undo, ...

@WildByDesign
Copy link
Contributor

WildByDesign commented May 30, 2024

For sure. examples.zip
You'll notice that the icons that end with _off do not have inverted SVG's. My script inverts those ones during the svg2png script.

Last night I worked on tooling so that I can fly through the icons now. I have two scripts now that take care of all converting, any inverting, packing into ICO, and renaming the icons. Previously, I had all the conversion done with scripting but I had to rename all of the icons manually at the end which was not fun. I think I love PowerShell now.

@WildByDesign
Copy link
Contributor

@ozone10 Can you please test these? It's the first 3 icons on the toolbar. Please compile into your build and particularly test the size (especially smaller sizes) and also the disabled state of the Save button. Check the disabled state of the Save button in both light and dark modes. I have followed your suggestion on the disabled state colors.

.icons.zip

@ozone10
Copy link
Contributor Author

ozone10 commented May 30, 2024

@WildByDesign
looks good, just save button seems to be smaller than other button.

@WildByDesign
Copy link
Contributor

Before I submit the PR for the updated Fluent icons, I wanted to share where it's at right now. It took about a whole week to modify all of the SVGs to ensure size, clarity and most importantly the symmetry amongst all of the icons.

Everything is done, however, I do still want to fix the Word Wrap icon and possibly another icon or two. I'm hoping to submit the PR tomorrow (Thurs.) as long as all goes well.

But for today, I really wanted to show how things look right now. Please view at 100% to see at it's best.

npp-fluent

@ozone10
Copy link
Contributor Author

ozone10 commented Jun 6, 2024

@WildByDesign
Looks good, but aren't icons for folder as workspace switched?

@WildByDesign
Copy link
Contributor

WildByDesign commented Jun 6, 2024

Yes, you are right. I did have the following briefly:

npp-fluent-workspace

Do you prefer this one with the desktop and toolbox?

EDIT: I got rid of the desktop with the toolbox icon after a brief time because the little toolbox was blurry on certain DPI. I was able to resolve that problem and keep the toolbox sharp on all DPI now. Therefore, I have brought this icon back now. I also like it better because the desktop and toolbox better symbolizes folder as a workspace. Thanks for bringing this up.

@WildByDesign
Copy link
Contributor

WildByDesign commented Jun 7, 2024

Alright I've got the new PR (#15253) submitted now. A lot of hand crafted attention was put into the symmetry between all icons.

I have compiled this into my build and tested at 100%, 125% and 150% scaling all on dark mode. I need somebody to further test more scaling scenarios in light mode as well.

I can easily update any of the icons individually as needed.

@ozone10 Have you done a commit since 8.6.7 that affects the highlighting (hot track?) of toolbar icons?

I must have missed that commit when browsing through. But what a nice surprise! It caught my attention immediately and looks fantastic. It seems to resolve the Windows 11 (blue highlighting in dark mode) issue and looks incredible. Cheers to that!

EDIT: I found it. You fixed it with PR fedaabf and I must have skipped over it since it referenced pressed state. But it also obviously fixed the mouse over highlight as well. So you effectively and properly fixed this issue (#10510) which originally had a simple workaround to revert the icons when hovered over or pressed I believe.

Question: Is this fix something that the LibreOffice developers could reasonably do? They still suffer from that toolbar icon blue highlighting in dark mode on Windows 11.

@WildByDesign
Copy link
Contributor

One thing that I have wanted to tackle for a long time now is the Close button on the tabs. As far as I know, that is still BMP format and has issues with scalability and is wonky with the whole transparent background and such.

Is it possible to change the Close button on the tabs to ICO format?

I would also have more creative freedom to make it extra special. The BMPs for the Close buttons on the tabs always presented weird issues for me in the past and limited what I wanted to really do with them.

@WildByDesign
Copy link
Contributor

@ozone10

btw Search result panel does not have fluent icon image

Sorry for the barrage of messages, but I don't want to forget some of these details.

npp-fluent-results

Do any of these represent the Search Results icon well? Which do you prefer?

Also, how can I see this Search Results panel in Notepad++?

I have tried all sorts of different search options and cannot figure out how to bring up that Search Results panel. Please let me know so that way I can see the icon in various scaling scenarios to ensure that I'm doing it right. Thank you.

@donho
Copy link
Member

donho commented Jun 7, 2024

@WildByDesign

Do any of these represent the Search Results icon well? Which do you prefer?

They are gorgeous! I would say the 1st ones. What do you think @ozone10 ?

Also, how can I see this Search Results panel in Notepad++?

Step 1:

image

Step 2:

image

@ozone10
Copy link
Contributor Author

ozone10 commented Jun 7, 2024

@WildByDesign

Question: Is this fix something that the LibreOffice developers could reasonably do? They still suffer from that toolbar icon blue highlighting in dark mode on Windows 11.

if they use win32 they can use custom draw

Could you check Show all characters small icons, it looks strange for me.

Close button ...

I quiet busy now, but eventually I would like to replace all BMP files.

Meanwhile you can work on main tabbar and panels tabbar and toolbar (there was recent commit which replaced BMP with ICO) icons, since they use ICO files

Do any of these represent the Search Results icon well? Which do you prefer?

Personally I like the 3rd one. It looks similar to current standard.

Also, how can I see this Search Results panel in Notepad++?

Open Find dialog and press Find All in current Document @donho was faster

@ozone10
Copy link
Contributor Author

ozone10 commented Jun 7, 2024

@WildByDesign
it's almost unnoticeable but could you move icons little to the right, except for document list which could be moved little to left for symmetry.

@WildByDesign
Copy link
Contributor

WildByDesign commented Jun 7, 2024

Thank you both for your quick and thorough responses, I appreciate it.

if they use win32 they can use custom draw

I've heard that they use the Qt framework, so they may be out of luck unfortunately.

Could you check Show all characters small icons, it looks strange for me.

I see what you mean. The Show All Characters icon is quite blurry for the 16x16 icons for some reason. I will fix that.

Personally I like the 3rd one. It looks similar to current standard.

I agree with you. I think that the 3rd one represents the overall icon set.

it's almost unnoticeable but could you move icons little to the right, except for document list which could be moved little to left for symmetry.

Yes, I see what you mean and I can fix those quite easily. I just have to shift some of the SVGs over a pixel or two. Everything after that is completely scripted and automated now.

It was definitely worthwhile to create the scripts to export the SVGs to PNG, then stuff the PNGs into ICO files automatically named according to the Notepad++ icon filenames.

@WildByDesign
Copy link
Contributor

@ozone10 I have found something interesting under 100%, 125% and 150% scaling. All of those (and likely higher scaling) all add 1 extra pixel of space on the right side of each icon, within the square that is drawn around each icon.

Top, bottom and left do not have an added pixel of space. But in a scenarios, a single pixel of space is added on the right of each icon, but within the square.

For example, on my 125% scaling system using 20x20, the inner section of each icon box drawn is 25x24 pixels. Including the frame is 27x26.

This gives the impression that each icon is slightly off.

Now, there were definitely some icons that legitimately needed to be moved to the right by 1 pixel. And the document list icon needed to be moved to the left by 1 pixel. However, the majority of the icons can't be moved over because they cover the entire space (left to right). So in many cases, I can't adjust them for this extra 1 pixel of space.

Do you know if this is something that can be fixed?

I just checked a build from a few weeks ago, and in that case the extra space was being added on the left. I don't understand the programming aspect of this.

@WildByDesign
Copy link
Contributor

I just did some more testing regarding the issue with the box drawn around the icons to get more details to share.

20x20 pixel icon as SVG and PNG and ICO

  • space referring to padding between icon and inner side of box drawn around icon
Space on left	2
Space on right	2

20x20 pixel icon in Notepad++

Space of left	4
Space on right	5

20x20 pixel icon as SVG and PNG and ICO (shift padding to account for extra pixel)

  • space referring to padding between icon and inner side of box drawn around icon
Space on left	3
Space on right	1

20x20 pixel icon in Notepad++

Space of left	5
Space on right	4

So my thought process was that since we had a perfectly centered icon with 2 px space on each side evenly, I would simply shift the icon spacing so that it was moved over to account for that extra pixel of space being added to the right.

It should have worked, but we end up with an extra pixel of space on the left side now. Icons with a perfect amount of pixels in size and space cannot be aligned evenly (horizontally) at the moment. I can't even wrap my mind around the mathematics of this.

I'm really not sure how to proceed with the horizontal symmetry of the icons right now.

@WildByDesign
Copy link
Contributor

WildByDesign commented Jun 8, 2024

Sorry for the multiple comments in a row, again.

@ozone10 @donho I have a suggestion. I propose that we merge the PR (#15253) as is.

Once it is merged, I can do separate (and smaller) PRs to address individual icon issues. For example, I can do a separate PR for the Show All Characters icon, Document List icon and possibly a few others to address horizontal alignment.

I just feel a lot of weight on my shoulders when I keep recreating the big PR with 188 icon files spread across 4 directories and I worry that I might make a mistake. Right now, I know that PR is proper and correct. Although as noted, I will have to follow up with one or two smaller PRs to fix a few icons.

I still haven't had time to learn Git and therefore I'm just uploading the icons through the Github web site and creating the PR that way at the moment.

What do you guys think?

If it gets merged, I can follow up with the smaller fixes today also.

EDIT: Here is the PR (#15256) for the Show All Characters icon fix.

@donho
Copy link
Member

donho commented Jun 8, 2024

@WildByDesign
PR (#15253) has been merged.
However, PR (#15256) is not due to the conflict.
Could you update your master, create a new branch and redo the PR please?

@WildByDesign
Copy link
Contributor

Thanks @donho
Here is the updated PR (#15259) to fix the Show All Characters icon.

@donho
Copy link
Member

donho commented Jun 9, 2024

@WildByDesign
Merged. Thank you!

@WildByDesign
Copy link
Contributor

WildByDesign commented Jun 9, 2024

@donho You're welcome.

@ozone10 I will come back to the horizontal alignment of toolbar icons once we can figure out that issue with the 1 pixel added to the right of all toolbar icons. But for now, I am working on the icons for tab bar and toolbars from docking panels and docking panels tab bar.

I ran into another weird scaling issue while working on that Search Results (findResult.ico) icon. The original icon is 16x16.

I created 16, 20, 24 and 48 pixel icons within the new ICO. Here is what I am seeing:

Scaling		Dimensions	Using
		in NPP		Icon

100		14x14		16
125		17x17		20
150		20x20		24

The Dimensions in NPP refers to what is visually showing within Notepad++.

For example, at 100% scaling, the 16px icon is being scaled down to 14px.
At 125% scaling, the 20px icon is being scaled down to 17px.
At 150% scaling, the 24px icon is being scaled down to 20px.

The weird thing is, the ICO contains a 20px icon yet it still scales the 24px down to 20px instead of using the 20px.

So as you can imagine, all scaling scenarios look terrible.

I will attach an example ICO to this comment so that you can test.

findResult.zip

Until this is resolved, I will try working on the Function List docking panel icons to see if they are scaling correctly or not.

EDIT: The docking panel icons such as funclstReload.ico all display in the correct dimensions, which is great news. So I can move forward and work on those now. They do suffer from the same 1 pixel space on the right issue that the main toolbar icons suffer from though.

@ozone10
Copy link
Contributor Author

ozone10 commented Jun 10, 2024

@WildByDesign
currently I am very busy, so I won't be able to answer immediately or do PR.

Panel's tabbar icons are still using non-dpi api so it's normal what you are observing.
Except for search results, icons use size 14x14. I will look into if 16x16 can be used instead.

For 1 px to right this is also normal. Icon has size 16x16 and we are setting button to size 16x16 for this same size OS cannot add padding. By standard toolbar button width is usually 1-2 px larger than height and padding will center icon.
That additional 1 px IMHO is used because when you press button there is offset, without 1 px icon will be "cut".

So mainly modify document list icons.

@ozone10
Copy link
Contributor Author

ozone10 commented Jun 10, 2024

@WildByDesign
PR #15267 should help with loading correct icon sizes. But docking panels still require a lot of work.

@WildByDesign
Copy link
Contributor

@ozone10

That additional 1 px IMHO is used because when you press button there is offset, without 1 px icon will be "cut".

That is interesting and I never realized that. All these years of using Notepad++ and I never noticed that the icon moved over 1 pixel to simulate the button being pressed. That makes sense. I can work with that and align the icons as best as possible to accomodate.

PR #15267 should help with loading correct icon sizes. But docking panels still require a lot of work.

I've compiled my local build based on this PR. It has slightly changed the display size of the icons, but it seems that the sizes still quite aren't as expected.

Scaling		Dimensions	After
		in NPP		PR15267

100		14x14		14x14
125		17x17		18x18
150		20x20		21x21

@ozone10
Copy link
Contributor Author

ozone10 commented Jun 11, 2024

@WildByDesign
I did not change icon size to not affect current looks, because Notepad++ currently use one size ico files, it still uses 14x14.

You can change size by yourself

constexpr int g_dockingContTabIconSize = 14;

@WildByDesign
Copy link
Contributor

I apologize for the confusion on my part. Initially, I misunderstood which icons that PR was targeting. I kept focusing on the Search Results icon and panel which was clearly not part of that PR.

Now I understand which icons and I can go ahead and complete most icons tonight which is exciting.

@WildByDesign
Copy link
Contributor

I did not change icon size to not affect current looks, because Notepad++ currently use one size ico files, it still uses 14x14.

You can change size by yourself

constexpr int g_dockingContTabIconSize = 14;

This is working perfectly. The icons are displaying as 16, 20, 24, etc. and looking sharp and beautiful.

I can submit a PR for this 14 to 16 base pixel change later today along with all of your the updated icons. They are all done but I am reviewing them in all scaling scenarios first before submitting the PR which should be today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants