summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@gmail.com>2016-05-18 19:45:03 +0200
committerJean Guyomarc'h <jean.guyomarch@gmail.com>2016-05-18 19:45:03 +0200
commit6b73832d57709df13349ea30a8b1f05c20656255 (patch)
tree8b92c2779e5a633c8250578555d3d67b9c36e991
parent82e013160a546f72fdfe65c0344b572ee527ad59 (diff)
wip: should be ok - needs testing with scriptdevs/jayji/osx-notifications
-rw-r--r--src/Makefile_Ecore_Cocoa.am1
-rw-r--r--src/Makefile_Elementary.am2
-rw-r--r--src/lib/ecore_cocoa/Ecore_Cocoa.h82
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa.m5
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_notification.m86
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_private.h2
-rw-r--r--src/lib/elementary/Makefile.am2
-rw-r--r--src/lib/elementary/elm_sys_notify.c75
-rw-r--r--src/lib/elementary/elm_sys_notify_cocoa.c87
-rw-r--r--src/lib/elementary/elm_sys_notify_cocoa.eo12
-rw-r--r--src/lib/elementary/elm_sys_notify_cocoa.m50
-rw-r--r--src/lib/elementary/elm_sys_notify_dbus.c14
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c2
13 files changed, 385 insertions, 35 deletions
diff --git a/src/Makefile_Ecore_Cocoa.am b/src/Makefile_Ecore_Cocoa.am
index 1283125d4f..40fb175912 100644
--- a/src/Makefile_Ecore_Cocoa.am
+++ b/src/Makefile_Ecore_Cocoa.am
@@ -13,6 +13,7 @@ lib/ecore_cocoa/ecore_cocoa.m \
13lib/ecore_cocoa/ecore_cocoa_keys.h \ 13lib/ecore_cocoa/ecore_cocoa_keys.h \
14lib/ecore_cocoa/ecore_cocoa_window.h \ 14lib/ecore_cocoa/ecore_cocoa_window.h \
15lib/ecore_cocoa/ecore_cocoa_window.m \ 15lib/ecore_cocoa/ecore_cocoa_window.m \
16lib/ecore_cocoa/ecore_cocoa_notification.m \
16lib/ecore_cocoa/ecore_cocoa_cnp.m \ 17lib/ecore_cocoa/ecore_cocoa_cnp.m \
17lib/ecore_cocoa/ecore_cocoa_app.m \ 18lib/ecore_cocoa/ecore_cocoa_app.m \
18lib/ecore_cocoa/ecore_cocoa_app.h \ 19lib/ecore_cocoa/ecore_cocoa_app.h \
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 83dac45cb1..9f5e8c71d7 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -87,6 +87,7 @@ elm_public_eolian_files = \
87 lib/elementary/elm_sys_notify_interface.eo \ 87 lib/elementary/elm_sys_notify_interface.eo \
88 lib/elementary/elm_sys_notify.eo \ 88 lib/elementary/elm_sys_notify.eo \
89 lib/elementary/elm_sys_notify_dbus.eo \ 89 lib/elementary/elm_sys_notify_dbus.eo \
90 lib/elementary/elm_sys_notify_cocoa.eo \
90 lib/elementary/elm_systray.eo \ 91 lib/elementary/elm_systray.eo \
91 lib/elementary/elm_thumb.eo \ 92 lib/elementary/elm_thumb.eo \
92 lib/elementary/elm_toolbar.eo \ 93 lib/elementary/elm_toolbar.eo \
@@ -617,6 +618,7 @@ lib_elementary_libelementary_la_SOURCES = \
617 lib/elementary/elm_sys_notify_interface.c \ 618 lib/elementary/elm_sys_notify_interface.c \
618 lib/elementary/elm_sys_notify.c \ 619 lib/elementary/elm_sys_notify.c \
619 lib/elementary/elm_sys_notify_dbus.c \ 620 lib/elementary/elm_sys_notify_dbus.c \
621 lib/elementary/elm_sys_notify_cocoa.c \
620 lib/elementary/elm_table.c \ 622 lib/elementary/elm_table.c \
621 lib/elementary/elm_theme.c \ 623 lib/elementary/elm_theme.c \
622 lib/elementary/elm_thumb.c \ 624 lib/elementary/elm_thumb.c \
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h
index 1e73b7fe9e..2ad47d54d4 100644
--- a/src/lib/ecore_cocoa/Ecore_Cocoa.h
+++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h
@@ -8,16 +8,6 @@
8#ifndef __ECORE_COCOA_H__ 8#ifndef __ECORE_COCOA_H__
9#define __ECORE_COCOA_H__ 9#define __ECORE_COCOA_H__
10 10
11/*
12 * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND
13 * THE API MAY CHANGE.
14 */
15
16#ifndef ECORE_COCOA_WIP_GNSIDNQI
17# warning "You are using a work in progress API. This API is not stable"
18# warning "and is subject to change. You use this at your own risk."
19#endif
20
21#include <Eina.h> 11#include <Eina.h>
22 12
23#ifdef EAPI 13#ifdef EAPI
@@ -43,6 +33,7 @@ extern "C" {
43/** 33/**
44 * @typedef Ecore_Cocoa_Window 34 * @typedef Ecore_Cocoa_Window
45 * Opaque handler to manipulate a Cocoa Window through Ecore 35 * Opaque handler to manipulate a Cocoa Window through Ecore
36 * @since 1.18
46 */ 37 */
47typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; 38typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
48#endif /* ! _ECORE_COCOA_WINDOW_PREDEF */ 39#endif /* ! _ECORE_COCOA_WINDOW_PREDEF */
@@ -50,36 +41,42 @@ typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
50/** 41/**
51 * @typedef Ecore_Cocoa_Screen 42 * @typedef Ecore_Cocoa_Screen
52 * Opaque handler to manipulate a Cocoa Screen through Ecore 43 * Opaque handler to manipulate a Cocoa Screen through Ecore
44 * @since 1.18
53 */ 45 */
54typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen; 46typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen;
55 47
56/** 48/**
57 * @typedef Ecore_Cocoa_Object 49 * @typedef Ecore_Cocoa_Object
58 * Opaque handler to refer to an objective-c object (aka id) 50 * Opaque handler to refer to an objective-c object (aka id)
51 * @since 1.18
59 */ 52 */
60typedef void Ecore_Cocoa_Object; 53typedef void Ecore_Cocoa_Object;
61 54
62/** 55/**
63 * @typedef Ecore_Cocoa_Event_Window_Resize_Request 56 * @typedef Ecore_Cocoa_Event_Window_Resize_Request
64 * Type of event thrown when a Cocoa window is resized 57 * Type of event thrown when a Cocoa window is resized
58 * @since 1.18
65 */ 59 */
66typedef struct _Ecore_Cocoa_Event_Window_Resize_Request Ecore_Cocoa_Event_Window_Resize_Request; 60typedef struct _Ecore_Cocoa_Event_Window_Resize_Request Ecore_Cocoa_Event_Window_Resize_Request;
67 61
68/** 62/**
69 * @typedef Ecore_Cocoa_Event_Window_Focused 63 * @typedef Ecore_Cocoa_Event_Window_Focused
70 * Type of event thrown when a Cocoa window receives focus 64 * Type of event thrown when a Cocoa window receives focus
65 * @since 1.18
71 */ 66 */
72typedef struct _Ecore_Cocoa_Event_Window_Focused Ecore_Cocoa_Event_Window_Focused; 67typedef struct _Ecore_Cocoa_Event_Window_Focused Ecore_Cocoa_Event_Window_Focused;
73 68
74/** 69/**
75 * @typedef Ecore_Cocoa_Event_Window_Unfocused 70 * @typedef Ecore_Cocoa_Event_Window_Unfocused
76 * Type of event thrown when a Cocoa window loses the focus 71 * Type of event thrown when a Cocoa window loses the focus
72 * @since 1.18
77 */ 73 */
78typedef struct _Ecore_Cocoa_Event_Window_Unfocused Ecore_Cocoa_Event_Window_Unfocused; 74typedef struct _Ecore_Cocoa_Event_Window_Unfocused Ecore_Cocoa_Event_Window_Unfocused;
79 75
80/** 76/**
81 * @typedef Ecore_Cocoa_Event_Window_Destroy 77 * @typedef Ecore_Cocoa_Event_Window_Destroy
82 * Type of event thrown when a Cocoa window gets destoyed 78 * Type of event thrown when a Cocoa window gets destoyed
79 * @since 1.18
83 */ 80 */
84typedef struct _Ecore_Cocoa_Event_Window_Destroy Ecore_Cocoa_Event_Window_Destroy; 81typedef struct _Ecore_Cocoa_Event_Window_Destroy Ecore_Cocoa_Event_Window_Destroy;
85 82
@@ -87,6 +84,7 @@ typedef struct _Ecore_Cocoa_Event_Window_Destroy Ecore_Cocoa_Event_Window_Destro
87 * @typedef Ecore_Cocoa_Cursor 84 * @typedef Ecore_Cocoa_Cursor
88 * Values of the Cocoa cursors handled by Ecore_Cocoa 85 * Values of the Cocoa cursors handled by Ecore_Cocoa
89 * See https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCursor_Class/index.html for images of each cursors. 86 * See https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCursor_Class/index.html for images of each cursors.
87 * @since 1.18
90 */ 88 */
91typedef enum 89typedef enum
92{ 90{
@@ -116,21 +114,29 @@ typedef enum
116} Ecore_Cocoa_Cursor; 114} Ecore_Cocoa_Cursor;
117 115
118 116
119/** Event triggered when a Cocoa window receives focus */ 117/** Event triggered when a Cocoa window receives focus
118 * @since 1.18
119 */
120EAPI extern int ECORE_COCOA_EVENT_WINDOW_FOCUSED; 120EAPI extern int ECORE_COCOA_EVENT_WINDOW_FOCUSED;
121 121
122/** Event triggered when a Cocoa window loses focus */ 122/**
123 * Event triggered when a Cocoa window loses focus
124 * @since 1.18
125 */
123EAPI extern int ECORE_COCOA_EVENT_WINDOW_UNFOCUSED; 126EAPI extern int ECORE_COCOA_EVENT_WINDOW_UNFOCUSED;
124 127
125/** Event triggered when a Cocoa window is resized */ 128/** Event triggered when a Cocoa window is resized */
126EAPI extern int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST; 129EAPI extern int ECORE_COCOA_EVENT_WINDOW_RESIZE_REQUEST;
127 130
128/** Event triggered when a Cocoa window get destroyed */ 131/** Event triggered when a Cocoa window get destroyed
132 * @since 1.18
133 */
129EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY; 134EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY;
130 135
131/** 136/**
132 * @struct _Ecore_Cocoa_Event_Window_Resize_Request 137 * @struct _Ecore_Cocoa_Event_Window_Resize_Request
133 * Data available when a window is resized 138 * Data available when a window is resized
139 * @since 1.18
134 */ 140 */
135struct _Ecore_Cocoa_Event_Window_Resize_Request 141struct _Ecore_Cocoa_Event_Window_Resize_Request
136{ 142{
@@ -142,6 +148,7 @@ struct _Ecore_Cocoa_Event_Window_Resize_Request
142/** 148/**
143 * @struct _Ecore_Cocoa_Event_Window_Focused 149 * @struct _Ecore_Cocoa_Event_Window_Focused
144 * Data available when a Cocoa window receives focus 150 * Data available when a Cocoa window receives focus
151 * @since 1.18
145 */ 152 */
146struct _Ecore_Cocoa_Event_Window_Focused 153struct _Ecore_Cocoa_Event_Window_Focused
147{ 154{
@@ -151,6 +158,7 @@ struct _Ecore_Cocoa_Event_Window_Focused
151/** 158/**
152 * @struct _Ecore_Cocoa_Event_Window_Unfocused 159 * @struct _Ecore_Cocoa_Event_Window_Unfocused
153 * Data available when a Cocoa window losrs focus 160 * Data available when a Cocoa window losrs focus
161 * @since 1.18
154 */ 162 */
155struct _Ecore_Cocoa_Event_Window_Unfocused 163struct _Ecore_Cocoa_Event_Window_Unfocused
156{ 164{
@@ -160,6 +168,7 @@ struct _Ecore_Cocoa_Event_Window_Unfocused
160/** 168/**
161 * @struct _Ecore_Cocoa_Event_Window_Destroy 169 * @struct _Ecore_Cocoa_Event_Window_Destroy
162 * Data available when a Cocoa window is destroyed 170 * Data available when a Cocoa window is destroyed
171 * @since 1.18
163 */ 172 */
164struct _Ecore_Cocoa_Event_Window_Destroy 173struct _Ecore_Cocoa_Event_Window_Destroy
165{ 174{
@@ -170,6 +179,7 @@ struct _Ecore_Cocoa_Event_Window_Destroy
170 * @typedef Ecore_Cocoa_Cnp_Type 179 * @typedef Ecore_Cocoa_Cnp_Type
171 * Type used to interact with the Cocoa pasteboard. 180 * Type used to interact with the Cocoa pasteboard.
172 * It hold types that can apply to a context. 181 * It hold types that can apply to a context.
182 * @since 1.18
173 */ 183 */
174typedef enum 184typedef enum
175{ 185{
@@ -188,12 +198,14 @@ typedef enum
188/** 198/**
189 * Inits the Ecore_Cocoa library 199 * Inits the Ecore_Cocoa library
190 * @return How many times Ecore_Cocoa has been initted 200 * @return How many times Ecore_Cocoa has been initted
201 * @since 1.18
191 */ 202 */
192EAPI int ecore_cocoa_init(void); 203EAPI int ecore_cocoa_init(void);
193 204
194/** 205/**
195 * Shuts the Ecore_Cocoa library down 206 * Shuts the Ecore_Cocoa library down
196 * @return How many times Ecore_Cocoa has been initted 207 * @return How many times Ecore_Cocoa has been initted
208 * @since 1.18
197 */ 209 */
198EAPI int ecore_cocoa_shutdown(void); 210EAPI int ecore_cocoa_shutdown(void);
199 211
@@ -207,6 +219,7 @@ EAPI int ecore_cocoa_shutdown(void);
207 * @param screen The screen which size must be retrieved 219 * @param screen The screen which size must be retrieved
208 * @param [out] w The width of the screen 220 * @param [out] w The width of the screen
209 * @param [out] h The height of the screen 221 * @param [out] h The height of the screen
222 * @since 1.18
210 */ 223 */
211EAPI void ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h); 224EAPI void ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h);
212 225
@@ -222,6 +235,7 @@ EAPI void ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h
222 * @param w The width of the window 235 * @param w The width of the window
223 * @param h The height of the window 236 * @param h The height of the window
224 * @return A handler on the window. NULL on failure 237 * @return A handler on the window. NULL on failure
238 * @since 1.18
225 */ 239 */
226EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x, 240EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x,
227 int y, 241 int y,
@@ -233,6 +247,7 @@ EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x,
233/** 247/**
234 * Releases a Cocoa window 248 * Releases a Cocoa window
235 * @param window The window to be released 249 * @param window The window to be released
250 * @since 1.18
236 */ 251 */
237EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window) 252EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window)
238 EINA_ARG_NONNULL(1); 253 EINA_ARG_NONNULL(1);
@@ -242,6 +257,7 @@ EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window)
242 * @param window The window to be moved 257 * @param window The window to be moved
243 * @param x The new origin of the window (X) 258 * @param x The new origin of the window (X)
244 * @param y The new origin of the window (Y) 259 * @param y The new origin of the window (Y)
260 * @since 1.18
245 */ 261 */
246EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window, 262EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
247 int x, 263 int x,
@@ -253,6 +269,7 @@ EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
253 * @param window The window to be moved 269 * @param window The window to be moved
254 * @param w The new width of the window 270 * @param w The new width of the window
255 * @param h The new height of the window 271 * @param h The new height of the window
272 * @since 1.18
256 */ 273 */
257EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window, 274EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
258 int w, 275 int w,
@@ -269,6 +286,7 @@ EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
269 * 286 *
270 * @see ecore_cocoa_window_resize() 287 * @see ecore_cocoa_window_resize()
271 * @see ecore_cocoa_window_move() 288 * @see ecore_cocoa_window_move()
289 * @since 1.18
272 */ 290 */
273EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window, 291EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
274 int x, 292 int x,
@@ -284,6 +302,7 @@ EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
284 * @param y Pointer used to retrieve its origin in Y 302 * @param y Pointer used to retrieve its origin in Y
285 * @param w Pointer used to retrieve its width 303 * @param w Pointer used to retrieve its width
286 * @param h Pointer used to retrieve its height 304 * @param h Pointer used to retrieve its height
305 * @since 1.18
287 */ 306 */
288EAPI void ecore_cocoa_window_geometry_get(const Ecore_Cocoa_Window *window, 307EAPI void ecore_cocoa_window_geometry_get(const Ecore_Cocoa_Window *window,
289 int *x, 308 int *x,
@@ -297,6 +316,7 @@ EAPI void ecore_cocoa_window_geometry_get(const Ecore_Cocoa_Window *window,
297 * @param window The window which size is queried 316 * @param window The window which size is queried
298 * @param w Pointer used to retrieve its width 317 * @param w Pointer used to retrieve its width
299 * @param h Pointer used to retrieve its height 318 * @param h Pointer used to retrieve its height
319 * @since 1.18
300 */ 320 */
301EAPI void ecore_cocoa_window_size_get(const Ecore_Cocoa_Window *window, 321EAPI void ecore_cocoa_window_size_get(const Ecore_Cocoa_Window *window,
302 int *w, 322 int *w,
@@ -308,6 +328,7 @@ EAPI void ecore_cocoa_window_size_get(const Ecore_Cocoa_Window *window,
308 * @param window The window which minimum size is to be altered 328 * @param window The window which minimum size is to be altered
309 * @param w The new minimum width of the window 329 * @param w The new minimum width of the window
310 * @param h The new minimum height of the window 330 * @param h The new minimum height of the window
331 * @since 1.18
311 */ 332 */
312EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window, 333EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
313 int w, 334 int w,
@@ -319,6 +340,7 @@ EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
319 * @param window The window which minimum size is queried 340 * @param window The window which minimum size is queried
320 * @param w Pointer used to retrieve its minimum width 341 * @param w Pointer used to retrieve its minimum width
321 * @param h Pointer used to retrieve its minimum height 342 * @param h Pointer used to retrieve its minimum height
343 * @since 1.18
322 */ 344 */
323EAPI void ecore_cocoa_window_size_min_get(const Ecore_Cocoa_Window *window, 345EAPI void ecore_cocoa_window_size_min_get(const Ecore_Cocoa_Window *window,
324 int *w, 346 int *w,
@@ -330,6 +352,7 @@ EAPI void ecore_cocoa_window_size_min_get(const Ecore_Cocoa_Window *window,
330 * @param window The window which maximum size is to be altered 352 * @param window The window which maximum size is to be altered
331 * @param w The new maximum width of the window 353 * @param w The new maximum width of the window
332 * @param h The new maximum height of the window 354 * @param h The new maximum height of the window
355 * @since 1.18
333 */ 356 */
334EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window, 357EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
335 int w, 358 int w,
@@ -341,6 +364,7 @@ EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
341 * @param window The window which maximum size is queried 364 * @param window The window which maximum size is queried
342 * @param w Pointer used to retrieve its maximum width 365 * @param w Pointer used to retrieve its maximum width
343 * @param h Pointer used to retrieve its maximum height 366 * @param h Pointer used to retrieve its maximum height
367 * @since 1.18
344 */ 368 */
345EAPI void ecore_cocoa_window_size_max_get(const Ecore_Cocoa_Window *window, 369EAPI void ecore_cocoa_window_size_max_get(const Ecore_Cocoa_Window *window,
346 int *w, 370 int *w,
@@ -352,6 +376,7 @@ EAPI void ecore_cocoa_window_size_max_get(const Ecore_Cocoa_Window *window,
352 * @param window The Cocoa window which resize increment is to be set 376 * @param window The Cocoa window which resize increment is to be set
353 * @param w The width size increment 377 * @param w The width size increment
354 * @param h The height size increment 378 * @param h The height size increment
379 * @since 1.18
355 */ 380 */
356EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window, 381EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
357 int w, 382 int w,
@@ -363,6 +388,7 @@ EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
363 * @param window The Cocoa window which resize increment queried 388 * @param window The Cocoa window which resize increment queried
364 * @param w The width size increment 389 * @param w The width size increment
365 * @param h The height size increment 390 * @param h The height size increment
391 * @since 1.18
366 */ 392 */
367EAPI void ecore_cocoa_window_size_step_get(const Ecore_Cocoa_Window *window, 393EAPI void ecore_cocoa_window_size_step_get(const Ecore_Cocoa_Window *window,
368 int *w, 394 int *w,
@@ -372,6 +398,7 @@ EAPI void ecore_cocoa_window_size_step_get(const Ecore_Cocoa_Window *window,
372/** 398/**
373 * Display a Cocoa window 399 * Display a Cocoa window
374 * @param window The Cocoa window to be displayed 400 * @param window The Cocoa window to be displayed
401 * @since 1.18
375 */ 402 */
376EAPI void ecore_cocoa_window_show(Ecore_Cocoa_Window *window) 403EAPI void ecore_cocoa_window_show(Ecore_Cocoa_Window *window)
377 EINA_ARG_NONNULL(1); 404 EINA_ARG_NONNULL(1);
@@ -379,6 +406,7 @@ EAPI void ecore_cocoa_window_show(Ecore_Cocoa_Window *window)
379/** 406/**
380 * Hide a Cocoa window 407 * Hide a Cocoa window
381 * @param window The Cocoa window to be hid 408 * @param window The Cocoa window to be hid
409 * @since 1.18
382 */ 410 */
383EAPI void ecore_cocoa_window_hide(Ecore_Cocoa_Window *window) 411EAPI void ecore_cocoa_window_hide(Ecore_Cocoa_Window *window)
384 EINA_ARG_NONNULL(1); 412 EINA_ARG_NONNULL(1);
@@ -386,6 +414,7 @@ EAPI void ecore_cocoa_window_hide(Ecore_Cocoa_Window *window)
386/** 414/**
387 * Brings a Cocoa window to front 415 * Brings a Cocoa window to front
388 * @param window The Cocoa window to be raised 416 * @param window The Cocoa window to be raised
417 * @since 1.18
389 */ 418 */
390EAPI void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window) 419EAPI void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window)
391 EINA_ARG_NONNULL(1); 420 EINA_ARG_NONNULL(1);
@@ -393,6 +422,7 @@ EAPI void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window)
393/** 422/**
394 * Brings a Cocoa window back 423 * Brings a Cocoa window back
395 * @param window The Cocoa window to be lowered 424 * @param window The Cocoa window to be lowered
425 * @since 1.18
396 */ 426 */
397EAPI void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window) 427EAPI void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window)
398 EINA_ARG_NONNULL(1); 428 EINA_ARG_NONNULL(1);
@@ -400,6 +430,7 @@ EAPI void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window)
400/** 430/**
401 * Makes a Cocoa window the current key window by raising it 431 * Makes a Cocoa window the current key window by raising it
402 * @param window The Cocoa window to be activated 432 * @param window The Cocoa window to be activated
433 * @since 1.18
403 */ 434 */
404EAPI void ecore_cocoa_window_activate(Ecore_Cocoa_Window *window) 435EAPI void ecore_cocoa_window_activate(Ecore_Cocoa_Window *window)
405 EINA_ARG_NONNULL(1); 436 EINA_ARG_NONNULL(1);
@@ -417,6 +448,7 @@ EAPI void ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window,
417 * Miniaturize or deminiaturize a Cocoa window 448 * Miniaturize or deminiaturize a Cocoa window
418 * @param window The Cocoa window which iconify status is to be changed 449 * @param window The Cocoa window which iconify status is to be changed
419 * @param on If #EINA_TRUE, will miniaturize the window. Will deminiaturize it if #EINA_FALSE 450 * @param on If #EINA_TRUE, will miniaturize the window. Will deminiaturize it if #EINA_FALSE
451 * @since 1.18
420 */ 452 */
421EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window, 453EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
422 Eina_Bool on) 454 Eina_Bool on)
@@ -426,6 +458,7 @@ EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
426 * Manage the borders of a Cocoa window 458 * Manage the borders of a Cocoa window
427 * @param window The Cocoa window which borders are to be changed 459 * @param window The Cocoa window which borders are to be changed
428 * @param on If #EINA_TRUE, will remove borders. Will restore them if #EINA_FALSE 460 * @param on If #EINA_TRUE, will remove borders. Will restore them if #EINA_FALSE
461 * @since 1.18
429 */ 462 */
430EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window, 463EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
431 Eina_Bool on) 464 Eina_Bool on)
@@ -435,6 +468,7 @@ EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
435 * Set the content view of a Cocoa window 468 * Set the content view of a Cocoa window
436 * @param window The Cocoa window which internal view is to be set 469 * @param window The Cocoa window which internal view is to be set
437 * @param view The NSView to be set as @c window content view 470 * @param view The NSView to be set as @c window content view
471 * @since 1.18
438 */ 472 */
439EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window, 473EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
440 Ecore_Cocoa_Object *view) 474 Ecore_Cocoa_Object *view)
@@ -444,6 +478,7 @@ EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
444/** 478/**
445 * Get the height of the title bar of Cocoa windows 479 * Get the height of the title bar of Cocoa windows
446 * @return The height of the title bar of Cocoa windows 480 * @return The height of the title bar of Cocoa windows
481 * @since 1.18
447 */ 482 */
448EAPI int ecore_cocoa_titlebar_height_get(void); 483EAPI int ecore_cocoa_titlebar_height_get(void);
449 484
@@ -451,6 +486,7 @@ EAPI int ecore_cocoa_titlebar_height_get(void);
451 * Retrieves the actual NSWindow behind the Ecore_Cocoa wrapper 486 * Retrieves the actual NSWindow behind the Ecore_Cocoa wrapper
452 * @param window The Ecore_Cocoa wrapper which window is to be retrieved 487 * @param window The Ecore_Cocoa wrapper which window is to be retrieved
453 * @return The Cocoa NSWindow manipulated by @c window 488 * @return The Cocoa NSWindow manipulated by @c window
489 * @since 1.18
454 */ 490 */
455EAPI Ecore_Cocoa_Object *ecore_cocoa_window_get(const Ecore_Cocoa_Window *window) 491EAPI Ecore_Cocoa_Object *ecore_cocoa_window_get(const Ecore_Cocoa_Window *window)
456 EINA_ARG_NONNULL(1) 492 EINA_ARG_NONNULL(1)
@@ -462,6 +498,7 @@ EAPI Ecore_Cocoa_Object *ecore_cocoa_window_get(const Ecore_Cocoa_Window *window
462 * @param size The size in bytes of @c data 498 * @param size The size in bytes of @c data
463 * @param type 499 * @param type
464 * @return EINA_TRUE on success, EINA_FALSE on failure 500 * @return EINA_TRUE on success, EINA_FALSE on failure
501 * @since 1.18
465 */ 502 */
466EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data, 503EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data,
467 int size, 504 int size,
@@ -477,6 +514,7 @@ EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data,
477 * If @c type was ECORE_COCOA_CNP_TYPE_STRING or ECORE_COCOA_CNP_TYPE_MARKUP, 514 * If @c type was ECORE_COCOA_CNP_TYPE_STRING or ECORE_COCOA_CNP_TYPE_MARKUP,
478 * @c retrieved_types will contain ECORE_COCOA_CNP_TYPE_STRING and the data 515 * @c retrieved_types will contain ECORE_COCOA_CNP_TYPE_STRING and the data
479 * will be a C string (char*) that must be freed after use. 516 * will be a C string (char*) that must be freed after use.
517 * @since 1.18
480 */ 518 */
481EAPI void *ecore_cocoa_selection_clipboard_get(int *size, 519EAPI void *ecore_cocoa_selection_clipboard_get(int *size,
482 Ecore_Cocoa_Cnp_Type type, 520 Ecore_Cocoa_Cnp_Type type,
@@ -485,6 +523,7 @@ EAPI void *ecore_cocoa_selection_clipboard_get(int *size,
485 523
486/** 524/**
487 * Deletes the contents of the Cocoa clipboard 525 * Deletes the contents of the Cocoa clipboard
526 * @since 1.18
488 */ 527 */
489EAPI void ecore_cocoa_selection_clipboard_clear(void); 528EAPI void ecore_cocoa_selection_clipboard_clear(void);
490 529
@@ -492,6 +531,7 @@ EAPI void ecore_cocoa_selection_clipboard_clear(void);
492 * Set the Cocoa cursor for a given Cocoa window 531 * Set the Cocoa cursor for a given Cocoa window
493 * @param win The Cocoa window on which the cursor is to be changed. 532 * @param win The Cocoa window on which the cursor is to be changed.
494 * @param c The cursor to be set 533 * @param c The cursor to be set
534 * @since 1.18
495 */ 535 */
496EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, 536EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win,
497 Ecore_Cocoa_Cursor c) 537 Ecore_Cocoa_Cursor c)
@@ -501,11 +541,25 @@ EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win,
501 * Hide or show the Cocoa cursor for a given Cocoa window 541 * Hide or show the Cocoa cursor for a given Cocoa window
502 * @param win The Cocoa window on which the cursor is to be hid 542 * @param win The Cocoa window on which the cursor is to be hid
503 * @param show Shows the cursor if EINA_TRUE. Hides it if EINA_FALSE 543 * @param show Shows the cursor if EINA_TRUE. Hides it if EINA_FALSE
504 * 544 * @since 1.18
505 */ 545 */
506EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show); 546EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show);
507 EINA_ARG_NONNULL(1); 547 EINA_ARG_NONNULL(1);
508 548
549
550typedef struct _Ecore_Cocoa_Notification Ecore_Cocoa_Notification;
551typedef void (*Ecore_Cocoa_Notify_Send_Cb)(void *data, unsigned int uid);
552
553EAPI Ecore_Cocoa_Notification *ecore_cocoa_notification_get(unsigned int uid);
554
555EAPI void
556ecore_cocoa_notification_send(Ecore_Cocoa_Notification *replaces EINA_UNUSED,
557 const char *name,
558 const char *description,
559 const char *icon EINA_UNUSED,
560 Ecore_Cocoa_Notify_Send_Cb cb,
561 const void *cb_data);
562
509#ifdef __cplusplus 563#ifdef __cplusplus
510} 564}
511#endif 565#endif
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index 6197d58eed..1e6f53502a 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa.m
@@ -67,6 +67,9 @@ ecore_cocoa_init(void)
67 if (!_ecore_cocoa_window_init()) 67 if (!_ecore_cocoa_window_init())
68 return --_ecore_cocoa_init_count; 68 return --_ecore_cocoa_init_count;
69 69
70 if (!_ecore_cocoa_notification_init())
71 return --_ecore_cocoa_init_count;
72
70 return _ecore_cocoa_init_count; 73 return _ecore_cocoa_init_count;
71} 74}
72 75
@@ -82,6 +85,8 @@ ecore_cocoa_shutdown(void)
82 if (--_ecore_cocoa_init_count != 0) 85 if (--_ecore_cocoa_init_count != 0)
83 return _ecore_cocoa_init_count; 86 return _ecore_cocoa_init_count;
84 87
88 _ecore_cocoa_notification_shutdown();
89
85 DBG("Ecore Cocoa shutdown"); 90 DBG("Ecore Cocoa shutdown");
86 91
87 eina_log_domain_unregister(_ecore_cocoa_log_domain); 92 eina_log_domain_unregister(_ecore_cocoa_log_domain);
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_notification.m b/src/lib/ecore_cocoa/ecore_cocoa_notification.m
new file mode 100644
index 0000000000..ee0a2a923c
--- /dev/null
+++ b/src/lib/ecore_cocoa/ecore_cocoa_notification.m
@@ -0,0 +1,86 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#import <Cocoa/Cocoa.h>
6
7#include "Ecore_Cocoa.h"
8#include "ecore_cocoa_window.h"
9#include "ecore_cocoa_private.h"
10
11@interface EcoreCocoaNotificationDelegate: NSObject <NSUserNotificationCenterDelegate>
12@end
13
14@implementation EcoreCocoaNotificationDelegate
15
16- (void)userNotificationCenter:(NSUserNotificationCenter *)center
17 didDeliverNotification:(NSUserNotification *)notification
18{
19 NSLog(@"Hey, I just met you...\n");
20}
21
22@end
23
24struct _Ecore_Cocoa_Notification
25{
26 NSUserNotification *ref;
27 unsigned int uid;
28};
29
30EAPI void
31ecore_cocoa_notification_send(Ecore_Cocoa_Notification *replaces EINA_UNUSED,
32 const char *name,
33 const char *description,
34 const char *icon EINA_UNUSED,
35 Ecore_Cocoa_Notify_Send_Cb cb,
36 const void *cb_data)
37{
38 NSUserNotification *const n = [[NSUserNotification alloc] init];
39 n.title = [NSString stringWithUTF8String: name];
40 n.informativeText = [NSString stringWithUTF8String: description];
41 [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: n];
42}
43
44EAPI Ecore_Cocoa_Notification *
45ecore_cocoa_notification_get(unsigned int uid)
46{
47 if (!uid) return NULL;
48 CRI("NOT IMPLEMENTED!!!!\n");
49 return NULL; /* TODO FIXME */
50}
51
52void
53ecore_cocoa_notification_close(Ecore_Cocoa_Notification *n EINA_UNUSED)
54{
55 CRI("Not implemented");
56}
57
58Eina_Bool
59_ecore_cocoa_notification_init(void)
60{
61 // NSUserNotificationCenter *def;
62 // EcoreCocoaNotificationDelegate *delegate;
63
64 // def = [NSUserNotificationCenter defaultUserNotificationCenter];
65 // delegate = [[EcoreCocoaNotificationDelegate alloc] init];
66 // if (EINA_UNLIKELY(delegate == nil))
67 // {
68 // CRI("Failed to create delegate of user notification center");
69 // return EINA_FALSE;
70 // }
71 // def.delegate = delegate;
72
73 return EINA_TRUE;
74}
75
76void
77_ecore_cocoa_notification_shutdown(void)
78{
79 // NSUserNotificationCenter *def;
80 // EcoreCocoaNotificationDelegate *delegate;
81
82 // def = [NSUserNotificationCenter defaultUserNotificationCenter];
83 // delegate = def.delegate;
84 // [delegate release];
85 // def.delegate = nil;
86}
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_private.h b/src/lib/ecore_cocoa/ecore_cocoa_private.h
index 5a58bf51c3..9d2760be09 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_private.h
+++ b/src/lib/ecore_cocoa/ecore_cocoa_private.h
@@ -43,6 +43,8 @@ struct _Ecore_Cocoa_Screen
43 43
44/* Internal init */ 44/* Internal init */
45Eina_Bool _ecore_cocoa_window_init(void); 45Eina_Bool _ecore_cocoa_window_init(void);
46Eina_Bool _ecore_cocoa_notification_init(void);
47void _ecore_cocoa_notification_shutdown(void);
46 48
47Eina_Bool _ecore_cocoa_feed_events(void *anEvent); 49Eina_Bool _ecore_cocoa_feed_events(void *anEvent);
48 50
diff --git a/src/lib/elementary/Makefile.am b/src/lib/elementary/Makefile.am
index 837229794a..91bbe2c9fb 100644
--- a/src/lib/elementary/Makefile.am
+++ b/src/lib/elementary/Makefile.am
@@ -92,6 +92,7 @@ elm_eolian_files = \
92 elm_sys_notify_interface.eo \ 92 elm_sys_notify_interface.eo \
93 elm_sys_notify.eo \ 93 elm_sys_notify.eo \
94 elm_sys_notify_dbus.eo \ 94 elm_sys_notify_dbus.eo \
95 elm_sys_notify_cocoa.eo \
95 elm_systray.eo \ 96 elm_systray.eo \
96 elm_table.eo \ 97 elm_table.eo \
97 elm_thumb.eo \ 98 elm_thumb.eo \
@@ -603,6 +604,7 @@ libelementary_la_SOURCES = \
603 elm_sys_notify_interface.c \ 604 elm_sys_notify_interface.c \
604 elm_sys_notify.c \ 605 elm_sys_notify.c \
605 elm_sys_notify_dbus.c \ 606 elm_sys_notify_dbus.c \
607 elm_sys_notify_cocoa.c \
606 elm_table.c \ 608 elm_table.c \
607 elm_theme.c \ 609 elm_theme.c \
608 elm_thumb.c \ 610 elm_thumb.c \
diff --git a/src/lib/elementary/elm_sys_notify.c b/src/lib/elementary/elm_sys_notify.c
index c58659a1a3..3fe67396b8 100644
--- a/src/lib/elementary/elm_sys_notify.c
+++ b/src/lib/elementary/elm_sys_notify.c
@@ -9,6 +9,9 @@
9#include "elm_sys_notify_dbus.eo.h" 9#include "elm_sys_notify_dbus.eo.h"
10#include "elm_sys_notify_dbus.eo.legacy.h" 10#include "elm_sys_notify_dbus.eo.legacy.h"
11 11
12#include "elm_sys_notify_cocoa.eo.h"
13#include "elm_sys_notify_cocoa.eo.legacy.h"
14
12#define MY_CLASS ELM_SYS_NOTIFY_CLASS 15#define MY_CLASS ELM_SYS_NOTIFY_CLASS
13 16
14#define MY_CLASS_NAME "Elm_Sys_Notify" 17#define MY_CLASS_NAME "Elm_Sys_Notify"
@@ -19,36 +22,44 @@ EAPI int ELM_EVENT_SYS_NOTIFY_ACTION_INVOKED = 0;
19 22
20typedef const Eo_Class *(*Class_Get_Func)(void); 23typedef const Eo_Class *(*Class_Get_Func)(void);
21 24
25typedef struct
26{
27 const char *name;
28 Class_Get_Func func;
29} Sys_Notify;
30
22static Elm_Sys_Notify *_singleton = NULL; 31static Elm_Sys_Notify *_singleton = NULL;
23 32
24/* 33/*
25 * Registration of notification servers is done UNIQUELY 34 * Registration of notification servers is done UNIQUELY
26 * in the two structures below. 35 * in the two structures below.
27 * 1) ALWAYS add a SRV_XXX before __SRV_LAST 36 * 1) ALWAYS add a SRV_XXX before __SRV_LAST
28 * 2) copy the #if ... #else ... #endif with the appropriate class 37 * 2) add the appropriate class getter (generated by Eolian)
29 * getter (generated by Eolian) or NULL when unsupported
30 * 38 *
31 * The rest of the code relies on the Srv enum and _class_getters 39 * The rest of the code relies on the Srv enum and _sys_notify
32 * to register/unregister notification servers. 40 * to register/unregister notification servers, as well
41 * as the ELM_SYS_NOTIFY_SERVER environment variable
33 */ 42 */
34 43
35typedef enum 44typedef enum
36{ 45{
37 SRV_DBUS = 0, 46 SRV_DBUS = 0,
47 SRV_COCOA,
38 __SRV_LAST /* Sentinel */ 48 __SRV_LAST /* Sentinel */
39} Srv; 49} Srv;
40 50
41static Class_Get_Func _class_getters[__SRV_LAST] = 51static const Sys_Notify _sys_notify[__SRV_LAST] =
42{ 52{
43#ifdef ELM_SYS_NOTIFY_DBUS_CLASS 53 [SRV_DBUS] = {
44 [SRV_DBUS] = elm_sys_notify_dbus_class_get 54 .name = "dbus",
45#else 55 .func = elm_sys_notify_dbus_class_get,
46 [SRV_DBUS] = NULL 56 },
47#endif 57 [SRV_COCOA] = {
58 .name = "cocoa",
59 .func = elm_sys_notify_cocoa_class_get,
60 },
48}; 61};
49 62
50
51
52typedef struct 63typedef struct
53{ 64{
54 Eo *servers[__SRV_LAST]; 65 Eo *servers[__SRV_LAST];
@@ -104,7 +115,9 @@ _elm_sys_notify_elm_sys_notify_interface_send(const Eo *obj EINA_UNUSED,
104 /* Propagate to all registered servers */ 115 /* Propagate to all registered servers */
105 for (i = SRV_DBUS; i < __SRV_LAST; ++i) 116 for (i = SRV_DBUS; i < __SRV_LAST; ++i)
106 if (sd->servers[i]) 117 if (sd->servers[i])
107 elm_obj_sys_notify_interface_send(sd->servers[i], replaces_id, icon, summary, body, urgency, timeout, cb, cb_data); 118 elm_obj_sys_notify_interface_send(sd->servers[i], replaces_id, icon,
119 summary, body, urgency, timeout,
120 cb, cb_data);
108} 121}
109 122
110EOLIAN static void 123EOLIAN static void
@@ -119,7 +132,8 @@ _elm_sys_notify_elm_sys_notify_interface_simple_send(const Eo *obj EINA_UNUSED,
119 /* Propagate to all registered servers */ 132 /* Propagate to all registered servers */
120 for (i = SRV_DBUS; i < __SRV_LAST; ++i) 133 for (i = SRV_DBUS; i < __SRV_LAST; ++i)
121 if (sd->servers[i]) 134 if (sd->servers[i])
122 elm_obj_sys_notify_interface_simple_send(sd->servers[i], icon, summary, body); 135 elm_obj_sys_notify_interface_simple_send(sd->servers[i],
136 icon, summary, body);
123} 137}
124 138
125EOLIAN static void 139EOLIAN static void
@@ -141,7 +155,7 @@ _elm_sys_notify_elm_sys_notify_interface_close(const Eo *obj EINA_UNUSED,
141 *============================================================================*/ 155 *============================================================================*/
142 156
143EOLIAN static Eina_Bool 157EOLIAN static Eina_Bool
144_elm_sys_notify_servers_set(Eo *obj EINA_UNUSED, 158_elm_sys_notify_servers_set(Eo *obj EINA_UNUSED,
145 Elm_Sys_Notify_Data *sd, 159 Elm_Sys_Notify_Data *sd,
146 Elm_Sys_Notify_Server servers) 160 Elm_Sys_Notify_Server servers)
147{ 161{
@@ -162,7 +176,7 @@ _elm_sys_notify_servers_set(Eo *obj EINA_UNUSED,
162 /* If server is required, create when nonexistant */ 176 /* If server is required, create when nonexistant */
163 if (servers & (1 << i)) 177 if (servers & (1 << i))
164 { 178 {
165 class_get = _class_getters[i]; 179 class_get = _sys_notify[i].func;
166 if (!class_get) 180 if (!class_get)
167 { 181 {
168 CRI("Unsupported notification server"); 182 CRI("Unsupported notification server");
@@ -170,6 +184,7 @@ _elm_sys_notify_servers_set(Eo *obj EINA_UNUSED,
170 } 184 }
171 185
172 sd->servers[i] = eo_add(class_get(), NULL); 186 sd->servers[i] = eo_add(class_get(), NULL);
187 printf("--> cocoa added\n");
173 if (EINA_UNLIKELY(!(sd->servers[i]))) 188 if (EINA_UNLIKELY(!(sd->servers[i])))
174 { 189 {
175 CRI("Failed to create notification server"); 190 CRI("Failed to create notification server");
@@ -233,6 +248,7 @@ elm_need_sys_notify(void)
233 Elm_Sys_Notify_Server servers = ELM_SYS_NOTIFY_SERVER_NONE; 248 Elm_Sys_Notify_Server servers = ELM_SYS_NOTIFY_SERVER_NONE;
234 Elm_Sys_Notify *manager; 249 Elm_Sys_Notify *manager;
235 Srv i; 250 Srv i;
251 const char *env;
236 252
237 /* In theory, there can be N notification managers, but 253 /* In theory, there can be N notification managers, but
238 * in the implementation there will be only one: the 254 * in the implementation there will be only one: the
@@ -253,10 +269,29 @@ elm_need_sys_notify(void)
253 return EINA_FALSE; 269 return EINA_FALSE;
254 } 270 }
255 271
272 /* Environment will override the default choice */
273 env = getenv("ELM_SYS_NOTIFY_SERVER");
274
256 /* Register available notification servers */ 275 /* Register available notification servers */
257 for (i = SRV_DBUS; i < __SRV_LAST; ++i) 276 for (i = SRV_DBUS; i < __SRV_LAST; ++i)
258 if (_class_getters[i]) 277 {
259 servers |= (1 << i); 278 if (env)
279 {
280 /*
281 * When env is specified, select the matching server only
282 */
283 if (!strcmp(env, _sys_notify[i].name))
284 {
285 servers |= (1 << i);
286 printf("--> Found %s\n", env);
287 break;
288 }
289 }
290 else
291 {
292 servers |= (1 << i);
293 }
294 }
260 295
261 /* If no server are available, don't even bother... */ 296 /* If no server are available, don't even bother... */
262 if (servers == ELM_SYS_NOTIFY_SERVER_NONE) 297 if (servers == ELM_SYS_NOTIFY_SERVER_NONE)
@@ -275,7 +310,9 @@ elm_sys_notify_send(unsigned int replaces_id,
275 Elm_Sys_Notify_Send_Cb cb, 310 Elm_Sys_Notify_Send_Cb cb,
276 const void *cb_data) 311 const void *cb_data)
277{ 312{
278 elm_obj_sys_notify_interface_send(_singleton, replaces_id, icon, summary, body, urgency, timeout, cb, cb_data); 313 elm_obj_sys_notify_interface_send(_singleton, replaces_id, icon,
314 summary, body, urgency, timeout,
315 cb, cb_data);
279} 316}
280 317
281EAPI void 318EAPI void
diff --git a/src/lib/elementary/elm_sys_notify_cocoa.c b/src/lib/elementary/elm_sys_notify_cocoa.c
new file mode 100644
index 0000000000..bead1d3a06
--- /dev/null
+++ b/src/lib/elementary/elm_sys_notify_cocoa.c
@@ -0,0 +1,87 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_priv.h"
7#include "elm_sys_notify_cocoa.eo.h"
8#include "elm_sys_notify_cocoa.eo.legacy.h"
9
10#define MY_CLASS ELM_SYS_NOTIFY_COCOA_CLASS
11
12#ifdef HAVE_ELEMENTARY_COCOA
13EOLIAN static void
14_elm_sys_notify_cocoa_elm_sys_notify_interface_close(const Eo *obj EINA_UNUSED,
15 void *sd EINA_UNUSED,
16 unsigned int id EINA_UNUSED)
17{
18}
19EOLIAN static void
20_elm_sys_notify_cocoa_elm_sys_notify_interface_send(const Eo *obj EINA_UNUSED,
21 void *sd EINA_UNUSED,
22 unsigned int replaces_id EINA_UNUSED,
23 const char *icon EINA_UNUSED,
24 const char *summary,
25 const char *body,
26 Elm_Sys_Notify_Urgency urgency EINA_UNUSED,
27 int timeout EINA_UNUSED,
28 Elm_Sys_Notify_Send_Cb cb EINA_UNUSED,
29 const void *cb_data EINA_UNUSED)
30{
31 Ecore_Cocoa_Notification *n;
32
33 printf("----> %s()\n", __func__);
34 n = ecore_cocoa_notification_get(replaces_id);
35 printf("-> %p\n", n);
36 ecore_cocoa_notification_send(n, summary, body, icon, cb, cb_data);
37}
38#else
39EOLIAN static void
40_elm_sys_notify_cocoa_elm_sys_notify_interface_close(const Eo *obj EINA_UNUSED,
41 void *sd EINA_UNUSED,
42 unsigned int id EINA_UNUSED)
43{
44}
45EOLIAN static void
46_elm_sys_notify_cocoa_elm_sys_notify_interface_send(const Eo *obj EINA_UNUSED,
47 void *sd EINA_UNUSED,
48 unsigned int replaces_id EINA_UNUSED,
49 const char *icon EINA_UNUSED,
50 const char *summary EINA_UNUSED,
51 const char *body EINA_UNUSED,
52 Elm_Sys_Notify_Urgency urgency EINA_UNUSED,
53 int timeout EINA_UNUSED,
54 Elm_Sys_Notify_Send_Cb cb EINA_UNUSED,
55 const void *cb_data EINA_UNUSED)
56{
57}
58#endif
59
60EOLIAN static void
61_elm_sys_notify_cocoa_elm_sys_notify_interface_simple_send(const Eo *obj,
62 void *sd,
63 const char *icon,
64 const char *summary,
65 const char *body)
66{
67 printf("----> %s()\n", __func__);
68 _elm_sys_notify_cocoa_elm_sys_notify_interface_send(obj, sd,
69 0, icon, summary, body,
70 ELM_SYS_NOTIFY_URGENCY_NORMAL,
71 -1, NULL, NULL);
72}
73
74#if 0
75EOLIAN static Eina_Bool
76_elm_sys_notify_cocoa_elm_sys_notify_interface_available_get(const Eo *obj,
77 void *sd)
78{
79#ifdef HAVE_ELEMENTARY_COCOA
80 return EINA_TRUE;
81#else
82 return EINA_FALSE;
83#endif
84}
85#endif
86
87#include "elm_sys_notify_cocoa.eo.c"
diff --git a/src/lib/elementary/elm_sys_notify_cocoa.eo b/src/lib/elementary/elm_sys_notify_cocoa.eo
new file mode 100644
index 0000000000..d2aae6b9fe
--- /dev/null
+++ b/src/lib/elementary/elm_sys_notify_cocoa.eo
@@ -0,0 +1,12 @@
1class Elm.Sys_Notify.Cocoa (Eo.Base, Elm.Sys_Notify_Interface)
2{
3 legacy_prefix: elm_sys_notify_cocoa;
4 eo_prefix: elm_obj_sys_notify_cocoa;
5 data: null;
6
7 implements {
8 Elm.Sys_Notify_Interface.send;
9 Elm.Sys_Notify_Interface.simple_send;
10 Elm.Sys_Notify_Interface.close;
11 }
12}
diff --git a/src/lib/elementary/elm_sys_notify_cocoa.m b/src/lib/elementary/elm_sys_notify_cocoa.m
new file mode 100644
index 0000000000..41c58d73d4
--- /dev/null
+++ b/src/lib/elementary/elm_sys_notify_cocoa.m
@@ -0,0 +1,50 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_priv.h"
7#include "elm_sys_notify_cocoa.eo.h"
8#include "elm_sys_notify_cocoa.eo.legacy.h"
9
10#define MY_CLASS ELM_SYS_NOTIFY_COCOA_CLASS
11
12EOLIAN static void
13_elm_sys_notify_cocoa_elm_sys_notify_interface_close(const Eo *obj,
14 void *sd,
15 unsigned int id)
16{
17
18}
19
20EOLIAN static void
21_elm_sys_notify_cocoa_elm_sys_notify_interface_send(const Eo *obj EINA_UNUSED,
22 void *sd EINA_UNUSED,
23 unsigned int replaces_id EINA_UNUSED,
24 const char *icon EINA_UNUSED,
25 const char *summary,
26 const char *body,
27 Elm_Sys_Notify_Urgency urgency EINA_UNUSED,
28 int timeout EINA_UNUSED,
29 Elm_Sys_Notify_Send_Cb cb EINA_UNUSED,
30 const void *cb_data EINA_UNUSED)
31{
32 NSUserNotification *const n = [[NSUserNotification alloc] init];
33 n.title = [NSString stringWithUTF8String: summary];
34 n.informativeText = [NSString stringWithUTF8String: body];
35
36 [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: n];
37}
38
39EOLIAN static void
40_elm_sys_notify_cocoa_elm_sys_notify_interface_simple_send(const Eo *obj,
41 void *sd,
42 const char *icon,
43 const char *summary,
44 const char *body)
45{
46 _elm_sys_notify_cocoa_elm_sys_notify_interface_send(obj, sd,
47 0, icon, summary, body,
48 ELM_SYS_NOTIFY_URGENCY_NORMAL,
49 -1, NULL, NULL);
50}
diff --git a/src/lib/elementary/elm_sys_notify_dbus.c b/src/lib/elementary/elm_sys_notify_dbus.c
index 0878ba24e0..85ed6464f3 100644
--- a/src/lib/elementary/elm_sys_notify_dbus.c
+++ b/src/lib/elementary/elm_sys_notify_dbus.c
@@ -393,6 +393,18 @@ _elm_sys_notify_dbus_eo_base_destructor(Eo *obj,
393 eo_destructor(eo_super(obj, MY_CLASS)); 393 eo_destructor(eo_super(obj, MY_CLASS));
394} 394}
395 395
396#if 0
397EOLIAN static void
398_elm_sys_notify_dbus_elm_sys_notify_interface_available_get(const Eo *obj,
399 void *sd)
400{
401#ifdef HAVE_ELEMENTARY_COCOA
402 return EINA_FALSE;
403#else
404 return EINA_TRUE;
405#endif
406}
407#endif
396 408
397#include "elm_sys_notify_dbus.eo.c"
398 409
410#include "elm_sys_notify_dbus.eo.c"
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
index 7c705992fd..380739251f 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -221,7 +221,7 @@ _ecore_evas_resize_common(Ecore_Evas *ee,
221 ee->w = w; 221 ee->w = w;
222 ee->h = h; 222 ee->h = h;
223 223
224 DBG("Ecore_Evas Resize %d %d", w, h); 224 CRI("Ecore_Evas Resize %d %d", w, h);
225 225
226 if (resize_cocoa) 226 if (resize_cocoa)
227 ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h); 227 ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h);