summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-07-23 15:02:12 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-07-23 15:02:12 +0200
commit8227547eb637bb38d6af59e08599a9909a6ac71b (patch)
tree1cb3902867832c786848ef06b15f6b2407f5d9ad
parent29aa5a35b84f18490d2b94acd91abe3c8c78e0c8 (diff)
presentator: add more options to increase and decrease font size
this now also requires a keybindings to start it
-rw-r--r--src/e_mod_main.c74
1 files changed, 65 insertions, 9 deletions
diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index 0447642..3ad961e 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -146,11 +146,9 @@ _msg_from_child_handler_error(void *data EINA_UNUSED, int type EINA_UNUSED, void
146 return ECORE_CALLBACK_PASS_ON; 146 return ECORE_CALLBACK_PASS_ON;
147} 147}
148 148
149E_API void * 149static void
150e_modapi_init(E_Module *m) 150_start_logging(void)
151{ 151{
152 ecore_init();
153
154 string_hash = eina_hash_string_small_new((Eina_Free_Cb)_entry_free); 152 string_hash = eina_hash_string_small_new((Eina_Free_Cb)_entry_free);
155 153
156 notify = elm_notify_add(e_comp->elm); 154 notify = elm_notify_add(e_comp->elm);
@@ -163,25 +161,83 @@ e_modapi_init(E_Module *m)
163 elm_object_content_set(notify, bx); 161 elm_object_content_set(notify, bx);
164 evas_object_show(bx); 162 evas_object_show(bx);
165 163
164 /* FIXME this is only on x11 need a different solution for wl */
166 { 165 {
167 keylogger = ecore_exe_pipe_run(MODULE_DIR"/keylogger", ECORE_EXE_PIPE_WRITE | 166 keylogger = ecore_exe_pipe_run(MODULE_DIR"/keylogger", ECORE_EXE_PIPE_WRITE |
168 ECORE_EXE_PIPE_READ_LINE_BUFFERED | 167 ECORE_EXE_PIPE_READ_LINE_BUFFERED |
169 ECORE_EXE_PIPE_READ, notify); 168 ECORE_EXE_PIPE_READ, notify);
170 EINA_SAFETY_ON_NULL_RETURN_VAL(keylogger, NULL); 169 EINA_SAFETY_ON_NULL_RETURN(keylogger);
171 event_data = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _msg_from_child_handler, NULL); 170 event_data = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _msg_from_child_handler, NULL);
172 event_error = ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _msg_from_child_handler_error, NULL); 171 event_error = ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _msg_from_child_handler_error, NULL);
173 } 172 }
174
175 return m;
176} 173}
177 174
178E_API int 175static void
179e_modapi_shutdown(E_Module *m EINA_UNUSED) 176_stop_logging(void)
180{ 177{
181 E_FREE_FUNC(keylogger, ecore_exe_kill); 178 E_FREE_FUNC(keylogger, ecore_exe_kill);
182 E_FREE_FUNC(notify, evas_object_del); 179 E_FREE_FUNC(notify, evas_object_del);
183 E_FREE_FUNC(event_data, ecore_event_handler_del); 180 E_FREE_FUNC(event_data, ecore_event_handler_del);
184 E_FREE_FUNC(event_error, ecore_event_handler_del); 181 E_FREE_FUNC(event_error, ecore_event_handler_del);
182}
183
184static E_Action *start_stop;
185static Eina_Bool currently_running = EINA_FALSE;
186
187static void
188_toggle_run_mode(E_Object *e, const char *name)
189{
190 if (currently_running)
191 {
192 _stop_logging();
193 currently_running = EINA_FALSE;
194 }
195 else
196 {
197 _start_logging();
198 currently_running = EINA_TRUE;
199 }
200}
201
202static void
203_decrease_fontsize(E_Object *e, const char *name)
204{
205 float scale = elm_object_scale_get(notify);
206 elm_object_scale_set(notify, scale - 0.1);
207}
208
209static void
210_increase_fontsize(E_Object *e, const char *name)
211{
212 float scale = elm_object_scale_get(notify);
213 elm_object_scale_set(notify, scale + 0.1);
214}
215
216E_API void *
217e_modapi_init(E_Module *m)
218{
219 ecore_init();
220
221#define ACTION_ADD(_action, _cb, _title, _value, _params, _example, _editable) \
222 { \
223 const char *_name = _value; \
224 if ((_action = e_action_add(_name))) { \
225 _action->func.go = _cb; \
226 e_action_predef_name_set("Presentator", _title, _name, \
227 _params, _example, _editable); \
228 } \
229 }
230 ACTION_ADD(start_stop, _toggle_run_mode, "Start", "Toggle key highlight mode", NULL, NULL, EINA_FALSE);
231 ACTION_ADD(start_stop, _increase_fontsize, "Increase Fontsize", "Increase Fontsize", NULL, NULL, EINA_FALSE);
232 ACTION_ADD(start_stop, _decrease_fontsize, "Decrease Fontsize", "Decrease Fontsize", NULL, NULL, EINA_FALSE);
233#undef ACTION_ADD
234
235 return m;
236}
237
238E_API int
239e_modapi_shutdown(E_Module *m EINA_UNUSED)
240{
185 241
186 ecore_shutdown(); 242 ecore_shutdown();
187 return 1; 243 return 1;