diff --git a/legacy/ecore/Makefile.am b/legacy/ecore/Makefile.am index ab2aec0096..bbd57eea01 100644 --- a/legacy/ecore/Makefile.am +++ b/legacy/ecore/Makefile.am @@ -143,7 +143,7 @@ if BUILD_ECORE_SDL pkgconfig_DATA += ecore-sdl.pc endif -if BUILD_ECORE_QUARTZ +if BUILD_ECORE_COCOA pkgconfig_DATA += ecore-cocoa.pc endif diff --git a/legacy/ecore/configure.ac b/legacy/ecore/configure.ac index b51051f849..11790c46e0 100644 --- a/legacy/ecore/configure.ac +++ b/legacy/ecore/configure.ac @@ -47,7 +47,7 @@ case "$host_os" in ecore_input_release_info="-release $release" ecore_input_evas_release_info="-release $release" ecore_ipc_release_info="-release $release" - ecore_quartz_release_info="-release $release" + ecore_cocoa_release_info="-release $release" ecore_release_info="-release $release" ecore_sdl_release_info="-release $release" ecore_win32_release_info="-release $release" @@ -65,7 +65,7 @@ AC_SUBST(ecore_imf_release_info) AC_SUBST(ecore_input_release_info) AC_SUBST(ecore_input_evas_release_info) AC_SUBST(ecore_ipc_release_info) -AC_SUBST(ecore_quartz_release_info) +AC_SUBST(ecore_cocoa_release_info) AC_SUBST(ecore_release_info) AC_SUBST(ecore_sdl_release_info) AC_SUBST(ecore_win32_release_info) @@ -120,7 +120,7 @@ want_evas_simple_x11="no" want_ecore_x_xcb="no" want_ecore_x="no" want_ecore_win32="no" -want_ecore_quartz="no" +want_ecore_cocoa="no" want_ecore_sdl="no" want_ecore_fb="no" want_ecore_directfb="no" @@ -156,7 +156,7 @@ want_ecore_evas_software_ddraw="no" want_ecore_evas_direct3d="no" want_ecore_evas_opengl_glew="no" want_ecore_evas_software_16_ddraw="no" -want_ecore_evas_quartz="no" +want_ecore_evas_cocoa="no" want_ecore_evas_software_sdl="no" want_ecore_evas_gl_sdl="no" want_ecore_evas_directfb="no" @@ -191,8 +191,8 @@ case "$host_os" in want_openssl="auto" want_ecore_ipc="yes" want_ecore_imf="yes" - want_ecore_quartz="yes" - want_ecore_evas_quartz="yes" + want_ecore_cocoa="yes" + want_ecore_evas_cocoa="yes" want_ecore_evas_software_sdl="yes" want_ecore_evas_gl_sdl="yes" ;; @@ -234,7 +234,7 @@ requirements_ecore_imf_evas="" requirements_ecore_input="" requirements_ecore_input_evas="" requirements_ecore_ipc="" -requirements_ecore_quartz="" +requirements_ecore_cocoa="" requirements_ecore_sdl="" requirements_ecore_x="" requirements_ecore_win32="" @@ -411,7 +411,7 @@ requirements_ecore_imf_evas="ecore eina-0 ${requirements_ecore_imf_evas}" requirements_ecore_input="ecore eina-0 ${requirements_ecore_input}" requirements_ecore_input_evas="ecore eina-0 ${requirements_ecore_input_evas}" requirements_ecore_ipc="ecore eina-0 ${requirements_ecore_ipc}" -requirements_ecore_quartz="ecore eina-0 ${requirements_ecore_quartz}" +requirements_ecore_cocoa="ecore eina-0 ${requirements_ecore_cocoa}" requirements_ecore_sdl="ecore eina-0 ${requirements_ecore_sdl}" requirements_ecore_win32="ecore eina-0 ${requirements_ecore_win32}" requirements_ecore_wince="ecore eina-0 ${requirements_ecore_wince}" @@ -868,23 +868,23 @@ have_fb="no" AC_CHECK_HEADER([linux/fb.h], [AC_CHECK_HEADER([linux/input.h], [have_fb="yes"])]) -# Quartz header files (ecore_quartz) +# Cocoa header files (ecore_cocoa) -quartz_ldflags=""; -have_quartz="no" +cocoa_ldflags=""; +have_cocoa="no" if test "x${have_gnu_objc}" = "xyes" ; then AC_LANG_PUSH([Objective C]) AC_CHECK_HEADER([Cocoa/Cocoa.h], [ - have_quartz="yes" - quartz_ldflags="-framework Cocoa" + have_cocoa="yes" + cocoa_ldflags="-framework Cocoa" ], - [have_quartz="no"]) + [have_cocoa="no"]) AC_LANG_POP([Objective C]) fi -AC_SUBST(quartz_ldflags) +AC_SUBST(cocoa_ldflags) # basic pthread support @@ -1092,15 +1092,15 @@ ECORE_CHECK_MODULE([win32], [${want_ecore_win32}], [Win32], [${have_ecore_input} ]) AC_SUBST(ecore_win32_libs) -# ecore_quartz +# ecore_cocoa -ecore_quartz_deps="no" -if test "x${have_ecore_input}" = "xyes" -a "x${have_quartz}" = "xyes" ; then - ecore_quartz_deps="yes" +ecore_cocoa_deps="no" +if test "x${have_ecore_input}" = "xyes" -a "x${have_cocoa}" = "xyes" ; then + ecore_cocoa_deps="yes" fi -ECORE_CHECK_MODULE([quartz], [${want_ecore_quartz}], [Quartz], [${ecore_quartz_deps}], - [requirements_ecore_quartz="ecore-input ${requirements_ecore_quartz}"]) +ECORE_CHECK_MODULE([cocoa], [${want_ecore_cocoa}], [Cocoa], [${ecore_cocoa_deps}], + [requirements_ecore_cocoa="ecore-input ${requirements_ecore_cocoa}"]) # ecore_sdl @@ -1249,13 +1249,13 @@ if test "x${have_ecore_evas_software_gdi}" = "xyes" -o \ requirements_ecore_evas="ecore-win32 ${requirements_ecore_evas}" fi -# ecore_evas_quartz +# ecore_evas_cocoa -ECORE_EVAS_CHECK_MODULE([quartz], - [${want_ecore_evas_quartz}], - [Quartz], - [${have_ecore_quartz}], - [requirements_ecore_evas="ecore-quartz ${requirements_ecore_evas}"]) +ECORE_EVAS_CHECK_MODULE([cocoa], + [${want_ecore_evas_cocoa}], + [Cocoa], + [${have_ecore_cocoa}], + [requirements_ecore_evas="ecore-cocoa ${requirements_ecore_evas}"]) # ecore_evas_software_sdl @@ -1313,7 +1313,7 @@ AC_SUBST(requirements_ecore_imf_evas) AC_SUBST(requirements_ecore_input) AC_SUBST(requirements_ecore_input_evas) AC_SUBST(requirements_ecore_ipc) -AC_SUBST(requirements_ecore_quartz) +AC_SUBST(requirements_ecore_cocoa) AC_SUBST(requirements_ecore_sdl) AC_SUBST(requirements_ecore_x) AC_SUBST(requirements_ecore_win32) @@ -1350,7 +1350,7 @@ src/lib/ecore_directfb/Makefile src/lib/ecore_evas/Makefile src/lib/ecore_fb/Makefile src/lib/ecore_file/Makefile -src/lib/ecore_quartz/Makefile +src/lib/ecore_cocoa/Makefile src/lib/ecore_sdl/Makefile src/lib/ecore_imf/Makefile src/lib/ecore_imf_evas/Makefile @@ -1456,7 +1456,7 @@ else echo " Ecore_X......................: $have_ecore_x" fi echo " Ecore_Win32..................: $have_ecore_win32" -echo " Ecore_Quartz.................: $have_ecore_quartz" +echo " Ecore_Cocoa..................: $have_ecore_cocoa" echo " Ecore_SDL....................: $have_ecore_sdl" echo " Ecore_FB.....................: $have_ecore_fb" if test "x${have_ecore_fb}" = "xyes" ; then @@ -1484,7 +1484,7 @@ if test "x${have_ecore_evas}" = "xyes" ; then echo " Software DirectDraw........: $have_ecore_evas_software_ddraw" echo " Direct3D...................: $have_ecore_evas_direct3d" echo " OpenGL Glew................: $have_ecore_evas_opengl_glew" - echo " Quartz.....................: $have_ecore_evas_quartz" + echo " Cocoa......................: $have_ecore_evas_cocoa" echo " Software SDL...............: $have_ecore_evas_software_sdl" echo " OpenGL SDL.................: $have_ecore_evas_opengl_sdl" echo " DirectFB...................: $have_ecore_evas_directfb" diff --git a/legacy/ecore/src/lib/Makefile.am b/legacy/ecore/src/lib/Makefile.am index 1ccc5a3ac5..0c00c6a40c 100644 --- a/legacy/ecore/src/lib/Makefile.am +++ b/legacy/ecore/src/lib/Makefile.am @@ -11,7 +11,7 @@ ecore_x \ ecore_win32 \ ecore_wince \ ecore_sdl \ -ecore_quartz \ +ecore_cocoa \ ecore_ipc \ ecore_evas \ ecore_config \ diff --git a/legacy/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h b/legacy/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h new file mode 100644 index 0000000000..a3a11fda39 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h @@ -0,0 +1,137 @@ +/* +* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 +*/ + +#ifndef _ECORE_COCOA_H +#define _ECORE_COCOA_H + +#ifdef EAPI +# undef EAPI +#endif + +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; + +EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS; +EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS; +EAPI extern int ECORE_COCOA_EVENT_RESIZE; +EAPI extern int ECORE_COCOA_EVENT_EXPOSE; + +typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize; +struct _Ecore_Cocoa_Event_Video_Resize +{ + int w; + int h; +}; + + +/* Core */ + +EAPI int ecore_cocoa_init(const char *name); +EAPI int ecore_cocoa_shutdown(void); +EAPI void ecore_cocoa_feed_events(void); + +/* Window */ + +EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x, + int y, + int width, + int height); + +EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window); + +EAPI void *ecore_cocoa_window_hwnd_get(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window, + int x, + int y); + +EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window, + int width, + int height); + +EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window, + int x, + int y, + int width, + int height); + +EAPI void ecore_cocoa_window_geometry_get(Ecore_Cocoa_Window *window, + int *x, + int *y, + int *width, + int *height); + +EAPI void ecore_cocoa_window_size_get(Ecore_Cocoa_Window *window, + int *width, + int *height); + +EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window, + unsigned int min_width, + unsigned int min_height); + +EAPI void ecore_cocoa_window_size_min_get(Ecore_Cocoa_Window *window, + unsigned int *min_width, + unsigned int *min_height); + +EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window, + unsigned int max_width, + unsigned int max_height); + +EAPI void ecore_cocoa_window_size_max_get(Ecore_Cocoa_Window *window, + unsigned int *max_width, + unsigned int *max_height); + +EAPI void ecore_cocoa_window_size_base_set(Ecore_Cocoa_Window *window, + unsigned int base_width, + unsigned int base_height); + +EAPI void ecore_cocoa_window_size_base_get(Ecore_Cocoa_Window *window, + unsigned int *base_width, + unsigned int *base_height); + +EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window, + unsigned int step_width, + unsigned int step_height); + +EAPI void ecore_cocoa_window_size_step_get(Ecore_Cocoa_Window *window, + unsigned int *step_width, + unsigned int *step_height); + +EAPI void ecore_cocoa_window_show(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_hide(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, + const char *title); + +EAPI void ecore_cocoa_window_focus_set(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window, + int on); + +EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window, + int on); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/legacy/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h b/legacy/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h new file mode 100644 index 0000000000..cafd50325e --- /dev/null +++ b/legacy/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h @@ -0,0 +1,285 @@ +#ifndef ECORE_COCOA_KEYS_H__ +#define ECORE_COCOA_KEYS_H__ + +struct _ecore_cocoa_keys_s +{ + int code; + const char *name; + const char *compose; +}; + +static const struct _ecore_cocoa_keys_s keystable[] = +{ + +{ 0, "0x00", "" }, +{ 0, "First", "" }, +{ 3, "Return", "\015" }, +{ 8, "BackSpace", "\010" }, +{ 9, "Tab", "\011" }, +{ 12, "Clear", "" }, +{ 13, "Return", "\015" }, +{ 19, "Pause", "" }, +{ 25, "BackTab", ""}, +{ 27, "Escape", "" }, +{ 32, "space", " " }, +{ 33, "exclam", "!" }, +{ 34, "quotedbl", "\"" }, +{ 35, "numbersign", "#" }, +{ 36, "dollar", "$" }, +{ 37, "percent", "%%" }, +{ 38, "ampersand", "&" }, +{ 39, "apostrophe", "'" }, +{ 40, "parenleft", "(" }, +{ 41, "parenright", ")" }, +{ 42, "asterik", "*" }, +{ 43, "plus", "+" }, +{ 44, "comma", "," }, +{ 45, "minus", "-" }, +{ 46, "period", "." }, +{ 47, "slash", "/" }, +{ 48, "0", "0" }, +{ 49, "1", "1" }, +{ 50, "2", "2" }, +{ 51, "3", "3" }, +{ 52, "4", "4" }, +{ 53, "5", "5" }, +{ 54, "6", "6" }, +{ 55, "7", "7" }, +{ 56, "8", "8" }, +{ 57, "9", "9" }, +{ 58, "colon", ";" }, +{ 59, "semicolon", ";" }, +{ 60, "less", "<" }, +{ 61, "equal", "=" }, +{ 62, "greater", ">" }, +{ 63, "question", "?" }, +{ 64, "at", "@" }, + +{ 91, "bracketleft", "[" }, +{ 92, "backslash", "\\" }, +{ 93, "bracketright", "]" }, +{ 94, "asciicircumm", "^" }, +{ 95, "underscore", "_" }, +{ 96, "backquote", "`" }, +{ 97, "a", "a" }, +{ 98, "b", "b" }, +{ 99, "c", "c" }, +{ 100, "d", "d" }, +{ 101, "e", "e" }, +{ 102, "f", "f" }, +{ 103, "g", "g" }, +{ 104, "h", "h" }, +{ 105, "i", "i" }, +{ 106, "j", "j" }, +{ 107, "k", "k" }, +{ 108, "l", "l" }, +{ 109, "m", "m" }, +{ 110, "n", "n" }, +{ 111, "o", "o" }, +{ 112, "p", "p" }, +{ 113, "q", "q" }, +{ 114, "r", "r" }, +{ 115, "s", "s" }, +{ 116, "t", "t" }, +{ 117, "u", "u" }, +{ 118, "v", "v" }, +{ 119, "w", "w" }, +{ 120, "x", "x" }, +{ 121, "y", "y" }, +{ 122, "z", "z" }, +{ 123, "braceleft", "" }, +{ 124, "pipe", "" }, +{ 125, "braceright", "" }, +{ 127, "Delete", "\177" }, +{ 126, "asciitilde", "~" }, + +{ 160, "w0", "" }, +{ 161, "w1", "" }, +{ 162, "w2", "" }, +{ 163, "w3", "" }, +{ 164, "w4", "" }, +{ 165, "w5", "" }, +{ 166, "w6", "" }, +{ 167, "w7", "" }, +{ 168, "w8", "" }, +{ 169, "w9", "" }, +{ 170, "w10", "" }, +{ 171, "w11", "" }, +{ 172, "w12", "" }, +{ 173, "w13", "" }, +{ 174, "w14", "" }, +{ 175, "w15", "" }, +{ 176, "w16", "" }, +{ 177, "w17", "" }, +{ 178, "w18", "" }, +{ 179, "w19", "" }, +{ 180, "w20", "" }, +{ 181, "w21", "" }, +{ 182, "w22", "" }, +{ 183, "w23", "" }, +{ 184, "w24", "" }, +{ 185, "w25", "" }, +{ 186, "w26", "" }, +{ 187, "w27", "" }, +{ 188, "w28", "" }, +{ 189, "w29", "" }, +{ 190, "w30", "" }, +{ 191, "w31", "" }, +{ 192, "w32", "" }, +{ 193, "w33", "" }, +{ 194, "w34", "" }, +{ 195, "w35", "" }, +{ 196, "w36", "" }, +{ 197, "w37", "" }, +{ 198, "w38", "" }, +{ 199, "w39", "" }, +{ 200, "w40", "" }, +{ 201, "w41", "" }, +{ 202, "w42", "" }, +{ 203, "w43", "" }, +{ 204, "w44", "" }, +{ 205, "w45", "" }, +{ 206, "w46", "" }, +{ 207, "w47", "" }, +{ 208, "w48", "" }, +{ 209, "w49", "" }, +{ 210, "w50", "" }, +{ 211, "w51", "" }, +{ 212, "w52", "" }, +{ 213, "w53", "" }, +{ 214, "w54", "" }, +{ 215, "w55", "" }, +{ 216, "w56", "" }, +{ 217, "w57", "" }, +{ 218, "w58", "" }, +{ 219, "w59", "" }, +{ 220, "w60", "" }, +{ 221, "w61", "" }, +{ 222, "w62", "" }, +{ 223, "w63", "" }, +{ 224, "w64", "" }, +{ 225, "w65", "" }, +{ 226, "w66", "" }, +{ 227, "w67", "" }, +{ 228, "w68", "" }, +{ 229, "w69", "" }, +{ 230, "w70", "" }, +{ 231, "w71", "" }, +{ 232, "w72", "" }, +{ 233, "w73", "" }, +{ 234, "w74", "" }, +{ 235, "w75", "" }, +{ 236, "w76", "" }, +{ 237, "w77", "" }, +{ 238, "w78", "" }, +{ 239, "w79", "" }, +{ 240, "w80", "" }, +{ 241, "w81", "" }, +{ 242, "w82", "" }, +{ 243, "w83", "" }, +{ 244, "w84", "" }, +{ 245, "w85", "" }, +{ 246, "w86", "" }, +{ 247, "w87", "" }, +{ 248, "w88", "" }, +{ 249, "w89", "" }, +{ 250, "w90", "" }, +{ 251, "w91", "" }, +{ 252, "w92", "" }, +{ 253, "w93", "" }, +{ 254, "w94", "" }, +{ 255, "w95", "" }, + +{ 256, "KP0", "0" }, +{ 257, "KP1", "1" }, +{ 258, "KP2", "2" }, +{ 259, "KP3", "3" }, +{ 260, "KP4", "4" }, +{ 261, "KP5", "5" }, +{ 262, "KP6", "6" }, +{ 263, "KP7", "7" }, +{ 264, "KP8", "8" }, +{ 265, "KP9", "9" }, +{ 266, "period", "." }, +{ 267, "KP_Divide", "/" }, +{ 268, "KP_Multiply", "*" }, +{ 269, "KP_Minus", "-" }, +{ 270, "KP_Plus", "+" }, +{ 271, "KP_Enter", "\015" }, +{ 272, "KP_Equals", "=" }, + +{ NSUpArrowFunctionKey, "Up", "" }, +{ NSDownArrowFunctionKey, "Down", "" }, +{ NSRightArrowFunctionKey, "Right", "" }, +{ NSLeftArrowFunctionKey, "Left", "" }, +{ NSInsertFunctionKey, "Insert", "" }, +{ NSHomeFunctionKey, "Home", "" }, +{ NSEndFunctionKey, "End", "" }, +{ NSPageUpFunctionKey, "Page_Up", "" }, +{ NSPageDownFunctionKey, "Page_Down", "" }, + +{ NSF1FunctionKey, "F1", "" }, +{ NSF2FunctionKey, "F2", "" }, +{ NSF3FunctionKey, "F3", "" }, +{ NSF4FunctionKey, "F4", "" }, +{ NSF5FunctionKey, "F5", "" }, +{ NSF6FunctionKey, "F6", "" }, +{ NSF7FunctionKey, "F7", "" }, +{ NSF8FunctionKey, "F8", "" }, +{ NSF9FunctionKey, "F9", "" }, +{ NSF10FunctionKey, "F10", "" }, +{ NSF11FunctionKey, "F11", "" }, +{ NSF12FunctionKey, "F12", "" }, +{ NSF13FunctionKey, "F13", "" }, +{ NSF14FunctionKey, "F14", "" }, +{ NSF15FunctionKey, "F15", "" }, +{ NSF16FunctionKey, "F16", "" }, +{ NSF17FunctionKey, "F17", "" }, +{ NSF18FunctionKey, "F18", "" }, +{ NSF19FunctionKey, "F19", "" }, +{ NSF20FunctionKey, "F20", "" }, +{ NSF21FunctionKey, "F21", "" }, +{ NSF22FunctionKey, "F22", "" }, +{ NSF23FunctionKey, "F23", "" }, +{ NSF24FunctionKey, "F24", "" }, +{ NSF25FunctionKey, "F25", "" }, +{ NSF26FunctionKey, "F26", "" }, +{ NSF27FunctionKey, "F27", "" }, +{ NSF28FunctionKey, "F28", "" }, +{ NSF29FunctionKey, "F29", "" }, +{ NSF30FunctionKey, "F30", "" }, +{ NSF31FunctionKey, "F31", "" }, +{ NSF32FunctionKey, "F32", "" }, +{ NSF33FunctionKey, "F33", "" }, +{ NSF34FunctionKey, "F34", "" }, +{ NSF35FunctionKey, "F35", "" }, + +{ NSClearLineFunctionKey, "Num_Lock", "" }, +{ 301, "Caps_Lock", "" }, +{ NSScrollLockFunctionKey, "Scroll_Lock", "" }, +{ 303, "Shift_R", "" }, +{ 304, "Shift_L", "" }, +{ 305, "Control_R", "" }, +{ 306, "Control_L", "" }, +{ 307, "Alt_R", "" }, +{ 308, "Alt_L", "" }, +{ 309, "Meta_R", "" }, +{ 310, "Meta_L", "" }, +{ 311, "Super_L", "" }, +{ 312, "Super_R", "" }, + +{ NSModeSwitchFunctionKey, "Mode", "" }, +{ 314, "Compose", "" }, + +{ NSHelpFunctionKey, "Help", "" }, +{ NSPrintFunctionKey, "Print", "" }, +{ NSSysReqFunctionKey, "SysReq", "" }, +{ NSBreakFunctionKey, "Break", "" }, +{ NSMenuFunctionKey, "Menu", "" }, +{ 320, "Power", "" }, +{ 321, "Euro", "" }, +{ NSUndoFunctionKey, "Undo", "" } + +}; + +#endif /* ECORE_COCOA_KEYS_H__ */ diff --git a/legacy/ecore/src/lib/ecore_cocoa/Makefile.am b/legacy/ecore/src/lib/ecore_cocoa/Makefile.am new file mode 100644 index 0000000000..190d0fa9da --- /dev/null +++ b/legacy/ecore/src/lib/ecore_cocoa/Makefile.am @@ -0,0 +1,32 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +if BUILD_ECORE_COCOA + +lib_LTLIBRARIES = libecore_cocoa.la +include_HEADERS = \ +Ecore_Cocoa.h \ +Ecore_Cocoa_Keys.h + +libecore_cocoa_la_SOURCES = \ +ecore_cocoa.m \ +ecore_cocoa_window.m + +libecore_cocoa_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ + +libecore_cocoa_la_LDFLAGS = @cocoa_ldflags@ -version-info @version_info@ @ecore_cocoa_release_info@ + +endif + +EXTRA_DIST = ecore_cocoa_private.h diff --git a/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa.m b/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa.m new file mode 100644 index 0000000000..ad2e767339 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa.m @@ -0,0 +1,280 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include + +#include +#include +#include + +#include "Ecore_Cocoa.h" +#include "Ecore_Cocoa_Keys.h" + +EAPI int ECORE_COCOA_EVENT_GOT_FOCUS = 0; +EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0; +EAPI int ECORE_COCOA_EVENT_RESIZE = 0; +EAPI int ECORE_COCOA_EVENT_EXPOSE = 0; + +static int _ecore_cocoa_init_count = 0; + +static int old_flags; + +EAPI int +ecore_cocoa_init(const char *name __UNUSED__) +{ + if (++_ecore_cocoa_init_count != 1) + return _ecore_cocoa_init_count; + + if (!ecore_event_init()) + return --_ecore_cocoa_init_count; + + ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); + ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); + ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); + ECORE_COCOA_EVENT_EXPOSE = ecore_event_type_new(); + + return _ecore_cocoa_init_count; +} + +/** + * Shuts down the Ecore_Cocoa library. + * @return @c The number of times the system has been initialised without + * being shut down. + * @ingroup Ecore_Cocoa_Library_Group + */ +EAPI int +ecore_cocoa_shutdown(void) +{ + if (--_ecore_cocoa_init_count != 0) + return _ecore_cocoa_init_count; + + ecore_event_shutdown(); + + return _ecore_cocoa_init_count; +} + +EAPI void +ecore_cocoa_feed_events(void) +{ + NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0.001]; + NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:date + inMode:NSDefaultRunLoopMode + dequeue:YES]; + [date release]; + if (!event) return; // SDL loops until null; maybe we should do that too. or not. + + unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); + + switch([event type]) + { + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSOtherMouseDragged: + { + Ecore_Event_Mouse_Move * ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!ev) return; + ev->x = [event locationInWindow].x; + ev->y = [event locationInWindow].y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->timestamp = time; + ev->window = [event window]; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); + + [NSApp sendEvent:event]; // pass along mouse events, for window manager + break; + } + case NSLeftMouseDown: + case NSRightMouseDown: + case NSOtherMouseDown: + { + Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return; + ev->x = [event locationInWindow].x; + ev->y = [event locationInWindow].y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->timestamp = time; + ev->buttons = [event buttonNumber] + 1; // Apple indexes buttons from 0 + + if ([event clickCount] == 2) + ev->double_click = 1; + else + ev->double_click = 0; + + if ([event clickCount] >= 3) + ev->triple_click = 1; + else + ev->triple_click = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); + + [NSApp sendEvent:event]; // pass along mouse events, for window manager + break; + } + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: + { + Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return; + ev->x = [event locationInWindow].x; + ev->y = [event locationInWindow].y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->timestamp = time; + ev->buttons = [event buttonNumber] + 1; // Apple indexes buttons from 0 + + if ([event clickCount] == 2) + ev->double_click = 1; + else + ev->double_click = 0; + + if ([event clickCount] >= 3) + ev->triple_click = 1; + else + ev->triple_click = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); + + [NSApp sendEvent:event]; // pass along mouse events, for window manager + break; + } + case NSKeyDown: + { + Ecore_Event_Key *ev; + unsigned int i; + + ev = calloc(1, sizeof (Ecore_Event_Key)); + if (!ev) return; + ev->timestamp = time; + + for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + { + if (keystable[i].code == tolower([[event charactersIgnoringModifiers] characterAtIndex:0])) + { + ev->keyname = keystable[i].name; + ev->string = keystable[i].compose; + + ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); + return; + } + } + + break; + } + case NSKeyUp: + { + Ecore_Event_Key *ev; + unsigned int i; + + ev = calloc(1, sizeof (Ecore_Event_Key)); + if (!ev) return; + ev->timestamp = time; + + for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + { + if (keystable[i].code == tolower([[event charactersIgnoringModifiers] characterAtIndex:0])) + { + ev->keyname = keystable[i].name; + ev->string = keystable[i].compose; + + ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); + return; + } + } + + break; + } + case NSFlagsChanged: + { + int flags = [event modifierFlags]; + + Ecore_Event_Key *evDown = NULL; + Ecore_Event_Key *evUp = NULL; + + evDown = calloc(1, sizeof (Ecore_Event_Key)); + if (!evDown) return; + + evUp = calloc(1, sizeof (Ecore_Event_Key)); + if (!evUp) + { + free(evDown); + return; + } + + // Turn special key flags on + if (flags & NSShiftKeyMask) + evDown->keyname = "Shift_L"; + else if (flags & NSControlKeyMask) + evDown->keyname = "Control_L"; + else if (flags & NSAlternateKeyMask) + evDown->keyname = "Alt_L"; + else if (flags & NSCommandKeyMask) + evDown->keyname = "Super_L"; + else if (flags & NSAlphaShiftKeyMask) + evDown->keyname = "Caps_Lock"; + + if (evDown->keyname) + { + evDown->timestamp = time; + evDown->string = ""; + ecore_event_add(ECORE_EVENT_KEY_DOWN, evDown, NULL, NULL); + old_flags = flags; + break; + } + + int changed_flags = flags ^ old_flags; + + // Turn special key flags off + if (changed_flags & NSShiftKeyMask) + evUp->keyname = "Shift_L"; + else if (changed_flags & NSControlKeyMask) + evUp->keyname = "Control_L"; + else if (changed_flags & NSAlternateKeyMask) + evUp->keyname = "Alt_L"; + else if (changed_flags & NSCommandKeyMask) + evUp->keyname = "Super_L"; + else if (changed_flags & NSAlphaShiftKeyMask) + evUp->keyname = "Caps_Lock"; + + if (evUp->keyname) + { + evUp->timestamp = time; + evUp->string = ""; + ecore_event_add(ECORE_EVENT_KEY_UP, evUp, NULL, NULL); + old_flags = flags; + break; + } + + break; + } + case NSAppKitDefined: + { + if ([event subtype] == NSApplicationActivatedEventType) + ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, NULL, NULL, NULL); + else if ([event subtype] == NSApplicationDeactivatedEventType) + ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, NULL, NULL, NULL); + [NSApp sendEvent:event]; // pass along AppKit events, for window manager + break; + } + case NSScrollWheel: + { + break; + } + default: + { + [NSApp sendEvent:event]; + break; + } + } + + [event release]; +} diff --git a/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h b/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h new file mode 100644 index 0000000000..05bdc1f715 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h @@ -0,0 +1,13 @@ +#ifndef _ECORE_COCOA_PRIVATE_H +#define _ECORE_COCOA_PRIVATE_H + + +struct _Ecore_Cocoa_Window +{ + NSWindow *window; + + unsigned int borderless : 1; +}; + + +#endif diff --git a/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m b/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m new file mode 100644 index 0000000000..751bde4fc3 --- /dev/null +++ b/legacy/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m @@ -0,0 +1,110 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore_Cocoa.h" + +Ecore_Cocoa_Window * +ecore_cocoa_window_new(int x, + int y, + int width, + int height) +{ + NSWindow *window; + + window = [[NSWindow alloc] + initWithContentRect:NSMakeRect(x, y, width, height) + styleMask:(NSTitledWindowMask | + NSClosableWindowMask | + NSResizableWindowMask | + NSMiniaturizableWindowMask) + backing:NSBackingStoreBuffered + defer:NO + screen:nil + ]; + if (!window) + return NULL; + + return window; +} + +void +ecore_cocoa_window_free(Ecore_Cocoa_Window *window) +{ + if (!window) + return; + + [window release]; +} + +void +ecore_cocoa_window_move(Ecore_Cocoa_Window *window, + int x, + int y) +{ + if (!window) + return; +} + +void +ecore_cocoa_window_resize(Ecore_Cocoa_Window *window, + int width, + int height) +{ + if (!window) + return; + + [window setContentSize: NSMakeSize(width, height)]; +} + +void +ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window, + int x, + int y, + int width, + int height) +{ + if (!window) + return; +} + +void +ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, const char *title) +{ + if (!window || !title) + return; + + [window setTitle:[NSString stringWithUTF8String:title]]; +} + +void +ecore_cocoa_window_show(Ecore_Cocoa_Window *window) +{ + if (!window || [window isVisible]) + return; + + [window orderFront:NSApp]; +} + +void +ecore_cocoa_window_hide(Ecore_Cocoa_Window *window) +{ + if (!window || ![window isVisible]) + return; + + [window orderOut:NSApp]; +} + +void +ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window, + int on) +{ + if (!window) + return; + + if (on) + [window setContentBorderThickness:0.0 + forEdje:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge]; +} diff --git a/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h b/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h index df3344d25d..a113bdb598 100644 --- a/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h +++ b/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h @@ -64,7 +64,7 @@ extern "C" { #define HAVE_ECORE_EVAS_X11_16 1 #define HAVE_ECORE_EVAS_DIRECTFB 1 #define HAVE_ECORE_EVAS_WIN32 1 -#define HAVE_ECORE_EVAS_QUARTZ 1 +#define HAVE_ECORE_EVAS_COCOA 1 #define HAVE_ECORE_EVAS_SDL 1 #define HAVE_ECORE_EVAS_WINCE 1 @@ -80,7 +80,7 @@ typedef enum _Ecore_Evas_Engine_Type ECORE_EVAS_ENGINE_SOFTWARE_DDRAW, ECORE_EVAS_ENGINE_DIRECT3D, ECORE_EVAS_ENGINE_OPENGL_GLEW, - ECORE_EVAS_ENGINE_QUARTZ, + ECORE_EVAS_ENGINE_COCOA, ECORE_EVAS_ENGINE_SOFTWARE_SDL, ECORE_EVAS_ENGINE_DIRECTFB, ECORE_EVAS_ENGINE_SOFTWARE_FB, diff --git a/legacy/ecore/src/lib/ecore_evas/Makefile.am b/legacy/ecore/src/lib/ecore_evas/Makefile.am index 99f0c830de..adabce7d0f 100644 --- a/legacy/ecore/src/lib/ecore_evas/Makefile.am +++ b/legacy/ecore/src/lib/ecore_evas/Makefile.am @@ -42,12 +42,12 @@ ECORE_SDL_LIB = ECORE_SDL_LIBADD = endif -if BUILD_ECORE_QUARTZ -ECORE_QUARTZ_INC = -I$(top_srcdir)/src/lib/ecore_quartz -xobjective-c -ECORE_QUARTZ_LIB = $(top_builddir)/src/lib/ecore_quartz/libecore_cocoa.la +if BUILD_ECORE_COCOA +ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa -xobjective-c +ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la else -ECORE_QUARTZ_INC = -ECORE_QUARTZ_LIB = +ECORE_COCOA_INC = +ECORE_COCOA_LIB = endif if BUILD_ECORE_WINCE @@ -73,7 +73,7 @@ $(ECORE_FB_INC) \ $(ECORE_DIRECTFB_INC) \ $(ECORE_WIN32_INC) \ $(ECORE_SDL_INC) \ -$(ECORE_QUARTZ_INC) \ +$(ECORE_COCOA_INC) \ $(ECORE_WINCE_INC) \ @EVAS_CFLAGS@ \ @XCB_CFLAGS@ \ @@ -107,7 +107,7 @@ $(ECORE_DIRECTFB_LIB) \ $(ECORE_WIN32_LIB) \ $(ECORE_SDL_LIB) \ $(ECORE_SDL_LIBADD) \ -$(ECORE_QUARTZ_LIB) \ +$(ECORE_COCOA_LIB) \ $(ECORE_WINCE_LIB) \ $(top_builddir)/src/lib/ecore_input/libecore_input.la \ $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ @@ -116,7 +116,7 @@ $(top_builddir)/src/lib/ecore/libecore.la \ @EINA_LIBS@ \ @EVIL_LIBS@ -libecore_evas_la_LDFLAGS = @quartz_ldflags@ -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @ecore_evas_release_info@ +libecore_evas_la_LDFLAGS = @cocoa_ldflags@ -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @ecore_evas_release_info@ endif diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas.c index 3bf362caa5..adb43c84fa 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas.c @@ -173,8 +173,8 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) #else return 0; #endif - case ECORE_EVAS_ENGINE_QUARTZ: -#ifdef BUILD_ECORE_EVAS_QUARTZ + case ECORE_EVAS_ENGINE_COCOA: +#ifdef BUILD_ECORE_EVAS_COCOA return 1; #else return 0; @@ -392,15 +392,15 @@ _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *ext } #endif -#ifdef BUILD_ECORE_EVAS_QUARTZ +#ifdef BUILD_ECORE_EVAS_COCOA static Ecore_Evas * -_ecore_evas_constructor_quartz(int x, int y, int w, int h, const char *extra_options) +_ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options) { char *name = NULL; Ecore_Evas *ee; _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); - ee = ecore_evas_quartz_new(name, w, h); + ee = ecore_evas_cocoa_new(name, w, h); free(name); if (ee) ecore_evas_move(ee, x, y); @@ -672,8 +672,8 @@ static const struct ecore_evas_engine _engines[] = { #endif /* Apple */ -#ifdef BUILD_ECORE_EVAS_QUARTZ - {"quartz", _ecore_evas_constructor_quartz}, +#ifdef BUILD_ECORE_EVAS_COCOA + {"cocoa", _ecore_evas_constructor_cocoa}, #endif /* Last chance to have a window */ diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c index b7270fa3a2..f1b344508c 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -6,7 +6,7 @@ # include #endif -#ifdef BUILD_ECORE_EVAS_QUARTZ +#ifdef BUILD_ECORE_EVAS_COCOA #import #endif @@ -18,7 +18,7 @@ #include "ecore_evas_private.h" #include "Ecore_Evas.h" -#ifdef BUILD_ECORE_EVAS_QUARTZ +#ifdef BUILD_ECORE_EVAS_COCOA #include "Ecore_Cocoa.h" #include "Evas_Engine_Quartz.h" @@ -349,7 +349,7 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = EAPI Ecore_Evas * ecore_evas_cocoa_new(const char* name, int w, int h) { -#ifdef BUILD_ECORE_EVAS_QUARTZ +#ifdef BUILD_ECORE_EVAS_COCOA Evas_Engine_Info_Quartz *einfo; Ecore_Evas *ee; int rmethod;