Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-10

Scaling of menuitem icons

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

Hi

When higher DPI setting is used on Windows, Lazarus IDE appears to obey nicely. All icons are also scaled, together with texts.

On my Linux + KDE system however icons of the IDE's main menuitems do not scale. In KDE settings panel -> Fonts I set the "Force font's DPI" value to 144 which is about 150%.
Then I start lazarus and everything is scaled including menu texts but not the icons beside them. Icons everywhere else like in the IDE Coolbar and component palette are scaled. Editor toolbar also has scaled icons and the exact same icons show smaller in the main menu. This happens with both GTK2 and QT bindings.
Could somebody please test with other desktop / window manager systems. Who knows the High DPI code well enough to fix the issue?

I wanted to take a screenshot but the IDE's menus always close when Spectacle (screeshot app) takes it. This is another bug somewhere. Menus of well behaving KDE apps, for example Kate's, do not close.

Juha

Reply by email

Ondrej Pokorny
  On my Linux + KDE system however icons of the IDE's main menuitems

do not scale.

In KDE settings panel -> Fonts I set the "Force font's DPI" value to

144 which is about 150%.

I remember I worked on it:

1.) Gtk2: I added support for Gtk2. See screenshot. It works well for me if I use "xrandr --dpi 144x144" as it is suggested in http://wiki.lazarus.freepascal.org/High_DPI

Your settings revealed a bug in Gtk2 bindings. Patch is attached.

2.) Qt: I wasn't able to add support of high-resolution icons in menus under Qt. My conclusion was that either Qt itself or LCL-Qt bindings do not support big icons in menus. When I used the correct size icon in the menu it was always (badly) downscaled to 16x16 pixels.

Greetings
Ondrej

-------------- next part --------------
Index: lcl/interfaces/gtk2/gtk2winapi.inc
=================================================================== --- lcl/interfaces/gtk2/gtk2winapi.inc (revision 59319) +++ lcl/interfaces/gtk2/gtk2winapi.inc (working copy) @@ -4723,10 +4723,10 @@

   //we will also have to add internal support for Papersizes etc..
   LOGPIXELSX : { Logical pixels per inch in X }
-    Result := RoundToInt(gdk_screen_width / (GetScreenWidthMM / 25.4));
+    Result := ScreenInfo.PixelsPerInchX;
   LOGPIXELSY : { Logical pixels per inch in Y }
-    Result := RoundToInt(gdk_screen_height / (GetScreenHeightMM / 25.4));
+    Result := ScreenInfo.PixelsPerInchY;

SIZEPALETTE: { number of entries in color palette }

     if GetVisual then

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Laz-Gtk2.png
Type: image/png
Size: 41634 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20181019/157e4b53/attachment-0001.png>

Reply by email

zeljko
to Ondrej Pokorny
Ondrej Pokorny wrote 17 lines
>  On my Linux + KDE system however icons of the IDE's main menuitems do not scale. > In KDE settings panel -> Fonts I set the "Force font's DPI" value to 144 which is about 150%. I remember I worked on it: 1.) Gtk2: I added support for Gtk2. See screenshot. It works well for me if I use "xrandr --dpi 144x144" as it is suggested in http://wiki.lazarus.freepascal.org/High_DPI Your settings revealed a bug in Gtk2 bindings. Patch is attached. 2.) Qt: I wasn't able to add support of high-resolution icons in menus under Qt. My conclusion was that either Qt itself or LCL-Qt bindings do not support big icons in menus. When I used the correct size icon in the menu it was always (badly) downscaled to 16x16 pixels.

Probably the only solution is to use QProxyStyle class. There's no QProxyStyle class in Qt4/Qt5 C bindings and to fix this problem it should be implemented with it's overrides. QProxyStyle can return any size for PM_SmallIconSize, but in that case we should know what's the current size of "normal" icons in LCL.

zeljko

Reply by email

Ondrej Pokorny
to zeljko
zeljko wrote
QProxyStyle can return any size for PM_SmallIconSize, but in that case we should know what's the current size of "normal" icons in LCL.

The current size of "normal" icons in LCL is perfectly known, as well as the size of any menu icon in LCL. Call the TMenuItem.GetIconSize function to get it.

Ondrej

Reply by email

zeljko
to Ondrej Pokorny
Ondrej Pokorny wrote 7 lines
On 19.10.2018 11:43, zeljko wrote: > QProxyStyle can return any size for PM_SmallIconSize, but in that case > we should know what's the current size of "normal" icons in LCL. The current size of "normal" icons in LCL is perfectly known, as well as the size of any menu icon in LCL. Call the TMenuItem.GetIconSize function to get it.

Tnx

zeljko

Reply by email