GTK3 Theming modGTK3 Resolves layout corruption under ALL Linux Distros

  1. ‹ Older
  2. last year

    Tim J

    29 Sep 2018 Pre-Release Testers N. Phoenix, AZ

    ... and, I changed the name :P

  3. Jürg O

    30 Sep 2018 Pre-Release Testers, Xojo Pro Answer

    Since 2017r2, Xojo uses GTK3 for Linux. The default GTK3 Controls are quite big. That makes a cross platform layout quite difficult.
    This example Xojo project shows how one can style Controls using CSS in Xojo-built Applications. The example is trying to just set a minimal amount of styles, so that Controls can be sized at .Height=26 and look good on most Linux distributions.
    This is achieved in two steps: A global theme, and some tweaks for a couple of Controls.

    Many thanks to @jim m for digging in the deeper details providing the CSS live editor, which makes it so much more convenient to try different style adjustments!

    The example Xojo project includes a Module modGTK3. All the required Declares and Styles are in there. If you intend to use it in your own projects, have a look at where the global theme is set, and where/how the Control tweaks are set:

    1. App.Open -> modGTK3.InitGlobalGTK3Style()
    2. Control.Open -> me.InitGTK3Control()

    Note: modGTK3 extends InitGTK3Control for Controls. In this example project, it's called from Control Subclasses. Subclassing your Controls is highly recommended anyway, as you get a single place for tweaks and workarounds for different XojoVersions or BuildTargets.

  4. Jürg O

    30 Sep 2018 Pre-Release Testers, Xojo Pro

    You're probably wondering about the reply above ;)
    The main reason is that I usually don't keep my DropBox links alive for long... so I've moved the example project to a Webserver, where my "Xojo - some pieces 4u" are available.

    @Tim J I've also asked @Jason P to pin this conversation in the Linux target section.

    Since it is (for now), maybe you could mark it as the answer? So a link to the example project is right on top.

  5. Tim J

    30 Sep 2018 Pre-Release Testers N. Phoenix, AZ

    @Jürg O Since it is (for now), maybe you could mark it as the answer? So a link to the example project is right on top.

    Done!

  6. Garry P

    3 Oct 2018 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    Such a fantastic job with this module. Well done!

  7. jim m

    3 Oct 2018 Pre-Release Testers, Xojo Pro piDog.com

    Hey guys. I did a bunch more work on this (kind of got lost in it over the weekend)

    I eliminated the need to subclass controls by adding handlers for the GtkWidget and GtkEntry classes 'map' signals. All controls' height will be set to be at least their default 'min-height' property (not the css value) and all GtkEntries will have char-width set to zero.

    Added conditional parsing for the CSS. #IF - #END IF style

    I added a css nodes viewer and a GtkWidget properties viewer.

    I put up a BitBucket of the project . Please take a look and add css for any quirks you find for specific distro's, OS's, Desktops and Xojo versions. (Syntax is very simple and explained in the readme.)

    Be sure to add the init methods before any windows are shown or the 'map' signals will be missed.

  8. 5 months ago

    Is this still working? When I add the mod following the instructions, I get an error when compiling:

    GtkCssParsingErrorInfo.LastParsingError Declaration
    There is no class with this name
    Shared LastParsingError As modGTK3.GtkCssParsingErrorInfo

  9. jim m

    Jul 5 Pre-Release Testers, Xojo Pro piDog.com

    That's a very strange error...
    Did you open the modGtk3.xojo_project and copy the module from there or drag it from the downloaded folder?

  10. Tim J

    Jul 5 Pre-Release Testers N. Phoenix, AZ

    Did you add the full module to your project? It should look something like this is the Navigator:

    -image-

  11. @jim m That's a very strange error...
    Did you open the modGtk3.xojo_project and copy the module from there or drag it from the downloaded folder?

    I cannot open that, it ask immediately for the location of "Build Automation.xojo_code",which is nowhere to be found.

  12. jim m

    Jul 6 Pre-Release Testers, Xojo Pro piDog.com

    It looks like Build Automation was added to my gitignore file and not uploaded. I've fixed the problem.

  13. @jim m It looks like Build Automation was added to my gitignore file and not uploaded. I've fixed the problem.

    Great, it compiles now error free. Thanks for updating it!

  14. jim m

    Jul 7 Pre-Release Testers, Xojo Pro piDog.com

    Since you got me looking at the project, I've updated the repo to fix a 64bit bug in the demo and to improve tab panel handling to hopefully align contents correctly and aviod clipping.

  15. Massimo V

    Jul 7 Pre-Release Testers, Xojo Pro Europe (Germany, Würzburg)
    Edited 5 months ago

    @Ivan T As my second post states, GTK is NOT designed to work in a fixed layout like apps in windows or Mac. So, the only way Xojo could fix this problem is to implement and expose the GTK native containers. But, doing that, they will break the multiplatform compatibility of the layout designer. So, not an easy solution.

    But, Maybe if Xojo implement GTK in ALL 3 desktop platforms...

    • Lots of contros out of the box for xojo
    • Great Layout widgets to make modern interfaces
    • Awesome performance with hardware accelerated drawing
    • Consistency in all the 3 platforms
    • Cairo Drawing could be used to add PDF capabilities
    • Xojo team will focus in 1 UI instead of 3
    • Apps with themes in all the platforms.
    • Etc

    Feedback Case 52860 - Implement the full GTK widget set and Cairo drawings on all 3 platforms for better multiplatform compatibility

    Gimp On Windows
    -image-

    Gimp On Linux
    -image-

    Gimp On Mac
    -image-

    New Gimp style On Windows
    -image-

    New Gimp style On Windows other theme
    -image-

    Feedback Case 52860 - Implement the full GTK widget set and Cairo drawings on all 3 platforms for better multiplatform compatibility

    I think the idea of using GTK on Mac and Windows would spoil the whole idea of Xojo using native UI.
    And while on Windows this can be doable due there is much more UI look & feel fragmentation, this would be a disaster on Mac. Does someone notice on Mac it looks UGLY?

    I personally don't want my Mac applications looking like that and if Xojo would ever think to implement this, I would probably search for alternatives. There are other cross platform environments around, but all of them fail on the UI due to non native controls, etc.
    This is one of biggest plus of Xojo. It looks great on all platforms.

  16. Garry P

    Jul 8 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    I personally don't want my Mac applications looking like that and if Xojo would ever think to implement this, I would probably search for alternatives. There are other cross platform environments around, but all of them fail on the UI due to non native controls, etc.
    This is one of biggest plus of Xojo. It looks great on all platforms.

    Whilst the concept of native GUI controls for each OS is great in practice we actually get the lowest common denominator because there are so many differences between the three desktop platforms. For example, this is probably why we still don’t have a date picker control without having to spend additional money for a third party solution.

    Additionally, because Xojo don’t provide that many controls themselves (because they have to cater for all three platforms with three different GUI toolkits) developers end up with non-native canvas-based hacks to simulate what has already been implemented in a cross-platform toolkit like GTK3.

    Personally, I would have no problem at all if Xojo decided to support GTK3 on all three platforms. That would actually speed up development time for me. Much of my debugging time is spent fixing weird GUI glitches between platforms which would probably be solved if there was just one underlying toolkit. I find the logic side of my apps tends to “just work” as advertised by Xojo but the GUI side is often broken.

    Additionally, even as a die hard macOS user, I really don’t mind the look of GTK3.

    Just my two cents.

  17. Tim J

    Jul 8 Pre-Release Testers N. Phoenix, AZ

    @Massimo V I think the idea of using GTK on Mac and Windows would spoil the whole idea of Xojo using native UI.

    But ... if you look at modern Mac apps, you'll discover that they really aren't adhering to any specific look and feel outside of a design that works for them - even Apple's own apps.

  18. Norman P

    Jul 17 Pre-Release Testers, Xojo Pro under THE bus

    @jim m Since you got me looking at the project, I've updated the repo to fix a 64bit bug in the demo and to improve tab panel handling to hopefully align contents correctly and aviod clipping.

    Can you add the build automation item even if its empty to the repo ?
    Otherwise you get an error opening the project

  19. Massimo V

    Jul 17 Pre-Release Testers, Xojo Pro Europe (Germany, Würzburg)

    @Tim J But ... if you look at modern Mac apps, you'll discover that they really aren't adhering to any specific look and feel outside of a design that works for them - even Apple's own apps.

    This is true but only at a limited extent.
    One fact is partly not respecting the UI guidelines, which even Apple do sometimes. A completely different fact is having controls looking and behaving in a fully different way than the native ones. On Mac this is very noticeable, much more than on Windows where the UX fragmentation is much higher.
    Every Mac user who used a Java or Qt made application can easily confirm this. Even the most naive user can tell you a such application "looks weird".

    And about modern apps I have the feeling the trend is now to have a better UX, as much as possible consistent with the native OS UX. The past years IMHO this was too often sacrificed on the altar of the cross platform development. The web also played a role on this, in a way.

    So again, one of the strong pros of Xojo is the native UI, with all the limitations it brings, of course. One of the first arguments on pushing Xojo in companies is leveraging exactly the fact Xojo can do something no others can do, except the native development system, being it .NET or Cocoa. For Linux it's a completely different story, due the fragmentation is stellar, so it's basically not a problem for most Linux users.

  20. Norman P

    Jul 18 Pre-Release Testers, Xojo Pro under THE bus

    @Massimo V Every Mac user who used a Java or Qt made application can easily confirm this. Even the most naive user can tell you a such application "looks weird".

    electron based apps

  21. Massimo V

    Jul 18 Pre-Release Testers, Xojo Pro Europe (Germany, Würzburg)

    Electron is the worst one, not only because of the UI/UX but also because it's bloated.
    But Qt applications, might be good in term of performance and everything else, just the UI is totally alien to a Mac user.

or Sign Up to reply!