mir: set cursor

This commit is contained in:
William Hua 2014-11-03 11:46:45 -05:00 committed by Ryan Lortie
parent f60b2a11c5
commit 2fdb266c0d
2 changed files with 85 additions and 5 deletions

View File

@ -317,9 +317,7 @@ static GdkCursor *
gdk_mir_display_get_cursor_for_type (GdkDisplay *display, gdk_mir_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type) GdkCursorType cursor_type)
{ {
//g_printerr ("gdk_mir_display_get_cursor_for_type (%u)\n", cursor_type); return _gdk_mir_cursor_new (display, cursor_type);
/* We don't support configurable cursors */
return g_object_ref (GDK_MIR_DISPLAY (display)->cursor);
} }
static GdkCursor * static GdkCursor *

View File

@ -552,13 +552,95 @@ gdk_mir_window_impl_reparent (GdkWindow *window,
return FALSE; return FALSE;
} }
static const gchar *
get_cursor_name_for_cursor_type (GdkCursorType cursor_type)
{
switch (cursor_type)
{
case GDK_BLANK_CURSOR:
return mir_disabled_cursor_name;
case GDK_X_CURSOR:
case GDK_ARROW:
case GDK_CENTER_PTR:
case GDK_DRAFT_LARGE:
case GDK_DRAFT_SMALL:
case GDK_LEFT_PTR:
case GDK_RIGHT_PTR:
case GDK_TOP_LEFT_ARROW:
return mir_arrow_cursor_name;
case GDK_CLOCK:
case GDK_WATCH:
return mir_busy_cursor_name;
case GDK_XTERM:
return mir_caret_cursor_name;
case GDK_HAND1:
case GDK_HAND2:
return mir_pointing_hand_cursor_name;
return mir_open_hand_cursor_name;
case GDK_FLEUR:
return mir_closed_hand_cursor_name;
case GDK_LEFT_SIDE:
case GDK_LEFT_TEE:
case GDK_RIGHT_SIDE:
case GDK_RIGHT_TEE:
case GDK_SB_LEFT_ARROW:
case GDK_SB_RIGHT_ARROW:
return mir_horizontal_resize_cursor_name;
case GDK_BASED_ARROW_DOWN:
case GDK_BASED_ARROW_UP:
case GDK_BOTTOM_SIDE:
case GDK_BOTTOM_TEE:
case GDK_DOUBLE_ARROW:
case GDK_SB_DOWN_ARROW:
case GDK_SB_UP_ARROW:
case GDK_TOP_SIDE:
case GDK_TOP_TEE:
return mir_vertical_resize_cursor_name;
case GDK_BOTTOM_LEFT_CORNER:
case GDK_LL_ANGLE:
case GDK_TOP_RIGHT_CORNER:
case GDK_UR_ANGLE:
return mir_diagonal_resize_bottom_to_top_cursor_name;
case GDK_BOTTOM_RIGHT_CORNER:
case GDK_LR_ANGLE:
case GDK_SIZING:
case GDK_TOP_LEFT_CORNER:
case GDK_UL_ANGLE:
return mir_diagonal_resize_top_to_bottom_cursor_name;
return mir_omnidirectional_resize_cursor_name;
case GDK_SB_V_DOUBLE_ARROW:
return mir_vsplit_resize_cursor_name;
case GDK_SB_H_DOUBLE_ARROW:
return mir_hsplit_resize_cursor_name;
default:
return mir_default_cursor_name;
}
}
static void static void
gdk_mir_window_impl_set_device_cursor (GdkWindow *window, gdk_mir_window_impl_set_device_cursor (GdkWindow *window,
GdkDevice *device, GdkDevice *device,
GdkCursor *cursor) GdkCursor *cursor)
{ {
//g_printerr ("gdk_mir_window_impl_set_device_cursor window=%p\n", window); const gchar *cursor_name;
/* We don't support cursors yet... */ MirCursorConfiguration *configuration;
if (cursor)
cursor_name = get_cursor_name_for_cursor_type (gdk_cursor_get_cursor_type (cursor));
else
cursor_name = mir_default_cursor_name;
configuration = mir_cursor_configuration_from_name (cursor_name);
if (configuration)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
if (impl->surface)
mir_surface_configure_cursor (impl->surface, configuration);
mir_cursor_configuration_destroy (configuration);
}
} }
static void static void