GDK W32: Fix idiotic gdk_win32_display_get_monitor() implementation

Replace the code borrowed from the X11 backend with the code borrowed from Wayland backend. Now GTK doesn't crash when the number of monitors is zero.
This commit is contained in:
Руслан Ижбулатов 2017-01-20 09:08:41 +00:00
parent bbcc3ee456
commit a7ff95ce73

View File

@ -1108,10 +1108,10 @@ gdk_win32_display_get_monitor (GdkDisplay *display,
{ {
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display); GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
if (0 <= monitor_num || monitor_num < win32_display->monitors->len) if (monitor_num < 0 || monitor_num >= win32_display->monitors->len)
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num); return NULL;
return NULL; return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num);
} }
static GdkMonitor * static GdkMonitor *