summaryrefslogtreecommitdiff
path: root/src/periodic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/periodic.c')
-rw-r--r--src/periodic.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/periodic.c b/src/periodic.c
index b4f51ed3..0558ed50 100644
--- a/src/periodic.c
+++ b/src/periodic.c
@@ -107,14 +107,17 @@ iBool dispatchCommands_Periodic(iPeriodic *d) {
107 iConstForEach(Array, i, &d->commands.values) { 107 iConstForEach(Array, i, &d->commands.values) {
108 const iPeriodicCommand *pc = i.value; 108 const iPeriodicCommand *pc = i.value;
109 iAssert(isInstance_Object(pc->context, &Class_Widget)); 109 iAssert(isInstance_Object(pc->context, &Class_Widget));
110 const SDL_UserEvent ev = { 110 iRoot *root = constAs_Widget(pc->context)->root;
111 .type = SDL_USEREVENT, 111 if (root) {
112 .code = command_UserEventCode, 112 const SDL_UserEvent ev = {
113 .data1 = (void *) cstr_String(&pc->command), 113 .type = SDL_USEREVENT,
114 .data2 = findRoot_Window(get_Window(), pc->context) 114 .code = command_UserEventCode,
115 }; 115 .data1 = (void *) cstr_String(&pc->command),
116 if (ev.data2) { 116 .data2 = root,
117 setCurrent_Root(ev.data2); 117 .windowID = id_Window(root->window),
118 };
119 setCurrent_Window(root->window);
120 setCurrent_Root(root);
118 dispatchEvent_Widget(pc->context, (const SDL_Event *) &ev); 121 dispatchEvent_Widget(pc->context, (const SDL_Event *) &ev);
119 wasPosted = iTrue; 122 wasPosted = iTrue;
120 } 123 }