edje: Send seat name to all seat emitted events

Summary:
We now send the name of the seat (if available) to legacy and seat events
so the callbacks can query them via the new seat data api.

This isn't quite what I wanted, but it's enough to fix the ecore_wl2
input problems for now.  When multi-seat is a usable thing we can rework
these bits.
Depends on D6117

Reviewers: zmike, cedric

Reviewed By: zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6118
This commit is contained in:
Derek Foreman 2018-05-08 13:25:46 -05:00
parent ad5db090ab
commit cad847cf13
1 changed files with 14 additions and 7 deletions

View File

@ -1248,21 +1248,28 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
void
_edje_seat_emit(Edje *ed, Efl_Input_Device *dev, const char *sig, const char *src)
{
Efl_Input_Device *seat;
Edje_Message_Signal_Data *mdata = NULL;
Efl_Input_Device *seat = NULL;
char buf[128];
char *sname;
/* keep sending signals without seat information for legacy compatibility */
_edje_emit_full(ed, sig, src, NULL, NULL);
if (dev) seat = efl_input_device_seat_get(dev);
if (seat)
{
sname = strdup(efl_name_get(seat));
mdata = _edje_signal_data_setup(NULL, NULL, sname, free);
}
/* keep sending old style signals for legacy compatibility, but provide */
/* queryable seat data for callers that can make use of it. */
_edje_emit_full_data(ed, sig, src, mdata);
/* send extra signal with ",$SEAT" suffix if the input device originating
* the signal belongs to a seat */
if (!dev) return;
seat = efl_input_device_seat_get(dev);
if (!seat) return;
snprintf(buf, sizeof(buf), "seat,%s,%s", _edje_seat_name_get(ed, seat), sig);
_edje_emit_full(ed, buf, src, NULL, NULL);
_edje_emit_full_data(ed, buf, src, mdata);
_edje_signal_data_free(mdata);
}
/* data should either be NULL or a malloc allocated data */