Object size and spacing in Linux vs Windows

HI all, I have an application where the same code runs in both Windows and Linux. I’ve noticed a significant difference in display object size and spacing when running the application in Windows vs Linux even though the dimensions are the same. Windows object sizes (i.e. bevel button, text field, rectangle, etc.) and the spacing between objects seems about 30%-40% larger than in Linux. Screen resolution settings are the same in both environments. This is making it very difficult to manage realestate. In Windows, the headings section of a window is taking up two much space and the listbox below the heading is two small (I manually adjust listbox sizes on Open). If I reduce object sizes and spacing in Windows then in Linux they display almost on top of each other. How do you manage this difference in size and spacing? Am I missing something? I hope you don’t have to size and space every object based on OS!! Thoughts?

Screenshots? Xojo version? Windows vs. Linux versions or flavor? Example?

Isn’t there a checkbox to adjust control sizes for Linux somewhere?

This was the case but for Linux only, some years ago. Then I never fired my Linux VM again, so I do not know the current situation…

A solution is to adapt the values to a Control (SUb-class it, then set your preferences values) and set all occurences of that Control to that Super…

Check the Blog (I THINK THERE WAS AN ENTRY FOR THAT).

Linux Manjaro:

Windows 11:

Xojo version 2022 v2

Manjaro:

I do have code that sets the horizontal spacing and placement of these objects based on percentages of the rectangle the objects are in but nothing to set the height of objects or vertical distance.

Also, I did notice in windows the entire height of the popup menus do not show. This accounts for some of the difference in appearance in of the popups.

I build for Linux but most users have Windows or Mac. But I have noticed differences - also depends on the various flavors of Linux. Also newer versions of Xojo seem to handle Linux better.

I created this fixup method that I call from most windows in the Open (or Opening) event. Call it like this:

Call AdjustControls(Self)
Public Sub AdjustControls(w As window)
  For i As Integer 0 To w.ControlCount-1
    #If TargetLinux Then
      If (w.Control(i) IsA PopupMenu) Then
        PopupMenu(w.Control(i)).Height = PopupMenu(w.Control(i)).Height + 6
        PopupMenu(w.Control(i)).Top = PopupMenu(w.Control(i)).Top -2 // just a little tweak
      End
      If (w.Control(i) IsA BevelButton) Then
        ' If parent is not a window then icon needs adjustment
        If Not (BevelButton(w.Control(i)).Parent IsA Window) Then
          BevelButton(w.Control(i)).IconDX = -18
          BevelButton(w.Control(i)).IconDY = -10
        End
      End
      ' PushButtons are too tall on Linux but changes to the height or font size are ignored
      'If (w.Control(i) IsA PushButton) Then
      'PushButton(w.Control(i)).Height = 22
      'End If
    #Endif
  Next
End Sub

1 Like

I remember writing a routine just like that when I first tried to get a Linux version of some software working from a good Mac/windows version. I remember creating a feature request quite some time ago. I doubt it is still around.

Do you use “normalize control sizes”?

1 Like

That looks like what I was asking for in the feature request, all that time ago. Pity I don’t have a need for it anymore (retired).

Yes, it seems to align text better when I switch that on. What does that switch do anyway?

Maybe this info found in the Docs helps a bit: Calling native Linux APIs — Xojo documentation