summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2013-09-29 00:14:49 +0200
committerBoris Faure <billiob@gmail.com>2013-10-08 22:25:23 +0200
commit579c64878a045d42d6e1d96df110ca705955f8dc (patch)
treedbf41f371f0ed5bb8fa73c9ec4d8cd7174eb42ce
parent0f615122e585edf872d189d5ab7f09297d8748b7 (diff)
simplify code
-rw-r--r--src/bin/termio.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 4937814..e2193d6 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -2678,7 +2678,7 @@ _rep_mouse_up(Termio *sd, Evas_Event_Mouse_Up *ev, int cx, int cy)
2678} 2678}
2679 2679
2680static Eina_Bool 2680static Eina_Bool
2681_rep_mouse_move(Termio *sd, Evas_Event_Mouse_Move *ev, int cx EINA_UNUSED, int cy EINA_UNUSED, Eina_Bool change) 2681_rep_mouse_move(Termio *sd, Evas_Event_Mouse_Move *ev, int cx, int cy)
2682{ 2682{
2683 char buf[64]; 2683 char buf[64];
2684 Eina_Bool ret = EINA_FALSE; 2684 Eina_Bool ret = EINA_FALSE;
@@ -2692,8 +2692,6 @@ _rep_mouse_move(Termio *sd, Evas_Event_Mouse_Move *ev, int cx EINA_UNUSED, int c
2692 if ((!sd->mouse.button) && (sd->pty->mouse_mode == MOUSE_NORMAL_BTN_MOVE)) 2692 if ((!sd->mouse.button) && (sd->pty->mouse_mode == MOUSE_NORMAL_BTN_MOVE))
2693 return EINA_FALSE; 2693 return EINA_FALSE;
2694 2694
2695 if (!change) return EINA_TRUE;
2696
2697 btn = sd->mouse.button - 1; 2695 btn = sd->mouse.button - 1;
2698 shift = evas_key_modifier_is_set(ev->modifiers, "Shift") ? 4 : 0; 2696 shift = evas_key_modifier_is_set(ev->modifiers, "Shift") ? 4 : 0;
2699 meta = evas_key_modifier_is_set(ev->modifiers, "Alt") ? 8 : 0; 2697 meta = evas_key_modifier_is_set(ev->modifiers, "Alt") ? 8 : 0;
@@ -3098,15 +3096,17 @@ _smart_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
3098 Evas_Event_Mouse_Move *ev = event; 3096 Evas_Event_Mouse_Move *ev = event;
3099 Termio *sd; 3097 Termio *sd;
3100 int cx, cy; 3098 int cx, cy;
3101 Eina_Bool mc_change = EINA_FALSE;
3102 3099
3103 sd = evas_object_smart_data_get(data); 3100 sd = evas_object_smart_data_get(data);
3104 if (!sd) return; 3101 if (!sd) return;
3102
3105 _smart_xy_to_cursor(data, ev->cur.canvas.x, ev->cur.canvas.y, &cx, &cy); 3103 _smart_xy_to_cursor(data, ev->cur.canvas.x, ev->cur.canvas.y, &cx, &cy);
3106 if ((sd->mouse.cx != cx) || (sd->mouse.cy != cy)) mc_change = EINA_TRUE; 3104
3105 if ((sd->mouse.cx == cx) && (sd->mouse.cy == cy)) return;
3106
3107 sd->mouse.cx = cx; 3107 sd->mouse.cx = cx;
3108 sd->mouse.cy = cy; 3108 sd->mouse.cy = cy;
3109 if (_rep_mouse_move(sd, ev, cx, cy, mc_change)) return; 3109 if (_rep_mouse_move(sd, ev, cx, cy)) return;
3110 if (sd->link.down.dnd) 3110 if (sd->link.down.dnd)
3111 { 3111 {
3112 sd->cur.makesel = 0; 3112 sd->cur.makesel = 0;
@@ -3139,11 +3139,9 @@ _smart_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
3139 _selection_newline_extend_fix(data); 3139 _selection_newline_extend_fix(data);
3140 _smart_update_queue(data, sd); 3140 _smart_update_queue(data, sd);
3141 } 3141 }
3142 if (mc_change) 3142 /* TODO: make the following useless */
3143 { 3143 if (sd->mouse_move_job) ecore_job_del(sd->mouse_move_job);
3144 if (sd->mouse_move_job) ecore_job_del(sd->mouse_move_job); 3144 sd->mouse_move_job = ecore_job_add(_smart_cb_mouse_move_job, data);
3145 sd->mouse_move_job = ecore_job_add(_smart_cb_mouse_move_job, data);
3146 }
3147} 3145}
3148 3146
3149static void 3147static void