[gtk+/gtk-3-22] GDK W32: Fix idiotic gdk_win32_display_get_monitor() implementation



commit a7ff95ce73420e92cc280287513b98316525740f
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Fri Jan 20 09:08:41 2017 +0000

    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.

 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 4bc88fb..5219636 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 *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]