[gtk: 4/10] gdk/win32: annotate gdk_win32_surface_get_handle




commit 3cbf6c9d6e05ad3e89daabab1e51eba1f1072926
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Tue Aug 23 16:25:30 2022 +0400

    gdk/win32: annotate gdk_win32_surface_get_handle
    
    And adjust the argument precondition check.
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 gdk/win32/gdksurface-win32.c | 18 +++++++++++-------
 gdk/win32/gdkwin32misc.h     |  2 +-
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index bd4183eb0b..79f2b9dd05 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -4621,16 +4621,20 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
   impl_class->compute_size = _gdk_win32_surface_compute_size;
 }
 
+/**
+ * gdk_win32_surface_get_handle:
+ * @surface: (type GdkWin32Surface): a native `GdkSurface`.
+ *
+ * Returns the HWND handle belonging to @surface.
+ *
+ * Returns: the associated HWND handle.
+ */
 HWND
-gdk_win32_surface_get_handle (GdkSurface *window)
+gdk_win32_surface_get_handle (GdkSurface *surface)
 {
-  if (!GDK_IS_WIN32_SURFACE (window))
-    {
-      g_warning (G_STRLOC " window is not a native Win32 window");
-      return NULL;
-    }
+  g_return_val_if_fail (GDK_IS_WIN32_SURFACE (surface), NULL);
 
-  return GDK_SURFACE_HWND (window);
+  return GDK_SURFACE_HWND (surface);
 }
 
 #define LAST_PROP 1
diff --git a/gdk/win32/gdkwin32misc.h b/gdk/win32/gdkwin32misc.h
index 1bab4ec404..7497ee593e 100644
--- a/gdk/win32/gdkwin32misc.h
+++ b/gdk/win32/gdkwin32misc.h
@@ -78,7 +78,7 @@ GDK_AVAILABLE_IN_ALL
 gpointer      gdk_win32_handle_table_lookup (HWND handle);
 /* Translate from window to Windows handle */
 GDK_AVAILABLE_IN_ALL
-HWND          gdk_win32_surface_get_handle (GdkSurface *window);
+HWND          gdk_win32_surface_get_handle (GdkSurface *surface);
 
 GDK_AVAILABLE_IN_ALL
 GdkSurface *   gdk_win32_surface_lookup_for_display (GdkDisplay *display,


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