aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2013-09-12 03:00:08 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2013-09-12 03:05:18 -0300
commitf8ff0644992221c5c32d14a0ebc4e79c20e9e0be (patch)
treede87173b30d188e739398e838ec96e33d45f2d32
parentuse new elm_win_window_id_get to return wayland-compatible surface id: termin... (diff)
downloadterminology-devs/lucas/wip.tar.gz
Add option to disable drag and dropdevs/lucas/wip
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.
-rw-r--r--src/bin/config.c2
-rw-r--r--src/bin/config.h1
-rw-r--r--src/bin/options_behavior.c19
-rw-r--r--src/bin/termio.c5
4 files changed, 25 insertions, 2 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index d9be869..2244120 100644
--- a/src/bin/config.c
+++ b/src/bin/config.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
diff --git a/src/bin/config.h b/src/bin/config.h
index cda50ff..a40b207 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -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;
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 996aa60..00ebcd9 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -10,6 +10,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)
{
Evas_Object *term = data;
@@ -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);
diff --git a/src/bin/termio.c b/src/bin/termio.c
index ffe76af..41bcbfd 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -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())))
{