From: TimePath Date: Fri, 21 Jul 2017 16:26:53 +0000 (+1000) Subject: Wrap gtkutil/cursor X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2c72b6c4c150177c2d853b2b79c98976c9dcb9b8;p=xonotic%2Fnetradiant.git Wrap gtkutil/cursor --- 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;