summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-07-22 10:53:03 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-07-22 10:53:03 +0200
commitbfb50d06ea87f0c5fb9aa88b7dc571a3a2a67d05 (patch)
tree31301f632de3c056645f93af8ab432de5472f6da
parent70386bc094a70c5a68ae614c37a1100a501d8e73 (diff)
cleanup on shutdown correctly
-rw-r--r--src/e_mod_main.c19
-rw-r--r--src/keylogger.c3
2 files changed, 10 insertions, 12 deletions
diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index fd7d5d0..e56dd2d 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -1,5 +1,5 @@
1#include "e.h" 1#include "e.h"
2 2#include "../config.h"
3/* module setup */ 3/* module setup */
4E_API E_Module_Api e_modapi = 4E_API E_Module_Api e_modapi =
5{ 5{
@@ -10,7 +10,7 @@ E_API E_Module_Api e_modapi =
10static Evas_Object *notify, *bx; 10static Evas_Object *notify, *bx;
11static Eina_Hash *string_hash; 11static Eina_Hash *string_hash;
12static int entry_counter = 0; 12static int entry_counter = 0;
13 13static Ecore_Event_Handler *event_data, *event_error;
14static Ecore_Exe *keylogger; 14static Ecore_Exe *keylogger;
15 15
16typedef struct { 16typedef struct {
@@ -23,9 +23,6 @@ typedef struct {
23static void 23static void
24_del_key(const char *name) 24_del_key(const char *name)
25{ 25{
26 Evas_Object *o;
27 Eina_List *list;
28
29 Entry *e = eina_hash_find(string_hash, name); 26 Entry *e = eina_hash_find(string_hash, name);
30 27
31 //something fishy is going on sometimes, then we dont even have a entry 28 //something fishy is going on sometimes, then we dont even have a entry
@@ -146,7 +143,7 @@ e_modapi_init(E_Module *m)
146{ 143{
147 ecore_init(); 144 ecore_init();
148 145
149 string_hash = eina_hash_string_small_new(_entry_free); 146 string_hash = eina_hash_string_small_new((Eina_Free_Cb)_entry_free);
150 147
151 notify = elm_notify_add(e_comp->elm); 148 notify = elm_notify_add(e_comp->elm);
152 elm_notify_allow_events_set(notify, EINA_TRUE); 149 elm_notify_allow_events_set(notify, EINA_TRUE);
@@ -159,12 +156,12 @@ e_modapi_init(E_Module *m)
159 evas_object_show(bx); 156 evas_object_show(bx);
160 157
161 { 158 {
162 keylogger = ecore_exe_pipe_run("/usr/local/bin/keylogger", ECORE_EXE_PIPE_WRITE | 159 keylogger = ecore_exe_pipe_run(MODULE_DIR"/keylogger", ECORE_EXE_PIPE_WRITE |
163 ECORE_EXE_PIPE_READ_LINE_BUFFERED | 160 ECORE_EXE_PIPE_READ_LINE_BUFFERED |
164 ECORE_EXE_PIPE_READ, notify); 161 ECORE_EXE_PIPE_READ, notify);
165 EINA_SAFETY_ON_NULL_RETURN_VAL(keylogger, NULL); 162 EINA_SAFETY_ON_NULL_RETURN_VAL(keylogger, NULL);
166 ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _msg_from_child_handler, NULL); 163 event_data = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _msg_from_child_handler, NULL);
167 ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _msg_from_child_handler_error, NULL); 164 event_error = ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _msg_from_child_handler_error, NULL);
168 } 165 }
169 166
170 return m; 167 return m;
@@ -173,6 +170,10 @@ e_modapi_init(E_Module *m)
173E_API int 170E_API int
174e_modapi_shutdown(E_Module *m EINA_UNUSED) 171e_modapi_shutdown(E_Module *m EINA_UNUSED)
175{ 172{
173 E_FREE_FUNC(keylogger, ecore_exe_kill);
174 E_FREE_FUNC(notify, evas_object_del);
175 E_FREE_FUNC(event_data, ecore_event_handler_del);
176 E_FREE_FUNC(event_error, ecore_event_handler_del);
176 177
177 ecore_shutdown(); 178 ecore_shutdown();
178 return 1; 179 return 1;
diff --git a/src/keylogger.c b/src/keylogger.c
index dae2177..525c657 100644
--- a/src/keylogger.c
+++ b/src/keylogger.c
@@ -24,8 +24,6 @@ _release(const char *symbol)
24} 24}
25 25
26int main(void) { 26int main(void) {
27
28 int i;
29 int number = 0; 27 int number = 0;
30 int run = 1; 28 int run = 1;
31 int default_screen; 29 int default_screen;
@@ -34,7 +32,6 @@ int main(void) {
34 Window root_window; 32 Window root_window;
35 XEvent e; 33 XEvent e;
36 XDeviceKeyEvent * key; 34 XDeviceKeyEvent * key;
37 XInputClassInfo *ip;
38 XEventClass event_list[20]; 35 XEventClass event_list[20];
39 36
40 default_display = XOpenDisplay(getenv("DISPLAY")); 37 default_display = XOpenDisplay(getenv("DISPLAY"));