From 2c72b6c4c150177c2d853b2b79c98976c9dcb9b8 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 22 Jul 2017 02:26:53 +1000 Subject: [PATCH] Wrap gtkutil/cursor --- libs/gtkutil/cursor.cpp | 4 ++-- libs/gtkutil/cursor.h | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libs/gtkutil/cursor.cpp b/libs/gtkutil/cursor.cpp index 490c34fd..f123854d 100644 --- a/libs/gtkutil/cursor.cpp +++ b/libs/gtkutil/cursor.cpp @@ -31,13 +31,13 @@ GdkCursor* create_blank_cursor(){ return gdk_cursor_new(GDK_BLANK_CURSOR); } -void blank_cursor( GtkWidget* widget ){ +void blank_cursor( ui::Widget widget ){ GdkCursor* cursor = create_blank_cursor(); gdk_window_set_cursor( gtk_widget_get_window(widget), cursor ); gdk_cursor_unref( cursor ); } -void default_cursor( GtkWidget* widget ){ +void default_cursor( ui::Widget widget ){ gdk_window_set_cursor( gtk_widget_get_window(widget), 0 ); } diff --git a/libs/gtkutil/cursor.h b/libs/gtkutil/cursor.h index a4d9873a..d5d5d339 100644 --- a/libs/gtkutil/cursor.h +++ b/libs/gtkutil/cursor.h @@ -29,11 +29,10 @@ #include "debugging/debugging.h" typedef struct _GdkCursor GdkCursor; -typedef struct _GtkWidget GtkWidget; GdkCursor* create_blank_cursor(); -void blank_cursor( GtkWidget* widget ); -void default_cursor( GtkWidget* widget ); +void blank_cursor( ui::Widget widget ); +void default_cursor( ui::Widget widget ); void Sys_GetCursorPos( ui::Window window, int *x, int *y ); void Sys_SetCursorPos( ui::Window window, int x, int y ); @@ -65,7 +64,7 @@ void motion( gdouble x, gdouble y, guint state ){ m_handler = g_idle_add( (GSourceFunc)deferred, this ); } } -static gboolean gtk_motion( GtkWidget *widget, GdkEventMotion *event, DeferredMotion* self ){ +static gboolean gtk_motion( ui::Widget widget, GdkEventMotion *event, DeferredMotion* self ){ self->motion( event->x, event->y, event->state ); return FALSE; } @@ -119,7 +118,7 @@ void* m_data; public: FreezePointer() : handle_motion( 0 ), m_function( 0 ), m_data( 0 ){ } -static gboolean motion_delta( GtkWidget *widget, GdkEventMotion *event, FreezePointer* self ){ +static gboolean motion_delta( ui::Widget widget, GdkEventMotion *event, FreezePointer* self ){ int current_x, current_y; Sys_GetCursorPos( ui::Window(GTK_WINDOW( widget )), ¤t_x, ¤t_y ); int dx = current_x - self->last_x; -- 2.39.2