gdk/win32: annotate gdk_win32_surface_get_handle
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 23 Aug 2022 12:25:30 +0000 (16:25 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 23 Aug 2022 12:25:33 +0000 (16:25 +0400)
And adjust the argument precondition check.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
gdk/win32/gdksurface-win32.c
gdk/win32/gdkwin32misc.h

index bd4183eb0bc04e7706d4718557e7a8c8a4365d8d..79f2b9dd0539b1ea0b60015cd8d78ad26acf12d7 100644 (file)
@@ -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
index 1bab4ec404021acae6cc7d5a923e11722ae74d5a..7497ee593e953535a52e9d077dd07b6f113112a3 100644 (file)
@@ -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,