summaryrefslogtreecommitdiff
path: root/src/lib/ecore_cocoa/ecore_cocoa_window.m
diff options
context:
space:
mode:
authorRomain Perier <romain.perier@openwide.fr>2015-01-15 17:20:16 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-05 16:38:07 +0100
commitc6945c075ec108509a187d7ee1df735afa4bf0ff (patch)
tree188911a2f773621f6ed40500e879b92a22f70c65 /src/lib/ecore_cocoa/ecore_cocoa_window.m
parent382957c2b3d7f3c200072d5b1f00423978fafec2 (diff)
ecore_cocoa: use the right Cocoa notification handlers for focus events
Don't use NSAppKitDefined events subtype for focus events, which contain NULL window object most of the time. Use the NSWindowDelegate method designed for that purpose instead. It fixes random focus issues in windows which was caused by incorrect window identifier not found in ecore_evas_cocoa. Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_window.m28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m
index 754caa8c0b..9739220b60 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_window.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m
@@ -69,6 +69,34 @@
69 ecore_main_loop_iterate(); 69 ecore_main_loop_iterate();
70} 70}
71 71
72- (void)windowDidBecomeKey:(NSNotification *)notification
73{
74 Ecore_Cocoa_Event_Window *e;
75
76 e = malloc(sizeof(Ecore_Cocoa_Event_Window));
77 if (!e)
78 {
79 printf("GOT_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n");
80 return;
81 }
82 e->wid = [notification object];
83 ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL);
84}
85
86- (void)windowDidResignKey:(NSNotification *)notification
87{
88 Ecore_Cocoa_Event_Window *e;
89
90 e = malloc(sizeof(Ecore_Cocoa_Event_Window));
91 if (!e)
92 {
93 printf("LOST_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n");
94 return;
95 }
96 e->wid = [notification object];
97 ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL);
98}
99
72@end 100@end
73 101
74 102