Hi,
Attached are two files, the ecore.evas.c_ecore_evas_x_cursor.pxi which should
be 'cvs add'ed to
e17/proto/python-efl/python-ecore/ecore/evas/
and the efl.patch which is a patch containing the following changes :
python-ecore.evas :
- Adds a method for setting the cursor of the window (using an Ecore_X_Cursor,
or a shape)
- Adds X_Cursor class containing the values of each cursor shape available
The cursor_set_shape and cursor_set_x_cursor functions depend on the window_get
property of the
derived classes, so it should work with the available classes apart from the
ecore.evas.FB one
which doesn't implement it (but the FB one doesn't even seem to work). I don't
know how to check for
the existence of that property...
These functions are necessary for the use of Etk_Embed widgets, since we need
to register a callback
for changing the cursor manually (for entries for example).
The second changes in that patch are for Etk, it does a few things...
- Removed etk_combobox_entry_popup_feed from the header since the function
seems non-existent
- Added etk_embed_new_from_ecore_evas to create the Etk_Embed directly from the
Ecore_Evas, and no need
for the user to implement and manually set the position_method and the
pointer_method.
- Adds a second embed window to the etk_test_embed because I found some bugs
that only happen when
you have several embed widgets in the same Evas.
- Fixes the bug with multiple Etk_Embed in the same Evas, the widget gets the
focus internally,
but never requests it to the Evas, so the Evas keeps sending the keyboard
events to the same
Evas_Object.
- Fixes the bug with multiple Etk_Embed in the same Evas, when we loose the
focus because another
Evas_Object received it, we must unfocus the currently focused widget in our
Etk_Embed.
The last three fixes were already sent to CodeWarrior by mail, but I don't know
if he got them into CVS
yet, so I'm sending them again (since 'cvs diff' says they're not).
I hope this gets into CVS soon.
Thanks,
KaKaRoTo
? proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas_x_cursor.pxi
Index: libs/etk/src/bin/etk_embed_test.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/bin/etk_embed_test.c,v
retrieving revision 1.13
diff -u -r1.13 etk_embed_test.c
--- libs/etk/src/bin/etk_embed_test.c 21 Aug 2007 15:04:53 -0000 1.13
+++ libs/etk/src/bin/etk_embed_test.c 6 Sep 2007 03:10:43 -0000
@@ -21,7 +21,9 @@
static Evas_Object *panel, *panel_top, *panel_shadow;
static Evas_Object *panel_clip;
static Evas_Object *embed_object;
+static Evas_Object *embed_object2;
static Etk_Widget *embed;
+static Etk_Widget *embed2;
static int win_w = 240, win_h = 320;
static unsigned int starting_time;
@@ -85,7 +87,14 @@
embed_object = etk_embed_object_get(ETK_EMBED(embed));
evas_object_clip_set(embed_object, panel_clip);
+ embed2 = _embed_widget_new(evas);
+ etk_embed_position_method_set(ETK_EMBED(embed2), _embed_position_set, ecore_evas);
+ etk_embed_pointer_method_set(ETK_EMBED(embed2), _embed_pointer_set, ecore_evas);
+ embed_object2 = etk_embed_object_get(ETK_EMBED(embed2));
+ evas_object_clip_set(embed_object2, panel_clip);
+
etk_widget_size_request(embed, &min_size);
+ min_size.h *= 2;
ecore_evas_resize(ecore_evas, min_size.w + 50, min_size.h + 120);
ecore_evas_size_min_set(ecore_evas, min_size.w + 50, min_size.h + 120);
@@ -229,6 +238,10 @@
etk_widget_size_request(embed, &embed_size);
evas_object_move(embed_object, (win_w - embed_size.w) / 2, y + 20);
evas_object_resize(embed_object, embed_size.w, embed_size.h);
+
+ etk_widget_size_request(embed2, &embed_size);
+ evas_object_move(embed_object2, (win_w - embed_size.w) / 2, y + 20 + embed_size.h);
+ evas_object_resize(embed_object2, embed_size.w, embed_size.h);
}
/* Gets the position of the Evas where the embed object belongs, relative to the screen */
Index: libs/etk/src/lib/etk_combobox_entry.h
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_combobox_entry.h,v
retrieving revision 1.4
diff -u -r1.4 etk_combobox_entry.h
--- libs/etk/src/lib/etk_combobox_entry.h 21 Aug 2007 15:04:54 -0000 1.4
+++ libs/etk/src/lib/etk_combobox_entry.h 6 Sep 2007 03:10:43 -0000
@@ -164,7 +164,6 @@
Etk_Bool etk_combobox_entry_is_popped_up(Etk_Combobox_Entry *combobox_entry);
void etk_combobox_entry_pop_up(Etk_Combobox_Entry *combobox_entry);
void etk_combobox_entry_pop_down(Etk_Combobox_Entry *combobox_entry);
-void etk_combobox_entry_popup_feed(Etk_Combobox_Entry *combobox_entry, Etk_Window *window);
/** @} */
Index: libs/etk/src/lib/etk_embed.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_embed.c,v
retrieving revision 1.9
diff -u -r1.9 etk_embed.c
--- libs/etk/src/lib/etk_embed.c 21 Aug 2007 15:04:54 -0000 1.9
+++ libs/etk/src/lib/etk_embed.c 6 Sep 2007 03:10:43 -0000
@@ -18,6 +18,10 @@
static void _etk_embed_size_get(Etk_Toplevel *toplevel, int *w, int *h);
static void _etk_embed_pointer_set(Etk_Toplevel *toplevel, Etk_Pointer_Type pointer_type);
+static void _etk_embed_ecore_evas_position_get(void *ecore_evas, int *x, int *y);
+static void _etk_embed_ecore_evas_pointer_set(void *ecore_evas, Etk_Pointer_Type pointer_type);
+
+
/**************************
*
* Implementation
@@ -79,6 +83,23 @@
}
/**
+ * @brief Creates a new embed widget in an Ecore_Evas
+ * @param ecore_evas the Ecore_Evas where the embed object should belong
+ * @return Returns the new embed widget, or NULL on failure (most probably because the Ecore_Evas is invalid)
+ */
+Etk_Widget *etk_embed_new_from_ecore_evas(Ecore_Evas *ecore_evas) {
+ Evas *evas = ecore_evas_get(ecore_evas);
+ Etk_Widget *embed = etk_embed_new(evas);
+
+ if (!embed) {
+ etk_embed_position_method_set(ETK_EMBED(embed), _etk_embed_ecore_evas_position_get, ecore_evas);
+ etk_embed_pointer_method_set(ETK_EMBED(embed), _etk_embed_ecore_evas_pointer_set, ecore_evas);
+ }
+
+ return embed;
+}
+
+/**
* @brief Gets the smart-object of the embed widget. This object can be manipulated like the other Evas objects,
* with evas_object_move(), evas_object_resize(), evas_object_clip_set(), ...
* @param embed an embed widget
@@ -177,6 +198,11 @@
}
}
+/* Default handler for getting the position of the embed widget from an Ecore_Evas */
+static void _etk_embed_ecore_evas_position_get(void *ecore_evas, int *x, int *y) {
+ ecore_evas_geometry_get(ecore_evas, x, y, NULL, NULL);
+}
+
/* Gets the size of the embed widget */
static void _etk_embed_size_get(Etk_Toplevel *toplevel, int *w, int *h)
{
@@ -195,6 +221,34 @@
embed->pointer_set(embed->pointer_data, pointer_type);
}
+/* Default handler for setting the current mouse pointer from an Ecore_Evas */
+static void _etk_embed_ecore_evas_pointer_set(void *ecore_evas, Etk_Pointer_Type pointer_type) {
+ Ecore_Evas *ee;
+ Ecore_X_Window window;
+ Ecore_X_Cursor cursor;
+ int x_pointer_type;
+
+ if (!(ee = ecore_evas) || (window = ecore_evas_software_x11_window_get(ee)) == 0)
+ return;
+
+ /* FIXME : We only support the "text_edit" and the default cursors here
+ * this should be enhanced to support other types of cursors */
+ switch (pointer_type)
+ {
+ case ETK_POINTER_TEXT_EDIT:
+ x_pointer_type = ECORE_X_CURSOR_XTERM;
+ break;
+ default:
+ x_pointer_type = ECORE_X_CURSOR_LEFT_PTR;
+ break;
+ }
+
+ if (pointer_type == ETK_POINTER_NONE)
+ ecore_x_window_cursor_set(window, 0);
+ else if ((cursor = ecore_x_cursor_shape_get(x_pointer_type)))
+ ecore_x_window_cursor_set(window, cursor);
+}
+
/** @} */
/**************************
Index: libs/etk/src/lib/etk_embed.h
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_embed.h,v
retrieving revision 1.7
diff -u -r1.7 etk_embed.h
--- libs/etk/src/lib/etk_embed.h 21 Aug 2007 15:04:54 -0000 1.7
+++ libs/etk/src/lib/etk_embed.h 6 Sep 2007 03:10:43 -0000
@@ -4,6 +4,9 @@
#include "etk_toplevel.h"
#include "etk_types.h"
+#include <Ecore_Evas.h>
+#include <Ecore_X.h>
+#include <Ecore_X_Cursor.h>
/* TODO/FIXME list:
* - Add a method to add copy/paste support
@@ -47,6 +50,7 @@
Etk_Type *etk_embed_type_get(void);
Etk_Widget *etk_embed_new(Evas *evas);
+Etk_Widget *etk_embed_new_from_ecore_evas(Ecore_Evas *ecore_evas);
Evas_Object *etk_embed_object_get(Etk_Embed *embed_widget);
void etk_embed_position_method_set(Etk_Embed *embed, void (*position_get)(void *position_data, int *x, int *y), void *position_data);
void etk_embed_pointer_method_set(Etk_Embed *embed, void (*pointer_set)(void *pointer_data, Etk_Pointer_Type pointer_type), void *pointer_data);
Index: libs/etk/src/lib/etk_widget.c
===================================================================
RCS file: /var/cvs/e/e17/libs/etk/src/lib/etk_widget.c,v
retrieving revision 1.120
diff -u -r1.120 etk_widget.c
--- libs/etk/src/lib/etk_widget.c 28 Aug 2007 20:06:32 -0000 1.120
+++ libs/etk/src/lib/etk_widget.c 6 Sep 2007 03:10:45 -0000
@@ -106,6 +106,8 @@
static void _etk_widget_mouse_down_cb(void *data, Evas *evas, Evas_Object *object, void *event_info);
static void _etk_widget_mouse_up_cb(void *data, Evas *evas, Evas_Object *object, void *event_info);
static void _etk_widget_mouse_wheel_cb(void *data, Evas *evas, Evas_Object *object, void *event_info);
+static void _etk_widget_focus_in_cb(void *data, Evas *evas, Evas_Object *object, void *event_info);
+static void _etk_widget_focus_out_cb(void *data, Evas *evas, Evas_Object *object, void *event_info);
static void _etk_widget_signal_mouse_down_cb(Etk_Object *object, Etk_Event_Mouse_Down *event, void *data);
static void _etk_widget_signal_key_down_cb(Etk_Object *object, Etk_Event_Key_Down *event, void *data);
@@ -428,6 +430,11 @@
if (!widget || !widget->toplevel_parent || !widget->focusable || etk_widget_disabled_get(widget))
return;
+
+ /* Make sure to set the focus on the smart object of the toplevel parent because if many
+ * Etk_Embed are on the same Evas, only one of them will be able to receive keyboard events */
+ evas_object_focus_set(ETK_WIDGET(widget->toplevel_parent)->smart_object, 1);
+
if ((focused = etk_toplevel_focused_widget_get(widget->toplevel_parent)) && (widget == focused))
return;
@@ -2337,6 +2344,33 @@
_etk_widget_mouse_wheel_cb(widget->parent, evas, NULL, event_info);
}
+/* Evas Callback: Called when the widget gets focused */
+static void _etk_widget_focus_in_cb(void *data, Evas *evas, Evas_Object *object, void *event_info)
+{
+ Etk_Widget *widget;
+
+ if (!(widget = ETK_WIDGET(data)))
+ return;
+}
+
+/* Evas Callback: Called when the widget loses focus */
+static void _etk_widget_focus_out_cb(void *data, Evas *evas, Evas_Object *object, void *event_info)
+{
+ Etk_Widget *widget;
+ Etk_Widget *focused;
+
+ if (!(widget = ETK_WIDGET(data)))
+ return;
+
+ if (!(focused = etk_toplevel_focused_widget_get(widget->toplevel_parent)))
+ return;
+
+ if (focused)
+ etk_widget_unfocus(focused);
+
+}
+
+
/* Signal Callback: Called when the user presses a key, if the widget is focused */
static void _etk_widget_signal_key_down_cb(Etk_Object *object, Etk_Event_Key_Down *event, void *data)
{
@@ -2417,6 +2451,8 @@
evas_object_event_callback_add(widget->smart_object, EVAS_CALLBACK_MOUSE_DOWN, _etk_widget_mouse_down_cb, widget);
evas_object_event_callback_add(widget->smart_object, EVAS_CALLBACK_MOUSE_UP, _etk_widget_mouse_up_cb, widget);
evas_object_event_callback_add(widget->smart_object, EVAS_CALLBACK_MOUSE_WHEEL, _etk_widget_mouse_wheel_cb, widget);
+ evas_object_event_callback_add(widget->smart_object, EVAS_CALLBACK_FOCUS_IN, _etk_widget_focus_in_cb, widget);
+ evas_object_event_callback_add(widget->smart_object, EVAS_CALLBACK_FOCUS_OUT, _etk_widget_focus_out_cb, widget);
if (widget->parent && widget->parent->smart_object)
_etk_widget_object_add_to_smart(widget->parent, widget->smart_object, (widget->clip == NULL));
Index: proto/python-efl/python-ecore/setup.py
===================================================================
RCS file: /var/cvs/e/e17/proto/python-efl/python-ecore/setup.py,v
retrieving revision 1.13
diff -u -r1.13 setup.py
--- proto/python-efl/python-ecore/setup.py 4 Sep 2007 18:50:39 -0000 1.13
+++ proto/python-efl/python-ecore/setup.py 6 Sep 2007 03:10:46 -0000
@@ -50,6 +50,7 @@
# 'ecore/evas/ecore.evas.c_ecore_evas_directfb.pxi',
'ecore/evas/ecore.evas.c_ecore_evas_buffer.pxi',
'ecore/evas/ecore.evas.c_ecore_evas_software_x11_16.pxi',
+ 'ecore/evas/ecore.evas.c_ecore_evas_x_cursor.pxi',
'ecore/python.pxd',
],
**pkgconfig('"ecore-evas >= 0.9.9.040"'))
Index: proto/python-efl/python-ecore/ecore/evas/__init__.py
===================================================================
RCS file: /var/cvs/e/e17/proto/python-efl/python-ecore/ecore/evas/__init__.py,v
retrieving revision 1.4
diff -u -r1.4 __init__.py
--- proto/python-efl/python-ecore/ecore/evas/__init__.py 2 Sep 2007 15:11:54 -0000 1.4
+++ proto/python-efl/python-ecore/ecore/evas/__init__.py 6 Sep 2007 03:10:46 -0000
@@ -4,6 +4,6 @@
from c_ecore_evas import shutdown, engine_type_supported_get, \
engine_type_from_name, engine_name_from_type, SoftwareX11, \
- GLX11, XRenderX11, FB, DirectFB, Buffer, SoftwareX11_16
+ GLX11, XRenderX11, FB, DirectFB, Buffer, SoftwareX11_16, X_Cursor
c_ecore_evas.init()
Index: proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pxd
===================================================================
RCS file: /var/cvs/e/e17/proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pxd,v
retrieving revision 1.3
diff -u -r1.3 ecore.evas.c_ecore_evas.pxd
--- proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pxd 2 Sep 2007 15:11:54 -0000 1.3
+++ proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pxd 6 Sep 2007 03:10:46 -0000
@@ -184,6 +184,14 @@
cdef int _set_obj(EcoreEvas self, Ecore_Evas *obj) except 0
+cdef extern from "Ecore_X.h":
+ ctypedef unsigned int Ecore_X_Cursor
+
+ cdef void ecore_x_window_cursor_set(Ecore_X_Window win, Ecore_X_Cursor c)
+ Ecore_X_Cursor ecore_x_cursor_shape_get(int shape)
+
+
+
cdef class SoftwareX11(EcoreEvas):
pass
@@ -223,3 +231,4 @@
cdef class Buffer(EcoreEvas):
cdef int _get_buf_size(self)
+
Index: proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pyx
===================================================================
RCS file: /var/cvs/e/e17/proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pyx,v
retrieving revision 1.3
diff -u -r1.3 ecore.evas.c_ecore_evas.pyx
--- proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pyx 22 Jun 2007 21:05:07 -0000 1.3
+++ proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas.pyx 6 Sep 2007 03:10:46 -0000
@@ -58,3 +58,4 @@
#include "ecore.evas.c_ecore_evas_directfb.pxi"
include "ecore.evas.c_ecore_evas_buffer.pxi"
include "ecore.evas.c_ecore_evas_software_x11_16.pxi"
+include "ecore.evas.c_ecore_evas_x_cursor.pxi"
Index: proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas_base.pxi
===================================================================
RCS file: /var/cvs/e/e17/proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas_base.pxi,v
retrieving revision 1.4
diff -u -r1.4 ecore.evas.c_ecore_evas_base.pxi
--- proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas_base.pxi 2 Sep 2007 15:11:54 -0000 1.4
+++ proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas_base.pxi 6 Sep 2007 03:10:47 -0000
@@ -200,6 +200,17 @@
f = filename
ecore_evas_cursor_set(self.obj, f, layer, hotx, hoty)
+ def cursor_set_shape(self, shape):
+ cdef Ecore_X_Cursor x_cursor
+ x_cursor = ecore_x_cursor_shape_get(shape)
+ self.cursor_set_x_cursor(x_cursor)
+
+ def cursor_set_x_cursor(self, x_cursor):
+ cdef Ecore_X_Window win
+ win = self.window
+ ecore_x_window_cursor_set(win, x_cursor)
+
+
def move(self, int x, int y):
ecore_evas_move(self.obj, x, y)
class X_Cursor:
ECORE_X_CURSOR_X = 0
ECORE_X_CURSOR_ARROW = 2
ECORE_X_CURSOR_BASED_ARROW_DOWN = 4
ECORE_X_CURSOR_UP = 6
ECORE_X_CURSOR_BOAT = 8
ECORE_X_CURSOR_BOTTOM_LEFT_CORNER = 12
ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER = 14
ECORE_X_CURSOR_BOTTOM_SIDE = 16
ECORE_X_CURSOR_BOTTOM_TEE = 18
ECORE_X_CURSOR_BOX_SPIRAL = 20
ECORE_X_CURSOR_CENTER_PTR = 22
ECORE_X_CURSOR_CIRCLE = 24
ECORE_X_CURSOR_CLOCK = 26
ECORE_X_CURSOR_COFFEE_MUG = 28
ECORE_X_CURSOR_CROSS = 30
ECORE_X_CURSOR_CROSS_REVERSE = 32
ECORE_X_CURSOR_CROSSHAIR = 34
ECORE_X_CURSOR_DIAMOND_CROSS = 36
ECORE_X_CURSOR_DOT = 38
ECORE_X_CURSOR_DOT_BOX_MASK = 40
ECORE_X_CURSOR_DOUBLE_ARROW = 42
ECORE_X_CURSOR_DRAFT_LARGE = 44
ECORE_X_CURSOR_DRAFT_SMALL = 46
ECORE_X_CURSOR_DRAPED_BOX = 48
ECORE_X_CURSOR_EXCHANGE = 50
ECORE_X_CURSOR_FLEUR = 52
ECORE_X_CURSOR_GOBBLER = 54
ECORE_X_CURSOR_GUMBY = 56
ECORE_X_CURSOR_HAND1 = 58
ECORE_X_CURSOR_HAND2 = 60
ECORE_X_CURSOR_HEART = 62
ECORE_X_CURSOR_ICON = 64
ECORE_X_CURSOR_IRON_CROSS = 66
ECORE_X_CURSOR_LEFT_PTR = 68
ECORE_X_CURSOR_LEFT_SIDE = 70
ECORE_X_CURSOR_LEFT_TEE = 72
ECORE_X_CURSOR_LEFTBUTTON = 74
ECORE_X_CURSOR_LL_ANGLE = 76
ECORE_X_CURSOR_LR_ANGLE = 78
ECORE_X_CURSOR_MAN = 80
ECORE_X_CURSOR_MIDDLEBUTTON = 82
ECORE_X_CURSOR_MOUSE = 84
ECORE_X_CURSOR_PENCIL = 86
ECORE_X_CURSOR_PIRATE = 88
ECORE_X_CURSOR_PLUS = 90
ECORE_X_CURSOR_QUESTION_ARROW = 92
ECORE_X_CURSOR_RIGHT_PTR = 94
ECORE_X_CURSOR_RIGHT_SIDE = 96
ECORE_X_CURSOR_RIGHT_TEE = 98
ECORE_X_CURSOR_RIGHTBUTTON = 100
ECORE_X_CURSOR_RTL_LOGO = 102
ECORE_X_CURSOR_SAILBOAT = 104
ECORE_X_CURSOR_SB_DOWN_ARROW = 106
ECORE_X_CURSOR_SB_H_DOUBLE_ARROW = 108
ECORE_X_CURSOR_SB_LEFT_ARROW = 110
ECORE_X_CURSOR_SB_RIGHT_ARROW = 112
ECORE_X_CURSOR_SB_UP_ARROW = 114
ECORE_X_CURSOR_SB_V_DOUBLE_ARROW = 116
ECORE_X_CURSOR_SHUTTLE = 118
ECORE_X_CURSOR_SIZING = 120
ECORE_X_CURSOR_SPIDER = 122
ECORE_X_CURSOR_SPRAYCAN = 124
ECORE_X_CURSOR_STAR = 126
ECORE_X_CURSOR_TARGET = 128
ECORE_X_CURSOR_TCROSS = 130
ECORE_X_CURSOR_TOP_LEFT_ARROW = 132
ECORE_X_CURSOR_TOP_LEFT_CORNER = 134
ECORE_X_CURSOR_TOP_RIGHT_CORNER = 136
ECORE_X_CURSOR_TOP_SIDE = 138
ECORE_X_CURSOR_TOP_TEE = 140
ECORE_X_CURSOR_TREK = 142
ECORE_X_CURSOR_UL_ANGLE = 144
ECORE_X_CURSOR_UMBRELLA = 146
ECORE_X_CURSOR_UR_ANGLE = 148
ECORE_X_CURSOR_WATCH = 150
ECORE_X_CURSOR_XTERM = 152
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel