summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2016-11-08 17:50:23 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-12-19 14:58:35 -0200
commitfecd59fe3237d930d86e8b166b57271b16c5df43 (patch)
treef8108d4c765b73c41d864263051560ee960f2d62 /src
parent2958aba23a8dc99503fad8119eeffef82e410b42 (diff)
edje: add new signals providing seat information
Add the following signals: * mouse,in,$SEAT * mouse,out,$SEAT * mouse,move,$SEAT * mouse,clicked,$BUTTON,$SEAT * hold,on,$SEAT * hold,off,$SEAT * drag,$SEAT * drag,start,$SEAT * drag,stop,$SEAT
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/edje_callbacks.c38
-rw-r--r--src/lib/edje/edje_private.h1
-rw-r--r--src/lib/edje/edje_program.c20
3 files changed, 43 insertions, 16 deletions
diff --git a/src/lib/edje/edje_callbacks.c b/src/lib/edje/edje_callbacks.c
index b27049fc83..b367d0c0a5 100644
--- a/src/lib/edje/edje_callbacks.c
+++ b/src/lib/edje/edje_callbacks.c
@@ -15,9 +15,11 @@ _edje_hold_signal_cb(void *data, const Efl_Event *event)
15 rp = evas_object_data_get(event->object, "real_part"); 15 rp = evas_object_data_get(event->object, "real_part");
16 if (!rp) return; 16 if (!rp) return;
17 if (efl_input_hold_get(ev)) 17 if (efl_input_hold_get(ev))
18 _edje_emit(ed, "hold,on", rp->part->name); 18 _edje_seat_emit(ed, efl_input_device_get(ev),
19 "hold,on", rp->part->name);
19 else 20 else
20 _edje_emit(ed, "hold,off", rp->part->name); 21 _edje_seat_emit(ed, efl_input_device_get(ev),
22 "hold,off", rp->part->name);
21} 23}
22 24
23static void 25static void
@@ -61,7 +63,7 @@ _edje_mouse_in_signal_cb(void *data, const Efl_Event *event)
61 if (rp) 63 if (rp)
62 { 64 {
63 if (!(ev->event_flags) || !(rp->part->ignore_flags & ev->event_flags)) 65 if (!(ev->event_flags) || !(rp->part->ignore_flags & ev->event_flags))
64 _edje_emit(ed, "mouse,in", rp->part->name); 66 _edje_seat_emit(ed, ev->device, "mouse,in", rp->part->name);
65 67
66 ev->event_flags |= rp->part->mask_flags; 68 ev->event_flags |= rp->part->mask_flags;
67 } 69 }
@@ -80,7 +82,7 @@ _edje_mouse_out_signal_cb(void *data, const Efl_Event *event)
80 if (rp) 82 if (rp)
81 { 83 {
82 if (!(ev->event_flags) || !(rp->part->ignore_flags & ev->event_flags)) 84 if (!(ev->event_flags) || !(rp->part->ignore_flags & ev->event_flags))
83 _edje_emit(ed, "mouse,out", rp->part->name); 85 _edje_seat_emit(ed, ev->device, "mouse,out", rp->part->name);
84 86
85 ev->event_flags |= rp->part->mask_flags; 87 ev->event_flags |= rp->part->mask_flags;
86 } 88 }
@@ -113,7 +115,7 @@ _edje_mouse_down_signal_cb(void *data, const Efl_Event *event)
113 snprintf(buf, sizeof(buf), "mouse,down,%i,double", ev->button); 115 snprintf(buf, sizeof(buf), "mouse,down,%i,double", ev->button);
114 else 116 else
115 snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button); 117 snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
116 _edje_emit(ed, buf, rp->part->name); 118 _edje_seat_emit(ed, ev->device, buf, rp->part->name);
117 } 119 }
118 120
119 if (rp->part->dragable.event_id >= 0) 121 if (rp->part->dragable.event_id >= 0)
@@ -122,7 +124,7 @@ _edje_mouse_down_signal_cb(void *data, const Efl_Event *event)
122 if (!ignored) 124 if (!ignored)
123 { 125 {
124 snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button); 126 snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
125 _edje_emit(ed, buf, rp->part->name); 127 _edje_seat_emit(ed, ev->device, buf, rp->part->name);
126 } 128 }
127 } 129 }
128 130
@@ -177,7 +179,7 @@ _edje_mouse_up_signal_cb(void *data, const Efl_Event *event)
177 if ((!ev->event_flags) || (!ignored)) 179 if ((!ev->event_flags) || (!ignored))
178 { 180 {
179 snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button); 181 snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
180 _edje_emit(ed, buf, rp->part->name); 182 _edje_seat_emit(ed, ev->device, buf, rp->part->name);
181 } 183 }
182 184
183 if (rp->part->dragable.event_id >= 0) 185 if (rp->part->dragable.event_id >= 0)
@@ -186,7 +188,7 @@ _edje_mouse_up_signal_cb(void *data, const Efl_Event *event)
186 if (!ignored) 188 if (!ignored)
187 { 189 {
188 snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button); 190 snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
189 _edje_emit(ed, buf, rp->part->name); 191 _edje_seat_emit(ed, ev->device, buf, rp->part->name);
190 } 192 }
191 } 193 }
192 194
@@ -206,7 +208,8 @@ _edje_mouse_up_signal_cb(void *data, const Efl_Event *event)
206 rp->invalidate = EINA_TRUE; 208 rp->invalidate = EINA_TRUE;
207#endif 209#endif
208 if (!ignored && rp->drag->started) 210 if (!ignored && rp->drag->started)
209 _edje_emit(ed, "drag,stop", rp->part->name); 211 _edje_seat_emit(ed, ev->device, "drag,stop",
212 rp->part->name);
210 rp->drag->started = EINA_FALSE; 213 rp->drag->started = EINA_FALSE;
211 _edje_recalc_do(ed); 214 _edje_recalc_do(ed);
212 } 215 }
@@ -216,7 +219,7 @@ _edje_mouse_up_signal_cb(void *data, const Efl_Event *event)
216 if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ev->event_flags)) 219 if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ev->event_flags))
217 { 220 {
218 snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button); 221 snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button);
219 _edje_emit(ed, buf, rp->part->name); 222 _edje_seat_emit(ed, ev->device, buf, rp->part->name);
220 } 223 }
221 rp->clicked_button = 0; 224 rp->clicked_button = 0;
222 rp->still_in = EINA_FALSE; 225 rp->still_in = EINA_FALSE;
@@ -249,7 +252,7 @@ _edje_mouse_move_signal_cb(void *data, const Efl_Event *event)
249 252
250 _edje_ref(ed); 253 _edje_ref(ed);
251 if ((!ev->event_flags) || (!ignored)) 254 if ((!ev->event_flags) || (!ignored))
252 _edje_emit(ed, "mouse,move", rp->part->name); 255 _edje_seat_emit(ed, ev->device, "mouse,move", rp->part->name);
253 256
254 if (rp->still_in) 257 if (rp->still_in)
255 { 258 {
@@ -264,7 +267,8 @@ _edje_mouse_move_signal_cb(void *data, const Efl_Event *event)
264 (ev->cur.x >= (x + w)) || (ev->cur.y >= (y + h))) 267 (ev->cur.x >= (x + w)) || (ev->cur.y >= (y + h)))
265 { 268 {
266 if ((ev->pressed_buttons) && ((!ev->event_flags) || (!ignored))) 269 if ((ev->pressed_buttons) && ((!ev->event_flags) || (!ignored)))
267 _edje_emit(ed, "mouse,pressed,out", rp->part->name); 270 _edje_seat_emit(ed, ev->device, "mouse,pressed,out",
271 rp->part->name);
268 272
269 rp->still_in = EINA_FALSE; 273 rp->still_in = EINA_FALSE;
270 } 274 }
@@ -281,7 +285,8 @@ _edje_mouse_move_signal_cb(void *data, const Efl_Event *event)
281 (ev->cur.x < (x + w)) && (ev->cur.y < (y + h))) 285 (ev->cur.x < (x + w)) && (ev->cur.y < (y + h)))
282 { 286 {
283 if ((ev->pressed_buttons) && ((!ev->event_flags) || (!ignored))) 287 if ((ev->pressed_buttons) && ((!ev->event_flags) || (!ignored)))
284 _edje_emit(ed, "mouse,pressed,in", rp->part->name); 288 _edje_seat_emit(ed, ev->device, "mouse,pressed,in",
289 rp->part->name);
285 290
286 rp->still_in = EINA_TRUE; 291 rp->still_in = EINA_TRUE;
287 } 292 }
@@ -316,8 +321,9 @@ _edje_mouse_move_signal_cb(void *data, const Efl_Event *event)
316 if (!ignored) 321 if (!ignored)
317 { 322 {
318 if (!rp->drag->started) 323 if (!rp->drag->started)
319 _edje_emit(ed, "drag,start", rp->part->name); 324 _edje_seat_emit(ed, ev->device, "drag,start",
320 _edje_emit(ed, "drag", rp->part->name); 325 rp->part->name);
326 _edje_seat_emit(ed, ev->device, "drag", rp->part->name);
321 rp->drag->started = EINA_TRUE; 327 rp->drag->started = EINA_TRUE;
322 } 328 }
323 ed->recalc_call = EINA_TRUE; 329 ed->recalc_call = EINA_TRUE;
@@ -353,7 +359,7 @@ _edje_mouse_wheel_signal_cb(void *data, const Efl_Event *event)
353 snprintf(buf, sizeof(buf), "mouse,wheel,%i,%i", 359 snprintf(buf, sizeof(buf), "mouse,wheel,%i,%i",
354 ev->wheel.dir == EFL_ORIENT_HORIZONTAL ? 1 : 0, 360 ev->wheel.dir == EFL_ORIENT_HORIZONTAL ? 1 : 0,
355 (ev->wheel.z < 0) ? (-1) : (1)); 361 (ev->wheel.z < 0) ? (-1) : (1));
356 _edje_emit(ed, buf, rp->part->name); 362 _edje_seat_emit(ed, ev->device, buf, rp->part->name);
357 } 363 }
358 364
359 ev->event_flags |= rp->part->mask_flags; 365 ev->event_flags |= rp->part->mask_flags;
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 9a0fd21eb3..7dc1d59684 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2467,6 +2467,7 @@ void _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char
2467void _edje_programs_patterns_clean(Edje_Part_Collection *ed); 2467void _edje_programs_patterns_clean(Edje_Part_Collection *ed);
2468void _edje_programs_patterns_init(Edje_Part_Collection *ed); 2468void _edje_programs_patterns_init(Edje_Part_Collection *ed);
2469void _edje_emit(Edje *ed, const char *sig, const char *src); 2469void _edje_emit(Edje *ed, const char *sig, const char *src);
2470void _edje_seat_emit(Edje *ed, Efl_Input_Device *dev, const char *sig, const char *src);
2470void _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*free_func)(void *)); 2471void _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*free_func)(void *));
2471void _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop); 2472void _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Data *data, Eina_Bool prop);
2472void _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp); 2473void _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp);
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 3edaca98a9..2a6e100622 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -1209,6 +1209,26 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
1209 _edje_emit_full(ed, sig, src, NULL, NULL); 1209 _edje_emit_full(ed, sig, src, NULL, NULL);
1210} 1210}
1211 1211
1212void
1213_edje_seat_emit(Edje *ed, Efl_Input_Device *dev, const char *sig, const char *src)
1214{
1215 Efl_Input_Device *seat;
1216 char buf[128];
1217
1218 /* keep sending signals without seat information for legacy compatibility */
1219 _edje_emit_full(ed, sig, src, NULL, NULL);
1220
1221 /* send extra signal with ",$SEAT" suffix if the input device originating
1222 * the signal belongs to a seat */
1223 if (!dev) return;
1224
1225 seat = efl_input_device_seat_get(dev);
1226 if (!seat) return;
1227
1228 snprintf(buf, sizeof(buf), "%s,%s", sig, efl_input_device_name_get(seat));
1229 _edje_emit_full(ed, buf, src, NULL, NULL);
1230}
1231
1212/* data should either be NULL or a malloc allocated data */ 1232/* data should either be NULL or a malloc allocated data */
1213void 1233void
1214_edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*free_func)(void *)) 1234_edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*free_func)(void *))