summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2013-12-01 18:22:17 +0100
committerBoris Faure <billiob@gmail.com>2013-12-01 18:22:17 +0100
commit54aa692ee20d37b27ae181ea343b0d0236e4f20d (patch)
tree5b81d5ea8142c61e15e799e587df5084c8e5de09 /src
parentfd38df310815a76c4e259a2704641fb5533bf84f (diff)
fix selection pasting on wrong term. Closes T408
Diffstat (limited to 'src')
-rw-r--r--src/bin/controls.c30
-rw-r--r--src/bin/termio.c15
2 files changed, 26 insertions, 19 deletions
diff --git a/src/bin/controls.c b/src/bin/controls.c
index e3eb124..3fb8658 100644
--- a/src/bin/controls.c
+++ b/src/bin/controls.c
@@ -50,17 +50,21 @@ _cb_ct_del_delay(void *data EINA_UNUSED)
50} 50}
51 51
52static void 52static void
53_cb_ct_copy(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 53_cb_ct_copy(void *data EINA_UNUSED,
54 Evas_Object *obj EINA_UNUSED,
55 void *event EINA_UNUSED)
54{ 56{
57 termio_copy_clipboard(ct_term);
55 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata); 58 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
56 termio_copy_clipboard(data);
57} 59}
58 60
59static void 61static void
60_cb_ct_paste(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 62_cb_ct_paste(void *data EINA_UNUSED,
63 Evas_Object *obj EINA_UNUSED,
64 void *event EINA_UNUSED)
61{ 65{
66 termio_paste_clipboard(ct_term);
62 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata); 67 controls_toggle(ct_win, ct_bg, ct_term, ct_donecb, ct_donedata);
63 termio_paste_clipboard(data);
64} 68}
65 69
66static void 70static void
@@ -245,21 +249,21 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
245 elm_box_pack_end(ct_boxh, o); 249 elm_box_pack_end(ct_boxh, o);
246 evas_object_show(o); 250 evas_object_show(o);
247 251
248 o = _button_add(win, "New", "new", _cb_ct_new, term); 252 o = _button_add(win, "New", "new", _cb_ct_new, NULL);
249 elm_box_pack_end(ct_box2, o); 253 elm_box_pack_end(ct_box2, o);
250 254
251 o = _sep_add_h(win); 255 o = _sep_add_h(win);
252 elm_box_pack_end(ct_box2, o); 256 elm_box_pack_end(ct_box2, o);
253 257
254 o = _button_add(win, "Split V", "split-h", _cb_ct_split_v, term); 258 o = _button_add(win, "Split V", "split-h", _cb_ct_split_v, NULL);
255 elm_box_pack_end(ct_box2, o); 259 elm_box_pack_end(ct_box2, o);
256 o = _button_add(win, "Split H", "split-v", _cb_ct_split_h, term); 260 o = _button_add(win, "Split H", "split-v", _cb_ct_split_h, NULL);
257 elm_box_pack_end(ct_box2, o); 261 elm_box_pack_end(ct_box2, o);
258 262
259 o = _sep_add_h(win); 263 o = _sep_add_h(win);
260 elm_box_pack_end(ct_box2, o); 264 elm_box_pack_end(ct_box2, o);
261 265
262 o = _button_add(win, "Close", "close", _cb_ct_close, term); 266 o = _button_add(win, "Close", "close", _cb_ct_close, NULL);
263 elm_box_pack_end(ct_box2, o); 267 elm_box_pack_end(ct_box2, o);
264 268
265 o = _sep_add_v(win); 269 o = _sep_add_v(win);
@@ -269,24 +273,24 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
269 elm_box_pack_end(ct_boxh, o); 273 elm_box_pack_end(ct_boxh, o);
270 evas_object_show(o); 274 evas_object_show(o);
271 275
272 o = _button_add(win, "Copy", "copy", _cb_ct_copy, term); 276 o = _button_add(win, "Copy", "copy", _cb_ct_copy, NULL);
273 evas_object_data_set(ct_frame, "bt_copy", o); 277 evas_object_data_set(ct_frame, "bt_copy", o);
274 if (!termio_selection_exists(term)) 278 if (!termio_selection_exists(term))
275 elm_object_disabled_set(o, EINA_TRUE); 279 elm_object_disabled_set(o, EINA_TRUE);
276 elm_box_pack_end(ct_box, o); 280 elm_box_pack_end(ct_box, o);
277 o = _button_add(win, "Paste", "paste", _cb_ct_paste, term); 281 o = _button_add(win, "Paste", "paste", _cb_ct_paste, NULL);
278 elm_box_pack_end(ct_box, o); 282 elm_box_pack_end(ct_box, o);
279 283
280 o = _sep_add_h(win); 284 o = _sep_add_h(win);
281 elm_box_pack_end(ct_box, o); 285 elm_box_pack_end(ct_box, o);
282 286
283 o = _button_add(win, "Settings", "settings", _cb_ct_options, term); 287 o = _button_add(win, "Settings", "settings", _cb_ct_options, NULL);
284 elm_box_pack_end(ct_box, o); 288 elm_box_pack_end(ct_box, o);
285 289
286 o = _sep_add_h(win); 290 o = _sep_add_h(win);
287 elm_box_pack_end(ct_box, o); 291 elm_box_pack_end(ct_box, o);
288 292
289 o = _button_add(win, "About", "about", _cb_ct_about, term); 293 o = _button_add(win, "About", "about", _cb_ct_about, NULL);
290 elm_box_pack_end(ct_box, o); 294 elm_box_pack_end(ct_box, o);
291 295
292 evas_object_event_callback_add(ct_frame, EVAS_CALLBACK_DEL, 296 evas_object_event_callback_add(ct_frame, EVAS_CALLBACK_DEL,
@@ -306,7 +310,7 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
306 edje_object_part_swallow(bg, "terminology.dismiss", o); 310 edje_object_part_swallow(bg, "terminology.dismiss", o);
307 evas_object_show(o); 311 evas_object_show(o);
308 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, 312 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
309 _cb_mouse_down, term); 313 _cb_mouse_down, NULL);
310 evas_object_event_callback_add(ct_over, EVAS_CALLBACK_DEL, 314 evas_object_event_callback_add(ct_over, EVAS_CALLBACK_DEL,
311 _cb_over_del, NULL); 315 _cb_over_del, NULL);
312 316
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 99e5099..1001e28 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -103,6 +103,7 @@ static void
103_sel_set(Evas_Object *obj, Eina_Bool enable) 103_sel_set(Evas_Object *obj, Eina_Bool enable)
104{ 104{
105 Termio *sd = evas_object_smart_data_get(obj); 105 Termio *sd = evas_object_smart_data_get(obj);
106 EINA_SAFETY_ON_NULL_RETURN(sd);
106 107
107 if (sd->pty->selection.is_active == enable) return; 108 if (sd->pty->selection.is_active == enable) return;
108 sd->pty->selection.is_active = enable; 109 sd->pty->selection.is_active = enable;
@@ -139,7 +140,7 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
139 Eina_Bool url = EINA_FALSE, email = EINA_FALSE, handled = EINA_FALSE; 140 Eina_Bool url = EINA_FALSE, email = EINA_FALSE, handled = EINA_FALSE;
140 int type; 141 int type;
141 142
142 if (!sd) return; 143 EINA_SAFETY_ON_NULL_RETURN(sd);
143 if (!config) return; 144 if (!config) return;
144 if (!sd->link.string) return; 145 if (!sd->link.string) return;
145 if (link_is_url(sd->link.string)) 146 if (link_is_url(sd->link.string))
@@ -302,6 +303,7 @@ _cb_ctxp_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
302 void *event EINA_UNUSED) 303 void *event EINA_UNUSED)
303{ 304{
304 Termio *sd = data; 305 Termio *sd = data;
306 EINA_SAFETY_ON_NULL_RETURN(sd);
305 sd->link.ctxpopup = NULL; 307 sd->link.ctxpopup = NULL;
306 elm_object_focus_set(sd->self, EINA_TRUE); 308 elm_object_focus_set(sd->self, EINA_TRUE);
307} 309}
@@ -345,7 +347,7 @@ _cb_link_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
345{ 347{
346 Evas_Event_Mouse_Down *ev = event; 348 Evas_Event_Mouse_Down *ev = event;
347 Termio *sd = evas_object_smart_data_get(data); 349 Termio *sd = evas_object_smart_data_get(data);
348 if (!sd) return; 350 EINA_SAFETY_ON_NULL_RETURN(sd);
349 351
350 if (ev->button == 1) 352 if (ev->button == 1)
351 { 353 {
@@ -386,7 +388,7 @@ static Eina_Bool
386_cb_link_up_delay(void *data) 388_cb_link_up_delay(void *data)
387{ 389{
388 Termio *sd = evas_object_smart_data_get(data); 390 Termio *sd = evas_object_smart_data_get(data);
389 if (!sd) return EINA_FALSE; 391 EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
390 392
391 sd->link_do_timer = NULL; 393 sd->link_do_timer = NULL;
392 if (!sd->didclick) _activate_link(data, EINA_TRUE); 394 if (!sd->didclick) _activate_link(data, EINA_TRUE);
@@ -1746,6 +1748,8 @@ _take_selection_text(Evas_Object *obj, Elm_Sel_Type type, const char *text)
1746{ 1748{
1747 Termio *sd = evas_object_smart_data_get(obj); 1749 Termio *sd = evas_object_smart_data_get(obj);
1748 1750
1751 EINA_SAFETY_ON_NULL_RETURN(sd);
1752
1749 text = eina_stringshare_add(text); 1753 text = eina_stringshare_add(text);
1750 1754
1751 sd->have_sel = EINA_FALSE; 1755 sd->have_sel = EINA_FALSE;
@@ -1771,7 +1775,7 @@ _take_selection(Evas_Object *obj, Elm_Sel_Type type)
1771 char *s = NULL; 1775 char *s = NULL;
1772 size_t len = 0; 1776 size_t len = 0;
1773 1777
1774 if (!sd) return; 1778 EINA_SAFETY_ON_NULL_RETURN(sd);
1775 if (sd->pty->selection.is_active) 1779 if (sd->pty->selection.is_active)
1776 { 1780 {
1777 start_x = sd->pty->selection.start.x; 1781 start_x = sd->pty->selection.start.x;
@@ -1866,7 +1870,7 @@ static void
1866_paste_selection(Evas_Object *obj, Elm_Sel_Type type) 1870_paste_selection(Evas_Object *obj, Elm_Sel_Type type)
1867{ 1871{
1868 Termio *sd = evas_object_smart_data_get(obj); 1872 Termio *sd = evas_object_smart_data_get(obj);
1869 if (!sd) return; 1873 EINA_SAFETY_ON_NULL_RETURN(sd);
1870 if (!sd->win) return; 1874 if (!sd->win) return;
1871 elm_cnp_selection_get(sd->win, type, ELM_SEL_FORMAT_TEXT, 1875 elm_cnp_selection_get(sd->win, type, ELM_SEL_FORMAT_TEXT,
1872 _getsel_cb, obj); 1876 _getsel_cb, obj);
@@ -4022,7 +4026,6 @@ termio_content_change(Evas_Object *obj, Evas_Coord x, Evas_Coord y,
4022 if (!((cells_changed > (cells_selection + sel_len)) || 4026 if (!((cells_changed > (cells_selection + sel_len)) ||
4023 (cells_selection > (cells_changed + n)))) 4027 (cells_selection > (cells_changed + n))))
4024 _sel_set(obj, EINA_FALSE); 4028 _sel_set(obj, EINA_FALSE);
4025
4026 } 4029 }
4027} 4030}
4028 4031