* Add DND modifiers: Control for copy, Shift for move, Alt for ask. Default action is move. Config for these comes later.
* Add EDJE signals for theme to act on DND action change.
* Default theme: Show current DND action using overlay icons. Icons done by Tom 'Toma-' Haste, thank you very much.
SVN revision: 35772
image: "e17_sb_runnerv.png" COMP;
image: "e17_scrollbar_hdrag_thumb.png" COMP;
image: "e17_scrollbar_vdrag_thumb.png" COMP;
+ image: "e17_fileman_copy.png" COMP;
+ image: "e17_fileman_ask.png" COMP;
+ image: "e17_fileman_move.png" COMP;
}
group {
}
group {
- name: "e/fileman/default/list/fixed";
+ name: "e/fileman/default/list/variable";
parts {
part {
name: "base";
color: 0 0 0 0;
}
}
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ rel1 {
+ relative: 0.75 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
programs {
program {
+ name: "ask";
+ signal: "e,state,ask";
+ source: "e";
+ action: STATE_SET "ask" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "move";
+ signal: "e,state,move";
+ source: "e";
+ action: STATE_SET "move" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "copy";
+ signal: "e,state,copy";
+ source: "e";
+ action: STATE_SET "copy" 0.0;
+ target: "dnd_action";
+ }
+ program {
name: "go_active_pre";
signal: "e,state,selected";
source: "e";
}
group {
- name: "e/fileman/default/list_odd/fixed";
+ name: "e/fileman/default/list_odd/variable";
parts {
part {
name: "base";
color: 0 0 0 0;
}
}
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ rel1 {
+ relative: 0.75 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
programs {
program {
+ name: "ask";
+ signal: "e,state,ask";
+ source: "e";
+ action: STATE_SET "ask" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "move";
+ signal: "e,state,move";
+ source: "e";
+ action: STATE_SET "move" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "copy";
+ signal: "e,state,copy";
+ source: "e";
+ action: STATE_SET "copy" 0.0;
+ target: "dnd_action";
+ }
+ program {
name: "go_active_pre";
signal: "e,state,selected";
source: "e";
}
}
}
-
-/*
group {
- name: "e/fileman/default/list/variable";
+ name: "e/fileman/default/list/fixed";
parts {
part {
name: "base";
to: "icon_box";
relative: 0.0 0.0;
offset: 1 1;
+
}
rel2 {
to: "icon_box";
state: "default" 0.0;
align: 0.5 0.5;
aspect: 1.0 1.0;
+ aspect_preference: BOTH;
visible: 0;
rel1 {
to: "icon0";
text: "Item Label";
font: "Edje-Vera";
size: 10;
-// min: 1 1;
+ min: 1 1;
align: 0.0 0.5;
text_class: "ilist_item";
}
color: 0 0 0 0;
}
}
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ rel1 {
+ relative: 0.75 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
programs {
program {
+ name: "ask";
+ signal: "e,state,ask";
+ source: "e";
+ action: STATE_SET "ask" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "move";
+ signal: "e,state,move";
+ source: "e";
+ action: STATE_SET "move" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "copy";
+ signal: "e,state,copy";
+ source: "e";
+ action: STATE_SET "copy" 0.0;
+ target: "dnd_action";
+ }
+ program {
name: "go_active_pre";
signal: "e,state,selected";
source: "e";
}
group {
- name: "e/fileman/default/list_odd/variable";
+ name: "e/fileman/default/list_odd/fixed";
parts {
part {
name: "base";
text: "Item Label";
font: "Edje-Vera";
size: 10;
-// min: 1 1;
+ min: 1 1;
align: 0.0 0.5;
text_class: "ilist_item";
}
color: 0 0 0 0;
}
}
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ rel1 {
+ relative: 0.75 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
programs {
program {
+ name: "ask";
+ signal: "e,state,ask";
+ source: "e";
+ action: STATE_SET "ask" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "move";
+ signal: "e,state,move";
+ source: "e";
+ action: STATE_SET "move" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "copy";
+ signal: "e,state,copy";
+ source: "e";
+ action: STATE_SET "copy" 0.0;
+ target: "dnd_action";
+ }
+ program {
name: "go_active_pre";
signal: "e,state,selected";
source: "e";
}
}
}
-*/
group {
name: "e/fileman/default/icon/fixed";
color: 0 0 0 0;
}
}
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ min: 24 24;
+ rel1 {
+ relative: 0.75 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
programs {
program {
state: "default" 0.0;
color: 0 0 0 0;
}
- }
+ }
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ min: 24 24;
+ rel1 {
+ relative: 0.75 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -1 -1;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
programs {
program {
+ name: "ask";
+ signal: "e,state,ask";
+ source: "e";
+ action: STATE_SET "ask" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "move";
+ signal: "e,state,move";
+ source: "e";
+ action: STATE_SET "move" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "copy";
+ signal: "e,state,copy";
+ source: "e";
+ action: STATE_SET "copy" 0.0;
+ target: "dnd_action";
+ }
+ program {
name: "active";
signal: "e,state,selected";
source: "e";
color: 0 0 0 0;
}
}
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ rel1 {
+ relative: 0.75 0.75;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -1 -1;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
+
programs {
program {
+ name: "ask";
+ signal: "e,state,ask";
+ source: "e";
+ action: STATE_SET "ask" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "move";
+ signal: "e,state,move";
+ source: "e";
+ action: STATE_SET "move" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "copy";
+ signal: "e,state,copy";
+ source: "e";
+ action: STATE_SET "copy" 0.0;
+ target: "dnd_action";
+ }
+ program {
name: "active";
signal: "e,state,selected";
source: "e";
color: 0 0 0 0;
}
}
+ part {
+ name: "dnd_action";
+ type: IMAGE;
+ mouse_events: 0;
+ repeat_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ description {
+ state: "visible" 0.0;
+ aspect: 1.0 1.0;
+ aspect_preference: BOTH;
+ align: 1.0 1.0;
+ rel1 {
+ relative: 0.75 0.75;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ description {
+ state: "copy" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_copy.png";
+ }
+ }
+ description {
+ state: "ask" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_ask.png";
+ }
+ }
+ description {
+ state: "move" 0.0;
+ inherit: "visible" 0.0;
+ image {
+ normal: "e17_fileman_move.png";
+ }
+ }
+ }
}
programs {
program {
+ name: "ask";
+ signal: "e,state,ask";
+ source: "e";
+ action: STATE_SET "ask" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "move";
+ signal: "e,state,move";
+ source: "e";
+ action: STATE_SET "move" 0.0;
+ target: "dnd_action";
+ }
+ program {
+ name: "copy";
+ signal: "e,state,copy";
+ source: "e";
+ action: STATE_SET "copy" 0.0;
+ target: "dnd_action";
+ }
+ program {
name: "active";
signal: "e,state,selected";
source: "e";
static int _e_dnd_cb_window_shape(void *data, int type, void *event);
+static int _e_dnd_cb_key_down(void *data, int type, void *event);
+static int _e_dnd_cb_key_up(void *data, int type, void *event);
static int _e_dnd_cb_mouse_up(void *data, int type, void *event);
static int _e_dnd_cb_mouse_move(void *data, int type, void *event);
static int _e_dnd_cb_event_dnd_enter(void *data, int type, void *event);
_event_handlers = evas_list_append(_event_handlers,
ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
_e_dnd_cb_event_dnd_selection, NULL));
+ _event_handlers = evas_list_append(_event_handlers,
+ ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN,
+ _e_dnd_cb_key_down, NULL));
+ _event_handlers = evas_list_append(_event_handlers,
+ ecore_event_handler_add(ECORE_X_EVENT_KEY_UP,
+ _e_dnd_cb_key_up, NULL));
_action = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
return 1;
ecore_x_window_shadow_tree_flush();
_drag_win_root = drag->container->manager->root;
+
+ drag->cb.key_down = NULL;
+ drag->cb.key_up = NULL;
return drag;
}
return _action;
}
+EAPI void
+e_drag_key_down_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_X_Event_Key_Down *e))
+{
+ drag->cb.key_down = func;
+}
+
+EAPI void
+e_drag_key_up_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_X_Event_Key_Up *e))
+{
+ drag->cb.key_up = func;
+}
+
/* local subsystem functions */
static void
int dx, dy, dw, dh;
Ecore_X_Window win, ignore_win[2];
int responsive = 0;
+ static struct
+ {
+ Ecore_X_Window root, win;
+ } cache = {0, 0};
// double t1 = ecore_time_get(); ////
if (_drag_current)
/* FIXME: this is nasty. every x mouse event we go back to x and do
* a whole bunch of round-trips narrowing down the toplevel window
* which contains the mouse */
- win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, ignore_win, 2);
+ if (cache.win != root)
+ {
+ /* A little bit of caching to avoid trips to X. */
+ cache.win = root;
+ cache.root = ecore_x_window_root_get(root);
+ }
+ win = ecore_x_window_shadow_tree_at_xy_with_skip_get(cache.root, x, y, ignore_win, 2);
// win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2);
}
else
}
}
- if(action == ECORE_X_ATOM_ATOM) responsive = 0;
-
return responsive;
// double t2 = ecore_time_get() - t1; ////
// printf("DND UPDATE %3.7f\n", t2); ////
}
static int
+_e_dnd_cb_key_down(void *data, int type, void *event)
+{
+ Ecore_X_Event_Key_Down *ev;
+
+ ev = event;
+ if (ev->win != _drag_win) return 1;
+
+ if (!_drag_current) return 1;
+
+ if (_drag_current->cb.key_down)
+ _drag_current->cb.key_down(_drag_current, ev);
+
+ return 1;
+}
+
+static int
+_e_dnd_cb_key_up(void *data, int type, void *event)
+{
+ Ecore_X_Event_Key_Up *ev;
+
+ ev = event;
+ if (ev->win != _drag_win) return 1;
+
+ if (!_drag_current) return 1;
+
+ if (_drag_current->cb.key_up)
+ _drag_current->cb.key_up(_drag_current, ev);
+
+ return 1;
+}
+
+static int
_e_dnd_cb_mouse_up(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Button_Up *ev;
ev = event;
if (ev->win != _drag_win) return 1;
- _e_drag_update(_drag_win_root, ev->x, ev->y, ECORE_X_ATOM_ATOM);
+ if(!_xdnd) _e_drag_update(_drag_win_root, ev->x, ev->y, ECORE_X_ATOM_XDND_ACTION_PRIVATE);
return 1;
}
struct {
void *(*convert)(E_Drag *drag, const char *type);
void (*finished)(E_Drag *drag, int dropped);
+ void (*key_down)(E_Drag *drag, Ecore_X_Event_Key_Down *e);
+ void (*key_up)(E_Drag *drag, Ecore_X_Event_Key_Up *e);
} cb;
E_Container *container;
EAPI void e_drag_move(E_Drag *drag, int x, int y);
EAPI void e_drag_resize(E_Drag *drag, int w, int h);
EAPI void e_drag_idler_before(void);
+EAPI void e_drag_key_down_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_X_Event_Key_Down *e));
+EAPI void e_drag_key_up_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_X_Event_Key_Up *e));
/* x and y are the coords where the mouse is when dragging starts */
EAPI int e_drag_start(E_Drag *drag, int x, int y);
free(drag->data);
}
+void
+_e_fm_drag_key_down_cb(E_Drag *drag, Ecore_X_Event_Key_Down *e)
+{
+ if (!strncmp(e->keyname, "Alt", 3))
+ {
+ ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_ASK);
+ edje_object_signal_emit(drag->object, "e,state,ask", "e");
+ }
+ else if (!strncmp(e->keyname, "Shift", 5))
+ {
+ ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE);
+ edje_object_signal_emit(drag->object, "e,state,move", "e");
+ }
+ else if (!strncmp(e->keyname, "Control", 7))
+ {
+ ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_COPY);
+ edje_object_signal_emit(drag->object, "e,state,copy", "e");
+ }
+}
+
+void
+_e_fm_drag_key_up_cb(E_Drag *drag, Ecore_X_Event_Key_Up *e)
+{
+ /* Default action would be move. ;) */
+
+ if (!strncmp(e->keyname, "Alt", 3))
+ {
+ ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE);
+ }
+ else if (!strncmp(e->keyname, "Shift", 5))
+ {
+ ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE);
+ }
+ else if (!strncmp(e->keyname, "Control", 7))
+ {
+ ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE);
+ }
+
+ edje_object_signal_emit(drag->object, "e,state,move", "e");
+}
+
static void
_e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
edje_object_signal_emit(o, "e,state,selected", "e");
edje_object_signal_emit(o2, "e,state,selected", "e");
e_drag_object_set(d, o);
+ edje_object_signal_emit(o, "e,state,move", "e");
e_drag_resize(d, w, h);
+ e_drag_key_down_cb_set(d, _e_fm_drag_key_down_cb);
+ e_drag_key_up_cb_set(d, _e_fm_drag_key_up_cb);
+
e_drag_xdnd_start(d,
ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x,
ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y);