diff options
Diffstat (limited to '')
17 files changed, 6564 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h new file mode 100644 index 0000000..bdfb1c8 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h | |||
@@ -0,0 +1,529 @@ | |||
1 | #ifndef __ECORE_WIN32_H__ | ||
2 | #define __ECORE_WIN32_H__ | ||
3 | |||
4 | /* | ||
5 | * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND | ||
6 | * THE API MAY CHANGE. | ||
7 | */ | ||
8 | |||
9 | #ifndef ECORE_WIN32_WIP_POZEFLKSD | ||
10 | # ifdef _MSC_VER | ||
11 | # pragma message ("You are using a work in progress API. This API is not stable") | ||
12 | # pragma message ("and is subject to change. You use this at your own risk.") | ||
13 | # else | ||
14 | # warning "You are using a work in progress API. This API is not stable" | ||
15 | # warning "and is subject to change. You use this at your own risk." | ||
16 | # endif | ||
17 | #endif | ||
18 | |||
19 | #include <Eina.h> | ||
20 | |||
21 | #ifdef EAPI | ||
22 | # undef EAPI | ||
23 | #endif | ||
24 | |||
25 | #ifdef _WIN32 | ||
26 | # ifdef EFL_ECORE_WIN32_BUILD | ||
27 | # ifdef DLL_EXPORT | ||
28 | # define EAPI __declspec(dllexport) | ||
29 | # else | ||
30 | # define EAPI | ||
31 | # endif /* ! DLL_EXPORT */ | ||
32 | # else | ||
33 | # define EAPI __declspec(dllimport) | ||
34 | # endif /* ! EFL_ECORE_WIN32_BUILD */ | ||
35 | #else | ||
36 | # ifdef __GNUC__ | ||
37 | # if __GNUC__ >= 4 | ||
38 | # define EAPI __attribute__ ((visibility("default"))) | ||
39 | # else | ||
40 | # define EAPI | ||
41 | # endif | ||
42 | # else | ||
43 | # define EAPI | ||
44 | # endif | ||
45 | #endif /* ! _WIN32 */ | ||
46 | |||
47 | |||
48 | #ifdef __cplusplus | ||
49 | extern "C" { | ||
50 | #endif | ||
51 | |||
52 | /** | ||
53 | * @defgroup Ecore_Win32_Group Ecore_Win32 library | ||
54 | * | ||
55 | * @{ | ||
56 | */ | ||
57 | |||
58 | /** | ||
59 | * @typedef Ecore_Win32_Window_State | ||
60 | * State of a window. | ||
61 | */ | ||
62 | typedef enum | ||
63 | { | ||
64 | ECORE_WIN32_WINDOW_STATE_ICONIFIED, /**< iconified window */ | ||
65 | ECORE_WIN32_WINDOW_STATE_MODAL, /**< modal dialog box */ | ||
66 | ECORE_WIN32_WINDOW_STATE_STICKY, /**< sticky window */ | ||
67 | ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT, /**< maximum vertical sized window */ | ||
68 | ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ, /**< maximum horizontal sized window */ | ||
69 | ECORE_WIN32_WINDOW_STATE_MAXIMIZED, /**< maximum sized window */ | ||
70 | ECORE_WIN32_WINDOW_STATE_SHADED, /**< shaded window */ | ||
71 | ECORE_WIN32_WINDOW_STATE_HIDDEN, /**< hidden (minimized or iconified) window */ | ||
72 | ECORE_WIN32_WINDOW_STATE_FULLSCREEN, /**< fullscreen window */ | ||
73 | ECORE_WIN32_WINDOW_STATE_ABOVE, /**< above window */ | ||
74 | ECORE_WIN32_WINDOW_STATE_BELOW, /**< below window */ | ||
75 | ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION, /**< To document */ | ||
76 | ECORE_WIN32_WINDOW_STATE_UNKNOWN /**< Unknown state */ | ||
77 | } Ecore_Win32_Window_State; | ||
78 | |||
79 | /** | ||
80 | * @typedef Ecore_Win32_Window_Type | ||
81 | * Type of a window. | ||
82 | */ | ||
83 | typedef enum | ||
84 | { | ||
85 | ECORE_WIN32_WINDOW_TYPE_DESKTOP, /**< Desktop feature */ | ||
86 | ECORE_WIN32_WINDOW_TYPE_DOCK, /**< Dock window (should be on top of other windows) */ | ||
87 | ECORE_WIN32_WINDOW_TYPE_TOOLBAR, /**< Toolbar window */ | ||
88 | ECORE_WIN32_WINDOW_TYPE_MENU, /**< Menu window */ | ||
89 | ECORE_WIN32_WINDOW_TYPE_UTILITY, /**< Small persistent utility window, such as a palette or toolbox */ | ||
90 | ECORE_WIN32_WINDOW_TYPE_SPLASH, /**< Splash screen window displayed as an application is starting up */ | ||
91 | ECORE_WIN32_WINDOW_TYPE_DIALOG, /**< Dialog window */ | ||
92 | ECORE_WIN32_WINDOW_TYPE_NORMAL, /**< Normal top-level window */ | ||
93 | ECORE_WIN32_WINDOW_TYPE_UNKNOWN /**< Unknown type */ | ||
94 | } Ecore_Win32_Window_Type; | ||
95 | |||
96 | /** | ||
97 | * @typedef Ecore_Win32_Cursor_Shape | ||
98 | * Shape of a cursor. | ||
99 | */ | ||
100 | typedef enum | ||
101 | { | ||
102 | ECORE_WIN32_CURSOR_SHAPE_APP_STARTING, /**< Standard arrow and small hourglass */ | ||
103 | ECORE_WIN32_CURSOR_SHAPE_ARROW, /**< Standard arrow */ | ||
104 | ECORE_WIN32_CURSOR_SHAPE_CROSS, /**< Crosshair */ | ||
105 | ECORE_WIN32_CURSOR_SHAPE_HAND, /**< Hand */ | ||
106 | ECORE_WIN32_CURSOR_SHAPE_HELP, /**< Arrow and question mark */ | ||
107 | ECORE_WIN32_CURSOR_SHAPE_I_BEAM, /**< I-beam */ | ||
108 | ECORE_WIN32_CURSOR_SHAPE_NO, /**< Slashed circle */ | ||
109 | ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL, /**< Four-pointed arrow pointing north, south, east, and west */ | ||
110 | ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW, /**< Double-pointed arrow pointing northeast and southwest */ | ||
111 | ECORE_WIN32_CURSOR_SHAPE_SIZE_NS, /**< Double-pointed arrow pointing north and south */ | ||
112 | ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE, /**< Double-pointed arrow pointing northwest and southeast */ | ||
113 | ECORE_WIN32_CURSOR_SHAPE_SIZE_WE, /**< Double-pointed arrow pointing west and east */ | ||
114 | ECORE_WIN32_CURSOR_SHAPE_UP_ARROW, /**< Vertical arrow */ | ||
115 | ECORE_WIN32_CURSOR_SHAPE_WAIT /**< Hourglass */ | ||
116 | } Ecore_Win32_Cursor_Shape; | ||
117 | |||
118 | /** | ||
119 | * @typedef Ecore_Win32_DnD_State | ||
120 | * State of a DnD operation. | ||
121 | */ | ||
122 | typedef enum | ||
123 | { | ||
124 | ECORE_WIN32_DND_EVENT_DRAG_ENTER = 1, /**< Drag enter */ | ||
125 | ECORE_WIN32_DND_EVENT_DRAG_OVER = 2, /**< Drag over */ | ||
126 | ECORE_WIN32_DND_EVENT_DRAG_LEAVE = 3, /**< Drag leave */ | ||
127 | ECORE_WIN32_DND_EVENT_DROP = 4 /**< Drop */ | ||
128 | } Ecore_Win32_DnD_State; | ||
129 | |||
130 | /** | ||
131 | * @typedef Ecore_Win32_Window | ||
132 | * Abstract type for a window. | ||
133 | */ | ||
134 | typedef struct _Ecore_Win32_Window Ecore_Win32_Window; | ||
135 | |||
136 | /** | ||
137 | * @typedef Ecore_Win32_Cursor | ||
138 | * Abstract type for a cursor. | ||
139 | */ | ||
140 | typedef void Ecore_Win32_Cursor; | ||
141 | |||
142 | |||
143 | /** | ||
144 | * @typedef Ecore_Win32_Event_Mouse_In | ||
145 | * Event sent when the mouse enters the window. | ||
146 | */ | ||
147 | typedef struct _Ecore_Win32_Event_Mouse_In Ecore_Win32_Event_Mouse_In; | ||
148 | |||
149 | /** | ||
150 | * @typedef Ecore_Win32_Event_Mouse_Out | ||
151 | * Event sent when the mouse leaves the window. | ||
152 | */ | ||
153 | typedef struct _Ecore_Win32_Event_Mouse_Out Ecore_Win32_Event_Mouse_Out; | ||
154 | |||
155 | /** | ||
156 | * @typedef Ecore_Win32_Event_Window_Focus_In | ||
157 | * Event sent when the window gets the focus. | ||
158 | */ | ||
159 | typedef struct _Ecore_Win32_Event_Window_Focus_In Ecore_Win32_Event_Window_Focus_In; | ||
160 | |||
161 | /** | ||
162 | * @typedef Ecore_Win32_Event_Window_Focus_Out | ||
163 | * Event sent when the window looses the focus. | ||
164 | */ | ||
165 | typedef struct _Ecore_Win32_Event_Window_Focus_Out Ecore_Win32_Event_Window_Focus_Out; | ||
166 | |||
167 | /** | ||
168 | * @typedef Ecore_Win32_Event_Window_Damage | ||
169 | * Event sent when the window is damaged. | ||
170 | */ | ||
171 | typedef struct _Ecore_Win32_Event_Window_Damage Ecore_Win32_Event_Window_Damage; | ||
172 | |||
173 | /** | ||
174 | * @typedef Ecore_Win32_Event_Window_Create | ||
175 | * Event sent when the window is created. | ||
176 | */ | ||
177 | typedef struct _Ecore_Win32_Event_Window_Create Ecore_Win32_Event_Window_Create; | ||
178 | |||
179 | /** | ||
180 | * @typedef Ecore_Win32_Event_Window_Destroy | ||
181 | * Event sent when the window is destroyed. | ||
182 | */ | ||
183 | typedef struct _Ecore_Win32_Event_Window_Destroy Ecore_Win32_Event_Window_Destroy; | ||
184 | |||
185 | /** | ||
186 | * @typedef Ecore_Win32_Event_Window_Hide | ||
187 | * Event sent when the window is hidden. | ||
188 | */ | ||
189 | typedef struct _Ecore_Win32_Event_Window_Hide Ecore_Win32_Event_Window_Hide; | ||
190 | |||
191 | /** | ||
192 | * @typedef Ecore_Win32_Event_Window_Show | ||
193 | * Event sent when the window is shown. | ||
194 | */ | ||
195 | typedef struct _Ecore_Win32_Event_Window_Show Ecore_Win32_Event_Window_Show; | ||
196 | |||
197 | /** | ||
198 | * @typedef Ecore_Win32_Event_Window_Configure | ||
199 | * Event sent when the window is configured. | ||
200 | */ | ||
201 | typedef struct _Ecore_Win32_Event_Window_Configure Ecore_Win32_Event_Window_Configure; | ||
202 | |||
203 | /** | ||
204 | * @typedef Ecore_Win32_Event_Window_Resize | ||
205 | * Event sent when the window is resized. | ||
206 | */ | ||
207 | typedef struct _Ecore_Win32_Event_Window_Resize Ecore_Win32_Event_Window_Resize; | ||
208 | |||
209 | /** | ||
210 | * @typedef Ecore_Win32_Event_Window_Delete_Request | ||
211 | * Event sent when the window is deleted. | ||
212 | */ | ||
213 | typedef struct _Ecore_Win32_Event_Window_Delete_Request Ecore_Win32_Event_Window_Delete_Request; | ||
214 | |||
215 | /** | ||
216 | * @struct _Ecore_Win32_Event_Mouse_In | ||
217 | * Event sent when the mouse enters the window. | ||
218 | */ | ||
219 | struct _Ecore_Win32_Event_Mouse_In | ||
220 | { | ||
221 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
222 | int x; /**< The x coordinate where the mouse leaved */ | ||
223 | int y; /**< The y coordinate where the mouse entered */ | ||
224 | long time; /**< The time the event occurred */ | ||
225 | }; | ||
226 | |||
227 | /** | ||
228 | * @struct _Ecore_Win32_Event_Mouse_Out | ||
229 | * Event sent when the mouse leaves the window. | ||
230 | */ | ||
231 | struct _Ecore_Win32_Event_Mouse_Out | ||
232 | { | ||
233 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
234 | int x; /**< The x coordinate where the mouse leaved */ | ||
235 | int y; /**< The y coordinate where the mouse leaved */ | ||
236 | long time; /**< The time the event occurred */ | ||
237 | }; | ||
238 | |||
239 | /** | ||
240 | * @struct _Ecore_Win32_Event_Window_Focus_In | ||
241 | * Event sent when the window gets the focus. | ||
242 | */ | ||
243 | struct _Ecore_Win32_Event_Window_Focus_In | ||
244 | { | ||
245 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
246 | long long time; /**< The time the event occurred */ | ||
247 | }; | ||
248 | |||
249 | /** | ||
250 | * @struct _Ecore_Win32_Event_Window_Focus_Out | ||
251 | * Event sent when the window looses the focus. | ||
252 | */ | ||
253 | struct _Ecore_Win32_Event_Window_Focus_Out | ||
254 | { | ||
255 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
256 | long time; /**< The time the event occurred */ | ||
257 | }; | ||
258 | |||
259 | /** | ||
260 | * @struct _Ecore_Win32_Event_Window_Damage | ||
261 | * Event sent when the window is damaged. | ||
262 | */ | ||
263 | struct _Ecore_Win32_Event_Window_Damage | ||
264 | { | ||
265 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
266 | int x; /**< The x coordinate of the top left corner of the damaged region */ | ||
267 | int y; /**< The y coordinate of the top left corner of the damaged region */ | ||
268 | int width; /**< The width of the damaged region */ | ||
269 | int height; /**< The time the event occurred */ | ||
270 | long time; /**< The time the event occurred */ | ||
271 | }; | ||
272 | |||
273 | /** | ||
274 | * @struct _Ecore_Win32_Event_Window_Create | ||
275 | * Event sent when the window is created. | ||
276 | */ | ||
277 | struct _Ecore_Win32_Event_Window_Create | ||
278 | { | ||
279 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
280 | long time; /**< The time the event occurred */ | ||
281 | }; | ||
282 | |||
283 | /** | ||
284 | * @struct _Ecore_Win32_Event_Window_Destroy | ||
285 | * Event sent when the window is destroyed. | ||
286 | */ | ||
287 | struct _Ecore_Win32_Event_Window_Destroy | ||
288 | { | ||
289 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
290 | long time; /**< The time the event occurred */ | ||
291 | }; | ||
292 | |||
293 | /** | ||
294 | * @struct _Ecore_Win32_Event_Window_Hide | ||
295 | * Event sent when the window is hidden. | ||
296 | */ | ||
297 | struct _Ecore_Win32_Event_Window_Hide | ||
298 | { | ||
299 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
300 | long time; /**< The time the event occurred */ | ||
301 | }; | ||
302 | |||
303 | /** | ||
304 | * @struct _Ecore_Win32_Event_Window_Show | ||
305 | * Event sent when the window is shown. | ||
306 | */ | ||
307 | struct _Ecore_Win32_Event_Window_Show | ||
308 | { | ||
309 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
310 | long time; /**< The time the event occurred */ | ||
311 | }; | ||
312 | |||
313 | /** | ||
314 | * @struct _Ecore_Win32_Event_Window_Configure | ||
315 | * Event sent when the window is configured. | ||
316 | */ | ||
317 | struct _Ecore_Win32_Event_Window_Configure | ||
318 | { | ||
319 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
320 | Ecore_Win32_Window *abovewin; | ||
321 | int x; /**< The new x coordinate of the top left corner */ | ||
322 | int y; /**< The new y coordinate of the top left corner */ | ||
323 | int width; /**< The new width */ | ||
324 | int height; /**< The new height */ | ||
325 | long time; /**< The time the event occurred */ | ||
326 | }; | ||
327 | |||
328 | /** | ||
329 | * @struct _Ecore_Win32_Event_Window_Resize | ||
330 | * Event sent when the window is resized. | ||
331 | */ | ||
332 | struct _Ecore_Win32_Event_Window_Resize | ||
333 | { | ||
334 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
335 | int width; /**< The new width */ | ||
336 | int height; /**< The new height */ | ||
337 | long time; /**< The time the event occurred */ | ||
338 | }; | ||
339 | |||
340 | /** | ||
341 | * @struct _Ecore_Win32_Event_Window_Delete_Request | ||
342 | * Event sent when the window is deleted. | ||
343 | */ | ||
344 | struct _Ecore_Win32_Event_Window_Delete_Request | ||
345 | { | ||
346 | Ecore_Win32_Window *window; /**< The window that received the event */ | ||
347 | long time; /**< The time the event occurred */ | ||
348 | }; | ||
349 | |||
350 | /** | ||
351 | * @typedef Ecore_Win32_Dnd_DropTarget_Callback | ||
352 | * Callback type for Drop operations. See ecore_win32_dnd_register_drop_target(). | ||
353 | */ | ||
354 | typedef int (*Ecore_Win32_Dnd_DropTarget_Callback)(void *window, int event, int pt_x, int pt_y, void *data, int size); | ||
355 | |||
356 | EAPI extern int ECORE_WIN32_EVENT_MOUSE_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_In event */ | ||
357 | EAPI extern int ECORE_WIN32_EVENT_MOUSE_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_Out event */ | ||
358 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_In event */ | ||
359 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_Out event */ | ||
360 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_DAMAGE; /**< Ecore_Event for the #Ecore_Win32_Event_Damage event */ | ||
361 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_CREATE; /**< Ecore_Event for the #Ecore_Win32_Event_Create event */ | ||
362 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_DESTROY; /**< Ecore_Event for the #Ecore_Win32_Event_Destroy event */ | ||
363 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_HIDE; /**< Ecore_Event for the #Ecore_Win32_Event_Hide event */ | ||
364 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_SHOW; /**< Ecore_Event for the #Ecore_Win32_Event_Show event */ | ||
365 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_CONFIGURE; /**< Ecore_Event for the #Ecore_Win32_Event_Configure event */ | ||
366 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_RESIZE; /**< Ecore_Event for the #Ecore_Win32_Event_Resize event */ | ||
367 | EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Delete_Request event */ | ||
368 | |||
369 | |||
370 | /* Core */ | ||
371 | |||
372 | EAPI int ecore_win32_init(); | ||
373 | EAPI int ecore_win32_shutdown(); | ||
374 | EAPI int ecore_win32_screen_depth_get(); | ||
375 | EAPI void ecore_win32_double_click_time_set(double t); | ||
376 | EAPI double ecore_win32_double_click_time_get(void); | ||
377 | EAPI long ecore_win32_current_time_get(void); | ||
378 | |||
379 | /* Window */ | ||
380 | |||
381 | EAPI Ecore_Win32_Window *ecore_win32_window_new(Ecore_Win32_Window *parent, | ||
382 | int x, | ||
383 | int y, | ||
384 | int width, | ||
385 | int height); | ||
386 | EAPI Ecore_Win32_Window *ecore_win32_window_override_new(Ecore_Win32_Window *parent, | ||
387 | int x, | ||
388 | int y, | ||
389 | int width, | ||
390 | int height); | ||
391 | |||
392 | EAPI void ecore_win32_window_free(Ecore_Win32_Window *window); | ||
393 | |||
394 | EAPI void *ecore_win32_window_hwnd_get(Ecore_Win32_Window *window); | ||
395 | |||
396 | EAPI void ecore_win32_window_move(Ecore_Win32_Window *window, | ||
397 | int x, | ||
398 | int y); | ||
399 | |||
400 | EAPI void ecore_win32_window_resize(Ecore_Win32_Window *window, | ||
401 | int width, | ||
402 | int height); | ||
403 | |||
404 | EAPI void ecore_win32_window_move_resize(Ecore_Win32_Window *window, | ||
405 | int x, | ||
406 | int y, | ||
407 | int width, | ||
408 | int height); | ||
409 | |||
410 | EAPI void ecore_win32_window_geometry_get(Ecore_Win32_Window *window, | ||
411 | int *x, | ||
412 | int *y, | ||
413 | int *width, | ||
414 | int *height); | ||
415 | |||
416 | EAPI void ecore_win32_window_size_get(Ecore_Win32_Window *window, | ||
417 | int *width, | ||
418 | int *height); | ||
419 | |||
420 | EAPI void ecore_win32_window_size_min_set(Ecore_Win32_Window *window, | ||
421 | unsigned int min_width, | ||
422 | unsigned int min_height); | ||
423 | |||
424 | EAPI void ecore_win32_window_size_min_get(Ecore_Win32_Window *window, | ||
425 | unsigned int *min_width, | ||
426 | unsigned int *min_height); | ||
427 | |||
428 | EAPI void ecore_win32_window_size_max_set(Ecore_Win32_Window *window, | ||
429 | unsigned int max_width, | ||
430 | unsigned int max_height); | ||
431 | |||
432 | EAPI void ecore_win32_window_size_max_get(Ecore_Win32_Window *window, | ||
433 | unsigned int *max_width, | ||
434 | unsigned int *max_height); | ||
435 | |||
436 | EAPI void ecore_win32_window_size_base_set(Ecore_Win32_Window *window, | ||
437 | unsigned int base_width, | ||
438 | unsigned int base_height); | ||
439 | |||
440 | EAPI void ecore_win32_window_size_base_get(Ecore_Win32_Window *window, | ||
441 | unsigned int *base_width, | ||
442 | unsigned int *base_height); | ||
443 | |||
444 | EAPI void ecore_win32_window_size_step_set(Ecore_Win32_Window *window, | ||
445 | unsigned int step_width, | ||
446 | unsigned int step_height); | ||
447 | |||
448 | EAPI void ecore_win32_window_size_step_get(Ecore_Win32_Window *window, | ||
449 | unsigned int *step_width, | ||
450 | unsigned int *step_height); | ||
451 | |||
452 | EAPI void ecore_win32_window_show(Ecore_Win32_Window *window); | ||
453 | |||
454 | EAPI void ecore_win32_window_hide(Ecore_Win32_Window *window); | ||
455 | |||
456 | EAPI void ecore_win32_window_raise(Ecore_Win32_Window *window); | ||
457 | |||
458 | EAPI void ecore_win32_window_lower(Ecore_Win32_Window *window); | ||
459 | |||
460 | EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window, | ||
461 | const char *title); | ||
462 | |||
463 | EAPI void ecore_win32_window_focus_set(Ecore_Win32_Window *window); | ||
464 | |||
465 | EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window, | ||
466 | Eina_Bool on); | ||
467 | |||
468 | EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window, | ||
469 | Eina_Bool on); | ||
470 | |||
471 | EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, | ||
472 | Eina_Bool on); | ||
473 | |||
474 | EINA_DEPRECATED EAPI void ecore_win32_window_shape_set(Ecore_Win32_Window *window, | ||
475 | unsigned short width, | ||
476 | unsigned short height, | ||
477 | unsigned char *mask); | ||
478 | |||
479 | EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window, | ||
480 | Ecore_Win32_Cursor *cursor); | ||
481 | |||
482 | EAPI void ecore_win32_window_state_set(Ecore_Win32_Window *window, | ||
483 | Ecore_Win32_Window_State *state, | ||
484 | unsigned int num); | ||
485 | |||
486 | EAPI void ecore_win32_window_state_request_send(Ecore_Win32_Window *window, | ||
487 | Ecore_Win32_Window_State state, | ||
488 | unsigned int set); | ||
489 | |||
490 | EAPI void ecore_win32_window_type_set(Ecore_Win32_Window *window, | ||
491 | Ecore_Win32_Window_Type type); | ||
492 | |||
493 | /* Cursor */ | ||
494 | |||
495 | EAPI Ecore_Win32_Cursor *ecore_win32_cursor_new(const void *pixels_and, | ||
496 | const void *pixels_xor, | ||
497 | int width, | ||
498 | int height, | ||
499 | int hot_x, | ||
500 | int hot_y); | ||
501 | |||
502 | EAPI void ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor); | ||
503 | |||
504 | EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape); | ||
505 | |||
506 | EAPI void ecore_win32_cursor_size_get(int *width, int *height); | ||
507 | |||
508 | |||
509 | |||
510 | /* Drag and drop */ | ||
511 | EAPI int ecore_win32_dnd_init(); | ||
512 | EAPI int ecore_win32_dnd_shutdown(); | ||
513 | EAPI Eina_Bool ecore_win32_dnd_begin(const char *data, | ||
514 | int size); | ||
515 | EAPI Eina_Bool ecore_win32_dnd_register_drop_target(Ecore_Win32_Window *window, | ||
516 | Ecore_Win32_Dnd_DropTarget_Callback callback); | ||
517 | EAPI void ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window); | ||
518 | |||
519 | /** | ||
520 | * @} | ||
521 | */ | ||
522 | |||
523 | |||
524 | #ifdef __cplusplus | ||
525 | } | ||
526 | #endif | ||
527 | |||
528 | |||
529 | #endif /* __ECORE_WIN32_H__ */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/Makefile.am b/libraries/ecore/src/lib/ecore_win32/Makefile.am new file mode 100644 index 0000000..ce317c7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/Makefile.am | |||
@@ -0,0 +1,42 @@ | |||
1 | MAINTAINERCLEANFILES = Makefile.in | ||
2 | |||
3 | AM_CPPFLAGS = \ | ||
4 | -I$(top_srcdir)/src/lib/ecore \ | ||
5 | -I$(top_srcdir)/src/lib/ecore_input \ | ||
6 | -I$(top_builddir)/src/lib/ecore \ | ||
7 | -I$(top_builddir)/src/lib/ecore_input \ | ||
8 | @EFL_ECORE_WIN32_BUILD@ \ | ||
9 | @EINA_CFLAGS@ \ | ||
10 | @WIN32_CPPFLAGS@ | ||
11 | |||
12 | lib_LTLIBRARIES = libecore_win32.la | ||
13 | |||
14 | includes_HEADERS = Ecore_Win32.h | ||
15 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
16 | |||
17 | libecore_win32_la_SOURCES = \ | ||
18 | ecore_win32.c \ | ||
19 | ecore_win32_cursor.c \ | ||
20 | ecore_win32_dnd.c \ | ||
21 | ecore_win32_dnd_enumformatetc.cpp \ | ||
22 | ecore_win32_dnd_data_object.cpp \ | ||
23 | ecore_win32_dnd_drop_source.cpp \ | ||
24 | ecore_win32_dnd_drop_target.cpp \ | ||
25 | ecore_win32_event.c \ | ||
26 | ecore_win32_window.c | ||
27 | |||
28 | libecore_win32_la_LIBADD = \ | ||
29 | @ecore_win32_libs@ \ | ||
30 | @WIN32_LIBS@ \ | ||
31 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
32 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
33 | @EINA_LIBS@ | ||
34 | |||
35 | libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | ||
36 | |||
37 | EXTRA_DIST = \ | ||
38 | ecore_win32_private.h \ | ||
39 | ecore_win32_dnd_enumformatetc.h \ | ||
40 | ecore_win32_dnd_data_object.h \ | ||
41 | ecore_win32_dnd_drop_source.h \ | ||
42 | ecore_win32_dnd_drop_target.h | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/Makefile.in b/libraries/ecore/src/lib/ecore_win32/Makefile.in new file mode 100644 index 0000000..4e4f363 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/Makefile.in | |||
@@ -0,0 +1,887 @@ | |||
1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. | ||
2 | # @configure_input@ | ||
3 | |||
4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, | ||
6 | # Inc. | ||
7 | # This Makefile.in is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
14 | # PARTICULAR PURPOSE. | ||
15 | |||
16 | @SET_MAKE@ | ||
17 | |||
18 | |||
19 | VPATH = @srcdir@ | ||
20 | pkgdatadir = $(datadir)/@PACKAGE@ | ||
21 | pkgincludedir = $(includedir)/@PACKAGE@ | ||
22 | pkglibdir = $(libdir)/@PACKAGE@ | ||
23 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||
24 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
25 | install_sh_DATA = $(install_sh) -c -m 644 | ||
26 | install_sh_PROGRAM = $(install_sh) -c | ||
27 | install_sh_SCRIPT = $(install_sh) -c | ||
28 | INSTALL_HEADER = $(INSTALL_DATA) | ||
29 | transform = $(program_transform_name) | ||
30 | NORMAL_INSTALL = : | ||
31 | PRE_INSTALL = : | ||
32 | POST_INSTALL = : | ||
33 | NORMAL_UNINSTALL = : | ||
34 | PRE_UNINSTALL = : | ||
35 | POST_UNINSTALL = : | ||
36 | build_triplet = @build@ | ||
37 | host_triplet = @host@ | ||
38 | subdir = src/lib/ecore_win32 | ||
39 | DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ | ||
40 | $(srcdir)/Makefile.in | ||
41 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
42 | am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ | ||
43 | $(top_srcdir)/m4/ac_path_generic.m4 \ | ||
44 | $(top_srcdir)/m4/check_x_extension.m4 \ | ||
45 | $(top_srcdir)/m4/ecore_check_module.m4 \ | ||
46 | $(top_srcdir)/m4/ecore_check_options.m4 \ | ||
47 | $(top_srcdir)/m4/efl_compiler_flag.m4 \ | ||
48 | $(top_srcdir)/m4/efl_doxygen.m4 \ | ||
49 | $(top_srcdir)/m4/efl_examples.m4 \ | ||
50 | $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ | ||
51 | $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ | ||
52 | $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ | ||
53 | $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ | ||
54 | $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ | ||
55 | $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ | ||
56 | $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ | ||
57 | $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ | ||
58 | $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ | ||
59 | $(top_srcdir)/configure.ac | ||
60 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
61 | $(ACLOCAL_M4) | ||
62 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs | ||
63 | CONFIG_HEADER = $(top_builddir)/config.h | ||
64 | CONFIG_CLEAN_FILES = | ||
65 | CONFIG_CLEAN_VPATH_FILES = | ||
66 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | ||
67 | am__vpath_adj = case $$p in \ | ||
68 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | ||
69 | *) f=$$p;; \ | ||
70 | esac; | ||
71 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | ||
72 | am__install_max = 40 | ||
73 | am__nobase_strip_setup = \ | ||
74 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | ||
75 | am__nobase_strip = \ | ||
76 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | ||
77 | am__nobase_list = $(am__nobase_strip_setup); \ | ||
78 | for p in $$list; do echo "$$p $$p"; done | \ | ||
79 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | ||
80 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | ||
81 | if (++n[$$2] == $(am__install_max)) \ | ||
82 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | ||
83 | END { for (dir in files) print dir, files[dir] }' | ||
84 | am__base_list = \ | ||
85 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | ||
86 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | ||
87 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" | ||
88 | LTLIBRARIES = $(lib_LTLIBRARIES) | ||
89 | libecore_win32_la_DEPENDENCIES = \ | ||
90 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
91 | $(top_builddir)/src/lib/ecore_input/libecore_input.la | ||
92 | am_libecore_win32_la_OBJECTS = ecore_win32.lo ecore_win32_cursor.lo \ | ||
93 | ecore_win32_dnd.lo ecore_win32_dnd_enumformatetc.lo \ | ||
94 | ecore_win32_dnd_data_object.lo ecore_win32_dnd_drop_source.lo \ | ||
95 | ecore_win32_dnd_drop_target.lo ecore_win32_event.lo \ | ||
96 | ecore_win32_window.lo | ||
97 | libecore_win32_la_OBJECTS = $(am_libecore_win32_la_OBJECTS) | ||
98 | AM_V_lt = $(am__v_lt_$(V)) | ||
99 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||
100 | am__v_lt_0 = --silent | ||
101 | libecore_win32_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ | ||
102 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ | ||
103 | $(AM_CXXFLAGS) $(CXXFLAGS) $(libecore_win32_la_LDFLAGS) \ | ||
104 | $(LDFLAGS) -o $@ | ||
105 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) | ||
106 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
107 | am__depfiles_maybe = depfiles | ||
108 | am__mv = mv -f | ||
109 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | ||
110 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||
111 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
112 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | ||
113 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
114 | $(AM_CFLAGS) $(CFLAGS) | ||
115 | AM_V_CC = $(am__v_CC_$(V)) | ||
116 | am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||
117 | am__v_CC_0 = @echo " CC " $@; | ||
118 | AM_V_at = $(am__v_at_$(V)) | ||
119 | am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||
120 | am__v_at_0 = @ | ||
121 | CCLD = $(CC) | ||
122 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
123 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
124 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
125 | AM_V_CCLD = $(am__v_CCLD_$(V)) | ||
126 | am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||
127 | am__v_CCLD_0 = @echo " CCLD " $@; | ||
128 | CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ | ||
129 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) | ||
130 | LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ | ||
131 | $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ | ||
132 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
133 | $(AM_CXXFLAGS) $(CXXFLAGS) | ||
134 | AM_V_CXX = $(am__v_CXX_$(V)) | ||
135 | am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) | ||
136 | am__v_CXX_0 = @echo " CXX " $@; | ||
137 | CXXLD = $(CXX) | ||
138 | CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ | ||
139 | $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ | ||
140 | $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
141 | AM_V_CXXLD = $(am__v_CXXLD_$(V)) | ||
142 | am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) | ||
143 | am__v_CXXLD_0 = @echo " CXXLD " $@; | ||
144 | AM_V_GEN = $(am__v_GEN_$(V)) | ||
145 | am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||
146 | am__v_GEN_0 = @echo " GEN " $@; | ||
147 | SOURCES = $(libecore_win32_la_SOURCES) | ||
148 | DIST_SOURCES = $(libecore_win32_la_SOURCES) | ||
149 | HEADERS = $(includes_HEADERS) | ||
150 | ETAGS = etags | ||
151 | CTAGS = ctags | ||
152 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
153 | ACLOCAL = @ACLOCAL@ | ||
154 | ALLOCA = @ALLOCA@ | ||
155 | AMTAR = @AMTAR@ | ||
156 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||
157 | AR = @AR@ | ||
158 | AS = @AS@ | ||
159 | AUTOCONF = @AUTOCONF@ | ||
160 | AUTOHEADER = @AUTOHEADER@ | ||
161 | AUTOMAKE = @AUTOMAKE@ | ||
162 | AWK = @AWK@ | ||
163 | CARES_CFLAGS = @CARES_CFLAGS@ | ||
164 | CARES_LIBS = @CARES_LIBS@ | ||
165 | CC = @CC@ | ||
166 | CCDEPMODE = @CCDEPMODE@ | ||
167 | CFLAGS = @CFLAGS@ | ||
168 | CHECK_CFLAGS = @CHECK_CFLAGS@ | ||
169 | CHECK_LIBS = @CHECK_LIBS@ | ||
170 | CPP = @CPP@ | ||
171 | CPPFLAGS = @CPPFLAGS@ | ||
172 | CURL_CFLAGS = @CURL_CFLAGS@ | ||
173 | CURL_LIBS = @CURL_LIBS@ | ||
174 | CXX = @CXX@ | ||
175 | CXXCPP = @CXXCPP@ | ||
176 | CXXDEPMODE = @CXXDEPMODE@ | ||
177 | CXXFLAGS = @CXXFLAGS@ | ||
178 | CYGPATH_W = @CYGPATH_W@ | ||
179 | DEFS = @DEFS@ | ||
180 | DEPDIR = @DEPDIR@ | ||
181 | DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ | ||
182 | DIRECTFB_LIBS = @DIRECTFB_LIBS@ | ||
183 | DLLTOOL = @DLLTOOL@ | ||
184 | DSYMUTIL = @DSYMUTIL@ | ||
185 | DUMPBIN = @DUMPBIN@ | ||
186 | ECHO_C = @ECHO_C@ | ||
187 | ECHO_N = @ECHO_N@ | ||
188 | ECHO_T = @ECHO_T@ | ||
189 | ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ | ||
190 | ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ | ||
191 | EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ | ||
192 | EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ | ||
193 | EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ | ||
194 | EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ | ||
195 | EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ | ||
196 | EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ | ||
197 | EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ | ||
198 | EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ | ||
199 | EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ | ||
200 | EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ | ||
201 | EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ | ||
202 | EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ | ||
203 | EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ | ||
204 | EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ | ||
205 | EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ | ||
206 | EGREP = @EGREP@ | ||
207 | EINA_CFLAGS = @EINA_CFLAGS@ | ||
208 | EINA_LIBS = @EINA_LIBS@ | ||
209 | ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ | ||
210 | ESCAPE_LIBS = @ESCAPE_LIBS@ | ||
211 | EVAS_CFLAGS = @EVAS_CFLAGS@ | ||
212 | EVAS_LIBS = @EVAS_LIBS@ | ||
213 | EVIL_CFLAGS = @EVIL_CFLAGS@ | ||
214 | EVIL_LIBS = @EVIL_LIBS@ | ||
215 | EXEEXT = @EXEEXT@ | ||
216 | FGREP = @FGREP@ | ||
217 | GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ | ||
218 | GLIB_CFLAGS = @GLIB_CFLAGS@ | ||
219 | GLIB_LIBS = @GLIB_LIBS@ | ||
220 | GMSGFMT = @GMSGFMT@ | ||
221 | GMSGFMT_015 = @GMSGFMT_015@ | ||
222 | GREP = @GREP@ | ||
223 | INSTALL = @INSTALL@ | ||
224 | INSTALL_DATA = @INSTALL_DATA@ | ||
225 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
226 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
227 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
228 | INTLLIBS = @INTLLIBS@ | ||
229 | INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ | ||
230 | KEYSYMDEFS = @KEYSYMDEFS@ | ||
231 | LD = @LD@ | ||
232 | LDFLAGS = @LDFLAGS@ | ||
233 | LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ | ||
234 | LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ | ||
235 | LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ | ||
236 | LIBICONV = @LIBICONV@ | ||
237 | LIBINTL = @LIBINTL@ | ||
238 | LIBOBJS = @LIBOBJS@ | ||
239 | LIBS = @LIBS@ | ||
240 | LIBTOOL = @LIBTOOL@ | ||
241 | LIPO = @LIPO@ | ||
242 | LN_S = @LN_S@ | ||
243 | LTLIBICONV = @LTLIBICONV@ | ||
244 | LTLIBINTL = @LTLIBINTL@ | ||
245 | LTLIBOBJS = @LTLIBOBJS@ | ||
246 | MAKEINFO = @MAKEINFO@ | ||
247 | MKDIR_P = @MKDIR_P@ | ||
248 | MSGFMT = @MSGFMT@ | ||
249 | MSGFMT_015 = @MSGFMT_015@ | ||
250 | MSGMERGE = @MSGMERGE@ | ||
251 | NM = @NM@ | ||
252 | NMEDIT = @NMEDIT@ | ||
253 | OBJC = @OBJC@ | ||
254 | OBJCDEPMODE = @OBJCDEPMODE@ | ||
255 | OBJCFLAGS = @OBJCFLAGS@ | ||
256 | OBJDUMP = @OBJDUMP@ | ||
257 | OBJEXT = @OBJEXT@ | ||
258 | OTOOL = @OTOOL@ | ||
259 | OTOOL64 = @OTOOL64@ | ||
260 | PACKAGE = @PACKAGE@ | ||
261 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
262 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
263 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
264 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
265 | PACKAGE_URL = @PACKAGE_URL@ | ||
266 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
267 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
268 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ | ||
269 | PIXMAN_LIBS = @PIXMAN_LIBS@ | ||
270 | PKG_CONFIG = @PKG_CONFIG@ | ||
271 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
272 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
273 | POSUB = @POSUB@ | ||
274 | RANLIB = @RANLIB@ | ||
275 | SDL_CFLAGS = @SDL_CFLAGS@ | ||
276 | SDL_CONFIG = @SDL_CONFIG@ | ||
277 | SDL_LIBS = @SDL_LIBS@ | ||
278 | SED = @SED@ | ||
279 | SET_MAKE = @SET_MAKE@ | ||
280 | SHELL = @SHELL@ | ||
281 | SSL_CFLAGS = @SSL_CFLAGS@ | ||
282 | SSL_LIBS = @SSL_LIBS@ | ||
283 | STRIP = @STRIP@ | ||
284 | TLS2_CFLAGS = @TLS2_CFLAGS@ | ||
285 | TLS2_LIBS = @TLS2_LIBS@ | ||
286 | TLS_CFLAGS = @TLS_CFLAGS@ | ||
287 | TLS_LIBS = @TLS_LIBS@ | ||
288 | TSLIB_CFLAGS = @TSLIB_CFLAGS@ | ||
289 | TSLIB_LIBS = @TSLIB_LIBS@ | ||
290 | USE_NLS = @USE_NLS@ | ||
291 | VERSION = @VERSION@ | ||
292 | VMAJ = @VMAJ@ | ||
293 | WIN32_CFLAGS = @WIN32_CFLAGS@ | ||
294 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ | ||
295 | WIN32_LIBS = @WIN32_LIBS@ | ||
296 | XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ | ||
297 | XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ | ||
298 | XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ | ||
299 | XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ | ||
300 | XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ | ||
301 | XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ | ||
302 | XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ | ||
303 | XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ | ||
304 | XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ | ||
305 | XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ | ||
306 | XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ | ||
307 | XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ | ||
308 | XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ | ||
309 | XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ | ||
310 | XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ | ||
311 | XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ | ||
312 | XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ | ||
313 | XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ | ||
314 | XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ | ||
315 | XCB_X11_LIBS = @XCB_X11_LIBS@ | ||
316 | XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ | ||
317 | XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ | ||
318 | XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ | ||
319 | XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ | ||
320 | XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ | ||
321 | XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ | ||
322 | XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ | ||
323 | XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ | ||
324 | XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ | ||
325 | XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ | ||
326 | XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ | ||
327 | XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ | ||
328 | XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ | ||
329 | XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ | ||
330 | XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ | ||
331 | XDAMAGE_LIBS = @XDAMAGE_LIBS@ | ||
332 | XDPMS_CFLAGS = @XDPMS_CFLAGS@ | ||
333 | XDPMS_LIBS = @XDPMS_LIBS@ | ||
334 | XFIXES_CFLAGS = @XFIXES_CFLAGS@ | ||
335 | XFIXES_LIBS = @XFIXES_LIBS@ | ||
336 | XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ | ||
337 | XGESTURE_LIBS = @XGESTURE_LIBS@ | ||
338 | XGETTEXT = @XGETTEXT@ | ||
339 | XGETTEXT_015 = @XGETTEXT_015@ | ||
340 | XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ | ||
341 | XI2_CFLAGS = @XI2_CFLAGS@ | ||
342 | XI2_LIBS = @XI2_LIBS@ | ||
343 | XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ | ||
344 | XINERAMA_LIBS = @XINERAMA_LIBS@ | ||
345 | XKB_CFLAGS = @XKB_CFLAGS@ | ||
346 | XKB_LIBS = @XKB_LIBS@ | ||
347 | XMKMF = @XMKMF@ | ||
348 | XPRINT_CFLAGS = @XPRINT_CFLAGS@ | ||
349 | XPRINT_LIBS = @XPRINT_LIBS@ | ||
350 | XRANDR_CFLAGS = @XRANDR_CFLAGS@ | ||
351 | XRANDR_LIBS = @XRANDR_LIBS@ | ||
352 | XRENDER_CFLAGS = @XRENDER_CFLAGS@ | ||
353 | XRENDER_LIBS = @XRENDER_LIBS@ | ||
354 | XSS_CFLAGS = @XSS_CFLAGS@ | ||
355 | XSS_LIBS = @XSS_LIBS@ | ||
356 | XTEST_CFLAGS = @XTEST_CFLAGS@ | ||
357 | XTEST_LIBS = @XTEST_LIBS@ | ||
358 | X_CFLAGS = @X_CFLAGS@ | ||
359 | X_EXTRA_LIBS = @X_EXTRA_LIBS@ | ||
360 | X_LIBS = @X_LIBS@ | ||
361 | X_PRE_LIBS = @X_PRE_LIBS@ | ||
362 | Xcursor_cflags = @Xcursor_cflags@ | ||
363 | Xcursor_libs = @Xcursor_libs@ | ||
364 | abs_builddir = @abs_builddir@ | ||
365 | abs_srcdir = @abs_srcdir@ | ||
366 | abs_top_builddir = @abs_top_builddir@ | ||
367 | abs_top_srcdir = @abs_top_srcdir@ | ||
368 | ac_ct_CC = @ac_ct_CC@ | ||
369 | ac_ct_CXX = @ac_ct_CXX@ | ||
370 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
371 | ac_ct_OBJC = @ac_ct_OBJC@ | ||
372 | am__include = @am__include@ | ||
373 | am__leading_dot = @am__leading_dot@ | ||
374 | am__quote = @am__quote@ | ||
375 | am__tar = @am__tar@ | ||
376 | am__untar = @am__untar@ | ||
377 | bindir = @bindir@ | ||
378 | build = @build@ | ||
379 | build_alias = @build_alias@ | ||
380 | build_cpu = @build_cpu@ | ||
381 | build_os = @build_os@ | ||
382 | build_vendor = @build_vendor@ | ||
383 | builddir = @builddir@ | ||
384 | cocoa_ldflags = @cocoa_ldflags@ | ||
385 | datadir = @datadir@ | ||
386 | datarootdir = @datarootdir@ | ||
387 | dlopen_libs = @dlopen_libs@ | ||
388 | docdir = @docdir@ | ||
389 | dvidir = @dvidir@ | ||
390 | ecore_cocoa_cflags = @ecore_cocoa_cflags@ | ||
391 | ecore_cocoa_libs = @ecore_cocoa_libs@ | ||
392 | ecore_con_cflags = @ecore_con_cflags@ | ||
393 | ecore_con_libs = @ecore_con_libs@ | ||
394 | ecore_directfb_cflags = @ecore_directfb_cflags@ | ||
395 | ecore_directfb_libs = @ecore_directfb_libs@ | ||
396 | ecore_evas_cflags = @ecore_evas_cflags@ | ||
397 | ecore_evas_libs = @ecore_evas_libs@ | ||
398 | ecore_fb_cflags = @ecore_fb_cflags@ | ||
399 | ecore_fb_libs = @ecore_fb_libs@ | ||
400 | ecore_file_cflags = @ecore_file_cflags@ | ||
401 | ecore_file_libs = @ecore_file_libs@ | ||
402 | ecore_imf_cflags = @ecore_imf_cflags@ | ||
403 | ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ | ||
404 | ecore_imf_evas_libs = @ecore_imf_evas_libs@ | ||
405 | ecore_imf_libs = @ecore_imf_libs@ | ||
406 | ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ | ||
407 | ecore_imf_xim_libs = @ecore_imf_xim_libs@ | ||
408 | ecore_input_cflags = @ecore_input_cflags@ | ||
409 | ecore_input_evas_cflags = @ecore_input_evas_cflags@ | ||
410 | ecore_input_evas_libs = @ecore_input_evas_libs@ | ||
411 | ecore_input_libs = @ecore_input_libs@ | ||
412 | ecore_ipc_cflags = @ecore_ipc_cflags@ | ||
413 | ecore_ipc_libs = @ecore_ipc_libs@ | ||
414 | ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ | ||
415 | ecore_psl1ght_libs = @ecore_psl1ght_libs@ | ||
416 | ecore_sdl_cflags = @ecore_sdl_cflags@ | ||
417 | ecore_sdl_libs = @ecore_sdl_libs@ | ||
418 | ecore_win32_cflags = @ecore_win32_cflags@ | ||
419 | ecore_win32_libs = @ecore_win32_libs@ | ||
420 | ecore_wince_cflags = @ecore_wince_cflags@ | ||
421 | ecore_wince_libs = @ecore_wince_libs@ | ||
422 | ecore_x_cflags = @ecore_x_cflags@ | ||
423 | ecore_x_libs = @ecore_x_libs@ | ||
424 | ecore_x_libs_private = @ecore_x_libs_private@ | ||
425 | efl_doxygen = @efl_doxygen@ | ||
426 | efl_have_doxygen = @efl_have_doxygen@ | ||
427 | exec_prefix = @exec_prefix@ | ||
428 | have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ | ||
429 | host = @host@ | ||
430 | host_alias = @host_alias@ | ||
431 | host_cpu = @host_cpu@ | ||
432 | host_os = @host_os@ | ||
433 | host_vendor = @host_vendor@ | ||
434 | htmldir = @htmldir@ | ||
435 | includedir = @includedir@ | ||
436 | infodir = @infodir@ | ||
437 | install_sh = @install_sh@ | ||
438 | libdir = @libdir@ | ||
439 | libexecdir = @libexecdir@ | ||
440 | localedir = @localedir@ | ||
441 | localstatedir = @localstatedir@ | ||
442 | lt_ECHO = @lt_ECHO@ | ||
443 | lt_enable_auto_import = @lt_enable_auto_import@ | ||
444 | mandir = @mandir@ | ||
445 | mkdir_p = @mkdir_p@ | ||
446 | oldincludedir = @oldincludedir@ | ||
447 | pdfdir = @pdfdir@ | ||
448 | pkgconfig_requires_private = @pkgconfig_requires_private@ | ||
449 | prefix = @prefix@ | ||
450 | program_transform_name = @program_transform_name@ | ||
451 | psdir = @psdir@ | ||
452 | release_info = @release_info@ | ||
453 | requirements_ecore = @requirements_ecore@ | ||
454 | requirements_ecore_cocoa = @requirements_ecore_cocoa@ | ||
455 | requirements_ecore_con = @requirements_ecore_con@ | ||
456 | requirements_ecore_directfb = @requirements_ecore_directfb@ | ||
457 | requirements_ecore_evas = @requirements_ecore_evas@ | ||
458 | requirements_ecore_fb = @requirements_ecore_fb@ | ||
459 | requirements_ecore_file = @requirements_ecore_file@ | ||
460 | requirements_ecore_imf = @requirements_ecore_imf@ | ||
461 | requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ | ||
462 | requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ | ||
463 | requirements_ecore_input = @requirements_ecore_input@ | ||
464 | requirements_ecore_input_evas = @requirements_ecore_input_evas@ | ||
465 | requirements_ecore_ipc = @requirements_ecore_ipc@ | ||
466 | requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ | ||
467 | requirements_ecore_sdl = @requirements_ecore_sdl@ | ||
468 | requirements_ecore_win32 = @requirements_ecore_win32@ | ||
469 | requirements_ecore_wince = @requirements_ecore_wince@ | ||
470 | requirements_ecore_x = @requirements_ecore_x@ | ||
471 | rt_libs = @rt_libs@ | ||
472 | sbindir = @sbindir@ | ||
473 | sharedstatedir = @sharedstatedir@ | ||
474 | srcdir = @srcdir@ | ||
475 | sysconfdir = @sysconfdir@ | ||
476 | target_alias = @target_alias@ | ||
477 | top_build_prefix = @top_build_prefix@ | ||
478 | top_builddir = @top_builddir@ | ||
479 | top_srcdir = @top_srcdir@ | ||
480 | version_info = @version_info@ | ||
481 | x_cflags = @x_cflags@ | ||
482 | x_includes = @x_includes@ | ||
483 | x_libs = @x_libs@ | ||
484 | MAINTAINERCLEANFILES = Makefile.in | ||
485 | AM_CPPFLAGS = \ | ||
486 | -I$(top_srcdir)/src/lib/ecore \ | ||
487 | -I$(top_srcdir)/src/lib/ecore_input \ | ||
488 | -I$(top_builddir)/src/lib/ecore \ | ||
489 | -I$(top_builddir)/src/lib/ecore_input \ | ||
490 | @EFL_ECORE_WIN32_BUILD@ \ | ||
491 | @EINA_CFLAGS@ \ | ||
492 | @WIN32_CPPFLAGS@ | ||
493 | |||
494 | lib_LTLIBRARIES = libecore_win32.la | ||
495 | includes_HEADERS = Ecore_Win32.h | ||
496 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
497 | libecore_win32_la_SOURCES = \ | ||
498 | ecore_win32.c \ | ||
499 | ecore_win32_cursor.c \ | ||
500 | ecore_win32_dnd.c \ | ||
501 | ecore_win32_dnd_enumformatetc.cpp \ | ||
502 | ecore_win32_dnd_data_object.cpp \ | ||
503 | ecore_win32_dnd_drop_source.cpp \ | ||
504 | ecore_win32_dnd_drop_target.cpp \ | ||
505 | ecore_win32_event.c \ | ||
506 | ecore_win32_window.c | ||
507 | |||
508 | libecore_win32_la_LIBADD = \ | ||
509 | @ecore_win32_libs@ \ | ||
510 | @WIN32_LIBS@ \ | ||
511 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
512 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
513 | @EINA_LIBS@ | ||
514 | |||
515 | libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | ||
516 | EXTRA_DIST = \ | ||
517 | ecore_win32_private.h \ | ||
518 | ecore_win32_dnd_enumformatetc.h \ | ||
519 | ecore_win32_dnd_data_object.h \ | ||
520 | ecore_win32_dnd_drop_source.h \ | ||
521 | ecore_win32_dnd_drop_target.h | ||
522 | |||
523 | all: all-am | ||
524 | |||
525 | .SUFFIXES: | ||
526 | .SUFFIXES: .c .cpp .lo .o .obj | ||
527 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
528 | @for dep in $?; do \ | ||
529 | case '$(am__configure_deps)' in \ | ||
530 | *$$dep*) \ | ||
531 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
532 | && { if test -f $@; then exit 0; else break; fi; }; \ | ||
533 | exit 1;; \ | ||
534 | esac; \ | ||
535 | done; \ | ||
536 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_win32/Makefile'; \ | ||
537 | $(am__cd) $(top_srcdir) && \ | ||
538 | $(AUTOMAKE) --gnu src/lib/ecore_win32/Makefile | ||
539 | .PRECIOUS: Makefile | ||
540 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
541 | @case '$?' in \ | ||
542 | *config.status*) \ | ||
543 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
544 | *) \ | ||
545 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
546 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
547 | esac; | ||
548 | |||
549 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
550 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
551 | |||
552 | $(top_srcdir)/configure: $(am__configure_deps) | ||
553 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
554 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
555 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
556 | $(am__aclocal_m4_deps): | ||
557 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) | ||
558 | @$(NORMAL_INSTALL) | ||
559 | test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" | ||
560 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
561 | list2=; for p in $$list; do \ | ||
562 | if test -f $$p; then \ | ||
563 | list2="$$list2 $$p"; \ | ||
564 | else :; fi; \ | ||
565 | done; \ | ||
566 | test -z "$$list2" || { \ | ||
567 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ | ||
568 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ | ||
569 | } | ||
570 | |||
571 | uninstall-libLTLIBRARIES: | ||
572 | @$(NORMAL_UNINSTALL) | ||
573 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
574 | for p in $$list; do \ | ||
575 | $(am__strip_dir) \ | ||
576 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ | ||
577 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ | ||
578 | done | ||
579 | |||
580 | clean-libLTLIBRARIES: | ||
581 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) | ||
582 | @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ | ||
583 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ | ||
584 | test "$$dir" != "$$p" || dir=.; \ | ||
585 | echo "rm -f \"$${dir}/so_locations\""; \ | ||
586 | rm -f "$${dir}/so_locations"; \ | ||
587 | done | ||
588 | libecore_win32.la: $(libecore_win32_la_OBJECTS) $(libecore_win32_la_DEPENDENCIES) | ||
589 | $(AM_V_CXXLD)$(libecore_win32_la_LINK) -rpath $(libdir) $(libecore_win32_la_OBJECTS) $(libecore_win32_la_LIBADD) $(LIBS) | ||
590 | |||
591 | mostlyclean-compile: | ||
592 | -rm -f *.$(OBJEXT) | ||
593 | |||
594 | distclean-compile: | ||
595 | -rm -f *.tab.c | ||
596 | |||
597 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32.Plo@am__quote@ | ||
598 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_cursor.Plo@am__quote@ | ||
599 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd.Plo@am__quote@ | ||
600 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_data_object.Plo@am__quote@ | ||
601 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_drop_source.Plo@am__quote@ | ||
602 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_drop_target.Plo@am__quote@ | ||
603 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_enumformatetc.Plo@am__quote@ | ||
604 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_event.Plo@am__quote@ | ||
605 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_window.Plo@am__quote@ | ||
606 | |||
607 | .c.o: | ||
608 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
609 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
610 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
611 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
612 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
613 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< | ||
614 | |||
615 | .c.obj: | ||
616 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
617 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
618 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
619 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
620 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
621 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` | ||
622 | |||
623 | .c.lo: | ||
624 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
625 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
626 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
627 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
628 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
629 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< | ||
630 | |||
631 | .cpp.o: | ||
632 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
633 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
634 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
635 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
636 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
637 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< | ||
638 | |||
639 | .cpp.obj: | ||
640 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
641 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
642 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
643 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
644 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
645 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` | ||
646 | |||
647 | .cpp.lo: | ||
648 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
649 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
650 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
651 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
652 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
653 | @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< | ||
654 | |||
655 | mostlyclean-libtool: | ||
656 | -rm -f *.lo | ||
657 | |||
658 | clean-libtool: | ||
659 | -rm -rf .libs _libs | ||
660 | install-includesHEADERS: $(includes_HEADERS) | ||
661 | @$(NORMAL_INSTALL) | ||
662 | test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" | ||
663 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
664 | for p in $$list; do \ | ||
665 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
666 | echo "$$d$$p"; \ | ||
667 | done | $(am__base_list) | \ | ||
668 | while read files; do \ | ||
669 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ | ||
670 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ | ||
671 | done | ||
672 | |||
673 | uninstall-includesHEADERS: | ||
674 | @$(NORMAL_UNINSTALL) | ||
675 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
676 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | ||
677 | test -n "$$files" || exit 0; \ | ||
678 | echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ | ||
679 | cd "$(DESTDIR)$(includesdir)" && rm -f $$files | ||
680 | |||
681 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
682 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
683 | unique=`for i in $$list; do \ | ||
684 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
685 | done | \ | ||
686 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
687 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
688 | mkid -fID $$unique | ||
689 | tags: TAGS | ||
690 | |||
691 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
692 | $(TAGS_FILES) $(LISP) | ||
693 | set x; \ | ||
694 | here=`pwd`; \ | ||
695 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
696 | unique=`for i in $$list; do \ | ||
697 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
698 | done | \ | ||
699 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
700 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
701 | shift; \ | ||
702 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | ||
703 | test -n "$$unique" || unique=$$empty_fix; \ | ||
704 | if test $$# -gt 0; then \ | ||
705 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
706 | "$$@" $$unique; \ | ||
707 | else \ | ||
708 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
709 | $$unique; \ | ||
710 | fi; \ | ||
711 | fi | ||
712 | ctags: CTAGS | ||
713 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
714 | $(TAGS_FILES) $(LISP) | ||
715 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
716 | unique=`for i in $$list; do \ | ||
717 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
718 | done | \ | ||
719 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
720 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
721 | test -z "$(CTAGS_ARGS)$$unique" \ | ||
722 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
723 | $$unique | ||
724 | |||
725 | GTAGS: | ||
726 | here=`$(am__cd) $(top_builddir) && pwd` \ | ||
727 | && $(am__cd) $(top_srcdir) \ | ||
728 | && gtags -i $(GTAGS_ARGS) "$$here" | ||
729 | |||
730 | distclean-tags: | ||
731 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
732 | |||
733 | distdir: $(DISTFILES) | ||
734 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
735 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
736 | list='$(DISTFILES)'; \ | ||
737 | dist_files=`for file in $$list; do echo $$file; done | \ | ||
738 | sed -e "s|^$$srcdirstrip/||;t" \ | ||
739 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
740 | case $$dist_files in \ | ||
741 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
742 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
743 | sort -u` ;; \ | ||
744 | esac; \ | ||
745 | for file in $$dist_files; do \ | ||
746 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
747 | if test -d $$d/$$file; then \ | ||
748 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
749 | if test -d "$(distdir)/$$file"; then \ | ||
750 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
751 | fi; \ | ||
752 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
753 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
754 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
755 | fi; \ | ||
756 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
757 | else \ | ||
758 | test -f "$(distdir)/$$file" \ | ||
759 | || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
760 | || exit 1; \ | ||
761 | fi; \ | ||
762 | done | ||
763 | check-am: all-am | ||
764 | check: check-am | ||
765 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) | ||
766 | installdirs: | ||
767 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ | ||
768 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | ||
769 | done | ||
770 | install: install-am | ||
771 | install-exec: install-exec-am | ||
772 | install-data: install-data-am | ||
773 | uninstall: uninstall-am | ||
774 | |||
775 | install-am: all-am | ||
776 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
777 | |||
778 | installcheck: installcheck-am | ||
779 | install-strip: | ||
780 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
781 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
782 | `test -z '$(STRIP)' || \ | ||
783 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
784 | mostlyclean-generic: | ||
785 | |||
786 | clean-generic: | ||
787 | |||
788 | distclean-generic: | ||
789 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
790 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
791 | |||
792 | maintainer-clean-generic: | ||
793 | @echo "This command is intended for maintainers to use" | ||
794 | @echo "it deletes files that may require special tools to rebuild." | ||
795 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | ||
796 | clean: clean-am | ||
797 | |||
798 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ | ||
799 | mostlyclean-am | ||
800 | |||
801 | distclean: distclean-am | ||
802 | -rm -rf ./$(DEPDIR) | ||
803 | -rm -f Makefile | ||
804 | distclean-am: clean-am distclean-compile distclean-generic \ | ||
805 | distclean-tags | ||
806 | |||
807 | dvi: dvi-am | ||
808 | |||
809 | dvi-am: | ||
810 | |||
811 | html: html-am | ||
812 | |||
813 | html-am: | ||
814 | |||
815 | info: info-am | ||
816 | |||
817 | info-am: | ||
818 | |||
819 | install-data-am: install-includesHEADERS | ||
820 | |||
821 | install-dvi: install-dvi-am | ||
822 | |||
823 | install-dvi-am: | ||
824 | |||
825 | install-exec-am: install-libLTLIBRARIES | ||
826 | |||
827 | install-html: install-html-am | ||
828 | |||
829 | install-html-am: | ||
830 | |||
831 | install-info: install-info-am | ||
832 | |||
833 | install-info-am: | ||
834 | |||
835 | install-man: | ||
836 | |||
837 | install-pdf: install-pdf-am | ||
838 | |||
839 | install-pdf-am: | ||
840 | |||
841 | install-ps: install-ps-am | ||
842 | |||
843 | install-ps-am: | ||
844 | |||
845 | installcheck-am: | ||
846 | |||
847 | maintainer-clean: maintainer-clean-am | ||
848 | -rm -rf ./$(DEPDIR) | ||
849 | -rm -f Makefile | ||
850 | maintainer-clean-am: distclean-am maintainer-clean-generic | ||
851 | |||
852 | mostlyclean: mostlyclean-am | ||
853 | |||
854 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | ||
855 | mostlyclean-libtool | ||
856 | |||
857 | pdf: pdf-am | ||
858 | |||
859 | pdf-am: | ||
860 | |||
861 | ps: ps-am | ||
862 | |||
863 | ps-am: | ||
864 | |||
865 | uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES | ||
866 | |||
867 | .MAKE: install-am install-strip | ||
868 | |||
869 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||
870 | clean-libLTLIBRARIES clean-libtool ctags distclean \ | ||
871 | distclean-compile distclean-generic distclean-libtool \ | ||
872 | distclean-tags distdir dvi dvi-am html html-am info info-am \ | ||
873 | install install-am install-data install-data-am install-dvi \ | ||
874 | install-dvi-am install-exec install-exec-am install-html \ | ||
875 | install-html-am install-includesHEADERS install-info \ | ||
876 | install-info-am install-libLTLIBRARIES install-man install-pdf \ | ||
877 | install-pdf-am install-ps install-ps-am install-strip \ | ||
878 | installcheck installcheck-am installdirs maintainer-clean \ | ||
879 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
880 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | ||
881 | tags uninstall uninstall-am uninstall-includesHEADERS \ | ||
882 | uninstall-libLTLIBRARIES | ||
883 | |||
884 | |||
885 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
886 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
887 | .NOEXPORT: | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32.c new file mode 100644 index 0000000..19ca3ed --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32.c | |||
@@ -0,0 +1,788 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | |||
7 | #define WIN32_LEAN_AND_MEAN | ||
8 | #include <windows.h> | ||
9 | #undef WIN32_LEAN_AND_MEAN | ||
10 | #include <windowsx.h> | ||
11 | |||
12 | #include <Eina.h> | ||
13 | #include <Ecore.h> | ||
14 | #include <Ecore_Input.h> | ||
15 | |||
16 | #include "Ecore_Win32.h" | ||
17 | #include "ecore_win32_private.h" | ||
18 | |||
19 | /*============================================================================* | ||
20 | * Local * | ||
21 | *============================================================================*/ | ||
22 | |||
23 | /** | ||
24 | * @cond LOCAL | ||
25 | */ | ||
26 | |||
27 | /* OLE IID for Drag'n Drop */ | ||
28 | |||
29 | # define INITGUID | ||
30 | # include <basetyps.h> | ||
31 | DEFINE_OLEGUID(IID_IEnumFORMATETC, 0x00000103L, 0, 0); | ||
32 | DEFINE_OLEGUID(IID_IDataObject, 0x0000010EL, 0, 0); | ||
33 | DEFINE_OLEGUID(IID_IDropSource, 0x00000121L, 0, 0); | ||
34 | DEFINE_OLEGUID(IID_IDropTarget, 0x00000122L, 0, 0); | ||
35 | DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0); | ||
36 | |||
37 | #define IDI_ICON 101 | ||
38 | |||
39 | static int _ecore_win32_init_count = 0; | ||
40 | |||
41 | static void | ||
42 | _ecore_win32_size_check(Ecore_Win32_Window *win, int w, int h, int *dx, int *dy) | ||
43 | { | ||
44 | int minimal_width; | ||
45 | int minimal_height; | ||
46 | |||
47 | minimal_width = GetSystemMetrics(SM_CXMIN); | ||
48 | minimal_height = GetSystemMetrics(SM_CYMIN); | ||
49 | if ((w) < MAX(minimal_width, (int)win->min_width)) | ||
50 | *dx = 0; | ||
51 | if ((w) > (int)win->max_width) | ||
52 | *dx = 0; | ||
53 | if ((h) < MAX(minimal_height, (int)win->min_height)) | ||
54 | *dy = 0; | ||
55 | if ((h) > (int)win->max_height) | ||
56 | *dy = 0; | ||
57 | } | ||
58 | |||
59 | LRESULT CALLBACK | ||
60 | _ecore_win32_window_procedure(HWND window, | ||
61 | UINT message, | ||
62 | WPARAM window_param, | ||
63 | LPARAM data_param) | ||
64 | { | ||
65 | Ecore_Win32_Callback_Data *data; | ||
66 | POINTS point; | ||
67 | DWORD coord; | ||
68 | |||
69 | data = (Ecore_Win32_Callback_Data *)malloc(sizeof(Ecore_Win32_Callback_Data)); | ||
70 | if (!data) return DefWindowProc(window, message, window_param, data_param); | ||
71 | |||
72 | data->window = window; | ||
73 | data->message = message; | ||
74 | data->window_param = window_param; | ||
75 | data->data_param = data_param; | ||
76 | data->time = GetMessageTime(); | ||
77 | coord = GetMessagePos(); | ||
78 | point = MAKEPOINTS(coord); | ||
79 | data->x = point.x; | ||
80 | data->y = point.y; | ||
81 | |||
82 | switch (data->message) | ||
83 | { | ||
84 | /* Keyboard input notifications */ | ||
85 | case WM_KEYDOWN: | ||
86 | case WM_SYSKEYDOWN: | ||
87 | INF("keydown message"); | ||
88 | _ecore_win32_event_handle_key_press(data, 1); | ||
89 | return 0; | ||
90 | case WM_CHAR: | ||
91 | case WM_SYSCHAR: | ||
92 | INF("char message"); | ||
93 | _ecore_win32_event_handle_key_press(data, 0); | ||
94 | return 0; | ||
95 | case WM_KEYUP: | ||
96 | case WM_SYSKEYUP: | ||
97 | INF("keyup message"); | ||
98 | _ecore_win32_event_handle_key_release(data); | ||
99 | return 0; | ||
100 | case WM_SETFOCUS: | ||
101 | INF("setfocus message"); | ||
102 | _ecore_win32_event_handle_focus_in(data); | ||
103 | return 0; | ||
104 | case WM_KILLFOCUS: | ||
105 | INF("kill focus message"); | ||
106 | _ecore_win32_event_handle_focus_out(data); | ||
107 | return 0; | ||
108 | /* Mouse input notifications */ | ||
109 | case WM_LBUTTONDOWN: | ||
110 | INF("left button down message"); | ||
111 | SetCapture(window); | ||
112 | _ecore_win32_event_handle_button_press(data, 1); | ||
113 | return 0; | ||
114 | case WM_MBUTTONDOWN: | ||
115 | INF("middle button down message"); | ||
116 | _ecore_win32_event_handle_button_press(data, 2); | ||
117 | return 0; | ||
118 | case WM_RBUTTONDOWN: | ||
119 | INF("right button down message"); | ||
120 | _ecore_win32_event_handle_button_press(data, 3); | ||
121 | return 0; | ||
122 | case WM_LBUTTONUP: | ||
123 | { | ||
124 | Ecore_Win32_Window *w = NULL; | ||
125 | |||
126 | INF("left button up message"); | ||
127 | |||
128 | ReleaseCapture(); | ||
129 | w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); | ||
130 | if (w->drag.dragging) | ||
131 | { | ||
132 | w->drag.dragging = 0; | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | _ecore_win32_event_handle_button_release(data, 1); | ||
137 | return 0; | ||
138 | } | ||
139 | case WM_MBUTTONUP: | ||
140 | INF("middle button up message"); | ||
141 | _ecore_win32_event_handle_button_release(data, 2); | ||
142 | return 0; | ||
143 | case WM_RBUTTONUP: | ||
144 | INF("right button up message"); | ||
145 | _ecore_win32_event_handle_button_release(data, 3); | ||
146 | return 0; | ||
147 | case WM_MOUSEMOVE: | ||
148 | { | ||
149 | RECT rect; | ||
150 | Ecore_Win32_Window *w = NULL; | ||
151 | |||
152 | INF("moue move message"); | ||
153 | |||
154 | w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); | ||
155 | |||
156 | if (w->drag.dragging) | ||
157 | { | ||
158 | POINT pt; | ||
159 | |||
160 | pt.x = GET_X_LPARAM(data_param); | ||
161 | pt.y = GET_Y_LPARAM(data_param); | ||
162 | if (ClientToScreen(window, &pt)) | ||
163 | { | ||
164 | if (w->drag.type == HTCAPTION) | ||
165 | { | ||
166 | int dx; | ||
167 | int dy; | ||
168 | |||
169 | dx = pt.x - w->drag.px; | ||
170 | dy = pt.y - w->drag.py; | ||
171 | ecore_win32_window_move(w, w->drag.x + dx, w->drag.y + dy); | ||
172 | w->drag.x += dx; | ||
173 | w->drag.y += dy; | ||
174 | w->drag.px = pt.x; | ||
175 | w->drag.py = pt.y; | ||
176 | return 0; | ||
177 | } | ||
178 | if (w->drag.type == HTLEFT) | ||
179 | { | ||
180 | int dw; | ||
181 | |||
182 | dw = pt.x - w->drag.px; | ||
183 | ecore_win32_window_move_resize(w, w->drag.x + dw, w->drag.y, w->drag.w - dw, w->drag.h); | ||
184 | w->drag.x += dw; | ||
185 | w->drag.w -= dw; | ||
186 | w->drag.px = pt.x; | ||
187 | w->drag.py = pt.y; | ||
188 | return 0; | ||
189 | } | ||
190 | if (w->drag.type == HTRIGHT) | ||
191 | { | ||
192 | int dw; | ||
193 | |||
194 | dw = pt.x - w->drag.px; | ||
195 | ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h); | ||
196 | w->drag.w += dw; | ||
197 | w->drag.px = pt.x; | ||
198 | w->drag.py = pt.y; | ||
199 | return 0; | ||
200 | } | ||
201 | if (w->drag.type == HTTOP) | ||
202 | { | ||
203 | int dh; | ||
204 | |||
205 | dh = pt.y - w->drag.py; | ||
206 | ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dh, w->drag.w, w->drag.h - dh); | ||
207 | w->drag.y += dh; | ||
208 | w->drag.h -= dh; | ||
209 | w->drag.px = pt.x; | ||
210 | w->drag.py = pt.y; | ||
211 | return 0; | ||
212 | } | ||
213 | if (w->drag.type == HTBOTTOM) | ||
214 | { | ||
215 | int dh; | ||
216 | |||
217 | dh = pt.y - w->drag.py; | ||
218 | ecore_win32_window_resize(w, w->drag.w, w->drag.h + dh); | ||
219 | w->drag.h += dh; | ||
220 | w->drag.px = pt.x; | ||
221 | w->drag.py = pt.y; | ||
222 | return 0; | ||
223 | } | ||
224 | if (w->drag.type == HTTOPLEFT) | ||
225 | { | ||
226 | int dx; | ||
227 | int dy; | ||
228 | int dh; | ||
229 | int dw; | ||
230 | |||
231 | dw = pt.x - w->drag.px; | ||
232 | dh = pt.y - w->drag.py; | ||
233 | dx = dw; | ||
234 | dy = dh; | ||
235 | _ecore_win32_size_check(w, | ||
236 | w->drag.w - dw, w->drag.h - dh, | ||
237 | &dx, &dy); | ||
238 | |||
239 | ecore_win32_window_move_resize(w, w->drag.x + dx, w->drag.y + dy, w->drag.w - dw, w->drag.h - dh); | ||
240 | w->drag.x += dx; | ||
241 | w->drag.y += dy; | ||
242 | w->drag.w -= dw; | ||
243 | w->drag.h -= dh; | ||
244 | w->drag.px = pt.x; | ||
245 | w->drag.py = pt.y; | ||
246 | return 0; | ||
247 | } | ||
248 | if (w->drag.type == HTTOPRIGHT) | ||
249 | { | ||
250 | int dx; | ||
251 | int dy; | ||
252 | int dh; | ||
253 | int dw; | ||
254 | |||
255 | dw = pt.x - w->drag.px; | ||
256 | dh = pt.y - w->drag.py; | ||
257 | dx = dw; | ||
258 | dy = dh; | ||
259 | _ecore_win32_size_check(w, | ||
260 | w->drag.w, w->drag.h - dh, | ||
261 | &dx, &dy); | ||
262 | ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dy, w->drag.w, w->drag.h - dh); | ||
263 | w->drag.y += dy; | ||
264 | w->drag.w += dw; | ||
265 | w->drag.h -= dh; | ||
266 | w->drag.px = pt.x; | ||
267 | w->drag.py = pt.y; | ||
268 | return 0; | ||
269 | } | ||
270 | if (w->drag.type == HTBOTTOMLEFT) | ||
271 | { | ||
272 | int dx; | ||
273 | int dy; | ||
274 | int dh; | ||
275 | int dw; | ||
276 | |||
277 | dw = pt.x - w->drag.px; | ||
278 | dh = pt.y - w->drag.py; | ||
279 | dx = dw; | ||
280 | dy = dh; | ||
281 | _ecore_win32_size_check(w, | ||
282 | w->drag.w - dw, w->drag.h + dh, | ||
283 | &dx, &dy); | ||
284 | ecore_win32_window_move_resize(w, w->drag.x + dx, w->drag.y, w->drag.w - dw, w->drag.h + dh); | ||
285 | w->drag.x += dx; | ||
286 | w->drag.w -= dw; | ||
287 | w->drag.h += dh; | ||
288 | w->drag.px = pt.x; | ||
289 | w->drag.py = pt.y; | ||
290 | return 0; | ||
291 | } | ||
292 | if (w->drag.type == HTBOTTOMRIGHT) | ||
293 | { | ||
294 | int dh; | ||
295 | int dw; | ||
296 | |||
297 | dw = pt.x - w->drag.px; | ||
298 | dh = pt.y - w->drag.py; | ||
299 | ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h + dh); | ||
300 | w->drag.w += dw; | ||
301 | w->drag.h += dh; | ||
302 | w->drag.px = pt.x; | ||
303 | w->drag.py = pt.y; | ||
304 | return 0; | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | |||
309 | if (GetClientRect(window, &rect)) | ||
310 | { | ||
311 | POINT pt; | ||
312 | |||
313 | INF("mouse in window"); | ||
314 | |||
315 | pt.x = GET_X_LPARAM(data_param); | ||
316 | pt.y = GET_Y_LPARAM(data_param); | ||
317 | if (!PtInRect(&rect, pt)) | ||
318 | { | ||
319 | if (w->pointer_is_in) | ||
320 | { | ||
321 | w->pointer_is_in = 0; | ||
322 | _ecore_win32_event_handle_leave_notify(data); | ||
323 | } | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | if (!w->pointer_is_in) | ||
328 | { | ||
329 | w->pointer_is_in = 1; | ||
330 | _ecore_win32_event_handle_enter_notify(data); | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | else | ||
335 | { | ||
336 | ERR("GetClientRect() failed"); | ||
337 | } | ||
338 | _ecore_win32_event_handle_motion_notify(data); | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | case WM_MOUSEWHEEL: | ||
343 | INF("mouse wheel message"); | ||
344 | _ecore_win32_event_handle_button_press(data, 4); | ||
345 | return 0; | ||
346 | /* Window notifications */ | ||
347 | case WM_CREATE: | ||
348 | INF("create window message"); | ||
349 | _ecore_win32_event_handle_create_notify(data); | ||
350 | return 0; | ||
351 | case WM_DESTROY: | ||
352 | INF("destroy window message"); | ||
353 | _ecore_win32_event_handle_destroy_notify(data); | ||
354 | return 0; | ||
355 | case WM_SHOWWINDOW: | ||
356 | INF("show window message"); | ||
357 | if ((data->data_param == SW_OTHERUNZOOM) || | ||
358 | (data->data_param == SW_OTHERZOOM)) | ||
359 | return 0; | ||
360 | |||
361 | if (data->window_param) | ||
362 | _ecore_win32_event_handle_map_notify(data); | ||
363 | else | ||
364 | _ecore_win32_event_handle_unmap_notify(data); | ||
365 | |||
366 | return 0; | ||
367 | case WM_CLOSE: | ||
368 | INF("close window message"); | ||
369 | _ecore_win32_event_handle_delete_request(data); | ||
370 | return 0; | ||
371 | case WM_GETMINMAXINFO: | ||
372 | INF("get min max info window message"); | ||
373 | return TRUE; | ||
374 | case WM_MOVING: | ||
375 | INF("moving window message"); | ||
376 | _ecore_win32_event_handle_configure_notify(data); | ||
377 | return TRUE; | ||
378 | case WM_MOVE: | ||
379 | INF("move window message"); | ||
380 | return 0; | ||
381 | case WM_SIZING: | ||
382 | INF("sizing window message"); | ||
383 | _ecore_win32_event_handle_resize(data); | ||
384 | _ecore_win32_event_handle_configure_notify(data); | ||
385 | return TRUE; | ||
386 | case WM_SIZE: | ||
387 | INF("size window message"); | ||
388 | return 0; | ||
389 | /* case WM_WINDOWPOSCHANGING: */ | ||
390 | /* { */ | ||
391 | /* RECT rect; */ | ||
392 | /* GetClientRect(window, &rect); */ | ||
393 | /* printf (" *** ecore message : WINDOWPOSCHANGING %ld %ld\n", */ | ||
394 | /* rect.right - rect.left, rect.bottom - rect.top); */ | ||
395 | /* } */ | ||
396 | /* _ecore_win32_event_handle_configure_notify(data); */ | ||
397 | /* return 0; */ | ||
398 | case WM_WINDOWPOSCHANGED: | ||
399 | INF("position changed window message"); | ||
400 | _ecore_win32_event_handle_configure_notify(data); | ||
401 | _ecore_win32_event_handle_expose(data); | ||
402 | return 0; | ||
403 | case WM_ENTERSIZEMOVE: | ||
404 | INF("enter size move window message"); | ||
405 | return 0; | ||
406 | case WM_EXITSIZEMOVE: | ||
407 | INF("exit size move window message"); | ||
408 | return 0; | ||
409 | case WM_NCLBUTTONDOWN: | ||
410 | INF("non client left button down window message"); | ||
411 | |||
412 | if (((DWORD)window_param == HTCAPTION) || | ||
413 | ((DWORD)window_param == HTBOTTOM) || | ||
414 | ((DWORD)window_param == HTBOTTOMLEFT) || | ||
415 | ((DWORD)window_param == HTBOTTOMRIGHT) || | ||
416 | ((DWORD)window_param == HTLEFT) || | ||
417 | ((DWORD)window_param == HTRIGHT) || | ||
418 | ((DWORD)window_param == HTTOP) || | ||
419 | ((DWORD)window_param == HTTOPLEFT) || | ||
420 | ((DWORD)window_param == HTTOPRIGHT)) | ||
421 | { | ||
422 | Ecore_Win32_Window *w; | ||
423 | |||
424 | w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); | ||
425 | ecore_win32_window_geometry_get(w, | ||
426 | NULL, NULL, | ||
427 | &w->drag.w, &w->drag.h); | ||
428 | SetCapture(window); | ||
429 | w->drag.type = (DWORD)window_param; | ||
430 | w->drag.px = GET_X_LPARAM(data_param); | ||
431 | w->drag.py = GET_Y_LPARAM(data_param); | ||
432 | w->drag.dragging = 1; | ||
433 | return 0; | ||
434 | } | ||
435 | return DefWindowProc(window, message, window_param, data_param); | ||
436 | case WM_SYSCOMMAND: | ||
437 | INF("sys command window message %d", (int)window_param); | ||
438 | |||
439 | if ((((DWORD)window_param & 0xfff0) == SC_MOVE) || | ||
440 | (((DWORD)window_param & 0xfff0) == SC_SIZE)) | ||
441 | { | ||
442 | Ecore_Win32_Window *w; | ||
443 | |||
444 | INF("sys command MOVE or SIZE window message : %dx%d", GET_X_LPARAM(data_param), GET_Y_LPARAM(data_param)); | ||
445 | |||
446 | w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); | ||
447 | w->drag.dragging = 1; | ||
448 | return 0; | ||
449 | } | ||
450 | return DefWindowProc(window, message, window_param, data_param); | ||
451 | /* GDI notifications */ | ||
452 | case WM_ERASEBKGND: | ||
453 | return 1; | ||
454 | case WM_PAINT: | ||
455 | { | ||
456 | RECT rect; | ||
457 | |||
458 | INF("paint message"); | ||
459 | |||
460 | if (GetUpdateRect(window, &rect, FALSE)) | ||
461 | { | ||
462 | PAINTSTRUCT ps; | ||
463 | HDC hdc; | ||
464 | |||
465 | hdc = BeginPaint(window, &ps); | ||
466 | data->update = rect; | ||
467 | _ecore_win32_event_handle_expose(data); | ||
468 | EndPaint(window, &ps); | ||
469 | } | ||
470 | return 0; | ||
471 | } | ||
472 | case WM_SETREDRAW: | ||
473 | INF("set redraw message"); | ||
474 | return 0; | ||
475 | case WM_SYNCPAINT: | ||
476 | INF("sync paint message"); | ||
477 | return 0; | ||
478 | default: | ||
479 | return DefWindowProc(window, message, window_param, data_param); | ||
480 | } | ||
481 | } | ||
482 | |||
483 | /** | ||
484 | * @endcond | ||
485 | */ | ||
486 | |||
487 | |||
488 | /*============================================================================* | ||
489 | * Global * | ||
490 | *============================================================================*/ | ||
491 | |||
492 | |||
493 | HINSTANCE _ecore_win32_instance = NULL; | ||
494 | double _ecore_win32_double_click_time = 0.25; | ||
495 | long _ecore_win32_event_last_time = 0; | ||
496 | Ecore_Win32_Window *_ecore_win32_event_last_window = NULL; | ||
497 | int _ecore_win32_log_dom_global = -1; | ||
498 | |||
499 | int ECORE_WIN32_EVENT_MOUSE_IN = 0; | ||
500 | int ECORE_WIN32_EVENT_MOUSE_OUT = 0; | ||
501 | int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = 0; | ||
502 | int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = 0; | ||
503 | int ECORE_WIN32_EVENT_WINDOW_DAMAGE = 0; | ||
504 | int ECORE_WIN32_EVENT_WINDOW_CREATE = 0; | ||
505 | int ECORE_WIN32_EVENT_WINDOW_DESTROY = 0; | ||
506 | int ECORE_WIN32_EVENT_WINDOW_SHOW = 0; | ||
507 | int ECORE_WIN32_EVENT_WINDOW_HIDE = 0; | ||
508 | int ECORE_WIN32_EVENT_WINDOW_CONFIGURE = 0; | ||
509 | int ECORE_WIN32_EVENT_WINDOW_RESIZE = 0; | ||
510 | int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = 0; | ||
511 | |||
512 | /*============================================================================* | ||
513 | * API * | ||
514 | *============================================================================*/ | ||
515 | |||
516 | /** | ||
517 | * @addtogroup Ecore_Win32_Group Ecore_Win32 library | ||
518 | * | ||
519 | * Ecore_Win32 is a library that wraps Windows graphic functions | ||
520 | * and integrate them nicely into the Ecore main loop. | ||
521 | * | ||
522 | * @section Ecore_Win32_Sec_Init Initialisation / Shutdown | ||
523 | * | ||
524 | * To fill... | ||
525 | * | ||
526 | * @section Ecore_Win32_Sec_Icons How to set icons to an application | ||
527 | * | ||
528 | * It is possible to also sets the icon of the application easily: | ||
529 | * | ||
530 | * @li Create an icon with your favorite image creator. The Gimp is a | ||
531 | * good choice. Create several images of size 16, 32 and 48. You can | ||
532 | * also create images of size 24, 64, 128 and 256. Paste all of them | ||
533 | * in the image of size 16 as a layer. Save the image of size 16 with | ||
534 | * the name my_icon.ico. Put it where the source code of the | ||
535 | * application is located. | ||
536 | * @li Create my_icon_rc.rc file with your code editor and add in it: | ||
537 | * @code | ||
538 | * 101 ICON DISCARDABLE "my_icon.ico" | ||
539 | * @endcode | ||
540 | * @li With Visual Studio, put that file in the 'Resource file' part | ||
541 | * of the project. | ||
542 | * @li With MinGW, you have to compile it with windres: | ||
543 | * @code | ||
544 | * windres my_icon_rc.rc my_icon_rc.o | ||
545 | * @endcode | ||
546 | * and add my_icon_rc.o to the object files of the application. | ||
547 | * | ||
548 | * @note The value 101 must not be changed, it's the ID used | ||
549 | * internally by Ecore_Win32 to get the icons. | ||
550 | * | ||
551 | * @{ | ||
552 | */ | ||
553 | |||
554 | /** | ||
555 | * @brief Initialize the Ecore_Win32 library. | ||
556 | * | ||
557 | * @return 1 or greater on success, 0 on error. | ||
558 | * | ||
559 | * This function sets up the Windows graphic system. It returns 0 on | ||
560 | * failure, otherwise it returns the number of times it has already been | ||
561 | * called. | ||
562 | * | ||
563 | * When Ecore_Win32 is not used anymore, call ecore_win32_shutdown() | ||
564 | * to shut down the Ecore_Win32 library. | ||
565 | */ | ||
566 | EAPI int | ||
567 | ecore_win32_init() | ||
568 | { | ||
569 | WNDCLASSEX wc; | ||
570 | HICON icon; | ||
571 | HICON icon_sm; | ||
572 | |||
573 | if (++_ecore_win32_init_count != 1) | ||
574 | return _ecore_win32_init_count; | ||
575 | |||
576 | if (!eina_init()) | ||
577 | return --_ecore_win32_init_count; | ||
578 | |||
579 | _ecore_win32_log_dom_global = eina_log_domain_register | ||
580 | ("ecore_win32", ECORE_WIN32_DEFAULT_LOG_COLOR); | ||
581 | if (_ecore_win32_log_dom_global < 0) | ||
582 | { | ||
583 | EINA_LOG_ERR("Ecore_Win32: Could not register log domain"); | ||
584 | goto shutdown_eina; | ||
585 | } | ||
586 | |||
587 | if (!ecore_event_init()) | ||
588 | { | ||
589 | ERR("Ecore_Win32: Could not init ecore_event"); | ||
590 | goto unregister_log_domain; | ||
591 | } | ||
592 | |||
593 | _ecore_win32_instance = GetModuleHandle(NULL); | ||
594 | if (!_ecore_win32_instance) | ||
595 | { | ||
596 | ERR("GetModuleHandle() failed"); | ||
597 | goto shutdown_ecore_event; | ||
598 | } | ||
599 | |||
600 | icon = LoadImage(_ecore_win32_instance, | ||
601 | MAKEINTRESOURCE(IDI_ICON), | ||
602 | IMAGE_ICON, | ||
603 | GetSystemMetrics(SM_CXICON), | ||
604 | GetSystemMetrics(SM_CYICON), | ||
605 | LR_DEFAULTCOLOR); | ||
606 | icon_sm = LoadImage(_ecore_win32_instance, | ||
607 | MAKEINTRESOURCE(IDI_ICON), | ||
608 | IMAGE_ICON, | ||
609 | GetSystemMetrics(SM_CXSMICON), | ||
610 | GetSystemMetrics(SM_CYSMICON), | ||
611 | LR_DEFAULTCOLOR); | ||
612 | if (!icon) | ||
613 | icon = LoadIcon (NULL, IDI_APPLICATION); | ||
614 | if (!icon_sm) | ||
615 | icon_sm = LoadIcon (NULL, IDI_APPLICATION); | ||
616 | |||
617 | memset (&wc, 0, sizeof (WNDCLASSEX)); | ||
618 | wc.cbSize = sizeof (WNDCLASSEX); | ||
619 | wc.style = CS_HREDRAW | CS_VREDRAW; | ||
620 | wc.lpfnWndProc = _ecore_win32_window_procedure; | ||
621 | wc.cbClsExtra = 0; | ||
622 | wc.cbWndExtra = 0; | ||
623 | wc.hInstance = _ecore_win32_instance; | ||
624 | wc.hIcon = icon; | ||
625 | wc.hCursor = LoadCursor (NULL, IDC_ARROW); | ||
626 | wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE); | ||
627 | wc.lpszMenuName = NULL; | ||
628 | wc.lpszClassName = ECORE_WIN32_WINDOW_CLASS; | ||
629 | wc.hIconSm = icon_sm; | ||
630 | |||
631 | if(!RegisterClassEx(&wc)) | ||
632 | { | ||
633 | ERR("RegisterClass() failed"); | ||
634 | goto free_library; | ||
635 | } | ||
636 | |||
637 | if (!ecore_win32_dnd_init()) | ||
638 | { | ||
639 | ERR("ecore_win32_dnd_init() failed"); | ||
640 | goto unregister_class; | ||
641 | } | ||
642 | |||
643 | if (!ECORE_WIN32_EVENT_MOUSE_IN) | ||
644 | { | ||
645 | ECORE_WIN32_EVENT_MOUSE_IN = ecore_event_type_new(); | ||
646 | ECORE_WIN32_EVENT_MOUSE_OUT = ecore_event_type_new(); | ||
647 | ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); | ||
648 | ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); | ||
649 | ECORE_WIN32_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); | ||
650 | ECORE_WIN32_EVENT_WINDOW_CREATE = ecore_event_type_new(); | ||
651 | ECORE_WIN32_EVENT_WINDOW_DESTROY = ecore_event_type_new(); | ||
652 | ECORE_WIN32_EVENT_WINDOW_SHOW = ecore_event_type_new(); | ||
653 | ECORE_WIN32_EVENT_WINDOW_HIDE = ecore_event_type_new(); | ||
654 | ECORE_WIN32_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); | ||
655 | ECORE_WIN32_EVENT_WINDOW_RESIZE = ecore_event_type_new(); | ||
656 | ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); | ||
657 | } | ||
658 | |||
659 | return _ecore_win32_init_count; | ||
660 | |||
661 | unregister_class: | ||
662 | UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance); | ||
663 | free_library: | ||
664 | FreeLibrary(_ecore_win32_instance); | ||
665 | shutdown_ecore_event: | ||
666 | ecore_event_shutdown(); | ||
667 | unregister_log_domain: | ||
668 | eina_log_domain_unregister(_ecore_win32_log_dom_global); | ||
669 | shutdown_eina: | ||
670 | eina_shutdown(); | ||
671 | |||
672 | return --_ecore_win32_init_count; | ||
673 | } | ||
674 | |||
675 | /** | ||
676 | * @brief Shut down the Ecore_Win32 library. | ||
677 | * | ||
678 | * @return 0 when the library is completely shut down, 1 or | ||
679 | * greater otherwise. | ||
680 | * | ||
681 | * This function shuts down the Ecore_Win32 library. It returns 0 when it has | ||
682 | * been called the same number of times than ecore_win32_init(). In that case | ||
683 | * it shuts down all the Windows graphic system. | ||
684 | */ | ||
685 | EAPI int | ||
686 | ecore_win32_shutdown() | ||
687 | { | ||
688 | if (--_ecore_win32_init_count != 0) | ||
689 | return _ecore_win32_init_count; | ||
690 | |||
691 | ecore_win32_dnd_shutdown(); | ||
692 | |||
693 | if (!UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance)) | ||
694 | INF("UnregisterClass() failed"); | ||
695 | |||
696 | if (!FreeLibrary(_ecore_win32_instance)) | ||
697 | INF("FreeLibrary() failed"); | ||
698 | |||
699 | _ecore_win32_instance = NULL; | ||
700 | |||
701 | ecore_event_shutdown(); | ||
702 | eina_log_domain_unregister(_ecore_win32_log_dom_global); | ||
703 | _ecore_win32_log_dom_global = -1; | ||
704 | eina_shutdown(); | ||
705 | |||
706 | return _ecore_win32_init_count; | ||
707 | } | ||
708 | |||
709 | /** | ||
710 | * @brief Retrieve the depth of the screen. | ||
711 | * | ||
712 | * @return The depth of the screen. | ||
713 | * | ||
714 | * This function returns the depth of the screen. If an error occurs, | ||
715 | * it returns 0. | ||
716 | */ | ||
717 | EAPI int | ||
718 | ecore_win32_screen_depth_get() | ||
719 | { | ||
720 | HDC dc; | ||
721 | int depth; | ||
722 | |||
723 | INF("getting screen depth"); | ||
724 | |||
725 | dc = GetDC(NULL); | ||
726 | if (!dc) | ||
727 | { | ||
728 | ERR("GetDC() failed"); | ||
729 | return 0; | ||
730 | } | ||
731 | |||
732 | depth = GetDeviceCaps(dc, BITSPIXEL); | ||
733 | if (!ReleaseDC(NULL, dc)) | ||
734 | { | ||
735 | ERR("ReleaseDC() failed (device context not released)"); | ||
736 | } | ||
737 | |||
738 | return depth; | ||
739 | } | ||
740 | |||
741 | /** | ||
742 | * @brief Sets the timeout for a double and triple clicks to be flagged. | ||
743 | * | ||
744 | * @param t The time in seconds. | ||
745 | * | ||
746 | * This function sets the time @p t between clicks before the | ||
747 | * double_click flag is set in a button down event. If 3 clicks occur | ||
748 | * within double this time, the triple_click flag is also set. | ||
749 | */ | ||
750 | EAPI void | ||
751 | ecore_win32_double_click_time_set(double t) | ||
752 | { | ||
753 | if (t < 0.0) t = 0.0; | ||
754 | _ecore_win32_double_click_time = t; | ||
755 | } | ||
756 | |||
757 | /** | ||
758 | * @brief Retrieve the double and triple click flag timeout. | ||
759 | * | ||
760 | * @return The timeout for double clicks in seconds. | ||
761 | * | ||
762 | * This function returns the double clicks in seconds. If | ||
763 | * ecore_win32_double_click_time_set() has not been called, the | ||
764 | * default value is returned. See ecore_win32_double_click_time_set() | ||
765 | * for more informations. | ||
766 | */ | ||
767 | EAPI double | ||
768 | ecore_win32_double_click_time_get(void) | ||
769 | { | ||
770 | return _ecore_win32_double_click_time; | ||
771 | } | ||
772 | |||
773 | /** | ||
774 | * @brief Return the last event time. | ||
775 | * | ||
776 | * @return The last envent time. | ||
777 | * | ||
778 | * This function returns the last event time. | ||
779 | */ | ||
780 | EAPI long | ||
781 | ecore_win32_current_time_get(void) | ||
782 | { | ||
783 | return _ecore_win32_event_last_time; | ||
784 | } | ||
785 | |||
786 | /** | ||
787 | * @} | ||
788 | */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c new file mode 100644 index 0000000..9a5a7eb --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c | |||
@@ -0,0 +1,306 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #define WIN32_LEAN_AND_MEAN | ||
6 | #include <windows.h> | ||
7 | #undef WIN32_LEAN_AND_MEAN | ||
8 | |||
9 | #include <Eina.h> | ||
10 | |||
11 | #include "Ecore_Win32.h" | ||
12 | #include "ecore_win32_private.h" | ||
13 | |||
14 | /*============================================================================* | ||
15 | * Local * | ||
16 | *============================================================================*/ | ||
17 | |||
18 | |||
19 | /*============================================================================* | ||
20 | * Global * | ||
21 | *============================================================================*/ | ||
22 | |||
23 | |||
24 | /*============================================================================* | ||
25 | * API * | ||
26 | *============================================================================*/ | ||
27 | |||
28 | /** | ||
29 | * @addtogroup Ecore_Win32_Group Ecore_Win32 library | ||
30 | * | ||
31 | * @{ | ||
32 | */ | ||
33 | |||
34 | /** | ||
35 | * @brief Create a new cursor. | ||
36 | * | ||
37 | * @param pixels_and The array of bytes containing the bit values for | ||
38 | * the AND mask of the cursor. | ||
39 | * @param pixels_xor The array of bytes containing the bit values for | ||
40 | * the XOR mask of the cursor. | ||
41 | * @param width The width of the cursor. | ||
42 | * @param height The height of the cursor. | ||
43 | * @param hot_x The horizontal position of the cursor's hot spot. | ||
44 | * @param hot_y The vertical position of the cursor's hot spot. | ||
45 | * @return A newly user-defined cursor. | ||
46 | * | ||
47 | * This function creates a new cursor of size @p width and @p | ||
48 | * height. They must be valid size. To determine the valid size of a | ||
49 | * cursor, useecore_win32_cursor_size_get(). @p pixels_and is an array | ||
50 | * of bytes (unsigned char) containing the bits of the cursor that | ||
51 | * will be visible. @p pixels_xor is similar but will allow the cursor | ||
52 | * to have a shape. Here is the truth table for the masks: | ||
53 | * | ||
54 | * <table border=1> | ||
55 | * <tr><td>AND mask</td><td>XOR mask</td><td>Display</td></tr> | ||
56 | * <tr><td>0</td> <td>0</td> <td>Black</td></tr> | ||
57 | * <tr><td>0</td> <td>1</td> <td>White</td></tr> | ||
58 | * <tr><td>1</td> <td>0</td> <td>Screen</td></tr> | ||
59 | * <tr><td>1</td> <td>1</td> <td>Reverse screen</td></tr> | ||
60 | * </table> | ||
61 | * | ||
62 | * @p hot_x and @p hot_y are the position of the hot spot of the | ||
63 | * cursor. If @p pixels_and or @p pixels_xor are @c NULL, the function | ||
64 | * returns NULL. If @p width or @p height does not match the valid | ||
65 | * size of a cursor, the function returns @c NULL. On success, the | ||
66 | * function creates a user-defined cursor, otherwise it returns | ||
67 | * @c NULL. | ||
68 | * | ||
69 | * Once the cursor is not used anymore, use ecore_win32_cursor_free() | ||
70 | * to free the ressources. | ||
71 | * | ||
72 | * Example of use: | ||
73 | * | ||
74 | * @code | ||
75 | * unsigned char pixels_and[] ={ | ||
76 | * 0xFF, 0xFC, 0x3F, 0xFF, // line 1 | ||
77 | * 0xFF, 0xC0, 0x1F, 0xFF, // line 2 | ||
78 | * 0xFF, 0x00, 0x3F, 0xFF, // line 3 | ||
79 | * 0xFE, 0x00, 0xFF, 0xFF, // line 4 | ||
80 | * | ||
81 | * 0xF7, 0x01, 0xFF, 0xFF, // line 5 | ||
82 | * 0xF0, 0x03, 0xFF, 0xFF, // line 6 | ||
83 | * 0xF0, 0x03, 0xFF, 0xFF, // line 7 | ||
84 | * 0xE0, 0x07, 0xFF, 0xFF, // line 8 | ||
85 | * | ||
86 | * 0xC0, 0x07, 0xFF, 0xFF, // line 9 | ||
87 | * 0xC0, 0x0F, 0xFF, 0xFF, // line 10 | ||
88 | * 0x80, 0x0F, 0xFF, 0xFF, // line 11 | ||
89 | * 0x80, 0x0F, 0xFF, 0xFF, // line 12 | ||
90 | * | ||
91 | * 0x80, 0x07, 0xFF, 0xFF, // line 13 | ||
92 | * 0x00, 0x07, 0xFF, 0xFF, // line 14 | ||
93 | * 0x00, 0x03, 0xFF, 0xFF, // line 15 | ||
94 | * 0x00, 0x00, 0xFF, 0xFF, // line 16 | ||
95 | * | ||
96 | * 0x00, 0x00, 0x7F, 0xFF, // line 17 | ||
97 | * 0x00, 0x00, 0x1F, 0xFF, // line 18 | ||
98 | * 0x00, 0x00, 0x0F, 0xFF, // line 19 | ||
99 | * 0x80, 0x00, 0x0F, 0xFF, // line 20 | ||
100 | * | ||
101 | * 0x80, 0x00, 0x07, 0xFF, // line 21 | ||
102 | * 0x80, 0x00, 0x07, 0xFF, // line 22 | ||
103 | * 0xC0, 0x00, 0x07, 0xFF, // line 23 | ||
104 | * 0xC0, 0x00, 0x0F, 0xFF, // line 24 | ||
105 | * | ||
106 | * 0xE0, 0x00, 0x0F, 0xFF, // line 25 | ||
107 | * 0xF0, 0x00, 0x1F, 0xFF, // line 26 | ||
108 | * 0xF0, 0x00, 0x1F, 0xFF, // line 27 | ||
109 | * 0xF8, 0x00, 0x3F, 0xFF, // line 28 | ||
110 | * | ||
111 | * 0xFE, 0x00, 0x7F, 0xFF, // line 29 | ||
112 | * 0xFF, 0x00, 0xFF, 0xFF, // line 30 | ||
113 | * 0xFF, 0xC3, 0xFF, 0xFF, // line 31 | ||
114 | * 0xFF, 0xFF, 0xFF, 0xFF // line 32 | ||
115 | * }; | ||
116 | * | ||
117 | * unsigned char pixels_xor[] = | ||
118 | * { | ||
119 | * 0x00, 0x00, 0x00, 0x00, // line 1 | ||
120 | * 0x00, 0x03, 0xC0, 0x00, // line 2 | ||
121 | * 0x00, 0x3F, 0x00, 0x00, // line 3 | ||
122 | * 0x00, 0xFE, 0x00, 0x00, // line 4 | ||
123 | * | ||
124 | * 0x0E, 0xFC, 0x00, 0x00, // line 5 | ||
125 | * 0x07, 0xF8, 0x00, 0x00, // line 6 | ||
126 | * 0x07, 0xF8, 0x00, 0x00, // line 7 | ||
127 | * 0x0F, 0xF0, 0x00, 0x00, // line 8 | ||
128 | * | ||
129 | * 0x1F, 0xF0, 0x00, 0x00, // line 9 | ||
130 | * 0x1F, 0xE0, 0x00, 0x00, // line 10 | ||
131 | * 0x3F, 0xE0, 0x00, 0x00, // line 11 | ||
132 | * 0x3F, 0xE0, 0x00, 0x00, // line 12 | ||
133 | * | ||
134 | * 0x3F, 0xF0, 0x00, 0x00, // line 13 | ||
135 | * 0x7F, 0xF0, 0x00, 0x00, // line 14 | ||
136 | * 0x7F, 0xF8, 0x00, 0x00, // line 15 | ||
137 | * 0x7F, 0xFC, 0x00, 0x00, // line 16 | ||
138 | * | ||
139 | * 0x7F, 0xFF, 0x00, 0x00, // line 17 | ||
140 | * 0x7F, 0xFF, 0x80, 0x00, // line 18 | ||
141 | * 0x7F, 0xFF, 0xE0, 0x00, // line 19 | ||
142 | * 0x3F, 0xFF, 0xE0, 0x00, // line 20 | ||
143 | * | ||
144 | * 0x3F, 0xC7, 0xF0, 0x00, // line 21 | ||
145 | * 0x3F, 0x83, 0xF0, 0x00, // line 22 | ||
146 | * 0x1F, 0x83, 0xF0, 0x00, // line 23 | ||
147 | * 0x1F, 0x83, 0xE0, 0x00, // line 24 | ||
148 | * | ||
149 | * 0x0F, 0xC7, 0xE0, 0x00, // line 25 | ||
150 | * 0x07, 0xFF, 0xC0, 0x00, // line 26 | ||
151 | * 0x07, 0xFF, 0xC0, 0x00, // line 27 | ||
152 | * 0x01, 0xFF, 0x80, 0x00, // line 28 | ||
153 | * | ||
154 | * 0x00, 0xFF, 0x00, 0x00, // line 29 | ||
155 | * 0x00, 0x3C, 0x00, 0x00, // line 30 | ||
156 | * 0x00, 0x00, 0x00, 0x00, // line 31 | ||
157 | * 0x00, 0x00, 0x00, 0x00 // line 32 | ||
158 | * }; | ||
159 | * | ||
160 | * Ecore_Win32_Cursor cursor = ecore_win32_cursor_new(pixels_and, pixels_xor, 32, 32, 19, 2); | ||
161 | * @endcode | ||
162 | */ | ||
163 | EAPI Ecore_Win32_Cursor * | ||
164 | ecore_win32_cursor_new(const void *pixels_and, | ||
165 | const void *pixels_xor, | ||
166 | int width, | ||
167 | int height, | ||
168 | int hot_x, | ||
169 | int hot_y) | ||
170 | { | ||
171 | Ecore_Win32_Cursor *cursor = NULL; | ||
172 | int cursor_width; | ||
173 | int cursor_height; | ||
174 | |||
175 | INF("creating cursor"); | ||
176 | |||
177 | if (!pixels_and || !pixels_xor) | ||
178 | return NULL; | ||
179 | |||
180 | cursor_width = GetSystemMetrics(SM_CXCURSOR); | ||
181 | cursor_height = GetSystemMetrics(SM_CYCURSOR); | ||
182 | |||
183 | if ((cursor_width != width) || | ||
184 | (cursor_height != height)) | ||
185 | return NULL; | ||
186 | |||
187 | if (!(cursor = CreateCursor(_ecore_win32_instance, | ||
188 | hot_x, hot_y, | ||
189 | width, height, | ||
190 | pixels_and, | ||
191 | pixels_xor))) | ||
192 | return NULL; | ||
193 | |||
194 | return cursor; | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * @brief Free the given cursor. | ||
199 | * | ||
200 | * @param cursor The cursor to free. | ||
201 | * | ||
202 | * This function free @p cursor. @p cursor must have been obtained | ||
203 | * with ecore_win32_cursor_new(). | ||
204 | */ | ||
205 | EAPI void | ||
206 | ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor) | ||
207 | { | ||
208 | INF("destroying cursor"); | ||
209 | |||
210 | DestroyCursor(cursor); | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * @brief Create a cursor from a Windows ressource. | ||
215 | * | ||
216 | * @param shape The pre-defined shape of the cursor. | ||
217 | * @return The new cursor. | ||
218 | * | ||
219 | * This function returns a pre-defined cursor with a specified | ||
220 | * @p shape. This cursor does not need to be freed, as it is loaded | ||
221 | * from an existing resource. | ||
222 | */ | ||
223 | EAPI Ecore_Win32_Cursor * | ||
224 | ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape) | ||
225 | { | ||
226 | Ecore_Win32_Cursor *cursor = NULL; | ||
227 | const char *cursor_name; | ||
228 | |||
229 | INF("geting shape cursor"); | ||
230 | |||
231 | switch (shape) | ||
232 | { | ||
233 | case ECORE_WIN32_CURSOR_SHAPE_APP_STARTING: | ||
234 | cursor_name = IDC_APPSTARTING; | ||
235 | break; | ||
236 | case ECORE_WIN32_CURSOR_SHAPE_ARROW: | ||
237 | cursor_name = IDC_ARROW; | ||
238 | break; | ||
239 | case ECORE_WIN32_CURSOR_SHAPE_CROSS: | ||
240 | cursor_name = IDC_CROSS; | ||
241 | break; | ||
242 | case ECORE_WIN32_CURSOR_SHAPE_HAND: | ||
243 | cursor_name = IDC_HAND; | ||
244 | break; | ||
245 | case ECORE_WIN32_CURSOR_SHAPE_HELP: | ||
246 | cursor_name = IDC_HELP; | ||
247 | break; | ||
248 | case ECORE_WIN32_CURSOR_SHAPE_I_BEAM: | ||
249 | cursor_name = IDC_IBEAM; | ||
250 | break; | ||
251 | case ECORE_WIN32_CURSOR_SHAPE_NO: | ||
252 | cursor_name = IDC_NO; | ||
253 | break; | ||
254 | case ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL: | ||
255 | cursor_name = IDC_SIZEALL; | ||
256 | break; | ||
257 | case ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW: | ||
258 | cursor_name = IDC_SIZENESW; | ||
259 | break; | ||
260 | case ECORE_WIN32_CURSOR_SHAPE_SIZE_NS: | ||
261 | cursor_name = IDC_SIZENS; | ||
262 | break; | ||
263 | case ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE: | ||
264 | cursor_name = IDC_SIZENWSE; | ||
265 | break; | ||
266 | case ECORE_WIN32_CURSOR_SHAPE_SIZE_WE: | ||
267 | cursor_name = IDC_SIZEWE; | ||
268 | break; | ||
269 | case ECORE_WIN32_CURSOR_SHAPE_UP_ARROW: | ||
270 | cursor_name = IDC_UPARROW; | ||
271 | break; | ||
272 | case ECORE_WIN32_CURSOR_SHAPE_WAIT: | ||
273 | cursor_name = IDC_WAIT; | ||
274 | break; | ||
275 | default: | ||
276 | return NULL; | ||
277 | } | ||
278 | |||
279 | if (!(cursor = LoadCursor(NULL, cursor_name))) | ||
280 | return NULL; | ||
281 | |||
282 | return cursor; | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * @brief Retrieve the size of a valid cursor. | ||
287 | * | ||
288 | * @param width The width of a valid cursor. | ||
289 | * @param height The height of a valid cursor. | ||
290 | * | ||
291 | * This function returns the size of a cursor that must be passed to | ||
292 | * ecore_win32_cursor_new(). @p width and @p height are buffers that | ||
293 | * will be filled with the correct size. They can be @c NULL. | ||
294 | */ | ||
295 | EAPI void | ||
296 | ecore_win32_cursor_size_get(int *width, int *height) | ||
297 | { | ||
298 | INF("geting size cursor"); | ||
299 | |||
300 | if (*width) *width = GetSystemMetrics(SM_CXCURSOR); | ||
301 | if (*height) *height = GetSystemMetrics(SM_CYCURSOR); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * @} | ||
306 | */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c new file mode 100755 index 0000000..a629c8b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c | |||
@@ -0,0 +1,221 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <windows.h> | ||
6 | |||
7 | #include "Ecore_Win32.h" | ||
8 | #include "ecore_win32_private.h" | ||
9 | |||
10 | /*============================================================================* | ||
11 | * Local * | ||
12 | *============================================================================*/ | ||
13 | |||
14 | /** | ||
15 | * @cond LOCAL | ||
16 | */ | ||
17 | |||
18 | |||
19 | static int _ecore_win32_dnd_init_count = 0; | ||
20 | |||
21 | static HANDLE DataToHandle(const char *data, int size) | ||
22 | { | ||
23 | char *ptr; | ||
24 | ptr = (char *)GlobalAlloc(GMEM_FIXED, size); | ||
25 | memcpy(ptr, data, size); | ||
26 | return ptr; | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * @endcond | ||
31 | */ | ||
32 | |||
33 | |||
34 | /*============================================================================* | ||
35 | * Global * | ||
36 | *============================================================================*/ | ||
37 | |||
38 | |||
39 | /*============================================================================* | ||
40 | * API * | ||
41 | *============================================================================*/ | ||
42 | |||
43 | /** | ||
44 | * @addtogroup Ecore_Win32_Group Ecore_Win32 library | ||
45 | * | ||
46 | * @{ | ||
47 | */ | ||
48 | |||
49 | /** | ||
50 | * @brief Initialize the Ecore_Win32 Drag and Drop module. | ||
51 | * | ||
52 | * @return 1 or greater on success, 0 on error. | ||
53 | * | ||
54 | * This function initialize the Drag and Drop module. It returns 0 on | ||
55 | * failure, otherwise it returns the number of times it has already | ||
56 | * been called. | ||
57 | * | ||
58 | * When the Drag and Drop module is not used anymore, call | ||
59 | * ecore_win32_dnd_shutdown() to shut down the module. | ||
60 | */ | ||
61 | EAPI int | ||
62 | ecore_win32_dnd_init() | ||
63 | { | ||
64 | if (_ecore_win32_dnd_init_count > 0) | ||
65 | { | ||
66 | _ecore_win32_dnd_init_count++; | ||
67 | return _ecore_win32_dnd_init_count; | ||
68 | } | ||
69 | |||
70 | if (OleInitialize(NULL) != S_OK) | ||
71 | return 0; | ||
72 | |||
73 | _ecore_win32_dnd_init_count++; | ||
74 | |||
75 | return _ecore_win32_dnd_init_count; | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * @brief Shut down the Ecore_Win32 Drag and Drop module. | ||
80 | * | ||
81 | * @return 0 when the module is completely shut down, 1 or | ||
82 | * greater otherwise. | ||
83 | * | ||
84 | * This function shuts down the Drag and Drop module. It returns 0 when it has | ||
85 | * been called the same number of times than ecore_win32_dnd_init(). In that case | ||
86 | * it shut down the module. | ||
87 | */ | ||
88 | EAPI int | ||
89 | ecore_win32_dnd_shutdown() | ||
90 | { | ||
91 | _ecore_win32_dnd_init_count--; | ||
92 | if (_ecore_win32_dnd_init_count > 0) return _ecore_win32_dnd_init_count; | ||
93 | |||
94 | OleUninitialize(); | ||
95 | |||
96 | if (_ecore_win32_dnd_init_count < 0) _ecore_win32_dnd_init_count = 0; | ||
97 | |||
98 | return _ecore_win32_dnd_init_count; | ||
99 | } | ||
100 | |||
101 | /** | ||
102 | * @brief Begin a DnD operation. | ||
103 | * | ||
104 | * @param data The name pf the Drag operation. | ||
105 | * @param size The size of the name. | ||
106 | * @return EINA_TRUE on success, EINA_FALSE otherwise. | ||
107 | * | ||
108 | * This function start a Drag operation with the name @p data. If | ||
109 | * @p data is @c NULL, EINA_FALSE is returned. if @p size is less than | ||
110 | * 0, it is set to the length (as strlen()) of @p data. On success the | ||
111 | * function returns EINA_TRUE, otherwise it returns EINA_FALSE. | ||
112 | */ | ||
113 | EAPI Eina_Bool | ||
114 | ecore_win32_dnd_begin(const char *data, | ||
115 | int size) | ||
116 | { | ||
117 | IDataObject *pDataObject = NULL; | ||
118 | IDropSource *pDropSource = NULL; | ||
119 | FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | ||
120 | STGMEDIUM stgmed = { TYMED_HGLOBAL, { 0 }, 0 }; | ||
121 | Eina_Bool res = EINA_FALSE; | ||
122 | |||
123 | if (!data) | ||
124 | return EINA_FALSE; | ||
125 | |||
126 | if (size < 0) | ||
127 | size = strlen(data) + 1; | ||
128 | |||
129 | stgmed.hGlobal = DataToHandle(data, size); | ||
130 | |||
131 | // create the data object | ||
132 | pDataObject = (IDataObject *)_ecore_win32_dnd_data_object_new((void *)&fmtetc, | ||
133 | (void *)&stgmed, | ||
134 | 1); | ||
135 | pDropSource = (IDropSource *)_ecore_win32_dnd_drop_source_new(); | ||
136 | |||
137 | if (pDataObject && pDropSource) | ||
138 | { | ||
139 | DWORD dwResult; | ||
140 | DWORD dwEffect = DROPEFFECT_COPY; | ||
141 | |||
142 | // do the drag-drop! | ||
143 | dwResult = DoDragDrop(pDataObject, pDropSource, DROPEFFECT_COPY, &dwEffect); | ||
144 | |||
145 | // finished. Check the return values to see if we need to do anything else | ||
146 | if (dwResult == DRAGDROP_S_DROP) | ||
147 | { | ||
148 | //printf(">>> \"%s\" Dropped <<<\n", str); | ||
149 | if(dwEffect == DROPEFFECT_MOVE) | ||
150 | { | ||
151 | // remove the data we just dropped from active document | ||
152 | } | ||
153 | } | ||
154 | //else if (dwResult == DRAGDROP_S_CANCEL) | ||
155 | // printf("DND cancelled\n"); | ||
156 | //else | ||
157 | // printf("DND error\n"); | ||
158 | |||
159 | res = EINA_TRUE; | ||
160 | } | ||
161 | |||
162 | _ecore_win32_dnd_data_object_free(pDataObject); | ||
163 | _ecore_win32_dnd_drop_source_free(pDropSource); | ||
164 | |||
165 | // cleanup | ||
166 | ReleaseStgMedium(&stgmed); | ||
167 | |||
168 | return res; | ||
169 | } | ||
170 | |||
171 | /** | ||
172 | * @brief Register a Drop operation. | ||
173 | * | ||
174 | * @param window The destination of the Drop operation. | ||
175 | * @param callback The callback called when the Drop operation | ||
176 | * finishes. | ||
177 | * @return EINA_TRUE on success, EINA_FALSE otherwise. | ||
178 | * | ||
179 | * This function register a Drop operation on @p window. Once the Drop | ||
180 | * operation finishes, @p callback is called. If @p window is @c NULL, | ||
181 | * the function returns EINA_FALSE. On success, it returns EINA_TRUE, | ||
182 | * otherwise it returns EINA_FALSE. | ||
183 | */ | ||
184 | EAPI Eina_Bool | ||
185 | ecore_win32_dnd_register_drop_target(Ecore_Win32_Window *window, | ||
186 | Ecore_Win32_Dnd_DropTarget_Callback callback) | ||
187 | { | ||
188 | Ecore_Win32_Window *wnd = (Ecore_Win32_Window *)window; | ||
189 | |||
190 | if (!window) | ||
191 | return EINA_FALSE; | ||
192 | |||
193 | wnd->dnd_drop_target = _ecore_win32_dnd_register_drop_window(wnd->window, | ||
194 | callback, | ||
195 | (void *)wnd); | ||
196 | return wnd->dnd_drop_target ? EINA_TRUE : EINA_FALSE; | ||
197 | } | ||
198 | |||
199 | /** | ||
200 | * @brief Unregister a Drop operation. | ||
201 | * | ||
202 | * @param window The destination of the Drop operation. | ||
203 | * | ||
204 | * This function unregister a Drop operation on @p window. If | ||
205 | * @p window is @c NULL, the function does nothing. | ||
206 | */ | ||
207 | EAPI void | ||
208 | ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window) | ||
209 | { | ||
210 | Ecore_Win32_Window *wnd = (Ecore_Win32_Window *)window; | ||
211 | |||
212 | if (!window) | ||
213 | return; | ||
214 | |||
215 | if (wnd->dnd_drop_target) | ||
216 | _ecore_win32_dnd_unregister_drop_window(wnd->window, wnd->dnd_drop_target); | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * @} | ||
221 | */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp new file mode 100644 index 0000000..75e26f5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 | ||
3 | */ | ||
4 | |||
5 | #ifdef HAVE_CONFIG_H | ||
6 | # include <config.h> | ||
7 | #endif | ||
8 | |||
9 | #include <assert.h> | ||
10 | |||
11 | #define WIN32_LEAN_AND_MEAN | ||
12 | #include <windows.h> | ||
13 | #undef WIN32_LEAN_AND_MEAN | ||
14 | #include <ole2.h> | ||
15 | |||
16 | #include "Ecore_Win32.h" | ||
17 | #include "ecore_win32_private.h" | ||
18 | |||
19 | #include "ecore_win32_dnd_enumformatetc.h" | ||
20 | #include "ecore_win32_dnd_data_object.h" | ||
21 | |||
22 | |||
23 | static HGLOBAL DupGlobalMem(HGLOBAL hMem) | ||
24 | { | ||
25 | DWORD len = (DWORD)GlobalSize(hMem); | ||
26 | PVOID source = GlobalLock(hMem); | ||
27 | PVOID dest = GlobalAlloc(GMEM_FIXED, len); | ||
28 | memcpy(dest, source, len); | ||
29 | GlobalUnlock(hMem); | ||
30 | return dest; | ||
31 | } | ||
32 | |||
33 | // structors | ||
34 | |||
35 | DataObject::DataObject(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count) | ||
36 | { | ||
37 | assert(fmtetc != NULL); | ||
38 | assert(stgmed != NULL); | ||
39 | assert(count > 0); | ||
40 | |||
41 | // reference count must ALWAYS start at 1 | ||
42 | ref_count_ = 1; | ||
43 | formats_num_ = count; | ||
44 | |||
45 | format_etc_ = new FORMATETC[count]; | ||
46 | stg_medium_ = new STGMEDIUM[count]; | ||
47 | |||
48 | for(int i = 0; i < count; i++) | ||
49 | { | ||
50 | format_etc_[i] = fmtetc[i]; | ||
51 | stg_medium_[i] = stgmed[i]; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | DataObject::~DataObject() | ||
56 | { | ||
57 | delete[] format_etc_; | ||
58 | delete[] stg_medium_; | ||
59 | } | ||
60 | |||
61 | |||
62 | // IUnknown | ||
63 | |||
64 | HRESULT DataObject::QueryInterface(REFIID iid, void **ppvObject) | ||
65 | { | ||
66 | // check to see what interface has been requested | ||
67 | if ((iid == IID_IDataObject) || (iid == IID_IUnknown)) | ||
68 | { | ||
69 | AddRef(); | ||
70 | *ppvObject = this; | ||
71 | return S_OK; | ||
72 | } | ||
73 | *ppvObject = 0; | ||
74 | return E_NOINTERFACE; | ||
75 | } | ||
76 | |||
77 | ULONG DataObject::AddRef() | ||
78 | { | ||
79 | return InterlockedIncrement(&ref_count_); | ||
80 | } | ||
81 | |||
82 | ULONG DataObject::Release() | ||
83 | { | ||
84 | LONG count = InterlockedDecrement(&ref_count_); | ||
85 | if(count == 0) | ||
86 | { | ||
87 | delete this; | ||
88 | return 0; | ||
89 | } | ||
90 | return count; | ||
91 | } | ||
92 | |||
93 | // IDataObject | ||
94 | |||
95 | HRESULT DataObject::GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium) | ||
96 | { | ||
97 | assert(pMedium != NULL); | ||
98 | int idx; | ||
99 | |||
100 | // try to match the specified FORMATETC with one of our supported formats | ||
101 | if((idx = lookup_format_etc(pFormatEtc)) == -1) | ||
102 | return DV_E_FORMATETC; | ||
103 | |||
104 | // found a match - transfer data into supplied storage medium | ||
105 | pMedium->tymed = format_etc_[idx].tymed; | ||
106 | pMedium->pUnkForRelease = 0; | ||
107 | |||
108 | // copy the data into the caller's storage medium | ||
109 | switch(format_etc_[idx].tymed) | ||
110 | { | ||
111 | case TYMED_HGLOBAL: | ||
112 | pMedium->hGlobal = DupGlobalMem(stg_medium_[idx].hGlobal); | ||
113 | break; | ||
114 | |||
115 | default: | ||
116 | return DV_E_FORMATETC; | ||
117 | } | ||
118 | |||
119 | return S_OK; | ||
120 | } | ||
121 | |||
122 | HRESULT DataObject::GetDataHere(FORMATETC *pFormatEtc __UNUSED__, STGMEDIUM *pmedium __UNUSED__) | ||
123 | { | ||
124 | return DATA_E_FORMATETC; | ||
125 | } | ||
126 | |||
127 | HRESULT DataObject::QueryGetData(FORMATETC *pFormatEtc) | ||
128 | { | ||
129 | return (lookup_format_etc(pFormatEtc) == -1) ? DV_E_FORMATETC : S_OK; | ||
130 | } | ||
131 | |||
132 | HRESULT DataObject::GetCanonicalFormatEtc(FORMATETC *pFormatEct __UNUSED__, FORMATETC *pFormatEtcOut) | ||
133 | { | ||
134 | // Apparently we have to set this field to NULL even though we don't do anything else | ||
135 | pFormatEtcOut->ptd = NULL; | ||
136 | return E_NOTIMPL; | ||
137 | } | ||
138 | |||
139 | HRESULT DataObject::SetData(FORMATETC *pFormatEtc __UNUSED__, STGMEDIUM *pMedium __UNUSED__, BOOL fRelease __UNUSED__) | ||
140 | { | ||
141 | return E_NOTIMPL; | ||
142 | } | ||
143 | |||
144 | HRESULT DataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc) | ||
145 | { | ||
146 | // only the get direction is supported for OLE | ||
147 | if(dwDirection == DATADIR_GET) | ||
148 | { | ||
149 | // for Win2k+ you can use the SHCreateStdEnumFmtEtc API call, however | ||
150 | // to support all Windows platforms we need to implement IEnumFormatEtc ourselves. | ||
151 | return CreateEnumFormatEtc(formats_num_, format_etc_, ppEnumFormatEtc); | ||
152 | } | ||
153 | else | ||
154 | { | ||
155 | // the direction specified is not supported for drag+drop | ||
156 | return E_NOTIMPL; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | HRESULT DataObject::DAdvise(FORMATETC *pFormatEtc __UNUSED__, DWORD advf __UNUSED__, IAdviseSink *, DWORD *) | ||
161 | { | ||
162 | return OLE_E_ADVISENOTSUPPORTED; | ||
163 | } | ||
164 | |||
165 | HRESULT DataObject::DUnadvise(DWORD dwConnection __UNUSED__) | ||
166 | { | ||
167 | return OLE_E_ADVISENOTSUPPORTED; | ||
168 | } | ||
169 | |||
170 | HRESULT DataObject::EnumDAdvise(IEnumSTATDATA **ppEnumAdvise __UNUSED__) | ||
171 | { | ||
172 | return OLE_E_ADVISENOTSUPPORTED; | ||
173 | } | ||
174 | |||
175 | // internal helper function | ||
176 | |||
177 | int DataObject::lookup_format_etc(FORMATETC *pFormatEtc) | ||
178 | { | ||
179 | // check each of our formats in turn to see if one matches | ||
180 | for(int i = 0; i < formats_num_; i++) | ||
181 | { | ||
182 | if((format_etc_[i].tymed & pFormatEtc->tymed) && | ||
183 | (format_etc_[i].cfFormat == pFormatEtc->cfFormat) && | ||
184 | (format_etc_[i].dwAspect == pFormatEtc->dwAspect)) | ||
185 | { | ||
186 | // return index of stored format | ||
187 | return i; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | // error, format not found | ||
192 | return -1; | ||
193 | } | ||
194 | |||
195 | void *_ecore_win32_dnd_data_object_new(void *fmtetc, void *stgmeds, int count) | ||
196 | { | ||
197 | IDataObject *object = new DataObject((FORMATETC *)fmtetc, (STGMEDIUM *)stgmeds, (UINT)count); | ||
198 | assert(object != NULL); | ||
199 | return object; | ||
200 | } | ||
201 | |||
202 | void _ecore_win32_dnd_data_object_free(void *data_object) | ||
203 | { | ||
204 | if (!data_object) | ||
205 | return; | ||
206 | |||
207 | IDataObject *object = (IDataObject *)data_object; | ||
208 | object->Release(); | ||
209 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h new file mode 100644 index 0000000..3d289cf --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef __ECORE_WIN32_DND_DATA_OBJECT_H__ | ||
2 | #define __ECORE_WIN32_DND_DATA_OBJECT_H__ | ||
3 | |||
4 | |||
5 | #define WIN32_LEAN_AND_MEAN | ||
6 | #include <windows.h> | ||
7 | #undef WIN32_LEAN_AND_MEAN | ||
8 | #include <objbase.h> | ||
9 | |||
10 | |||
11 | class DataObject : public IDataObject | ||
12 | { | ||
13 | private: | ||
14 | |||
15 | LONG ref_count_; | ||
16 | int formats_num_; | ||
17 | FORMATETC *format_etc_; | ||
18 | STGMEDIUM *stg_medium_; | ||
19 | |||
20 | private: // internal helper function | ||
21 | |||
22 | int lookup_format_etc(FORMATETC *format_etc); | ||
23 | |||
24 | public: // structors | ||
25 | |||
26 | DataObject(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count); | ||
27 | ~DataObject(); | ||
28 | |||
29 | public: // IUnknown | ||
30 | |||
31 | HRESULT __stdcall QueryInterface(REFIID iid, void **ppvObject); | ||
32 | ULONG __stdcall AddRef(); | ||
33 | ULONG __stdcall Release(); | ||
34 | |||
35 | public: // IDataObject | ||
36 | |||
37 | HRESULT __stdcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); | ||
38 | HRESULT __stdcall GetDataHere(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); | ||
39 | HRESULT __stdcall QueryGetData(FORMATETC *pFormatEtc); | ||
40 | HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut); | ||
41 | HRESULT __stdcall SetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease); | ||
42 | HRESULT __stdcall EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc); | ||
43 | HRESULT __stdcall DAdvise(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *, DWORD *); | ||
44 | HRESULT __stdcall DUnadvise(DWORD dwConnection); | ||
45 | HRESULT __stdcall EnumDAdvise(IEnumSTATDATA **ppEnumAdvise); | ||
46 | }; | ||
47 | |||
48 | |||
49 | #endif /* __ECORE_WIN32_DND_DATA_OBJECT_H__ */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp new file mode 100644 index 0000000..bea7736 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 | ||
3 | */ | ||
4 | |||
5 | #ifdef HAVE_CONFIG_H | ||
6 | # include <config.h> | ||
7 | #endif | ||
8 | |||
9 | #include <assert.h> | ||
10 | |||
11 | #include "ecore_win32_dnd_drop_source.h" | ||
12 | |||
13 | #include "ecore_win32_private.h" | ||
14 | |||
15 | // structors | ||
16 | |||
17 | // reference count must ALWAYS start at 1 | ||
18 | DropSource::DropSource() : ref_count_(1) | ||
19 | { } | ||
20 | |||
21 | |||
22 | // IUnknown | ||
23 | |||
24 | HRESULT DropSource::QueryInterface(REFIID iid, void **ppvObject) | ||
25 | { | ||
26 | // check to see what interface has been requested | ||
27 | if (iid == IID_IDropSource || iid == IID_IUnknown) | ||
28 | { | ||
29 | AddRef(); | ||
30 | *ppvObject = this; | ||
31 | return S_OK; | ||
32 | } | ||
33 | *ppvObject = 0; | ||
34 | return E_NOINTERFACE; | ||
35 | } | ||
36 | |||
37 | ULONG DropSource::AddRef() | ||
38 | { | ||
39 | return InterlockedIncrement(&ref_count_); | ||
40 | } | ||
41 | |||
42 | ULONG DropSource::Release() | ||
43 | { | ||
44 | LONG count = InterlockedDecrement(&ref_count_); | ||
45 | if(count == 0) | ||
46 | { | ||
47 | delete this; | ||
48 | return 0; | ||
49 | } | ||
50 | return count; | ||
51 | } | ||
52 | |||
53 | |||
54 | // IDropSource | ||
55 | |||
56 | HRESULT DropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) | ||
57 | { | ||
58 | // if the Escape key has been pressed since the last call, cancel the drop | ||
59 | if(fEscapePressed == TRUE) | ||
60 | return DRAGDROP_S_CANCEL; | ||
61 | |||
62 | // if the LeftMouse button has been released, then do the drop! | ||
63 | if((grfKeyState & MK_LBUTTON) == 0) | ||
64 | return DRAGDROP_S_DROP; | ||
65 | |||
66 | // continue with the drag-drop | ||
67 | return S_OK; | ||
68 | } | ||
69 | |||
70 | HRESULT DropSource::GiveFeedback(DWORD dwEffect __UNUSED__) | ||
71 | { | ||
72 | return DRAGDROP_S_USEDEFAULTCURSORS; | ||
73 | } | ||
74 | |||
75 | |||
76 | // ecore_win32 private functions | ||
77 | |||
78 | void *_ecore_win32_dnd_drop_source_new() | ||
79 | { | ||
80 | IDropSource *object = new DropSource(); | ||
81 | assert(object != NULL); | ||
82 | return object; | ||
83 | } | ||
84 | |||
85 | void _ecore_win32_dnd_drop_source_free(void *drop_source) | ||
86 | { | ||
87 | if (!drop_source) | ||
88 | return; | ||
89 | |||
90 | IDropSource *object = (IDropSource *)drop_source; | ||
91 | object->Release(); | ||
92 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h new file mode 100644 index 0000000..9081f46 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef __ECORE_WIN32_DND_DROP_SOURCE_H__ | ||
2 | #define __ECORE_WIN32_DND_DROP_SOURCE_H__ | ||
3 | |||
4 | |||
5 | #define WIN32_LEAN_AND_MEAN | ||
6 | #include <windows.h> | ||
7 | #undef WIN32_LEAN_AND_MEAN | ||
8 | #include <ole2.h> | ||
9 | |||
10 | #include "Ecore_Win32.h" | ||
11 | |||
12 | |||
13 | class DropSource : public IDropSource | ||
14 | { | ||
15 | private: | ||
16 | |||
17 | LONG ref_count_; | ||
18 | |||
19 | public: // structors | ||
20 | |||
21 | DropSource(); | ||
22 | |||
23 | public: // IUnknown | ||
24 | |||
25 | HRESULT __stdcall QueryInterface(REFIID iid, void ** ppvObject); | ||
26 | ULONG __stdcall AddRef(); | ||
27 | ULONG __stdcall Release(); | ||
28 | |||
29 | public: // IDropSource | ||
30 | |||
31 | HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState); | ||
32 | HRESULT __stdcall GiveFeedback(DWORD dwEffect); | ||
33 | }; | ||
34 | |||
35 | |||
36 | #endif /* __ECORE_WIN32_DND_DROP_SOURCE_H__ */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp new file mode 100644 index 0000000..e19fb5d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp | |||
@@ -0,0 +1,232 @@ | |||
1 | /* | ||
2 | * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 | ||
3 | */ | ||
4 | |||
5 | #ifdef HAVE_CONFIG_H | ||
6 | # include <config.h> | ||
7 | #endif | ||
8 | |||
9 | #include "ecore_win32_dnd_drop_target.h" | ||
10 | |||
11 | #include "ecore_win32_private.h" | ||
12 | |||
13 | |||
14 | // structors | ||
15 | |||
16 | DropTarget::DropTarget(HWND window, Ecore_Win32_Dnd_DropTarget_Callback callback, void *window_obj_ptr) | ||
17 | : ref_count_(1) | ||
18 | , window_(window) | ||
19 | , allow_drop_(false) | ||
20 | , drop_callback_(callback) | ||
21 | ,drop_callback_ptr_(window_obj_ptr) | ||
22 | { } | ||
23 | |||
24 | |||
25 | // IUnknown | ||
26 | |||
27 | HRESULT DropTarget::QueryInterface(REFIID iid, void **ppvObject) | ||
28 | { | ||
29 | // check to see what interface has been requested | ||
30 | if (iid == IID_IDropTarget || iid == IID_IUnknown) | ||
31 | { | ||
32 | AddRef(); | ||
33 | *ppvObject = this; | ||
34 | return S_OK; | ||
35 | } | ||
36 | *ppvObject = 0; | ||
37 | |||
38 | return E_NOINTERFACE; | ||
39 | } | ||
40 | |||
41 | ULONG DropTarget::AddRef() | ||
42 | { | ||
43 | return InterlockedIncrement(&ref_count_); | ||
44 | } | ||
45 | |||
46 | ULONG DropTarget::Release() | ||
47 | { | ||
48 | LONG count = InterlockedDecrement(&ref_count_); | ||
49 | if (count == 0) | ||
50 | { | ||
51 | delete this; | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | return count; | ||
56 | } | ||
57 | |||
58 | |||
59 | // IDropTarget | ||
60 | |||
61 | HRESULT DropTarget::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) | ||
62 | { | ||
63 | // does the dataobject contain data we want? | ||
64 | allow_drop_ = QueryDataObject(pDataObject) && | ||
65 | (drop_callback_ == NULL || | ||
66 | (drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_ENTER, pt.x, pt.y, NULL, 0) != 0)); | ||
67 | |||
68 | if (allow_drop_) | ||
69 | { | ||
70 | // get the dropeffect based on keyboard state | ||
71 | *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect); | ||
72 | SetFocus(window_); | ||
73 | //PositionCursor(_hwnd, pt); | ||
74 | } | ||
75 | else | ||
76 | *pdwEffect = DROPEFFECT_NONE; | ||
77 | return S_OK; | ||
78 | } | ||
79 | |||
80 | HRESULT DropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD * pdwEffect) | ||
81 | { | ||
82 | allow_drop_ = | ||
83 | (drop_callback_ == NULL) || | ||
84 | (drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_OVER, pt.x, pt.y, NULL, 0) != 0); | ||
85 | |||
86 | if (allow_drop_) | ||
87 | { | ||
88 | *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect); | ||
89 | //PositionCursor(m_hWnd, pt); | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | *pdwEffect = DROPEFFECT_NONE; | ||
94 | } | ||
95 | |||
96 | return S_OK; | ||
97 | } | ||
98 | |||
99 | HRESULT DropTarget::DragLeave() | ||
100 | { | ||
101 | POINT pt; | ||
102 | |||
103 | GetCursorPos(&pt); | ||
104 | if (drop_callback_ != NULL) | ||
105 | drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_LEAVE, pt.x, pt.y, NULL, 0); | ||
106 | |||
107 | return S_OK; | ||
108 | } | ||
109 | |||
110 | HRESULT DropTarget::Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) | ||
111 | { | ||
112 | if (allow_drop_) | ||
113 | { | ||
114 | // construct a FORMATETC object | ||
115 | FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | ||
116 | STGMEDIUM stgmed; | ||
117 | |||
118 | // See if the dataobject contains any TEXT stored as a HGLOBAL | ||
119 | if (pDataObject->QueryGetData(&fmtetc) == S_OK) | ||
120 | { | ||
121 | // Yippie! the data is there, so go get it! | ||
122 | if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) | ||
123 | { | ||
124 | // we asked for the data as a HGLOBAL, so access it appropriately | ||
125 | PVOID data = GlobalLock(stgmed.hGlobal); | ||
126 | UINT size = GlobalSize(stgmed.hGlobal); | ||
127 | |||
128 | if (drop_callback_ != NULL) | ||
129 | { | ||
130 | drop_callback_(drop_callback_ptr_, | ||
131 | ECORE_WIN32_DND_EVENT_DROP, | ||
132 | pt.x, pt.y, | ||
133 | data, size); | ||
134 | } | ||
135 | |||
136 | GlobalUnlock(stgmed.hGlobal); | ||
137 | |||
138 | // release the data using the COM API | ||
139 | ReleaseStgMedium(&stgmed); | ||
140 | } | ||
141 | } | ||
142 | *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect); | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | *pdwEffect = DROPEFFECT_NONE; | ||
147 | } | ||
148 | |||
149 | return S_OK; | ||
150 | } | ||
151 | |||
152 | |||
153 | // internal helper function | ||
154 | |||
155 | DWORD DropTarget::DropEffect(DWORD grfKeyState, POINTL pt __UNUSED__, DWORD dwAllowed) | ||
156 | { | ||
157 | DWORD dwEffect = 0; | ||
158 | |||
159 | // 1. check "pt" -> do we allow a drop at the specified coordinates? | ||
160 | |||
161 | // 2. work out that the drop-effect should be based on grfKeyState | ||
162 | if (grfKeyState & MK_CONTROL) | ||
163 | { | ||
164 | dwEffect = dwAllowed & DROPEFFECT_COPY; | ||
165 | } | ||
166 | else if (grfKeyState & MK_SHIFT) | ||
167 | { | ||
168 | dwEffect = dwAllowed & DROPEFFECT_MOVE; | ||
169 | } | ||
170 | |||
171 | // 3. no key-modifiers were specified (or drop effect not allowed), so | ||
172 | // base the effect on those allowed by the dropsource | ||
173 | if (dwEffect == 0) | ||
174 | { | ||
175 | if (dwAllowed & DROPEFFECT_COPY) dwEffect = DROPEFFECT_COPY; | ||
176 | if (dwAllowed & DROPEFFECT_MOVE) dwEffect = DROPEFFECT_MOVE; | ||
177 | } | ||
178 | |||
179 | return dwEffect; | ||
180 | } | ||
181 | |||
182 | bool DropTarget::QueryDataObject(IDataObject *pDataObject) | ||
183 | { | ||
184 | FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | ||
185 | |||
186 | // does the data object support CF_TEXT using a HGLOBAL? | ||
187 | return pDataObject->QueryGetData(&fmtetc) == S_OK; | ||
188 | } | ||
189 | |||
190 | |||
191 | // ecore_win32 private functions | ||
192 | |||
193 | void *_ecore_win32_dnd_register_drop_window(HWND hwnd, Ecore_Win32_Dnd_DropTarget_Callback callback, void *ptr) | ||
194 | { | ||
195 | DropTarget *pDropTarget = new DropTarget(hwnd, callback, ptr); | ||
196 | |||
197 | if (pDropTarget == NULL) | ||
198 | return NULL; | ||
199 | |||
200 | // acquire a strong lock | ||
201 | if (FAILED(CoLockObjectExternal(pDropTarget, TRUE, FALSE))) | ||
202 | { | ||
203 | delete pDropTarget; | ||
204 | return NULL; | ||
205 | } | ||
206 | |||
207 | // tell OLE that the window is a drop target | ||
208 | if (FAILED(RegisterDragDrop(hwnd, pDropTarget))) | ||
209 | { | ||
210 | delete pDropTarget; | ||
211 | return NULL; | ||
212 | } | ||
213 | |||
214 | return pDropTarget; | ||
215 | } | ||
216 | |||
217 | void _ecore_win32_dnd_unregister_drop_window(HWND hwnd, void *drop_target) | ||
218 | { | ||
219 | IDropTarget *pDropTarget = (IDropTarget *)drop_target; | ||
220 | |||
221 | if (drop_target == NULL) | ||
222 | return; | ||
223 | |||
224 | // remove drag+drop | ||
225 | RevokeDragDrop(hwnd); | ||
226 | |||
227 | // remove the strong lock | ||
228 | CoLockObjectExternal(pDropTarget, FALSE, TRUE); | ||
229 | |||
230 | // release our own reference | ||
231 | pDropTarget->Release(); | ||
232 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h new file mode 100644 index 0000000..24c3de3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef __ECORE_WIN32_DND_DROP_TARGET_H__ | ||
2 | #define __ECORE_WIN32_DND_DROP_TARGET_H__ | ||
3 | |||
4 | |||
5 | #define WIN32_LEAN_AND_MEAN | ||
6 | #include <windows.h> | ||
7 | #undef WIN32_LEAN_AND_MEAN | ||
8 | #include <ole2.h> | ||
9 | |||
10 | #include "Ecore_Win32.h" | ||
11 | |||
12 | |||
13 | class DropTarget : public IDropTarget | ||
14 | { | ||
15 | private: | ||
16 | |||
17 | LONG ref_count_; | ||
18 | HWND window_; | ||
19 | bool allow_drop_; | ||
20 | Ecore_Win32_Dnd_DropTarget_Callback drop_callback_; | ||
21 | void *drop_callback_ptr_; | ||
22 | |||
23 | private: // internal helper function | ||
24 | |||
25 | DWORD DropEffect(DWORD grfKeyState, POINTL pt, DWORD dwAllowed); | ||
26 | bool QueryDataObject(IDataObject *pDataObject); | ||
27 | |||
28 | public: // structors | ||
29 | |||
30 | DropTarget(HWND hwnd, Ecore_Win32_Dnd_DropTarget_Callback callback, void *window_obj_ptr); | ||
31 | |||
32 | public: // IUnknown | ||
33 | |||
34 | HRESULT __stdcall QueryInterface(REFIID iid, void ** ppvObject); | ||
35 | ULONG __stdcall AddRef(); | ||
36 | ULONG __stdcall Release(); | ||
37 | |||
38 | public: // IDropTarget | ||
39 | |||
40 | HRESULT __stdcall DragEnter(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect); | ||
41 | HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD * pdwEffect); | ||
42 | HRESULT __stdcall DragLeave(); | ||
43 | HRESULT __stdcall Drop(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect); | ||
44 | }; | ||
45 | |||
46 | |||
47 | #endif /* __ECORE_WIN32_DND_DROP_TARGET_H__ */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp new file mode 100644 index 0000000..a3858bc --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp | |||
@@ -0,0 +1,157 @@ | |||
1 | |||
2 | #include <ole2.h> | ||
3 | |||
4 | #include "ecore_win32_dnd_enumformatetc.h" | ||
5 | |||
6 | |||
7 | // structors | ||
8 | |||
9 | CEnumFormatEtc::CEnumFormatEtc(FORMATETC *format_etc, int formats_num) | ||
10 | : ref_count_(1) | ||
11 | , index_(0) | ||
12 | , formats_num_(formats_num) | ||
13 | , format_etc_(new FORMATETC[formats_num]) | ||
14 | { | ||
15 | // make a new copy of each FORMATETC structure | ||
16 | for (unsigned int i = 0; i < formats_num_; i++) | ||
17 | { | ||
18 | DeepCopyFormatEtc(&format_etc_[i], &format_etc[i]); | ||
19 | } | ||
20 | } | ||
21 | |||
22 | CEnumFormatEtc::~CEnumFormatEtc() | ||
23 | { | ||
24 | if (format_etc_) | ||
25 | { | ||
26 | // first free any DVTARGETDEVICE structures | ||
27 | for (ULONG i = 0; i < formats_num_; i++) | ||
28 | { | ||
29 | if (format_etc_[i].ptd) | ||
30 | CoTaskMemFree(format_etc_[i].ptd); | ||
31 | } | ||
32 | |||
33 | // now free the main array | ||
34 | delete[] format_etc_; | ||
35 | } | ||
36 | } | ||
37 | |||
38 | // IUnknown | ||
39 | |||
40 | ULONG __stdcall CEnumFormatEtc::AddRef(void) | ||
41 | { | ||
42 | // increment object reference count | ||
43 | return InterlockedIncrement(&ref_count_); | ||
44 | } | ||
45 | |||
46 | ULONG __stdcall CEnumFormatEtc::Release(void) | ||
47 | { | ||
48 | // decrement object reference count | ||
49 | LONG count = InterlockedDecrement(&ref_count_); | ||
50 | |||
51 | if (count == 0) | ||
52 | { | ||
53 | delete this; | ||
54 | return 0; | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | return count; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | HRESULT __stdcall CEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject) | ||
63 | { | ||
64 | // check to see what interface has been requested | ||
65 | if ((iid == IID_IEnumFORMATETC) || (iid == IID_IUnknown)) | ||
66 | { | ||
67 | AddRef(); | ||
68 | *ppvObject = this; | ||
69 | return S_OK; | ||
70 | } | ||
71 | else | ||
72 | { | ||
73 | *ppvObject = 0; | ||
74 | return E_NOINTERFACE; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | // IEnumFormatEtc | ||
79 | |||
80 | HRESULT CEnumFormatEtc::Reset(void) | ||
81 | { | ||
82 | index_ = 0; | ||
83 | return S_OK; | ||
84 | } | ||
85 | |||
86 | HRESULT CEnumFormatEtc::Skip(ULONG celt) | ||
87 | { | ||
88 | index_ += celt; | ||
89 | return (index_ <= formats_num_) ? S_OK : S_FALSE; | ||
90 | } | ||
91 | |||
92 | HRESULT CEnumFormatEtc::Clone(IEnumFORMATETC **ppEnumFormatEtc) | ||
93 | { | ||
94 | HRESULT hResult; | ||
95 | |||
96 | // make a duplicate enumerator | ||
97 | hResult = CreateEnumFormatEtc(formats_num_, format_etc_, ppEnumFormatEtc); | ||
98 | |||
99 | if (hResult == S_OK) | ||
100 | { | ||
101 | // manually set the index state | ||
102 | ((CEnumFormatEtc *)*ppEnumFormatEtc)->index_ = index_; | ||
103 | } | ||
104 | |||
105 | return hResult; | ||
106 | } | ||
107 | |||
108 | HRESULT CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG *pceltFetched) | ||
109 | { | ||
110 | ULONG copied = 0; | ||
111 | |||
112 | // validate arguments | ||
113 | if ((celt == 0) || (pFormatEtc == 0)) | ||
114 | return E_INVALIDARG; | ||
115 | |||
116 | // copy the FORMATETC structures into the caller's buffer | ||
117 | while (index_ < formats_num_ && copied < celt) | ||
118 | { | ||
119 | DeepCopyFormatEtc(&pFormatEtc[copied], &format_etc_[index_]); | ||
120 | copied++; | ||
121 | index_++; | ||
122 | } | ||
123 | |||
124 | // store result | ||
125 | if (pceltFetched != 0) | ||
126 | *pceltFetched = copied; | ||
127 | |||
128 | // did we copy all that was requested? | ||
129 | return (copied == celt) ? S_OK : S_FALSE; | ||
130 | } | ||
131 | |||
132 | // external functions | ||
133 | |||
134 | void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source) | ||
135 | { | ||
136 | // copy the source FORMATETC into dest | ||
137 | *dest = *source; | ||
138 | |||
139 | if (source->ptd) | ||
140 | { | ||
141 | // allocate memory for the DVTARGETDEVICE if necessary | ||
142 | dest->ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE)); | ||
143 | |||
144 | // copy the contents of the source DVTARGETDEVICE into dest->ptd | ||
145 | *(dest->ptd) = *(source->ptd); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | HRESULT CreateEnumFormatEtc(UINT cfmt, FORMATETC *afmt, IEnumFORMATETC **ppEnumFormatEtc) | ||
150 | { | ||
151 | if((cfmt == 0) || (afmt == 0) || (ppEnumFormatEtc == 0)) | ||
152 | return E_INVALIDARG; | ||
153 | |||
154 | *ppEnumFormatEtc = new CEnumFormatEtc(afmt, cfmt); | ||
155 | |||
156 | return (*ppEnumFormatEtc) ? S_OK : E_OUTOFMEMORY; | ||
157 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h new file mode 100644 index 0000000..9f17f56 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h | |||
@@ -0,0 +1,50 @@ | |||
1 | #ifndef __ECORE_WIN32_DND_ENUMFORMATETC_H__ | ||
2 | #define __ECORE_WIN32_DND_ENUMFORMATETC_H__ | ||
3 | |||
4 | |||
5 | #define WIN32_LEAN_AND_MEAN | ||
6 | #include <windows.h> | ||
7 | #undef WIN32_LEAN_AND_MEAN | ||
8 | #include <objbase.h> | ||
9 | |||
10 | |||
11 | class CEnumFormatEtc : public IEnumFORMATETC | ||
12 | { | ||
13 | private: | ||
14 | |||
15 | LONG ref_count_; // Reference count for this COM interface | ||
16 | ULONG index_; // current enumerator index | ||
17 | ULONG formats_num_; // number of FORMATETC members | ||
18 | FORMATETC *format_etc_; // array of FORMATETC objects | ||
19 | |||
20 | public: // structors | ||
21 | |||
22 | CEnumFormatEtc(FORMATETC *pFormatEtc, int nNumFormats); | ||
23 | |||
24 | ~CEnumFormatEtc(); | ||
25 | |||
26 | public: // IUnknown | ||
27 | |||
28 | HRESULT __stdcall QueryInterface (REFIID iid, void ** ppvObject); | ||
29 | |||
30 | ULONG __stdcall AddRef (void); | ||
31 | |||
32 | ULONG __stdcall Release (void); | ||
33 | |||
34 | public: // IEnumFormatEtc | ||
35 | |||
36 | HRESULT __stdcall Next (ULONG celt, FORMATETC * rgelt, ULONG * pceltFetched); | ||
37 | |||
38 | HRESULT __stdcall Skip (ULONG celt); | ||
39 | |||
40 | HRESULT __stdcall Reset (void); | ||
41 | |||
42 | HRESULT __stdcall Clone (IEnumFORMATETC ** ppEnumFormatEtc); | ||
43 | }; | ||
44 | |||
45 | void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source); | ||
46 | |||
47 | HRESULT CreateEnumFormatEtc(UINT cfmt, FORMATETC *afmt, IEnumFORMATETC **ppEnumFormatEtc); | ||
48 | |||
49 | |||
50 | #endif /* __ECORE_WIN32_DND_ENUMFORMATETC_H__ */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c new file mode 100644 index 0000000..63356d3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c | |||
@@ -0,0 +1,1231 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <stdio.h> /* for printf */ | ||
7 | |||
8 | #define WIN32_LEAN_AND_MEAN | ||
9 | #include <windows.h> | ||
10 | #undef WIN32_LEAN_AND_MEAN | ||
11 | #include <windowsx.h> | ||
12 | |||
13 | #include <Eina.h> | ||
14 | #include <Ecore.h> | ||
15 | #include <Ecore_Input.h> | ||
16 | |||
17 | #include "Ecore_Win32.h" | ||
18 | #include "ecore_win32_private.h" | ||
19 | |||
20 | |||
21 | typedef enum | ||
22 | { | ||
23 | ECORE_WIN32_KEY_MASK_LSHIFT = 1 << 0, | ||
24 | ECORE_WIN32_KEY_MASK_RSHIFT = 1 << 1, | ||
25 | ECORE_WIN32_KEY_MASK_LCONTROL = 1 << 2, | ||
26 | ECORE_WIN32_KEY_MASK_RCONTROL = 1 << 3, | ||
27 | ECORE_WIN32_KEY_MASK_LMENU = 1 << 4, | ||
28 | ECORE_WIN32_KEY_MASK_RMENU = 1 << 5 | ||
29 | } Ecore_Win32_Key_Mask; | ||
30 | |||
31 | /***** Private declarations *****/ | ||
32 | |||
33 | |||
34 | static Ecore_Win32_Window *_ecore_win32_mouse_down_last_window = NULL; | ||
35 | static Ecore_Win32_Window *_ecore_win32_mouse_down_last_last_window = NULL; | ||
36 | static long _ecore_win32_mouse_down_last_time = 0 ; | ||
37 | static long _ecore_win32_mouse_down_last_last_time = 0 ; | ||
38 | static int _ecore_win32_mouse_down_did_triple = 0; | ||
39 | static int _ecore_win32_mouse_up_count = 0; | ||
40 | static Ecore_Win32_Key_Mask _ecore_win32_key_mask = 0; | ||
41 | |||
42 | static void _ecore_win32_event_free_key_down(void *data, | ||
43 | void *ev); | ||
44 | |||
45 | static void _ecore_win32_event_free_key_up(void *data, | ||
46 | void *ev); | ||
47 | |||
48 | static int _ecore_win32_event_keystroke_get(int key, | ||
49 | int is_extended, | ||
50 | Eina_Bool is_down, | ||
51 | char **keyname, | ||
52 | char **keysymbol, | ||
53 | char **keycompose, | ||
54 | unsigned int *modifiers); | ||
55 | |||
56 | static int _ecore_win32_event_char_get(int key, | ||
57 | char **keyname, | ||
58 | char **keysymbol, | ||
59 | char **keycompose); | ||
60 | |||
61 | |||
62 | /***** Global functions definitions *****/ | ||
63 | |||
64 | void | ||
65 | _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, | ||
66 | int is_keystroke) | ||
67 | { | ||
68 | Ecore_Event_Key *e; | ||
69 | |||
70 | INF("key pressed"); | ||
71 | |||
72 | e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); | ||
73 | if (!e) return; | ||
74 | |||
75 | if (is_keystroke) | ||
76 | { | ||
77 | if (!_ecore_win32_event_keystroke_get(msg->window_param, | ||
78 | msg->data_param & 0x01000000, | ||
79 | EINA_TRUE, | ||
80 | (char **)&e->keyname, | ||
81 | (char **)&e->key, | ||
82 | (char **)&e->string, | ||
83 | &e->modifiers)) | ||
84 | { | ||
85 | free(e); | ||
86 | return; | ||
87 | } | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), | ||
92 | (char **)&e->keyname, | ||
93 | (char **)&e->key, | ||
94 | (char **)&e->string)) | ||
95 | { | ||
96 | free(e); | ||
97 | return; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
102 | if (!e->window) | ||
103 | { | ||
104 | free(e); | ||
105 | return; | ||
106 | } | ||
107 | e->event_window = e->window; | ||
108 | e->timestamp = msg->time; | ||
109 | |||
110 | _ecore_win32_event_last_time = e->timestamp; | ||
111 | |||
112 | ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_win32_event_free_key_down, NULL); | ||
113 | } | ||
114 | |||
115 | void | ||
116 | _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg) | ||
117 | { | ||
118 | Ecore_Event_Key *e; | ||
119 | |||
120 | INF("key released"); | ||
121 | |||
122 | e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); | ||
123 | if (!e) return; | ||
124 | |||
125 | if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param), | ||
126 | msg->data_param & 0x01000000, | ||
127 | EINA_FALSE, | ||
128 | (char **)&e->keyname, | ||
129 | (char **)&e->key, | ||
130 | (char **)&e->string, | ||
131 | &e->modifiers)) | ||
132 | { | ||
133 | if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), | ||
134 | (char **)&e->keyname, | ||
135 | (char **)&e->key, | ||
136 | (char **)&e->string)) | ||
137 | { | ||
138 | free(e); | ||
139 | return; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
144 | if (!e->window) | ||
145 | { | ||
146 | free(e); | ||
147 | return; | ||
148 | } | ||
149 | e->event_window = e->window; | ||
150 | e->timestamp = msg->time; | ||
151 | |||
152 | _ecore_win32_event_last_time = e->timestamp; | ||
153 | |||
154 | ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_win32_event_free_key_up, NULL); | ||
155 | } | ||
156 | |||
157 | void | ||
158 | _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, | ||
159 | int button) | ||
160 | { | ||
161 | Ecore_Win32_Window *window; | ||
162 | |||
163 | INF("mouse button pressed"); | ||
164 | |||
165 | window = (Ecore_Win32_Window *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
166 | |||
167 | if (button > 3) | ||
168 | { | ||
169 | Ecore_Event_Mouse_Wheel *e; | ||
170 | |||
171 | e = (Ecore_Event_Mouse_Wheel *)calloc(1, sizeof(Ecore_Event_Mouse_Wheel)); | ||
172 | if (!e) return; | ||
173 | |||
174 | e->window = (Ecore_Window)window; | ||
175 | e->event_window = e->window; | ||
176 | e->direction = 0; | ||
177 | /* wheel delta is positive or negative, never 0 */ | ||
178 | e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1; | ||
179 | e->x = GET_X_LPARAM(msg->data_param); | ||
180 | e->y = GET_Y_LPARAM(msg->data_param); | ||
181 | e->timestamp = msg->time; | ||
182 | |||
183 | _ecore_win32_event_last_time = e->timestamp; | ||
184 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | ||
185 | |||
186 | ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); | ||
187 | } | ||
188 | else | ||
189 | { | ||
190 | { | ||
191 | Ecore_Event_Mouse_Move *e; | ||
192 | |||
193 | e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); | ||
194 | if (!e) return; | ||
195 | |||
196 | e->window = (Ecore_Window)window; | ||
197 | e->event_window = e->window; | ||
198 | e->x = GET_X_LPARAM(msg->data_param); | ||
199 | e->y = GET_Y_LPARAM(msg->data_param); | ||
200 | e->timestamp = msg->time; | ||
201 | |||
202 | _ecore_win32_event_last_time = e->timestamp; | ||
203 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | ||
204 | |||
205 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); | ||
206 | } | ||
207 | |||
208 | { | ||
209 | Ecore_Event_Mouse_Button *e; | ||
210 | |||
211 | if (_ecore_win32_mouse_down_did_triple) | ||
212 | { | ||
213 | _ecore_win32_mouse_down_last_window = NULL; | ||
214 | _ecore_win32_mouse_down_last_last_window = NULL; | ||
215 | _ecore_win32_mouse_down_last_time = 0; | ||
216 | _ecore_win32_mouse_down_last_last_time = 0; | ||
217 | } | ||
218 | |||
219 | e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); | ||
220 | if (!e) return; | ||
221 | |||
222 | e->window = (Ecore_Window)window; | ||
223 | e->event_window = e->window; | ||
224 | e->buttons = button; | ||
225 | e->x = GET_X_LPARAM(msg->data_param); | ||
226 | e->y = GET_Y_LPARAM(msg->data_param); | ||
227 | e->timestamp = msg->time; | ||
228 | |||
229 | if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && | ||
230 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) | ||
231 | e->double_click = 1; | ||
232 | |||
233 | if (((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (unsigned long)(2 * 1000 * _ecore_win32_double_click_time)) && | ||
234 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) && | ||
235 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window)) | ||
236 | { | ||
237 | e->triple_click = 1; | ||
238 | _ecore_win32_mouse_down_did_triple = 1; | ||
239 | } | ||
240 | else | ||
241 | _ecore_win32_mouse_down_did_triple = 0; | ||
242 | |||
243 | if (!e->double_click && !e->triple_click) | ||
244 | _ecore_win32_mouse_up_count = 0; | ||
245 | |||
246 | _ecore_win32_event_last_time = e->timestamp; | ||
247 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | ||
248 | |||
249 | if (!_ecore_win32_mouse_down_did_triple) | ||
250 | { | ||
251 | _ecore_win32_mouse_down_last_last_window = _ecore_win32_mouse_down_last_window; | ||
252 | _ecore_win32_mouse_down_last_window = (Ecore_Win32_Window *)e->window; | ||
253 | _ecore_win32_mouse_down_last_last_time = _ecore_win32_mouse_down_last_time; | ||
254 | _ecore_win32_mouse_down_last_time = e->timestamp; | ||
255 | } | ||
256 | |||
257 | ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | |||
262 | void | ||
263 | _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, | ||
264 | int button) | ||
265 | { | ||
266 | Ecore_Win32_Window *window; | ||
267 | |||
268 | INF("mouse button released"); | ||
269 | |||
270 | window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
271 | |||
272 | { | ||
273 | Ecore_Event_Mouse_Move *e; | ||
274 | |||
275 | e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); | ||
276 | if (!e) return; | ||
277 | |||
278 | e->window = (Ecore_Window)window; | ||
279 | e->event_window = e->window; | ||
280 | e->x = GET_X_LPARAM(msg->data_param); | ||
281 | e->y = GET_Y_LPARAM(msg->data_param); | ||
282 | e->timestamp = msg->time; | ||
283 | |||
284 | _ecore_win32_event_last_time = e->timestamp; | ||
285 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | ||
286 | |||
287 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); | ||
288 | } | ||
289 | |||
290 | { | ||
291 | Ecore_Event_Mouse_Button *e; | ||
292 | |||
293 | e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); | ||
294 | if (!e) return; | ||
295 | |||
296 | e->window = (Ecore_Window)window; | ||
297 | e->event_window = e->window; | ||
298 | e->buttons = button; | ||
299 | e->x = GET_X_LPARAM(msg->data_param); | ||
300 | e->y = GET_Y_LPARAM(msg->data_param); | ||
301 | e->timestamp = msg->time; | ||
302 | |||
303 | _ecore_win32_mouse_up_count++; | ||
304 | |||
305 | if ((_ecore_win32_mouse_up_count >= 2) && | ||
306 | ((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && | ||
307 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) | ||
308 | e->double_click = 1; | ||
309 | |||
310 | if ((_ecore_win32_mouse_up_count >= 3) && | ||
311 | ((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (unsigned long)(2 * 1000 * _ecore_win32_double_click_time)) && | ||
312 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) && | ||
313 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window)) | ||
314 | e->triple_click = 1; | ||
315 | |||
316 | _ecore_win32_event_last_time = e->timestamp; | ||
317 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | ||
318 | |||
319 | ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); | ||
320 | } | ||
321 | } | ||
322 | |||
323 | void | ||
324 | _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) | ||
325 | { | ||
326 | Ecore_Event_Mouse_Move *e; | ||
327 | |||
328 | INF("mouse moved"); | ||
329 | |||
330 | e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); | ||
331 | if (!e) return; | ||
332 | |||
333 | e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
334 | e->event_window = e->window; | ||
335 | e->x = GET_X_LPARAM(msg->data_param); | ||
336 | e->y = GET_Y_LPARAM(msg->data_param); | ||
337 | e->timestamp = msg->time; | ||
338 | |||
339 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); | ||
340 | } | ||
341 | |||
342 | void | ||
343 | _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) | ||
344 | { | ||
345 | { | ||
346 | Ecore_Event_Mouse_Move *e; | ||
347 | |||
348 | INF("mouse in"); | ||
349 | |||
350 | e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); | ||
351 | if (!e) return; | ||
352 | |||
353 | e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
354 | e->event_window = e->window; | ||
355 | e->x = msg->x; | ||
356 | e->y = msg->y; | ||
357 | e->timestamp = msg->time; | ||
358 | |||
359 | _ecore_win32_event_last_time = e->timestamp; | ||
360 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | ||
361 | |||
362 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); | ||
363 | } | ||
364 | |||
365 | { | ||
366 | Ecore_Win32_Event_Mouse_In *e; | ||
367 | |||
368 | e = (Ecore_Win32_Event_Mouse_In *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_In)); | ||
369 | if (!e) return; | ||
370 | |||
371 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
372 | e->x = msg->x; | ||
373 | e->y = msg->y; | ||
374 | e->time = msg->time ; | ||
375 | |||
376 | _ecore_win32_event_last_time = e->time; | ||
377 | |||
378 | ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | void | ||
383 | _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) | ||
384 | { | ||
385 | { | ||
386 | Ecore_Event_Mouse_Move *e; | ||
387 | |||
388 | INF("mouse out"); | ||
389 | |||
390 | e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); | ||
391 | if (!e) return; | ||
392 | |||
393 | e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
394 | e->event_window = e->window; | ||
395 | e->x = msg->x; | ||
396 | e->y = msg->y; | ||
397 | e->timestamp = msg->time; | ||
398 | |||
399 | _ecore_win32_event_last_time = e->timestamp; | ||
400 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | ||
401 | |||
402 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); | ||
403 | } | ||
404 | |||
405 | { | ||
406 | Ecore_Win32_Event_Mouse_Out *e; | ||
407 | |||
408 | e = (Ecore_Win32_Event_Mouse_Out *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Out)); | ||
409 | if (!e) return; | ||
410 | |||
411 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
412 | e->x = msg->x; | ||
413 | e->y = msg->y; | ||
414 | e->time = msg->time; | ||
415 | |||
416 | _ecore_win32_event_last_time = e->time; | ||
417 | |||
418 | ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL); | ||
419 | } | ||
420 | } | ||
421 | |||
422 | void | ||
423 | _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg) | ||
424 | { | ||
425 | Ecore_Win32_Event_Window_Focus_In *e; | ||
426 | |||
427 | INF("focus in"); | ||
428 | |||
429 | e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_In)); | ||
430 | if (!e) return; | ||
431 | |||
432 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
433 | |||
434 | e->time = _ecore_win32_event_last_time; | ||
435 | _ecore_win32_event_last_time = e->time; | ||
436 | |||
437 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); | ||
438 | } | ||
439 | |||
440 | void | ||
441 | _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg) | ||
442 | { | ||
443 | Ecore_Win32_Event_Window_Focus_Out *e; | ||
444 | |||
445 | INF("focus out"); | ||
446 | |||
447 | e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_Out)); | ||
448 | if (!e) return; | ||
449 | |||
450 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
451 | |||
452 | e->time = _ecore_win32_event_last_time; | ||
453 | _ecore_win32_event_last_time = e->time; | ||
454 | |||
455 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); | ||
456 | } | ||
457 | |||
458 | void | ||
459 | _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg) | ||
460 | { | ||
461 | Ecore_Win32_Event_Window_Damage *e; | ||
462 | |||
463 | INF("window expose"); | ||
464 | |||
465 | e = (Ecore_Win32_Event_Window_Damage *)calloc(1, sizeof(Ecore_Win32_Event_Window_Damage)); | ||
466 | if (!e) return; | ||
467 | |||
468 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
469 | |||
470 | e->x = msg->update.left; | ||
471 | e->y = msg->update.top; | ||
472 | e->width = msg->update.right - msg->update.left; | ||
473 | e->height = msg->update.bottom - msg->update.top; | ||
474 | |||
475 | e->time = _ecore_win32_event_last_time; | ||
476 | |||
477 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL); | ||
478 | } | ||
479 | |||
480 | void | ||
481 | _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg) | ||
482 | { | ||
483 | Ecore_Win32_Event_Window_Create *e; | ||
484 | |||
485 | INF("window create notify"); | ||
486 | |||
487 | e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create)); | ||
488 | if (!e) return; | ||
489 | |||
490 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
491 | |||
492 | e->time = _ecore_win32_event_last_time; | ||
493 | |||
494 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL); | ||
495 | } | ||
496 | |||
497 | void | ||
498 | _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg) | ||
499 | { | ||
500 | Ecore_Win32_Event_Window_Destroy *e; | ||
501 | |||
502 | INF("window destroy notify"); | ||
503 | |||
504 | e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy)); | ||
505 | if (!e) return; | ||
506 | |||
507 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
508 | |||
509 | e->time = _ecore_win32_event_last_time; | ||
510 | if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; | ||
511 | |||
512 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL); | ||
513 | } | ||
514 | |||
515 | void | ||
516 | _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg) | ||
517 | { | ||
518 | Ecore_Win32_Event_Window_Show *e; | ||
519 | |||
520 | INF("window map notify"); | ||
521 | |||
522 | e = calloc(1, sizeof(Ecore_Win32_Event_Window_Show)); | ||
523 | if (!e) return; | ||
524 | |||
525 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
526 | |||
527 | e->time = _ecore_win32_event_last_time; | ||
528 | |||
529 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL); | ||
530 | } | ||
531 | |||
532 | void | ||
533 | _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg) | ||
534 | { | ||
535 | Ecore_Win32_Event_Window_Hide *e; | ||
536 | |||
537 | INF("window unmap notify"); | ||
538 | |||
539 | e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide)); | ||
540 | if (!e) return; | ||
541 | |||
542 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
543 | |||
544 | e->time = _ecore_win32_event_last_time; | ||
545 | |||
546 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL); | ||
547 | } | ||
548 | |||
549 | void | ||
550 | _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg) | ||
551 | { | ||
552 | WINDOWINFO wi; | ||
553 | Ecore_Win32_Event_Window_Configure *e; | ||
554 | WINDOWPOS *window_pos; | ||
555 | |||
556 | INF("window configure notify"); | ||
557 | |||
558 | e = calloc(1, sizeof(Ecore_Win32_Event_Window_Configure)); | ||
559 | if (!e) return; | ||
560 | |||
561 | window_pos = (WINDOWPOS *)msg->data_param; | ||
562 | wi.cbSize = sizeof(WINDOWINFO); | ||
563 | if (!GetWindowInfo(window_pos->hwnd, &wi)) | ||
564 | { | ||
565 | free(e); | ||
566 | return; | ||
567 | } | ||
568 | |||
569 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
570 | e->abovewin = (void *)GetWindowLongPtr(window_pos->hwndInsertAfter, GWLP_USERDATA); | ||
571 | e->x = wi.rcClient.left; | ||
572 | e->y = wi.rcClient.top; | ||
573 | e->width = wi.rcClient.right - wi.rcClient.left; | ||
574 | e->height = wi.rcClient.bottom - wi.rcClient.top; | ||
575 | e->time = _ecore_win32_event_last_time; | ||
576 | |||
577 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); | ||
578 | } | ||
579 | |||
580 | void | ||
581 | _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg) | ||
582 | { | ||
583 | RECT rect; | ||
584 | Ecore_Win32_Event_Window_Resize *e; | ||
585 | |||
586 | INF("window resize"); | ||
587 | |||
588 | if (!GetClientRect(msg->window, &rect)) | ||
589 | return; | ||
590 | |||
591 | e = calloc(1, sizeof(Ecore_Win32_Event_Window_Resize)); | ||
592 | if (!e) return; | ||
593 | |||
594 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
595 | e->width = rect.right - rect.left; | ||
596 | e->height = rect.bottom - rect.top; | ||
597 | e->time = _ecore_win32_event_last_time; | ||
598 | |||
599 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL); | ||
600 | } | ||
601 | |||
602 | void | ||
603 | _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg) | ||
604 | { | ||
605 | Ecore_Win32_Event_Window_Delete_Request *e; | ||
606 | |||
607 | INF("window delete request"); | ||
608 | |||
609 | e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request)); | ||
610 | if (!e) return; | ||
611 | |||
612 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | ||
613 | e->time = _ecore_win32_event_last_time; | ||
614 | |||
615 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); | ||
616 | } | ||
617 | |||
618 | |||
619 | /***** Private functions definitions *****/ | ||
620 | |||
621 | static void | ||
622 | _ecore_win32_event_free_key_down(void *data __UNUSED__, | ||
623 | void *ev) | ||
624 | { | ||
625 | Ecore_Event_Key *e; | ||
626 | |||
627 | e = ev; | ||
628 | if (e->keyname) free((char *)e->keyname); | ||
629 | if (e->key) free((char *)e->key); | ||
630 | if (e->string) free((char *)e->string); | ||
631 | free(e); | ||
632 | } | ||
633 | |||
634 | static void | ||
635 | _ecore_win32_event_free_key_up(void *data __UNUSED__, | ||
636 | void *ev) | ||
637 | { | ||
638 | Ecore_Event_Key *e; | ||
639 | |||
640 | e = ev; | ||
641 | if (e->keyname) free((char *)e->keyname); | ||
642 | if (e->key) free((char *)e->key); | ||
643 | if (e->string) free((char *)e->string); | ||
644 | free(e); | ||
645 | } | ||
646 | |||
647 | static int | ||
648 | _ecore_win32_event_keystroke_get(int key, | ||
649 | int is_extended, | ||
650 | Eina_Bool is_down, | ||
651 | char **keyname, | ||
652 | char **keysymbol, | ||
653 | char **keycompose, | ||
654 | unsigned int *modifiers) | ||
655 | { | ||
656 | char *kn = NULL; | ||
657 | char *ks = NULL; | ||
658 | char *kc = NULL; | ||
659 | |||
660 | *keyname = NULL; | ||
661 | *keysymbol = NULL; | ||
662 | *keycompose = NULL; | ||
663 | |||
664 | |||
665 | printf("vk key 0x%x\n", key); | ||
666 | switch (key) | ||
667 | { | ||
668 | /* Keystroke */ | ||
669 | case VK_PRIOR: | ||
670 | if (is_extended) | ||
671 | { | ||
672 | kn = "Prior"; | ||
673 | ks = "Prior"; | ||
674 | kc = NULL; | ||
675 | } | ||
676 | else | ||
677 | { | ||
678 | kn = "KP_Prior"; | ||
679 | ks = "KP_9"; | ||
680 | kc = "KP_Prior"; | ||
681 | } | ||
682 | break; | ||
683 | case VK_NEXT: | ||
684 | if (is_extended) | ||
685 | { | ||
686 | kn = "Next"; | ||
687 | ks = "Next"; | ||
688 | kc = NULL; | ||
689 | } | ||
690 | else | ||
691 | { | ||
692 | kn = "KP_Next"; | ||
693 | ks = "KP_3"; | ||
694 | kc = "KP_Next"; | ||
695 | } | ||
696 | break; | ||
697 | case VK_END: | ||
698 | if (is_extended) | ||
699 | { | ||
700 | kn = "End"; | ||
701 | ks = "End"; | ||
702 | kc = NULL; | ||
703 | } | ||
704 | else | ||
705 | { | ||
706 | kn = "KP_End"; | ||
707 | ks = "KP_1"; | ||
708 | kc = "KP_End"; | ||
709 | } | ||
710 | break; | ||
711 | case VK_HOME: | ||
712 | if (is_extended) | ||
713 | { | ||
714 | kn = "Home"; | ||
715 | ks = "Home"; | ||
716 | kc = NULL; | ||
717 | } | ||
718 | else | ||
719 | { | ||
720 | kn = "KP_Home"; | ||
721 | ks = "KP_7"; | ||
722 | kc = "KP_Home"; | ||
723 | } | ||
724 | break; | ||
725 | case VK_LEFT: | ||
726 | if (is_extended) | ||
727 | { | ||
728 | kn = "Left"; | ||
729 | ks = "Left"; | ||
730 | kc = NULL; | ||
731 | } | ||
732 | else | ||
733 | { | ||
734 | kn = "KP_Left"; | ||
735 | ks = "KP_4"; | ||
736 | kc = "KP_Left"; | ||
737 | } | ||
738 | break; | ||
739 | case VK_UP: | ||
740 | if (is_extended) | ||
741 | { | ||
742 | kn = "Up"; | ||
743 | ks = "Up"; | ||
744 | kc = NULL; | ||
745 | } | ||
746 | else | ||
747 | { | ||
748 | kn = "KP_Up"; | ||
749 | ks = "KP_8"; | ||
750 | kc = "KP_Up"; | ||
751 | } | ||
752 | break; | ||
753 | case VK_RIGHT: | ||
754 | printf("vk val 0x%x (right)\n", VK_RIGHT); | ||
755 | if (is_extended) | ||
756 | { | ||
757 | kn = "Right"; | ||
758 | ks = "Right"; | ||
759 | kc = NULL; | ||
760 | } | ||
761 | else | ||
762 | { | ||
763 | kn = "KP_Right"; | ||
764 | ks = "KP_6"; | ||
765 | kc = "KP_Right"; | ||
766 | } | ||
767 | break; | ||
768 | case VK_DOWN: | ||
769 | if (is_extended) | ||
770 | { | ||
771 | kn = "Down"; | ||
772 | ks = "Down"; | ||
773 | kc = NULL; | ||
774 | } | ||
775 | else | ||
776 | { | ||
777 | kn = "KP_Down"; | ||
778 | ks = "KP_2"; | ||
779 | kc = "KP_Down"; | ||
780 | } | ||
781 | break; | ||
782 | case VK_INSERT: | ||
783 | if (is_extended) | ||
784 | { | ||
785 | kn = "Insert"; | ||
786 | ks = "Insert"; | ||
787 | kc = NULL; | ||
788 | } | ||
789 | else | ||
790 | { | ||
791 | kn = "KP_Insert"; | ||
792 | ks = "KP_0"; | ||
793 | kc = "KP_Insert"; | ||
794 | } | ||
795 | break; | ||
796 | case VK_DELETE: | ||
797 | if (is_extended) | ||
798 | { | ||
799 | kn = "Delete"; | ||
800 | ks = "Delete"; | ||
801 | /* FIXME: kc is wrong, here */ | ||
802 | kc = "Delete"; | ||
803 | } | ||
804 | else | ||
805 | { | ||
806 | kn = "KP_Delete"; | ||
807 | ks = "KP_Decimal"; | ||
808 | kc = "KP_Delete"; | ||
809 | } | ||
810 | break; | ||
811 | case VK_SHIFT: | ||
812 | { | ||
813 | SHORT res; | ||
814 | |||
815 | if (is_down) | ||
816 | { | ||
817 | res = GetKeyState(VK_LSHIFT); | ||
818 | if (res & 0x8000) | ||
819 | { | ||
820 | _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LSHIFT; | ||
821 | kn = "Shift_L"; | ||
822 | ks = "Shift_L"; | ||
823 | kc = ""; | ||
824 | } | ||
825 | res = GetKeyState(VK_RSHIFT); | ||
826 | if (res & 0x8000) | ||
827 | { | ||
828 | _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RSHIFT; | ||
829 | kn = "Shift_R"; | ||
830 | ks = "Shift_R"; | ||
831 | kc = ""; | ||
832 | } | ||
833 | *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; | ||
834 | } | ||
835 | else /* is_up */ | ||
836 | { | ||
837 | res = GetKeyState(VK_LSHIFT); | ||
838 | if (!(res & 0x8000) && | ||
839 | (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LSHIFT)) | ||
840 | { | ||
841 | kn = "Shift_L"; | ||
842 | ks = "Shift_L"; | ||
843 | kc = ""; | ||
844 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LSHIFT; | ||
845 | } | ||
846 | res = GetKeyState(VK_RSHIFT); | ||
847 | if (!(res & 0x8000) && | ||
848 | (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RSHIFT)) | ||
849 | { | ||
850 | kn = "Shift_R"; | ||
851 | ks = "Shift_R"; | ||
852 | kc = ""; | ||
853 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT; | ||
854 | } | ||
855 | *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; | ||
856 | } | ||
857 | break; | ||
858 | } | ||
859 | case VK_CONTROL: | ||
860 | { | ||
861 | SHORT res; | ||
862 | |||
863 | if (is_down) | ||
864 | { | ||
865 | res = GetKeyState(VK_LCONTROL); | ||
866 | if (res & 0x8000) | ||
867 | { | ||
868 | _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LCONTROL; | ||
869 | kn = "Control_L"; | ||
870 | ks = "Control_L"; | ||
871 | kc = ""; | ||
872 | break; | ||
873 | } | ||
874 | res = GetKeyState(VK_RCONTROL); | ||
875 | if (res & 0x8000) | ||
876 | { | ||
877 | _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RCONTROL; | ||
878 | kn = "Control_R"; | ||
879 | ks = "Control_R"; | ||
880 | kc = ""; | ||
881 | break; | ||
882 | } | ||
883 | *modifiers |= ECORE_EVENT_MODIFIER_CTRL; | ||
884 | } | ||
885 | else /* is_up */ | ||
886 | { | ||
887 | res = GetKeyState(VK_LCONTROL); | ||
888 | if (!(res & 0x8000) && | ||
889 | (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LCONTROL)) | ||
890 | { | ||
891 | kn = "Control_L"; | ||
892 | ks = "Control_L"; | ||
893 | kc = ""; | ||
894 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LCONTROL; | ||
895 | break; | ||
896 | } | ||
897 | res = GetKeyState(VK_RCONTROL); | ||
898 | if (!(res & 0x8000) && | ||
899 | (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RCONTROL)) | ||
900 | { | ||
901 | kn = "Control_R"; | ||
902 | ks = "Control_R"; | ||
903 | kc = ""; | ||
904 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RCONTROL; | ||
905 | break; | ||
906 | } | ||
907 | *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL; | ||
908 | } | ||
909 | break; | ||
910 | } | ||
911 | case VK_MENU: | ||
912 | { | ||
913 | SHORT res; | ||
914 | |||
915 | if (is_down) | ||
916 | { | ||
917 | res = GetKeyState(VK_LMENU); | ||
918 | if (res & 0x8000) | ||
919 | { | ||
920 | _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LMENU; | ||
921 | kn = "Alt_L"; | ||
922 | ks = "Alt_L"; | ||
923 | kc = ""; | ||
924 | } | ||
925 | res = GetKeyState(VK_RMENU); | ||
926 | if (res & 0x8000) | ||
927 | { | ||
928 | _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RMENU; | ||
929 | kn = "Alt_R"; | ||
930 | ks = "Alt_R"; | ||
931 | kc = ""; | ||
932 | } | ||
933 | *modifiers |= ECORE_EVENT_MODIFIER_ALT; | ||
934 | } | ||
935 | else /* is_up */ | ||
936 | { | ||
937 | res = GetKeyState(VK_LMENU); | ||
938 | if (!(res & 0x8000) && | ||
939 | (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LMENU)) | ||
940 | { | ||
941 | kn = "Alt_L"; | ||
942 | ks = "Alt_L"; | ||
943 | kc = ""; | ||
944 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LMENU; | ||
945 | } | ||
946 | res = GetKeyState(VK_RMENU); | ||
947 | if (!(res & 0x8000) && | ||
948 | (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RMENU)) | ||
949 | { | ||
950 | kn = "Alt_R"; | ||
951 | ks = "Alt_R"; | ||
952 | kc = ""; | ||
953 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RMENU; | ||
954 | } | ||
955 | *modifiers &= ~ECORE_EVENT_MODIFIER_ALT; | ||
956 | } | ||
957 | break; | ||
958 | } | ||
959 | case VK_LWIN: | ||
960 | { | ||
961 | if (is_down) | ||
962 | { | ||
963 | kn = "Super_L"; | ||
964 | ks = "Super_L"; | ||
965 | kc = ""; | ||
966 | *modifiers |= ECORE_EVENT_MODIFIER_WIN; | ||
967 | } | ||
968 | else /* is_up */ | ||
969 | { | ||
970 | kn = "Super_L"; | ||
971 | ks = "Super_L"; | ||
972 | kc = ""; | ||
973 | *modifiers &= ~ECORE_EVENT_MODIFIER_WIN; | ||
974 | } | ||
975 | break; | ||
976 | } | ||
977 | case VK_RWIN: | ||
978 | { | ||
979 | if (is_down) | ||
980 | { | ||
981 | kn = "Super_R"; | ||
982 | ks = "Super_R"; | ||
983 | kc = ""; | ||
984 | *modifiers |= ECORE_EVENT_MODIFIER_WIN; | ||
985 | } | ||
986 | else /* is_up */ | ||
987 | { | ||
988 | kn = "Super_R"; | ||
989 | ks = "Super_R"; | ||
990 | kc = ""; | ||
991 | *modifiers &= ~ECORE_EVENT_MODIFIER_WIN; | ||
992 | } | ||
993 | break; | ||
994 | } | ||
995 | case VK_F1: | ||
996 | kn = "F1"; | ||
997 | ks = "F1"; | ||
998 | kc = ""; | ||
999 | break; | ||
1000 | case VK_F2: | ||
1001 | kn = "F2"; | ||
1002 | ks = "F2"; | ||
1003 | kc = ""; | ||
1004 | break; | ||
1005 | case VK_F3: | ||
1006 | kn = "F3"; | ||
1007 | ks = "F3"; | ||
1008 | kc = ""; | ||
1009 | break; | ||
1010 | case VK_F4: | ||
1011 | kn = "F4"; | ||
1012 | ks = "F4"; | ||
1013 | kc = ""; | ||
1014 | break; | ||
1015 | case VK_F5: | ||
1016 | kn = "F5"; | ||
1017 | ks = "F5"; | ||
1018 | kc = ""; | ||
1019 | break; | ||
1020 | case VK_F6: | ||
1021 | kn = "F6"; | ||
1022 | ks = "F6"; | ||
1023 | kc = ""; | ||
1024 | break; | ||
1025 | case VK_F7: | ||
1026 | kn = "F7"; | ||
1027 | ks = "F7"; | ||
1028 | kc = ""; | ||
1029 | break; | ||
1030 | case VK_F8: | ||
1031 | kn = "F8"; | ||
1032 | ks = "F8"; | ||
1033 | kc = ""; | ||
1034 | break; | ||
1035 | case VK_F9: | ||
1036 | kn = "F9"; | ||
1037 | ks = "F9"; | ||
1038 | kc = ""; | ||
1039 | break; | ||
1040 | case VK_F10: | ||
1041 | kn = "F10"; | ||
1042 | ks = "F10"; | ||
1043 | kc = ""; | ||
1044 | break; | ||
1045 | case VK_F11: | ||
1046 | kn = "F11"; | ||
1047 | ks = "F11"; | ||
1048 | kc = ""; | ||
1049 | break; | ||
1050 | case VK_F12: | ||
1051 | kn = "F12"; | ||
1052 | ks = "F12"; | ||
1053 | kc = ""; | ||
1054 | break; | ||
1055 | case VK_F13: | ||
1056 | kn = "F13"; | ||
1057 | ks = "F13"; | ||
1058 | kc = ""; | ||
1059 | break; | ||
1060 | case VK_F14: | ||
1061 | kn = "F14"; | ||
1062 | ks = "F14"; | ||
1063 | kc = ""; | ||
1064 | break; | ||
1065 | case VK_F15: | ||
1066 | kn = "F15"; | ||
1067 | ks = "F15"; | ||
1068 | kc = ""; | ||
1069 | break; | ||
1070 | case VK_F16: | ||
1071 | kn = "F16"; | ||
1072 | ks = "F16"; | ||
1073 | kc = ""; | ||
1074 | break; | ||
1075 | case VK_F17: | ||
1076 | kn = "F17"; | ||
1077 | ks = "F17"; | ||
1078 | kc = ""; | ||
1079 | break; | ||
1080 | case VK_F18: | ||
1081 | kn = "F18"; | ||
1082 | ks = "F18"; | ||
1083 | kc = ""; | ||
1084 | break; | ||
1085 | case VK_F19: | ||
1086 | kn = "F19"; | ||
1087 | ks = "F19"; | ||
1088 | kc = ""; | ||
1089 | break; | ||
1090 | case VK_F20: | ||
1091 | kn = "F20"; | ||
1092 | ks = "F20"; | ||
1093 | kc = ""; | ||
1094 | break; | ||
1095 | case VK_F21: | ||
1096 | kn = "F21"; | ||
1097 | ks = "F21"; | ||
1098 | kc = ""; | ||
1099 | break; | ||
1100 | case VK_F22: | ||
1101 | kn = "F22"; | ||
1102 | ks = "F22"; | ||
1103 | kc = ""; | ||
1104 | break; | ||
1105 | case VK_F23: | ||
1106 | kn = "F23"; | ||
1107 | ks = "F23"; | ||
1108 | kc = ""; | ||
1109 | break; | ||
1110 | case VK_F24: | ||
1111 | kn = "F24"; | ||
1112 | ks = "F24"; | ||
1113 | kc = ""; | ||
1114 | break; | ||
1115 | default: | ||
1116 | /* other non keystroke characters */ | ||
1117 | return 0; | ||
1118 | } | ||
1119 | |||
1120 | printf("sortie...\n"); | ||
1121 | *keyname = strdup(kn); | ||
1122 | if (!*keyname) return 0; | ||
1123 | *keysymbol = strdup(ks); | ||
1124 | if (!*keysymbol) | ||
1125 | { | ||
1126 | free(*keyname); | ||
1127 | *keyname = NULL; | ||
1128 | return 0; | ||
1129 | } | ||
1130 | if (!kc) | ||
1131 | *keycompose = NULL; | ||
1132 | else | ||
1133 | { | ||
1134 | *keycompose = strdup(kc); | ||
1135 | if (!*keycompose) | ||
1136 | { | ||
1137 | free(*keyname); | ||
1138 | free(*keysymbol); | ||
1139 | *keyname = NULL; | ||
1140 | *keysymbol = NULL; | ||
1141 | return 0; | ||
1142 | } | ||
1143 | } | ||
1144 | printf("sortie 2 ...\n"); | ||
1145 | |||
1146 | return 1; | ||
1147 | } | ||
1148 | |||
1149 | static int | ||
1150 | _ecore_win32_event_char_get(int key, | ||
1151 | char **keyname, | ||
1152 | char **keysymbol, | ||
1153 | char **keycompose) | ||
1154 | { | ||
1155 | char *kn = NULL; | ||
1156 | char *ks = NULL; | ||
1157 | char *kc = NULL; | ||
1158 | char buf[2]; | ||
1159 | |||
1160 | *keyname = NULL; | ||
1161 | *keysymbol = NULL; | ||
1162 | *keycompose = NULL; | ||
1163 | |||
1164 | printf("char key 0x%x\n", key); | ||
1165 | |||
1166 | switch (key) | ||
1167 | { | ||
1168 | case VK_PROCESSKEY: | ||
1169 | break; | ||
1170 | case VK_BACK: | ||
1171 | kn = "BackSpace"; | ||
1172 | ks = "BackSpace"; | ||
1173 | kc = "\b"; | ||
1174 | break; | ||
1175 | case VK_TAB: | ||
1176 | kn = "Tab"; | ||
1177 | ks = "Tab"; | ||
1178 | kc = "\t"; | ||
1179 | break; | ||
1180 | case 0x0a: | ||
1181 | /* Line feed (Shift + Enter) */ | ||
1182 | kn = "LineFeed"; | ||
1183 | ks = "LineFeed"; | ||
1184 | kc = "LineFeed"; | ||
1185 | break; | ||
1186 | case VK_RETURN: | ||
1187 | kn = "Return"; | ||
1188 | ks = "Return"; | ||
1189 | kc = "\n"; | ||
1190 | break; | ||
1191 | case VK_ESCAPE: | ||
1192 | kn = "Escape"; | ||
1193 | ks = "Escape"; | ||
1194 | kc = "\e"; | ||
1195 | break; | ||
1196 | case VK_SPACE: | ||
1197 | kn = "space"; | ||
1198 | ks = "space"; | ||
1199 | kc = " "; | ||
1200 | break; | ||
1201 | default: | ||
1202 | /* displayable characters */ | ||
1203 | printf (" * key : %d\n", key); | ||
1204 | buf[0] = key; | ||
1205 | buf[1] = '\0'; | ||
1206 | kn = buf; | ||
1207 | ks = buf; | ||
1208 | kc = buf; | ||
1209 | break; | ||
1210 | } | ||
1211 | *keyname = strdup(kn); | ||
1212 | if (!*keyname) return 0; | ||
1213 | *keysymbol = strdup(ks); | ||
1214 | if (!*keysymbol) | ||
1215 | { | ||
1216 | free(*keyname); | ||
1217 | *keyname = NULL; | ||
1218 | return 0; | ||
1219 | } | ||
1220 | *keycompose = strdup(kc); | ||
1221 | if (!*keycompose) | ||
1222 | { | ||
1223 | free(*keyname); | ||
1224 | free(*keysymbol); | ||
1225 | *keyname = NULL; | ||
1226 | *keysymbol = NULL; | ||
1227 | return 0; | ||
1228 | } | ||
1229 | |||
1230 | return 1; | ||
1231 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h new file mode 100644 index 0000000..4533169 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h | |||
@@ -0,0 +1,169 @@ | |||
1 | #ifndef __ECORE_WIN32_PRIVATE_H__ | ||
2 | #define __ECORE_WIN32_PRIVATE_H__ | ||
3 | |||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | #ifdef MIN | ||
10 | # undef MIN | ||
11 | #endif | ||
12 | #define MIN(a,b) (((a) < (b)) ? (a) : (b)) | ||
13 | |||
14 | #ifdef MAX | ||
15 | # undef MAX | ||
16 | #endif | ||
17 | #define MAX(a,b) (((a) < (b)) ? (b) : (a)) | ||
18 | |||
19 | /* logging messages macros */ | ||
20 | extern int _ecore_win32_log_dom_global; | ||
21 | |||
22 | #ifdef ECORE_WIN32_DEFAULT_LOG_COLOR | ||
23 | # undef ECORE_WIN32_DEFAULT_LOG_COLOR | ||
24 | #endif | ||
25 | #define ECORE_WIN32_DEFAULT_LOG_COLOR EINA_COLOR_LIGHTBLUE | ||
26 | |||
27 | #ifdef ERR | ||
28 | # undef ERR | ||
29 | #endif | ||
30 | #define ERR(...) EINA_LOG_DOM_ERR(_ecore_win32_log_dom_global , __VA_ARGS__) | ||
31 | #ifdef DBG | ||
32 | #undef DBG | ||
33 | #endif | ||
34 | #define DBG(...) EINA_LOG_DOM_DBG(_ecore_win32_log_dom_global , __VA_ARGS__) | ||
35 | |||
36 | #ifdef INF | ||
37 | #undef INF | ||
38 | #endif | ||
39 | #define INF(...) EINA_LOG_DOM_INFO(_ecore_win32_log_dom_global , __VA_ARGS__) | ||
40 | |||
41 | #ifdef WRN | ||
42 | # undef WRN | ||
43 | #endif | ||
44 | #define WRN(...) EINA_LOG_DOM_WARN(_ecore_win32_log_dom_global, __VA_ARGS__) | ||
45 | |||
46 | #define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class" | ||
47 | |||
48 | typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data; | ||
49 | |||
50 | struct _Ecore_Win32_Callback_Data | ||
51 | { | ||
52 | RECT update; | ||
53 | HWND window; | ||
54 | unsigned int message; | ||
55 | WPARAM window_param; | ||
56 | LPARAM data_param; | ||
57 | long time; | ||
58 | int x; | ||
59 | int y; | ||
60 | }; | ||
61 | |||
62 | struct _Ecore_Win32_Window | ||
63 | { | ||
64 | HWND window; | ||
65 | |||
66 | DWORD style; /* used to go fullscreen to normal */ | ||
67 | RECT rect; /* used to go fullscreen to normal */ | ||
68 | |||
69 | unsigned int min_width; | ||
70 | unsigned int min_height; | ||
71 | unsigned int max_width; | ||
72 | unsigned int max_height; | ||
73 | unsigned int base_width; | ||
74 | unsigned int base_height; | ||
75 | unsigned int step_width; | ||
76 | unsigned int step_height; | ||
77 | |||
78 | struct { | ||
79 | unsigned int iconified : 1; | ||
80 | unsigned int modal : 1; | ||
81 | unsigned int sticky : 1; | ||
82 | unsigned int maximized_vert : 1; | ||
83 | unsigned int maximized_horz : 1; | ||
84 | unsigned int shaded : 1; | ||
85 | unsigned int hidden : 1; | ||
86 | unsigned int fullscreen : 1; | ||
87 | unsigned int above : 1; | ||
88 | unsigned int below : 1; | ||
89 | unsigned int demands_attention : 1; | ||
90 | } state; | ||
91 | |||
92 | struct { | ||
93 | unsigned int desktop : 1; | ||
94 | unsigned int dock : 1; | ||
95 | unsigned int toolbar : 1; | ||
96 | unsigned int menu : 1; | ||
97 | unsigned int utility : 1; | ||
98 | unsigned int splash : 1; | ||
99 | unsigned int dialog : 1; | ||
100 | unsigned int normal : 1; | ||
101 | } type; | ||
102 | |||
103 | unsigned int pointer_is_in : 1; | ||
104 | unsigned int borderless : 1; | ||
105 | unsigned int iconified : 1; | ||
106 | unsigned int fullscreen : 1; | ||
107 | |||
108 | struct { | ||
109 | unsigned short width; | ||
110 | unsigned short height; | ||
111 | unsigned char *mask; | ||
112 | unsigned int enabled : 1; | ||
113 | unsigned int layered : 1; | ||
114 | } shape; | ||
115 | |||
116 | struct { | ||
117 | DWORD type; | ||
118 | int x; | ||
119 | int y; | ||
120 | int w; | ||
121 | int h; | ||
122 | int px; | ||
123 | int py; | ||
124 | unsigned int dragging : 1; | ||
125 | } drag; | ||
126 | |||
127 | void *dnd_drop_target; | ||
128 | }; | ||
129 | |||
130 | |||
131 | extern HINSTANCE _ecore_win32_instance; | ||
132 | extern double _ecore_win32_double_click_time; | ||
133 | extern long _ecore_win32_event_last_time; | ||
134 | extern Ecore_Win32_Window *_ecore_win32_event_last_window; | ||
135 | |||
136 | |||
137 | void _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int is_keystroke); | ||
138 | void _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg); | ||
139 | void _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, int button); | ||
140 | void _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, int button); | ||
141 | void _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg); | ||
142 | void _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg); | ||
143 | void _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg); | ||
144 | void _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg); | ||
145 | void _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg); | ||
146 | void _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg); | ||
147 | void _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg); | ||
148 | void _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg); | ||
149 | void _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg); | ||
150 | void _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg); | ||
151 | void _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg); | ||
152 | void _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg); | ||
153 | void _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg); | ||
154 | |||
155 | void *_ecore_win32_dnd_data_object_new(void *fmtetc, void *stgmeds, int count); | ||
156 | void _ecore_win32_dnd_data_object_free(void *data_object); | ||
157 | void *_ecore_win32_dnd_drop_source_new(); | ||
158 | void _ecore_win32_dnd_drop_source_free(void *drop_source); | ||
159 | void *_ecore_win32_dnd_register_drop_window(HWND hwnd, | ||
160 | Ecore_Win32_Dnd_DropTarget_Callback callback, void *ptr); | ||
161 | void _ecore_win32_dnd_unregister_drop_window(HWND hwnd, void *drop_target); | ||
162 | |||
163 | |||
164 | #ifdef __cplusplus | ||
165 | } | ||
166 | #endif | ||
167 | |||
168 | |||
169 | #endif /* __ECORE_WIN32_PRIVATE_H__ */ | ||
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c new file mode 100644 index 0000000..459f051 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c | |||
@@ -0,0 +1,1519 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <stdio.h> /* for printf */ | ||
7 | |||
8 | #define WIN32_LEAN_AND_MEAN | ||
9 | #include <windows.h> | ||
10 | #undef WIN32_LEAN_AND_MEAN | ||
11 | |||
12 | #include <Eina.h> | ||
13 | |||
14 | #include "Ecore_Win32.h" | ||
15 | #include "ecore_win32_private.h" | ||
16 | |||
17 | /*============================================================================* | ||
18 | * Local * | ||
19 | *============================================================================*/ | ||
20 | |||
21 | /** | ||
22 | * @cond LOCAL | ||
23 | */ | ||
24 | |||
25 | |||
26 | typedef enum _Ecore_Win32_Window_Z_Order Ecore_Win32_Window_Z_Order; | ||
27 | enum _Ecore_Win32_Window_Z_Order | ||
28 | { | ||
29 | ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM, | ||
30 | ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST, | ||
31 | ECORE_WIN32_WINDOW_Z_ORDER_TOP, | ||
32 | ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST | ||
33 | }; | ||
34 | |||
35 | static Ecore_Win32_Window * | ||
36 | ecore_win32_window_internal_new(Ecore_Win32_Window *parent, | ||
37 | int x, | ||
38 | int y, | ||
39 | int width, | ||
40 | int height, | ||
41 | DWORD style) | ||
42 | { | ||
43 | RECT rect; | ||
44 | Ecore_Win32_Window *w; | ||
45 | int minimal_width; | ||
46 | int minimal_height; | ||
47 | |||
48 | w = (Ecore_Win32_Window *)calloc(1, sizeof(Ecore_Win32_Window)); | ||
49 | if (!w) | ||
50 | { | ||
51 | ERR("malloc() failed"); | ||
52 | return NULL; | ||
53 | } | ||
54 | |||
55 | rect.left = 0; | ||
56 | rect.top = 0; | ||
57 | rect.right = width; | ||
58 | rect.bottom = height; | ||
59 | if (!AdjustWindowRectEx(&rect, style, FALSE, 0)) | ||
60 | { | ||
61 | ERR("AdjustWindowRect() failed"); | ||
62 | free(w); | ||
63 | return NULL; | ||
64 | } | ||
65 | |||
66 | minimal_width = GetSystemMetrics(SM_CXMIN); | ||
67 | minimal_height = GetSystemMetrics(SM_CYMIN); | ||
68 | /* if (((rect.right - rect.left) < minimal_width) || */ | ||
69 | /* ((rect.bottom - rect.top) < minimal_height)) */ | ||
70 | /* { */ | ||
71 | /* fprintf (stderr, "[Ecore] [Win32] ERROR !!\n"); */ | ||
72 | /* fprintf (stderr, " Wrong size %ld\n", rect.right - rect.left); */ | ||
73 | /* free(w); */ | ||
74 | /* return NULL; */ | ||
75 | /* } */ | ||
76 | if ((rect.right - rect.left) < minimal_width) | ||
77 | { | ||
78 | rect.right = rect.left + minimal_width; | ||
79 | } | ||
80 | |||
81 | w->window = CreateWindowEx(0, | ||
82 | ECORE_WIN32_WINDOW_CLASS, "", | ||
83 | style, | ||
84 | x, y, | ||
85 | rect.right - rect.left, | ||
86 | rect.bottom - rect.top, | ||
87 | parent ? parent->window : NULL, | ||
88 | NULL, _ecore_win32_instance, NULL); | ||
89 | if (!w->window) | ||
90 | { | ||
91 | ERR("CreateWindowEx() failed"); | ||
92 | free(w); | ||
93 | return NULL; | ||
94 | } | ||
95 | |||
96 | SetLastError(0); | ||
97 | if (!SetWindowLongPtr(w->window, GWLP_USERDATA, (LONG_PTR)w) && | ||
98 | (GetLastError() != 0)) | ||
99 | { | ||
100 | ERR("SetWindowLongPtr() failed"); | ||
101 | DestroyWindow(w->window); | ||
102 | free(w); | ||
103 | return NULL; | ||
104 | } | ||
105 | |||
106 | w->min_width = 0; | ||
107 | w->min_height = 0; | ||
108 | w->max_width = 32767; | ||
109 | w->max_height = 32767; | ||
110 | w->base_width = 0; | ||
111 | w->base_height = 0; | ||
112 | w->step_width = 1; | ||
113 | w->step_height = 1; | ||
114 | |||
115 | w->state.iconified = 0; | ||
116 | w->state.modal = 0; | ||
117 | w->state.sticky = 0; | ||
118 | w->state.maximized_vert = 0; | ||
119 | w->state.maximized_horz = 0; | ||
120 | w->state.shaded = 0; | ||
121 | w->state.hidden = 0; | ||
122 | w->state.fullscreen = 0; | ||
123 | w->state.above = 0; | ||
124 | w->state.below = 0; | ||
125 | w->state.demands_attention = 0; | ||
126 | |||
127 | w->type.desktop = 0; | ||
128 | w->type.dock = 0; | ||
129 | w->type.toolbar = 0; | ||
130 | w->type.menu = 0; | ||
131 | w->type.utility = 0; | ||
132 | w->type.splash = 0; | ||
133 | w->type.dialog = 0; | ||
134 | w->type.normal = 0; | ||
135 | |||
136 | w->pointer_is_in = 0; | ||
137 | w->borderless = 0; | ||
138 | w->iconified = 0; | ||
139 | w->fullscreen = 0; | ||
140 | |||
141 | return w; | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * @endcond | ||
146 | */ | ||
147 | |||
148 | |||
149 | /*============================================================================* | ||
150 | * Global * | ||
151 | *============================================================================*/ | ||
152 | |||
153 | /*============================================================================* | ||
154 | * API * | ||
155 | *============================================================================*/ | ||
156 | |||
157 | /** | ||
158 | * @addtogroup Ecore_Win32_Group Ecore_Win32 library | ||
159 | * | ||
160 | * @{ | ||
161 | */ | ||
162 | |||
163 | /** | ||
164 | * @brief Creates a new window. | ||
165 | * | ||
166 | * @param parent The parent window. | ||
167 | * @param x The x coordinate of the top-left corner of the window. | ||
168 | * @param y The y coordinate of the top-left corner of the window. | ||
169 | * @param width The width of the window. | ||
170 | * @param height The height of hte window. | ||
171 | * @return A newly allocated window. | ||
172 | * | ||
173 | * This function creates a new window which parent is @p parent. @p width and | ||
174 | * @p height are the size of the window content (the client part), | ||
175 | * without the border and title bar. @p x and @p y are the system | ||
176 | * coordinates of the top left cerner of the window (that is, of the | ||
177 | * title bar). This function returns a newly created window on | ||
178 | * success, and @c NULL on failure. | ||
179 | */ | ||
180 | EAPI Ecore_Win32_Window * | ||
181 | ecore_win32_window_new(Ecore_Win32_Window *parent, | ||
182 | int x, | ||
183 | int y, | ||
184 | int width, | ||
185 | int height) | ||
186 | { | ||
187 | INF("creating window with border"); | ||
188 | |||
189 | return ecore_win32_window_internal_new(parent, | ||
190 | x, y, | ||
191 | width, height, | ||
192 | WS_OVERLAPPEDWINDOW | WS_SIZEBOX); | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * @brief Creates a new borderless window. | ||
197 | * | ||
198 | * @param parent The parent window. | ||
199 | * @param x The x coordinate of the top-left corner of the window. | ||
200 | * @param y The y coordinate of the top-left corner of the window. | ||
201 | * @param width The width of the window. | ||
202 | * @param height The height of hte window. | ||
203 | * @return A newly allocated window. | ||
204 | * | ||
205 | * This function is the same than ecore_win32_window_override_new() | ||
206 | * but the returned window is borderless. | ||
207 | */ | ||
208 | EAPI Ecore_Win32_Window * | ||
209 | ecore_win32_window_override_new(Ecore_Win32_Window *parent, | ||
210 | int x, | ||
211 | int y, | ||
212 | int width, | ||
213 | int height) | ||
214 | { | ||
215 | INF("creating window without border"); | ||
216 | |||
217 | return ecore_win32_window_internal_new(parent, | ||
218 | x, y, | ||
219 | width, height, | ||
220 | WS_POPUP); | ||
221 | } | ||
222 | |||
223 | /** | ||
224 | * @brief Free the given window. | ||
225 | * | ||
226 | * @param window The window to free. | ||
227 | * | ||
228 | * This function frees @p window. If @p window is @c NULL, this | ||
229 | * function does nothing. | ||
230 | */ | ||
231 | EAPI void | ||
232 | ecore_win32_window_free(Ecore_Win32_Window *window) | ||
233 | { | ||
234 | if (!window) return; | ||
235 | |||
236 | INF("destroying window"); | ||
237 | |||
238 | if (window->shape.mask) | ||
239 | free(window->shape.mask); | ||
240 | |||
241 | DestroyWindow(window->window); | ||
242 | free(window); | ||
243 | } | ||
244 | |||
245 | /** | ||
246 | * @brief Return the window HANDLE associated to the given window. | ||
247 | * | ||
248 | * @param window The window to retrieve the HANDLE from. | ||
249 | * | ||
250 | * This function returns the window HANDLE associated to @p window. If | ||
251 | * @p window is @c NULL, this function returns @c NULL. | ||
252 | */ | ||
253 | EAPI void * | ||
254 | ecore_win32_window_hwnd_get(Ecore_Win32_Window *window) | ||
255 | { | ||
256 | if (!window) return NULL; | ||
257 | |||
258 | return window->window; | ||
259 | } | ||
260 | |||
261 | /* | ||
262 | void | ||
263 | ecore_win32_window_configure(Ecore_Win32_Window *window, | ||
264 | Ecore_Win32_Window_Z_Order order, | ||
265 | int x, | ||
266 | int y, | ||
267 | int width, | ||
268 | int height) | ||
269 | { | ||
270 | HWND w; | ||
271 | |||
272 | switch (order) | ||
273 | { | ||
274 | case ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM: | ||
275 | w = HWND_BOTTOM; | ||
276 | break; | ||
277 | case ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST: | ||
278 | w = HWND_NOTOPMOST; | ||
279 | break; | ||
280 | case ECORE_WIN32_WINDOW_Z_ORDER_TOP: | ||
281 | w = HWND_TOP; | ||
282 | break; | ||
283 | case ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST: | ||
284 | w = HWND_TOPMOST; | ||
285 | break; | ||
286 | default: | ||
287 | return; | ||
288 | } | ||
289 | SetWindowPos((Ecore_Win32_Window *)window->window, w, x, y, width, height, ???); | ||
290 | } | ||
291 | */ | ||
292 | |||
293 | /** | ||
294 | * @brief Move the given window to a given position. | ||
295 | * | ||
296 | * @param window The window to move. | ||
297 | * @param x The x coordinate of the destination position. | ||
298 | * @param y The y coordinate of the destination position. | ||
299 | * | ||
300 | * This function move @p window to the new position of coordinates @p x | ||
301 | * and @p y. If @p window is @c NULL, or if it is fullscreen, or on | ||
302 | * error, this function does nothing. | ||
303 | */ | ||
304 | EAPI void | ||
305 | ecore_win32_window_move(Ecore_Win32_Window *window, | ||
306 | int x, | ||
307 | int y) | ||
308 | { | ||
309 | RECT rect; | ||
310 | |||
311 | /* FIXME: on fullscreen, should not move it */ | ||
312 | if (!window) return; | ||
313 | |||
314 | INF("moving window (%dx%d)", x, y); | ||
315 | |||
316 | if (!GetWindowRect(window->window, &rect)) | ||
317 | { | ||
318 | ERR("GetWindowRect() failed"); | ||
319 | return; | ||
320 | } | ||
321 | |||
322 | if (!MoveWindow(window->window, x, y, | ||
323 | rect.right - rect.left, | ||
324 | rect.bottom - rect.top, | ||
325 | TRUE)) | ||
326 | { | ||
327 | ERR("MoveWindow() failed"); | ||
328 | } | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * @brief Resize the given window to a given size. | ||
333 | * | ||
334 | * @param window The window to resize. | ||
335 | * @param width The new width. | ||
336 | * @param height The new height. | ||
337 | * | ||
338 | * This function resize @p window to the new @p width and @p height. | ||
339 | * If @p window is @c NULL, or if it is fullscreen, or on error, this | ||
340 | * function does nothing. | ||
341 | */ | ||
342 | EAPI void | ||
343 | ecore_win32_window_resize(Ecore_Win32_Window *window, | ||
344 | int width, | ||
345 | int height) | ||
346 | { | ||
347 | RECT rect; | ||
348 | DWORD style; | ||
349 | int x; | ||
350 | int y; | ||
351 | int minimal_width; | ||
352 | int minimal_height; | ||
353 | |||
354 | /* FIXME: on fullscreen, should not resize it */ | ||
355 | if (!window) return; | ||
356 | |||
357 | INF("resizing window (%dx%d)", width, height); | ||
358 | |||
359 | minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width); | ||
360 | minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height); | ||
361 | |||
362 | if (!GetWindowRect(window->window, &rect)) | ||
363 | { | ||
364 | ERR("GetWindowRect() failed"); | ||
365 | return; | ||
366 | } | ||
367 | |||
368 | x = rect.left; | ||
369 | y = rect.top; | ||
370 | rect.left = 0; | ||
371 | rect.top = 0; | ||
372 | if (width < minimal_width) width = minimal_width; | ||
373 | if (width > (int)window->max_width) width = window->max_width; | ||
374 | if (height < minimal_height) height = minimal_height; | ||
375 | if (height > (int)window->max_height) height = window->max_height; | ||
376 | rect.right = width; | ||
377 | rect.bottom = height; | ||
378 | if (!(style = GetWindowLong(window->window, GWL_STYLE))) | ||
379 | { | ||
380 | ERR("GetWindowLong() failed"); | ||
381 | return; | ||
382 | } | ||
383 | if (!AdjustWindowRect(&rect, style, FALSE)) | ||
384 | { | ||
385 | ERR("AdjustWindowRect() failed"); | ||
386 | return; | ||
387 | } | ||
388 | |||
389 | if (!MoveWindow(window->window, x, y, | ||
390 | rect.right - rect.left, | ||
391 | rect.bottom - rect.top, | ||
392 | TRUE)) | ||
393 | { | ||
394 | ERR("MoveWindow() failed"); | ||
395 | } | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * @brief Move and resize the given window to a given position and size. | ||
400 | * | ||
401 | * @param window The window to move and resize. | ||
402 | * @param x The x coordinate of the destination position. | ||
403 | * @param y The x coordinate of the destination position. | ||
404 | * @param width The new width. | ||
405 | * @param height The new height. | ||
406 | * | ||
407 | * This function resize @p window to the new position of coordinates @p x | ||
408 | * and @p y and the new @p width and @p height. If @p window is @c NULL, | ||
409 | * or if it is fullscreen, or on error, this function does nothing. | ||
410 | */ | ||
411 | EAPI void | ||
412 | ecore_win32_window_move_resize(Ecore_Win32_Window *window, | ||
413 | int x, | ||
414 | int y, | ||
415 | int width, | ||
416 | int height) | ||
417 | { | ||
418 | RECT rect; | ||
419 | DWORD style; | ||
420 | int minimal_width; | ||
421 | int minimal_height; | ||
422 | |||
423 | /* FIXME: on fullscreen, should not move/resize it */ | ||
424 | if (!window) return; | ||
425 | |||
426 | INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height); | ||
427 | |||
428 | minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width); | ||
429 | minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height); | ||
430 | |||
431 | rect.left = 0; | ||
432 | rect.top = 0; | ||
433 | if (width < minimal_width) width = minimal_width; | ||
434 | if (width > (int)window->max_width) width = window->max_width; | ||
435 | if (height < minimal_height) height = minimal_height; | ||
436 | if (height > (int)window->max_height) height = window->max_height; | ||
437 | rect.right = width; | ||
438 | rect.bottom = height; | ||
439 | if (!(style = GetWindowLong(window->window, GWL_STYLE))) | ||
440 | { | ||
441 | ERR("GetWindowLong() failed"); | ||
442 | return; | ||
443 | } | ||
444 | if (!AdjustWindowRect(&rect, style, FALSE)) | ||
445 | { | ||
446 | ERR("AdjustWindowRect() failed"); | ||
447 | return; | ||
448 | } | ||
449 | |||
450 | if (!MoveWindow(window->window, x, y, | ||
451 | rect.right - rect.left, | ||
452 | rect.bottom - rect.top, | ||
453 | TRUE)) | ||
454 | { | ||
455 | ERR("MoveWindow() failed"); | ||
456 | } | ||
457 | } | ||
458 | |||
459 | /** | ||
460 | * @brief Get the geometry of the given window. | ||
461 | * | ||
462 | * @param window The window to retrieve the geometry from. | ||
463 | * @param x The x coordinate of the position. | ||
464 | * @param y The x coordinate of the position. | ||
465 | * @param width The width. | ||
466 | * @param height The height. | ||
467 | * | ||
468 | * This function retrieves the position and size of @p window. @p x, | ||
469 | * @p y, @p width and @p height can be buffers that will be filled with | ||
470 | * the corresponding values. If one of them is @c NULL, nothing will | ||
471 | * be done for that parameter. If @p window is @c NULL, and if the | ||
472 | * buffers are not @c NULL, they will be filled with respectively 0, | ||
473 | * 0, the size of the screen and the height of the screen. | ||
474 | */ | ||
475 | EAPI void | ||
476 | ecore_win32_window_geometry_get(Ecore_Win32_Window *window, | ||
477 | int *x, | ||
478 | int *y, | ||
479 | int *width, | ||
480 | int *height) | ||
481 | { | ||
482 | RECT rect; | ||
483 | int w; | ||
484 | int h; | ||
485 | |||
486 | INF("getting window geometry"); | ||
487 | |||
488 | if (!window) | ||
489 | { | ||
490 | if (x) *x = 0; | ||
491 | if (y) *y = 0; | ||
492 | if (width) *width = GetSystemMetrics(SM_CXSCREEN); | ||
493 | if (height) *height = GetSystemMetrics(SM_CYSCREEN); | ||
494 | |||
495 | return; | ||
496 | } | ||
497 | |||
498 | if (!GetClientRect(window->window, &rect)) | ||
499 | { | ||
500 | ERR("GetClientRect() failed"); | ||
501 | |||
502 | if (x) *x = 0; | ||
503 | if (y) *y = 0; | ||
504 | if (width) *width = 0; | ||
505 | if (height) *height = 0; | ||
506 | |||
507 | return; | ||
508 | } | ||
509 | |||
510 | w = rect.right - rect.left; | ||
511 | h = rect.bottom - rect.top; | ||
512 | |||
513 | if (!GetWindowRect(window->window, &rect)) | ||
514 | { | ||
515 | ERR("GetWindowRect() failed"); | ||
516 | |||
517 | if (x) *x = 0; | ||
518 | if (y) *y = 0; | ||
519 | if (width) *width = 0; | ||
520 | if (height) *height = 0; | ||
521 | |||
522 | return; | ||
523 | } | ||
524 | |||
525 | if (x) *x = rect.left; | ||
526 | if (y) *y = rect.top; | ||
527 | if (width) *width = w; | ||
528 | if (height) *height = h; | ||
529 | } | ||
530 | |||
531 | /** | ||
532 | * @brief Get the size of the given window. | ||
533 | * | ||
534 | * @param window The window to retrieve the size from. | ||
535 | * @param width The width. | ||
536 | * @param height The height. | ||
537 | * | ||
538 | * This function retrieves the size of @p window. @p width and | ||
539 | * @p height can be buffers that will be filled with the corresponding | ||
540 | * values. If one of them is @c NULL, nothing will be done for that | ||
541 | * parameter. If @p window is @c NULL, and if the buffers are not | ||
542 | * @c NULL, they will be filled with respectively the size of the screen | ||
543 | * and the height of the screen. | ||
544 | */ | ||
545 | EAPI void | ||
546 | ecore_win32_window_size_get(Ecore_Win32_Window *window, | ||
547 | int *width, | ||
548 | int *height) | ||
549 | { | ||
550 | RECT rect; | ||
551 | |||
552 | INF("getting window size"); | ||
553 | |||
554 | if (!window) | ||
555 | { | ||
556 | if (width) *width = GetSystemMetrics(SM_CXSCREEN); | ||
557 | if (height) *height = GetSystemMetrics(SM_CYSCREEN); | ||
558 | |||
559 | return; | ||
560 | } | ||
561 | |||
562 | if (!GetClientRect(window->window, &rect)) | ||
563 | { | ||
564 | ERR("GetClientRect() failed"); | ||
565 | |||
566 | if (width) *width = 0; | ||
567 | if (height) *height = 0; | ||
568 | } | ||
569 | |||
570 | if (width) *width = rect.right - rect.left; | ||
571 | if (height) *height = rect.bottom - rect.top; | ||
572 | } | ||
573 | |||
574 | /** | ||
575 | * @brief Set the minimum size of the given window. | ||
576 | * | ||
577 | * @param window The window. | ||
578 | * @param min_width The minimal width. | ||
579 | * @param min_height The minimal height. | ||
580 | * | ||
581 | * This function sets the minimum size of @p window to @p min_width | ||
582 | * and *p min_height. If @p window is @c NULL, this functions does | ||
583 | * nothing. | ||
584 | */ | ||
585 | EAPI void | ||
586 | ecore_win32_window_size_min_set(Ecore_Win32_Window *window, | ||
587 | unsigned int min_width, | ||
588 | unsigned int min_height) | ||
589 | { | ||
590 | if (!window) return; | ||
591 | |||
592 | printf ("ecore_win32_window_size_min_set : %p %d %d\n", window, min_width, min_height); | ||
593 | window->min_width = min_width; | ||
594 | window->min_height = min_height; | ||
595 | } | ||
596 | |||
597 | /** | ||
598 | * @brief Get the minimum size of the given window. | ||
599 | * | ||
600 | * @param window The window. | ||
601 | * @param min_width The minimal width. | ||
602 | * @param min_height The minimal height. | ||
603 | * | ||
604 | * This function fills the minimum size of @p window in the buffers | ||
605 | * @p min_width and *p min_height. They both can be @c NULL. If | ||
606 | * @p window is @c NULL, this functions does nothing. | ||
607 | */ | ||
608 | EAPI void | ||
609 | ecore_win32_window_size_min_get(Ecore_Win32_Window *window, | ||
610 | unsigned int *min_width, | ||
611 | unsigned int *min_height) | ||
612 | { | ||
613 | if (!window) return; | ||
614 | |||
615 | printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, window->min_width, window->min_height); | ||
616 | if (min_width) *min_width = window->min_width; | ||
617 | if (min_height) *min_height = window->min_height; | ||
618 | } | ||
619 | |||
620 | /** | ||
621 | * @brief Set the maximum size of the given window. | ||
622 | * | ||
623 | * @param window The window. | ||
624 | * @param max_width The maximal width. | ||
625 | * @param max_height The maximal height. | ||
626 | * | ||
627 | * This function sets the maximum size of @p window to @p max_width | ||
628 | * and *p max_height. If @p window is @c NULL, this functions does | ||
629 | * nothing. | ||
630 | */ | ||
631 | EAPI void | ||
632 | ecore_win32_window_size_max_set(Ecore_Win32_Window *window, | ||
633 | unsigned int max_width, | ||
634 | unsigned int max_height) | ||
635 | { | ||
636 | if (!window) return; | ||
637 | |||
638 | printf ("ecore_win32_window_size_max_set : %p %d %d\n", window, max_width, max_height); | ||
639 | window->max_width = max_width; | ||
640 | window->max_height = max_height; | ||
641 | } | ||
642 | |||
643 | /** | ||
644 | * @brief Get the maximum size of the given window. | ||
645 | * | ||
646 | * @param window The window. | ||
647 | * @param max_width The maximal width. | ||
648 | * @param max_height The maximal height. | ||
649 | * | ||
650 | * This function fills the maximum size of @p window in the buffers | ||
651 | * @p max_width and *p max_height. They both can be @c NULL. If | ||
652 | * @p window is @c NULL, this functions does nothing. | ||
653 | */ | ||
654 | EAPI void | ||
655 | ecore_win32_window_size_max_get(Ecore_Win32_Window *window, | ||
656 | unsigned int *max_width, | ||
657 | unsigned int *max_height) | ||
658 | { | ||
659 | if (!window) return; | ||
660 | |||
661 | printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, window->max_width, window->max_height); | ||
662 | if (max_width) *max_width = window->max_width; | ||
663 | if (max_height) *max_height = window->max_height; | ||
664 | } | ||
665 | |||
666 | /** | ||
667 | * @brief Set the base size of the given window. | ||
668 | * | ||
669 | * @param window The window. | ||
670 | * @param base_width The base width. | ||
671 | * @param base_height The base height. | ||
672 | * | ||
673 | * This function sets the base size of @p window to @p base_width | ||
674 | * and *p base_height. If @p window is @c NULL, this functions does | ||
675 | * nothing. | ||
676 | */ | ||
677 | EAPI void | ||
678 | ecore_win32_window_size_base_set(Ecore_Win32_Window *window, | ||
679 | unsigned int base_width, | ||
680 | unsigned int base_height) | ||
681 | { | ||
682 | printf ("ecore_win32_window_size_base_set : %p %d %d\n", window, base_width, base_height); | ||
683 | if (!window) return; | ||
684 | |||
685 | window->base_width = base_width; | ||
686 | window->base_height = base_height; | ||
687 | } | ||
688 | |||
689 | /** | ||
690 | * @brief Get the base size of the given window. | ||
691 | * | ||
692 | * @param window The window. | ||
693 | * @param base_width The base width. | ||
694 | * @param base_height The bas height. | ||
695 | * | ||
696 | * This function fills the base size of @p window in the buffers | ||
697 | * @p base_width and *p base_height. They both can be @c NULL. If | ||
698 | * @p window is @c NULL, this functions does nothing. | ||
699 | */ | ||
700 | EAPI void | ||
701 | ecore_win32_window_size_base_get(Ecore_Win32_Window *window, | ||
702 | unsigned int *base_width, | ||
703 | unsigned int *base_height) | ||
704 | { | ||
705 | if (!window) return; | ||
706 | |||
707 | printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, window->base_width, window->base_height); | ||
708 | if (base_width) *base_width = window->base_width; | ||
709 | if (base_height) *base_height = window->base_height; | ||
710 | } | ||
711 | |||
712 | /** | ||
713 | * @brief Set the step size of the given window. | ||
714 | * | ||
715 | * @param window The window. | ||
716 | * @param step_width The step width. | ||
717 | * @param step_height The step height. | ||
718 | * | ||
719 | * This function sets the step size of @p window to @p step_width | ||
720 | * and *p step_height. If @p window is @c NULL, this functions does | ||
721 | * nothing. | ||
722 | */ | ||
723 | EAPI void | ||
724 | ecore_win32_window_size_step_set(Ecore_Win32_Window *window, | ||
725 | unsigned int step_width, | ||
726 | unsigned int step_height) | ||
727 | { | ||
728 | printf ("ecore_win32_window_size_step_set : %p %d %d\n", window, step_width, step_height); | ||
729 | if (!window) return; | ||
730 | |||
731 | window->step_width = step_width; | ||
732 | window->step_height = step_height; | ||
733 | } | ||
734 | |||
735 | /** | ||
736 | * @brief Get the step size of the given window. | ||
737 | * | ||
738 | * @param window The window. | ||
739 | * @param step_width The step width. | ||
740 | * @param step_height The bas height. | ||
741 | * | ||
742 | * This function fills the step size of @p window in the buffers | ||
743 | * @p step_width and *p step_height. They both can be @c NULL. If | ||
744 | * @p window is @c NULL, this functions does nothing. | ||
745 | */ | ||
746 | EAPI void | ||
747 | ecore_win32_window_size_step_get(Ecore_Win32_Window *window, | ||
748 | unsigned int *step_width, | ||
749 | unsigned int *step_height) | ||
750 | { | ||
751 | if (!window) return; | ||
752 | |||
753 | printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, window->step_width, window->step_height); | ||
754 | if (step_width) *step_width = window->step_width; | ||
755 | if (step_height) *step_height = window->step_height; | ||
756 | } | ||
757 | |||
758 | EAPI void | ||
759 | ecore_win32_window_shape_set(Ecore_Win32_Window *window, | ||
760 | unsigned short width, | ||
761 | unsigned short height, | ||
762 | unsigned char *mask) | ||
763 | { | ||
764 | HRGN rgn; | ||
765 | int x; | ||
766 | int y; | ||
767 | OSVERSIONINFO version_info; | ||
768 | |||
769 | if (!window) | ||
770 | return; | ||
771 | |||
772 | if (!mask) | ||
773 | { | ||
774 | window->shape.enabled = 0; | ||
775 | if (window->shape.layered != 0) | ||
776 | { | ||
777 | window->shape.layered = 0; | ||
778 | #if defined(WS_EX_LAYERED) | ||
779 | SetLastError(0); | ||
780 | if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, | ||
781 | GetWindowLong(window->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && | ||
782 | (GetLastError() != 0)) | ||
783 | { | ||
784 | ERR("SetWindowLongPtr() failed"); | ||
785 | return; | ||
786 | } | ||
787 | if (!RedrawWindow(window->window, NULL, NULL, | ||
788 | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN)) | ||
789 | { | ||
790 | ERR("RedrawWindow() failed"); | ||
791 | return; | ||
792 | } | ||
793 | #endif | ||
794 | } | ||
795 | else | ||
796 | if (!SetWindowRgn(window->window, NULL, TRUE)) | ||
797 | { | ||
798 | ERR("SetWindowRgn() failed"); | ||
799 | } | ||
800 | return; | ||
801 | } | ||
802 | |||
803 | if (width == 0 || height == 0) | ||
804 | return; | ||
805 | |||
806 | window->shape.enabled = 1; | ||
807 | |||
808 | if (width != window->shape.width || height != window->shape.height) | ||
809 | { | ||
810 | window->shape.width = width; | ||
811 | window->shape.height = height; | ||
812 | if (window->shape.mask) | ||
813 | { | ||
814 | free(window->shape.mask); | ||
815 | window->shape.mask = NULL; | ||
816 | } | ||
817 | window->shape.mask = malloc(width * height); | ||
818 | } | ||
819 | memcpy(window->shape.mask, mask, width * height); | ||
820 | |||
821 | window->shape.layered = 0; | ||
822 | |||
823 | #if defined(WS_EX_LAYERED) | ||
824 | version_info.dwOSVersionInfoSize = sizeof(version_info); | ||
825 | if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5) | ||
826 | { | ||
827 | SetLastError(0); | ||
828 | if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, | ||
829 | GetWindowLong(window->window, GWL_EXSTYLE) | WS_EX_LAYERED) && | ||
830 | (GetLastError() != 0)) | ||
831 | { | ||
832 | ERR("SetWindowLongPtr() failed"); | ||
833 | return; | ||
834 | } | ||
835 | window->shape.layered = 1; | ||
836 | return; | ||
837 | } | ||
838 | #endif | ||
839 | |||
840 | if (!(rgn = CreateRectRgn(0, 0, 0, 0))) | ||
841 | { | ||
842 | ERR("CreateRectRgn() failed"); | ||
843 | return; | ||
844 | } | ||
845 | for (y = 0; y < height; y++) | ||
846 | { | ||
847 | HRGN rgnLine; | ||
848 | |||
849 | if (!(rgnLine = CreateRectRgn(0, 0, 0, 0))) | ||
850 | { | ||
851 | ERR("CreateRectRgn() failed"); | ||
852 | return; | ||
853 | } | ||
854 | for (x = 0; x < width; x++) | ||
855 | { | ||
856 | if (mask[y * width + x] > 0) | ||
857 | { | ||
858 | HRGN rgnDot; | ||
859 | |||
860 | if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1))) | ||
861 | { | ||
862 | ERR("CreateRectRgn() failed"); | ||
863 | return; | ||
864 | } | ||
865 | if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR) | ||
866 | { | ||
867 | ERR("CombineRgn() has not created a new region"); | ||
868 | } | ||
869 | if (!DeleteObject(rgnDot)) | ||
870 | { | ||
871 | ERR("DeleteObject() failed"); | ||
872 | return; | ||
873 | } | ||
874 | } | ||
875 | } | ||
876 | if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR) | ||
877 | { | ||
878 | ERR("CombineRgn() has not created a new region"); | ||
879 | } | ||
880 | if (!DeleteObject(rgnLine)) | ||
881 | { | ||
882 | ERR("DeleteObject() failed"); | ||
883 | return; | ||
884 | } | ||
885 | } | ||
886 | if (!SetWindowRgn(window->window, rgn, TRUE)) | ||
887 | { | ||
888 | ERR("SetWindowRgn() failed"); | ||
889 | } | ||
890 | } | ||
891 | |||
892 | /** | ||
893 | * @brief Show the given window. | ||
894 | * | ||
895 | * @param window The window to show. | ||
896 | * | ||
897 | * This function shows @p window. If @p window is @c NULL, or on | ||
898 | * error, this function does nothing. | ||
899 | */ | ||
900 | EAPI void | ||
901 | ecore_win32_window_show(Ecore_Win32_Window *window) | ||
902 | { | ||
903 | if (!window) return; | ||
904 | |||
905 | INF("showing window"); | ||
906 | |||
907 | ShowWindow(window->window, SW_SHOWNORMAL); | ||
908 | if (!UpdateWindow(window->window)) | ||
909 | { | ||
910 | ERR("UpdateWindow() failed"); | ||
911 | } | ||
912 | } | ||
913 | |||
914 | /* FIXME: seems to block the taskbar */ | ||
915 | /** | ||
916 | * @brief Hide the given window. | ||
917 | * | ||
918 | * @param window The window to show. | ||
919 | * | ||
920 | * This function hides @p window. If @p window is @c NULL, or on | ||
921 | * error, this function does nothing. | ||
922 | */ | ||
923 | EAPI void | ||
924 | ecore_win32_window_hide(Ecore_Win32_Window *window) | ||
925 | { | ||
926 | if (!window) return; | ||
927 | |||
928 | INF("hiding window"); | ||
929 | |||
930 | ShowWindow(window->window, SW_HIDE); | ||
931 | } | ||
932 | |||
933 | /** | ||
934 | * @brief Place the given window at the top of the Z order. | ||
935 | * | ||
936 | * @param window The window to place at the top. | ||
937 | * | ||
938 | * This function places @p window at the top of the Z order. If | ||
939 | * @p window is @c NULL, this function does nothing. | ||
940 | */ | ||
941 | EAPI void | ||
942 | ecore_win32_window_raise(Ecore_Win32_Window *window) | ||
943 | { | ||
944 | if (!window) return; | ||
945 | |||
946 | INF("raising window"); | ||
947 | |||
948 | if (!SetWindowPos(window->window, | ||
949 | HWND_TOP, 0, 0, 0, 0, | ||
950 | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)) | ||
951 | { | ||
952 | ERR("SetWindowPos() failed"); | ||
953 | } | ||
954 | } | ||
955 | |||
956 | /** | ||
957 | * @brief Place the given window at the bottom of the Z order. | ||
958 | * | ||
959 | * @param window The window to place at the bottom. | ||
960 | * | ||
961 | * This function places @p window at the bottom of the Z order. If | ||
962 | * @p window is @c NULL, this function does nothing. | ||
963 | */ | ||
964 | EAPI void | ||
965 | ecore_win32_window_lower(Ecore_Win32_Window *window) | ||
966 | { | ||
967 | if (!window) return; | ||
968 | |||
969 | INF("lowering window"); | ||
970 | |||
971 | if (!SetWindowPos(window->window, | ||
972 | HWND_BOTTOM, 0, 0, 0, 0, | ||
973 | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)) | ||
974 | { | ||
975 | ERR("SetWindowPos() failed"); | ||
976 | } | ||
977 | } | ||
978 | |||
979 | /** | ||
980 | * @brief Set the title of the given window. | ||
981 | * | ||
982 | * @param window The window to set the title. | ||
983 | * @param title The new title. | ||
984 | * | ||
985 | * This function sets the title of @p window to @p title. If @p window | ||
986 | * is @c NULL, or if @p title is @c NULL or empty, or on error, this | ||
987 | * function does nothing. | ||
988 | */ | ||
989 | EAPI void | ||
990 | ecore_win32_window_title_set(Ecore_Win32_Window *window, | ||
991 | const char *title) | ||
992 | { | ||
993 | if (!window) return; | ||
994 | |||
995 | if (!title || !title[0]) return; | ||
996 | |||
997 | INF("setting window title"); | ||
998 | |||
999 | if (!SetWindowText(window->window, title)) | ||
1000 | { | ||
1001 | ERR("SetWindowText() failed"); | ||
1002 | } | ||
1003 | } | ||
1004 | |||
1005 | /** | ||
1006 | * @brief Set the focus to the given window. | ||
1007 | * | ||
1008 | * @param window The window to give focus to. | ||
1009 | * | ||
1010 | * This function gives the focus to @p window. If @p window is | ||
1011 | * @c NULL, this function does nothing. | ||
1012 | */ | ||
1013 | EAPI void | ||
1014 | ecore_win32_window_focus_set(Ecore_Win32_Window *window) | ||
1015 | { | ||
1016 | if (!window) return; | ||
1017 | |||
1018 | INF("focusing window"); | ||
1019 | |||
1020 | if (!SetFocus(window->window)) | ||
1021 | { | ||
1022 | ERR("SetFocus() failed"); | ||
1023 | } | ||
1024 | } | ||
1025 | |||
1026 | /** | ||
1027 | * @brief Iconify or restore the given window. | ||
1028 | * | ||
1029 | * @param window The window. | ||
1030 | * @param on EINA_TRUE to iconify the window, EINA_FALSE to restore it. | ||
1031 | * | ||
1032 | * This function iconify or restore @p window. If @p on | ||
1033 | * is set to EINA_TRUE, the window will be iconified, if it is set to | ||
1034 | * EINA_FALSE, it will be restored. If @p window is @c NULL or if the | ||
1035 | * state does not change (like iconifying the window while it is | ||
1036 | * already iconified), this function does nothing. | ||
1037 | */ | ||
1038 | EAPI void | ||
1039 | ecore_win32_window_iconified_set(Ecore_Win32_Window *window, | ||
1040 | Eina_Bool on) | ||
1041 | { | ||
1042 | if (!window) return; | ||
1043 | |||
1044 | if (((window->iconified) && (on)) || | ||
1045 | ((!window->iconified) && (!on))) | ||
1046 | return; | ||
1047 | |||
1048 | INF("iconifying window: %s", on ? "yes" : "no"); | ||
1049 | |||
1050 | ShowWindow(window->window, on ? SW_MINIMIZE : SW_RESTORE); | ||
1051 | window->iconified = on; | ||
1052 | } | ||
1053 | |||
1054 | /** | ||
1055 | * @brief Remove or restore the border of the given window. | ||
1056 | * | ||
1057 | * @param window The window. | ||
1058 | * @param on EINA_TRUE to remove the border, EINA_FALSE to restore it. | ||
1059 | * | ||
1060 | * This function remove or restore the border of @p window. If @p on | ||
1061 | * is set to EINA_TRUE, the window will have no border, if it is set to | ||
1062 | * EINA_FALSE, it will have a border. If @p window is @c NULL or if the | ||
1063 | * state does not change (like setting to borderless while the window | ||
1064 | * has no border), this function does nothing. | ||
1065 | */ | ||
1066 | EAPI void | ||
1067 | ecore_win32_window_borderless_set(Ecore_Win32_Window *window, | ||
1068 | Eina_Bool on) | ||
1069 | { | ||
1070 | RECT rect; | ||
1071 | DWORD style; | ||
1072 | |||
1073 | if (!window) return; | ||
1074 | |||
1075 | if (((window->borderless) && (on)) || | ||
1076 | ((!window->borderless) && (!on))) | ||
1077 | return; | ||
1078 | |||
1079 | INF("setting window without border: %s", on ? "yes" : "no"); | ||
1080 | |||
1081 | style = GetWindowLong(window->window, GWL_STYLE); | ||
1082 | if (on) | ||
1083 | { | ||
1084 | if (!GetClientRect(window->window, &rect)) | ||
1085 | { | ||
1086 | ERR("GetClientRect() failed"); | ||
1087 | return; | ||
1088 | } | ||
1089 | SetLastError(0); | ||
1090 | if (!SetWindowLongPtr(window->window, GWL_STYLE, style & ~(WS_CAPTION | WS_THICKFRAME)) && | ||
1091 | (GetLastError() != 0)) | ||
1092 | { | ||
1093 | ERR("SetWindowLongPtr() failed"); | ||
1094 | return; | ||
1095 | } | ||
1096 | } | ||
1097 | else | ||
1098 | { | ||
1099 | if (!GetWindowRect(window->window, &rect)) | ||
1100 | { | ||
1101 | ERR("GetWindowRect() failed"); | ||
1102 | return; | ||
1103 | } | ||
1104 | style |= WS_CAPTION | WS_THICKFRAME; | ||
1105 | if (!AdjustWindowRect (&rect, style, FALSE)) | ||
1106 | { | ||
1107 | ERR("AdjustWindowRect() failed"); | ||
1108 | return; | ||
1109 | } | ||
1110 | SetLastError(0); | ||
1111 | if (!SetWindowLongPtr(window->window, GWL_STYLE, style) && | ||
1112 | (GetLastError() != 0)) | ||
1113 | { | ||
1114 | ERR("SetWindowLongPtr() failed"); | ||
1115 | return; | ||
1116 | } | ||
1117 | } | ||
1118 | if (!SetWindowPos(window->window, HWND_TOPMOST, | ||
1119 | rect.left, rect.top, | ||
1120 | rect.right - rect.left, rect.bottom - rect.top, | ||
1121 | SWP_NOMOVE | SWP_FRAMECHANGED)) | ||
1122 | { | ||
1123 | ERR("SetWindowPos() failed"); | ||
1124 | return; | ||
1125 | } | ||
1126 | |||
1127 | window->borderless = on; | ||
1128 | } | ||
1129 | |||
1130 | /** | ||
1131 | * @brief Set the given window to fullscreen. | ||
1132 | * | ||
1133 | * @param window The window. | ||
1134 | * @param on EINA_TRUE for fullscreen mode, EINA_FALSE for windowed mode. | ||
1135 | * | ||
1136 | * This function set @p window to fullscreen or windowed mode. If @p on | ||
1137 | * is set to EINA_TRUE, the window will be fullscreen, if it is set to | ||
1138 | * EINA_FALSE, it will be windowed. If @p window is @c NULL or if the | ||
1139 | * state does not change (like setting to fullscreen while the window | ||
1140 | * is already fullscreen), this function does nothing. | ||
1141 | */ | ||
1142 | EAPI void | ||
1143 | ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, | ||
1144 | Eina_Bool on) | ||
1145 | { | ||
1146 | if (!window) return; | ||
1147 | |||
1148 | if (((window->fullscreen) && (on)) || | ||
1149 | ((!window->fullscreen) && (!on))) | ||
1150 | return; | ||
1151 | |||
1152 | INF("setting fullscreen: %s", on ? "yes" : "no"); | ||
1153 | |||
1154 | window->fullscreen = !!on; | ||
1155 | |||
1156 | if (on) | ||
1157 | { | ||
1158 | DWORD style; | ||
1159 | |||
1160 | if (!GetWindowRect(window->window, &window->rect)) | ||
1161 | { | ||
1162 | ERR("GetWindowRect() failed"); | ||
1163 | return; | ||
1164 | } | ||
1165 | if (!(window->style = GetWindowLong(window->window, GWL_STYLE))) | ||
1166 | { | ||
1167 | ERR("GetWindowLong() failed"); | ||
1168 | return; | ||
1169 | } | ||
1170 | style = window->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX; | ||
1171 | style |= WS_VISIBLE | WS_POPUP; | ||
1172 | SetLastError(0); | ||
1173 | if (!SetWindowLongPtr(window->window, GWL_STYLE, style) && | ||
1174 | (GetLastError() != 0)) | ||
1175 | { | ||
1176 | ERR("SetWindowLongPtr() failed"); | ||
1177 | return; | ||
1178 | } | ||
1179 | SetLastError(0); | ||
1180 | if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, WS_EX_TOPMOST) && | ||
1181 | (GetLastError() != 0)) | ||
1182 | { | ||
1183 | ERR("SetWindowLongPtr() failed"); | ||
1184 | return; | ||
1185 | } | ||
1186 | if (!SetWindowPos(window->window, HWND_TOPMOST, 0, 0, | ||
1187 | GetSystemMetrics (SM_CXSCREEN), | ||
1188 | GetSystemMetrics (SM_CYSCREEN), | ||
1189 | SWP_NOCOPYBITS | SWP_SHOWWINDOW)) | ||
1190 | { | ||
1191 | ERR("SetWindowPos() failed"); | ||
1192 | return; | ||
1193 | } | ||
1194 | } | ||
1195 | else | ||
1196 | { | ||
1197 | SetLastError(0); | ||
1198 | if (!SetWindowLongPtr(window->window, GWL_STYLE, window->style) && | ||
1199 | (GetLastError() != 0)) | ||
1200 | { | ||
1201 | ERR("SetWindowLongPtr() failed"); | ||
1202 | return; | ||
1203 | } | ||
1204 | SetLastError(0); | ||
1205 | if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, 0) && | ||
1206 | (GetLastError() != 0)) | ||
1207 | { | ||
1208 | ERR("SetWindowLongPtr() failed"); | ||
1209 | return; | ||
1210 | } | ||
1211 | if (!SetWindowPos(window->window, HWND_NOTOPMOST, | ||
1212 | window->rect.left, | ||
1213 | window->rect.top, | ||
1214 | window->rect.right - window->rect.left, | ||
1215 | window->rect.bottom - window->rect.top, | ||
1216 | SWP_NOCOPYBITS | SWP_SHOWWINDOW)) | ||
1217 | { | ||
1218 | ERR("SetWindowPos() failed"); | ||
1219 | return; | ||
1220 | } | ||
1221 | } | ||
1222 | } | ||
1223 | |||
1224 | /** | ||
1225 | * @brief Set the given cursor to the given window. | ||
1226 | * | ||
1227 | * @param window The window to modify the cursor. | ||
1228 | * @param cursor The new cursor. | ||
1229 | * | ||
1230 | * This function sets @p cursor to @p window. @p cursor must have been | ||
1231 | * obtained by ecore_win32_cursor_new() or | ||
1232 | * ecore_win32_cursor_shaped_new(). If @p window or @p cursor is | ||
1233 | * @c NULL, the function does nothing. | ||
1234 | */ | ||
1235 | EAPI void | ||
1236 | ecore_win32_window_cursor_set(Ecore_Win32_Window *window, | ||
1237 | Ecore_Win32_Cursor *cursor) | ||
1238 | { | ||
1239 | INF("setting cursor"); | ||
1240 | |||
1241 | if (!window || !cursor) | ||
1242 | return; | ||
1243 | |||
1244 | if (!SetClassLongPtr(window->window, | ||
1245 | GCLP_HCURSOR, (LONG_PTR)cursor)) | ||
1246 | { | ||
1247 | ERR("SetClassLong() failed"); | ||
1248 | } | ||
1249 | } | ||
1250 | |||
1251 | /** | ||
1252 | * @brief Set the state of the given window. | ||
1253 | * | ||
1254 | * @param window The window to modify the state. | ||
1255 | * @param state An array of the new states. | ||
1256 | * @param num The number of states in the array. | ||
1257 | * | ||
1258 | * This function set the state of @p window. @p state is an array of | ||
1259 | * states of size @p num. If @p window or @p state are @c NULL, or if | ||
1260 | * @p num is less or equal than 0, the function does nothing. | ||
1261 | */ | ||
1262 | EAPI void | ||
1263 | ecore_win32_window_state_set(Ecore_Win32_Window *window, | ||
1264 | Ecore_Win32_Window_State *state, | ||
1265 | unsigned int num) | ||
1266 | { | ||
1267 | unsigned int i; | ||
1268 | |||
1269 | if (!window || !state || (num <= 0)) | ||
1270 | return; | ||
1271 | |||
1272 | INF("setting cursor state"); | ||
1273 | |||
1274 | for (i = 0; i < num; i++) | ||
1275 | { | ||
1276 | switch (state[i]) | ||
1277 | { | ||
1278 | case ECORE_WIN32_WINDOW_STATE_ICONIFIED: | ||
1279 | window->state.iconified = 1; | ||
1280 | break; | ||
1281 | case ECORE_WIN32_WINDOW_STATE_MODAL: | ||
1282 | window->state.modal = 1; | ||
1283 | break; | ||
1284 | case ECORE_WIN32_WINDOW_STATE_STICKY: | ||
1285 | window->state.sticky = 1; | ||
1286 | break; | ||
1287 | case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT: | ||
1288 | window->state.maximized_vert = 1; | ||
1289 | break; | ||
1290 | case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ: | ||
1291 | window->state.maximized_horz = 1; | ||
1292 | break; | ||
1293 | case ECORE_WIN32_WINDOW_STATE_MAXIMIZED: | ||
1294 | window->state.maximized_horz = 1; | ||
1295 | window->state.maximized_vert = 1; | ||
1296 | break; | ||
1297 | case ECORE_WIN32_WINDOW_STATE_SHADED: | ||
1298 | window->state.shaded = 1; | ||
1299 | break; | ||
1300 | case ECORE_WIN32_WINDOW_STATE_HIDDEN: | ||
1301 | window->state.hidden = 1; | ||
1302 | break; | ||
1303 | case ECORE_WIN32_WINDOW_STATE_FULLSCREEN: | ||
1304 | window->state.fullscreen = 1; | ||
1305 | break; | ||
1306 | case ECORE_WIN32_WINDOW_STATE_ABOVE: | ||
1307 | window->state.above = 1; | ||
1308 | break; | ||
1309 | case ECORE_WIN32_WINDOW_STATE_BELOW: | ||
1310 | window->state.below = 1; | ||
1311 | break; | ||
1312 | case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION: | ||
1313 | window->state.demands_attention = 1; | ||
1314 | break; | ||
1315 | case ECORE_WIN32_WINDOW_STATE_UNKNOWN: | ||
1316 | /* nothing to be done */ | ||
1317 | break; | ||
1318 | } | ||
1319 | } | ||
1320 | } | ||
1321 | |||
1322 | /** | ||
1323 | * @brief Apply the modification of the state to the given window. | ||
1324 | * | ||
1325 | * @param window The window. | ||
1326 | * @param state The state to apply changes. | ||
1327 | * @param set The value of the state change. | ||
1328 | * | ||
1329 | * This function applies the modification of the state @p state of | ||
1330 | * @p window. @p set is used only for | ||
1331 | * #ECORE_WIN32_WINDOW_STATE_ICONIFIED and | ||
1332 | * #ECORE_WIN32_WINDOW_STATE_FULLSCREEN. If @p window is @c NULL, the | ||
1333 | * function does nothing. | ||
1334 | */ | ||
1335 | EAPI void | ||
1336 | ecore_win32_window_state_request_send(Ecore_Win32_Window *window, | ||
1337 | Ecore_Win32_Window_State state, | ||
1338 | unsigned int set) | ||
1339 | { | ||
1340 | if (!window) return; | ||
1341 | |||
1342 | INF("sending cursor state"); | ||
1343 | |||
1344 | switch (state) | ||
1345 | { | ||
1346 | case ECORE_WIN32_WINDOW_STATE_ICONIFIED: | ||
1347 | if (window->state.iconified) | ||
1348 | ecore_win32_window_iconified_set(window, set); | ||
1349 | break; | ||
1350 | case ECORE_WIN32_WINDOW_STATE_MODAL: | ||
1351 | window->state.modal = 1; | ||
1352 | break; | ||
1353 | case ECORE_WIN32_WINDOW_STATE_STICKY: | ||
1354 | window->state.sticky = 1; | ||
1355 | break; | ||
1356 | case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT: | ||
1357 | if (window->state.maximized_vert) | ||
1358 | { | ||
1359 | RECT rect; | ||
1360 | int y; | ||
1361 | int height; | ||
1362 | |||
1363 | if (!SystemParametersInfo(SPI_GETWORKAREA, 0, | ||
1364 | &rect, 0)) | ||
1365 | { | ||
1366 | ERR("SystemParametersInfo() failed"); | ||
1367 | break; | ||
1368 | } | ||
1369 | y = rect.top; | ||
1370 | height = rect.bottom - rect.top; | ||
1371 | |||
1372 | if (!GetClientRect(window->window, &rect)) | ||
1373 | { | ||
1374 | ERR("GetClientRect() failed"); | ||
1375 | break; | ||
1376 | } | ||
1377 | |||
1378 | if (!MoveWindow(window->window, rect.left, y, | ||
1379 | rect.right - rect.left, | ||
1380 | height, | ||
1381 | TRUE)) | ||
1382 | { | ||
1383 | ERR("MoveWindow() failed"); | ||
1384 | } | ||
1385 | } | ||
1386 | break; | ||
1387 | case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ: | ||
1388 | if (window->state.maximized_horz) | ||
1389 | { | ||
1390 | RECT rect; | ||
1391 | |||
1392 | if (!GetClientRect(window->window, &rect)) | ||
1393 | { | ||
1394 | ERR("GetClientRect() failed"); | ||
1395 | break; | ||
1396 | } | ||
1397 | |||
1398 | if (!MoveWindow(window->window, 0, rect.top, | ||
1399 | GetSystemMetrics(SM_CXSCREEN), | ||
1400 | rect.bottom - rect.top, | ||
1401 | TRUE)) | ||
1402 | { | ||
1403 | ERR("MoveWindow() failed"); | ||
1404 | } | ||
1405 | } | ||
1406 | break; | ||
1407 | case ECORE_WIN32_WINDOW_STATE_MAXIMIZED: | ||
1408 | if (window->state.maximized_vert && window->state.maximized_horz) | ||
1409 | { | ||
1410 | RECT rect; | ||
1411 | |||
1412 | if (!SystemParametersInfo(SPI_GETWORKAREA, 0, | ||
1413 | &rect, 0)) | ||
1414 | { | ||
1415 | ERR("SystemParametersInfo() failed"); | ||
1416 | break; | ||
1417 | } | ||
1418 | |||
1419 | if (!MoveWindow(window->window, 0, 0, | ||
1420 | GetSystemMetrics(SM_CXSCREEN), | ||
1421 | rect.bottom - rect.top, | ||
1422 | TRUE)) | ||
1423 | { | ||
1424 | ERR("MoveWindow() failed"); | ||
1425 | } | ||
1426 | } | ||
1427 | break; | ||
1428 | case ECORE_WIN32_WINDOW_STATE_SHADED: | ||
1429 | window->state.shaded = 1; | ||
1430 | break; | ||
1431 | case ECORE_WIN32_WINDOW_STATE_HIDDEN: | ||
1432 | window->state.hidden = 1; | ||
1433 | break; | ||
1434 | case ECORE_WIN32_WINDOW_STATE_FULLSCREEN: | ||
1435 | if (window->state.fullscreen) | ||
1436 | ecore_win32_window_fullscreen_set(window, set); | ||
1437 | break; | ||
1438 | case ECORE_WIN32_WINDOW_STATE_ABOVE: | ||
1439 | if (window->state.above) | ||
1440 | if (!SetWindowPos(window->window, HWND_TOP, | ||
1441 | 0, 0, | ||
1442 | 0, 0, | ||
1443 | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) | ||
1444 | { | ||
1445 | ERR("SetWindowPos() failed"); | ||
1446 | } | ||
1447 | break; | ||
1448 | case ECORE_WIN32_WINDOW_STATE_BELOW: | ||
1449 | if (window->state.below) | ||
1450 | if (!SetWindowPos(window->window, HWND_BOTTOM, | ||
1451 | 0, 0, | ||
1452 | 0, 0, | ||
1453 | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) | ||
1454 | { | ||
1455 | ERR("SetWindowPos() failed"); | ||
1456 | } | ||
1457 | break; | ||
1458 | case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION: | ||
1459 | window->state.demands_attention = 1; | ||
1460 | break; | ||
1461 | case ECORE_WIN32_WINDOW_STATE_UNKNOWN: | ||
1462 | /* nothing to be done */ | ||
1463 | break; | ||
1464 | } | ||
1465 | } | ||
1466 | |||
1467 | /** | ||
1468 | * @brief Set the type of the given window. | ||
1469 | * | ||
1470 | * @param window The window to modify the type. | ||
1471 | * @param type The nwindow types. | ||
1472 | * | ||
1473 | * This function set the type of @p window to @p type. If | ||
1474 | * @p window is @c NULL, the function does nothing. | ||
1475 | */ | ||
1476 | EAPI void | ||
1477 | ecore_win32_window_type_set(Ecore_Win32_Window *window, | ||
1478 | Ecore_Win32_Window_Type type) | ||
1479 | { | ||
1480 | if (!window) | ||
1481 | return; | ||
1482 | |||
1483 | INF("setting window type"); | ||
1484 | |||
1485 | switch (type) | ||
1486 | { | ||
1487 | case ECORE_WIN32_WINDOW_TYPE_DESKTOP: | ||
1488 | window->type.desktop = 1; | ||
1489 | break; | ||
1490 | case ECORE_WIN32_WINDOW_TYPE_DOCK: | ||
1491 | window->type.dock = 1; | ||
1492 | break; | ||
1493 | case ECORE_WIN32_WINDOW_TYPE_TOOLBAR: | ||
1494 | window->type.toolbar = 1; | ||
1495 | break; | ||
1496 | case ECORE_WIN32_WINDOW_TYPE_MENU: | ||
1497 | window->type.menu = 1; | ||
1498 | break; | ||
1499 | case ECORE_WIN32_WINDOW_TYPE_UTILITY: | ||
1500 | window->type.utility = 1; | ||
1501 | break; | ||
1502 | case ECORE_WIN32_WINDOW_TYPE_SPLASH: | ||
1503 | window->type.splash = 1; | ||
1504 | break; | ||
1505 | case ECORE_WIN32_WINDOW_TYPE_DIALOG: | ||
1506 | window->type.dialog = 1; | ||
1507 | break; | ||
1508 | case ECORE_WIN32_WINDOW_TYPE_NORMAL: | ||
1509 | window->type.normal = 1; | ||
1510 | break; | ||
1511 | case ECORE_WIN32_WINDOW_TYPE_UNKNOWN: | ||
1512 | window->type.normal = 1; | ||
1513 | break; | ||
1514 | } | ||
1515 | } | ||
1516 | |||
1517 | /** | ||
1518 | * @} | ||
1519 | */ | ||