gdk_display_get_monitor_at_surface can return a NULL without documenting it
Steps to reproduce
Don't have a solid reproducer but managed to get my system into that state by disconnecting a laptop from a docking station and plugging a TV to it via HDMI. A GTK4 app was then launched from a container. Stopping and starting the container did not change the behaviour.
Current behavior
I have the following snippet in an application:
gtk_widget_show (GTK_WIDGET (main_window));
native = gtk_widget_get_native (GTK_WIDGET (main_window));
surface = gtk_native_get_surface (native);
display = gdk_surface_get_display (surface);
monitor = gdk_display_get_monitor_at_surface (display, surface);
where gdk_display_get_monitor_at_surface (display, surface)
returns NULL
which is not mentioned to be possible in the documentation. main_window
, native
, surface
and display
are all valid existing widgets/objects.
Expected outcome
Either for gdk_display_get_monitor_at_surface
to document that NULL can be returned or adjust the method to always return a valid GdkMonitor
.
Version information
- GTK 4.6.6 (
gtk4-4.6.6-1.fc36.x86_64
) - Fedora 36 (Container image)