Menu

#3 wGetDisplaySize() not working

closed
None
2025-10-22
2025-10-22
No

I'm working my way thru start up and the next problem I hit is wGetDisplaySize()
It fails because gdk_scrren_get_primary_monitor() returns NULL
This generates about 10 GTK-Warnings before we hit the main loop

Discussion

  • Martin Fischer

    Martin Fischer - 2025-10-22

    Comment by Adam

    As I understand it the gdk_screen_get_primary_monitor() will be null if not set and that will be true if there is only one physical screen. There is also discussion of bug where it returns null even if set up for some Linux variants.

    The suggestion in these cases is to get the list of GDKList of GdkMonitor objects for the default screen and use the first one (often the only one).

    Get the default display and screen

    display = Gdk.Display.get_default()
    screen = display.get_default_screen()

    Get the list of monitors

    monitors = display.get_monitors()

     
  • Martin Fischer

    Martin Fischer - 2025-10-22

    As a workaround the older version using gdk_screen_get_monitor_geometry is used. gdk_screen_get_monitor_geometry is deprecated so at some time should be replaced using the approach described here.

     
  • Martin Fischer

    Martin Fischer - 2025-10-22
    • status: open --> closed
    • assigned_to: Martin Fischer
     

Log in to post a comment.

MongoDB Logo MongoDB