diff options
author | Руслан Ижбулатов <lrn1986@gmail.com> | 2017-01-20 09:08:41 +0000 |
---|---|---|
committer | Руслан Ижбулатов <lrn1986@gmail.com> | 2017-01-20 09:08:41 +0000 |
commit | a7ff95ce73420e92cc280287513b98316525740f (patch) | |
tree | e2902b9e059d9266b78e802d364d1af6871697ac /gdk/win32 | |
parent | bbcc3ee45643ccdc25bc525b4d7f7daf6b25440a (diff) | |
download | gtk+-a7ff95ce73420e92cc280287513b98316525740f.tar.gz |
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.
Diffstat (limited to 'gdk/win32')
-rw-r--r-- | gdk/win32/gdkdisplay-win32.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index 4bc88fb1ef..5219636547 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -1108,10 +1108,10 @@ gdk_win32_display_get_monitor (GdkDisplay *display, { GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display); - if (0 <= monitor_num || monitor_num < win32_display->monitors->len) - return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num); + if (monitor_num < 0 || monitor_num >= win32_display->monitors->len) + return NULL; - return NULL; + return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num); } static GdkMonitor * |