summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-01-22 16:23:21 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-02-02 13:37:35 -0500
commite5e2a7cca4bf86ee70444b52ec0640888601d503 (patch)
tree76ed7e3648a713408b29b2ce373d2c9556316876
parente84ea043ac1494189b970b5b87c4d7efd5763069 (diff)
defer screenshot action execution using a job
the drm screenshot action forcefully iterates the main loop, causing the current loop (which triggered the action) to return after the screenshot action has ended. during this time, it's possible for other actions to also trigger, including triggering subsequent screenshot actions, so it's necessary to defer the execution of the action until after the initial loop which triggered the action has returned #Recursion
-rw-r--r--src/modules/shot/e_mod_main.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c
index 0174bbb6b..1663a9ee7 100644
--- a/src/modules/shot/e_mod_main.c
+++ b/src/modules/shot/e_mod_main.c
@@ -1193,10 +1193,31 @@ _e_mod_action_border_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSE
1193 _wl_shot_now(NULL, ec, NULL); 1193 _wl_shot_now(NULL, ec, NULL);
1194} 1194}
1195 1195
1196typedef struct
1197{
1198 E_Zone *zone;
1199 char *params;
1200} Delayed_Shot;
1201
1202static void
1203_delayed_shot(void *data)
1204{
1205 Delayed_Shot *ds = data;
1206
1207 if (e_comp->comp_type == E_PIXMAP_TYPE_X)
1208 _x_shot_now(ds->zone, NULL, ds->params);
1209 else
1210 _wl_shot_now(ds->zone, NULL, ds->params);
1211 e_object_unref(E_OBJECT(ds->zone));
1212 free(ds->params);
1213 free(ds);
1214}
1215
1196static void 1216static void
1197_e_mod_action_cb(E_Object *obj, const char *params) 1217_e_mod_action_cb(E_Object *obj, const char *params)
1198{ 1218{
1199 E_Zone *zone = NULL; 1219 E_Zone *zone = NULL;
1220 Delayed_Shot *ds;
1200 1221
1201 if (obj) 1222 if (obj)
1202 { 1223 {
@@ -1210,10 +1231,14 @@ _e_mod_action_cb(E_Object *obj, const char *params)
1210 if (!zone) zone = e_zone_current_get(); 1231 if (!zone) zone = e_zone_current_get();
1211 if (!zone) return; 1232 if (!zone) return;
1212 E_FREE_FUNC(timer, ecore_timer_del); 1233 E_FREE_FUNC(timer, ecore_timer_del);
1213 if (e_comp->comp_type == E_PIXMAP_TYPE_X) 1234 ds = E_NEW(Delayed_Shot, 1);
1214 _x_shot_now(zone, NULL, params); 1235 e_object_ref(E_OBJECT(zone));
1215 else 1236 ds->zone = zone;
1216 _wl_shot_now(zone, NULL, params); 1237 ds->params = params ? strdup(params) : NULL;
1238 /* forced main loop iteration in screenshots causes bugs if the action
1239 * executes immediately
1240 */
1241 ecore_job_add(_delayed_shot, ds);
1217} 1242}
1218 1243
1219static void 1244static void