#include <gdk/gdk.h>
#include <gtk/gtk.h>
-
GdkCursor* create_blank_cursor(){
- return gdk_cursor_new(GDK_BLANK_CURSOR);
+ return gdk_cursor_new( GDK_BLANK_CURSOR );
}
-void blank_cursor( ui::Widget widget ){
- GdkCursor* cursor = create_blank_cursor();
- gdk_window_set_cursor( gtk_widget_get_window(widget), cursor );
+void set_cursor( ui::Widget widget, GdkCursorType cursor_type ){
+ GdkCursor* cursor = gdk_cursor_new( cursor_type );
+ gdk_window_set_cursor( gtk_widget_get_window( widget ), cursor );
gdk_cursor_unref( cursor );
}
-void default_cursor( ui::Widget widget ){
- gdk_window_set_cursor( gtk_widget_get_window(widget), 0 );
+void blank_cursor( ui::Widget widget ){
+ set_cursor( widget, GDK_BLANK_CURSOR );
}
+void default_cursor( ui::Widget widget ){
+ gdk_window_set_cursor( gtk_widget_get_window( widget ), NULL );
+}
void Sys_GetCursorPos( ui::Window window, int *x, int *y ){
gdk_display_get_pointer( gdk_display_get_default(), 0, x, y, 0 );
#if !defined( INCLUDED_GTKUTIL_CURSOR_H )
#define INCLUDED_GTKUTIL_CURSOR_H
+#include <gdk/gdk.h>
#include <uilib/uilib.h>
#include "debugging/debugging.h"
typedef struct _GdkEventMotion GdkEventMotion;
GdkCursor* create_blank_cursor();
+void set_cursor( ui::Widget widget, GdkCursorType cursor_type );
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 );
-
-
class DeferredMotion
{
guint m_handler;
#include "gtkutil/widget.h"
#include "gtkutil/glwidget.h"
#include "gtkutil/filechooser.h"
+#include "gtkutil/cursor.h"
#include "gtkmisc.h"
#include "select.h"
#include "csg.h"
Vector3 mousePosition;
XY_ToPoint( x, y, mousePosition );
if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) {
- GdkCursor *cursor;
- cursor = gdk_cursor_new( GDK_CROSSHAIR );
- gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor );
- gdk_cursor_unref( cursor );
+ set_cursor ( m_gl_widget, GDK_CROSSHAIR );
}
else
{
- gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), 0 );
+ default_cursor( m_gl_widget );
}
}