Add option to disable drag and drop

Enabling drag and drop on a desktop (!touch) is too cumbersome: we
aren't allowed to select part of the link anymore since it would start
the drag and drop operation.
devs/lucas/wip
Lucas De Marchi 9 years ago
parent 70d71d21a0
commit f8ff064499
  1. 2
      src/bin/config.c
  2. 1
      src/bin/config.h
  3. 19
      src/bin/options_behavior.c
  4. 5
      src/bin/termio.c

@ -89,6 +89,8 @@ config_init(void)
(edd_base, Config, "cg_width", cg_width, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "cg_height", cg_height, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "drag_links", drag_links, EET_T_UCHAR);
}
void

@ -41,6 +41,7 @@ struct _Config
Eina_Bool urg_bell;
Eina_Bool multi_instance;
Eina_Bool custom_geometry;
Eina_Bool drag_links;
int cg_width;
int cg_height;

@ -9,6 +9,15 @@
static Evas_Object *op_w, *op_h;
static void
_cb_op_behavior_drag_links_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *term = data;
Config *config = termio_config_get(term);
config->drag_links = elm_check_state_get(obj);
config_save(config, NULL);
}
static void
_cb_op_behavior_jump_keypress_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
@ -275,6 +284,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_custom_geometry, term);
o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, "Drag & drop links");
elm_check_state_set(o, config->drag_links);
elm_box_pack_end(bx, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_drag_links_chg, term);
o = elm_label_add(bx);
evas_object_size_hint_weight_set(o, 0.0, 0.0);
evas_object_size_hint_align_set(o, 0.0, 0.5);

@ -400,11 +400,12 @@ _cb_link_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event)
Termio *sd = evas_object_smart_data_get(data);
Evas_Coord dx, dy;
if (!sd) return;
if (!sd->link.down.down) return;
dx = abs(ev->cur.canvas.x - sd->link.down.x);
dy = abs(ev->cur.canvas.y - sd->link.down.y);
if ((sd->link.string) &&
if ((sd->config->drag_links) &&
(sd->link.string) &&
((dx > elm_config_finger_size_get()) ||
(dy > elm_config_finger_size_get())))
{

Loading…
Cancel
Save