[Lazarus] Scaling of menuitem icons

Ondrej Pokorny lazarus at kluug.net
Fri Oct 19 10:15:53 CEST 2018

 >  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 

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.


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

More information about the Lazarus mailing list