Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: Ewl.h.in ewl_attach.h ewl_embed.c ewl_embed.h ewl_entry.c ewl_enums.h ewl_paned.c Log Message: - add mouse cursor support to ewl - this is based off of a patch by chaos - ewl_entry and ewl_paned both take advantage of the cursors - adding a cursor is as simple as ewl_attach_mouse_cursor_set(Ewl_Widget *, int cursor); where the int cursor is one of the EWL_WIDGET_* entries in ewl_enums.h - still need to add custom cursors, but they'll be done with something like ewl_attach_mouse_cursor_custom_set that takes a const char *image or something =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/Ewl.h.in,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- Ewl.h.in 31 Dec 2005 06:03:36 -0000 1.27 +++ Ewl.h.in 31 Jan 2006 05:11:58 -0000 1.28 @@ -258,6 +258,8 @@ #include <Evas.h> #include <Ecore.h> #include <Ecore_Data.h> +#include <Ecore_X.h> +#include <Ecore_X_Cursor.h> #include <ewl_enums.h> =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_attach.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_attach.h 12 Jan 2006 18:21:18 -0000 1.3 +++ ewl_attach.h 31 Jan 2006 05:11:59 -0000 1.4 @@ -37,6 +37,15 @@ #define ewl_attach_tooltip_widget_set(w, data) \ ewl_attach_widget_set(w, EWL_ATTACH_TYPE_TOOLTIP, data) + +/** + * @def ewl_attach_pointer_set(w, data) + * Convience method to set a pointer widget attachment + */ +#define ewl_attach_mouse_cursor_set(w, data) \ + ewl_attach_other_set(w, EWL_ATTACH_TYPE_MOUSE_CURSOR, \ + (int *)ecore_x_cursor_shape_get(data)) + /** * @def ewl_attach_color_set(w, data) * Convience method to set a colour widget attachment =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -3 -r1.45 -r1.46 --- ewl_embed.c 20 Jan 2006 14:16:55 -0000 1.45 +++ ewl_embed.c 31 Jan 2006 05:11:59 -0000 1.46 @@ -662,13 +662,12 @@ */ while (embed->last.mouse_in && (widget != embed->last.mouse_in) && !ewl_widget_parent_of(embed->last.mouse_in, widget)) { + ewl_embed_mouse_cursor_set(embed->last.mouse_in); + ewl_object_state_remove(EWL_OBJECT(embed->last.mouse_in), EWL_FLAG_STATE_MOUSE_IN); ewl_callback_call(embed->last.mouse_in, EWL_CALLBACK_MOUSE_OUT); - /*It's possible that the call to MOUSE_IN caused the 'embed->last.mouse_in' - * to have become null. Make sure this pointer is still here - * An example of this behaviour is FOCUS_OUT in ewl_menu */ if (embed->last.mouse_in) embed->last.mouse_in = embed->last.mouse_in->parent; } @@ -690,6 +689,8 @@ */ if (!(ewl_object_state_has(EWL_OBJECT(embed->last.mouse_in), EWL_FLAG_STATE_MOUSE_IN))) { + ewl_embed_mouse_cursor_set(embed->last.mouse_in); + ewl_object_state_add(EWL_OBJECT(embed->last.mouse_in), EWL_FLAG_STATE_MOUSE_IN); ewl_callback_call_with_event_data(embed->last.mouse_in, @@ -1459,6 +1460,29 @@ } void +ewl_embed_mouse_cursor_set(Ewl_Widget *w) +{ + Ecore_X_Cursor pointer; + Ewl_Embed *embed; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); + DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); + + embed = ewl_embed_widget_find(w); + if (!embed) DRETURN(DLEVEL_STABLE); + + if ((pointer = (Ecore_X_Cursor)ewl_attach_get(w, + EWL_ATTACH_TYPE_MOUSE_CURSOR))) + ecore_x_window_cursor_set((Ecore_X_Window)embed->evas_window, pointer); + else + ecore_x_window_cursor_set((Ecore_X_Window)embed->evas_window, + ecore_x_cursor_shape_get(EWL_MOUSE_CURSOR_LEFT_PTR)); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +void ewl_embed_realize_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ewl_embed.h 12 Jan 2006 18:21:18 -0000 1.12 +++ ewl_embed.h 31 Jan 2006 05:11:59 -0000 1.13 @@ -130,6 +130,8 @@ void ewl_embed_coord_to_screen(Ewl_Embed *e, int xx, int yy, int *x, int *y); +void ewl_embed_mouse_cursor_set(Ewl_Widget *w); + /* * Internally used callbacks, override at your own risk. */ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_entry.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -3 -r1.45 -r1.46 --- ewl_entry.c 12 Jan 2006 18:21:18 -0000 1.45 +++ ewl_entry.c 31 Jan 2006 05:11:59 -0000 1.46 @@ -64,6 +64,9 @@ ewl_widget_internal_set(e->cursor, TRUE); ewl_object_fill_policy_set(EWL_OBJECT(e->cursor), EWL_FLAG_FILL_SHRINK); + /* Set the pointer */ + ewl_attach_mouse_cursor_set(EWL_WIDGET(e), EWL_MOUSE_CURSOR_XTERM); + /* this has to be called after the cursor is created as it will try * to show the cursor */ ewl_entry_editable_set(e, TRUE); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_enums.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- ewl_enums.h 31 Dec 2005 06:03:36 -0000 1.32 +++ ewl_enums.h 31 Jan 2006 05:11:59 -0000 1.33 @@ -355,7 +355,8 @@ { EWL_ATTACH_TYPE_TOOLTIP, EWL_ATTACH_TYPE_COLOR, - EWL_ATTACH_TYPE_NAME + EWL_ATTACH_TYPE_NAME, + EWL_ATTACH_TYPE_MOUSE_CURSOR }; typedef enum Ewl_Attach_Type Ewl_Attach_Type; @@ -417,6 +418,83 @@ }; typedef enum Ewl_Freebox_Layout_Type Ewl_Freebox_Layout_Type; +#define EWL_MOUSE_CURSOR_X 0 +#define EWL_MOUSE_CURSOR_ARROW 2 +#define EWL_MOUSE_CURSOR_BASED_ARROW_DOWN 4 +#define EWL_MOUSE_CURSOR_UP 6 +#define EWL_MOUSE_CURSOR_BOAT 8 +#define EWL_MOUSE_CURSOR_BOTTOM_LEFT_CORNER 12 +#define EWL_MOUSE_CURSOR_BOTTOM_RIGHT_CORNER 14 +#define EWL_MOUSE_CURSOR_BOTTOM_SIDE 16 +#define EWL_MOUSE_CURSOR_BOTTOM_TEE 18 +#define EWL_MOUSE_CURSOR_BOX_SPIRAL 20 +#define EWL_MOUSE_CURSOR_CENTER_PTR 22 +#define EWL_MOUSE_CURSOR_CIRCLE 24 +#define EWL_MOUSE_CURSOR_CLOCK 26 +#define EWL_MOUSE_CURSOR_COFFEE_MUG 28 +#define EWL_MOUSE_CURSOR_CROSS 30 +#define EWL_MOUSE_CURSOR_CROSS_REVERSE 32 +#define EWL_MOUSE_CURSOR_CROSSHAIR 34 +#define EWL_MOUSE_CURSOR_DIAMOND_CROSS 36 +#define EWL_MOUSE_CURSOR_DOT 38 +#define EWL_MOUSE_CURSOR_DOT_BOX_MASK 40 +#define EWL_MOUSE_CURSOR_DOUBLE_ARROW 42 +#define EWL_MOUSE_CURSOR_DRAFT_LARGE 44 +#define EWL_MOUSE_CURSOR_DRAFT_SMALL 46 +#define EWL_MOUSE_CURSOR_DRAPED_BOX 48 +#define EWL_MOUSE_CURSOR_EXCHANGE 50 +#define EWL_MOUSE_CURSOR_FLEUR 52 +#define EWL_MOUSE_CURSOR_GOBBLER 54 +#define EWL_MOUSE_CURSOR_GUMBY 56 +#define EWL_MOUSE_CURSOR_HAND1 58 +#define EWL_MOUSE_CURSOR_HAND2 60 +#define EWL_MOUSE_CURSOR_HEART 62 +#define EWL_MOUSE_CURSOR_ICON 64 +#define EWL_MOUSE_CURSOR_IRON_CROSS 66 +#define EWL_MOUSE_CURSOR_LEFT_PTR 68 +#define EWL_MOUSE_CURSOR_LEFT_SIDE 70 +#define EWL_MOUSE_CURSOR_LEFT_TEE 72 +#define EWL_MOUSE_CURSOR_LEFTBUTTON 74 +#define EWL_MOUSE_CURSOR_LL_ANGLE 76 +#define EWL_MOUSE_CURSOR_LR_ANGLE 78 +#define EWL_MOUSE_CURSOR_MAN 80 +#define EWL_MOUSE_CURSOR_MIDDLEBUTTON 82 +#define EWL_MOUSE_CURSOR_MOUSE 84 +#define EWL_MOUSE_CURSOR_PENCIL 86 +#define EWL_MOUSE_CURSOR_PIRATE 88 +#define EWL_MOUSE_CURSOR_PLUS 90 +#define EWL_MOUSE_CURSOR_QUESTION_ARROW 92 +#define EWL_MOUSE_CURSOR_RIGHT_PTR 94 +#define EWL_MOUSE_CURSOR_RIGHT_SIDE 96 +#define EWL_MOUSE_CURSOR_RIGHT_TEE 98 +#define EWL_MOUSE_CURSOR_RIGHTBUTTON 100 +#define EWL_MOUSE_CURSOR_RTL_LOGO 102 +#define EWL_MOUSE_CURSOR_SAILBOAT 104 +#define EWL_MOUSE_CURSOR_SB_DOWN_ARROW 106 +#define EWL_MOUSE_CURSOR_SB_H_DOUBLE_ARROW 108 +#define EWL_MOUSE_CURSOR_SB_LEFT_ARROW 110 +#define EWL_MOUSE_CURSOR_SB_RIGHT_ARROW 112 +#define EWL_MOUSE_CURSOR_SB_UP_ARROW 114 +#define EWL_MOUSE_CURSOR_SB_V_DOUBLE_ARROW 116 +#define EWL_MOUSE_CURSOR_SHUTTLE 118 +#define EWL_MOUSE_CURSOR_SIZING 120 +#define EWL_MOUSE_CURSOR_SPIDER 122 +#define EWL_MOUSE_CURSOR_SPRAYCAN 124 +#define EWL_MOUSE_CURSOR_STAR 126 +#define EWL_MOUSE_CURSOR_TARGET 128 +#define EWL_MOUSE_CURSOR_TCROSS 130 +#define EWL_MOUSE_CURSOR_TOP_LEFT_ARROW 132 +#define EWL_MOUSE_CURSOR_TOP_LEFT_CORNER 134 +#define EWL_MOUSE_CURSOR_TOP_RIGHT_CORNER 136 +#define EWL_MOUSE_CURSOR_TOP_SIDE 138 +#define EWL_MOUSE_CURSOR_TOP_TEE 140 +#define EWL_MOUSE_CURSOR_TREK 142 +#define EWL_MOUSE_CURSOR_UL_ANGLE 144 +#define EWL_MOUSE_CURSOR_UMBRELLA 146 +#define EWL_MOUSE_CURSOR_UR_ANGLE 148 +#define EWL_MOUSE_CURSOR_WATCH 150 +#define EWL_MOUSE_CURSOR_XTERM 152 + /** * @} */ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_paned.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- ewl_paned.c 12 Jan 2006 18:21:19 -0000 1.16 +++ ewl_paned.c 31 Jan 2006 05:11:59 -0000 1.17 @@ -201,11 +201,15 @@ { o = ewl_vseparator_new(); ewl_widget_appearance_set(o, "grabber/vertical"); + ewl_attach_mouse_cursor_set(o, + EWL_MOUSE_CURSOR_SB_H_DOUBLE_ARROW); } else { o = ewl_hseparator_new(); ewl_widget_appearance_set(o, "grabber/horizontal"); + ewl_attach_mouse_cursor_set(o, + EWL_MOUSE_CURSOR_SB_V_DOUBLE_ARROW); } ewl_widget_internal_set(o, TRUE); ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs