Ecore_Win32: add support of X11 shaped cursors

@feature
This commit is contained in:
Vincent Torri 2015-10-16 07:08:09 +02:00 committed by Nicolas Aguirre
parent 24984131d7
commit c6cb13934a
4 changed files with 5769 additions and 3 deletions

View File

@ -116,6 +116,91 @@ typedef enum
ECORE_WIN32_CURSOR_SHAPE_WAIT /**< Hourglass */
} Ecore_Win32_Cursor_Shape;
/**
* @typedef Ecore_Win32_Cursor_X11_Shape
* Shape of an X11 cursor.
*/
typedef enum
{
ECORE_WIN32_CURSOR_X11_SHAPE_X,
ECORE_WIN32_CURSOR_X11_SHAPE_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_BASED_ARROW_DOWN,
ECORE_WIN32_CURSOR_X11_SHAPE_UP,
ECORE_WIN32_CURSOR_X11_SHAPE_BOAT,
ECORE_WIN32_CURSOR_X11_SHAPE_BOGOSITY,
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_LEFT_CORNER,
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_RIGHT_CORNER,
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_SIDE,
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_TEE,
ECORE_WIN32_CURSOR_X11_SHAPE_BOX_SPIRAL,
ECORE_WIN32_CURSOR_X11_SHAPE_CENTER_PTR,
ECORE_WIN32_CURSOR_X11_SHAPE_CIRCLE,
ECORE_WIN32_CURSOR_X11_SHAPE_CLOCK,
ECORE_WIN32_CURSOR_X11_SHAPE_COFFEE_MUG,
ECORE_WIN32_CURSOR_X11_SHAPE_CROSS,
ECORE_WIN32_CURSOR_X11_SHAPE_CROSS_REVERSE,
ECORE_WIN32_CURSOR_X11_SHAPE_CROSSHAIR,
ECORE_WIN32_CURSOR_X11_SHAPE_DIAMOND_CROSS,
ECORE_WIN32_CURSOR_X11_SHAPE_DOT,
ECORE_WIN32_CURSOR_X11_SHAPE_DOT_BOX_MASK,
ECORE_WIN32_CURSOR_X11_SHAPE_DOUBLE_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_DRAFT_LARGE,
ECORE_WIN32_CURSOR_X11_SHAPE_DRAFT_SMALL,
ECORE_WIN32_CURSOR_X11_SHAPE_DRAPED_BOX,
ECORE_WIN32_CURSOR_X11_SHAPE_EXCHANGE,
ECORE_WIN32_CURSOR_X11_SHAPE_FLEUR,
ECORE_WIN32_CURSOR_X11_SHAPE_GOBBLER,
ECORE_WIN32_CURSOR_X11_SHAPE_GUMBY,
ECORE_WIN32_CURSOR_X11_SHAPE_HAND1,
ECORE_WIN32_CURSOR_X11_SHAPE_HAND2,
ECORE_WIN32_CURSOR_X11_SHAPE_HEART,
ECORE_WIN32_CURSOR_X11_SHAPE_ICON,
ECORE_WIN32_CURSOR_X11_SHAPE_IRON_CROSS,
ECORE_WIN32_CURSOR_X11_SHAPE_LEFT_PTR,
ECORE_WIN32_CURSOR_X11_SHAPE_LEFT_SIDE,
ECORE_WIN32_CURSOR_X11_SHAPE_LEFT_TEE,
ECORE_WIN32_CURSOR_X11_SHAPE_LEFTBUTTON,
ECORE_WIN32_CURSOR_X11_SHAPE_LL_ANGLE,
ECORE_WIN32_CURSOR_X11_SHAPE_LR_ANGLE,
ECORE_WIN32_CURSOR_X11_SHAPE_MAN,
ECORE_WIN32_CURSOR_X11_SHAPE_MIDDLEBUTTON,
ECORE_WIN32_CURSOR_X11_SHAPE_MOUSE,
ECORE_WIN32_CURSOR_X11_SHAPE_PENCIL,
ECORE_WIN32_CURSOR_X11_SHAPE_PIRATE,
ECORE_WIN32_CURSOR_X11_SHAPE_PLUS,
ECORE_WIN32_CURSOR_X11_SHAPE_QUESTION_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHT_PTR,
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHT_SIDE,
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHT_TEE,
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHTBUTTON,
ECORE_WIN32_CURSOR_X11_SHAPE_RTL_LOGO,
ECORE_WIN32_CURSOR_X11_SHAPE_SAILBOAT,
ECORE_WIN32_CURSOR_X11_SHAPE_SB_DOWN_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_SB_H_DOUBLE_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_SB_LEFT_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_SB_RIGHT_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_SB_UP_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_SB_V_DOUBLE_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_SHUTTLE,
ECORE_WIN32_CURSOR_X11_SHAPE_SIZING,
ECORE_WIN32_CURSOR_X11_SHAPE_SPIDER,
ECORE_WIN32_CURSOR_X11_SHAPE_SPRAYCAN,
ECORE_WIN32_CURSOR_X11_SHAPE_STAR,
ECORE_WIN32_CURSOR_X11_SHAPE_TARGET,
ECORE_WIN32_CURSOR_X11_SHAPE_TCROSS,
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_LEFT_ARROW,
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_LEFT_CORNER,
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_RIGHT_CORNER,
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_SIDE,
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_TEE,
ECORE_WIN32_CURSOR_X11_SHAPE_TREK,
ECORE_WIN32_CURSOR_X11_SHAPE_UL_ANGLE,
ECORE_WIN32_CURSOR_X11_SHAPE_UMBRELLA,
ECORE_WIN32_CURSOR_X11_SHAPE_UR_ANGLE,
ECORE_WIN32_CURSOR_X11_SHAPE_WATCH,
ECORE_WIN32_CURSOR_X11_SHAPE_XTERM,
} Ecore_Win32_Cursor_X11_Shape;
/**
* @typedef Ecore_Win32_DnD_State
* State of a DnD operation.
@ -563,6 +648,8 @@ EAPI void ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor);
EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape);
EAPI Ecore_Win32_Cursor *ecore_win32_cursor_x11_shaped_new(Ecore_Win32_Cursor_X11_Shape shape);
EAPI void ecore_win32_cursor_size_get(int *width, int *height);

View File

@ -10,6 +10,7 @@
#include "Ecore_Win32.h"
#include "ecore_win32_private.h"
#include "ecore_win32_cursor_x11.c"
/*============================================================================*
* Local *
@ -157,7 +158,11 @@
* };
*
* Ecore_Win32_Cursor *cursor = ecore_win32_cursor_new(pixels_and, pixels_xor, 32, 32, 19, 2);
* ecore_win32_window_cursor_set(window, cursor);
* @endcode
*
* @see ecore_win32_cursor_free()
* @see ecore_win32_window_cursor_set()
*/
EAPI Ecore_Win32_Cursor *
ecore_win32_cursor_new(const void *pixels_and,
@ -199,13 +204,19 @@ ecore_win32_cursor_new(const void *pixels_and,
* @param cursor The cursor to free.
*
* This function free @p cursor. @p cursor must have been obtained
* with ecore_win32_cursor_new().
* with ecore_win32_cursor_new() or ecore_win32_cursor_x11_shaped_new().
*
* @see ecore_win32_cursor_new()
* @see ecore_win32_cursor_x11_shaped_new()
*/
EAPI void
ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor)
{
INF("destroying cursor");
if (!cursor)
return;
DestroyCursor(cursor);
}
@ -217,7 +228,7 @@ ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor)
*
* This function returns a pre-defined cursor with a specified
* @p shape. This cursor does not need to be freed, as it is loaded
* from an existing resource.
* from an existing resource. On error @c NULL is returned.
*/
EAPI Ecore_Win32_Cursor *
ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape)
@ -281,6 +292,36 @@ ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape)
return cursor;
}
/**
* @brief Create a X11 cursor from a X Id.
*
* @param[in] shape The defined X11 shape of the cursor.
* @return The new cursor.
*
* This function returns a defined cursor with a specified X11
* @p shape. Once the cursor is not used anymore, use
* ecore_win32_cursor_free() to free the ressources.
*
* @see ecore_win32_cursor_free()
*
* @since 1.16
*/
EAPI Ecore_Win32_Cursor *
ecore_win32_cursor_x11_shaped_new(Ecore_Win32_Cursor_X11_Shape shape)
{
INF("getting X11 shape cursor");
if ((shape < ECORE_WIN32_CURSOR_X11_SHAPE_X) ||
(shape > ECORE_WIN32_CURSOR_X11_SHAPE_XTERM))
return NULL;
return ecore_win32_cursor_new(_ecore_win32_cursors_x11[shape].mask_and,
_ecore_win32_cursors_x11[shape].mask_xor,
32, 32,
_ecore_win32_cursors_x11[shape].hotspot_x,
_ecore_win32_cursors_x11[shape].hotspot_y);
}
/**
* @brief Retrieve the size of a valid cursor.
*

File diff suppressed because it is too large Load Diff

View File

@ -1436,8 +1436,13 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
*
* This function sets @p cursor to @p window. @p cursor must have been
* obtained by ecore_win32_cursor_new() or
* ecore_win32_cursor_shaped_new(). If @p window or @p cursor is
* ecore_win32_cursor_shaped_new() or
* ecore_win32_cursor_x11_shaped_new(). If @p window or @p cursor is
* @c NULL, the function does nothing.
*
* @see ecore_win32_cursor_new()
* @see ecore_win32_cursor_shaped_new()
* @see ecore_win32_cursor_x11_shaped_new()
*/
EAPI void
ecore_win32_window_cursor_set(Ecore_Win32_Window *window,