[gnome-robots/arnaudb/wip/gtk4: 20/45] Replace GdkWindow by GdkSurface.




commit 193d6e1ad9786211731a17b2d8084cd00c47c8b2
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon May 25 15:51:55 2020 +0200

    Replace GdkWindow by GdkSurface.

 src/cursors.c | 10 +++++-----
 src/cursors.h |  4 ++--
 src/game.c    |  5 ++++-
 3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/cursors.c b/src/cursors.c
index 6a85f17..cba97ef 100644
--- a/src/cursors.c
+++ b/src/cursors.c
@@ -86,22 +86,22 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 void
-set_cursor_default (GdkWindow * window)
+set_cursor_default (GdkSurface * surface)
 {
-  gdk_window_set_cursor (window, default_cursor);
+  gdk_surface_set_cursor (surface, default_cursor);
 }
 
 void
-set_cursor_by_direction (GdkWindow * window, int dx, int dy)
+set_cursor_by_direction (GdkSurface * surface, int dx, int dy)
 {
   int index;
 
   if (game_state != STATE_PLAYING) {
-    set_cursor_default (window);
+    set_cursor_default (surface);
     return;
   }
 
   index = 3 * dy + dx + 4;
 
-  gdk_window_set_cursor (window, cursor_list[index].cursor);
+  gdk_surface_set_cursor (surface, cursor_list[index].cursor);
 }
diff --git a/src/cursors.h b/src/cursors.h
index 620ae70..b9ba2f3 100644
--- a/src/cursors.h
+++ b/src/cursors.h
@@ -23,7 +23,7 @@
 #define CURSORS_H
 
 void make_cursors (void);
-void set_cursor_default (GdkWindow * window);
-void set_cursor_by_direction (GdkWindow * window, int dx, int dy);
+void set_cursor_default (GdkSurface * surface);
+void set_cursor_by_direction (GdkSurface * surface, int dx, int dy);
 
 #endif
diff --git a/src/game.c b/src/game.c
index 6931f42..b3adb63 100644
--- a/src/game.c
+++ b/src/game.c
@@ -1350,11 +1350,14 @@ move_cb (GtkEventControllerMotion *controller,
          gdouble                   y,
          gpointer                  user_data)
 {
+  GtkNative* native;
   int dx, dy;
 
   get_dir ((int)x, (int)y, &dx, &dy);
 
-  set_cursor_by_direction (gtk_widget_get_window (game_area), dx, dy);
+  native = gtk_widget_get_native (game_area);
+
+  set_cursor_by_direction (gtk_native_get_surface (native), dx, dy);
 
   return;
 }


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