summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2016-12-05 15:24:35 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-12-19 14:58:35 -0200
commitc6399665ddb0f719df6514b78c9cf6f685dfbb0d (patch)
tree359e23e048a7af97f52df4fcb78084651914d8de /src
parent0ab6567b3e5ef63e97c97db01497619b7ea57f8d (diff)
edje: support action seats on edje_edit
Diffstat (limited to 'src')
-rw-r--r--src/examples/edje/edje-multiseat.c34
-rw-r--r--src/lib/edje/edje_edit.c16
2 files changed, 42 insertions, 8 deletions
diff --git a/src/examples/edje/edje-multiseat.c b/src/examples/edje/edje-multiseat.c
index 620724492b..3387fb11cc 100644
--- a/src/examples/edje/edje-multiseat.c
+++ b/src/examples/edje/edje-multiseat.c
@@ -25,12 +25,16 @@
25#include <Ecore_Evas.h> 25#include <Ecore_Evas.h>
26#include <Edje.h> 26#include <Edje.h>
27 27
28#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
29#include <Edje_Edit.h>
30
28#define WIDTH 400 31#define WIDTH 400
29#define HEIGHT 400 32#define HEIGHT 400
30 33
31static const char *GROUPNAME = "example/main"; 34static const char *GROUPNAME = "example/main";
32static const char *PARTNAME_KNOB1 = "example/knob1"; 35static const char *PARTNAME_KNOB1 = "example/knob1";
33static const char *PARTNAME_KNOB2 = "example/knob2"; 36static const char *PARTNAME_KNOB2 = "example/knob2";
37static const char *EDJE_FILE = PACKAGE_DATA_DIR"/multiseat.edj";
34 38
35static void 39static void
36_on_destroy(Ecore_Evas *ee EINA_UNUSED) 40_on_destroy(Ecore_Evas *ee EINA_UNUSED)
@@ -100,14 +104,31 @@ _on_rect_focus_out(void *data, const Efl_Event *event)
100} 104}
101 105
102static void 106static void
103_on_key_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *o, void *event_info) 107_on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *event_info)
104{ 108{
105 Evas_Event_Key_Down *ev = event_info; 109 Evas_Event_Key_Down *ev = event_info;
110 const Evas_Modifier *mods;
106 Efl_Input_Device *seat; 111 Efl_Input_Device *seat;
112 Evas *evas = data;
107 113
108 seat = efl_input_device_seat_get(ev->dev); 114 seat = efl_input_device_seat_get(ev->dev);
109 printf("Seat %s (%s) pressed key %s\n", efl_input_device_name_get(seat), 115 printf("Seat %s (%s) pressed key %s\n", efl_input_device_name_get(seat),
110 edje_obj_seat_name_get(o, seat), ev->key); 116 edje_obj_seat_name_get(o, seat), ev->key);
117
118 mods = evas_key_modifier_get(evas);
119 if (!strcmp(ev->key, "p") &&
120 evas_seat_key_modifier_is_set(mods, "Control", seat))
121 {
122 Evas_Object *edje_edit_obj;
123
124 edje_edit_obj = edje_edit_object_add(evas);
125 if (!edje_object_file_set(edje_edit_obj, EDJE_FILE, GROUPNAME))
126 printf("failed to set file %s.\n", EDJE_FILE);
127
128 printf("EDC source code:\n%s\n",
129 edje_edit_source_generate(edje_edit_obj));
130 evas_object_del(edje_edit_obj);
131 }
111} 132}
112 133
113static void 134static void
@@ -171,7 +192,6 @@ _device_added(void *data, const Efl_Event *event)
171int 192int
172main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED) 193main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
173{ 194{
174 const char *edje_file = PACKAGE_DATA_DIR"/multiseat.edj";
175 const Eina_List *devices, *l; 195 const Eina_List *devices, *l;
176 Evas_Object *edje_obj, *bg, *rect; 196 Evas_Object *edje_obj, *bg, *rect;
177 Efl_Input_Device *dev; 197 Efl_Input_Device *dev;
@@ -201,8 +221,8 @@ main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
201 221
202 edje_obj = edje_object_add(evas); 222 edje_obj = edje_object_add(evas);
203 223
204 if (!edje_object_file_set(edje_obj, edje_file, GROUPNAME)) 224 if (!edje_object_file_set(edje_obj, EDJE_FILE, GROUPNAME))
205 printf("failed to set file %s.\n", edje_file); 225 printf("failed to set file %s.\n", EDJE_FILE);
206 226
207 evas_object_move(edje_obj, 0, 0); 227 evas_object_move(edje_obj, 0, 0);
208 evas_object_resize(edje_obj, WIDTH, HEIGHT); 228 evas_object_resize(edje_obj, WIDTH, HEIGHT);
@@ -238,7 +258,7 @@ main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
238 efl_event_callback_add(evas, EFL_CANVAS_EVENT_DEVICE_ADDED, 258 efl_event_callback_add(evas, EFL_CANVAS_EVENT_DEVICE_ADDED,
239 _device_added, edje_obj); 259 _device_added, edje_obj);
240 evas_object_event_callback_add(edje_obj, EVAS_CALLBACK_KEY_DOWN, 260 evas_object_event_callback_add(edje_obj, EVAS_CALLBACK_KEY_DOWN,
241 _on_key_down, NULL); 261 _on_key_down, evas);
242 edje_object_signal_callback_add(edje_obj, "seat,*", "", 262 edje_object_signal_callback_add(edje_obj, "seat,*", "",
243 _edje_seat_cb, NULL); 263 _edje_seat_cb, NULL);
244 edje_object_signal_callback_add(edje_obj, "load", "", 264 edje_object_signal_callback_add(edje_obj, "load", "",
@@ -246,6 +266,8 @@ main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
246 266
247 printf("Running example on evas engine %s\n", 267 printf("Running example on evas engine %s\n",
248 ecore_evas_engine_name_get(ee)); 268 ecore_evas_engine_name_get(ee));
269 printf("Press 'Ctrl + p' to print EDC source code\n");
270
249 ecore_evas_show(ee); 271 ecore_evas_show(ee);
250 272
251 ecore_main_loop_begin(); 273 ecore_main_loop_begin();
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index eab121f498..317892016e 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -13187,13 +13187,25 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str
13187 13187
13188 case EDJE_ACTION_TYPE_FOCUS_SET: 13188 case EDJE_ACTION_TYPE_FOCUS_SET:
13189 { 13189 {
13190 BUF_APPEND(I4 "action: FOCUS_SET;\n"); 13190 if (epr->seat)
13191 {
13192 BUF_APPEND(I4 "action: FOCUS_SET ");
13193 BUF_APPENDF("\"%s\";\n", epr->seat);
13194 }
13195 else
13196 BUF_APPEND(I4 "action: FOCUS_SET;\n");
13191 break; 13197 break;
13192 } 13198 }
13193 13199
13194 case EDJE_ACTION_TYPE_FOCUS_OBJECT: 13200 case EDJE_ACTION_TYPE_FOCUS_OBJECT:
13195 { 13201 {
13196 BUF_APPEND(I4 "action: FOCUS_OBJECT;\n"); 13202 if (epr->seat)
13203 {
13204 BUF_APPEND(I4 "action: FOCUS_OBJECT ");
13205 BUF_APPENDF("\"%s\";\n", epr->seat);
13206 }
13207 else
13208 BUF_APPEND(I4 "action: FOCUS_OBJECT;\n");
13197 break; 13209 break;
13198 } 13210 }
13199 13211