Compare commits
486 Commits
master
...
devs/devil
Author | SHA1 | Date |
---|---|---|
|
46d35dd75e | |
|
240f817ba5 | |
|
9e9b5d6b31 | |
|
85381ee839 | |
|
8273f35269 | |
|
864fed5fef | |
|
d61189fa4b | |
|
2d7058d4d4 | |
|
9be52172cb | |
|
26f6ef7ae9 | |
|
24b1b54bbf | |
|
c9456e3cfe | |
|
389986a263 | |
|
9b18d0d8a2 | |
|
77a310b18e | |
|
a8e853a1e9 | |
|
86116ab18c | |
|
ba08cdcdce | |
|
82903da150 | |
|
9c6ea9d70f | |
|
33af9c0210 | |
|
8fd1ed5c7e | |
|
83389ec869 | |
|
f8e7f0d2ac | |
|
77b3975640 | |
|
89a4fa17f1 | |
|
d44b524e7a | |
|
5b0c8d8606 | |
|
e2db06f11f | |
|
a87eb94ffe | |
|
0daa4a0156 | |
|
b458cca08c | |
|
0dd1a9144c | |
|
9ef7237aa3 | |
|
d912777476 | |
|
5edc57156b | |
|
39e8f1824e | |
|
8c3af8ef19 | |
|
8955c24424 | |
|
2ca03d4566 | |
|
16bf841884 | |
|
a1951db500 | |
|
5e1c926818 | |
|
931ff41168 | |
|
667fe4dc8d | |
|
13560ef285 | |
|
908b97243e | |
|
d9540fd2dd | |
|
ae305761e0 | |
|
ba73c40fdb | |
|
c6e038f740 | |
|
83ba75ccd6 | |
|
fe3a1ac654 | |
|
3a1502d16a | |
|
ca5d75c5b8 | |
|
04a1d91c2f | |
|
9bf5d669ec | |
|
36ab03290d | |
|
79447403a0 | |
|
b8f34dfcd8 | |
|
49ba44f64b | |
|
889411bcf9 | |
|
ca577a1c9d | |
|
b53049d898 | |
|
f2bb88ad1e | |
|
d07ad96727 | |
|
bf837a9763 | |
|
aa85457d71 | |
|
87195c41ea | |
|
da20ed38d4 | |
|
ccd2817776 | |
|
d944184ff7 | |
|
4cf61ad918 | |
|
1753e42639 | |
|
28b31c4f14 | |
|
6e1054f897 | |
|
389c88529f | |
|
7eed6d062d | |
|
9dd8d8e3b4 | |
|
8ee8eaf526 | |
|
de6b7acbaf | |
|
cc20e01b4a | |
|
d1125c11a9 | |
|
d5303bec8b | |
|
c47925c13a | |
|
1252a022b1 | |
|
887bd798a2 | |
|
e1f57a1173 | |
|
c461aa04b8 | |
|
0e8b48aa8e | |
|
d01d7a9159 | |
|
cd3d5e84f3 | |
|
838c67c2c5 | |
|
7fff962813 | |
|
a697e47df1 | |
|
b2efb3044f | |
|
bfb3bb0e61 | |
|
4ed004769b | |
|
89155a3e7b | |
|
4299290476 | |
|
c080b409ad | |
|
7df5711a63 | |
|
e54073f3c4 | |
|
347bc94d10 | |
|
bdb13d23b2 | |
|
bcc3980296 | |
|
ccf1ee8224 | |
|
fe1f9bfd8b | |
|
a78a62c90c | |
|
0f5eb551c8 | |
|
64e636bcf6 | |
|
b635497632 | |
|
504a165f81 | |
|
931ab93ba4 | |
|
3ecdc98967 | |
|
36e14082a3 | |
|
e08c76c78e | |
|
78b6b07e16 | |
|
e1f5bf8ee5 | |
|
8a242b10df | |
|
3ce1d99ac2 | |
|
e3bbd8c9d0 | |
|
eb19a36703 | |
|
27ba8943ac | |
|
517464f961 | |
|
c65d9c2d62 | |
|
eff8185283 | |
|
4b440fcc5d | |
|
f56c81d0e4 | |
|
af2df731d8 | |
|
04317ce6f4 | |
|
2be9ed825d | |
|
64f3a4e931 | |
|
bd5795917c | |
|
55b194a463 | |
|
448cedc5d3 | |
|
4e20be6657 | |
|
b24594fc4b | |
|
e8528498f0 | |
|
66306f3e6e | |
|
41b6da1a3e | |
|
b02f374ad7 | |
|
21a4bda992 | |
|
7fe0b1e664 | |
|
009d662e31 | |
|
3e76b74871 | |
|
8f09386247 | |
|
5e5bbe05cc | |
|
872b5f73f5 | |
|
56e172af4f | |
|
4511fff3e3 | |
|
2c4fa3472d | |
|
bb834d96ea | |
|
a9b35151bb | |
|
9154d932ea | |
|
ffa488e8e3 | |
|
7504dec273 | |
|
9d19fcb185 | |
|
08304504df | |
|
261a3ed4b3 | |
|
58d2c3c726 | |
|
f9b7179684 | |
|
e9b4d2964e | |
|
a11bf0d36c | |
|
9260da5c8c | |
|
e74e8d4f78 | |
|
cc0c6ed852 | |
|
65a2f2044d | |
|
0642a14cbe | |
|
6fa212a25d | |
|
7870e4fc70 | |
|
61e529406c | |
|
1f43b91b8a | |
|
2572201276 | |
|
107388ae0d | |
|
d6f6bf9914 | |
|
ed7bef4a6e | |
|
2f17f0834f | |
|
daa43ae25c | |
|
a05a6c733a | |
|
843b312e9c | |
|
c31f88a720 | |
|
071db5634e | |
|
30f1775043 | |
|
86a89c6869 | |
|
321d127473 | |
|
6b4e862780 | |
|
02434285cb | |
|
d909d46981 | |
|
8d8298a579 | |
|
e03d423da3 | |
|
d37d44c977 | |
|
d44dab055c | |
|
9444de3ab7 | |
|
65e3548a31 | |
|
ca1ea20b0b | |
|
3e22ae2558 | |
|
6ca00b70de | |
|
feb1351939 | |
|
00807969bc | |
|
699eee9422 | |
|
ea2f71c0c2 | |
|
e530cc37a6 | |
|
85a576016d | |
|
60fa3c182a | |
|
6eacfcd5c3 | |
|
97b51f61eb | |
|
b46455ba96 | |
|
c0708792ce | |
|
d764ee34a5 | |
|
623d568e18 | |
|
878cdb0e32 | |
|
82541c9d05 | |
|
8b6c6cfb07 | |
|
c4fda4ebc1 | |
|
a092f0ae9e | |
|
5552e09427 | |
|
658bce248a | |
|
e91e1331d3 | |
|
058a7dd5c4 | |
|
7edddd9a95 | |
|
0487ae1724 | |
|
6c127eaf4d | |
|
c780ad4f2c | |
|
b2656ab0df | |
|
60d72df09a | |
|
402c787997 | |
|
84ec2f606f | |
|
9a6bfea870 | |
|
108a356d36 | |
|
7be6489a31 | |
|
2a77bd33f6 | |
|
9db8e740ec | |
|
881bd75ab2 | |
|
ceb8597a4c | |
|
ef704b3670 | |
|
4033e41730 | |
|
c8a9e0c0af | |
|
3f09a6e0f2 | |
|
0975d5d8e4 | |
|
b93502d78d | |
|
88a559117a | |
|
b7b4d5b485 | |
|
0afc559edf | |
|
e8b333cb4c | |
|
60f960ff36 | |
|
9881621d9a | |
|
c823935828 | |
|
1ac54c1e77 | |
|
bad87e39bd | |
|
0e172f6fbe | |
|
e4b8bea513 | |
|
a7c6754db3 | |
|
d6a1da16c6 | |
|
cb75b35f04 | |
|
c5d190ffc5 | |
|
61cb6f17f9 | |
|
f4837267b1 | |
|
ac11a9a8fe | |
|
df88d7d0f8 | |
|
b4130b7ade | |
|
ded7a94085 | |
|
571e8d3b21 | |
|
d11f0fdddc | |
|
1cff662d5a | |
|
01784a1dfe | |
|
e1ee09938b | |
|
2484056698 | |
|
049acffbd9 | |
|
af49a8f0c6 | |
|
8d4854d28d | |
|
b1e5730bc2 | |
|
043d5d31b2 | |
|
a86c7a6fc0 | |
|
d29fed2a26 | |
|
134893a6d6 | |
|
5ac582cdfd | |
|
00145d70ba | |
|
d28493b8d7 | |
|
a6798eb812 | |
|
48546cb67d | |
|
e79bf409b8 | |
|
cc384c26e7 | |
|
84f58faa20 | |
|
0afc5a2ab4 | |
|
e53f74787e | |
|
8f2512c9a3 | |
|
40ba19a73c | |
|
b87652b8bc | |
|
26e8935205 | |
|
70db0a5b19 | |
|
8149404d62 | |
|
6ed5a5fabb | |
|
2be0a40129 | |
|
aa232d0a61 | |
|
110a210c6e | |
|
bda1b1d731 | |
|
ba5e5ab667 | |
|
0d9ce71b39 | |
|
54077f460c | |
|
9bfe2b4392 | |
|
a83de3e1fe | |
|
0d598da53b | |
|
faf1f03101 | |
|
eb3823e891 | |
|
3fa374f09e | |
|
2fa19739ed | |
|
7b8431b93d | |
|
fe8580cf6f | |
|
80cccbf8c4 | |
|
8e41ee62a9 | |
|
d532f5240c | |
|
407bbd0538 | |
|
e39325929d | |
|
d5556753c9 | |
|
e103d86143 | |
|
7b981d0f79 | |
|
8f715f090a | |
|
a466cef85f | |
|
5bf1015c29 | |
|
f7b4bf3775 | |
|
8b65a84759 | |
|
ef016f5a65 | |
|
d4d9556bd4 | |
|
ba35c5acbd | |
|
298989495b | |
|
c8e16b85bb | |
|
4aa3f7957c | |
|
942684d8fc | |
|
3299b9db4c | |
|
5bf4141fac | |
|
0bb09e4a1a | |
|
cb6fb2280d | |
|
f0fceeaa46 | |
|
5f7b0796c0 | |
|
df5d7b0485 | |
|
f0936d67f4 | |
|
9c2b713a4c | |
|
34f49d3e01 | |
|
5e8d9bc6c6 | |
|
080e2c8613 | |
|
3682bc6348 | |
|
14f53ae171 | |
|
4dbfcae2a0 | |
|
6c2a497f7b | |
|
5171d7d92a | |
|
8f8f47d933 | |
|
bfa04ca6c7 | |
|
454d91c005 | |
|
7a762d87dc | |
|
d15dfad898 | |
|
a3a0e20193 | |
|
8de77bf6b2 | |
|
30a5f1a6dd | |
|
5a7aae761c | |
|
dda0f18bd7 | |
|
bac455e651 | |
|
64217f2395 | |
|
bcf21e46ea | |
|
ddeb2cfba6 | |
|
efff154808 | |
|
539876df81 | |
|
1bf99a7df7 | |
|
ea577e02f6 | |
|
5cdf7a8d14 | |
|
9903774a14 | |
|
e0e20383b0 | |
|
f67a86e7fe | |
|
faa8eae113 | |
|
618f94f367 | |
|
9f6f7c931a | |
|
840710da63 | |
|
9364b71e54 | |
|
4255d238dc | |
|
0a239557b7 | |
|
05ffa467f6 | |
|
b375a29739 | |
|
e23750bc33 | |
|
93dce48609 | |
|
ca33bbb4f1 | |
|
1107303c3e | |
|
f204780968 | |
|
b0e559d536 | |
|
5045ff1319 | |
|
a261b135d2 | |
|
0f03c0b451 | |
|
8403024cf1 | |
|
49391cbdb6 | |
|
303faf8e33 | |
|
83c623fb3a | |
|
6fb6813845 | |
|
bc774525d0 | |
|
807e36c5ac | |
|
238c0b9144 | |
|
bd5e10ef8a | |
|
48e63ba17a | |
|
d5cdbf4b61 | |
|
99f78e2660 | |
|
70e7e584da | |
|
5ce2bc3a50 | |
|
7ed409d477 | |
|
379149eaf3 | |
|
4759f68734 | |
|
445b340a3f | |
|
549ba9aeea | |
|
846214c734 | |
|
af9c21d875 | |
|
e039bc06ea | |
|
57fa740fe7 | |
|
5b7297a120 | |
|
7c7bdcc41e | |
|
35861403f7 | |
|
a4ebba55fe | |
|
3b8d91ec2f | |
|
d38fd710a3 | |
|
7d2dce17ee | |
|
6ae3560210 | |
|
15c49d4d25 | |
|
a8c6a4fff5 | |
|
99dcc2e4c9 | |
|
d5e0a60788 | |
|
6ebc272a46 | |
|
64b7e6dd9e | |
|
600e542149 | |
|
8f4c45636f | |
|
8b738a0ad1 | |
|
212e843310 | |
|
b6cc9cac24 | |
|
81c6843f87 | |
|
7e8945f088 | |
|
7acfc3f8ce | |
|
eeab762498 | |
|
2a96aff413 | |
|
a34e83137e | |
|
9ceeaf1b29 | |
|
fc2a4f5f34 | |
|
84d84dfcf1 | |
|
e6ed988e54 | |
|
79f4fa95ed | |
|
e4c39ba2fe | |
|
e0fdb907dc | |
|
353ecac25e | |
|
d1c4d53e50 | |
|
2811d85907 | |
|
561a67069c | |
|
58bc1a5e87 | |
|
addfd3f42a | |
|
eb34a9f53e | |
|
137c24c904 | |
|
7458725b85 | |
|
3fd3d99baf | |
|
e283efa5a1 | |
|
2c4aeefc23 | |
|
a925d0ca66 | |
|
9005f360d0 | |
|
e81351491f | |
|
1d69824237 | |
|
01706a9eae | |
|
c273933205 | |
|
d76c2e2a2d | |
|
de7a0947a5 | |
|
6a05c1e69b | |
|
ea416178e4 | |
|
7c226972dc | |
|
69bf2f0c7c | |
|
f3d640f10a | |
|
f449ad4f87 | |
|
2366f6b7d8 | |
|
e4db8ef7c5 | |
|
7f34987f65 | |
|
e4aa6eedc8 | |
|
d006ebff71 | |
|
35dfb992ca | |
|
d013e678bb | |
|
71e7efde0f | |
|
674d3d386a | |
|
d2dbbdc071 | |
|
8e8f2e480c | |
|
e6a3a0736c | |
|
26459b4492 | |
|
04add6501d | |
|
c42fa00bfa | |
|
6458cae492 | |
|
a891d9f2ef | |
|
73e87f071b | |
|
64f76de07a |
|
@ -20,6 +20,7 @@ tags
|
|||
.libs
|
||||
*.trs
|
||||
*.log
|
||||
*.core
|
||||
*.exe
|
||||
*.o
|
||||
*.lo
|
||||
|
|
|
@ -244,6 +244,10 @@ if HAVE_ECORE_WAYLAND
|
|||
pkgconfig_DATA += pc/ecore-wayland.pc
|
||||
endif
|
||||
|
||||
if HAVE_ECORE_WL2
|
||||
pkgconfig_DATA += pc/ecore-wl2.pc
|
||||
endif
|
||||
|
||||
if HAVE_WIN32
|
||||
pkgconfig_DATA += pc/ecore-win32.pc
|
||||
endif
|
||||
|
@ -297,7 +301,8 @@ cmakeconfig/EoConfigVersion.cmake
|
|||
eolian_cmakeconfigdir = $(libdir)/cmake/Eolian/
|
||||
eolian_cmakeconfig_DATA = \
|
||||
cmakeconfig/EolianConfig.cmake \
|
||||
cmakeconfig/EolianConfigVersion.cmake
|
||||
cmakeconfig/EolianConfigVersion.cmake \
|
||||
cmakeconfig/EolianHelper.cmake
|
||||
|
||||
eolian_cxx_cmakeconfigdir = $(libdir)/cmake/EolianCxx/
|
||||
eolian_cxx_cmakeconfig_DATA = \
|
||||
|
|
|
@ -39,3 +39,5 @@ if(_pkgconfig_failed)
|
|||
else()
|
||||
set (EOLIAN_EO_DIR ${_pkgconfig_invoke_result})
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/EolianHelper.cmake)
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# macro to create a eolian generated c source file
|
||||
#
|
||||
# macro adds a generate rule, which depends on the original file the rule will output file.x
|
||||
#
|
||||
# The passed include snippet will just be added to the command
|
||||
|
||||
macro(_rule_eox file include deps)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${file}.x
|
||||
COMMAND eolian_gen ${include} --gc -o ${CMAKE_CURRENT_SOURCE_DIR}/${file}.x ${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
||||
DEPENDS ${deps}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# macro to create a eolian generated header file
|
||||
#
|
||||
# other details are like the eox rule
|
||||
macro(_rule_eoh file include deps)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${file}.h
|
||||
COMMAND eolian_gen ${include} --gh -o ${CMAKE_CURRENT_SOURCE_DIR}/${file}.h ${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
||||
DEPENDS ${deps}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# Can be used to create .eo.x , .eo.h, .eot.h generator rules.
|
||||
# <file>.eo files are generated into <file>.eo.x and <file>.eo.h files
|
||||
# <file>.eot files are generated into <file>.eot.h files
|
||||
# The standard include path of efl eolian files is automatically added to the includes
|
||||
#
|
||||
# build_files - A list of files
|
||||
# relative_include_dirs - A list of dirs to include
|
||||
#
|
||||
# If one of the included files is changed the file will be rebuilded at the next
|
||||
# make call
|
||||
#
|
||||
# The macro scans for .eo files, hey have to be in the build_files.
|
||||
# The generator rules are just executed if the file is a dependecy of some lib/executable.
|
||||
|
||||
function(eo_rule_create build_files relative_include_dirs)
|
||||
string(REPLACE "\n" "" EOLIAN_EO_DIR_WITHOUT_NEWLINE "${EOLIAN_EO_DIR}")
|
||||
|
||||
# add std includes
|
||||
list(APPEND include_dirs
|
||||
${EOLIAN_EO_DIR_WITHOUT_NEWLINE}
|
||||
)
|
||||
|
||||
# convert relative to absolut
|
||||
foreach(relative_include_dir ${relative_include_dirs})
|
||||
list(APPEND include_dirs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${relative_include_dir}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# work with the absolut paths
|
||||
foreach(include_cmd ${include_dirs})
|
||||
# build include cmd
|
||||
string(CONCAT includes "${includes}" " -I${include_cmd}")
|
||||
# fetch dep files
|
||||
file(GLOB_RECURSE files "${include_cmd}/*.eo")
|
||||
foreach(file ${files})
|
||||
list(APPEND dep_files ${file})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
string(REPLACE " " ";" includes "${includes}")
|
||||
foreach(file ${build_files})
|
||||
get_filename_component(ext ${file} EXT)
|
||||
if (ext MATCHES "^\\.eo$")
|
||||
_rule_eoh("${file}" "${includes}" "${dep_files}")
|
||||
_rule_eox("${file}" "${includes}" "${dep_files}")
|
||||
endif()
|
||||
if (ext MATCHES "^\\.eot$")
|
||||
_rule_eoh("${file}" "${includes}" "${dep_files}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
84
configure.ac
84
configure.ac
|
@ -878,6 +878,9 @@ EINA_CONFIG([MAGIC_DEBUG], [test "x${have_magic_debug}" = "xyes"])
|
|||
AC_ARG_WITH([xattr-tests-path],
|
||||
[AS_HELP_STRING([--with-xattr-tests-path=DIR],[path of xattr enabled directory to create test files])],[XATTR_TEST_DIR=${withval}][AC_DEFINE_UNQUOTED([XATTR_TEST_DIR],["$withval"], [xattr enabled directory])])
|
||||
|
||||
AC_ARG_WITH([dictionaries-hyphen-dir],
|
||||
[AS_HELP_STRING([--with-dictionaries-hyphen-dir=DIR],[path of hunspell-compatible hyphen dictionaries])],[EVAS_DICTS_HYPHEN_DIR=${withval}][AC_DEFINE_UNQUOTED([EVAS_DICTS_HYPHEN_DIR],["$withval"], [Hunspell-compatible hyphen dictionaries install directory])])
|
||||
|
||||
### Checks for programs
|
||||
|
||||
### Checks for libraries
|
||||
|
@ -1609,6 +1612,18 @@ AC_ARG_ENABLE([harfbuzz],
|
|||
],
|
||||
[want_harfbuzz="no"])
|
||||
|
||||
# Hyphenation
|
||||
AC_ARG_ENABLE([hyphen],
|
||||
[AS_HELP_STRING([--enable-hyphen],[enable text hyphenation support. @<:@default=disabled@:>@])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
want_hyphen="yes"
|
||||
else
|
||||
want_hyphen="no"
|
||||
fi
|
||||
],
|
||||
[want_hyphen="no"])
|
||||
|
||||
# Egl
|
||||
AC_ARG_ENABLE([egl],
|
||||
[AS_HELP_STRING([--enable-egl],[enable EGL rendering. @<:@default=disabled@:>@])],
|
||||
|
@ -2066,6 +2081,25 @@ EFL_EVAL_PKGS([EVAS])
|
|||
|
||||
### Checks for header files
|
||||
|
||||
if test "x$want_hyphen" = "xyes" ; then
|
||||
|
||||
EFL_CHECK_LIB_CODE([EVAS], [-lhyphen], [have_fct], [[
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <hyphen.h>
|
||||
]], [[
|
||||
HyphenDict *dict;
|
||||
]])
|
||||
|
||||
if test "${have_fct}" = "no"; then
|
||||
AC_MSG_ERROR([Cannot find the hyphen library.])
|
||||
else
|
||||
AC_DEFINE([HAVE_HYPHEN], [1], [have hunspell hyphen support])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$have_harfbuzz" = "xyes" ; then
|
||||
|
||||
CPPFLAGS_SAVE="$CPPFLAGS"
|
||||
|
@ -2625,7 +2659,9 @@ AC_CHECK_TYPES([struct ipv6_mreq],
|
|||
[have_ipv6="yes"],
|
||||
[have_ipv6="no"],
|
||||
[[
|
||||
#include <netinet/in.h>
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
@ -2807,6 +2843,8 @@ EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [ecore-input])
|
|||
EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [ecore])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [eo])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [eina])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [evas])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [emile])
|
||||
|
||||
### Checks for header files
|
||||
|
||||
|
@ -2988,6 +3026,45 @@ EFL_EVAL_PKGS([ECORE_WAYLAND])
|
|||
EFL_LIB_END_OPTIONAL([Ecore_Wayland])
|
||||
#### End of Ecore_Wayland
|
||||
|
||||
#### Ecore_Wl2
|
||||
EFL_LIB_START_OPTIONAL([Ecore_Wl2], [test "${want_wayland}" = "yes"])
|
||||
|
||||
if test "x${want_wayland_ivi_shell}" = "xyes" ; then
|
||||
AC_DEFINE(USE_IVI_SHELL, 1, [Ecore_Wl2 IVI-Shell Support])
|
||||
fi
|
||||
|
||||
### Additional options to configure
|
||||
|
||||
### Default values
|
||||
|
||||
### Checks for programs
|
||||
|
||||
### Checks for libraries
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WL2], [ecore-input])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WL2], [ecore])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WL2], [eo])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WL2], [eina])
|
||||
|
||||
EFL_DEPEND_PKG([ECORE_WL2], [WAYLAND],
|
||||
[wayland-server >= 1.8.0 wayland-client >= 1.8.0 wayland-cursor >= 1.8.0 xkbcommon >= 0.5.0])
|
||||
|
||||
EFL_EVAL_PKGS([ECORE_WL2])
|
||||
|
||||
### Checks for header files
|
||||
|
||||
### Checks for types
|
||||
|
||||
### Checks for structures
|
||||
|
||||
### Checks for compiler characteristics
|
||||
|
||||
### Checks for linker characteristics
|
||||
|
||||
### Checks for library functions
|
||||
|
||||
EFL_LIB_END_OPTIONAL([Ecore_Wl2])
|
||||
#### End of Ecore_Wl2
|
||||
|
||||
#### Eldbus
|
||||
EFL_LIB_START([Eldbus])
|
||||
|
||||
|
@ -4216,7 +4293,7 @@ EFL_LIB_START([Edje])
|
|||
### Default values
|
||||
|
||||
AC_ARG_ENABLE([multisense],
|
||||
[AS_HELP_STRING([--enable-multisense],[Enable multisense support. @<:@default=enabled@:>@])],
|
||||
[AS_HELP_STRING([--enable-multisense],[Enable multisense support. @<:@default=disabled@:>@])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
want_multisense="yes"
|
||||
|
@ -4757,6 +4834,7 @@ pc/ecore-fb.pc
|
|||
pc/ecore-psl1ght.pc
|
||||
pc/ecore-sdl.pc
|
||||
pc/ecore-wayland.pc
|
||||
pc/ecore-wl2.pc
|
||||
pc/ecore-win32.pc
|
||||
pc/ecore-x.pc
|
||||
pc/ecore-evas.pc
|
||||
|
@ -4798,6 +4876,7 @@ cmakeconfig/EoConfig.cmake
|
|||
cmakeconfig/EoConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EolianConfig.cmake
|
||||
cmakeconfig/EolianConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EolianHelper.cmake
|
||||
cmakeconfig/EolianCxxConfig.cmake
|
||||
cmakeconfig/EolianCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EinaCxxConfig.cmake
|
||||
|
@ -4925,6 +5004,7 @@ echo "Ecore_IMF.......: yes (${features_ecore_imf})"
|
|||
echo "Ecore_X.........: ${with_x11} (${features_ecore_x})"
|
||||
echo "Ecore_SDL.......: $want_sdl"
|
||||
echo "Ecore_Wayland...: $want_wayland"
|
||||
echo "Ecore_Wl2.......: $want_wayland"
|
||||
echo "IVI-Shell.......: $want_wayland_ivi_shell"
|
||||
echo "Ecore_Buffer....: $want_ecore_buffer (${features_ecore_buffer})"
|
||||
if test "${have_linux}" = "yes"; then
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
/ecore-psl1ght.pc
|
||||
/ecore-sdl.pc
|
||||
/ecore-wayland.pc
|
||||
/ecore-wl2.pc
|
||||
/ecore-win32.pc
|
||||
/ecore-x.pc
|
||||
/ecore.pc
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: ecore-wl2
|
||||
Description: E core library, Wayland module
|
||||
Requires.private: @requirements_pc_ecore_wl2@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lecore_wl2
|
||||
Libs.private: @requirements_libs_ecore_wl2@
|
||||
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/ecore-wl2-@VMAJ@
|
|
@ -40,6 +40,7 @@ include Makefile_Ecore_FB.am
|
|||
include Makefile_Ecore_Psl1ght.am
|
||||
include Makefile_Ecore_SDL.am
|
||||
include Makefile_Ecore_Wayland.am
|
||||
include Makefile_Ecore_Wl2.am
|
||||
include Makefile_Ecore_Win32.am
|
||||
include Makefile_Ecore_X.am
|
||||
include Makefile_Ecore_IMF.am
|
||||
|
|
|
@ -7,12 +7,14 @@ lib_LTLIBRARIES += lib/ecore_cocoa/libecore_cocoa.la
|
|||
installed_ecorecocoamainheadersdir = $(includedir)/ecore-cocoa-@VMAJ@
|
||||
dist_installed_ecorecocoamainheaders_DATA = \
|
||||
lib/ecore_cocoa/Ecore_Cocoa.h \
|
||||
lib/ecore_cocoa/Ecore_Cocoa_Keys.h
|
||||
lib/ecore_cocoa/Ecore_Cocoa_Cursor.h
|
||||
|
||||
lib_ecore_cocoa_libecore_cocoa_la_SOURCES = \
|
||||
lib/ecore_cocoa/ecore_cocoa.m \
|
||||
lib/ecore_cocoa/ecore_cocoa_keys.h \
|
||||
lib/ecore_cocoa/ecore_cocoa_window.h \
|
||||
lib/ecore_cocoa/ecore_cocoa_window.m \
|
||||
lib/ecore_cocoa/ecore_cocoa_cnp.m \
|
||||
lib/ecore_cocoa/ecore_cocoa_app.m \
|
||||
lib/ecore_cocoa/ecore_cocoa_app.h \
|
||||
lib/ecore_cocoa/ecore_cocoa_private.h
|
||||
|
|
|
@ -71,7 +71,8 @@ else
|
|||
if HAVE_IPV6
|
||||
lib_ecore_con_libecore_con_la_SOURCES += \
|
||||
lib/ecore_con/ecore_con_dns.c \
|
||||
static_libs/dns/dns.c
|
||||
static_libs/dns/dns.c \
|
||||
static_libs/dns/dns.h
|
||||
else
|
||||
lib_ecore_con_libecore_con_la_SOURCES += lib/ecore_con/ecore_con_info.c
|
||||
endif
|
||||
|
|
|
@ -20,6 +20,7 @@ lib/ecore_evas/ecore_evas_private.h \
|
|||
lib/ecore_evas/ecore_evas_extn.h \
|
||||
lib/ecore_evas/ecore_evas_extn.c \
|
||||
lib/ecore_evas/ecore_evas_wayland.h \
|
||||
lib/ecore_evas/ecore_evas_cocoa.h \
|
||||
lib/ecore_evas/ecore_evas_win32.h \
|
||||
lib/ecore_evas/ecore_evas_x11.h \
|
||||
lib/ecore_evas/ecore_evas_util.c
|
||||
|
@ -186,15 +187,19 @@ modules_ecore_evas_engines_wayland_module_la_SOURCES = $(WAYLANDSOURCES)
|
|||
modules_ecore_evas_engines_wayland_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
@ECORE_EVAS_CFLAGS@ \
|
||||
@ECORE_WAYLAND_CFLAGS@ \
|
||||
@ECORE_WL2_CFLAGS@ \
|
||||
-I$(top_srcdir)/src/modules/evas/engines/wayland_shm \
|
||||
-I$(top_srcdir)/src/modules/evas/engines/wayland_egl \
|
||||
@ECORE_WAYLAND_CFLAGS@
|
||||
@ECORE_WAYLAND_CFLAGS@ \
|
||||
@ECORE_WL2_CFLAGS@
|
||||
modules_ecore_evas_engines_wayland_module_la_LIBADD = \
|
||||
@USE_ECORE_EVAS_LIBS@ \
|
||||
@USE_ECORE_WAYLAND_LIBS@
|
||||
@USE_ECORE_WAYLAND_LIBS@ \
|
||||
@USE_ECORE_WL2_LIBS@
|
||||
modules_ecore_evas_engines_wayland_module_la_DEPENDENCIES = \
|
||||
@USE_ECORE_EVAS_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_WAYLAND_INTERNAL_LIBS@
|
||||
@USE_ECORE_WAYLAND_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_WL2_INTERNAL_LIBS@
|
||||
modules_ecore_evas_engines_wayland_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
|
||||
modules_ecore_evas_engines_wayland_module_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
endif
|
||||
|
|
|
@ -139,15 +139,15 @@ modules/ecore_imf/wayland/text-protocol.c
|
|||
modules_ecore_imf_wayland_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
@ECORE_IMF_CFLAGS@ \
|
||||
@ECORE_EVAS_CFLAGS@ \
|
||||
@ECORE_WAYLAND_CFLAGS@
|
||||
@ECORE_WL2_CFLAGS@
|
||||
modules_ecore_imf_wayland_module_la_LIBADD = \
|
||||
@USE_ECORE_IMF_LIBS@ \
|
||||
@USE_ECORE_EVAS_LIBS@ \
|
||||
@USE_ECORE_WAYLAND_LIBS@
|
||||
@USE_ECORE_WL2_LIBS@
|
||||
modules_ecore_imf_wayland_module_la_DEPENDENCIES = \
|
||||
@USE_ECORE_IMF_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_EVAS_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_WAYLAND_INTERNAL_LIBS@
|
||||
@USE_ECORE_WL2_INTERNAL_LIBS@
|
||||
modules_ecore_imf_wayland_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
|
||||
modules_ecore_imf_wayland_module_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
endif
|
||||
|
|
|
@ -10,6 +10,7 @@ lib/ecore_win32/Ecore_Win32.h
|
|||
|
||||
lib_ecore_win32_libecore_win32_la_SOURCES = \
|
||||
lib/ecore_win32/ecore_win32.c \
|
||||
lib/ecore_win32/ecore_win32_clipboard.c \
|
||||
lib/ecore_win32/ecore_win32_cursor.c \
|
||||
lib/ecore_win32/ecore_win32_dnd.c \
|
||||
lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp \
|
||||
|
@ -19,6 +20,7 @@ lib/ecore_win32/ecore_win32_dnd_drop_target.cpp \
|
|||
lib/ecore_win32/ecore_win32_event.c \
|
||||
lib/ecore_win32/ecore_win32_window.c \
|
||||
lib/ecore_win32/ecore_win32_private.h \
|
||||
lib/ecore_win32/ecore_win32_cursor_x11.h \
|
||||
lib/ecore_win32/ecore_win32_dnd_enumformatetc.h \
|
||||
lib/ecore_win32/ecore_win32_dnd_data_object.h \
|
||||
lib/ecore_win32/ecore_win32_dnd_drop_source.h \
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
if HAVE_ECORE_WL2
|
||||
|
||||
### Library
|
||||
|
||||
lib_LTLIBRARIES += lib/ecore_wl2/libecore_wl2.la
|
||||
|
||||
installed_ecorewl2mainheadersdir = $(includedir)/ecore-wl2-@VMAJ@
|
||||
dist_installed_ecorewl2mainheaders_DATA = lib/ecore_wl2/Ecore_Wl2.h
|
||||
|
||||
lib_ecore_wl2_libecore_wl2_la_SOURCES = \
|
||||
lib/ecore_wl2/subsurface-client-protocol.h \
|
||||
lib/ecore_wl2/subsurface-protocol.c \
|
||||
lib/ecore_wl2/xdg-shell-client-protocol.h \
|
||||
lib/ecore_wl2/xdg-shell-protocol.c \
|
||||
lib/ecore_wl2/ecore_wl2_seat.c \
|
||||
lib/ecore_wl2/ecore_wl2_subsurf.c \
|
||||
lib/ecore_wl2/ecore_wl2_dnd.c \
|
||||
lib/ecore_wl2/ecore_wl2_window.c \
|
||||
lib/ecore_wl2/ecore_wl2_input.c \
|
||||
lib/ecore_wl2/ecore_wl2_output.c \
|
||||
lib/ecore_wl2/ecore_wl2_display.c \
|
||||
lib/ecore_wl2/ecore_wl2.c \
|
||||
lib/ecore_wl2/ecore_wl2_private.h
|
||||
|
||||
lib_ecore_wl2_libecore_wl2_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_WL2_CFLAGS@
|
||||
lib_ecore_wl2_libecore_wl2_la_LIBADD = @ECORE_WL2_LIBS@
|
||||
lib_ecore_wl2_libecore_wl2_la_DEPENDENCIES = @ECORE_WL2_INTERNAL_LIBS@
|
||||
lib_ecore_wl2_libecore_wl2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
|
||||
endif
|
|
@ -2,8 +2,10 @@
|
|||
### Library
|
||||
ector_eolian_files_generic = \
|
||||
lib/ector/ector_generic_surface.eo \
|
||||
lib/ector/ector_generic_buffer.eo \
|
||||
lib/ector/ector_renderer_generic_base.eo \
|
||||
lib/ector/ector_renderer_generic_shape.eo \
|
||||
lib/ector/ector_renderer_generic_buffer.eo \
|
||||
lib/ector/ector_renderer_generic_gradient.eo \
|
||||
lib/ector/ector_renderer_generic_gradient_radial.eo \
|
||||
lib/ector/ector_renderer_generic_gradient_linear.eo
|
||||
|
@ -12,6 +14,7 @@ ector_eolian_generic_h = $(ector_eolian_files_generic:%.eo=%.eo.h)
|
|||
# Handle cairo backend
|
||||
ector_eolian_files_cairo = \
|
||||
lib/ector/cairo/ector_cairo_surface.eo \
|
||||
lib/ector/cairo/ector_cairo_software_surface.eo \
|
||||
lib/ector/cairo/ector_renderer_cairo_base.eo \
|
||||
lib/ector/cairo/ector_renderer_cairo_shape.eo \
|
||||
lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo \
|
||||
|
@ -21,8 +24,11 @@ ector_eolian_cairo_h = $(ector_eolian_files_cairo:%.eo=%.eo.h)
|
|||
# Handle default software backend
|
||||
ector_eolian_files_software = \
|
||||
lib/ector/software/ector_software_surface.eo \
|
||||
lib/ector/software/ector_software_buffer.eo \
|
||||
lib/ector/software/ector_software_buffer_base.eo \
|
||||
lib/ector/software/ector_renderer_software_base.eo \
|
||||
lib/ector/software/ector_renderer_software_shape.eo \
|
||||
lib/ector/software/ector_renderer_software_buffer.eo \
|
||||
lib/ector/software/ector_renderer_software_gradient_radial.eo \
|
||||
lib/ector/software/ector_renderer_software_gradient_linear.eo
|
||||
ector_eolian_software_h = $(ector_eolian_files_software:%.eo=%.eo.h)
|
||||
|
@ -63,12 +69,13 @@ lib/ector/software/Ector_Software.h
|
|||
|
||||
lib_ector_libector_la_SOURCES = \
|
||||
lib/ector/ector_main.c \
|
||||
lib/ector/ector_surface.c \
|
||||
lib/ector/ector_renderer_shape.c \
|
||||
lib/ector/ector_renderer_base.c \
|
||||
lib/ector/ector_renderer_gradient.c \
|
||||
lib/ector/ector_renderer_gradient_radial.c \
|
||||
lib/ector/ector_renderer_gradient_linear.c
|
||||
lib/ector/ector_generic_buffer.c \
|
||||
lib/ector/ector_renderer_generic_shape.c \
|
||||
lib/ector/ector_renderer_generic_base.c \
|
||||
lib/ector/ector_renderer_generic_buffer.c \
|
||||
lib/ector/ector_renderer_generic_gradient.c \
|
||||
lib/ector/ector_renderer_generic_gradient_radial.c \
|
||||
lib/ector/ector_renderer_generic_gradient_linear.c
|
||||
|
||||
installed_ectorgenericheadersdir = $(includedir)/ector-@VMAJ@/generic
|
||||
nodist_installed_ectorgenericheaders_DATA = $(ector_eolian_generic_h)
|
||||
|
@ -79,25 +86,33 @@ lib/ector/cairo/ector_renderer_cairo_gradient_linear.c \
|
|||
lib/ector/cairo/ector_renderer_cairo_gradient_radial.c \
|
||||
lib/ector/cairo/ector_renderer_cairo_shape.c \
|
||||
lib/ector/cairo/ector_renderer_cairo_base.c \
|
||||
lib/ector/cairo/ector_cairo_software_surface.c \
|
||||
lib/ector/cairo/ector_cairo_surface.c
|
||||
|
||||
installed_ectorcairoheadersdir = $(includedir)/ector-@VMAJ@/cairo
|
||||
nodist_installed_ectorcairoheaders_DATA = $(ector_eolian_cairo_h)
|
||||
|
||||
# SW draw static lib
|
||||
draw_sources = \
|
||||
static_libs/draw/draw_main_sse2.c \
|
||||
static_libs/draw/draw_main.c \
|
||||
static_libs/draw/draw_main_neon.c \
|
||||
$(NULL)
|
||||
|
||||
# And the default software backend
|
||||
lib_ector_libector_la_SOURCES += \
|
||||
lib/ector/software/ector_renderer_software_gradient_linear.c \
|
||||
lib/ector/software/ector_renderer_software_gradient_radial.c \
|
||||
lib/ector/software/ector_renderer_software_shape.c \
|
||||
lib/ector/software/ector_renderer_software_buffer.c \
|
||||
lib/ector/software/ector_software_gradient.c \
|
||||
lib/ector/software/ector_software_rasterizer.c \
|
||||
lib/ector/software/ector_software_surface.c \
|
||||
lib/ector/software/ector_software_buffer.c \
|
||||
static_libs/freetype/sw_ft_math.c \
|
||||
static_libs/freetype/sw_ft_raster.c \
|
||||
static_libs/freetype/sw_ft_stroker.c \
|
||||
lib/ector/software/ector_drawhelper.c \
|
||||
lib/ector/software/ector_drawhelper_sse2.c \
|
||||
lib/ector/software/ector_drawhelper_neon.c
|
||||
$(draw_sources)
|
||||
|
||||
installed_ectorsoftwareheadersdir = $(includedir)/ector-@VMAJ@/software
|
||||
nodist_installed_ectorsoftwareheaders_DATA = $(ector_eolian_software_h)
|
||||
|
@ -107,6 +122,7 @@ lib_ector_libector_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
|||
-I$(top_builddir)/src/lib/ector/cairo \
|
||||
-I$(top_builddir)/src/lib/ector/software \
|
||||
-I$(top_srcdir)/src/static_libs/freetype \
|
||||
-I$(top_srcdir)/src/static_libs/draw \
|
||||
@ECTOR_CFLAGS@ \
|
||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||
|
@ -150,10 +166,12 @@ endif
|
|||
|
||||
EXTRA_DIST += \
|
||||
lib/ector/ector_private.h \
|
||||
lib/ector/ector_buffer.h \
|
||||
lib/ector/cairo/ector_cairo_private.h \
|
||||
lib/ector/software/ector_drawhelper_private.h \
|
||||
lib/ector/software/ector_software_private.h \
|
||||
static_libs/freetype/sw_ft_math.h \
|
||||
static_libs/freetype/sw_ft_raster.h \
|
||||
static_libs/freetype/sw_ft_stroker.h \
|
||||
static_libs/freetype/sw_ft_types.h
|
||||
static_libs/freetype/sw_ft_types.h \
|
||||
static_libs/draw/draw.h \
|
||||
static_libs/draw/draw_private.h
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
# Even though libefl is new, it contains definitions used by legacy APIs
|
||||
efl_eolian_legacy_files = \
|
||||
lib/efl/interfaces/efl_gfx_fill.eo \
|
||||
lib/efl/interfaces/efl_gfx_base.eo \
|
||||
$(NULL)
|
||||
|
||||
efl_eolian_files = \
|
||||
lib/efl/interfaces/efl_control.eo \
|
||||
lib/efl/interfaces/efl_file.eo \
|
||||
|
@ -5,9 +11,7 @@ efl_eolian_files = \
|
|||
lib/efl/interfaces/efl_player.eo \
|
||||
lib/efl/interfaces/efl_text.eo \
|
||||
lib/efl/interfaces/efl_text_properties.eo \
|
||||
lib/efl/interfaces/efl_gfx_base.eo \
|
||||
lib/efl/interfaces/efl_gfx_stack.eo \
|
||||
lib/efl/interfaces/efl_gfx_fill.eo \
|
||||
lib/efl/interfaces/efl_gfx_view.eo \
|
||||
lib/efl/interfaces/efl_gfx_shape.eo \
|
||||
lib/efl/interfaces/efl_gfx_gradient_base.eo \
|
||||
|
@ -15,18 +19,22 @@ efl_eolian_files = \
|
|||
lib/efl/interfaces/efl_gfx_gradient_radial.eo \
|
||||
lib/efl/interfaces/efl_gfx_filter.eo \
|
||||
lib/efl/interfaces/efl_model_base.eo \
|
||||
$(efl_eolian_legacy_files) \
|
||||
$(NULL)
|
||||
|
||||
efl_eolian_files_h = $(efl_eolian_files:%.eo=%.eo.h)
|
||||
efl_eolian_files_c = $(efl_eolian_files:%.eo=%.eo.c)
|
||||
efl_eolian_legacy_files_h = $(efl_eolian_legacy_files:%.eo=%.eo.legacy.h)
|
||||
|
||||
BUILT_SOURCES += \
|
||||
$(efl_eolian_files_c) \
|
||||
$(efl_eolian_files_h)
|
||||
$(efl_eolian_files_h) \
|
||||
$(efl_eolian_legacy_files_h)
|
||||
|
||||
CLEANFILES += \
|
||||
$(efl_eolian_files_c) \
|
||||
$(efl_eolian_files_h)
|
||||
$(efl_eolian_files_h) \
|
||||
$(efl_eolian_legacy_files_h)
|
||||
|
||||
EXTRA_DIST += \
|
||||
lib/efl/Efl_Config.h \
|
||||
|
@ -55,7 +63,8 @@ dist_installed_eflheaders_DATA = \
|
|||
|
||||
installed_eflinterfacesdir = $(includedir)/efl-@VMAJ@/interfaces
|
||||
nodist_installed_eflinterfaces_DATA = \
|
||||
$(efl_eolian_files_h)
|
||||
$(efl_eolian_files_h) \
|
||||
$(efl_eolian_legacy_files_h)
|
||||
|
||||
if HAVE_ELUA
|
||||
|
||||
|
@ -81,7 +90,7 @@ bin/efl/efl_debugd.c \
|
|||
bin/efl/efl_debug_common.c \
|
||||
bin/efl/efl_debug_common.h
|
||||
bin_efl_efl_debugd_CPPFLAGS = -I$(top_builddir)/src/bin/efl @EINA_CFLAGS@ @ECORE_CFLAGS@ @ECORE_CON_CFLAGS@
|
||||
bin_efl_efl_debugd_LDADD = @USE_EINA_INTERNAL_LIBS@ @USE_ECORE_INTERNAL_LIBS@ @USE_ECORE_CON_INTERNAL_LIBS@
|
||||
bin_efl_efl_debugd_LDADD = @EFL_LIBS@ @USE_EINA_INTERNAL_LIBS@ @USE_ECORE_INTERNAL_LIBS@ @USE_ECORE_CON_INTERNAL_LIBS@
|
||||
bin_efl_efl_debugd_DEPENDENCIES = @USE_EINA_INTERNAL_LIBS@ @USE_ECORE_INTERNAL_LIBS@ @USE_ECORE_CON_INTERNAL_LIBS@
|
||||
|
||||
bin_efl_efl_debug_SOURCES = \
|
||||
|
@ -89,6 +98,6 @@ bin/efl/efl_debug.c \
|
|||
bin/efl/efl_debug_common.c \
|
||||
bin/efl/efl_debug_common.h
|
||||
bin_efl_efl_debug_CPPFLAGS = -I$(top_builddir)/src/bin/efl @EINA_CFLAGS@ @ECORE_CFLAGS@ @ECORE_CON_CFLAGS@
|
||||
bin_efl_efl_debug_LDADD = @USE_EINA_INTERNAL_LIBS@ @USE_ECORE_INTERNAL_LIBS@ @USE_ECORE_CON_INTERNAL_LIBS@
|
||||
bin_efl_efl_debug_LDADD = @EFL_LIBS@ @USE_EINA_INTERNAL_LIBS@ @USE_ECORE_INTERNAL_LIBS@ @USE_ECORE_CON_INTERNAL_LIBS@
|
||||
bin_efl_efl_debug_DEPENDENCIES = @USE_EINA_INTERNAL_LIBS@ @USE_ECORE_INTERNAL_LIBS@ @USE_ECORE_CON_INTERNAL_LIBS@
|
||||
|
||||
|
|
|
@ -148,6 +148,7 @@ lib/evas/canvas/evas_object_box.c \
|
|||
lib/evas/canvas/evas_object_table.c \
|
||||
lib/evas/canvas/evas_object_text.c \
|
||||
lib/evas/canvas/evas_object_textblock.c \
|
||||
lib/evas/canvas/evas_textblock_hyphenation.x \
|
||||
lib/evas/canvas/evas_object_textgrid.c \
|
||||
lib/evas/canvas/evas_object_grid.c \
|
||||
lib/evas/canvas/evas_font_dir.c \
|
||||
|
@ -223,7 +224,8 @@ lib/evas/canvas/evas_canvas3d_node_callback.h
|
|||
lib_evas_libevas_la_SOURCES += \
|
||||
lib/evas/common3d/save_load/evas_model_load.c \
|
||||
lib/evas/common3d/save_load/evas_model_save.c \
|
||||
lib/evas/common3d/save_load/evas_model_common.c \
|
||||
lib/evas/common3d/save_load/evas_model_load_save_common.c \
|
||||
lib/evas/common3d/save_load/evas_model_load_save_common.h \
|
||||
modules/evas/model_loaders/eet/evas_model_load_eet.c \
|
||||
modules/evas/model_loaders/md2/evas_model_load_md2.c \
|
||||
modules/evas/model_loaders/obj/evas_model_load_obj.c \
|
||||
|
@ -257,6 +259,10 @@ lib/evas/canvas/evas_vg_gradient_radial.c \
|
|||
lib/evas/canvas/evas_vg_utils.c \
|
||||
lib/evas/canvas/evas_vg_shape.c
|
||||
|
||||
# Static draw lib
|
||||
lib_evas_libevas_la_SOURCES += \
|
||||
static_libs/draw/draw_alpha_main.c
|
||||
|
||||
# Engine
|
||||
lib_evas_libevas_la_SOURCES += \
|
||||
lib/evas/common/evas_op_copy_main_.c \
|
||||
|
@ -265,7 +271,6 @@ lib/evas/common/evas_op_add_main_.c \
|
|||
lib/evas/common/evas_op_sub_main_.c \
|
||||
lib/evas/common/evas_op_mask_main_.c \
|
||||
lib/evas/common/evas_op_mul_main_.c \
|
||||
lib/evas/common/evas_alpha_main.c \
|
||||
lib/evas/common/evas_blend_main.c \
|
||||
lib/evas/common/evas_blit_main.c \
|
||||
lib/evas/common/evas_convert_color.c \
|
||||
|
@ -347,6 +352,7 @@ lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
|||
-I$(top_srcdir)/src/lib/evas/file \
|
||||
-I$(top_srcdir)/src/lib/evas/include \
|
||||
-I$(top_srcdir)/src/static_libs/libunibreak \
|
||||
-I$(top_srcdir)/src/static_libs/draw \
|
||||
-I$(top_builddir)/src/lib/evas/canvas \
|
||||
-I$(top_builddir)/src/modules/evas/engines/software_generic \
|
||||
-I$(top_builddir)/src/modules/evas/engines/gl_generic \
|
||||
|
@ -552,19 +558,10 @@ lib/evas/filters/blur/blur_box_rgba_i386.c \
|
|||
lib/evas/filters/blur/blur_box_rgba_sse3.c \
|
||||
lib/evas/filters/blur/blur_box_rgba_neon.c
|
||||
|
||||
### Vector surface helper
|
||||
|
||||
EXTRA_DIST += \
|
||||
modules/evas/engines/software_generic/ector_cairo_software_surface.eo \
|
||||
modules/evas/engines/gl_generic/ector_cairo_software_surface.eo
|
||||
|
||||
### Engines
|
||||
|
||||
if EVAS_STATIC_BUILD_SOFTWARE_GENERIC
|
||||
BUILT_SOURCES += \
|
||||
modules/evas/engines/software_generic/ector_cairo_software_surface.eo.c \
|
||||
modules/evas/engines/software_generic/ector_cairo_software_surface.eo.h
|
||||
lib_evas_libevas_la_SOURCES += modules/evas/engines/software_generic/evas_engine.c modules/evas/engines/software_generic/ector_surface.c modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h
|
||||
lib_evas_libevas_la_SOURCES += modules/evas/engines/software_generic/evas_engine.c modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h
|
||||
lib_evas_libevas_la_LIBADD +=
|
||||
else
|
||||
enginesoftwaregenericpkgdir = $(libdir)/evas/modules/engines/software_generic/$(MODULE_ARCH)
|
||||
|
@ -653,10 +650,6 @@ endif
|
|||
endif
|
||||
|
||||
if BUILD_ENGINE_GL_COMMON
|
||||
BUILT_SOURCES += \
|
||||
modules/evas/engines/gl_generic/ector_cairo_software_surface.eo.c \
|
||||
modules/evas/engines/gl_generic/ector_cairo_software_surface.eo.h
|
||||
|
||||
GL_COMMON_SOURCES = \
|
||||
modules/evas/engines/gl_common/evas_gl_private.h \
|
||||
modules/evas/engines/gl_common/evas_gl_common.h \
|
||||
|
@ -737,7 +730,6 @@ modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x: modules/evas/engi
|
|||
|
||||
GL_GENERIC_SOURCES = \
|
||||
modules/evas/engines/gl_generic/evas_engine.c \
|
||||
modules/evas/engines/gl_generic/ector_surface.c \
|
||||
modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h
|
||||
|
||||
if EVAS_STATIC_BUILD_GL_COMMON
|
||||
|
@ -2120,6 +2112,7 @@ tests_evas_evas_suite_SOURCES = \
|
|||
tests/evas/evas_suite.c \
|
||||
tests/evas/evas_test_init.c \
|
||||
tests/evas/evas_test_object.c \
|
||||
tests/evas/evas_test_object_smart.c \
|
||||
tests/evas/evas_test_textblock.c \
|
||||
tests/evas/evas_test_text.c \
|
||||
tests/evas/evas_test_callbacks.c \
|
||||
|
@ -2129,6 +2122,7 @@ tests/evas/evas_test_image.c \
|
|||
tests/evas/evas_test_mesh.c \
|
||||
tests/evas/evas_test_mask.c \
|
||||
tests/evas/evas_test_evasgl.c \
|
||||
tests/evas/evas_test_matrix.c \
|
||||
tests/evas/evas_tests_helpers.h \
|
||||
tests/evas/evas_suite.h
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ lib/evil/Evil.h \
|
|||
lib/evil/evil_fcntl.h \
|
||||
lib/evil/evil_inet.h \
|
||||
lib/evil/evil_langinfo.h \
|
||||
lib/evil/evil_locale.h \
|
||||
lib/evil/evil_macro.h \
|
||||
lib/evil/evil_macro_pop.h \
|
||||
lib/evil/evil_main.h \
|
||||
|
@ -35,6 +36,7 @@ lib/evil/evil_fnmatch.c \
|
|||
lib/evil/evil_fnmatch_list_of_states.c \
|
||||
lib/evil/evil_inet.c \
|
||||
lib/evil/evil_langinfo.c \
|
||||
lib/evil/evil_locale.c \
|
||||
lib/evil/evil_link_xp.cpp \
|
||||
lib/evil/evil_main.c \
|
||||
lib/evil/evil_mman.c \
|
||||
|
|
|
@ -5587,7 +5587,8 @@ st_collections_group_parts_part_norepeat(void)
|
|||
Specifies whether events with the given flags should be ignored,
|
||||
i.e., will not have the signals emitted to the parts. Multiple flags
|
||||
must be separated by spaces, the effect will be ignoring all events
|
||||
with one of the flags specified. Possible flags:
|
||||
with one of the flags specified.
|
||||
Possible flags:
|
||||
@li NONE (default value, no event will be ignored)
|
||||
@li ON_HOLD
|
||||
@endproperty
|
||||
|
@ -5610,9 +5611,9 @@ st_collections_group_parts_part_ignore_flags(void)
|
|||
@parameters
|
||||
[FLAG] ...
|
||||
@effect
|
||||
Masks event flags with the given value, so event propagating from this part
|
||||
will go with masked flags. Other library, like Elementary, can determine
|
||||
whether it handles this event. Possible flags:
|
||||
Masks event flags with the given value, so that the event can be repeated
|
||||
to the lower object along with masked event flags.
|
||||
Possible flags:
|
||||
@li NONE (default value, no event will be masked)
|
||||
@li ON_HOLD
|
||||
@endproperty
|
||||
|
@ -7524,8 +7525,8 @@ st_collections_group_parts_part_description_min(void)
|
|||
check_min_arg_count(1);
|
||||
|
||||
if (is_param(1)) {
|
||||
current_desc->min.w = parse_float_range(0, 0, 0x7fffffff);
|
||||
current_desc->min.h = parse_float_range(1, 0, 0x7fffffff);
|
||||
current_desc->min.w = parse_int_range(0, 0, 0x7fffffff);
|
||||
current_desc->min.h = parse_int_range(1, 0, 0x7fffffff);
|
||||
} else {
|
||||
char *tmp;
|
||||
|
||||
|
@ -7586,8 +7587,8 @@ st_collections_group_parts_part_description_max(void)
|
|||
check_min_arg_count(1);
|
||||
|
||||
if (is_param(1)) {
|
||||
current_desc->max.w = parse_float_range(0, -1.0, 0x7fffffff);
|
||||
current_desc->max.h = parse_float_range(1, -1.0, 0x7fffffff);
|
||||
current_desc->max.w = parse_int_range(0, -1, 0x7fffffff);
|
||||
current_desc->max.h = parse_int_range(1, -1, 0x7fffffff);
|
||||
} else {
|
||||
char *tmp;
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ int new_dir = 1;
|
|||
|
||||
int decomp(void);
|
||||
void output(void);
|
||||
static int compiler_cmd_is_sane();
|
||||
static int root_filename_is_sane();
|
||||
static int compiler_cmd_is_sane(void);
|
||||
static int root_filename_is_sane(void);
|
||||
|
||||
|
||||
static void
|
||||
|
|
|
@ -86,7 +86,7 @@ do_eet_list(const char *file, Eina_Bool verbose)
|
|||
if (verbose)
|
||||
{
|
||||
printf("*** ***\n");
|
||||
printf("Total payload size : %lli.\n", total);
|
||||
printf("Total payload size : %llu.\n", total);
|
||||
}
|
||||
|
||||
eet_close(ef);
|
||||
|
|
|
@ -534,7 +534,7 @@ icon_changes_listen_recursive(Eina_Inarray *stack, const char *path, Eina_Bool b
|
|||
|
||||
if (stat(path, &st) == -1) return;
|
||||
if (eina_inarray_search(stack, &st, stat_cmp) >= 0) return;
|
||||
if (!_check_recurse_monitor_sanity(stack, path, 8)) return;
|
||||
if (!_check_recurse_monitor_sanity(stack, path, 10)) return;
|
||||
eina_inarray_push(stack, &st);
|
||||
|
||||
if ((!S_ISDIR(st.st_mode)) && (base))
|
||||
|
@ -573,7 +573,7 @@ desktop_changes_listen_recursive(Eina_Inarray *stack, const char *path, Eina_Boo
|
|||
|
||||
if (stat(path, &st) == -1) return;
|
||||
if (eina_inarray_search(stack, &st, stat_cmp) >= 0) return;
|
||||
if (!_check_recurse_monitor_sanity(stack, path, 3)) return;
|
||||
if (!_check_recurse_monitor_sanity(stack, path, 10)) return;
|
||||
eina_inarray_push(stack, &st);
|
||||
|
||||
if ((!S_ISDIR(st.st_mode)) && (base))
|
||||
|
@ -698,7 +698,9 @@ error:
|
|||
static void
|
||||
read_lists(void)
|
||||
{
|
||||
fill_list("extra_desktops.dirs", &desktop_extra_dirs);
|
||||
// dont use extra dirs as the only way to get extra dirs is by loading a
|
||||
// specific desktop file at a specific path, and this is wrong
|
||||
// fill_list("extra_desktops.dirs", &desktop_extra_dirs);
|
||||
fill_list("extra_icons.dirs", &icon_extra_dirs);
|
||||
fill_list("icons.exts", &icon_exts);
|
||||
}
|
||||
|
|
|
@ -317,7 +317,6 @@ main(int argc, char **argv)
|
|||
printf(" --help/-h Print that help\n");
|
||||
printf(" --include/-I Include 'input_dir' as directory to search .eo files into\n");
|
||||
printf(" --output/-o Force output filename to 'outfile'\n");
|
||||
printf(" --eo Set generator to eo mode. Must be specified\n");
|
||||
printf(" --gh Generate C header file [.h]\n");
|
||||
printf(" --gs Generate C type stubs [.h]\n");
|
||||
printf(" --gc Generate C source file [.c]\n");
|
||||
|
@ -391,4 +390,4 @@ end:
|
|||
eolian_shutdown();
|
||||
eina_shutdown();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,9 +198,8 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full,
|
|||
if (eolian_type_type_get(tp) == EOLIAN_TYPE_ALIAS)
|
||||
{
|
||||
const Eolian_Type *btp = eolian_type_base_type_get(tp);
|
||||
if (eolian_type_type_get(btp) == EOLIAN_TYPE_REGULAR)
|
||||
if (!strcmp(eolian_type_full_name_get(btp), "__undefined_type"))
|
||||
continue;
|
||||
if (eolian_type_type_get(btp) == EOLIAN_TYPE_UNDEFINED)
|
||||
continue;
|
||||
}
|
||||
|
||||
Eina_Strbuf *tbuf = _type_generate(tp, full, use_legacy);
|
||||
|
|
|
@ -292,8 +292,8 @@ void cserve2_slave_kill(Slave *s);
|
|||
|
||||
void cserve2_message_handler(int fd, Fd_Flags flags, void *data);
|
||||
|
||||
void cserve2_shm_init();
|
||||
void cserve2_shm_shutdown();
|
||||
void cserve2_shm_init(void);
|
||||
void cserve2_shm_shutdown(void);
|
||||
Shm_Handle *cserve2_shm_request(const char *infix, size_t size);
|
||||
Shm_Handle *cserve2_shm_segment_request(Shm_Handle *shm, size_t size);
|
||||
Shm_Handle *cserve2_shm_resize(Shm_Handle *shm, size_t newsize);
|
||||
|
@ -394,8 +394,8 @@ int cserve2_shared_mempool_generation_id_set(Shared_Mempool *sm, int generation_
|
|||
Shared_Array *cserve2_shared_mempool_index_get(Shared_Mempool *sm);
|
||||
|
||||
// Shared strings
|
||||
const char *cserve2_shared_strings_table_name_get();
|
||||
const char *cserve2_shared_strings_index_name_get();
|
||||
const char *cserve2_shared_strings_table_name_get(void);
|
||||
const char *cserve2_shared_strings_index_name_get(void);
|
||||
int cserve2_shared_string_add(const char *str);
|
||||
int cserve2_shared_string_ref(int id);
|
||||
void cserve2_shared_string_del(int id);
|
||||
|
|
|
@ -45,7 +45,7 @@ test_pipe_test(void)
|
|||
int sockets[2];
|
||||
struct timeval t;
|
||||
fd_set rfds;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
data *d;
|
||||
DWORD thread_id;
|
||||
HANDLE h;
|
||||
|
|
|
@ -280,6 +280,7 @@ ffi.cdef [[
|
|||
const char *eolian_type_file_get(const Eolian_Type *tp);
|
||||
const Eolian_Type *eolian_type_return_type_get(const Eolian_Type *tp);
|
||||
const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
|
||||
const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
|
||||
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
||||
Eina_Bool eolian_type_is_own(const Eolian_Type *tp);
|
||||
Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
||||
|
@ -423,7 +424,8 @@ M.type_type = {
|
|||
STRUCT_OPAQUE = 7,
|
||||
ENUM = 8,
|
||||
ALIAS = 9,
|
||||
CLASS = 10
|
||||
CLASS = 10,
|
||||
UNDEFINED = 11
|
||||
}
|
||||
|
||||
ffi.metatype("Eolian_Struct_Type_Field", {
|
||||
|
@ -538,6 +540,12 @@ M.Type = ffi.metatype("Eolian_Type", {
|
|||
return v
|
||||
end,
|
||||
|
||||
aliased_base_get = function(self)
|
||||
local v = eolian.eolian_type_aliased_byse_get(self)
|
||||
if v == nil then return nil end
|
||||
return v
|
||||
end,
|
||||
|
||||
class_get = function(self)
|
||||
local v = eolian.eolian_type_class_get(self)
|
||||
if v == nil then return nil end
|
||||
|
|
|
@ -144,7 +144,7 @@ main(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
cd = (Consumer_Data *)calloc(sizeof(Consumer_Data), 1);
|
||||
cd = (Consumer_Data *)calloc(1, sizeof(Consumer_Data));
|
||||
|
||||
if (!cd || !(cd->consumer = ecore_buffer_consumer_new(name, queue_size, WIDTH, HEIGHT)))
|
||||
{
|
||||
|
|
|
@ -244,7 +244,7 @@ main(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
pd = (Provider_Data *)calloc(sizeof(Provider_Data), 1);
|
||||
pd = (Provider_Data *)calloc(1, sizeof(Provider_Data));
|
||||
|
||||
if (!pd || !(pd->provider = ecore_buffer_provider_new(name)))
|
||||
{
|
||||
|
|
|
@ -49,7 +49,8 @@ toggle_using_filter.edc \
|
|||
box_example.edc \
|
||||
embryo_tween_anim.edc \
|
||||
embryo_set_state_anim.edc \
|
||||
bezier-transition-example.edc
|
||||
bezier-transition-example.edc \
|
||||
textblock-hyphen.edc
|
||||
|
||||
DIST_EDCS = $(EDCS)
|
||||
|
||||
|
@ -106,7 +107,8 @@ edje-basic2.c \
|
|||
signals2.c \
|
||||
edje-swallow2.c \
|
||||
edje-multisense.c \
|
||||
edje-edit-part-box.c
|
||||
edje-edit-part-box.c \
|
||||
edje-textblock-hyphenation.c
|
||||
|
||||
EXTRA_DIST = $(DIST_EDCS) $(DATA_FILES)
|
||||
|
||||
|
@ -175,7 +177,8 @@ animations2 \
|
|||
edje-basic2 \
|
||||
signals2 \
|
||||
edje-swallow2 \
|
||||
edje-edit-part-box
|
||||
edje-edit-part-box \
|
||||
edje-textblock-hyphenation
|
||||
|
||||
if ENABLE_MULTISENSE
|
||||
EXTRA_PROGRAMS += edje-multisense
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
/**
|
||||
* Edje example for hyphenation option with TEXTBLOCK parts
|
||||
*
|
||||
* You'll need at least one Evas engine built for it (excluding the
|
||||
* buffer one). See stdout/stderr for output.
|
||||
*
|
||||
* @verbatim
|
||||
* edje_cc swallow.edc && gcc -o edje-textblock-hyphenation edje-textblock-hyphenation.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#else
|
||||
# define EINA_UNUSED
|
||||
#endif
|
||||
|
||||
#ifndef PACKAGE_DATA_DIR
|
||||
#define PACKAGE_DATA_DIR "."
|
||||
#endif
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_Evas.h>
|
||||
#include <Edje.h>
|
||||
#include <locale.h>
|
||||
|
||||
#define WIDTH (300)
|
||||
#define HEIGHT (300)
|
||||
|
||||
static void
|
||||
_on_delete(Ecore_Evas *ee EINA_UNUSED)
|
||||
{
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
/* here just to keep our example's window size and background image's
|
||||
* size in synchrony */
|
||||
static void
|
||||
_on_canvas_resize(Ecore_Evas *ee)
|
||||
{
|
||||
Evas_Object *bg, *edj;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
|
||||
bg = ecore_evas_data_get(ee, "background");
|
||||
evas_object_resize(bg, w, h);
|
||||
edj = ecore_evas_data_get(ee, "edje_obj");
|
||||
evas_object_resize(edj, w, h);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
|
||||
{
|
||||
const char *edje_file = PACKAGE_DATA_DIR"/textblock-hyphen.edj";
|
||||
Ecore_Evas *ee;
|
||||
Evas *evas;
|
||||
Evas_Object *bg;
|
||||
Evas_Object *edje_obj;
|
||||
|
||||
if (!ecore_evas_init())
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if (!edje_init())
|
||||
goto shutdown_ecore_evas;
|
||||
|
||||
/* this will give you a window with an Evas canvas under the first
|
||||
* engine available */
|
||||
ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
|
||||
if (!ee) goto shutdown_edje;
|
||||
|
||||
ecore_evas_callback_delete_request_set(ee, _on_delete);
|
||||
ecore_evas_callback_resize_set(ee, _on_canvas_resize);
|
||||
ecore_evas_title_set(ee, "Edje Textblock Hyphenation");
|
||||
|
||||
evas = ecore_evas_get(ee);
|
||||
|
||||
bg = evas_object_rectangle_add(evas);
|
||||
evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
|
||||
evas_object_move(bg, 0, 0); /* at canvas' origin */
|
||||
evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
|
||||
evas_object_show(bg);
|
||||
ecore_evas_data_set(ee, "background", bg);
|
||||
|
||||
setlocale(LC_MESSAGES, "en_US.UTF-8");
|
||||
|
||||
edje_obj = edje_object_add(evas);
|
||||
|
||||
edje_object_file_set(edje_obj, edje_file, "example_textblock_hyphenation");
|
||||
evas_object_move(edje_obj, 0, 0); /* at canvas' origin */
|
||||
evas_object_resize(edje_obj, WIDTH, HEIGHT);
|
||||
evas_object_show(edje_obj);
|
||||
ecore_evas_data_set(ee, "edje_obj", edje_obj);
|
||||
|
||||
edje_object_part_text_set(edje_obj, "text_part", "Hello world hyphenation world");
|
||||
|
||||
ecore_evas_show(ee);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
ecore_evas_free(ee);
|
||||
ecore_evas_shutdown();
|
||||
edje_shutdown();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
shutdown_edje:
|
||||
edje_shutdown();
|
||||
shutdown_ecore_evas:
|
||||
ecore_evas_shutdown();
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
collections {
|
||||
styles {
|
||||
style { name: "entry_style";
|
||||
base: "font="DejavuSans" font_size=10 color=#000 wrap=hyphenation left_margin=2 right_margin=2";
|
||||
}
|
||||
}
|
||||
group {
|
||||
name: "example_textblock_hyphenation";
|
||||
min: 10 50;
|
||||
|
||||
parts {
|
||||
part {
|
||||
name: "text_part"; type: TEXTBLOCK;
|
||||
description {
|
||||
min: 10 50;
|
||||
state: "default" 0.0;
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel2.relative: 1.0 1.0;
|
||||
text {
|
||||
style: "entry_style";
|
||||
min: 0 1;
|
||||
align: 0.0 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ int main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
char *time_arr;
|
||||
time_t curr_time;
|
||||
struct tm *info;
|
||||
char *b64;
|
||||
|
||||
eina_init();
|
||||
|
||||
|
@ -68,6 +69,10 @@ int main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
printf("Today's Date: %s\n", time_arr);
|
||||
free(time_arr);
|
||||
|
||||
b64 = eina_str_base64_encode((unsigned char *)"Enlightenment", 9);
|
||||
printf("%s\n", b64);
|
||||
free(b64);
|
||||
|
||||
eina_shutdown();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -141,10 +141,10 @@ eolian_cxx_complex_types_01_SOURCES = eolian_cxx_complex_types_01.cc
|
|||
true $<
|
||||
|
||||
%.eo.c: %.eo
|
||||
$(AM_V_EOL)$(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o $@ $<
|
||||
$(AM_V_EOL)$(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gc -o $@ $<
|
||||
|
||||
%.eo.h: %.eo
|
||||
$(AM_V_EOL)$(EOLIAN_GEN) --eo $(EOLIAN_FLAGS) --gh -o $@ $<
|
||||
$(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) --gh -o $@ $<
|
||||
|
||||
examples: $(ECXX_EXAMPLE_EOS) $(GENERATED) $(EXTRA_PROGRAMS)
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ all: $(OBJS) examples
|
|||
codegen:
|
||||
$(EOLIAN_CXX) $(EOLIAN_FLAGS) -I./colourable.eo -o colourable.eo.hh
|
||||
$(EOLIAN_CXX) $(EOLIAN_FLAGS) -I./colourablesquare.eo -o colourablesquare.eo.hh
|
||||
$(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o colourable.eo.c colourable.eo
|
||||
$(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o colourablesquare.eo.c colourablesquare.eo
|
||||
$(EOLIAN_GEN) --eo $(EOLIAN_FLAGS) --gh -o colourable.eo.h colourable.eo
|
||||
$(EOLIAN_GEN) --eo $(EOLIAN_FLAGS) --gh -o colourablesquare.eo.h colourablesquare.eo
|
||||
$(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gc -o colourable.eo.c colourable.eo
|
||||
$(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gc -o colourablesquare.eo.c colourablesquare.eo
|
||||
$(EOLIAN_GEN) $(EOLIAN_FLAGS) --gh -o colourable.eo.h colourable.eo
|
||||
$(EOLIAN_GEN) $(EOLIAN_FLAGS) --gh -o colourablesquare.eo.h colourablesquare.eo
|
||||
|
||||
$(OBJS): codegen
|
||||
$(CC) -c colourable.c $(COMMON_FLAGS)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* one). See stdout/stderr for output.
|
||||
*
|
||||
* @verbatim
|
||||
* gcc -o evas_vg_simple evas-vg-simple.c `pkg-config --libs --cflags evas ecore ecore-evas eina ector eo efl`
|
||||
* gcc -o evas_vg_simple evas-vg-simple.c `pkg-config --libs --cflags evas ecore ecore-evas eina ector eo efl` -lm
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
|
@ -370,9 +370,9 @@ void _arcto(Efl_VG *obj, int x, int y, int width, int height, int startAngle, in
|
|||
for (i = 0; i < point_count; i += 3)
|
||||
{
|
||||
evas_vg_shape_shape_append_cubic_to(obj,
|
||||
pts[i+2].x, pts[i+2].y,
|
||||
pts[i].x, pts[i].y,
|
||||
pts[i+1].x, pts[i+1].y);
|
||||
pts[i+1].x, pts[i+1].y,
|
||||
pts[i+2].x, pts[i+2].y);
|
||||
}
|
||||
evas_vg_shape_shape_append_close(obj);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/**
|
||||
* @file Ecore_Cocoa.h
|
||||
*
|
||||
* @brief Ecore_Cocoa Wrapper Library to interact with the Cocoa
|
||||
* envirnement (Mac OS X) from the E environment
|
||||
*
|
||||
*/
|
||||
#ifndef __ECORE_COCOA_H__
|
||||
#define __ECORE_COCOA_H__
|
||||
|
||||
|
@ -26,27 +33,58 @@
|
|||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
#include "Ecore_Cocoa_Cursor.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Cocoa_Window
|
||||
* Opaque handler to manipulate a Cocoa Window through Ecore
|
||||
*/
|
||||
#ifndef _ECORE_COCOA_WINDOW_PREDEF
|
||||
typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
|
||||
#endif /* ! _ECORE_COCOA_WINDOW_PREDEF */
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Cocoa_Screen
|
||||
* Opaque handler to manipulate a Cocoa Screen through Ecore
|
||||
*/
|
||||
typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Cocoa_Window_Id
|
||||
* Opaque handler to reference the actual Cocoa window
|
||||
*/
|
||||
typedef void * Ecore_Cocoa_Window_Id;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Cocoa_Event_Video_Resize
|
||||
* Type of event thrown when a window is resized
|
||||
*/
|
||||
typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize;
|
||||
|
||||
/** Event triggered when a window receives focus */
|
||||
EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS;
|
||||
|
||||
/** Event triggered when a window loses focus */
|
||||
EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS;
|
||||
|
||||
/** Event triggered when a window is resized */
|
||||
EAPI extern int ECORE_COCOA_EVENT_RESIZE;
|
||||
EAPI extern int ECORE_COCOA_EVENT_EXPOSE;
|
||||
|
||||
EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY;
|
||||
|
||||
typedef void * Ecore_Cocoa_Window_Id;
|
||||
typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize;
|
||||
/**
|
||||
* @struct _Ecore_Cocoa_Event_Video_Resize
|
||||
* Data available when a window is resized
|
||||
*/
|
||||
struct _Ecore_Cocoa_Event_Video_Resize
|
||||
{
|
||||
int w;
|
||||
int h;
|
||||
Ecore_Cocoa_Window_Id wid;
|
||||
int w; /**< Current width of the window */
|
||||
int h; /**< Current height of the window */
|
||||
Ecore_Cocoa_Window_Id wid; /**< Handler of the Cocoa window */
|
||||
};
|
||||
|
||||
typedef struct _Ecore_Cocoa_Event_Window Ecore_Cocoa_Event_Window;
|
||||
|
@ -60,35 +98,106 @@ struct _Ecore_Cocoa_Screen
|
|||
int dummy;
|
||||
};
|
||||
|
||||
/* Core */
|
||||
/**
|
||||
* @typedef Ecore_Cocoa_Cnp_Type
|
||||
* Type used to interact with the Cocoa pasteboard.
|
||||
* It hold types that can apply to a context.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ECORE_COCOA_CNP_TYPE_UNKNOWN = 0, /**< Undefined type */
|
||||
ECORE_COCOA_CNP_TYPE_STRING = (1 << 0), /**< String type (pure text) */
|
||||
ECORE_COCOA_CNP_TYPE_MARKUP = (1 << 1), /**< Elementary markup */
|
||||
ECORE_COCOA_CNP_TYPE_IMAGE = (1 << 2), /**< Image (all formats) */
|
||||
ECORE_COCOA_CNP_TYPE_HTML = (1 << 3) /**< HTML */
|
||||
} Ecore_Cocoa_Cnp_Type;
|
||||
|
||||
EAPI int ecore_cocoa_init(void);
|
||||
EAPI int ecore_cocoa_shutdown(void);
|
||||
EAPI Eina_Bool ecore_cocoa_feed_events(void *anEvent);
|
||||
|
||||
/* Screen */
|
||||
/*============================================================================*
|
||||
* Core *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* Inits the Ecore_Cocoa library
|
||||
* @return How many times Ecore_Cocoa has been initted
|
||||
*/
|
||||
EAPI int ecore_cocoa_init(void);
|
||||
|
||||
/**
|
||||
* Shuts the Ecore_Cocoa library down
|
||||
* @return How many times Ecore_Cocoa has been initted
|
||||
*/
|
||||
EAPI int ecore_cocoa_shutdown(void);
|
||||
|
||||
|
||||
/*============================================================================*
|
||||
* Screen *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* Retrieves the size of a Cocoa screen
|
||||
* @param screen The screen which size must be retrieved
|
||||
* @param [out] w The width of the screen
|
||||
* @param [out] h The height of the screen
|
||||
*/
|
||||
EAPI void ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h);
|
||||
|
||||
/* Window */
|
||||
|
||||
/*============================================================================*
|
||||
* Window *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* Creates a Cocoa window
|
||||
* @param x The origin (X) where the window must be created
|
||||
* @param y The origin (Y) where the window must be created
|
||||
* @param width The width of the window
|
||||
* @param height The height of the window
|
||||
* @return A handler on the window. NULL on failure
|
||||
*/
|
||||
EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* Releases a Cocoa window
|
||||
* @param window The window to be released
|
||||
*/
|
||||
EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window);
|
||||
|
||||
EAPI void *ecore_cocoa_window_hwnd_get(Ecore_Cocoa_Window *window);
|
||||
|
||||
/**
|
||||
* Moves a Cocoa window to a given point
|
||||
* @param window The window to be moved
|
||||
* @param x The new origin of the window (X)
|
||||
* @param y The new origin of the window (Y)
|
||||
*/
|
||||
EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
/**
|
||||
* Resizes a Cocoa window to a given size
|
||||
* @param window The window to be moved
|
||||
* @param width The new width of the window
|
||||
* @param height The new height of the window
|
||||
*/
|
||||
EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* Moves and resizes a Cocoa window to a given point and size
|
||||
* @param window The window to be moved
|
||||
* @param x The new origin of the window (X)
|
||||
* @param y The new origin of the window (Y)
|
||||
* @param width The new width of the window
|
||||
* @param height The new height of the window
|
||||
* @see ecore_cocoa_window_resize()
|
||||
* @see ecore_cocoa_window_move()
|
||||
*/
|
||||
EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
|
||||
int x,
|
||||
int y,
|
||||
|
@ -163,7 +272,18 @@ EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
|
|||
|
||||
EAPI int ecore_cocoa_titlebar_height_get(void);
|
||||
|
||||
EAPI Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(Ecore_Cocoa_Window *window);
|
||||
EAPI Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(const Ecore_Cocoa_Window *window);
|
||||
|
||||
|
||||
EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data, int size, Ecore_Cocoa_Cnp_Type type);
|
||||
|
||||
EAPI void *ecore_cocoa_selection_clipboard_get(int *size, Ecore_Cocoa_Cnp_Type type,
|
||||
Ecore_Cocoa_Cnp_Type *retrieved_types);
|
||||
|
||||
EAPI void ecore_cocoa_selection_clipboard_clear(void);
|
||||
|
||||
EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c);
|
||||
EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef __ECORE_COCOA_CURSOR_H__
|
||||
#define __ECORE_COCOA_CURSOR_H__
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ECORE_COCOA_CURSOR_ARROW = 0,
|
||||
ECORE_COCOA_CURSOR_CONTEXTUAL_MENU,
|
||||
ECORE_COCOA_CURSOR_CLOSED_HAND,
|
||||
ECORE_COCOA_CURSOR_CROSSHAIR,
|
||||
ECORE_COCOA_CURSOR_DISAPPEARING_ITEM,
|
||||
ECORE_COCOA_CURSOR_DRAG_COPY,
|
||||
ECORE_COCOA_CURSOR_DRAG_LINK,
|
||||
ECORE_COCOA_CURSOR_IBEAM,
|
||||
ECORE_COCOA_CURSOR_OPEN_HAND,
|
||||
ECORE_COCOA_CURSOR_OPERATION_NOT_ALLOWED,
|
||||
ECORE_COCOA_CURSOR_POINTING_HAND,
|
||||
ECORE_COCOA_CURSOR_RESIZE_DOWN,
|
||||
ECORE_COCOA_CURSOR_RESIZE_LEFT,
|
||||
ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT,
|
||||
ECORE_COCOA_CURSOR_RESIZE_RIGHT,
|
||||
ECORE_COCOA_CURSOR_RESIZE_UP,
|
||||
ECORE_COCOA_CURSOR_RESIZE_UP_DOWN,
|
||||
ECORE_COCOA_CURSOR_IBEAM_VERTICAL,
|
||||
|
||||
__ECORE_COCOA_CURSOR_LAST, /* Sentinel */
|
||||
|
||||
ECORE_COCOA_CURSOR_DEFAULT = ECORE_COCOA_CURSOR_ARROW
|
||||
|
||||
} Ecore_Cocoa_Cursor;
|
||||
|
||||
#endif /* ! __ECORE_COCOA_CURSOR_H__ */
|
||||
|
|
@ -12,13 +12,16 @@
|
|||
#include <Ecore_Input.h>
|
||||
|
||||
#include "Ecore_Cocoa.h"
|
||||
#include "Ecore_Cocoa_Keys.h"
|
||||
|
||||
#define _ECORE_COCOA_KEYS_MANUAL_GUARD_
|
||||
#include "ecore_cocoa_keys.h"
|
||||
#undef _ECORE_COCOA_KEYS_MANUAL_GUARD_
|
||||
|
||||
#include "ecore_cocoa_private.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;
|
||||
EAPI int ECORE_COCOA_EVENT_WINDOW_DESTROY = 0;
|
||||
|
||||
static int _ecore_cocoa_init_count = 0;
|
||||
|
@ -47,13 +50,13 @@ ecore_cocoa_init(void)
|
|||
}
|
||||
|
||||
DBG("");
|
||||
|
||||
|
||||
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();
|
||||
ECORE_COCOA_EVENT_WINDOW_DESTROY = ecore_event_type_new();
|
||||
|
||||
|
||||
/* Init the Application handler */
|
||||
[Ecore_Cocoa_Application sharedApplication];
|
||||
[NSApp setDelegate:[Ecore_Cocoa_AppDelegate appDelegate]];
|
||||
|
@ -61,6 +64,9 @@ ecore_cocoa_init(void)
|
|||
/* Start events monitoring */
|
||||
[NSApp run];
|
||||
|
||||
if (!_ecore_cocoa_window_init())
|
||||
return --_ecore_cocoa_init_count;
|
||||
|
||||
return _ecore_cocoa_init_count;
|
||||
}
|
||||
|
||||
|
@ -85,7 +91,7 @@ ecore_cocoa_shutdown(void)
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
_ecore_cocoa_event_modifiers(unsigned int mod)
|
||||
_ecore_cocoa_event_modifiers(NSUInteger mod)
|
||||
{
|
||||
unsigned int modifiers = 0;
|
||||
|
||||
|
@ -95,13 +101,15 @@ _ecore_cocoa_event_modifiers(unsigned int mod)
|
|||
if(mod & NSCommandKeyMask) modifiers |= ECORE_EVENT_MODIFIER_WIN;
|
||||
if(mod & NSNumericPadKeyMask) modifiers |= ECORE_EVENT_LOCK_NUM;
|
||||
|
||||
DBG("key modifiers: %d, %d", mod, modifiers);
|
||||
DBG("key modifiers: 0x%lx, %u", mod, modifiers);
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
|
||||
static inline Ecore_Event_Key*
|
||||
_ecore_cocoa_event_key(NSEvent *event, int keyType)
|
||||
static Ecore_Event_Key*
|
||||
_ecore_cocoa_event_key(NSEvent *event,
|
||||
NSEventType keyType,
|
||||
unsigned int time)
|
||||
{
|
||||
static Eina_Bool compose = EINA_FALSE;
|
||||
static NSText *edit;
|
||||
|
@ -113,7 +121,7 @@ _ecore_cocoa_event_key(NSEvent *event, int keyType)
|
|||
NSString *keychar = [event charactersIgnoringModifiers];
|
||||
NSString *keycharRaw = [event characters];
|
||||
|
||||
DBG("Event Key, keyTpe : %d", keyType);
|
||||
DBG("Event Key, keyType : %lu", keyType);
|
||||
|
||||
ev = calloc(1, sizeof (Ecore_Event_Key));
|
||||
if (!ev) return NULL;
|
||||
|
@ -124,6 +132,7 @@ _ecore_cocoa_event_key(NSEvent *event, int keyType)
|
|||
compose=EINA_FALSE;
|
||||
}
|
||||
|
||||
ev->timestamp = time;
|
||||
ev->modifiers = _ecore_cocoa_event_modifiers([event modifierFlags]);
|
||||
|
||||
ev->keycode = event.keyCode;
|
||||
|
@ -163,8 +172,8 @@ _ecore_cocoa_event_key(NSEvent *event, int keyType)
|
|||
return ev;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_cocoa_feed_events(void *anEvent)
|
||||
Eina_Bool
|
||||
_ecore_cocoa_feed_events(void *anEvent)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(anEvent, EINA_FALSE);
|
||||
|
||||
|
@ -194,10 +203,9 @@ ecore_cocoa_feed_events(void *anEvent)
|
|||
{
|
||||
Ecore_Event_Key *ev;
|
||||
|
||||
ev = _ecore_cocoa_event_key(event, NSKeyDown);
|
||||
ev = _ecore_cocoa_event_key(event, NSKeyDown, time);
|
||||
if (ev == NULL) return EINA_TRUE;
|
||||
|
||||
ev->timestamp = time;
|
||||
ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
|
||||
|
||||
break;
|
||||
|
@ -206,17 +214,16 @@ ecore_cocoa_feed_events(void *anEvent)
|
|||
{
|
||||
Ecore_Event_Key *ev;
|
||||
|
||||
ev = _ecore_cocoa_event_key(event, NSKeyUp);
|
||||
ev = _ecore_cocoa_event_key(event, NSKeyUp, time);
|
||||
if (ev == NULL) return EINA_TRUE;
|
||||
|
||||
ev->timestamp = time;
|
||||
ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case NSFlagsChanged:
|
||||
{
|
||||
int flags = [event modifierFlags];
|
||||
NSUInteger flags = [event modifierFlags];
|
||||
|
||||
Ecore_Event_Key *evDown = NULL;
|
||||
Ecore_Event_Key *evUp = NULL;
|
||||
|
@ -254,7 +261,7 @@ ecore_cocoa_feed_events(void *anEvent)
|
|||
return pass;
|
||||
}
|
||||
|
||||
int changed_flags = flags ^ old_flags;
|
||||
NSUInteger changed_flags = flags ^ old_flags;
|
||||
|
||||
// Turn special key flags off
|
||||
if (changed_flags & NSShiftKeyMask)
|
||||
|
@ -280,37 +287,6 @@ ecore_cocoa_feed_events(void *anEvent)
|
|||
|
||||
break;
|
||||
}
|
||||
case NSAppKitDefined:
|
||||
{
|
||||
if ([event subtype] == NSApplicationActivatedEventType)
|
||||
{
|
||||
Ecore_Cocoa_Event_Window *ev;
|
||||
|
||||
ev = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
||||
if (!ev)
|
||||
{
|
||||
pass = EINA_FALSE;
|
||||
break;
|
||||
}
|
||||
ev->wid = [event window];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, ev, NULL, NULL);
|
||||
}
|
||||
else if ([event subtype] == NSApplicationDeactivatedEventType)
|
||||
{
|
||||
Ecore_Cocoa_Event_Window *ev;
|
||||
|
||||
ev = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
||||
if (!ev)
|
||||
{
|
||||
pass = EINA_FALSE;
|
||||
break;
|
||||
}
|
||||
ev->wid = [event window];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, ev, NULL, NULL);
|
||||
}
|
||||
pass = EINA_TRUE; // pass along AppKit events, for window manager
|
||||
break;
|
||||
}
|
||||
case NSScrollWheel:
|
||||
{
|
||||
DBG("Scroll Wheel");
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
- (id)init;
|
||||
- (void)internalUpdate;
|
||||
|
||||
- (void) pauseNSRunLoopMonitoring;
|
||||
- (void) resumeNSRunLoopMonitoring;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface Ecore_Cocoa_AppDelegate : NSObject <NSApplicationDelegate>
|
||||
|
||||
+ (Ecore_Cocoa_AppDelegate *)appDelegate;
|
||||
- (id)init;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -52,10 +52,17 @@ _ecore_cocoa_run_loop_cb(void *data EINA_UNUSED)
|
|||
{
|
||||
self = [super init];
|
||||
if (self == nil) {
|
||||
// XXX Critical error. Abort right now! Log?
|
||||
return nil;
|
||||
CRI("Failed to [super init]");
|
||||
return nil;
|
||||
}
|
||||
NSApp = self; // NSApp is used EVERYWHERE! Set it right now!
|
||||
|
||||
/* Set the process to be a foreground process,
|
||||
* without that it prevents the window to become the key window and
|
||||
* receive all mouse mouve events. */
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
return NSApp;
|
||||
}
|
||||
|
||||
|
@ -83,11 +90,26 @@ _ecore_cocoa_run_loop_cb(void *data EINA_UNUSED)
|
|||
/* Some events shall be handled by Ecore (like single non-command keys).
|
||||
* If we dispatch all events right to NSApplication, it will complain
|
||||
* with NSBeep() when an event is not authorized */
|
||||
to_super = ecore_cocoa_feed_events(anEvent);
|
||||
to_super = _ecore_cocoa_feed_events(anEvent);
|
||||
if (to_super)
|
||||
[super sendEvent:anEvent];
|
||||
}
|
||||
|
||||
- (void) pauseNSRunLoopMonitoring
|
||||
{
|
||||
/*
|
||||
* After calling this method, we will run an iteration of
|
||||
* the main loop. We don't want this timer to be fired while
|
||||
* calling manually the ecore loop, because it will query the
|
||||
* NSRunLoop, which blocks during live resize.
|
||||
*/
|
||||
ecore_timer_freeze(_timer);
|
||||
}
|
||||
|
||||
- (void) resumeNSRunLoopMonitoring
|
||||
{
|
||||
ecore_timer_thaw(_timer);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
@ -105,13 +127,7 @@ static Ecore_Cocoa_AppDelegate *_appDelegate = nil;
|
|||
return _appDelegate;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) EINA_UNUSED sender
|
||||
{
|
||||
// XXX This should be alterable (by Elm_Window policy)
|
||||
return YES;
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Evas.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "ecore_cocoa_window.h"
|
||||
#include "ecore_cocoa_private.h"
|
||||
#import "ecore_cocoa_app.h"
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_cocoa_selection_clipboard_set(const void *data,
|
||||
int size,
|
||||
Ecore_Cocoa_Cnp_Type type)
|
||||
{
|
||||
NSMutableArray *objects;
|
||||
NSString *str = nil;
|
||||
BOOL ok = YES;
|
||||
|
||||
objects = [[NSMutableArray alloc] init];
|
||||
if (type & ECORE_COCOA_CNP_TYPE_STRING)
|
||||
{
|
||||
str = [[NSString alloc] initWithBytes: data
|
||||
length: size
|
||||
encoding: NSUTF8StringEncoding];
|
||||
[objects addObject: str];
|
||||
}
|
||||
if (type & ECORE_COCOA_CNP_TYPE_MARKUP)
|
||||
{
|
||||
char *utf8;
|
||||
|
||||
utf8 = evas_textblock_text_markup_to_utf8(NULL, (const char *)data);
|
||||
str = [[NSString alloc] initWithBytes: utf8
|
||||
length: strlen(utf8) // XXX strlen() ?
|
||||
encoding: NSUTF8StringEncoding];
|
||||
free(utf8);
|
||||
[objects addObject: str];
|
||||
}
|
||||
if (type & ECORE_COCOA_CNP_TYPE_IMAGE)
|
||||
{
|
||||
WRN("Image CNP: NOT IMPLEMENTED");
|
||||
}
|
||||
if (type & ECORE_COCOA_CNP_TYPE_HTML)
|
||||
{
|
||||
WRN("HTML CNP: NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
/* Write to pasteboard */
|
||||
if ([objects count] > 0)
|
||||
{
|
||||
NSPasteboard *pb;
|
||||
|
||||
pb = [NSPasteboard generalPasteboard];
|
||||
[pb clearContents];
|
||||
ok = [pb writeObjects: objects];
|
||||
[objects removeAllObjects];
|
||||
}
|
||||
|
||||
return (ok) ? EINA_TRUE : EINA_FALSE;
|
||||
}
|
||||
|
||||
|
||||
EAPI void *
|
||||
ecore_cocoa_selection_clipboard_get(int *size,
|
||||
Ecore_Cocoa_Cnp_Type type,
|
||||
Ecore_Cocoa_Cnp_Type *retrieved_types)
|
||||
{
|
||||
NSMutableArray *classes;
|
||||
void *data;
|
||||
NSDictionary *options;
|
||||
NSPasteboard *pb;
|
||||
NSArray *items;
|
||||
unsigned int len;
|
||||
BOOL string_class = NO;
|
||||
Ecore_Cocoa_Cnp_Type types = 0;
|
||||
|
||||
classes = [[NSMutableArray alloc] init];
|
||||
|
||||
if ((type & ECORE_COCOA_CNP_TYPE_STRING) ||
|
||||
(type & ECORE_COCOA_CNP_TYPE_MARKUP))
|
||||
{
|
||||
string_class = YES;
|
||||
[classes addObject: [NSString class]];
|
||||
}
|
||||
if (type & ECORE_COCOA_CNP_TYPE_IMAGE)
|
||||
{
|
||||
WRN("Image CNP: NOT IMPLEMENTED");
|
||||
}
|
||||
if (type & ECORE_COCOA_CNP_TYPE_HTML)
|
||||
{
|
||||
WRN("HTML CNP: NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
if ([classes count] <= 0)
|
||||
{
|
||||
ERR("No registered classes... got nothing from pasteboard");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pb = [NSPasteboard generalPasteboard];
|
||||
options = [NSDictionary dictionary];
|
||||
items = [pb readObjectsForClasses: classes
|
||||
options: options];
|
||||
if (!items)
|
||||
{
|
||||
ERR("No items in the clipboard");
|
||||
goto remove_fail;
|
||||
}
|
||||
if ([items count] != 1)
|
||||
{
|
||||
ERR("%lu items in pasteboard. Only one at the time can be handled",
|
||||
[items count]);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (string_class)
|
||||
{
|
||||
NSString *str = [items objectAtIndex: 0];
|
||||
data = (void *)[str UTF8String];
|
||||
len = [str lengthOfBytesUsingEncoding: NSUTF8StringEncoding];
|
||||
data = strndup((const char *)data, len);
|
||||
|
||||
if (EINA_UNLIKELY(!data))
|
||||
{
|
||||
CRI("Failed to strndup() string \"%s\" (len: %u)",
|
||||
(const char *)data, len);
|
||||
goto remove_fail;
|
||||
}
|
||||
types |= ECORE_COCOA_CNP_TYPE_STRING;
|
||||
|
||||
#if 0
|
||||
if (type & ECORE_COCOA_CNP_TYPE_MARKUP)
|
||||
{
|
||||
char *markup;
|
||||
markup = evas_textblock_text_utf8_to_markup(NULL, data);
|
||||
free(data);
|
||||
data = markup;
|
||||
if (EINA_UNLIKELY(!data))
|
||||
{
|
||||
CRI("Failed to retrieve markup from UTF8");
|
||||
goto remove_fail;
|
||||
}
|
||||
len = strlen(markup);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!types)
|
||||
{
|
||||
ERR("No types retrieved!");
|
||||
goto remove_fail;
|
||||
}
|
||||
|
||||
[classes removeAllObjects];
|
||||
|
||||
if (size) *size = len;
|
||||
if (retrieved_types) *retrieved_types = types;
|
||||
return data;
|
||||
|
||||
remove_fail:
|
||||
[classes removeAllObjects];
|
||||
fail:
|
||||
if (size) *size = 0;
|
||||
if (retrieved_types) *retrieved_types = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_cocoa_selection_clipboard_clear(void)
|
||||
{
|
||||
[[NSPasteboard generalPasteboard] clearContents];
|
||||
}
|
|
@ -1,6 +1,12 @@
|
|||
#ifndef ECORE_COCOA_KEYS_H__
|
||||
#define ECORE_COCOA_KEYS_H__
|
||||
|
||||
/* Prevent innocent devs to include this directly. */
|
||||
#ifndef _ECORE_COCOA_KEYS_MANUAL_GUARD_
|
||||
# error This header must be be included directly!
|
||||
#endif
|
||||
|
||||
|
||||
struct _ecore_cocoa_keys_s
|
||||
{
|
||||
int code;
|
|
@ -62,4 +62,11 @@ struct _Ecore_Cocoa_Window
|
|||
};
|
||||
|
||||
|
||||
/* Internal init */
|
||||
Eina_Bool _ecore_cocoa_window_init(void);
|
||||
|
||||
Eina_Bool _ecore_cocoa_feed_events(void *anEvent);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,9 +6,14 @@
|
|||
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_Cocoa.h>
|
||||
#include <Ecore_Cocoa_Cursor.h>
|
||||
#import "ecore_cocoa_window.h"
|
||||
#import "ecore_cocoa_app.h"
|
||||
#include "ecore_cocoa_private.h"
|
||||
|
||||
static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
|
||||
|
||||
|
||||
@implementation EcoreCocoaWindow
|
||||
|
||||
@synthesize ecore_window_data;
|
||||
|
@ -18,19 +23,19 @@
|
|||
backing: (NSBackingStoreType) bufferingType
|
||||
defer: (BOOL) flag
|
||||
{
|
||||
if (![super initWithContentRect: contentRect
|
||||
styleMask: aStyle
|
||||
backing: bufferingType
|
||||
defer: flag]) return nil;
|
||||
if (![super initWithContentRect: contentRect
|
||||
styleMask: aStyle
|
||||
backing: bufferingType
|
||||
defer: flag]) return nil;
|
||||
|
||||
[self setBackgroundColor: [NSColor whiteColor]];
|
||||
[self makeKeyWindow];
|
||||
[self setDelegate:self];
|
||||
[self setAcceptsMouseMovedEvents:YES];
|
||||
[self setBackgroundColor: [NSColor whiteColor]];
|
||||
[self makeKeyWindow];
|
||||
[self setDelegate:self];
|
||||
[self setAcceptsMouseMovedEvents:YES];
|
||||
|
||||
[self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
[self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isFullScreen
|
||||
|
@ -45,34 +50,33 @@
|
|||
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *) EINA_UNUSED notification
|
||||
- (void)windowWillClose:(NSNotification *) notification
|
||||
{
|
||||
NSLog(@"window is going to be closed");
|
||||
Ecore_Cocoa_Event_Window *event;
|
||||
|
||||
event = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
||||
if (event == NULL)
|
||||
event = malloc(sizeof(*event));
|
||||
if (EINA_UNLIKELY(event == NULL))
|
||||
{
|
||||
// FIXME Use Eina_Log
|
||||
printf("Failed to allocate Ecore_Cocoa_Event_Window_destroy\n");
|
||||
return;
|
||||
CRI("Failed to allocate Ecore_Cocoa_Event_Window");
|
||||
return;
|
||||
}
|
||||
event->wid = [notification object];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, event, NULL, NULL);
|
||||
}
|
||||
|
||||
- (void)windowDidResize:(NSNotification *) EINA_UNUSED notif
|
||||
- (void)windowDidResize:(NSNotification *) notif
|
||||
{
|
||||
Ecore_Cocoa_Event_Video_Resize *event;
|
||||
NSSize size = self.frame.size;
|
||||
|
||||
event = malloc(sizeof(Ecore_Cocoa_Event_Video_Resize));
|
||||
if (event == NULL)
|
||||
event = malloc(sizeof(*event));
|
||||
if (EINA_UNLIKELY(event == NULL))
|
||||
{
|
||||
DBG("Failed to allocate Ecore_Cocoa_Event_Video_Resize\n");
|
||||
CRI("Failed to allocate Ecore_Cocoa_Event_Video_Resize");
|
||||
return;
|
||||
}
|
||||
event->w = size.width;
|
||||
|
@ -80,34 +84,55 @@
|
|||
(([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
||||
event->wid = [notif object];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_RESIZE, event, NULL, NULL);
|
||||
|
||||
/*
|
||||
* During live resize, NSRunLoop blocks, and prevent the ecore_main_loop
|
||||
* to be run.
|
||||
* This, combined with the -pauseNSRunLoopMonitoring and
|
||||
* -resumeNSRunLoopMonitoring methods invoked in
|
||||
* -windowWillStartLiveResize and -windowDidEndLiveResize
|
||||
* allow the ecore_main_loop to run withing NSRunLoop during the
|
||||
* live resizing of a window.
|
||||
*/
|
||||
ecore_main_loop_iterate();
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
Ecore_Cocoa_Event_Window *e;
|
||||
Ecore_Cocoa_Event_Window *e;
|
||||
|
||||
e = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
||||
if (!e)
|
||||
{
|
||||
DBG("GOT_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n");
|
||||
return;
|
||||
}
|
||||
e->wid = [notification object];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL);
|
||||
e = malloc(sizeof(*e));
|
||||
if (EINA_UNLIKELY(e == NULL))
|
||||
{
|
||||
CRI("Failed to allocate Ecore_Cocoa_Event_Window");
|
||||
return;
|
||||
}
|
||||
e->wid = [notification object];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL);
|
||||
}
|
||||
|
||||
- (void) windowWillStartLiveResize:(NSNotification *) EINA_UNUSED notification
|
||||
{
|
||||
[NSApp pauseNSRunLoopMonitoring];
|
||||
}
|
||||
|
||||
- (void) windowDidEndLiveResize:(NSNotification *) EINA_UNUSED notification
|
||||
{
|
||||
[NSApp resumeNSRunLoopMonitoring];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
Ecore_Cocoa_Event_Window *e;
|
||||
Ecore_Cocoa_Event_Window *e;
|
||||
|
||||
e = malloc(sizeof(Ecore_Cocoa_Event_Window));
|
||||
if (!e)
|
||||
{
|
||||
DBG("LOST_FOCUS: Failed to allocate Ecore_Cocoa_Event_Window\n");
|
||||
return;
|
||||
}
|
||||
e->wid = [notification object];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL);
|
||||
e = malloc(sizeof(*e));
|
||||
if (EINA_UNLIKELY(e == NULL))
|
||||
{
|
||||
CRI("Failed to allocate Ecore_Cocoa_Event_Window");
|
||||
return;
|
||||
}
|
||||
e->wid = [notification object];
|
||||
ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL);
|
||||
}
|
||||
|
||||
- (void) mouseDown:(NSEvent*) event
|
||||
|
@ -129,7 +154,12 @@
|
|||
}
|
||||
|
||||
Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
||||
if (!ev) return;
|
||||
|
||||
if (EINA_UNLIKELY(!ev))
|
||||
{
|
||||
CRI("Failed to allocate Ecore_Event_Mouse_Button");
|
||||
return;
|
||||
}
|
||||
|
||||
ev->x = x;
|
||||
ev->y = y;
|
||||
|
@ -161,12 +191,12 @@
|
|||
|
||||
- (void) rightMouseDown:(NSEvent*) event
|
||||
{
|
||||
[self mouseDown: event];
|
||||
[self mouseDown: event];
|
||||
}
|
||||
|
||||
- (void) otherMouseDown:(NSEvent*) event
|
||||
{
|
||||
[self mouseDown: event];
|
||||
[self mouseDown: event];
|
||||
}
|
||||
|
||||
- (void) mouseUp:(NSEvent*) event
|
||||
|
@ -181,8 +211,12 @@
|
|||
int x = pt.x;
|
||||
int y = h - pt.y;
|
||||
|
||||
Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
||||
if (!ev) return;
|
||||
Ecore_Event_Mouse_Button *ev = calloc(1, sizeof(*ev));
|
||||
if (EINA_UNLIKELY(!ev))
|
||||
{
|
||||
CRI("Failed to allocate Ecore_Event_Mouse_Button");
|
||||
return;
|
||||
}
|
||||
|
||||
ev->x = x;
|
||||
ev->y = y;
|
||||
|
@ -214,19 +248,23 @@
|
|||
|
||||
- (void) rightMouseUp:(NSEvent*) event
|
||||
{
|
||||
[self mouseUp: event];
|
||||
[self mouseUp: event];
|
||||
}
|
||||
|
||||
- (void) otherMouseUp:(NSEvent*) event
|
||||
{
|
||||
[self mouseUp: event];
|
||||
[self mouseUp: event];
|
||||
}
|
||||
|
||||
- (void) mouseMoved:(NSEvent*) event
|
||||
{
|
||||
unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
|
||||
Ecore_Event_Mouse_Move * ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
|
||||
if (!ev) return;
|
||||
Ecore_Event_Mouse_Move *ev = calloc(1, sizeof(*ev));
|
||||
if (EINA_UNLIKELY(!ev))
|
||||
{
|
||||
CRI("Failed to allocate Ecore_Event_Mouse_Move");
|
||||
return;
|
||||
}
|
||||
|
||||
NSView *view = [self contentView];
|
||||
NSPoint event_location = [event locationInWindow];
|
||||
|
@ -251,202 +289,196 @@
|
|||
|
||||
@end
|
||||
|
||||
Ecore_Cocoa_Window *
|
||||
EAPI Ecore_Cocoa_Window *
|
||||
ecore_cocoa_window_new(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
Ecore_Cocoa_Window *w;
|
||||
Ecore_Cocoa_Window *w;
|
||||
EcoreCocoaWindow *window;
|
||||
NSRect frame = NSMakeRect(x, y, width, height);
|
||||
NSUInteger style =
|
||||
NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
NSResizableWindowMask |
|
||||
NSMiniaturizableWindowMask;
|
||||
|
||||
EcoreCocoaWindow *window = [[EcoreCocoaWindow alloc] initWithContentRect:NSMakeRect(x, y, width, height)
|
||||
styleMask:(NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
NSResizableWindowMask |
|
||||
NSMiniaturizableWindowMask)
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
window = [[EcoreCocoaWindow alloc] initWithContentRect:frame
|
||||
styleMask:style
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
if (EINA_UNLIKELY(!window))
|
||||
{
|
||||
CRI("Failed to create EcoreCocoaWindow");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!window)
|
||||
return NULL;
|
||||
w = calloc(1, sizeof(Ecore_Cocoa_Window));
|
||||
if (EINA_UNLIKELY(w == NULL))
|
||||
{
|
||||
CRI("Failed to allocate Ecore_Cocoa_Window");
|
||||
[window release];
|
||||
return NULL;
|
||||
}
|
||||
w->window = window;
|
||||
w->borderless = 0;
|
||||
|
||||
//Set the process to be a foreground process,
|
||||
//without that it prevents the window to become the key window and
|
||||
//receive all mouse mouve events.
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
window.ecore_window_data = w;
|
||||
|
||||
|
||||
w = calloc(1, sizeof(Ecore_Cocoa_Window));
|
||||
if (w == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
w->window = window;
|
||||
w->borderless = 0;
|
||||
|
||||
window.ecore_window_data = w;
|
||||
|
||||
return w;
|
||||
return w;
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_free(Ecore_Cocoa_Window *window)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
[window->window release];
|
||||
free(window);
|
||||
[window->window release];
|
||||
free(window);
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
|
||||
unsigned int w,
|
||||
unsigned int h)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
NSSize size = {w,h};
|
||||
window->window.contentMinSize = size;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
NSSize size = {w,h};
|
||||
window->window.contentMinSize = size;
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
|
||||
unsigned int w,
|
||||
unsigned int h)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
NSSize size = {w,h};
|
||||
window->window.contentMaxSize = size;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
NSSize size = {w,h};
|
||||
window->window.contentMaxSize = size;
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
|
||||
unsigned int w,
|
||||
unsigned int h)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
NSSize size = {w,h};
|
||||
window->window.contentResizeIncrements = size;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
NSSize size = {w,h};
|
||||
window->window.contentResizeIncrements = size;
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
|
||||
int x,
|
||||
int y)
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
NSRect win_frame;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
NSRect win_frame;
|
||||
|
||||
win_frame = [window->window frame];
|
||||
win_frame.origin.x = x;
|
||||
win_frame.origin.y = y;
|
||||
win_frame = [window->window frame];
|
||||
win_frame.origin.x = x;
|
||||
win_frame.origin.y = y;
|
||||
|
||||
[window->window setFrame:win_frame display:YES];
|
||||
[window->window setFrame:win_frame display:YES];
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
|
||||
int width,
|
||||
int height)
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
if (!window) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
NSRect win_frame;
|
||||
NSRect win_frame;
|
||||
|
||||
win_frame = [window->window frame];
|
||||
win_frame.size.height = height +
|
||||
(([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
||||
win_frame.size.width = width;
|
||||
win_frame = [window->window frame];
|
||||
win_frame.size.height = height +
|
||||
(([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
||||
win_frame.size.width = width;
|
||||
|
||||
[window->window setFrame:win_frame display:YES];
|
||||
[window->window setFrame:win_frame display:YES];
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
if (!window) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
NSRect win_frame;
|
||||
NSRect win_frame;
|
||||
|
||||
win_frame = [window->window frame];
|
||||
win_frame.size.height = height +
|
||||
(([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
||||
win_frame.size.width = width;
|
||||
win_frame.origin.x = x;
|
||||
win_frame.origin.y = y;
|
||||
win_frame = [window->window frame];
|
||||
win_frame.size.height = height +
|
||||
(([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
|
||||
win_frame.size.width = width;
|
||||
win_frame.origin.x = x;
|
||||
win_frame.origin.y = y;
|
||||
|
||||
[window->window setFrame:win_frame display:YES];
|
||||
[window->window setFrame:win_frame display:YES];
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, const char *title)
|
||||
{
|
||||
if (!window || !title)
|
||||
return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
EINA_SAFETY_ON_NULL_RETURN(title);
|
||||
|
||||
[window->window setTitle:[NSString stringWithUTF8String:title]];
|
||||
[window->window setTitle:[NSString stringWithUTF8String:title]];
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_show(Ecore_Cocoa_Window *window)
|
||||
{
|
||||
if (!window || [window->window isVisible])
|
||||
{
|
||||
DBG("Window(%p) is not visible\n", window->window);
|
||||
return;
|
||||
}
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
[window->window makeKeyAndOrderFront:NSApp];
|
||||
if (![window->window isVisible])
|
||||
[window->window makeKeyAndOrderFront:NSApp];
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_hide(Ecore_Cocoa_Window *window)
|
||||
{
|
||||
if (!window || ![window->window isVisible])
|
||||
return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
[window->window orderOut:NSApp];
|
||||
if (![window->window isVisible])
|
||||
[window->window orderOut:NSApp];
|
||||
}
|
||||
|
||||
void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window)
|
||||
EAPI void
|
||||
ecore_cocoa_window_raise(Ecore_Cocoa_Window *window)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
[window->window orderFront:nil];
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
[window->window orderFront:nil];
|
||||
}
|
||||
|
||||
void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window)
|
||||
EAPI void
|
||||
ecore_cocoa_window_lower(Ecore_Cocoa_Window *window)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
[window->window orderBack:nil];
|
||||
}
|
||||
|
||||
void ecore_cocoa_window_activate(Ecore_Cocoa_Window *window)
|
||||
EAPI void
|
||||
ecore_cocoa_window_activate(Ecore_Cocoa_Window *window)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
[window->window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
|
||||
int on)
|
||||
EAPI void
|
||||
ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
|
||||
int on)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (on)
|
||||
{
|
||||
|
@ -458,46 +490,91 @@ void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
|
||||
int on)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (on)
|
||||
[window->window setContentBorderThickness:0.0
|
||||
forEdge:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge];
|
||||
if (on)
|
||||
[window->window setContentBorderThickness:0.0
|
||||
forEdge:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge];
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
|
||||
void *view)
|
||||
void *view)
|
||||
{
|
||||
if (!window || !view)
|
||||
return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
EINA_SAFETY_ON_NULL_RETURN(view);
|
||||
|
||||
//[[window->window contentView] addSubview:view];
|
||||
NSView *v = view;
|
||||
[window->window setContentView:view];
|
||||
//[[window->window contentView] addSubview:view];
|
||||
NSView *v = view;
|
||||
[window->window setContentView:view];
|
||||
|
||||
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[v frame]
|
||||
options:NSTrackingMouseMoved |
|
||||
NSTrackingActiveInActiveApp |
|
||||
NSTrackingInVisibleRect
|
||||
owner:v
|
||||
userInfo:nil];
|
||||
[v addTrackingArea:area];
|
||||
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[v frame]
|
||||
options:NSTrackingMouseMoved |
|
||||
NSTrackingActiveInActiveApp |
|
||||
NSTrackingInVisibleRect
|
||||
owner:v
|
||||
userInfo:nil];
|
||||
[v addTrackingArea:area];
|
||||
|
||||
[area release];
|
||||
[area release];
|
||||
}
|
||||
|
||||
Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(Ecore_Cocoa_Window *window)
|
||||
EAPI Ecore_Cocoa_Window_Id
|
||||
ecore_cocoa_window_get_window_id(const Ecore_Cocoa_Window *window)
|
||||
{
|
||||
if (!window)
|
||||
return 0;
|
||||
|
||||
DBG("Return : %p", window->window);
|
||||
|
||||
return window->window;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
||||
return window->window;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win,
|
||||
Ecore_Cocoa_Cursor c)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
EINA_SAFETY_ON_FALSE_RETURN((c >= 0) && (c <= __ECORE_COCOA_CURSOR_LAST));
|
||||
|
||||
NSCursor *cursor = _cursors[c];
|
||||
|
||||
DBG("Setting cursor %i (%s)", c, [[cursor description] UTF8String]);
|
||||
[cursor set];
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win,
|
||||
Eina_Bool show)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
if (show) [NSCursor unhide];
|
||||
else [NSCursor hide];
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_ecore_cocoa_window_init(void)
|
||||
{
|
||||
_cursors[ECORE_COCOA_CURSOR_ARROW] = [NSCursor arrowCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_CONTEXTUAL_MENU] = [NSCursor contextualMenuCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_CLOSED_HAND] = [NSCursor closedHandCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_CROSSHAIR] = [NSCursor crosshairCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_DISAPPEARING_ITEM] = [NSCursor disappearingItemCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_DRAG_COPY] = [NSCursor dragCopyCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_DRAG_LINK] = [NSCursor dragLinkCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_IBEAM] = [NSCursor IBeamCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_OPEN_HAND] = [NSCursor openHandCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_OPERATION_NOT_ALLOWED] = [NSCursor operationNotAllowedCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_POINTING_HAND] = [NSCursor pointingHandCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_RESIZE_DOWN] = [NSCursor resizeDownCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT] = [NSCursor resizeLeftCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT] = [NSCursor resizeLeftRightCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_RESIZE_RIGHT] = [NSCursor resizeRightCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_RESIZE_UP] = [NSCursor resizeUpCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_RESIZE_UP_DOWN] = [NSCursor resizeUpDownCursor];
|
||||
_cursors[ECORE_COCOA_CURSOR_IBEAM_VERTICAL] = [NSCursor IBeamCursorForVerticalLayout];
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2360,6 +2360,7 @@ _ecore_con_svr_udp_handler(void *data,
|
|||
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, ECORE_CALLBACK_RENEW);
|
||||
|
||||
cl->host_server = svr_obj;
|
||||
cl->fd = -1;
|
||||
cl->client_addr = malloc(client_addr_len);
|
||||
if (!cl->client_addr)
|
||||
{
|
||||
|
|
|
@ -442,12 +442,12 @@ ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
|
|||
{
|
||||
EINA_LIST_FOREACH(seat->devices, ll, edev)
|
||||
{
|
||||
if (!libinput_device_has_capability(edev->device,
|
||||
if (!libinput_device_has_capability(edev->device,
|
||||
LIBINPUT_DEVICE_CAP_POINTER))
|
||||
continue;
|
||||
|
||||
if (x) *x = edev->mouse.dx;
|
||||
if (y) *y = edev->mouse.dy;
|
||||
if (x) *x = seat->ptr.dx;
|
||||
if (y) *y = seat->ptr.dy;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -80,40 +80,10 @@ _device_output_set(Ecore_Drm_Evdev *edev)
|
|||
if (libinput_device_has_capability(edev->device,
|
||||
LIBINPUT_DEVICE_CAP_POINTER))
|
||||
{
|
||||
Ecore_Drm_Input *pointer_input;
|
||||
Ecore_Event_Mouse_Move *ev;
|
||||
|
||||
edev->mouse.dx = edev->output->current_mode->width / 2;
|
||||
edev->mouse.dy = edev->output->current_mode->height / 2;
|
||||
|
||||
/* send a fake motion event to let other know the initial pos of mouse */
|
||||
if (!(pointer_input = edev->seat->input)) return;
|
||||
if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
|
||||
|
||||
ev->window = (Ecore_Window)pointer_input->dev->window;
|
||||
ev->event_window = (Ecore_Window)pointer_input->dev->window;
|
||||
ev->root_window = (Ecore_Window)pointer_input->dev->window;
|
||||
|
||||
_device_modifiers_update(edev);
|
||||
ev->modifiers = edev->xkb.modifiers;
|
||||
ev->same_screen = 1;
|
||||
|
||||
ev->x = edev->mouse.dx;
|
||||
ev->y = edev->mouse.dy;
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
ev->multi.device = edev->mt_slot;
|
||||
ev->multi.radius = 1;
|
||||
ev->multi.radius_x = 1;
|
||||
ev->multi.radius_y = 1;
|
||||
ev->multi.pressure = 1.0;
|
||||
ev->multi.angle = 0.0;
|
||||
ev->multi.x = ev->x;
|
||||
ev->multi.y = ev->y;
|
||||
ev->multi.root.x = ev->x;
|
||||
ev->multi.root.y = ev->y;
|
||||
|
||||
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
|
||||
edev->seat->ptr.ix = edev->seat->ptr.dx = edev->output->current_mode->width / 2;
|
||||
edev->seat->ptr.iy = edev->seat->ptr.dy = edev->output->current_mode->height / 2;
|
||||
edev->mouse.dx = edev->seat->ptr.dx;
|
||||
edev->mouse.dy = edev->seat->ptr.dy;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,15 +361,18 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve
|
|||
|
||||
if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
|
||||
|
||||
if (edev->mouse.ix < edev->mouse.minx)
|
||||
edev->mouse.dx = edev->mouse.ix = edev->mouse.minx;
|
||||
else if (edev->mouse.ix >= (edev->mouse.minx + edev->mouse.maxw))
|
||||
edev->mouse.dx = edev->mouse.ix = (edev->mouse.minx + edev->mouse.maxw - 1);
|
||||
if (edev->seat->ptr.ix < edev->mouse.minx)
|
||||
edev->seat->ptr.dx = edev->seat->ptr.ix = edev->mouse.minx;
|
||||
else if (edev->seat->ptr.ix >= (edev->mouse.minx + edev->mouse.maxw))
|
||||
edev->seat->ptr.dx = edev->seat->ptr.ix = (edev->mouse.minx + edev->mouse.maxw - 1);
|
||||
|
||||
if (edev->mouse.iy < edev->mouse.miny)
|
||||
edev->mouse.dy = edev->mouse.iy = edev->mouse.miny;
|
||||
else if (edev->mouse.iy >= (edev->mouse.miny + edev->mouse.maxh))
|
||||
edev->mouse.dy = edev->mouse.iy = (edev->mouse.miny + edev->mouse.maxh - 1);
|
||||
if (edev->seat->ptr.iy < edev->mouse.miny)
|
||||
edev->seat->ptr.dy = edev->seat->ptr.iy = edev->mouse.miny;
|
||||
else if (edev->seat->ptr.iy >= (edev->mouse.miny + edev->mouse.maxh))
|
||||
edev->seat->ptr.dy = edev->seat->ptr.iy = (edev->mouse.miny + edev->mouse.maxh - 1);
|
||||
|
||||
edev->mouse.dx = edev->seat->ptr.dx;
|
||||
edev->mouse.dy = edev->seat->ptr.dy;
|
||||
|
||||
ev->window = (Ecore_Window)input->dev->window;
|
||||
ev->event_window = (Ecore_Window)input->dev->window;
|
||||
|
@ -410,8 +383,8 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve
|
|||
_device_modifiers_update(edev);
|
||||
ev->modifiers = edev->xkb.modifiers;
|
||||
|
||||
ev->x = edev->mouse.ix;
|
||||
ev->y = edev->mouse.iy;
|
||||
ev->x = edev->seat->ptr.ix;
|
||||
ev->y = edev->seat->ptr.iy;
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
|
||||
|
@ -436,14 +409,17 @@ _device_handle_pointer_motion(struct libinput_device *device, struct libinput_ev
|
|||
|
||||
if (!(edev = libinput_device_get_user_data(device))) return;
|
||||
|
||||
edev->mouse.dx += libinput_event_pointer_get_dx(event);
|
||||
edev->mouse.dy += libinput_event_pointer_get_dy(event);
|
||||
edev->seat->ptr.dx += libinput_event_pointer_get_dx(event);
|
||||
edev->seat->ptr.dy += libinput_event_pointer_get_dy(event);
|
||||
|
||||
if (floor(edev->mouse.dx) == edev->mouse.ix &&
|
||||
floor(edev->mouse.dy) == edev->mouse.iy) return;
|
||||
edev->mouse.dx = edev->seat->ptr.dx;
|
||||
edev->mouse.dy = edev->seat->ptr.dy;
|
||||
|
||||
edev->mouse.ix = edev->mouse.dx;
|
||||
edev->mouse.iy = edev->mouse.dy;
|
||||
if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
|
||||
floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
|
||||
|
||||
edev->seat->ptr.ix = edev->seat->ptr.dx;
|
||||
edev->seat->ptr.iy = edev->seat->ptr.dy;
|
||||
_device_pointer_motion(edev, event);
|
||||
}
|
||||
|
||||
|
@ -454,16 +430,18 @@ _device_handle_pointer_motion_absolute(struct libinput_device *device, struct li
|
|||
|
||||
if (!(edev = libinput_device_get_user_data(device))) return;
|
||||
|
||||
edev->mouse.dx =
|
||||
edev->mouse.dx = edev->seat->ptr.dx =
|
||||
libinput_event_pointer_get_absolute_x_transformed(event,
|
||||
edev->output->current_mode->width);
|
||||
edev->mouse.dy =
|
||||
edev->mouse.dy = edev->seat->ptr.dy =
|
||||
libinput_event_pointer_get_absolute_y_transformed(event,
|
||||
edev->output->current_mode->height);
|
||||
|
||||
if (floor(edev->mouse.dx) == edev->mouse.ix &&
|
||||
floor(edev->mouse.dy) == edev->mouse.iy) return;
|
||||
if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
|
||||
floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
|
||||
|
||||
edev->seat->ptr.ix = edev->seat->ptr.dx;
|
||||
edev->seat->ptr.iy = edev->seat->ptr.dy;
|
||||
_device_pointer_motion(edev, event);
|
||||
}
|
||||
|
||||
|
@ -498,8 +476,8 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin
|
|||
_device_modifiers_update(edev);
|
||||
ev->modifiers = edev->xkb.modifiers;
|
||||
|
||||
ev->x = edev->mouse.ix;
|
||||
ev->y = edev->mouse.iy;
|
||||
ev->x = edev->seat->ptr.ix;
|
||||
ev->y = edev->seat->ptr.iy;
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
|
||||
|
@ -580,8 +558,8 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe
|
|||
_device_modifiers_update(edev);
|
||||
ev->modifiers = edev->xkb.modifiers;
|
||||
|
||||
ev->x = edev->mouse.ix;
|
||||
ev->y = edev->mouse.iy;
|
||||
ev->x = edev->seat->ptr.ix;
|
||||
ev->y = edev->seat->ptr.iy;
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
|
||||
|
@ -691,8 +669,8 @@ _device_handle_touch_event_send(Ecore_Drm_Evdev *edev, struct libinput_event_tou
|
|||
_device_modifiers_update(edev);
|
||||
ev->modifiers = edev->xkb.modifiers;
|
||||
|
||||
ev->x = edev->mouse.ix;
|
||||
ev->y = edev->mouse.iy;
|
||||
ev->x = edev->seat->ptr.ix;
|
||||
ev->y = edev->seat->ptr.iy;
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
|
||||
|
@ -766,8 +744,8 @@ _device_handle_touch_motion_send(Ecore_Drm_Evdev *edev, struct libinput_event_to
|
|||
ev->modifiers = edev->xkb.modifiers;
|
||||
ev->modifiers = 0;
|
||||
|
||||
ev->x = edev->mouse.ix;
|
||||
ev->y = edev->mouse.iy;
|
||||
ev->x = edev->seat->ptr.ix;
|
||||
ev->y = edev->seat->ptr.iy;
|
||||
ev->root.x = ev->x;
|
||||
ev->root.y = ev->y;
|
||||
|
||||
|
@ -792,9 +770,9 @@ _device_handle_touch_down(struct libinput_device *device, struct libinput_event_
|
|||
|
||||
if (!(edev = libinput_device_get_user_data(device))) return;
|
||||
|
||||
edev->mouse.ix = edev->mouse.dx =
|
||||
edev->mouse.dx = edev->seat->ptr.ix = edev->seat->ptr.dx =
|
||||
libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
|
||||
edev->mouse.iy = edev->mouse.dy =
|
||||
edev->mouse.dy = edev->seat->ptr.iy = edev->seat->ptr.dy =
|
||||
libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
|
||||
|
||||
edev->mt_slot = libinput_event_touch_get_seat_slot(event);
|
||||
|
@ -810,16 +788,16 @@ _device_handle_touch_motion(struct libinput_device *device, struct libinput_even
|
|||
|
||||
if (!(edev = libinput_device_get_user_data(device))) return;
|
||||
|
||||
edev->mouse.dx =
|
||||
edev->mouse.dx = edev->seat->ptr.dx =
|
||||
libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
|
||||
edev->mouse.dy =
|
||||
edev->mouse.dy = edev->seat->ptr.dy =
|
||||
libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
|
||||
|
||||
if (floor(edev->mouse.dx) == edev->mouse.ix &&
|
||||
floor(edev->mouse.dy) == edev->mouse.iy) return;
|
||||
if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
|
||||
floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
|
||||
|
||||
edev->mouse.ix = edev->mouse.dx;
|
||||
edev->mouse.iy = edev->mouse.dy;
|
||||
edev->seat->ptr.ix = edev->seat->ptr.dx;
|
||||
edev->seat->ptr.iy = edev->seat->ptr.dy;
|
||||
|
||||
edev->mt_slot = libinput_event_touch_get_seat_slot(event);
|
||||
|
||||
|
|
|
@ -153,6 +153,11 @@ struct _Ecore_Drm_Seat
|
|||
const char *name;
|
||||
Ecore_Drm_Input *input;
|
||||
Eina_List *devices;
|
||||
struct
|
||||
{
|
||||
int ix, iy;
|
||||
double dx, dy;
|
||||
} ptr;
|
||||
};
|
||||
|
||||
struct _Ecore_Drm_Input
|
||||
|
|
|
@ -1316,6 +1316,9 @@ EAPI void ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y);
|
|||
EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y);
|
||||
EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type);
|
||||
EAPI Ecore_Wl_Window *ecore_evas_wayland_window_get(const Ecore_Evas *ee);
|
||||
EAPI Ecore_Wl2_Window *ecore_evas_wayland_window_get2(const Ecore_Evas *ee);
|
||||
|
||||
EAPI Ecore_Cocoa_Window *ecore_evas_cocoa_window_get(const Ecore_Evas *ee);
|
||||
|
||||
EAPI Ecore_Evas *ecore_evas_drm_new(const char *device, unsigned int parent, int x, int y, int w, int h);
|
||||
EAPI Ecore_Evas *ecore_evas_gl_drm_new(const char *device, unsigned int parent, int x, int y, int w, int h); /** @since 1.12 */
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
|
|||
#endif
|
||||
|
||||
#ifndef __ECORE_COCOA_H__
|
||||
# define _ECORE_COCOA_WINDOW_PREDEF
|
||||
typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
|
||||
#endif
|
||||
|
||||
|
@ -47,6 +48,11 @@ typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for s
|
|||
typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
|
||||
#endif
|
||||
|
||||
#ifndef _ECORE_WL2_H_
|
||||
#define _ECORE_WAYLAND_WINDOW_PREDEF
|
||||
typedef struct _Ecore_Wl2_Window Ecore_Wl2_Window;
|
||||
#endif
|
||||
|
||||
#ifndef _ECORE_GETOPT_PREDEF
|
||||
typedef struct _Ecore_Getopt Ecore_Getopt;
|
||||
#define _ECORE_GETOPT_PREDEF 1
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "ecore_evas_private.h"
|
||||
#include "ecore_evas_x11.h"
|
||||
#include "ecore_evas_wayland.h"
|
||||
#include "ecore_evas_cocoa.h"
|
||||
#include "ecore_evas_extn.h"
|
||||
#include "ecore_evas_win32.h"
|
||||
|
||||
|
@ -3983,6 +3984,25 @@ ecore_evas_wayland_window_get(const Ecore_Evas *ee)
|
|||
return iface->window_get(ee);
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Window *
|
||||
ecore_evas_wayland_window_get2(const Ecore_Evas *ee)
|
||||
{
|
||||
Ecore_Evas_Interface_Wayland *iface;
|
||||
iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
|
||||
|
||||
return iface->window_get2(ee);
|
||||
}
|
||||
|
||||
EAPI Ecore_Cocoa_Window *
|
||||
ecore_evas_cocoa_window_get(const Ecore_Evas *ee)
|
||||
{
|
||||
Ecore_Evas_Interface_Cocoa *iface;
|
||||
iface = (Ecore_Evas_Interface_Cocoa *)_ecore_evas_interface_get(ee, "opengl_cocoa");
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
|
||||
return iface->window_get(ee);
|
||||
}
|
||||
|
||||
EAPI Ecore_Evas *
|
||||
ecore_evas_drm_new(const char *disp_name, unsigned int parent,
|
||||
int x, int y, int w, int h)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __ECORE_EVAS_COCOA_H__
|
||||
#define __ECORE_EVAS_COCOA_H__
|
||||
|
||||
typedef struct _Ecore_Evas_Interface_Cocoa Ecore_Evas_Interface_Cocoa;
|
||||
|
||||
struct _Ecore_Evas_Interface_Cocoa
|
||||
{
|
||||
Ecore_Evas_Interface base;
|
||||
|
||||
Ecore_Cocoa_Window *(*window_get)(const Ecore_Evas *ee);
|
||||
};
|
||||
|
||||
#endif /* ! __ECORE_EVAS_COCOA_H__ */
|
||||
|
|
@ -12,6 +12,7 @@ struct _Ecore_Evas_Interface_Wayland
|
|||
void (*pointer_set)(Ecore_Evas *ee, int hot_x, int hot_y);
|
||||
void (*type_set)(Ecore_Evas *ee, int type);
|
||||
Ecore_Wl_Window* (*window_get)(const Ecore_Evas *ee);
|
||||
Ecore_Wl2_Window *(*window_get2)(const Ecore_Evas *ee);
|
||||
void (*pre_post_swap_callback_set)(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e));
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
/*
|
||||
* FIXME: the following functions will certainly not work on Windows:
|
||||
* ecore_file_file_get()
|
||||
* ecore_file_app_exe_get()
|
||||
* ecore_file_escape_name()
|
||||
*/
|
||||
|
@ -773,6 +772,23 @@ ecore_file_file_get(const char *path)
|
|||
char *result = NULL;
|
||||
|
||||
if (!path) return NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
|
||||
memcpy(buf, path, strlen(path) + 1);
|
||||
EVIL_PATH_SEP_UNIX_TO_WIN32(buf);
|
||||
if ((result = strrchr(buf, '\\')))
|
||||
{
|
||||
result++;
|
||||
return path + (result - buf);
|
||||
}
|
||||
else
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((result = strrchr(path, '/'))) result++;
|
||||
else result = (char *)path;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ struct _Ecore_Ipc_Client
|
|||
} prev;
|
||||
|
||||
int event_count;
|
||||
char delete_me : 1;
|
||||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
struct _Ecore_Ipc_Server
|
||||
|
@ -99,7 +99,7 @@ struct _Ecore_Ipc_Server
|
|||
} prev;
|
||||
|
||||
int event_count;
|
||||
char delete_me : 1;
|
||||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,7 +43,7 @@ static void _ecore_wl_init_callback(void *data, struct wl_callback *callback, ui
|
|||
static int _ecore_wl_init_count = 0;
|
||||
static Eina_Bool _ecore_wl_animator_busy = EINA_FALSE;
|
||||
static Eina_Bool _ecore_wl_fatal_error = EINA_FALSE;
|
||||
static Eina_Bool _ecore_wl_server_mode = EINA_FALSE;
|
||||
Eina_Bool _ecore_wl_server_mode = EINA_FALSE;
|
||||
|
||||
static const struct wl_registry_listener _ecore_wl_registry_listener =
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
# endif
|
||||
|
||||
extern int _ecore_wl_log_dom;
|
||||
extern Eina_Bool _ecore_wl_server_mode;
|
||||
|
||||
# ifdef ECORE_WL_DEFAULT_LOG_COLOR
|
||||
# undef ECORE_WL_DEFAULT_LOG_COLOR
|
||||
|
|
|
@ -227,6 +227,7 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
|
|||
win->class_name = NULL;
|
||||
|
||||
eina_hash_add(_windows, _ecore_wl_window_id_str_get(win->id), win);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
|
@ -237,7 +238,7 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
eina_hash_del(_windows, _ecore_wl_window_id_str_get(win->id), win);
|
||||
|
||||
|
@ -286,7 +287,7 @@ ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y)
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
input = win->keyboard_device;
|
||||
ecore_wl_window_update_location(win, x, y);
|
||||
|
@ -315,7 +316,7 @@ ecore_wl_window_resize(Ecore_Wl_Window *win, int w EINA_UNUSED, int h EINA_UNUSE
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
input = win->keyboard_device;
|
||||
|
||||
|
@ -342,7 +343,8 @@ ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
if (win->surface) wl_surface_damage(win->surface, x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -351,7 +353,7 @@ ecore_wl_window_commit(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
if ((win->surface))// && (win->has_buffer))
|
||||
wl_surface_commit(win->surface);
|
||||
|
@ -362,7 +364,7 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
switch (win->buffer_type)
|
||||
{
|
||||
|
@ -391,7 +393,8 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return NULL;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
|
||||
|
||||
if (win->surface) return win->surface;
|
||||
if (_ecore_wl_disp->wl.session_recovery)
|
||||
session_recovery_add_listener(_ecore_wl_disp->wl.session_recovery, &_ecore_session_recovery_listener, win);
|
||||
|
@ -418,7 +421,7 @@ ecore_wl_window_hide(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface);
|
||||
win->xdg_surface = NULL;
|
||||
|
@ -438,7 +441,8 @@ ecore_wl_window_raise(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
/* FIXME: This should raise the xdg surface also */
|
||||
if (win->shell_surface)
|
||||
wl_shell_surface_set_toplevel(win->shell_surface);
|
||||
|
@ -447,40 +451,33 @@ ecore_wl_window_raise(Ecore_Wl_Window *win)
|
|||
EAPI void
|
||||
ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
|
||||
{
|
||||
Eina_Bool prev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
if ((win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) == maximized) return;
|
||||
prev = win->maximized;
|
||||
maximized = !!maximized;
|
||||
if (prev == maximized) return;
|
||||
|
||||
if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL)
|
||||
if (maximized)
|
||||
{
|
||||
if (win->xdg_surface)
|
||||
{
|
||||
xdg_surface_set_maximized(win->xdg_surface);
|
||||
win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
|
||||
}
|
||||
xdg_surface_set_maximized(win->xdg_surface);
|
||||
else if (win->shell_surface)
|
||||
{
|
||||
wl_shell_surface_set_maximized(win->shell_surface, NULL);
|
||||
win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
|
||||
}
|
||||
wl_shell_surface_set_maximized(win->shell_surface, NULL);
|
||||
win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
|
||||
}
|
||||
else if (win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED)
|
||||
else
|
||||
{
|
||||
if (win->xdg_surface)
|
||||
{
|
||||
xdg_surface_unset_maximized(win->xdg_surface);
|
||||
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
|
||||
_ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
|
||||
}
|
||||
xdg_surface_unset_maximized(win->xdg_surface);
|
||||
else if (win->shell_surface)
|
||||
{
|
||||
wl_shell_surface_set_toplevel(win->shell_surface);
|
||||
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
|
||||
_ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
|
||||
}
|
||||
wl_shell_surface_set_toplevel(win->shell_surface);
|
||||
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
|
||||
}
|
||||
win->maximized = maximized;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -488,21 +485,24 @@ ecore_wl_window_maximized_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return EINA_FALSE;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
|
||||
|
||||
if (win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED)
|
||||
return EINA_TRUE;
|
||||
|
||||
return EINA_FALSE;
|
||||
return win->maximized;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
|
||||
{
|
||||
Eina_Bool prev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
if ((win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN) == fullscreen) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
prev = win->fullscreen;
|
||||
fullscreen = !!fullscreen;
|
||||
if (prev == fullscreen) return;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN;
|
||||
|
@ -523,8 +523,8 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
|
|||
wl_shell_surface_set_toplevel(win->shell_surface);
|
||||
|
||||
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
|
||||
_ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
|
||||
}
|
||||
win->fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -532,9 +532,9 @@ ecore_wl_window_fullscreen_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return EINA_FALSE;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
|
||||
|
||||
return win->fullscreen || (win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN);
|
||||
return win->fullscreen;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -542,7 +542,8 @@ ecore_wl_window_transparent_set(Ecore_Wl_Window *win, Eina_Bool transparent)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->transparent = transparent;
|
||||
if (!win->transparent)
|
||||
ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
|
||||
|
@ -556,7 +557,7 @@ ecore_wl_window_alpha_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return EINA_FALSE;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
|
||||
|
||||
return win->alpha;
|
||||
}
|
||||
|
@ -566,7 +567,8 @@ ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->alpha = alpha;
|
||||
if (!win->alpha)
|
||||
ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
|
||||
|
@ -580,7 +582,7 @@ ecore_wl_window_transparent_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return EINA_FALSE;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
|
||||
|
||||
return win->transparent;
|
||||
}
|
||||
|
@ -590,7 +592,8 @@ ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->allocation.w = w;
|
||||
win->allocation.h = h;
|
||||
if ((!ecore_wl_window_maximized_get(win)) && (!win->fullscreen))
|
||||
|
@ -610,7 +613,8 @@ ecore_wl_window_update_location(Ecore_Wl_Window *win, int x, int y)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->allocation.x = x;
|
||||
win->allocation.y = y;
|
||||
|
||||
|
@ -625,7 +629,8 @@ ecore_wl_window_surface_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return NULL;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
|
||||
|
||||
return win->surface;
|
||||
}
|
||||
|
||||
|
@ -635,7 +640,8 @@ ecore_wl_window_shell_surface_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return NULL;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
|
||||
|
||||
return win->shell_surface;
|
||||
}
|
||||
|
||||
|
@ -645,7 +651,8 @@ ecore_wl_window_xdg_surface_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return NULL;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
|
||||
|
||||
return win->xdg_surface;
|
||||
}
|
||||
|
||||
|
@ -664,7 +671,8 @@ ecore_wl_window_type_set(Ecore_Wl_Window *win, Ecore_Wl_Window_Type type)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->type = type;
|
||||
}
|
||||
|
||||
|
@ -675,7 +683,7 @@ ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, in
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->pointer.surface = surface;
|
||||
win->pointer.hot_x = hot_x;
|
||||
|
@ -693,7 +701,7 @@ ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char *cursor_na
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->pointer.set = EINA_FALSE;
|
||||
|
||||
|
@ -713,7 +721,7 @@ ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win)
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->pointer.set = EINA_FALSE;
|
||||
|
||||
|
@ -727,6 +735,8 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->parent = parent;
|
||||
}
|
||||
|
||||
|
@ -734,20 +744,22 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
|
|||
EAPI void
|
||||
ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified)
|
||||
{
|
||||
Eina_Bool prev;
|
||||
struct wl_array states;
|
||||
uint32_t *s;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
prev = win->minimized;
|
||||
iconified = !!iconified;
|
||||
if (prev == iconified) return;
|
||||
|
||||
if (iconified)
|
||||
{
|
||||
if (win->xdg_surface)
|
||||
{
|
||||
xdg_surface_set_minimized(win->xdg_surface);
|
||||
win->minimized = iconified;
|
||||
}
|
||||
xdg_surface_set_minimized(win->xdg_surface);
|
||||
else if (win->shell_surface)
|
||||
{
|
||||
/* TODO: handle case of iconifying a wl_shell surface */
|
||||
|
@ -757,7 +769,6 @@ ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified)
|
|||
{
|
||||
if (win->xdg_surface)
|
||||
{
|
||||
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
|
||||
wl_array_init(&states);
|
||||
s = wl_array_add(&states, sizeof(*s));
|
||||
*s = XDG_SURFACE_STATE_ACTIVATED;
|
||||
|
@ -765,12 +776,12 @@ ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified)
|
|||
wl_array_release(&states);
|
||||
}
|
||||
else if (win->shell_surface)
|
||||
{
|
||||
wl_shell_surface_set_toplevel(win->shell_surface);
|
||||
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
|
||||
_ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
|
||||
}
|
||||
wl_shell_surface_set_toplevel(win->shell_surface);
|
||||
|
||||
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
|
||||
}
|
||||
|
||||
win->minimized = iconified;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -778,7 +789,8 @@ ecore_wl_window_iconified_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return EINA_FALSE;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
|
||||
|
||||
return win->minimized;
|
||||
}
|
||||
|
||||
|
@ -789,6 +801,8 @@ ecore_wl_window_surface_find(struct wl_surface *surface)
|
|||
Ecore_Wl_Window *win = NULL;
|
||||
void *data;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
|
||||
|
||||
itr = eina_hash_iterator_data_new(_windows);
|
||||
while (eina_iterator_next(itr, &data))
|
||||
{
|
||||
|
@ -810,7 +824,7 @@ ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->input.x = x;
|
||||
win->input.y = y;
|
||||
|
@ -853,7 +867,7 @@ ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
|
|||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->opaque.x = x;
|
||||
win->opaque.y = y;
|
||||
|
@ -891,7 +905,8 @@ ecore_wl_window_rotation_set(Ecore_Wl_Window *win, int rotation)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
win->rotation = rotation;
|
||||
}
|
||||
|
||||
|
@ -901,7 +916,8 @@ ecore_wl_window_rotation_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return 0;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
|
||||
|
||||
return win->rotation;
|
||||
}
|
||||
|
||||
|
@ -911,7 +927,8 @@ ecore_wl_window_id_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return 0;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
|
||||
|
||||
return win->id;
|
||||
}
|
||||
|
||||
|
@ -921,7 +938,8 @@ ecore_wl_window_surface_id_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return 0;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
|
||||
|
||||
return win->surface_id;
|
||||
}
|
||||
|
||||
|
@ -931,7 +949,8 @@ ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
eina_stringshare_replace(&win->title, title);
|
||||
|
||||
if ((win->xdg_surface) && (win->title))
|
||||
|
@ -946,7 +965,8 @@ ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
eina_stringshare_replace(&win->class_name, class_name);
|
||||
|
||||
if ((win->xdg_surface) && (win->class_name))
|
||||
|
@ -962,7 +982,8 @@ ecore_wl_window_keyboard_get(Ecore_Wl_Window *win)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return 0;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
|
||||
|
||||
return win->keyboard_device;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,91 @@ typedef enum
|
|||
ECORE_WIN32_CURSOR_SHAPE_WAIT /**< Hourglass */
|
||||
} Ecore_Win32_Cursor_Shape;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Win32_Cursor_X11_Shape
|
||||
* Shape of an X11 cursor.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_X,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BASED_ARROW_DOWN,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_UP,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BOAT,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BOGOSITY,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_LEFT_CORNER,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_RIGHT_CORNER,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_SIDE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BOTTOM_TEE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_BOX_SPIRAL,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_CENTER_PTR,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_CIRCLE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_CLOCK,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_COFFEE_MUG,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_CROSS,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_CROSS_REVERSE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_CROSSHAIR,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_DIAMOND_CROSS,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_DOT,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_DOT_BOX_MASK,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_DOUBLE_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_DRAFT_LARGE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_DRAFT_SMALL,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_DRAPED_BOX,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_EXCHANGE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_FLEUR,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_GOBBLER,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_GUMBY,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_HAND1,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_HAND2,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_HEART,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_ICON,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_IRON_CROSS,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_LEFT_PTR,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_LEFT_SIDE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_LEFT_TEE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_LEFTBUTTON,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_LL_ANGLE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_LR_ANGLE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_MAN,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_MIDDLEBUTTON,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_MOUSE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_PENCIL,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_PIRATE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_PLUS,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_QUESTION_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHT_PTR,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHT_SIDE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHT_TEE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_RIGHTBUTTON,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_RTL_LOGO,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SAILBOAT,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SB_DOWN_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SB_H_DOUBLE_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SB_LEFT_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SB_RIGHT_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SB_UP_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SB_V_DOUBLE_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SHUTTLE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SIZING,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SPIDER,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_SPRAYCAN,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_STAR,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TARGET,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TCROSS,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_LEFT_ARROW,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_LEFT_CORNER,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_RIGHT_CORNER,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_SIDE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TOP_TEE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_TREK,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_UL_ANGLE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_UMBRELLA,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_UR_ANGLE,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_WATCH,
|
||||
ECORE_WIN32_CURSOR_X11_SHAPE_XTERM,
|
||||
} Ecore_Win32_Cursor_X11_Shape;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Win32_DnD_State
|
||||
* State of a DnD operation.
|
||||
|
@ -128,6 +213,21 @@ typedef enum
|
|||
ECORE_WIN32_DND_EVENT_DROP = 4 /**< Drop */
|
||||
} Ecore_Win32_DnD_State;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Win32_Selection
|
||||
* Type of the selection.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ECORE_WIN32_SELECTION_PRIMARY,
|
||||
ECORE_WIN32_SELECTION_SECONDARY,
|
||||
ECORE_WIN32_SELECTION_DND,
|
||||
ECORE_WIN32_SELECTION_CLIPBOARD,
|
||||
ECORE_WIN32_SELECTION_OTHER
|
||||
} Ecore_Win32_Selection;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Win32_Window
|
||||
* Abstract type for a window.
|
||||
|
@ -213,6 +313,22 @@ typedef struct _Ecore_Win32_Event_Window_Resize Ecore_Win32_Event_Window
|
|||
*/
|
||||
typedef struct _Ecore_Win32_Event_Window_Delete_Request Ecore_Win32_Event_Window_Delete_Request;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Win32_Event_Selection_Clear
|
||||
* Event sent when the content of the clipboard has been removed.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
typedef struct _Ecore_Win32_Event_Selection_Clear Ecore_Win32_Event_Selection_Clear;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Win32_Event_Selection_Notify
|
||||
* Event sent when the content of the clipboard has been added.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
typedef struct _Ecore_Win32_Event_Selection_Notify Ecore_Win32_Event_Selection_Notify;
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Win32_Event_Mouse_In
|
||||
* Event sent when the mouse enters the window.
|
||||
|
@ -350,6 +466,33 @@ struct _Ecore_Win32_Event_Window_Delete_Request
|
|||
unsigned long timestamp; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Win32_Event_Selection_Clear
|
||||
* Event sent when the content of the clipboard has been removed.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
struct _Ecore_Win32_Event_Selection_Clear
|
||||
{
|
||||
Ecore_Win32_Window *window; /**< The window that received the event */
|
||||
unsigned long timestamp; /**< The time the event occurred */
|
||||
Ecore_Win32_Selection selection; /**< The type of the selection */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_Win32_Event_Selection_Notify
|
||||
* Event sent when the content of the clipboard has been added.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
struct _Ecore_Win32_Event_Selection_Notify
|
||||
{
|
||||
Ecore_Win32_Window *window; /**< The window that received the event */
|
||||
unsigned long timestamp; /**< The time the event occurred */
|
||||
Ecore_Win32_Selection selection; /**< The type of the selection */
|
||||
void *data; /**< The data of the selection */
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Win32_Dnd_DropTarget_Callback
|
||||
* Callback type for Drop operations. See ecore_win32_dnd_register_drop_target().
|
||||
|
@ -368,6 +511,8 @@ EAPI extern int ECORE_WIN32_EVENT_WINDOW_SHOW; /**< Ecore_Event for the Ecore_Wi
|
|||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_CONFIGURE; /**< Ecore_Event for the Ecore_Win32_Event_Configure event */
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_RESIZE; /**< Ecore_Event for the Ecore_Win32_Event_Resize event */
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Delete_Request event */
|
||||
EAPI extern int ECORE_WIN32_EVENT_SELECTION_CLEAR; /**< Ecore_Event for the #Ecore_Win32_Event_Selection_Clear event @since 1.16 */
|
||||
EAPI extern int ECORE_WIN32_EVENT_SELECTION_NOTIFY; /**< Ecore_Event for the #Ecore_Win32_Event_Selection_Notify event @since 1.16 */
|
||||
|
||||
|
||||
/* Core */
|
||||
|
@ -503,6 +648,8 @@ EAPI void ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor);
|
|||
|
||||
EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape);
|
||||
|
||||
EAPI const Ecore_Win32_Cursor *ecore_win32_cursor_x11_shaped_get(Ecore_Win32_Cursor_X11_Shape shape);
|
||||
|
||||
EAPI void ecore_win32_cursor_size_get(int *width, int *height);
|
||||
|
||||
|
||||
|
@ -516,6 +663,60 @@ EAPI Eina_Bool ecore_win32_dnd_register_drop_target(Ecore_Win32_Window
|
|||
Ecore_Win32_Dnd_DropTarget_Callback callback);
|
||||
EAPI void ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window);
|
||||
|
||||
/* Clipboard */
|
||||
|
||||
/**
|
||||
* @brief Set data to the clipboard.
|
||||
*
|
||||
* @param[in] window The window that owns the clipboard.
|
||||
* @param[in] data The data to set.
|
||||
* @param[in] size The size of the data.
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise.
|
||||
*
|
||||
* This function sets @p data of size @p size in the clipboard owned by
|
||||
* @p window. This function returns #EINA_TRUE on success, and
|
||||
* #EINA_FALSE otherwise. If @p window or @p data are @c NULL, or @p size
|
||||
* is less than or equal to 0, this function returns #EINA_FALSE.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
EAPI Eina_Bool ecore_win32_clipboard_set(const Ecore_Win32_Window *window,
|
||||
const void *data,
|
||||
int size);
|
||||
|
||||
/**
|
||||
* @brief Get data from the clipboard.
|
||||
*
|
||||
* @param[in] window The window that owns the clipboard.
|
||||
* @param[out] data The retrieved data.
|
||||
* @param[out] size The size of the data.
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise.
|
||||
*
|
||||
* This function gets @p data of size @p size from the clipboard owned by
|
||||
* @p window. This function returns #EINA_TRUE on success, and
|
||||
* #EINA_FALSE otherwise. If @p window is @c NULL, this function returns
|
||||
* #EINA_FALSE. @p data and @p size must be valid buffers.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
EAPI Eina_Bool ecore_win32_clipboard_get(const Ecore_Win32_Window *window,
|
||||
void **data,
|
||||
int *size);
|
||||
|
||||
/**
|
||||
* @brief Cleat the clipboard.
|
||||
*
|
||||
* @param[in] window The window that owns the clipboard.
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise.
|
||||
*
|
||||
* This function clears the clipboard owned by @p window. This
|
||||
* function returns #EINA_TRUE on success, and #EINA_FALSE otherwise.
|
||||
* If @p window is @c NULL, this function returns #EINA_FALSE.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
EAPI Eina_Bool ecore_win32_clipboard_clear(const Ecore_Win32_Window *window);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -24,10 +24,18 @@
|
|||
* @cond LOCAL
|
||||
*/
|
||||
|
||||
/* FIXME: uncomment when mingw-w64 will be updated in win-builds */
|
||||
|
||||
/* #if _WIN32_WINNT >= 0x0600 */
|
||||
/* # ifndef WM_CLIPBOARDUPDATE */
|
||||
# define WM_CLIPBOARDUPDATE 0x031D
|
||||
/* # endif */
|
||||
/* #endif */
|
||||
|
||||
/* OLE IID for Drag'n Drop */
|
||||
|
||||
# define INITGUID
|
||||
# include <basetyps.h>
|
||||
#define INITGUID
|
||||
#include <basetyps.h>
|
||||
DEFINE_OLEGUID(IID_IEnumFORMATETC, 0x00000103L, 0, 0);
|
||||
DEFINE_OLEGUID(IID_IDataObject, 0x0000010EL, 0, 0);
|
||||
DEFINE_OLEGUID(IID_IDropSource, 0x00000121L, 0, 0);
|
||||
|
@ -36,7 +44,10 @@ DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0);
|
|||
|
||||
#define IDI_ICON 101
|
||||
|
||||
static int _ecore_win32_init_count = 0;
|
||||
typedef BOOL WINAPI (*efl_AddClipboardFormatListener)(_In_ HWND hwnd);
|
||||
typedef BOOL WINAPI (*efl_RemoveClipboardFormatListener)(_In_ HWND hwnd);
|
||||
|
||||
static int _ecore_win32_init_count = 0;
|
||||
|
||||
LRESULT CALLBACK
|
||||
_ecore_win32_window_procedure(HWND window,
|
||||
|
@ -194,13 +205,33 @@ _ecore_win32_window_procedure(HWND window,
|
|||
return 0;
|
||||
/* Window notifications */
|
||||
case WM_CREATE:
|
||||
INF("create window message");
|
||||
{
|
||||
efl_AddClipboardFormatListener acfl;
|
||||
|
||||
INF("create window message");
|
||||
acfl = (efl_AddClipboardFormatListener)GetProcAddress(GetModuleHandle("user32.dll"),
|
||||
"AddClipboardFormatListener");
|
||||
if (acfl)
|
||||
{
|
||||
if (!acfl(window))
|
||||
INF("can not create clipboard format listener; no clipboard notification will be sent");
|
||||
}
|
||||
_ecore_win32_event_handle_create_notify(data);
|
||||
return 0;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
INF("destroy window message");
|
||||
_ecore_win32_event_handle_destroy_notify(data);
|
||||
return 0;
|
||||
{
|
||||
efl_RemoveClipboardFormatListener rcfl;
|
||||
|
||||
INF("destroy window message");
|
||||
_ecore_win32_event_handle_destroy_notify(data);
|
||||
|
||||
rcfl = (efl_RemoveClipboardFormatListener)GetProcAddress(GetModuleHandle("user32.dll"),
|
||||
"RemoveClipboardFormatListener");
|
||||
if (rcfl)
|
||||
rcfl(window);
|
||||
return 0;
|
||||
}
|
||||
case WM_SHOWWINDOW:
|
||||
INF("show window message");
|
||||
if ((data->data_param == SW_OTHERUNZOOM) ||
|
||||
|
@ -299,6 +330,23 @@ _ecore_win32_window_procedure(HWND window,
|
|||
return 0;
|
||||
}
|
||||
return DefWindowProc(window, message, window_param, data_param);
|
||||
case WM_CLIPBOARDUPDATE:
|
||||
INF("clipboard data updated");
|
||||
_ecore_win32_event_handle_selection_notify(data);
|
||||
return 0;
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
Ecore_Win32_Window *w;
|
||||
|
||||
INF("SetCursor");
|
||||
w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA);
|
||||
if (w && w->cursor)
|
||||
{
|
||||
SetCursor(w->cursor);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* GDI notifications */
|
||||
case WM_PAINT:
|
||||
{
|
||||
|
@ -340,11 +388,12 @@ _ecore_win32_window_procedure(HWND window,
|
|||
*============================================================================*/
|
||||
|
||||
|
||||
HINSTANCE _ecore_win32_instance = NULL;
|
||||
double _ecore_win32_double_click_time = 0.25;
|
||||
unsigned long _ecore_win32_event_last_time = 0;
|
||||
Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
|
||||
int _ecore_win32_log_dom_global = -1;
|
||||
HINSTANCE _ecore_win32_instance = NULL;
|
||||
double _ecore_win32_double_click_time = 0.25;
|
||||
unsigned long _ecore_win32_event_last_time = 0;
|
||||
Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
|
||||
int _ecore_win32_log_dom_global = -1;
|
||||
Ecore_Win32_Cursor *_ecore_win32_cursor_x[77];
|
||||
|
||||
int ECORE_WIN32_EVENT_MOUSE_IN = 0;
|
||||
int ECORE_WIN32_EVENT_MOUSE_OUT = 0;
|
||||
|
@ -358,6 +407,8 @@ int ECORE_WIN32_EVENT_WINDOW_HIDE = 0;
|
|||
int ECORE_WIN32_EVENT_WINDOW_CONFIGURE = 0;
|
||||
int ECORE_WIN32_EVENT_WINDOW_RESIZE = 0;
|
||||
int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = 0;
|
||||
int ECORE_WIN32_EVENT_SELECTION_CLEAR = 0;
|
||||
int ECORE_WIN32_EVENT_SELECTION_NOTIFY = 0;
|
||||
|
||||
/*============================================================================*
|
||||
* API *
|
||||
|
@ -419,6 +470,7 @@ ecore_win32_init()
|
|||
WNDCLASSEX wc;
|
||||
HICON icon;
|
||||
HICON icon_sm;
|
||||
int i;
|
||||
|
||||
if (++_ecore_win32_init_count != 1)
|
||||
return _ecore_win32_init_count;
|
||||
|
@ -504,8 +556,13 @@ ecore_win32_init()
|
|||
ECORE_WIN32_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_RESIZE = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_SELECTION_CLEAR = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_SELECTION_NOTIFY = ecore_event_type_new();
|
||||
}
|
||||
|
||||
for (i = 0; i < 77; i++)
|
||||
_ecore_win32_cursor_x[i] = _ecore_win32_cursor_x11_shaped_new(i);
|
||||
|
||||
return _ecore_win32_init_count;
|
||||
|
||||
unregister_class:
|
||||
|
@ -535,9 +592,14 @@ ecore_win32_init()
|
|||
EAPI int
|
||||
ecore_win32_shutdown()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (--_ecore_win32_init_count != 0)
|
||||
return _ecore_win32_init_count;
|
||||
|
||||
for (i = 0; i < 77; i++)
|
||||
ecore_win32_cursor_free(_ecore_win32_cursor_x[i]);
|
||||
|
||||
ecore_win32_dnd_shutdown();
|
||||
|
||||
if (!UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance))
|
||||
|
|
|
@ -0,0 +1,188 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Ecore_Win32.h"
|
||||
#include "ecore_win32_private.h"
|
||||
|
||||
/*============================================================================*
|
||||
* Local *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @cond LOCAL
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
|
||||
/*============================================================================*
|
||||
* Global *
|
||||
*============================================================================*/
|
||||
|
||||
|
||||
/*============================================================================*
|
||||
* API *
|
||||
*============================================================================*/
|
||||
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_win32_clipboard_set(const Ecore_Win32_Window *window,
|
||||
const void *data,
|
||||
int size)
|
||||
{
|
||||
HGLOBAL global;
|
||||
char *d;
|
||||
|
||||
/*
|
||||
* See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms649016%28v=vs.85%29.aspx#_win32_Copying_Information_to_the_Clipboard
|
||||
* 1. Open the clipboard
|
||||
* 2. Empty the clipboard
|
||||
* 3. Set the data
|
||||
* 4. Close the clipboard
|
||||
*/
|
||||
|
||||
INF("setting data to the clipboard");
|
||||
|
||||
if (!window || !data || (size <= 0))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!OpenClipboard(window->window))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!EmptyClipboard())
|
||||
goto close_clipboard;
|
||||
|
||||
global = GlobalAlloc(GMEM_MOVEABLE, size + 1);
|
||||
if (!global)
|
||||
goto close_clipboard;
|
||||
|
||||
d = (char *)GlobalLock(global);
|
||||
if (!d)
|
||||
goto unlock_global;
|
||||
|
||||
memcpy(d, data, size);
|
||||
d[size] = '\0';
|
||||
GlobalUnlock(global);
|
||||
SetClipboardData(CF_TEXT, global);
|
||||
CloseClipboard();
|
||||
|
||||
return EINA_TRUE;
|
||||
|
||||
unlock_global:
|
||||
GlobalUnlock(global);
|
||||
close_clipboard:
|
||||
CloseClipboard();
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_win32_clipboard_get(const Ecore_Win32_Window *window,
|
||||
void **data,
|
||||
int *size)
|
||||
{
|
||||
HGLOBAL global;
|
||||
void *d;
|
||||
void *p;
|
||||
|
||||
/*
|
||||
* See https://msdn.microsoft.com/en-us/library/windows/desktop/ms649016%28v=vs.85%29.aspx#_win32_Pasting_Information_from_the_Clipboard
|
||||
* 1. Open Clipboard
|
||||
* 2. Determine format
|
||||
* 3. Retrieve data
|
||||
* 4. Manage data
|
||||
* 5. Close clipboard
|
||||
*/
|
||||
|
||||
INF("getting data from the clipboard");
|
||||
|
||||
if (!window)
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!IsClipboardFormatAvailable(CF_TEXT))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!OpenClipboard(window->window))
|
||||
goto set_val;
|
||||
|
||||
/* { */
|
||||
/* UINT fmt = 0; */
|
||||
|
||||
/* while (1) */
|
||||
/* { */
|
||||
/* fmt = EnumClipboardFormats(fmt); */
|
||||
/* printf(" $ Format : %x\n", fmt); */
|
||||
/* if (!fmt) */
|
||||
/* break; */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
global = GetClipboardData(CF_TEXT);
|
||||
if (!global)
|
||||
goto close_clipboard;
|
||||
|
||||
d = GlobalLock(global);
|
||||
if (!d)
|
||||
goto unlock_global;
|
||||
|
||||
*size = strlen(d);
|
||||
p = malloc(*size);
|
||||
if (!p)
|
||||
goto unlock_global;
|
||||
|
||||
memcpy(p, d, *size);
|
||||
*data = p;
|
||||
GlobalUnlock(global);
|
||||
CloseClipboard();
|
||||
|
||||
return EINA_TRUE;
|
||||
|
||||
unlock_global:
|
||||
GlobalUnlock(global);
|
||||
close_clipboard:
|
||||
CloseClipboard();
|
||||
set_val:
|
||||
*data = NULL;
|
||||
*size = 0;
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_win32_clipboard_clear(const Ecore_Win32_Window *window)
|
||||
{
|
||||
INF("clearing the clipboard");
|
||||
|
||||
if (!window)
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!OpenClipboard(window->window))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!EmptyClipboard())
|
||||
goto close_clipboard;
|
||||
|
||||
CloseClipboard();
|
||||
|
||||
return EINA_TRUE;
|
||||
|
||||
close_clipboard:
|
||||
CloseClipboard();
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -10,12 +10,30 @@
|
|||
|
||||
#include "Ecore_Win32.h"
|
||||
#include "ecore_win32_private.h"
|
||||
#include "ecore_win32_cursor_x11.h"
|
||||
|
||||
/*============================================================================*
|
||||
* Local *
|
||||
*============================================================================*/
|
||||
|
||||
|
||||
Ecore_Win32_Cursor *
|
||||
_ecore_win32_cursor_x11_shaped_new(Ecore_Win32_Cursor_X11_Shape shape)
|
||||
{
|
||||
INF("creating X11 shaped cursor");
|
||||
|
||||
if ((shape < ECORE_WIN32_CURSOR_X11_SHAPE_X) ||
|
||||
(shape > ECORE_WIN32_CURSOR_X11_SHAPE_XTERM))
|
||||
return NULL;
|
||||
|
||||
return ecore_win32_cursor_new(_ecore_win32_cursors_x11[shape].mask_and,
|
||||
_ecore_win32_cursors_x11[shape].mask_xor,
|
||||
32, 32,
|
||||
_ecore_win32_cursors_x11[shape].hotspot_x,
|
||||
_ecore_win32_cursors_x11[shape].hotspot_y);
|
||||
}
|
||||
|
||||
|
||||
/*============================================================================*
|
||||
* Global *
|
||||
*============================================================================*/
|
||||
|
@ -157,7 +175,11 @@
|
|||
* };
|
||||
*
|
||||
* Ecore_Win32_Cursor *cursor = ecore_win32_cursor_new(pixels_and, pixels_xor, 32, 32, 19, 2);
|
||||
* ecore_win32_window_cursor_set(window, cursor);
|
||||
* @endcode
|
||||
*
|
||||
* @see ecore_win32_cursor_free()
|
||||
* @see ecore_win32_window_cursor_set()
|
||||
*/
|
||||
EAPI Ecore_Win32_Cursor *
|
||||
ecore_win32_cursor_new(const void *pixels_and,
|
||||
|
@ -199,13 +221,19 @@ ecore_win32_cursor_new(const void *pixels_and,
|
|||
* @param cursor The cursor to free.
|
||||
*
|
||||
* This function free @p cursor. @p cursor must have been obtained
|
||||
* with ecore_win32_cursor_new().
|
||||
* with ecore_win32_cursor_new() or ecore_win32_cursor_x11_shaped_new().
|
||||
*
|
||||
* @see ecore_win32_cursor_new()
|
||||
* @see ecore_win32_cursor_x11_shaped_new()
|
||||
*/
|
||||
EAPI void
|
||||
ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor)
|
||||
{
|
||||
INF("destroying cursor");
|
||||
|
||||
if (!cursor)
|
||||
return;
|
||||
|
||||
DestroyCursor(cursor);
|
||||
}
|
||||
|
||||
|
@ -217,7 +245,7 @@ ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor)
|
|||
*
|
||||
* This function returns a pre-defined cursor with a specified
|
||||
* @p shape. This cursor does not need to be freed, as it is loaded
|
||||
* from an existing resource.
|
||||
* from an existing resource. On error @c NULL is returned.
|
||||
*/
|
||||
EAPI Ecore_Win32_Cursor *
|
||||
ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape)
|
||||
|
@ -281,6 +309,33 @@ ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape)
|
|||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieve a X11 cursor from a X Id.
|
||||
*
|
||||
* @param[in] shape The defined X11 shape of the cursor.
|
||||
* @return The new cursor.
|
||||
*
|
||||
* This function returns a defined cursor with a specified X11
|
||||
* @p shape. Do not use ecore_win32_cursor_free() to free the
|
||||
* ressources as it is created once the libray is initialized and
|
||||
* detroyed when it is shut down.
|
||||
*
|
||||
* @see ecore_win32_cursor_new()
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
EAPI const Ecore_Win32_Cursor *
|
||||
ecore_win32_cursor_x11_shaped_get(Ecore_Win32_Cursor_X11_Shape shape)
|
||||
{
|
||||
INF("getting X11 shaped cursor");
|
||||
|
||||
if ((shape < ECORE_WIN32_CURSOR_X11_SHAPE_X) ||
|
||||
(shape > ECORE_WIN32_CURSOR_X11_SHAPE_XTERM))
|
||||
return NULL;
|
||||
|
||||
return _ecore_win32_cursor_x[shape];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieve the size of a valid cursor.
|
||||
*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -40,6 +40,7 @@ static int _ecore_win32_mouse_down_did_triple = 0;
|
|||
static int _ecore_win32_mouse_up_count = 0;
|
||||
static Ecore_Win32_Key_Mask _ecore_win32_key_mask = 0;
|
||||
static Eina_Bool _ecore_win32_ctrl_fake = EINA_FALSE;
|
||||
static Eina_Bool _ecore_win32_clipboard_has_data = EINA_FALSE;
|
||||
|
||||
static unsigned int
|
||||
_ecore_win32_modifiers_get(void)
|
||||
|
@ -1895,3 +1896,72 @@ _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg)
|
|||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_selection_notify(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Selection_Notify *e;
|
||||
HGLOBAL global;
|
||||
char *str;
|
||||
|
||||
INF("selection_notify");
|
||||
|
||||
/*
|
||||
* we have text data in clipboard but no data before,
|
||||
* so text data has just been added
|
||||
*/
|
||||
if (IsClipboardFormatAvailable(CF_TEXT) && !_ecore_win32_clipboard_has_data)
|
||||
{
|
||||
e = calloc(1, sizeof(Ecore_Win32_Event_Selection_Notify));
|
||||
if (!e) return;
|
||||
|
||||
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
|
||||
e->timestamp = _ecore_win32_event_last_time;
|
||||
e->selection = ECORE_WIN32_SELECTION_CLIPBOARD;
|
||||
|
||||
if (!OpenClipboard(msg->window))
|
||||
goto free_e;
|
||||
|
||||
global = GetClipboardData(CF_TEXT);
|
||||
if (!global)
|
||||
goto close_clipboard;
|
||||
|
||||
str = GlobalLock(global);
|
||||
if (str)
|
||||
{
|
||||
e->data = strdup(str);
|
||||
GlobalUnlock(global);
|
||||
}
|
||||
|
||||
CloseClipboard();
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_SELECTION_NOTIFY, e, NULL, NULL);
|
||||
|
||||
_ecore_win32_clipboard_has_data = EINA_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* we have no more text data in clipboard and data before,
|
||||
* so text data has just been removed
|
||||
*/
|
||||
if (!IsClipboardFormatAvailable(CF_TEXT) && _ecore_win32_clipboard_has_data)
|
||||
{
|
||||
e = calloc(1, sizeof(Ecore_Win32_Event_Selection_Clear));
|
||||
if (!e) return;
|
||||
|
||||
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
|
||||
e->timestamp = _ecore_win32_event_last_time;
|
||||
e->selection = ECORE_WIN32_SELECTION_CLIPBOARD;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_SELECTION_CLEAR, e, NULL, NULL);
|
||||
|
||||
_ecore_win32_clipboard_has_data = EINA_FALSE;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
close_clipboard:
|
||||
CloseClipboard();
|
||||
free_e:
|
||||
free(e);
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ struct _Ecore_Win32_Window
|
|||
DWORD style; /* used to go fullscreen to normal */
|
||||
RECT rect; /* used to go fullscreen to normal */
|
||||
|
||||
Ecore_Win32_Cursor *cursor;
|
||||
|
||||
struct {
|
||||
Ecore_Win32_Pos_Hints_Flags flags;
|
||||
int min_width;
|
||||
|
@ -145,6 +147,7 @@ extern HINSTANCE _ecore_win32_instance;
|
|||
extern double _ecore_win32_double_click_time;
|
||||
extern unsigned long _ecore_win32_event_last_time;
|
||||
extern Ecore_Win32_Window *_ecore_win32_event_last_window;
|
||||
extern Ecore_Win32_Cursor *_ecore_win32_cursor_x[77];
|
||||
|
||||
|
||||
void _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg);
|
||||
|
@ -164,6 +167,7 @@ void _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg);
|
|||
void _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_selection_notify(Ecore_Win32_Callback_Data *msg);
|
||||
|
||||
void *_ecore_win32_dnd_data_object_new(void *fmtetc, void *stgmeds, int count);
|
||||
void _ecore_win32_dnd_data_object_free(void *data_object);
|
||||
|
@ -173,7 +177,9 @@ void *_ecore_win32_dnd_register_drop_window(HWND hwnd,
|
|||
Ecore_Win32_Dnd_DropTarget_Callback callback, void *ptr);
|
||||
void _ecore_win32_dnd_unregister_drop_window(HWND hwnd, void *drop_target);
|
||||
|
||||
Eina_Bool ecore_win32_window_drag(Ecore_Win32_Window *w, int ptx, int pty);
|
||||
Eina_Bool ecore_win32_window_drag(Ecore_Win32_Window *w, int ptx, int pty);
|
||||
|
||||
Ecore_Win32_Cursor *_ecore_win32_cursor_x11_shaped_new(Ecore_Win32_Cursor_X11_Shape shape);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -155,6 +155,8 @@ _ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
|
|||
w->drag.current_mouse_x = -32768;
|
||||
w->drag.current_mouse_y = -32768;
|
||||
|
||||
w->cursor = LoadCursor (NULL, IDC_ARROW);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
|
@ -1436,8 +1438,13 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
|
|||
*
|
||||
* This function sets @p cursor to @p window. @p cursor must have been
|
||||
* obtained by ecore_win32_cursor_new() or
|
||||
* ecore_win32_cursor_shaped_new(). If @p window or @p cursor is
|
||||
* ecore_win32_cursor_shaped_new() or
|
||||
* ecore_win32_cursor_x11_shaped_new(). If @p window or @p cursor is
|
||||
* @c NULL, the function does nothing.
|
||||
*
|
||||
* @see ecore_win32_cursor_new()
|
||||
* @see ecore_win32_cursor_shaped_new()
|
||||
* @see ecore_win32_cursor_x11_shaped_new()
|
||||
*/
|
||||
EAPI void
|
||||
ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
|
||||
|
@ -1448,11 +1455,7 @@ ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
|
|||
if (!window || !cursor)
|
||||
return;
|
||||
|
||||
if (!SetClassLongPtr(window->window,
|
||||
GCLP_HCURSOR, (LONG_PTR)cursor))
|
||||
{
|
||||
ERR("SetClassLong() failed");
|
||||
}
|
||||
window->cursor = cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,135 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
/* local variables */
|
||||
static int _ecore_wl2_init_count = 0;
|
||||
|
||||
/* external variables */
|
||||
int _ecore_wl2_log_dom = -1;
|
||||
|
||||
/* public API variables */
|
||||
EAPI int ECORE_WL2_EVENT_GLOBAL_ADDED = 0;
|
||||
EAPI int ECORE_WL2_EVENT_GLOBAL_REMOVED = 0;
|
||||
EAPI int ECORE_WL2_EVENT_FOCUS_IN = 0;
|
||||
EAPI int ECORE_WL2_EVENT_FOCUS_OUT = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DND_ENTER = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DND_LEAVE = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DND_MOTION = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DND_DROP = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DND_END = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DATA_SOURCE_TARGET = 0;
|
||||
EAPI int ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0;
|
||||
EAPI int ECORE_WL2_EVENT_SELECTION_DATA_READY = 0;
|
||||
EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0;
|
||||
|
||||
/* public API functions */
|
||||
EAPI int
|
||||
ecore_wl2_init(void)
|
||||
{
|
||||
if (++_ecore_wl2_init_count != 1) return _ecore_wl2_init_count;
|
||||
|
||||
/* try to initialize Eina */
|
||||
if (!eina_init()) return --_ecore_wl2_init_count;
|
||||
|
||||
/* try to create Eina logging domain */
|
||||
_ecore_wl2_log_dom =
|
||||
eina_log_domain_register("ecore_wl2", ECORE_WL2_DEFAULT_LOG_COLOR);
|
||||
if (_ecore_wl2_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_ERR("Cannot create a log domain for Ecore Wl2");
|
||||
goto eina_err;
|
||||
}
|
||||
|
||||
/* try to initialize Ecore */
|
||||
if (!ecore_init())
|
||||
{
|
||||
ERR("Could not initialize Ecore");
|
||||
goto ecore_err;
|
||||
}
|
||||
|
||||
/* try to initialize Ecore_Event */
|
||||
if (!ecore_event_init())
|
||||
{
|
||||
ERR("Could not initialize Ecore_Event");
|
||||
goto ecore_event_err;
|
||||
}
|
||||
|
||||
/* handle creating new Ecore_Wl2 event types */
|
||||
if (!ECORE_WL2_EVENT_GLOBAL_ADDED)
|
||||
{
|
||||
ECORE_WL2_EVENT_GLOBAL_ADDED = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_GLOBAL_REMOVED = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_FOCUS_IN = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_FOCUS_OUT = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DND_ENTER = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DND_LEAVE = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DND_MOTION = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DND_DROP = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DND_END = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DATA_SOURCE_TARGET = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_DATA_SOURCE_SEND = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_SELECTION_DATA_READY = ecore_event_type_new();
|
||||
ECORE_WL2_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
|
||||
}
|
||||
|
||||
return _ecore_wl2_init_count;
|
||||
|
||||
ecore_event_err:
|
||||
ecore_shutdown();
|
||||
|
||||
ecore_err:
|
||||
eina_log_domain_unregister(_ecore_wl2_log_dom);
|
||||
_ecore_wl2_log_dom = -1;
|
||||
|
||||
eina_err:
|
||||
eina_shutdown();
|
||||
return --_ecore_wl2_init_count;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_wl2_shutdown(void)
|
||||
{
|
||||
if (_ecore_wl2_init_count < 1)
|
||||
{
|
||||
ERR("Ecore_Wl2 shutdown called without Ecore_Wl2 Init");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (--_ecore_wl2_init_count != 0) return _ecore_wl2_init_count;
|
||||
|
||||
/* reset events */
|
||||
ECORE_WL2_EVENT_GLOBAL_ADDED = 0;
|
||||
ECORE_WL2_EVENT_GLOBAL_REMOVED = 0;
|
||||
ECORE_WL2_EVENT_FOCUS_IN = 0;
|
||||
ECORE_WL2_EVENT_FOCUS_OUT = 0;
|
||||
ECORE_WL2_EVENT_DND_ENTER = 0;
|
||||
ECORE_WL2_EVENT_DND_LEAVE = 0;
|
||||
ECORE_WL2_EVENT_DND_MOTION = 0;
|
||||
ECORE_WL2_EVENT_DND_DROP = 0;
|
||||
ECORE_WL2_EVENT_DND_END = 0;
|
||||
ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED = 0;
|
||||
ECORE_WL2_EVENT_DATA_SOURCE_TARGET = 0;
|
||||
ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0;
|
||||
ECORE_WL2_EVENT_SELECTION_DATA_READY = 0;
|
||||
ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0;
|
||||
|
||||
/* shutdown Ecore_Event */
|
||||
ecore_event_shutdown();
|
||||
|
||||
/* shutdown Ecore */
|
||||
ecore_shutdown();
|
||||
|
||||
/* unregister logging domain */
|
||||
eina_log_domain_unregister(_ecore_wl2_log_dom);
|
||||
_ecore_wl2_log_dom = -1;
|
||||
|
||||
/* shutdown eina */
|
||||
eina_shutdown();
|
||||
|
||||
return _ecore_wl2_init_count;
|
||||
}
|
|
@ -0,0 +1,745 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
static Eina_Bool _fatal_error = EINA_FALSE;
|
||||
static Eina_Hash *_server_displays = NULL;
|
||||
static Eina_Hash *_client_displays = NULL;
|
||||
|
||||
static void
|
||||
_ecore_wl2_display_signal_exit(void)
|
||||
{
|
||||
Ecore_Event_Signal_Exit *ev;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Event_Signal_Exit));
|
||||
if (!ev) return;
|
||||
|
||||
ev->quit = EINA_TRUE;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_xdg_shell_cb_ping(void *data EINA_UNUSED, struct xdg_shell *shell, uint32_t serial)
|
||||
{
|
||||
xdg_shell_pong(shell, serial);
|
||||
}
|
||||
|
||||
static const struct xdg_shell_listener _xdg_shell_listener =
|
||||
{
|
||||
_xdg_shell_cb_ping
|
||||
};
|
||||
|
||||
static void
|
||||
_cb_global_event_free(void *data EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_Wl2_Event_Global *ev;
|
||||
|
||||
ev = event;
|
||||
eina_stringshare_del(ev->interface);
|
||||
free(ev);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
Ecore_Wl2_Event_Global *ev;
|
||||
|
||||
ewd = data;
|
||||
|
||||
/* test to see if we have already added this global to our hash */
|
||||
if (!eina_hash_find(ewd->globals, &id))
|
||||
{
|
||||
Ecore_Wl2_Global *global;
|
||||
|
||||
/* allocate space for new global */
|
||||
global = calloc(1, sizeof(Ecore_Wl2_Global));
|
||||
if (!global) return;
|
||||
|
||||
global->id = id;
|
||||
global->interface = eina_stringshare_add(interface);
|
||||
global->version = version;
|
||||
|
||||
/* add this global to our hash */
|
||||
if (!eina_hash_add(ewd->globals, &global->id, global))
|
||||
{
|
||||
eina_stringshare_del(global->interface);
|
||||
free(global);
|
||||
}
|
||||
}
|
||||
else
|
||||
goto event;
|
||||
|
||||
if (!strcmp(interface, "wl_compositor"))
|
||||
{
|
||||
ewd->wl.compositor =
|
||||
wl_registry_bind(registry, id, &wl_compositor_interface, 3);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_subcompositor"))
|
||||
{
|
||||
ewd->wl.subcompositor =
|
||||
wl_registry_bind(registry, id, &wl_subcompositor_interface, 1);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_shm"))
|
||||
{
|
||||
ewd->wl.shm =
|
||||
wl_registry_bind(registry, id, &wl_shm_interface, 1);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_data_device_manager"))
|
||||
{
|
||||
ewd->wl.data_device_manager =
|
||||
wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_shell"))
|
||||
{
|
||||
ewd->wl.wl_shell =
|
||||
wl_registry_bind(registry, id, &wl_shell_interface, 1);
|
||||
}
|
||||
else if ((!strcmp(interface, "xdg_shell")) &&
|
||||
(!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL")))
|
||||
{
|
||||
ewd->wl.xdg_shell =
|
||||
wl_registry_bind(registry, id, &xdg_shell_interface, 1);
|
||||
xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION);
|
||||
xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_output"))
|
||||
_ecore_wl2_output_add(ewd, id);
|
||||
else if (!strcmp(interface, "wl_seat"))
|
||||
_ecore_wl2_input_add(ewd, id, version);
|
||||
|
||||
event:
|
||||
/* allocate space for event structure */
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Global));
|
||||
if (!ev) return;
|
||||
|
||||
ev->id = id;
|
||||
ev->display = ewd;
|
||||
ev->version = version;
|
||||
ev->interface = eina_stringshare_add(interface);
|
||||
|
||||
/* raise an event saying a new global has been added */
|
||||
ecore_event_add(ECORE_WL2_EVENT_GLOBAL_ADDED, ev,
|
||||
_cb_global_event_free, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_global_remove(void *data, struct wl_registry *registry EINA_UNUSED, unsigned int id)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
Ecore_Wl2_Global *global;
|
||||
Ecore_Wl2_Event_Global *ev;
|
||||
|
||||
ewd = data;
|
||||
|
||||
/* try to find this global in our hash */
|
||||
global = eina_hash_find(ewd->globals, &id);
|
||||
if (!global) return;
|
||||
|
||||
/* allocate space for event structure */
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Global));
|
||||
if (!ev) return;
|
||||
|
||||
ev->id = id;
|
||||
ev->display = ewd;
|
||||
ev->version = global->version;
|
||||
ev->interface = eina_stringshare_add(global->interface);
|
||||
|
||||
/* raise an event saying a global has been removed */
|
||||
ecore_event_add(ECORE_WL2_EVENT_GLOBAL_REMOVED, ev,
|
||||
_cb_global_event_free, NULL);
|
||||
|
||||
/* delete this global from our hash */
|
||||
if (ewd->globals) eina_hash_del_by_key(ewd->globals, &id);
|
||||
}
|
||||
|
||||
static const struct wl_registry_listener _registry_listener =
|
||||
{
|
||||
_cb_global_add,
|
||||
_cb_global_remove
|
||||
};
|
||||
|
||||
static Eina_Bool
|
||||
_cb_create_data(void *data, Ecore_Fd_Handler *hdl)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
struct wl_event_loop *loop;
|
||||
|
||||
ewd = data;
|
||||
|
||||
if (_fatal_error) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
if (ecore_main_fd_handler_active_get(hdl, ECORE_FD_ERROR))
|
||||
{
|
||||
ERR("Received Fatal Error on Wayland Display");
|
||||
|
||||
_fatal_error = EINA_TRUE;
|
||||
_ecore_wl2_display_signal_exit();
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
loop = wl_display_get_event_loop(ewd->wl.display);
|
||||
wl_event_loop_dispatch(loop, 0);
|
||||
|
||||
/* wl_display_flush_clients(ewd->wl.display); */
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_create_prepare(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
|
||||
ewd = data;
|
||||
wl_display_flush_clients(ewd->wl.display);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_connect_data(void *data, Ecore_Fd_Handler *hdl)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
int ret = 0;
|
||||
|
||||
ewd = data;
|
||||
|
||||
if (_fatal_error) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
if (ecore_main_fd_handler_active_get(hdl, ECORE_FD_ERROR))
|
||||
{
|
||||
ERR("Received Fatal Error on Wayland Display");
|
||||
|
||||
_fatal_error = EINA_TRUE;
|
||||
_ecore_wl2_display_signal_exit();
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
if (ecore_main_fd_handler_active_get(hdl, ECORE_FD_READ))
|
||||
{
|
||||
ret = wl_display_dispatch(ewd->wl.display);
|
||||
if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
|
||||
{
|
||||
ERR("Received Fatal Error on Wayland Display");
|
||||
|
||||
_fatal_error = EINA_TRUE;
|
||||
_ecore_wl2_display_signal_exit();
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecore_main_fd_handler_active_get(hdl, ECORE_FD_WRITE))
|
||||
{
|
||||
ret = wl_display_flush(ewd->wl.display);
|
||||
if (ret == 0)
|
||||
ecore_main_fd_handler_active_set(hdl, ECORE_FD_READ);
|
||||
|
||||
if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
|
||||
{
|
||||
ERR("Received Fatal Error on Wayland Display");
|
||||
|
||||
_fatal_error = EINA_TRUE;
|
||||
_ecore_wl2_display_signal_exit();
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
}
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_globals_hash_del(void *data)
|
||||
{
|
||||
Ecore_Wl2_Global *global;
|
||||
|
||||
global = data;
|
||||
|
||||
eina_stringshare_del(global->interface);
|
||||
|
||||
free(global);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_connect_idle(void *data)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
int ret = 0;
|
||||
|
||||
ewd = data;
|
||||
if (!ewd) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
if (_fatal_error) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
ret = wl_display_get_error(ewd->wl.display);
|
||||
if (ret < 0) goto err;
|
||||
|
||||
ret = wl_display_dispatch_pending(ewd->wl.display);
|
||||
if (ret < 0) goto err;
|
||||
|
||||
ret = wl_display_flush(ewd->wl.display);
|
||||
if ((ret < 0) && (errno == EAGAIN))
|
||||
ecore_main_fd_handler_active_set(ewd->fd_hdl,
|
||||
(ECORE_FD_READ | ECORE_FD_WRITE));
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
err:
|
||||
if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
|
||||
{
|
||||
ERR("Wayland Socket Error: %s", strerror(errno));
|
||||
|
||||
_fatal_error = EINA_TRUE;
|
||||
_ecore_wl2_display_signal_exit();
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_sync_done(void *data, struct wl_callback *cb, uint32_t serial EINA_UNUSED)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
|
||||
ewd = data;
|
||||
ewd->sync_done = EINA_TRUE;
|
||||
|
||||
wl_callback_destroy(cb);
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener _sync_listener =
|
||||
{
|
||||
_cb_sync_done
|
||||
};
|
||||
|
||||
static void
|
||||
_ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
|
||||
{
|
||||
Ecore_Wl2_Output *output;
|
||||
Ecore_Wl2_Input *input;
|
||||
Eina_Inlist *tmp;
|
||||
|
||||
if (--ewd->refs) return;
|
||||
|
||||
if (ewd->xkb_context) xkb_context_unref(ewd->xkb_context);
|
||||
|
||||
/* free each input */
|
||||
EINA_INLIST_FOREACH_SAFE(ewd->inputs, tmp, input)
|
||||
_ecore_wl2_input_del(input);
|
||||
|
||||
/* free each output */
|
||||
EINA_INLIST_FOREACH_SAFE(ewd->outputs, tmp, output)
|
||||
_ecore_wl2_output_del(output);
|
||||
|
||||
if (ewd->idle_enterer) ecore_idle_enterer_del(ewd->idle_enterer);
|
||||
|
||||
if (ewd->fd_hdl) ecore_main_fd_handler_del(ewd->fd_hdl);
|
||||
|
||||
eina_hash_free(ewd->globals);
|
||||
|
||||
if (ewd->wl.xdg_shell) xdg_shell_destroy(ewd->wl.xdg_shell);
|
||||
if (ewd->wl.wl_shell) wl_shell_destroy(ewd->wl.wl_shell);
|
||||
if (ewd->wl.shm) wl_shm_destroy(ewd->wl.shm);
|
||||
if (ewd->wl.data_device_manager)
|
||||
wl_data_device_manager_destroy(ewd->wl.data_device_manager);
|
||||
if (ewd->wl.compositor) wl_compositor_destroy(ewd->wl.compositor);
|
||||
if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor);
|
||||
|
||||
if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry);
|
||||
|
||||
wl_display_flush(ewd->wl.display);
|
||||
|
||||
if (ewd->name) free(ewd->name);
|
||||
|
||||
/* remove this client display from hash */
|
||||
if (_client_displays) eina_hash_del(_client_displays, ewd->name, ewd);
|
||||
}
|
||||
|
||||
Ecore_Wl2_Window *
|
||||
_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface)
|
||||
{
|
||||
Ecore_Wl2_Window *window;
|
||||
|
||||
if ((!display) || (!wl_surface)) return NULL;
|
||||
|
||||
EINA_INLIST_FOREACH(display->windows, window)
|
||||
{
|
||||
if ((window->surface) &&
|
||||
(window->surface == wl_surface))
|
||||
return window;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Display *
|
||||
ecore_wl2_display_create(const char *name)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
struct wl_event_loop *loop;
|
||||
const char *n;
|
||||
|
||||
if (!_server_displays)
|
||||
_server_displays = eina_hash_string_superfast_new(NULL);
|
||||
|
||||
if (!name)
|
||||
{
|
||||
/* someone wants to create a new server */
|
||||
n = getenv("WAYLAND_DISPLAY");
|
||||
if (n)
|
||||
{
|
||||
/* we have a default wayland display */
|
||||
|
||||
/* check hash of cached server displays for this name */
|
||||
ewd = eina_hash_find(_server_displays, n);
|
||||
if (ewd) goto found;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* someone wants to create a server with a specific display */
|
||||
|
||||
/* check hash of cached server displays for this name */
|
||||
ewd = eina_hash_find(_server_displays, name);
|
||||
if (ewd) goto found;
|
||||
|
||||
}
|
||||
|
||||
/* allocate space for display structure */
|
||||
ewd = calloc(1, sizeof(Ecore_Wl2_Display));
|
||||
if (!ewd) return NULL;
|
||||
|
||||
ewd->refs++;
|
||||
ewd->pid = getpid();
|
||||
|
||||
/* try to create new wayland display */
|
||||
ewd->wl.display = wl_display_create();
|
||||
if (!ewd->wl.display)
|
||||
{
|
||||
ERR("Could not create wayland display: %m");
|
||||
goto create_err;
|
||||
}
|
||||
|
||||
if (!name)
|
||||
{
|
||||
const char *n;
|
||||
|
||||
n = wl_display_add_socket_auto(ewd->wl.display);
|
||||
if (!n)
|
||||
{
|
||||
ERR("Failed to add display socket: %m");
|
||||
goto socket_err;
|
||||
}
|
||||
|
||||
ewd->name = strdup(n);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wl_display_add_socket(ewd->wl.display, name))
|
||||
{
|
||||
ERR("Failed to add display socket: %m");
|
||||
goto socket_err;
|
||||
}
|
||||
|
||||
ewd->name = strdup(name);
|
||||
}
|
||||
|
||||
setenv("WAYLAND_DISPLAY", ewd->name, 1);
|
||||
DBG("WAYLAND_DISPLAY: %s", ewd->name);
|
||||
|
||||
loop = wl_display_get_event_loop(ewd->wl.display);
|
||||
|
||||
ewd->fd_hdl =
|
||||
ecore_main_fd_handler_add(wl_event_loop_get_fd(loop),
|
||||
ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR,
|
||||
_cb_create_data, ewd, NULL, NULL);
|
||||
|
||||
ecore_main_fd_handler_prepare_callback_set(ewd->fd_hdl,
|
||||
_cb_create_prepare, ewd);
|
||||
|
||||
/* add this new server display to hash */
|
||||
eina_hash_add(_server_displays, ewd->name, ewd);
|
||||
|
||||
return ewd;
|
||||
|
||||
socket_err:
|
||||
wl_display_destroy(ewd->wl.display);
|
||||
|
||||
create_err:
|
||||
free(ewd);
|
||||
return NULL;
|
||||
|
||||
found:
|
||||
ewd->refs++;
|
||||
return ewd;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_wl2_display_sync_get(void)
|
||||
{
|
||||
Ecore_Wl2_Display *sewd;
|
||||
Eina_Iterator *itr;
|
||||
Eina_Bool ret = EINA_TRUE;
|
||||
void *data;
|
||||
|
||||
if (eina_hash_population(_server_displays) < 1) return ret;
|
||||
|
||||
itr = eina_hash_iterator_data_new(_server_displays);
|
||||
while (eina_iterator_next(itr, &data))
|
||||
{
|
||||
sewd = (Ecore_Wl2_Display *)data;
|
||||
if (sewd->pid == getpid())
|
||||
{
|
||||
ret = EINA_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
eina_iterator_free(itr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Display *
|
||||
ecore_wl2_display_connect(const char *name)
|
||||
{
|
||||
Ecore_Wl2_Display *ewd;
|
||||
Eina_Bool sync = EINA_TRUE;
|
||||
struct wl_callback *cb;
|
||||
const char *n;
|
||||
|
||||
if (!_client_displays)
|
||||
_client_displays = eina_hash_string_superfast_new(NULL);
|
||||
|
||||
if (!name)
|
||||
{
|
||||
/* client wants to connect to default display */
|
||||
n = getenv("WAYLAND_DISPLAY");
|
||||
if (n)
|
||||
{
|
||||
/* we have a default wayland display */
|
||||
|
||||
/* check hash of cached client displays for this name */
|
||||
ewd = eina_hash_find(_client_displays, n);
|
||||
if (ewd) goto found;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* client wants to connect to specific display */
|
||||
|
||||
/* check hash of cached client displays for this name */
|
||||
ewd = eina_hash_find(_client_displays, name);
|
||||
if (ewd) goto found;
|
||||
}
|
||||
|
||||
if ((!name) && (!n))
|
||||
{
|
||||
ERR("No Wayland Display Running");
|
||||
goto name_err;
|
||||
}
|
||||
|
||||
/* allocate space for display structure */
|
||||
ewd = calloc(1, sizeof(Ecore_Wl2_Display));
|
||||
if (!ewd) return NULL;
|
||||
|
||||
ewd->refs++;
|
||||
|
||||
if (name)
|
||||
ewd->name = strdup(name);
|
||||
else if (n)
|
||||
ewd->name = strdup(n);
|
||||
|
||||
ewd->globals = eina_hash_int32_new(_cb_globals_hash_del);
|
||||
|
||||
/* try to connect to wayland display with this name */
|
||||
ewd->wl.display = wl_display_connect(ewd->name);
|
||||
if (!ewd->wl.display)
|
||||
{
|
||||
ERR("Could not connect to display %s: %m", ewd->name);
|
||||
goto connect_err;
|
||||
}
|
||||
|
||||
ewd->fd_hdl =
|
||||
ecore_main_fd_handler_add(wl_display_get_fd(ewd->wl.display),
|
||||
ECORE_FD_READ | ECORE_FD_ERROR,
|
||||
_cb_connect_data, ewd, NULL, NULL);
|
||||
|
||||
ewd->idle_enterer = ecore_idle_enterer_add(_cb_connect_idle, ewd);
|
||||
|
||||
ewd->wl.registry = wl_display_get_registry(ewd->wl.display);
|
||||
wl_registry_add_listener(ewd->wl.registry, &_registry_listener, ewd);
|
||||
|
||||
ewd->xkb_context = xkb_context_new(0);
|
||||
if (!ewd->xkb_context) goto context_err;
|
||||
|
||||
/* add this new client display to hash */
|
||||
eina_hash_add(_client_displays, ewd->name, ewd);
|
||||
|
||||
/* check server display hash and match on pid. If match, skip sync */
|
||||
sync = _ecore_wl2_display_sync_get();
|
||||
|
||||
cb = wl_display_sync(ewd->wl.display);
|
||||
wl_callback_add_listener(cb, &_sync_listener, ewd);
|
||||
|
||||
if (sync)
|
||||
{
|
||||
/* NB: If we are connecting (as a client), then we will need to setup
|
||||
* a callback for display_sync and wait for it to complete. There is no
|
||||
* other option here as we need the compositor, shell, etc, to be setup
|
||||
* before we can allow a user to make use of the API functions */
|
||||
while (!ewd->sync_done)
|
||||
wl_display_dispatch(ewd->wl.display);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this client is on same pid as server so we need to iterate
|
||||
* main loop until the "server" advertises it's globals
|
||||
*
|
||||
* NB: DO NOT REMOVE THIS !!
|
||||
*
|
||||
* This is NEEDED for E's internal dialogs to function because the
|
||||
* "server" and "client" are on the same PID
|
||||
* and thus the "server" never advertises out it's globals
|
||||
* (wl_compositor, wl_shm, etc) unless we sit here and iterate the
|
||||
* main loop until it's done.
|
||||
*
|
||||
* If we remove this, E will never show an internal dialog as it
|
||||
* just sits and waits for the globals */
|
||||
while (!ewd->sync_done)
|
||||
ecore_main_loop_iterate();
|
||||
}
|
||||
|
||||
return ewd;
|
||||
|
||||
context_err:
|
||||
ecore_main_fd_handler_del(ewd->fd_hdl);
|
||||
wl_registry_destroy(ewd->wl.registry);
|
||||
wl_display_disconnect(ewd->wl.display);
|
||||
|
||||
connect_err:
|
||||
eina_hash_free(ewd->globals);
|
||||
free(ewd->name);
|
||||
free(ewd);
|
||||
return NULL;
|
||||
|
||||
name_err:
|
||||
eina_hash_free(_client_displays);
|
||||
return NULL;
|
||||
|
||||
found:
|
||||
ewd->refs++;
|
||||
return ewd;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(display);
|
||||
_ecore_wl2_display_cleanup(display);
|
||||
if (display->refs <= 0)
|
||||
{
|
||||
wl_display_disconnect(display->wl.display);
|
||||
free(display);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_display_destroy(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(display);
|
||||
_ecore_wl2_display_cleanup(display);
|
||||
if (display->refs <= 0)
|
||||
{
|
||||
wl_display_destroy(display->wl.display);
|
||||
free(display);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_display_terminate(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(display);
|
||||
wl_display_terminate(display->wl.display);
|
||||
}
|
||||
|
||||
EAPI struct wl_display *
|
||||
ecore_wl2_display_get(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
return display->wl.display;
|
||||
}
|
||||
|
||||
EAPI struct wl_shm *
|
||||
ecore_wl2_display_shm_get(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
return display->wl.shm;
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
ecore_wl2_display_globals_get(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
return eina_hash_iterator_data_new(display->globals);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_display_screen_size_get(Ecore_Wl2_Display *display, int *w, int *h)
|
||||
{
|
||||
Ecore_Wl2_Output *output;
|
||||
int ow = 0, oh = 0;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(display);
|
||||
|
||||
if (w) *w = 0;
|
||||
if (h) *h = 0;
|
||||
|
||||
EINA_INLIST_FOREACH(display->outputs, output)
|
||||
{
|
||||
switch (output->transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
ow += output->geometry.h;
|
||||
oh += output->geometry.w;
|
||||
break;
|
||||
default:
|
||||
ow += output->geometry.w;
|
||||
oh += output->geometry.h;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (w) *w = ow;
|
||||
if (h) *h = oh;
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Window *
|
||||
ecore_wl2_display_window_find(Ecore_Wl2_Display *display, unsigned int id)
|
||||
{
|
||||
Ecore_Wl2_Window *window;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
|
||||
EINA_INLIST_FOREACH(display->windows, window)
|
||||
if (window->id == (int)id) return window;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI struct wl_registry *
|
||||
ecore_wl2_display_registry_get(Ecore_Wl2_Display *display)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
|
||||
return display->wl.registry;
|
||||
}
|
|
@ -0,0 +1,627 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/epoll.h>
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
struct _dnd_task
|
||||
{
|
||||
void *data;
|
||||
Ecore_Fd_Cb cb;
|
||||
};
|
||||
|
||||
struct _dnd_read_ctx
|
||||
{
|
||||
int epoll_fd;
|
||||
struct epoll_event *ep;
|
||||
};
|
||||
|
||||
static void
|
||||
_offer_cb_offer(void *data, struct wl_data_offer *offer EINA_UNUSED, const char *type)
|
||||
{
|
||||
Ecore_Wl2_Dnd_Source *source;
|
||||
char **t;
|
||||
|
||||
source = data;
|
||||
if ((!source) || (!type)) return;
|
||||
|
||||
t = wl_array_add(&source->types, sizeof(*t));
|
||||
if (t) *t = strdup(type);
|
||||
}
|
||||
|
||||
static const struct wl_data_offer_listener _offer_listener =
|
||||
{
|
||||
_offer_cb_offer
|
||||
};
|
||||
|
||||
static void
|
||||
_source_cb_target_free(void *data EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_Wl2_Event_Data_Source_Target *ev;
|
||||
|
||||
ev = event;
|
||||
if (!ev) return;
|
||||
|
||||
free(ev->type);
|
||||
free(ev);
|
||||
}
|
||||
|
||||
static void
|
||||
_source_cb_target(void *data, struct wl_data_source *source EINA_UNUSED, const char *mime_type)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
Ecore_Wl2_Event_Data_Source_Target *ev;
|
||||
|
||||
input = data;
|
||||
if (!input) return;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Data_Source_Target));
|
||||
if (!ev) return;
|
||||
|
||||
if (mime_type) ev->type = strdup(mime_type);
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DATA_SOURCE_TARGET, ev,
|
||||
_source_cb_target_free, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_source_cb_send_free(void *data EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_Wl2_Event_Data_Source_Send *ev;
|
||||
|
||||
ev = event;
|
||||
if (!ev) return;
|
||||
|
||||
free(ev->type);
|
||||
free(ev);
|
||||
}
|
||||
|
||||
static void
|
||||
_source_cb_send(void *data, struct wl_data_source *source EINA_UNUSED, const char *mime_type, int32_t fd)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
Ecore_Wl2_Event_Data_Source_Send *ev;
|
||||
|
||||
input = data;
|
||||
if (!input) return;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Data_Source_Send));
|
||||
if (!ev) return;
|
||||
|
||||
ev->fd = fd;
|
||||
ev->type = strdup(mime_type);
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, ev,
|
||||
_source_cb_send_free, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_source_cb_cancelled(void *data, struct wl_data_source *source)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
Ecore_Wl2_Event_Data_Source_Cancelled *ev;
|
||||
|
||||
input = data;
|
||||
if (!input) return;
|
||||
|
||||
if (input->data.source == source) input->data.source = NULL;
|
||||
wl_data_source_destroy(source);
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Data_Source_Cancelled));
|
||||
if (!ev) return;
|
||||
|
||||
if (input->focus.pointer)
|
||||
ev->win = input->focus.pointer->id;
|
||||
if (input->focus.keyboard)
|
||||
ev->source = input->focus.keyboard->id;
|
||||
|
||||
if (!ev->win) ev->win = ev->source;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
static const struct wl_data_source_listener _source_listener =
|
||||
{
|
||||
_source_cb_target,
|
||||
_source_cb_send,
|
||||
_source_cb_cancelled
|
||||
};
|
||||
|
||||
static void
|
||||
_selection_data_ready_cb_free(void *data EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_Wl2_Event_Selection_Data_Ready *ev;
|
||||
|
||||
ev = event;
|
||||
if (!ev) return;
|
||||
|
||||
free(ev->data);
|
||||
free(ev);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_selection_data_read(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
|
||||
{
|
||||
int len;
|
||||
char buffer[PATH_MAX];
|
||||
Ecore_Wl2_Dnd_Source *source;
|
||||
Ecore_Wl2_Event_Selection_Data_Ready *event;
|
||||
Eina_Bool ret;
|
||||
|
||||
source = data;
|
||||
|
||||
len = read(source->fd, buffer, sizeof buffer);
|
||||
|
||||
event = calloc(1, sizeof(Ecore_Wl2_Event_Selection_Data_Ready));
|
||||
if (!event) return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
if (len <= 0)
|
||||
{
|
||||
close(source->fd);
|
||||
_ecore_wl2_dnd_del(source);
|
||||
event->done = EINA_TRUE;
|
||||
event->data = NULL;
|
||||
event->len = 0;
|
||||
ret = ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
event->data = malloc(len);
|
||||
if (!event->data)
|
||||
{
|
||||
free(event);
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
memcpy(event->data, buffer, len);
|
||||
event->len = len;
|
||||
event->done = EINA_FALSE;
|
||||
ret = ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, event,
|
||||
_selection_data_ready_cb_free, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_selection_cb_idle(void *data)
|
||||
{
|
||||
struct _dnd_read_ctx *ctx;
|
||||
struct _dnd_task *task;
|
||||
int count, i;
|
||||
|
||||
ctx = data;
|
||||
count = epoll_wait(ctx->epoll_fd, ctx->ep, 1, 0);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
task = ctx->ep->data.ptr;
|
||||
if (task->cb(task->data, NULL) == ECORE_CALLBACK_CANCEL)
|
||||
{
|
||||
free(ctx->ep);
|
||||
free(task);
|
||||
free(ctx);
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static void
|
||||
_selection_data_receive(Ecore_Wl2_Dnd_Source *source, const char *type)
|
||||
{
|
||||
int epoll_fd;
|
||||
struct epoll_event *ep = NULL;
|
||||
struct _dnd_task *task = NULL;
|
||||
struct _dnd_read_ctx *read_ctx = NULL;
|
||||
int p[2];
|
||||
|
||||
if (pipe2(p, O_CLOEXEC) == -1)
|
||||
return;
|
||||
|
||||
wl_data_offer_receive(source->offer, type, p[1]);
|
||||
close(p[1]);
|
||||
|
||||
/* Due to http://trac.enlightenment.org/e/ticket/1208,
|
||||
* use epoll and idle handler instead of ecore_main_fd_handler_add() */
|
||||
|
||||
ep = calloc(1, sizeof(struct epoll_event));
|
||||
if (!ep) goto err;
|
||||
|
||||
task = calloc(1, sizeof(struct _dnd_task));
|
||||
if (!task) goto err;
|
||||
|
||||
read_ctx = calloc(1, sizeof(struct _dnd_read_ctx));
|
||||
if (!read_ctx) goto err;
|
||||
|
||||
epoll_fd = epoll_create1(0);
|
||||
if (epoll_fd < 0) goto err;
|
||||
|
||||
task->data = source;
|
||||
task->cb = _selection_data_read;
|
||||
ep->events = EPOLLIN;
|
||||
ep->data.ptr = task;
|
||||
|
||||
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, p[0], ep) < 0) goto err;
|
||||
|
||||
read_ctx->epoll_fd = epoll_fd;
|
||||
read_ctx->ep = ep;
|
||||
|
||||
if (!ecore_idler_add(_selection_cb_idle, read_ctx)) goto err;
|
||||
|
||||
source->refcount++;
|
||||
source->fd = p[0];
|
||||
|
||||
return;
|
||||
|
||||
err:
|
||||
if (ep) free(ep);
|
||||
if (task) free(task);
|
||||
if (read_ctx) free(read_ctx);
|
||||
close(p[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_dnd_add(Ecore_Wl2_Input *input, struct wl_data_offer *offer)
|
||||
{
|
||||
Ecore_Wl2_Dnd_Source *source;
|
||||
|
||||
source = calloc(1, sizeof(Ecore_Wl2_Dnd_Source));
|
||||
if (!source) return;
|
||||
|
||||
wl_array_init(&source->types);
|
||||
source->refcount = 1;
|
||||
source->input = input;
|
||||
source->offer = offer;
|
||||
|
||||
wl_data_offer_add_listener(source->offer, &_offer_listener, source);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_dnd_enter(Ecore_Wl2_Input *input, struct wl_data_offer *offer, struct wl_surface *surface, int x, int y, unsigned int timestamp)
|
||||
{
|
||||
Ecore_Wl2_Window *window;
|
||||
Ecore_Wl2_Event_Dnd_Enter *ev;
|
||||
char **types;
|
||||
int num = 0;
|
||||
|
||||
window = _ecore_wl2_display_window_surface_find(input->display, surface);
|
||||
if (!window) return;
|
||||
|
||||
if (offer)
|
||||
{
|
||||
input->drag.source = wl_data_offer_get_user_data(offer);
|
||||
num = (input->drag.source->types.size / sizeof(char *));
|
||||
types = input->drag.source->types.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
input->drag.source = NULL;
|
||||
types = NULL;
|
||||
}
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Dnd_Enter));
|
||||
if (!ev) return;
|
||||
|
||||
ev->win = window->id;
|
||||
|
||||
if (input->focus.keyboard)
|
||||
ev->source = input->focus.keyboard->id;
|
||||
|
||||
if (!ev->win) ev->win = ev->source;
|
||||
|
||||
ev->x = x;
|
||||
ev->y = y;
|
||||
ev->offer = offer;
|
||||
ev->serial = timestamp;
|
||||
ev->num_types = num;
|
||||
ev->types = types;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_ENTER, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_dnd_leave(Ecore_Wl2_Input *input)
|
||||
{
|
||||
Ecore_Wl2_Event_Dnd_Leave *ev;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Dnd_Leave));
|
||||
if (!ev) return;
|
||||
|
||||
if (input->focus.pointer)
|
||||
ev->win = input->focus.pointer->id;
|
||||
if (input->focus.keyboard)
|
||||
ev->source = input->focus.keyboard->id;
|
||||
|
||||
if (!ev->win) ev->win = ev->source;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_LEAVE, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_dnd_motion(Ecore_Wl2_Input *input, int x, int y, unsigned int timestamp)
|
||||
{
|
||||
Ecore_Wl2_Event_Dnd_Motion *ev;
|
||||
|
||||
input->pointer.sx = x;
|
||||
input->pointer.sy = y;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Dnd_Motion));
|
||||
if (!ev) return;
|
||||
|
||||
if (input->focus.pointer)
|
||||
ev->win = input->focus.pointer->id;
|
||||
if (input->focus.keyboard)
|
||||
ev->source = input->focus.keyboard->id;
|
||||
|
||||
if (!ev->win) ev->win = ev->source;
|
||||
|
||||
ev->x = x;
|
||||
ev->y = y;
|
||||
ev->serial = timestamp;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_MOTION, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_dnd_drop(Ecore_Wl2_Input *input)
|
||||
{
|
||||
Ecore_Wl2_Event_Dnd_Drop *ev;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Dnd_Drop));
|
||||
if (!ev) return;
|
||||
|
||||
if (input->drag.source)
|
||||
{
|
||||
if (input->focus.pointer)
|
||||
ev->win = input->focus.pointer->id;
|
||||
if (input->focus.keyboard)
|
||||
ev->source = input->focus.keyboard->id;
|
||||
|
||||
if (!ev->win) ev->win = ev->source;
|
||||
}
|
||||
|
||||
ev->x = input->pointer.sx;
|
||||
ev->y = input->pointer.sy;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_DROP, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_dnd_selection(Ecore_Wl2_Input *input, struct wl_data_offer *offer)
|
||||
{
|
||||
if (input->selection.source) _ecore_wl2_dnd_del(input->selection.source);
|
||||
input->selection.source = NULL;
|
||||
|
||||
if (offer)
|
||||
{
|
||||
char **t;
|
||||
|
||||
input->selection.source = wl_data_offer_get_user_data(offer);
|
||||
t = wl_array_add(&input->selection.source->types, sizeof(*t));
|
||||
*t = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_dnd_del(Ecore_Wl2_Dnd_Source *source)
|
||||
{
|
||||
if (!source) return;
|
||||
source->refcount--;
|
||||
if (source->refcount == 0)
|
||||
{
|
||||
wl_data_offer_destroy(source->offer);
|
||||
wl_array_release(&source->types);
|
||||
free(source);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_dnd_drag_types_set(Ecore_Wl2_Input *input, const char **types)
|
||||
{
|
||||
struct wl_data_device_manager *manager;
|
||||
const char **type;
|
||||
char **t;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(input);
|
||||
EINA_SAFETY_ON_NULL_RETURN(input->display);
|
||||
|
||||
manager = input->display->wl.data_device_manager;
|
||||
|
||||
if (input->data.types.data)
|
||||
{
|
||||
wl_array_for_each(t, &input->data.types)
|
||||
free(*t);
|
||||
wl_array_release(&input->data.types);
|
||||
wl_array_init(&input->data.types);
|
||||
}
|
||||
|
||||
if (input->data.source) wl_data_source_destroy(input->data.source);
|
||||
input->data.source = NULL;
|
||||
|
||||
input->data.source = wl_data_device_manager_create_data_source(manager);
|
||||
if (!input->data.source)
|
||||
{
|
||||
ERR("Could not create data source: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
for (type = types; *type; type++)
|
||||
{
|
||||
if (!*type) continue;
|
||||
t = wl_array_add(&input->data.types, sizeof(*t));
|
||||
if (t)
|
||||
{
|
||||
*t = strdup(*type);
|
||||
wl_data_source_offer(input->data.source, *t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_dnd_drag_start(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, Ecore_Wl2_Window *drag_window)
|
||||
{
|
||||
struct wl_surface *dsurface, *osurface;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(input);
|
||||
EINA_SAFETY_ON_NULL_RETURN(input->data.source);
|
||||
EINA_SAFETY_ON_NULL_RETURN(drag_window);
|
||||
|
||||
dsurface = ecore_wl2_window_surface_get(drag_window);
|
||||
|
||||
_ecore_wl2_input_ungrab(input);
|
||||
|
||||
wl_data_source_add_listener(input->data.source, &_source_listener, input);
|
||||
|
||||
osurface = ecore_wl2_window_surface_get(window);
|
||||
if (osurface)
|
||||
{
|
||||
wl_data_device_start_drag(input->data.device, input->data.source,
|
||||
osurface, dsurface, input->display->serial);
|
||||
|
||||
ecore_wl2_window_cursor_from_name_set(window, "move");
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_dnd_drag_get(Ecore_Wl2_Input *input, const char *type)
|
||||
{
|
||||
char **t;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input->drag.source, EINA_FALSE);
|
||||
|
||||
wl_array_for_each(t, &input->drag.source->types)
|
||||
if (!strcmp(type, *t)) break;
|
||||
|
||||
if (!*t) return EINA_FALSE;
|
||||
|
||||
_selection_data_receive(input->drag.source, type);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_dnd_drag_end(Ecore_Wl2_Input *input)
|
||||
{
|
||||
Ecore_Wl2_Event_Dnd_End *ev;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(input);
|
||||
|
||||
if (input->data.types.data)
|
||||
{
|
||||
char **t;
|
||||
|
||||
wl_array_for_each(t, &input->data.types)
|
||||
free(*t);
|
||||
wl_array_release(&input->data.types);
|
||||
wl_array_init(&input->data.types);
|
||||
}
|
||||
|
||||
if (input->data.source) wl_data_source_destroy(input->data.source);
|
||||
input->data.source = NULL;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Dnd_End));
|
||||
if (!ev) return;
|
||||
|
||||
if (input->focus.pointer)
|
||||
ev->win = input->focus.pointer->id;
|
||||
if (input->focus.keyboard)
|
||||
ev->source = input->focus.keyboard->id;
|
||||
|
||||
if (!ev->win) ev->win = ev->source;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_END, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_dnd_selection_owner_has(Ecore_Wl2_Input *input)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
|
||||
|
||||
return (input->selection.source != NULL);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_dnd_selection_set(Ecore_Wl2_Input *input, const char **types)
|
||||
{
|
||||
struct wl_data_device_manager *manager;
|
||||
const char **type;
|
||||
char **t;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input->display, EINA_FALSE);
|
||||
|
||||
manager = input->display->wl.data_device_manager;
|
||||
|
||||
if (input->data.types.data)
|
||||
{
|
||||
wl_array_for_each(t, &input->data.types)
|
||||
free(*t);
|
||||
wl_array_release(&input->data.types);
|
||||
wl_array_init(&input->data.types);
|
||||
}
|
||||
|
||||
input->data.source = NULL;
|
||||
|
||||
if (!types[0]) return EINA_FALSE;
|
||||
|
||||
input->data.source = wl_data_device_manager_create_data_source(manager);
|
||||
if (!input->data.source)
|
||||
{
|
||||
ERR("Could not create data source: %m");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
for (type = types; *type; type++)
|
||||
{
|
||||
if (!*type) continue;
|
||||
t = wl_array_add(&input->data.types, sizeof(*t));
|
||||
if (t)
|
||||
{
|
||||
*t = strdup(*type);
|
||||
wl_data_source_offer(input->data.source, *t);
|
||||
}
|
||||
}
|
||||
|
||||
wl_data_source_add_listener(input->data.source, &_source_listener, input);
|
||||
|
||||
wl_data_device_set_selection(input->data.device, input->data.source,
|
||||
input->display->serial);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_dnd_selection_get(Ecore_Wl2_Input *input, const char *type)
|
||||
{
|
||||
char **t;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input->selection.source, EINA_FALSE);
|
||||
|
||||
for (t = input->selection.source->types.data; *t; t++)
|
||||
if (!strcmp(type, *t)) break;
|
||||
|
||||
if (!*t) return EINA_FALSE;
|
||||
|
||||
_selection_data_receive(input->selection.source, type);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_dnd_selection_clear(Ecore_Wl2_Input *input)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input->data.device, EINA_FALSE);
|
||||
|
||||
wl_data_device_set_selection(input->data.device,
|
||||
NULL, input->display->serial);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,110 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
static void
|
||||
_cb_geometry(void *data, struct wl_output *wl_output EINA_UNUSED, int x, int y, int w, int h, int subpixel EINA_UNUSED, const char *make, const char *model, int transform)
|
||||
{
|
||||
Ecore_Wl2_Output *output;
|
||||
|
||||
output = data;
|
||||
if (!output) return;
|
||||
|
||||
output->mw = w;
|
||||
output->mh = h;
|
||||
output->geometry.x = x;
|
||||
output->geometry.y = y;
|
||||
output->transform = transform;
|
||||
eina_stringshare_replace(&output->make, make);
|
||||
eina_stringshare_replace(&output->model, model);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_mode(void *data, struct wl_output *wl_output EINA_UNUSED, unsigned int flags, int w, int h, int refresh EINA_UNUSED)
|
||||
{
|
||||
Ecore_Wl2_Output *output;
|
||||
|
||||
output = data;
|
||||
if (!output) return;
|
||||
|
||||
if (flags & WL_OUTPUT_MODE_CURRENT)
|
||||
{
|
||||
output->geometry.w = w;
|
||||
output->geometry.h = h;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_done(void *data EINA_UNUSED, struct wl_output *output EINA_UNUSED)
|
||||
{
|
||||
/* NB: Use this event to raise any "output (re)configured events" */
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_scale(void *data EINA_UNUSED, struct wl_output *output EINA_UNUSED, int scale EINA_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static const struct wl_output_listener _output_listener =
|
||||
{
|
||||
_cb_geometry,
|
||||
_cb_mode,
|
||||
_cb_done,
|
||||
_cb_scale
|
||||
};
|
||||
|
||||
void
|
||||
_ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id)
|
||||
{
|
||||
Ecore_Wl2_Output *output;
|
||||
|
||||
output = calloc(1, sizeof(Ecore_Wl2_Output));
|
||||
if (!output) return;
|
||||
|
||||
output->display = display;
|
||||
|
||||
output->wl_output =
|
||||
wl_registry_bind(display->wl.registry, id, &wl_output_interface, 2);
|
||||
|
||||
display->outputs =
|
||||
eina_inlist_append(display->outputs, EINA_INLIST_GET(output));
|
||||
|
||||
wl_output_add_listener(output->wl_output, &_output_listener, output);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_output_del(Ecore_Wl2_Output *output)
|
||||
{
|
||||
Ecore_Wl2_Display *display;
|
||||
|
||||
if (!output) return;
|
||||
|
||||
display = output->display;
|
||||
|
||||
if (output->wl_output) wl_output_destroy(output->wl_output);
|
||||
if (output->make) eina_stringshare_del(output->make);
|
||||
if (output->model) eina_stringshare_del(output->model);
|
||||
|
||||
display->outputs =
|
||||
eina_inlist_remove(display->outputs, EINA_INLIST_GET(output));
|
||||
|
||||
free(output);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_wl2_output_dpi_get(Ecore_Wl2_Output *output)
|
||||
{
|
||||
int w, mw;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(output, 75);
|
||||
|
||||
mw = output->mw;
|
||||
if (mw <= 0) return 75;
|
||||
|
||||
w = output->geometry.w;
|
||||
|
||||
return (((w * 254) / mw) + 5) / 10;
|
||||
}
|
|
@ -0,0 +1,403 @@
|
|||
#ifndef _ECORE_WL2_PRIVATE_H
|
||||
# define _ECORE_WL2_PRIVATE_H
|
||||
|
||||
# include <unistd.h>
|
||||
# include "Ecore_Wl2.h"
|
||||
# include "Ecore_Input.h"
|
||||
|
||||
/* NB: Test if subsurface protocol is part of wayland code, if not then
|
||||
* include our own copy */
|
||||
# ifndef WL_SUBSURFACE_ERROR_ENUM
|
||||
# include "subsurface-client-protocol.h"
|
||||
# endif
|
||||
|
||||
# include "xdg-shell-client-protocol.h"
|
||||
# define XDG_VERSION 5
|
||||
|
||||
extern int _ecore_wl2_log_dom;
|
||||
|
||||
# ifdef ECORE_WL2_DEFAULT_LOG_COLOR
|
||||
# undef ECORE_WL2_DEFAULT_LOG_COLOR
|
||||
# endif
|
||||
# define ECORE_WL2_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
|
||||
|
||||
# ifdef ERR
|
||||
# undef ERR
|
||||
# endif
|
||||
# define ERR(...) EINA_LOG_DOM_ERR(_ecore_wl2_log_dom, __VA_ARGS__)
|
||||
|
||||
# ifdef DBG
|
||||
# undef DBG
|
||||
# endif
|
||||
# define DBG(...) EINA_LOG_DOM_DBG(_ecore_wl2_log_dom, __VA_ARGS__)
|
||||
|
||||
# ifdef INF
|
||||
# undef INF
|
||||
# endif
|
||||
# define INF(...) EINA_LOG_DOM_INFO(_ecore_wl2_log_dom, __VA_ARGS__)
|
||||
|
||||
# ifdef WRN
|
||||
# undef WRN
|
||||
# endif
|
||||
# define WRN(...) EINA_LOG_DOM_WARN(_ecore_wl2_log_dom, __VA_ARGS__)
|
||||
|
||||
# ifdef CRI
|
||||
# undef CRI
|
||||
# endif
|
||||
# define CRI(...) EINA_LOG_DOM_CRIT(_ecore_wl2_log_dom, __VA_ARGS__)
|
||||
|
||||
struct _Ecore_Wl2_Display
|
||||
{
|
||||
int refs;
|
||||
char *name;
|
||||
pid_t pid;
|
||||
|
||||
struct
|
||||
{
|
||||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
struct wl_compositor *compositor;
|
||||
struct wl_subcompositor *subcompositor;
|
||||
struct wl_data_device_manager *data_device_manager;
|
||||
struct wl_shm *shm;
|
||||
struct wl_shell *wl_shell;
|
||||
struct xdg_shell *xdg_shell;
|
||||
} wl;
|
||||
|
||||
uint32_t serial;
|
||||
|
||||
struct xkb_context *xkb_context;
|
||||
|
||||
Ecore_Idle_Enterer *idle_enterer;
|
||||
Ecore_Fd_Handler *fd_hdl;
|
||||
|
||||
Eina_Hash *globals;
|
||||
|
||||
Eina_Inlist *windows;
|
||||
Eina_Inlist *outputs;
|
||||
Eina_Inlist *inputs;
|
||||
Eina_Inlist *seats;
|
||||
|
||||
Eina_Bool sync_done : 1;
|
||||
};
|
||||
|
||||
struct _Ecore_Wl2_Subsurface
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
int x, y;
|
||||
|
||||
Ecore_Wl2_Window *parent;
|
||||
|
||||
struct
|
||||
{
|
||||
struct wl_surface *surface;
|
||||
struct wl_subsurface *subsurface;
|
||||
} wl;
|
||||
|
||||
Eina_Bool sync : 1;
|
||||
};
|
||||
|
||||
struct _Ecore_Wl2_Window
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
Ecore_Wl2_Display *display;
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
Ecore_Wl2_Window *parent;
|
||||
|
||||
int id, rotation, surface_id;
|
||||
const char *title;
|
||||
const char *class;
|
||||
const char *cursor;
|
||||
|
||||
struct wl_surface *surface;
|
||||
struct wl_shell_surface *wl_shell_surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_popup *xdg_popup;
|
||||
|
||||
Eina_Rectangle saved;
|
||||
Eina_Rectangle geometry;
|
||||
Eina_Rectangle opaque;
|
||||
Eina_Rectangle input_rect;
|
||||
|
||||
Ecore_Wl2_Window_Type type;
|
||||
|
||||
Eina_Inlist *subsurfs;
|
||||
|
||||
Eina_Bool moving : 1;
|
||||
Eina_Bool minimized : 1;
|
||||
Eina_Bool maximized : 1;
|
||||
Eina_Bool fullscreen : 1;
|
||||
Eina_Bool focused : 1;
|
||||
Eina_Bool resizing : 1;
|
||||
Eina_Bool alpha : 1;
|
||||
Eina_Bool transparent : 1;
|
||||
};
|
||||
|
||||
struct _Ecore_Wl2_Output
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
Ecore_Wl2_Display *display;
|
||||
struct wl_output *wl_output;
|
||||
|
||||
int mw, mh, transform;
|
||||
const char *make, *model;
|
||||
Eina_Rectangle geometry;
|
||||
};
|
||||
|
||||
typedef struct _Ecore_Wl2_Dnd_Source
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
int refcount, fd, x, y;
|
||||
|
||||
struct wl_data_offer *offer;
|
||||
struct wl_array types;
|
||||
} Ecore_Wl2_Dnd_Source;
|
||||
|
||||
|
||||
/** TODO: Refactor ALL Input code :(
|
||||
*
|
||||
* wl_seat is a GROUP of Input Devices (such as):
|
||||
* keyboards, pointers, touch devices
|
||||
*/
|
||||
struct _Ecore_Wl2_Pointer
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
Ecore_Wl2_Seat *seat;
|
||||
|
||||
double sx, sy;
|
||||
unsigned int button;
|
||||
unsigned int enter_serial;
|
||||
|
||||
struct
|
||||
{
|
||||
const char *name, *theme_name;
|
||||
unsigned int index, size;
|
||||
struct wl_cursor *wl_cursor;
|
||||
struct wl_cursor_theme *theme;
|
||||
struct wl_surface *surface;
|
||||
struct wl_callback *frame_cb;
|
||||
Ecore_Timer *timer;
|
||||
} cursor;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int button, count, timestamp;
|
||||
Ecore_Wl2_Window *window;
|
||||
} grab;
|
||||
|
||||
Ecore_Wl2_Window *focus;
|
||||
|
||||
Eina_List *resources;
|
||||
};
|
||||
|
||||
struct _Ecore_Wl2_Keyboard
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
Ecore_Wl2_Seat *seat;
|
||||
|
||||
unsigned int modifiers;
|
||||
|
||||
struct
|
||||
{
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_state *state;
|
||||
xkb_mod_mask_t control_mask;
|
||||
xkb_mod_mask_t alt_mask;
|
||||
xkb_mod_mask_t shift_mask;
|
||||
xkb_mod_mask_t win_mask;
|
||||
xkb_mod_mask_t scroll_mask;
|
||||
xkb_mod_mask_t num_mask;
|
||||
xkb_mod_mask_t caps_mask;
|
||||
xkb_mod_mask_t altgr_mask;
|
||||
unsigned int mods_depressed;
|
||||
unsigned int mods_latched;
|
||||
unsigned int mods_locked;
|
||||
unsigned int mods_group;
|
||||
} xkb;
|
||||
|
||||
struct
|
||||
{
|
||||
Ecore_Timer *tmr;
|
||||
unsigned int sym, key, time;
|
||||
double rate, delay;
|
||||
Eina_Bool enabled : 1;
|
||||
} repeat;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int button, count, timestamp;
|
||||
Ecore_Wl2_Window *window;
|
||||
} grab;
|
||||
|
||||
Ecore_Wl2_Window *focus;
|
||||
|
||||
Eina_List *resources;
|
||||
};
|
||||
|
||||
struct _Ecore_Wl2_Touch
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int button, count, timestamp;
|
||||
Ecore_Wl2_Window *window;
|
||||
} grab;
|
||||
};
|
||||
|
||||
struct _Ecore_Wl2_Seat
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
uint32_t id;
|
||||
uint32_t version;
|
||||
const char *name;
|
||||
struct wl_global *global;
|
||||
const struct wl_seat_interface *implementation;
|
||||
|
||||
struct
|
||||
{
|
||||
struct wl_global *global;
|
||||
struct wl_resource *resource;
|
||||
} im;
|
||||
|
||||
Ecore_Wl2_Bind_Cb bind_cb;
|
||||
Ecore_Wl2_Unbind_Cb unbind_cb;
|
||||
|
||||
Ecore_Wl2_Pointer *pointer;
|
||||
int pointer_count;
|
||||
|
||||
Ecore_Wl2_Keyboard *keyboard;
|
||||
int keyboard_count;
|
||||
|
||||
Ecore_Wl2_Touch *touch;
|
||||
int touch_count;
|
||||
|
||||
Eina_List *resources;
|
||||
};
|
||||
|
||||
struct _Ecore_Wl2_Input
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
Ecore_Wl2_Display *display;
|
||||
|
||||
unsigned int timestamp;
|
||||
|
||||
struct
|
||||
{
|
||||
struct wl_seat *seat;
|
||||
struct wl_pointer *pointer;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct wl_touch *touch;
|
||||
} wl;
|
||||
|
||||
struct
|
||||
{
|
||||
struct wl_data_device *device;
|
||||
struct wl_data_source *source;
|
||||
struct wl_array types;
|
||||
} data;
|
||||
|
||||
struct
|
||||
{
|
||||
const char *name, *theme_name;
|
||||
unsigned int index, size;
|
||||
struct wl_cursor *wl_cursor;
|
||||
struct wl_cursor_theme *theme;
|
||||
struct wl_surface *surface;
|
||||
struct wl_callback *frame_cb;
|
||||
Ecore_Timer *timer;
|
||||
} cursor;
|
||||
|
||||
struct
|
||||
{
|
||||
double sx, sy;
|
||||
unsigned int button;
|
||||
unsigned int enter_serial;
|
||||
} pointer;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int modifiers;
|
||||
} keyboard;
|
||||
|
||||
struct
|
||||
{
|
||||
Ecore_Wl2_Window *pointer;
|
||||
Ecore_Wl2_Window *keyboard;
|
||||
Ecore_Wl2_Window *touch;
|
||||
} focus;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int button, count, timestamp;
|
||||
Ecore_Wl2_Window *window;
|
||||
} grab;
|
||||
|
||||
struct
|
||||
{
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_state *state;
|
||||
xkb_mod_mask_t control_mask;
|
||||
xkb_mod_mask_t alt_mask;
|
||||
xkb_mod_mask_t shift_mask;
|
||||
xkb_mod_mask_t win_mask;
|
||||
xkb_mod_mask_t scroll_mask;
|
||||
xkb_mod_mask_t num_mask;
|
||||
xkb_mod_mask_t caps_mask;
|
||||
xkb_mod_mask_t altgr_mask;
|
||||
unsigned int mods_depressed;
|
||||
unsigned int mods_latched;
|
||||
unsigned int mods_locked;
|
||||
unsigned int mods_group;
|
||||
} xkb;
|
||||
|
||||
struct
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
unsigned int sym, key, time;
|
||||
double rate, delay;
|
||||
Eina_Bool enabled : 1;
|
||||
} repeat;
|
||||
|
||||
struct
|
||||
{
|
||||
Ecore_Wl2_Dnd_Source *source;
|
||||
} drag, selection;
|
||||
|
||||
unsigned int seat_version;
|
||||
};
|
||||
|
||||
Ecore_Wl2_Window *_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface);
|
||||
|
||||
void _ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id);
|
||||
void _ecore_wl2_output_del(Ecore_Wl2_Output *output);
|
||||
|
||||
void _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int version);
|
||||
void _ecore_wl2_input_del(Ecore_Wl2_Input *input);
|
||||
|
||||
void _ecore_wl2_input_ungrab(Ecore_Wl2_Input *input);
|
||||
void _ecore_wl2_input_grab(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, unsigned int button);
|
||||
|
||||
void _ecore_wl2_input_cursor_set(Ecore_Wl2_Input *input, const char *cursor);
|
||||
void _ecore_wl2_input_cursor_update_stop(Ecore_Wl2_Input *input);
|
||||
|
||||
void _ecore_wl2_dnd_add(Ecore_Wl2_Input *input, struct wl_data_offer *offer);
|
||||
void _ecore_wl2_dnd_enter(Ecore_Wl2_Input *input, struct wl_data_offer *offer, struct wl_surface *surface, int x, int y, unsigned int timestamp);
|
||||
void _ecore_wl2_dnd_leave(Ecore_Wl2_Input *input);
|
||||
void _ecore_wl2_dnd_motion(Ecore_Wl2_Input *input, int x, int y, unsigned int timestamp);
|
||||
void _ecore_wl2_dnd_drop(Ecore_Wl2_Input *input);
|
||||
void _ecore_wl2_dnd_selection(Ecore_Wl2_Input *input, struct wl_data_offer *offer);
|
||||
void _ecore_wl2_dnd_del(Ecore_Wl2_Dnd_Source *source);
|
||||
|
||||
void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,350 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
static void
|
||||
_seat_cb_unbind(struct wl_resource *resource)
|
||||
{
|
||||
Ecore_Wl2_Seat *seat;
|
||||
|
||||
DBG("Seat Unbind");
|
||||
|
||||
seat = wl_resource_get_user_data(resource);
|
||||
if (!seat) return;
|
||||
|
||||
seat->resources = eina_list_remove(seat->resources, resource);
|
||||
|
||||
if (seat->unbind_cb) seat->unbind_cb(resource);
|
||||
}
|
||||
|
||||
static void
|
||||
_seat_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
||||
{
|
||||
Ecore_Wl2_Seat *seat;
|
||||
struct wl_resource *res;
|
||||
|
||||
seat = data;
|
||||
seat->id = id;
|
||||
|
||||
DBG("Seat Bind");
|
||||
|
||||
res = wl_resource_create(client, &wl_seat_interface, version, id);
|
||||
if (!res)
|
||||
{
|
||||
ERR("Failed to create seat resource: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
seat->resources = eina_list_append(seat->resources, res);
|
||||
|
||||
wl_resource_set_implementation(res, seat->implementation, seat,
|
||||
_seat_cb_unbind);
|
||||
|
||||
if (version >= WL_SEAT_NAME_SINCE_VERSION)
|
||||
wl_seat_send_name(res, seat->name);
|
||||
|
||||
if (seat->bind_cb) seat->bind_cb(client, seat, version, id);
|
||||
}
|
||||
|
||||
static void
|
||||
_pointer_cb_unbind(struct wl_resource *resource)
|
||||
{
|
||||
Ecore_Wl2_Pointer *ptr;
|
||||
|
||||
DBG("Pointer Unbind");
|
||||
|
||||
ptr = wl_resource_get_user_data(resource);
|
||||
if (!ptr) return;
|
||||
|
||||
ptr->resources = eina_list_remove(ptr->resources, resource);
|
||||
|
||||
/* wl_pointer_release(); */
|
||||
}
|
||||
|
||||
static Ecore_Wl2_Pointer *
|
||||
_ecore_wl2_seat_pointer_create(Ecore_Wl2_Seat *seat)
|
||||
{
|
||||
Ecore_Wl2_Pointer *ptr;
|
||||
|
||||
ptr = calloc(1, sizeof(Ecore_Wl2_Pointer));
|
||||
if (!ptr) return NULL;
|
||||
|
||||
/* FIXME: Init pointer fields */
|
||||
|
||||
ptr->seat = seat;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_wl2_seat_pointer_destroy(Ecore_Wl2_Pointer *ptr)
|
||||
{
|
||||
/* FIXME: Free pointer fields */
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
static void
|
||||
_keyboard_cb_unbind(struct wl_resource *resource)
|
||||
{
|
||||
Ecore_Wl2_Keyboard *kbd;
|
||||
|
||||
DBG("Keyboard Unbind");
|
||||
|
||||
kbd = wl_resource_get_user_data(resource);
|
||||
if (!kbd) return;
|
||||
|
||||
kbd->resources = eina_list_remove(kbd->resources, resource);
|
||||
|
||||
/* wl_keyboard_release(); */
|
||||
}
|
||||
|
||||
static Ecore_Wl2_Keyboard *
|
||||
_ecore_wl2_seat_keyboard_create(Ecore_Wl2_Seat *seat)
|
||||
{
|
||||
Ecore_Wl2_Keyboard *kbd;
|
||||
|
||||
kbd = calloc(1, sizeof(Ecore_Wl2_Keyboard));
|
||||
if (!kbd) return NULL;
|
||||
|
||||
/* FIXME: Init keyboard fields */
|
||||
|
||||
kbd->seat = seat;
|
||||
|
||||
return kbd;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_wl2_seat_keyboard_destroy(Ecore_Wl2_Keyboard *kbd)
|
||||
{
|
||||
/* FIXME: Free keyboard fields */
|
||||
free(kbd);
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Seat *
|
||||
ecore_wl2_seat_create(Ecore_Wl2_Display *display, const char *name, const struct wl_seat_interface *implementation, int version, Ecore_Wl2_Bind_Cb bind_cb, Ecore_Wl2_Unbind_Cb unbind_cb)
|
||||
{
|
||||
Ecore_Wl2_Seat *seat;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
|
||||
if (!name) name = "default";
|
||||
|
||||
EINA_INLIST_FOREACH(display->seats, seat)
|
||||
{
|
||||
if (!strcmp(seat->name, name))
|
||||
return seat;
|
||||
}
|
||||
|
||||
seat = calloc(1, sizeof(Ecore_Wl2_Seat));
|
||||
if (!seat) return NULL;
|
||||
|
||||
seat->version = version;
|
||||
seat->implementation = implementation;
|
||||
seat->bind_cb = bind_cb;
|
||||
seat->unbind_cb = unbind_cb;
|
||||
|
||||
eina_stringshare_replace(&seat->name, name);
|
||||
|
||||
seat->global =
|
||||
wl_global_create(display->wl.display, &wl_seat_interface, seat->version,
|
||||
seat, _seat_cb_bind);
|
||||
if (!seat->global)
|
||||
{
|
||||
ERR("Could not create seat global: %m");
|
||||
free(seat);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return seat;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_seat_destroy(Ecore_Wl2_Seat *seat)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(seat);
|
||||
|
||||
eina_stringshare_del(seat->name);
|
||||
|
||||
if (seat->pointer) _ecore_wl2_seat_pointer_destroy(seat->pointer);
|
||||
if (seat->keyboard) _ecore_wl2_seat_keyboard_destroy(seat->keyboard);
|
||||
|
||||
/* NB: Hmmm, should we iterate and free resources here ?? */
|
||||
|
||||
wl_global_destroy(seat->global);
|
||||
|
||||
free(seat);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_seat_capabilities_send(Ecore_Wl2_Seat *seat, enum wl_seat_capability caps)
|
||||
{
|
||||
Eina_List *l;
|
||||
struct wl_resource *res;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(seat);
|
||||
|
||||
EINA_LIST_FOREACH(seat->resources, l, res)
|
||||
wl_seat_send_capabilities(res, caps);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_seat_pointer_release(Ecore_Wl2_Seat *seat)
|
||||
{
|
||||
enum wl_seat_capability caps = 0;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(seat);
|
||||
|
||||
seat->pointer_count--;
|
||||
if (seat->pointer_count == 0)
|
||||
{
|
||||
if (seat->pointer_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||
if (seat->keyboard_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
|
||||
if (seat->touch_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_TOUCH;
|
||||
|
||||
ecore_wl2_seat_capabilities_send(seat, caps);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Pointer *
|
||||
ecore_wl2_pointer_get(Ecore_Wl2_Seat *seat)
|
||||
{
|
||||
enum wl_seat_capability caps = 0;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL);
|
||||
|
||||
if (seat->pointer_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||
if (seat->keyboard_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
|
||||
if (seat->touch_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_TOUCH;
|
||||
|
||||
if (seat->pointer)
|
||||
{
|
||||
seat->pointer_count += 1;
|
||||
if (seat->pointer_count == 1)
|
||||
{
|
||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||
ecore_wl2_seat_capabilities_send(seat, caps);
|
||||
}
|
||||
|
||||
return seat->pointer;
|
||||
}
|
||||
|
||||
seat->pointer = _ecore_wl2_seat_pointer_create(seat);
|
||||
seat->pointer_count = 1;
|
||||
|
||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||
ecore_wl2_seat_capabilities_send(seat, caps);
|
||||
|
||||
return seat->pointer;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_pointer_resource_create(Ecore_Wl2_Pointer *ptr, struct wl_client *client, const struct wl_pointer_interface *implementation, int version, uint32_t id)
|
||||
{
|
||||
struct wl_resource *res;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ptr, EINA_FALSE);
|
||||
|
||||
res = wl_resource_create(client, &wl_pointer_interface, version, id);
|
||||
if (!res)
|
||||
{
|
||||
ERR("Could not create pointer resource: %m");
|
||||
wl_client_post_no_memory(client);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
wl_resource_set_implementation(res, implementation, ptr, _pointer_cb_unbind);
|
||||
|
||||
ptr->resources = eina_list_append(ptr->resources, res);
|
||||
|
||||
/* FIXME: Hmmm, should we sent a pointer_enter to ptr->focus'd surface
|
||||
* here like weston does ? */
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Keyboard *
|
||||
ecore_wl2_keyboard_get(Ecore_Wl2_Seat *seat)
|
||||
{
|
||||
enum wl_seat_capability caps = 0;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL);
|
||||
|
||||
if (seat->pointer_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||
if (seat->keyboard_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
|
||||
if (seat->touch_count > 0)
|
||||
caps |= WL_SEAT_CAPABILITY_TOUCH;
|
||||
|
||||
if (seat->keyboard)
|
||||
{
|
||||
seat->keyboard_count += 1;
|
||||
if (seat->keyboard_count == 1)
|
||||
{
|
||||
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
|
||||
ecore_wl2_seat_capabilities_send(seat, caps);
|
||||
}
|
||||
|
||||
return seat->keyboard;
|
||||
}
|
||||
|
||||
seat->keyboard = _ecore_wl2_seat_keyboard_create(seat);
|
||||
seat->keyboard_count = 1;
|
||||
|
||||
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
|
||||
ecore_wl2_seat_capabilities_send(seat, caps);
|
||||
|
||||
return seat->keyboard;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_keyboard_resource_create(Ecore_Wl2_Keyboard *kbd, struct wl_client *client, const struct wl_keyboard_interface *implementation, int version, uint32_t id)
|
||||
{
|
||||
struct wl_resource *res;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(kbd, EINA_FALSE);
|
||||
|
||||
res = wl_resource_create(client, &wl_keyboard_interface, version, id);
|
||||
if (!res)
|
||||
{
|
||||
ERR("Could not create keyboard resource: %m");
|
||||
wl_client_post_no_memory(client);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
wl_resource_set_implementation(res, implementation, kbd, _keyboard_cb_unbind);
|
||||
|
||||
kbd->resources = eina_list_append(kbd->resources, res);
|
||||
|
||||
/* FIXME: Hmmm, should we sent a keyboard_enter to kbd->focus'd surface
|
||||
* here like weston does ? */
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_keyboard_repeat_info_set(Ecore_Wl2_Keyboard *kbd, double rate, double delay)
|
||||
{
|
||||
struct wl_resource *res;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(kbd);
|
||||
|
||||
kbd->repeat.rate = rate;
|
||||
kbd->repeat.delay = delay;
|
||||
|
||||
EINA_LIST_FOREACH(kbd->resources, l, res)
|
||||
{
|
||||
if (wl_resource_get_version(res) >=
|
||||
WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
|
||||
wl_keyboard_send_repeat_info(res, rate, delay);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
void
|
||||
_ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf)
|
||||
{
|
||||
Ecore_Wl2_Window *parent;
|
||||
|
||||
if (subsurf->wl.subsurface) wl_subsurface_destroy(subsurf->wl.subsurface);
|
||||
if (subsurf->wl.surface) wl_surface_destroy(subsurf->wl.surface);
|
||||
|
||||
parent = subsurf->parent;
|
||||
if (parent)
|
||||
{
|
||||
parent->subsurfs =
|
||||
eina_inlist_remove(parent->subsurfs, EINA_INLIST_GET(subsurf));
|
||||
}
|
||||
|
||||
free(subsurf);
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Subsurface *
|
||||
ecore_wl2_subsurface_new(Ecore_Wl2_Window *window)
|
||||
{
|
||||
Ecore_Wl2_Display *display;
|
||||
Ecore_Wl2_Subsurface *subsurf;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window->surface, NULL);
|
||||
|
||||
display = window->display;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display->wl.compositor, NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display->wl.subcompositor, NULL);
|
||||
|
||||
subsurf = calloc(1, sizeof(Ecore_Wl2_Subsurface));
|
||||
if (!subsurf) return NULL;
|
||||
|
||||
subsurf->parent = window;
|
||||
|
||||
subsurf->wl.surface = wl_compositor_create_surface(display->wl.compositor);
|
||||
if (!subsurf->wl.surface)
|
||||
{
|
||||
ERR("Failed to create surface: %m");
|
||||
goto surf_err;
|
||||
}
|
||||
|
||||
subsurf->wl.subsurface =
|
||||
wl_subcompositor_get_subsurface(display->wl.subcompositor,
|
||||
subsurf->wl.surface, window->surface);
|
||||
if (!subsurf->wl.subsurface)
|
||||
{
|
||||
ERR("Could not create subsurface: %m");
|
||||
goto sub_surf_err;
|
||||
}
|
||||
|
||||
window->subsurfs =
|
||||
eina_inlist_append(window->subsurfs, EINA_INLIST_GET(subsurf));
|
||||
|
||||
return subsurf;
|
||||
|
||||
sub_surf_err:
|
||||
wl_surface_destroy(subsurf->wl.surface);
|
||||
|
||||
surf_err:
|
||||
free(subsurf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_del(Ecore_Wl2_Subsurface *subsurface)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
|
||||
_ecore_wl2_subsurf_free(subsurface);
|
||||
}
|
||||
|
||||
EAPI struct wl_surface *
|
||||
ecore_wl2_subsurface_surface_get(Ecore_Wl2_Subsurface *subsurface)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(subsurface, NULL);
|
||||
|
||||
return subsurface->wl.surface;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.subsurface);
|
||||
|
||||
if ((subsurface->x == x) && (subsurface->y == y)) return;
|
||||
|
||||
subsurface->x = x;
|
||||
subsurface->y = y;
|
||||
|
||||
wl_subsurface_set_position(subsurface->wl.subsurface, x, y);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_position_get(Ecore_Wl2_Subsurface *subsurface, int *x, int *y)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
|
||||
if (x) *x = subsurface->x;
|
||||
if (y) *y = subsurface->y;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_place_above(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
EINA_SAFETY_ON_NULL_RETURN(surface);
|
||||
|
||||
wl_subsurface_place_above(subsurface->wl.subsurface, surface);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
EINA_SAFETY_ON_NULL_RETURN(surface);
|
||||
|
||||
wl_subsurface_place_below(subsurface->wl.subsurface, surface);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.subsurface);
|
||||
|
||||
sync = !!sync;
|
||||
if (subsurface->sync == sync) return;
|
||||
|
||||
subsurface->sync = sync;
|
||||
|
||||
if (subsurface->sync)
|
||||
wl_subsurface_set_sync(subsurface->wl.subsurface);
|
||||
else
|
||||
wl_subsurface_set_desync(subsurface->wl.subsurface);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface);
|
||||
EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.subsurface);
|
||||
|
||||
if ((w > 0) && (h > 0))
|
||||
{
|
||||
Ecore_Wl2_Window *parent;
|
||||
|
||||
parent = subsurface->parent;
|
||||
if (parent)
|
||||
{
|
||||
struct wl_region *region;
|
||||
|
||||
region =
|
||||
wl_compositor_create_region(parent->display->wl.compositor);
|
||||
if (!region)
|
||||
{
|
||||
ERR("Failed to create opaque region: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
wl_region_add(region, x, y, w, h);
|
||||
wl_surface_set_opaque_region(subsurface->wl.surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
}
|
||||
else
|
||||
wl_surface_set_opaque_region(subsurface->wl.surface, NULL);
|
||||
}
|
|
@ -0,0 +1,869 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl2_private.h"
|
||||
|
||||
static void
|
||||
_ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigned int edges)
|
||||
{
|
||||
Ecore_Wl2_Event_Window_Configure *ev;
|
||||
|
||||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Configure));
|
||||
if (!ev) return;
|
||||
|
||||
ev->win = window->id;
|
||||
ev->event_win = window->id;
|
||||
ev->x = window->geometry.x;
|
||||
ev->y = window->geometry.y;
|
||||
ev->w = w;
|
||||
ev->h = h;
|
||||
ev->edges = edges;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_wl_shell_surface_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial)
|
||||
{
|
||||
wl_shell_surface_pong(shell_surface, serial);
|
||||
}
|
||||
|
||||
static void
|
||||
_wl_shell_surface_cb_configure(void *data, struct wl_shell_surface *shell_surface EINA_UNUSED, unsigned int edges, int w, int h)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
|
||||
win = data;
|
||||
if (!win) return;
|
||||
|
||||
if ((w <= 0) || (h <= 0)) return;
|
||||
if ((w > 0) && (h > 0))
|
||||
_ecore_wl2_window_configure_send(win, w, h, edges);
|
||||
}
|
||||
|
||||
static void
|
||||
_wl_shell_surface_cb_popup_done(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface EINA_UNUSED)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
|
||||
win = data;
|
||||
if (!win) return;
|
||||
|
||||
_ecore_wl2_input_ungrab(win->input);
|
||||
}
|
||||
|
||||
static const struct wl_shell_surface_listener _wl_shell_surface_listener =
|
||||
{
|
||||
_wl_shell_surface_cb_ping,
|
||||
_wl_shell_surface_cb_configure,
|
||||
_wl_shell_surface_cb_popup_done
|
||||
};
|
||||
|
||||
static void
|
||||
_xdg_popup_cb_done(void *data, struct xdg_popup *xdg_popup EINA_UNUSED)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
|
||||
win = data;
|
||||
if (!win) return;
|
||||
|
||||
_ecore_wl2_input_ungrab(win->input);
|
||||
}
|
||||
|
||||
static const struct xdg_popup_listener _xdg_popup_listener =
|
||||
{
|
||||
_xdg_popup_cb_done,
|
||||
};
|
||||
|
||||
static void
|
||||
_xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSED, int32_t w, int32_t h, struct wl_array *states, uint32_t serial)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
uint32_t *s;
|
||||
|
||||
win = data;
|
||||
if (!win) return;
|
||||
|
||||
win->minimized = EINA_FALSE;
|
||||
win->maximized = EINA_FALSE;
|
||||
win->fullscreen = EINA_FALSE;
|
||||
win->focused = EINA_FALSE;
|
||||
win->resizing = EINA_FALSE;
|
||||
|
||||
wl_array_for_each(s, states)
|
||||
{
|
||||
switch (*s)
|
||||
{
|
||||
case XDG_SURFACE_STATE_MAXIMIZED:
|
||||
win->maximized = EINA_TRUE;
|
||||
break;
|
||||
case XDG_SURFACE_STATE_FULLSCREEN:
|
||||
win->fullscreen = EINA_TRUE;
|
||||
break;
|
||||
case XDG_SURFACE_STATE_RESIZING:
|
||||
win->resizing = EINA_TRUE;
|
||||
break;
|
||||
case XDG_SURFACE_STATE_ACTIVATED:
|
||||
win->focused = EINA_TRUE;
|
||||
win->minimized = EINA_FALSE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((w > 0) && (h > 0))
|
||||
_ecore_wl2_window_configure_send(win, w, h, 0);
|
||||
|
||||
xdg_surface_ack_configure(win->xdg_surface, serial);
|
||||
}
|
||||
|
||||
static void
|
||||
_xdg_surface_cb_delete(void *data, struct xdg_surface *xdg_surface EINA_UNUSED)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
|
||||
win = data;
|
||||
if (!win) return;
|
||||
|
||||
ecore_wl2_window_free(win);
|
||||
}
|
||||
|
||||
static const struct xdg_surface_listener _xdg_surface_listener =
|
||||
{
|
||||
_xdg_surface_cb_configure,
|
||||
_xdg_surface_cb_delete,
|
||||
};
|
||||
|
||||
static void
|
||||
_ecore_wl2_window_type_set(Ecore_Wl2_Window *win)
|
||||
{
|
||||
switch (win->type)
|
||||
{
|
||||
case ECORE_WL2_WINDOW_TYPE_FULLSCREEN:
|
||||
if (win->xdg_surface)
|
||||
xdg_surface_set_fullscreen(win->xdg_surface, NULL);
|
||||
else if (win->wl_shell_surface)
|
||||
wl_shell_surface_set_fullscreen(win->wl_shell_surface,
|
||||
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
|
||||
0, NULL);
|
||||
break;
|
||||
case ECORE_WL2_WINDOW_TYPE_MAXIMIZED:
|
||||
if (win->xdg_surface)
|
||||
xdg_surface_set_maximized(win->xdg_surface);
|
||||
else if (win->wl_shell_surface)
|
||||
wl_shell_surface_set_maximized(win->wl_shell_surface, NULL);
|
||||
break;
|
||||
case ECORE_WL2_WINDOW_TYPE_TRANSIENT:
|
||||
if (win->xdg_surface)
|
||||
xdg_surface_set_parent(win->xdg_surface, win->parent->xdg_surface);
|
||||
else if (win->wl_shell_surface)
|
||||
wl_shell_surface_set_transient(win->wl_shell_surface,
|
||||
win->parent->surface,
|
||||
win->geometry.x, win->geometry.y, 0);
|
||||
break;
|
||||
case ECORE_WL2_WINDOW_TYPE_MENU:
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
input = win->input;
|
||||
if ((!input) && (win->parent))
|
||||
{
|
||||
input = win->parent->input;
|
||||
}
|
||||
|
||||
if ((!input) || (!input->wl.seat)) return;
|
||||
|
||||
if (win->xdg_surface)
|
||||
{
|
||||
win->xdg_popup =
|
||||
xdg_shell_get_xdg_popup(win->display->wl.xdg_shell,
|
||||
win->surface, win->parent->surface,
|
||||
input->wl.seat,
|
||||
win->display->serial,
|
||||
win->geometry.x, win->geometry.y);
|
||||
if (!win->xdg_popup)
|
||||
{
|
||||
ERR("Could not create xdg popup: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
xdg_popup_set_user_data(win->xdg_popup, win);
|
||||
xdg_popup_add_listener(win->xdg_popup,
|
||||
&_xdg_popup_listener, win);
|
||||
}
|
||||
else if (win->wl_shell_surface)
|
||||
{
|
||||
wl_shell_surface_set_popup(win->wl_shell_surface,
|
||||
input->wl.seat,
|
||||
win->display->serial,
|
||||
win->parent->surface,
|
||||
win->geometry.x,
|
||||
win->geometry.y, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ECORE_WL2_WINDOW_TYPE_TOPLEVEL:
|
||||
if (win->xdg_surface)
|
||||
xdg_surface_set_parent(win->xdg_surface, NULL);
|
||||
else if (win->wl_shell_surface)
|
||||
wl_shell_surface_set_toplevel(win->wl_shell_surface);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Window *
|
||||
ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
static int _win_id = 1;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
||||
|
||||
/* try to allocate space for window structure */
|
||||
win = calloc(1, sizeof(Ecore_Wl2_Window));
|
||||
if (!win) return NULL;
|
||||
|
||||
win->display = display;
|
||||
win->parent = parent;
|
||||
win->id = _win_id++;
|
||||
|
||||
win->geometry.x = x;
|
||||
win->geometry.y = y;
|
||||
win->geometry.w = w;
|
||||
win->geometry.h = h;
|
||||
|
||||
win->opaque.x = x;
|
||||
win->opaque.y = y;
|
||||
win->opaque.w = w;
|
||||
win->opaque.h = h;
|
||||
|
||||
win->type = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
|
||||
|
||||
display->windows =
|
||||
eina_inlist_append(display->windows, EINA_INLIST_GET(win));
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_wl2_window_id_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, -1);
|
||||
return window->id;
|
||||
}
|
||||
|
||||
EAPI struct wl_surface *
|
||||
ecore_wl2_window_surface_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
||||
|
||||
if (!window->surface)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window->display->wl.compositor, NULL);
|
||||
|
||||
window->surface =
|
||||
wl_compositor_create_surface(window->display->wl.compositor);
|
||||
|
||||
window->surface_id =
|
||||
wl_proxy_get_id((struct wl_proxy *)window->surface);
|
||||
}
|
||||
|
||||
return window->surface;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_wl2_window_surface_id_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, -1);
|
||||
return window->surface_id;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_show(Ecore_Wl2_Window *window)
|
||||
{
|
||||
Ecore_Wl2_Display *disp;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
disp = window->display;
|
||||
|
||||
if (!window->surface)
|
||||
{
|
||||
window->surface =
|
||||
wl_compositor_create_surface(window->display->wl.compositor);
|
||||
}
|
||||
|
||||
if ((window->type == ECORE_WL2_WINDOW_TYPE_DND) ||
|
||||
(window->type == ECORE_WL2_WINDOW_TYPE_NONE))
|
||||
goto type_set;
|
||||
|
||||
if ((disp->wl.xdg_shell) && (!window->xdg_surface))
|
||||
{
|
||||
window->xdg_surface =
|
||||
xdg_shell_get_xdg_surface(disp->wl.xdg_shell, window->surface);
|
||||
if (!window->xdg_surface) goto surf_err;
|
||||
|
||||
if (window->title)
|
||||
xdg_surface_set_title(window->xdg_surface, window->title);
|
||||
if (window->class)
|
||||
xdg_surface_set_app_id(window->xdg_surface, window->class);
|
||||
|
||||
xdg_surface_set_user_data(window->xdg_surface, window);
|
||||
xdg_surface_add_listener(window->xdg_surface,
|
||||
&_xdg_surface_listener, window);
|
||||
}
|
||||
else if ((disp->wl.wl_shell) && (!window->wl_shell_surface))
|
||||
{
|
||||
window->wl_shell_surface =
|
||||
wl_shell_get_shell_surface(disp->wl.wl_shell, window->surface);
|
||||
if (!window->wl_shell_surface) goto surf_err;
|
||||
|
||||
if (window->title)
|
||||
wl_shell_surface_set_title(window->wl_shell_surface, window->title);
|
||||
if (window->class)
|
||||
wl_shell_surface_set_class(window->wl_shell_surface, window->class);
|
||||
|
||||
wl_shell_surface_add_listener(window->wl_shell_surface,
|
||||
&_wl_shell_surface_listener, window);
|
||||
}
|
||||
|
||||
type_set:
|
||||
_ecore_wl2_window_type_set(window);
|
||||
return;
|
||||
|
||||
surf_err:
|
||||
ERR("Failed to create surface for window: %m");
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_hide(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (window->xdg_surface) xdg_surface_destroy(window->xdg_surface);
|
||||
window->xdg_surface = NULL;
|
||||
|
||||
if (window->xdg_popup) xdg_popup_destroy(window->xdg_popup);
|
||||
window->xdg_popup = NULL;
|
||||
|
||||
if (window->wl_shell_surface)
|
||||
wl_shell_surface_destroy(window->wl_shell_surface);
|
||||
window->wl_shell_surface = NULL;
|
||||
|
||||
if (window->surface) wl_surface_destroy(window->surface);
|
||||
window->surface = NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_free(Ecore_Wl2_Window *window)
|
||||
{
|
||||
Ecore_Wl2_Display *display;
|
||||
Ecore_Wl2_Input *input;
|
||||
Ecore_Wl2_Subsurface *subsurf;
|
||||
Eina_Inlist *tmp;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
display = window->display;
|
||||
|
||||
EINA_INLIST_FOREACH(display->inputs, input)
|
||||
{
|
||||
if ((input->focus.pointer) &&
|
||||
(input->focus.pointer == window))
|
||||
input->focus.pointer = NULL;
|
||||
if ((input->focus.keyboard) &&
|
||||
(input->focus.keyboard == window))
|
||||
{
|
||||
input->focus.keyboard = NULL;
|
||||
ecore_timer_del(input->repeat.timer);
|
||||
input->repeat.timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf)
|
||||
_ecore_wl2_subsurf_free(subsurf);
|
||||
|
||||
ecore_wl2_window_hide(window);
|
||||
|
||||
if (window->title) eina_stringshare_del(window->title);
|
||||
if (window->class) eina_stringshare_del(window->class);
|
||||
|
||||
display->windows =
|
||||
eina_inlist_remove(display->windows, EINA_INLIST_GET(window));
|
||||
|
||||
free(window);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_move(Ecore_Wl2_Window *window, int x EINA_UNUSED, int y EINA_UNUSED)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
input = window->input;
|
||||
if ((!input) && (window->parent))
|
||||
{
|
||||
input = window->parent->input;
|
||||
}
|
||||
|
||||
if ((!input) || (!input->wl.seat)) return;
|
||||
|
||||
window->moving = EINA_TRUE;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_move(window->xdg_surface, input->wl.seat,
|
||||
window->display->serial);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_move(window->wl_shell_surface, input->wl.seat,
|
||||
window->display->serial);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_resize(Ecore_Wl2_Window *window, int w EINA_UNUSED, int h EINA_UNUSED, int location)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
input = window->input;
|
||||
if ((!input) && (window->parent))
|
||||
{
|
||||
input = window->parent->input;
|
||||
}
|
||||
|
||||
if ((!input) || (!input->wl.seat)) return;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_resize(window->xdg_surface, input->wl.seat,
|
||||
input->display->serial, location);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_resize(window->wl_shell_surface, input->wl.seat,
|
||||
input->display->serial, location);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_raise(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (window->xdg_surface)
|
||||
{
|
||||
struct wl_array states;
|
||||
uint32_t *s;
|
||||
|
||||
wl_array_init(&states);
|
||||
s = wl_array_add(&states, sizeof(*s));
|
||||
*s = XDG_SURFACE_STATE_ACTIVATED;
|
||||
_xdg_surface_cb_configure(window, window->xdg_surface,
|
||||
window->geometry.w, window->geometry.h,
|
||||
&states, 0);
|
||||
wl_array_release(&states);
|
||||
}
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_toplevel(window->wl_shell_surface);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_window_alpha_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
||||
|
||||
return window->alpha;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (window->alpha == alpha) return;
|
||||
|
||||
window->alpha = alpha;
|
||||
|
||||
if (!window->alpha)
|
||||
ecore_wl2_window_opaque_region_set(window, window->opaque.x,
|
||||
window->opaque.y, window->opaque.w,
|
||||
window->opaque.h);
|
||||
else
|
||||
ecore_wl2_window_opaque_region_set(window, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_transparent_set(Ecore_Wl2_Window *window, Eina_Bool transparent)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (window->transparent == transparent) return;
|
||||
|
||||
window->transparent = transparent;
|
||||
|
||||
if (!window->transparent)
|
||||
ecore_wl2_window_opaque_region_set(window, window->opaque.x,
|
||||
window->opaque.y, window->opaque.w,
|
||||
window->opaque.h);
|
||||
else
|
||||
ecore_wl2_window_opaque_region_set(window, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
|
||||
{
|
||||
struct wl_region *region;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
window->opaque.x = x;
|
||||
window->opaque.y = y;
|
||||
window->opaque.w = w;
|
||||
window->opaque.h = h;
|
||||
|
||||
if ((window->transparent) || (window->alpha)) return;
|
||||
|
||||
region = wl_compositor_create_region(window->display->wl.compositor);
|
||||
if (!region)
|
||||
{
|
||||
ERR("Failed to create opaque region: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (window->rotation)
|
||||
{
|
||||
case 0:
|
||||
wl_region_add(region, x, y, w, h);
|
||||
break;
|
||||
case 180:
|
||||
wl_region_add(region, x, x + y, w, h);
|
||||
break;
|
||||
case 90:
|
||||
wl_region_add(region, y, x, h, w);
|
||||
break;
|
||||
case 270:
|
||||
wl_region_add(region, x + y, x, h, w);
|
||||
break;
|
||||
}
|
||||
|
||||
wl_surface_set_opaque_region(window->surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
|
||||
{
|
||||
struct wl_region *region;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
window->input_rect.x = x;
|
||||
window->input_rect.y = y;
|
||||
window->input_rect.w = w;
|
||||
window->input_rect.h = h;
|
||||
|
||||
if (window->type == ECORE_WL2_WINDOW_TYPE_DND) return;
|
||||
|
||||
region = wl_compositor_create_region(window->display->wl.compositor);
|
||||
if (!region)
|
||||
{
|
||||
ERR("Failed to create opaque region: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (window->rotation)
|
||||
{
|
||||
case 0:
|
||||
wl_region_add(region, x, y, w, h);
|
||||
break;
|
||||
case 180:
|
||||
wl_region_add(region, x, x + y, w, h);
|
||||
break;
|
||||
case 90:
|
||||
wl_region_add(region, y, x, h, w);
|
||||
break;
|
||||
case 270:
|
||||
wl_region_add(region, x + y, x, h, w);
|
||||
break;
|
||||
}
|
||||
|
||||
wl_surface_set_input_region(window->surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_window_maximized_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
||||
|
||||
return window->maximized;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool maximized)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (window->maximized == maximized) return;
|
||||
|
||||
if (window->type == ECORE_WL2_WINDOW_TYPE_TOPLEVEL)
|
||||
{
|
||||
window->saved = window->geometry;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_set_maximized(window->xdg_surface);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_maximized(window->wl_shell_surface, NULL);
|
||||
|
||||
window->type = ECORE_WL2_WINDOW_TYPE_MAXIMIZED;
|
||||
}
|
||||
else if (window->type == ECORE_WL2_WINDOW_TYPE_MAXIMIZED)
|
||||
{
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_unset_maximized(window->xdg_surface);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_toplevel(window->wl_shell_surface);
|
||||
|
||||
window->type = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
|
||||
|
||||
_ecore_wl2_window_configure_send(window, window->saved.w,
|
||||
window->saved.h, 0);
|
||||
}
|
||||
|
||||
window->maximized = maximized;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_window_fullscreen_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
||||
|
||||
return window->fullscreen;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (window->fullscreen == fullscreen) return;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
window->saved = window->geometry;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_set_fullscreen(window->xdg_surface, NULL);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_fullscreen(window->wl_shell_surface,
|
||||
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
|
||||
0, NULL);
|
||||
|
||||
window->type = ECORE_WL2_WINDOW_TYPE_FULLSCREEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_unset_fullscreen(window->xdg_surface);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_toplevel(window->wl_shell_surface);
|
||||
|
||||
window->type = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
|
||||
|
||||
_ecore_wl2_window_configure_send(window, window->saved.w,
|
||||
window->saved.h, 0);
|
||||
}
|
||||
|
||||
window->fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_wl2_window_rotation_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, -1);
|
||||
|
||||
return window->rotation;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_rotation_set(Ecore_Wl2_Window *window, int rotation)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
window->rotation = rotation;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_title_set(Ecore_Wl2_Window *window, const char *title)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
eina_stringshare_replace(&window->title, title);
|
||||
if (!window->title) return;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_set_title(window->xdg_surface, window->title);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_title(window->wl_shell_surface, window->title);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_class_set(Ecore_Wl2_Window *window, const char *clas)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
eina_stringshare_replace(&window->class, clas);
|
||||
if (!window->class) return;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_set_app_id(window->xdg_surface, window->class);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_class(window->wl_shell_surface, window->class);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_geometry_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (x) *x = window->geometry.x;
|
||||
if (y) *y = window->geometry.y;
|
||||
if (w) *w = window->geometry.w;
|
||||
if (h) *h = window->geometry.h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_geometry_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if ((window->geometry.x == x) && (window->geometry.y == y) &&
|
||||
(window->geometry.w == w) && (window->geometry.h == h))
|
||||
return;
|
||||
|
||||
window->geometry.x = x;
|
||||
window->geometry.y = y;
|
||||
window->geometry.w = w;
|
||||
window->geometry.h = h;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_set_window_geometry(window->xdg_surface, x, y, w, h);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_window_iconified_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
||||
|
||||
return window->minimized;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (window->minimized == iconified) return;
|
||||
|
||||
if (iconified)
|
||||
{
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_set_minimized(window->xdg_surface);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->xdg_surface)
|
||||
{
|
||||
struct wl_array states;
|
||||
uint32_t *s;
|
||||
|
||||
wl_array_init(&states);
|
||||
s = wl_array_add(&states, sizeof(*s));
|
||||
*s = XDG_SURFACE_STATE_ACTIVATED;
|
||||
_xdg_surface_cb_configure(window, window->xdg_surface,
|
||||
window->geometry.w, window->geometry.h,
|
||||
&states, 0);
|
||||
wl_array_release(&states);
|
||||
}
|
||||
|
||||
window->type = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
|
||||
}
|
||||
|
||||
window->minimized = iconified;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_pointer_xy_get(Ecore_Wl2_Window *window, int *x, int *y)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
|
||||
input = ecore_wl2_window_input_get(window);
|
||||
if (!input) return;
|
||||
|
||||
if (x) *x = input->pointer.sx;
|
||||
if (y) *y = input->pointer.sy;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_pointer_set(Ecore_Wl2_Window *window, struct wl_surface *surface, int hot_x, int hot_y)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
input = ecore_wl2_window_input_get(window);
|
||||
if (!input) return;
|
||||
|
||||
_ecore_wl2_input_cursor_update_stop(input);
|
||||
|
||||
if (input->wl.pointer)
|
||||
wl_pointer_set_cursor(input->wl.pointer,
|
||||
input->pointer.enter_serial,
|
||||
surface, hot_x, hot_y);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_cursor_from_name_set(Ecore_Wl2_Window *window, const char *cursor)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
eina_stringshare_replace(&window->cursor, cursor);
|
||||
|
||||
input = ecore_wl2_window_input_get(window);
|
||||
if (!input) return;
|
||||
|
||||
_ecore_wl2_input_cursor_update_stop(input);
|
||||
_ecore_wl2_input_cursor_set(input, cursor);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_type_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_Type type)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
window->type = type;
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Input *
|
||||
ecore_wl2_window_input_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window->display, NULL);
|
||||
|
||||
if (window->input) return window->input;
|
||||
|
||||
EINA_INLIST_FOREACH(window->display->inputs, input)
|
||||
{
|
||||
if (input->focus.pointer) return input;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* Copyright © 2012-2013 Collabora, Ltd.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this
|
||||
* software and its documentation for any purpose is hereby granted
|
||||
* without fee, provided that the above copyright notice appear in
|
||||
* all copies and that both that copyright notice and this permission
|
||||
* notice appear in supporting documentation, and that the name of
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SUBSURFACE_CLIENT_PROTOCOL_H
|
||||
#define SUBSURFACE_CLIENT_PROTOCOL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
struct wl_client;
|
||||
struct wl_resource;
|
||||
|
||||
struct wl_subcompositor;
|
||||
struct wl_subsurface;
|
||||
|
||||
extern const struct wl_interface wl_subcompositor_interface;
|
||||
extern const struct wl_interface wl_subsurface_interface;
|
||||
|
||||
#ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
|
||||
#define WL_SUBCOMPOSITOR_ERROR_ENUM
|
||||
enum wl_subcompositor_error {
|
||||
WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
|
||||
};
|
||||
#endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
|
||||
|
||||
#define WL_SUBCOMPOSITOR_DESTROY 0
|
||||
#define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1
|
||||
|
||||
static inline void
|
||||
wl_subcompositor_set_user_data(struct wl_subcompositor *wl_subcompositor, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wl_subcompositor, user_data);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
wl_subcompositor_get_user_data(struct wl_subcompositor *wl_subcompositor)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wl_subcompositor);
|
||||
}
|
||||
|
||||
static inline void
|
||||
wl_subcompositor_destroy(struct wl_subcompositor *wl_subcompositor)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subcompositor,
|
||||
WL_SUBCOMPOSITOR_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) wl_subcompositor);
|
||||
}
|
||||
|
||||
static inline struct wl_subsurface *
|
||||
wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor, struct wl_surface *surface, struct wl_surface *parent)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_create((struct wl_proxy *) wl_subcompositor,
|
||||
&wl_subsurface_interface);
|
||||
if (!id)
|
||||
return NULL;
|
||||
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subcompositor,
|
||||
WL_SUBCOMPOSITOR_GET_SUBSURFACE, id, surface, parent);
|
||||
|
||||
return (struct wl_subsurface *) id;
|
||||
}
|
||||
|
||||
#ifndef WL_SUBSURFACE_ERROR_ENUM
|
||||
#define WL_SUBSURFACE_ERROR_ENUM
|
||||
enum wl_subsurface_error {
|
||||
WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
|
||||
};
|
||||
#endif /* WL_SUBSURFACE_ERROR_ENUM */
|
||||
|
||||
#define WL_SUBSURFACE_DESTROY 0
|
||||
#define WL_SUBSURFACE_SET_POSITION 1
|
||||
#define WL_SUBSURFACE_PLACE_ABOVE 2
|
||||
#define WL_SUBSURFACE_PLACE_BELOW 3
|
||||
#define WL_SUBSURFACE_SET_SYNC 4
|
||||
#define WL_SUBSURFACE_SET_DESYNC 5
|
||||
|
||||
static inline void
|
||||
wl_subsurface_set_user_data(struct wl_subsurface *wl_subsurface, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) wl_subsurface, user_data);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
wl_subsurface_get_user_data(struct wl_subsurface *wl_subsurface)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) wl_subsurface);
|
||||
}
|
||||
|
||||
static inline void
|
||||
wl_subsurface_destroy(struct wl_subsurface *wl_subsurface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
|
||||
WL_SUBSURFACE_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) wl_subsurface);
|
||||
}
|
||||
|
||||
static inline void
|
||||
wl_subsurface_set_position(struct wl_subsurface *wl_subsurface, int32_t x, int32_t y)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
|
||||
WL_SUBSURFACE_SET_POSITION, x, y);
|
||||
}
|
||||
|
||||
static inline void
|
||||
wl_subsurface_place_above(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
|
||||
WL_SUBSURFACE_PLACE_ABOVE, sibling);
|
||||
}
|
||||
|
||||
static inline void
|
||||
wl_subsurface_place_below(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
|
||||
WL_SUBSURFACE_PLACE_BELOW, sibling);
|
||||
}
|
||||
|
||||
static inline void
|
||||
wl_subsurface_set_sync(struct wl_subsurface *wl_subsurface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
|
||||
WL_SUBSURFACE_SET_SYNC);
|
||||
}
|
||||
|
||||
static inline void
|
||||
wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
|
||||
WL_SUBSURFACE_SET_DESYNC);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright © 2012-2013 Collabora, Ltd.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this
|
||||
* software and its documentation for any purpose is hereby granted
|
||||
* without fee, provided that the above copyright notice appear in
|
||||
* all copies and that both that copyright notice and this permission
|
||||
* notice appear in supporting documentation, and that the name of
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_subsurface_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
|
||||
static const struct wl_interface *types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
&wl_subsurface_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_surface_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message wl_subcompositor_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "get_subsurface", "noo", types + 2 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface wl_subcompositor_interface = {
|
||||
"wl_subcompositor", 1,
|
||||
2, wl_subcompositor_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message wl_subsurface_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "set_position", "ii", types + 0 },
|
||||
{ "place_above", "o", types + 5 },
|
||||
{ "place_below", "o", types + 6 },
|
||||
{ "set_sync", "", types + 0 },
|
||||
{ "set_desync", "", types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface wl_subsurface_interface = {
|
||||
"wl_subsurface", 1,
|
||||
6, wl_subsurface_requests,
|
||||
0, NULL,
|
||||
};
|
|
@ -0,0 +1,561 @@
|
|||
/*
|
||||
* Copyright © 2008-2013 Kristian Høgsberg
|
||||
* Copyright © 2013 Rafael Antognolli
|
||||
* Copyright © 2013 Jasper St. Pierre
|
||||
* Copyright © 2010-2013 Intel Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this
|
||||
* software and its documentation for any purpose is hereby granted
|
||||
* without fee, provided that the above copyright notice appear in
|
||||
* all copies and that both that copyright notice and this permission
|
||||
* notice appear in supporting documentation, and that the name of
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H
|
||||
#define XDG_SHELL_CLIENT_PROTOCOL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
struct wl_client;
|
||||
struct wl_resource;
|
||||
|
||||
struct wl_output;
|
||||
struct wl_seat;
|
||||
struct wl_surface;
|
||||
struct xdg_popup;
|
||||
struct xdg_shell;
|
||||
struct xdg_surface;
|
||||
|
||||
extern const struct wl_interface xdg_shell_interface;
|
||||
extern const struct wl_interface xdg_surface_interface;
|
||||
extern const struct wl_interface xdg_popup_interface;
|
||||
|
||||
#ifndef XDG_SHELL_VERSION_ENUM
|
||||
#define XDG_SHELL_VERSION_ENUM
|
||||
/**
|
||||
* xdg_shell_version - latest protocol version
|
||||
* @XDG_SHELL_VERSION_CURRENT: Always the latest version
|
||||
*
|
||||
* The 'current' member of this enum gives the version of the protocol.
|
||||
* Implementations can compare this to the version they implement using
|
||||
* static_assert to ensure the protocol and implementation versions match.
|
||||
*/
|
||||
enum xdg_shell_version {
|
||||
XDG_SHELL_VERSION_CURRENT = 5,
|
||||
};
|
||||
#endif /* XDG_SHELL_VERSION_ENUM */
|
||||
|
||||
#ifndef XDG_SHELL_ERROR_ENUM
|
||||
#define XDG_SHELL_ERROR_ENUM
|
||||
enum xdg_shell_error {
|
||||
XDG_SHELL_ERROR_ROLE = 0,
|
||||
XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1,
|
||||
XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP = 2,
|
||||
XDG_SHELL_ERROR_INVALID_POPUP_PARENT = 3,
|
||||
};
|
||||
#endif /* XDG_SHELL_ERROR_ENUM */
|
||||
|
||||
/**
|
||||
* xdg_shell - create desktop-style surfaces
|
||||
* @ping: check if the client is alive
|
||||
*
|
||||
* xdg_shell allows clients to turn a wl_surface into a "real window"
|
||||
* which can be dragged, resized, stacked, and moved around by the user.
|
||||
* Everything about this interface is suited towards traditional desktop
|
||||
* environments.
|
||||
*/
|
||||
struct xdg_shell_listener {
|
||||
/**
|
||||
* ping - check if the client is alive
|
||||
* @serial: pass this to the pong request
|
||||
*
|
||||
* The ping event asks the client if it's still alive. Pass the
|
||||
* serial specified in the event back to the compositor by sending
|
||||
* a "pong" request back with the specified serial.
|
||||
*
|
||||
* Compositors can use this to determine if the client is still
|
||||
* alive. It's unspecified what will happen if the client doesn't
|
||||
* respond to the ping request, or in what timeframe. Clients
|
||||
* should try to respond in a reasonable amount of time.
|
||||
*
|
||||
* A compositor is free to ping in any way it wants, but a client
|
||||
* must always respond to any xdg_shell object it created.
|
||||
*/
|
||||
void (*ping)(void *data,
|
||||
struct xdg_shell *xdg_shell,
|
||||
uint32_t serial);
|
||||
};
|
||||
|
||||
static inline int
|
||||
xdg_shell_add_listener(struct xdg_shell *xdg_shell,
|
||||
const struct xdg_shell_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) xdg_shell,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define XDG_SHELL_DESTROY 0
|
||||
#define XDG_SHELL_USE_UNSTABLE_VERSION 1
|
||||
#define XDG_SHELL_GET_XDG_SURFACE 2
|
||||
#define XDG_SHELL_GET_XDG_POPUP 3
|
||||
#define XDG_SHELL_PONG 4
|
||||
|
||||
static inline void
|
||||
xdg_shell_set_user_data(struct xdg_shell *xdg_shell, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
xdg_shell_get_user_data(struct xdg_shell *xdg_shell)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_shell_destroy(struct xdg_shell *xdg_shell)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_shell,
|
||||
XDG_SHELL_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_shell);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_shell_use_unstable_version(struct xdg_shell *xdg_shell, int32_t version)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_shell,
|
||||
XDG_SHELL_USE_UNSTABLE_VERSION, version);
|
||||
}
|
||||
|
||||
static inline struct xdg_surface *
|
||||
xdg_shell_get_xdg_surface(struct xdg_shell *xdg_shell, struct wl_surface *surface)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
|
||||
XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_interface, NULL, surface);
|
||||
|
||||
return (struct xdg_surface *) id;
|
||||
}
|
||||
|
||||
static inline struct xdg_popup *
|
||||
xdg_shell_get_xdg_popup(struct xdg_shell *xdg_shell, struct wl_surface *surface, struct wl_surface *parent, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
|
||||
XDG_SHELL_GET_XDG_POPUP, &xdg_popup_interface, NULL, surface, parent, seat, serial, x, y);
|
||||
|
||||
return (struct xdg_popup *) id;
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_shell_pong(struct xdg_shell *xdg_shell, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_shell,
|
||||
XDG_SHELL_PONG, serial);
|
||||
}
|
||||
|
||||
#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM
|
||||
#define XDG_SURFACE_RESIZE_EDGE_ENUM
|
||||
/**
|
||||
* xdg_surface_resize_edge - edge values for resizing
|
||||
* @XDG_SURFACE_RESIZE_EDGE_NONE: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_TOP: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_BOTTOM: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_LEFT: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_TOP_LEFT: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_RIGHT: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT: (none)
|
||||
* @XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT: (none)
|
||||
*
|
||||
* These values are used to indicate which edge of a surface is being
|
||||
* dragged in a resize operation. The server may use this information to
|
||||
* adapt its behavior, e.g. choose an appropriate cursor image.
|
||||
*/
|
||||
enum xdg_surface_resize_edge {
|
||||
XDG_SURFACE_RESIZE_EDGE_NONE = 0,
|
||||
XDG_SURFACE_RESIZE_EDGE_TOP = 1,
|
||||
XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2,
|
||||
XDG_SURFACE_RESIZE_EDGE_LEFT = 4,
|
||||
XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5,
|
||||
XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6,
|
||||
XDG_SURFACE_RESIZE_EDGE_RIGHT = 8,
|
||||
XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9,
|
||||
XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10,
|
||||
};
|
||||
#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */
|
||||
|
||||
#ifndef XDG_SURFACE_STATE_ENUM
|
||||
#define XDG_SURFACE_STATE_ENUM
|
||||
/**
|
||||
* xdg_surface_state - types of state on the surface
|
||||
* @XDG_SURFACE_STATE_MAXIMIZED: the surface is maximized
|
||||
* @XDG_SURFACE_STATE_FULLSCREEN: the surface is fullscreen
|
||||
* @XDG_SURFACE_STATE_RESIZING: (none)
|
||||
* @XDG_SURFACE_STATE_ACTIVATED: (none)
|
||||
*
|
||||
* The different state values used on the surface. This is designed for
|
||||
* state values like maximized, fullscreen. It is paired with the configure
|
||||
* event to ensure that both the client and the compositor setting the
|
||||
* state can be synchronized.
|
||||
*
|
||||
* States set in this way are double-buffered. They will get applied on the
|
||||
* next commit.
|
||||
*
|
||||
* Desktop environments may extend this enum by taking up a range of values
|
||||
* and documenting the range they chose in this description. They are not
|
||||
* required to document the values for the range that they chose. Ideally,
|
||||
* any good extensions from a desktop environment should make its way into
|
||||
* standardization into this enum.
|
||||
*
|
||||
* The current reserved ranges are:
|
||||
*
|
||||
* 0x0000 - 0x0FFF: xdg-shell core values, documented below. 0x1000 -
|
||||
* 0x1FFF: GNOME
|
||||
*/
|
||||
enum xdg_surface_state {
|
||||
XDG_SURFACE_STATE_MAXIMIZED = 1,
|
||||
XDG_SURFACE_STATE_FULLSCREEN = 2,
|
||||
XDG_SURFACE_STATE_RESIZING = 3,
|
||||
XDG_SURFACE_STATE_ACTIVATED = 4,
|
||||
};
|
||||
#endif /* XDG_SURFACE_STATE_ENUM */
|
||||
|
||||
/**
|
||||
* xdg_surface - A desktop window
|
||||
* @configure: suggest a surface change
|
||||
* @close: surface wants to be closed
|
||||
*
|
||||
* An interface that may be implemented by a wl_surface, for
|
||||
* implementations that provide a desktop-style user interface.
|
||||
*
|
||||
* It provides requests to treat surfaces like windows, allowing to set
|
||||
* properties like maximized, fullscreen, minimized, and to move and resize
|
||||
* them, and associate metadata like title and app id.
|
||||
*
|
||||
* The client must call wl_surface.commit on the corresponding wl_surface
|
||||
* for the xdg_surface state to take effect. Prior to committing the new
|
||||
* state, it can set up initial configuration, such as maximizing or
|
||||
* setting a window geometry.
|
||||
*
|
||||
* Even without attaching a buffer the compositor must respond to initial
|
||||
* committed configuration, for instance sending a configure event with
|
||||
* expected window geometry if the client maximized its surface during
|
||||
* initialization.
|
||||
*
|
||||
* For a surface to be mapped by the compositor the client must have
|
||||
* committed both an xdg_surface state and a buffer.
|
||||
*/
|
||||
struct xdg_surface_listener {
|
||||
/**
|
||||
* configure - suggest a surface change
|
||||
* @width: (none)
|
||||
* @height: (none)
|
||||
* @states: (none)
|
||||
* @serial: (none)
|
||||
*
|
||||
* The configure event asks the client to resize its surface or
|
||||
* to change its state.
|
||||
*
|
||||
* The width and height arguments specify a hint to the window
|
||||
* about how its surface should be resized in window geometry
|
||||
* coordinates. See set_window_geometry.
|
||||
*
|
||||
* If the width or height arguments are zero, it means the client
|
||||
* should decide its own window dimension. This may happen when the
|
||||
* compositor need to configure the state of the surface but
|
||||
* doesn't have any information about any previous or expected
|
||||
* dimension.
|
||||
*
|
||||
* The states listed in the event specify how the width/height
|
||||
* arguments should be interpreted, and possibly how it should be
|
||||
* drawn.
|
||||
*
|
||||
* Clients should arrange their surface for the new size and
|
||||
* states, and then send a ack_configure request with the serial
|
||||
* sent in this configure event at some point before committing the
|
||||
* new surface.
|
||||
*
|
||||
* If the client receives multiple configure events before it can
|
||||
* respond to one, it is free to discard all but the last event it
|
||||
* received.
|
||||
*/
|
||||
void (*configure)(void *data,
|
||||
struct xdg_surface *xdg_surface,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
struct wl_array *states,
|
||||
uint32_t serial);
|
||||
/**
|
||||
* close - surface wants to be closed
|
||||
*
|
||||
* The close event is sent by the compositor when the user wants
|
||||
* the surface to be closed. This should be equivalent to the user
|
||||
* clicking the close button in client-side decorations, if your
|
||||
* application has any...
|
||||
*
|
||||
* This is only a request that the user intends to close your
|
||||
* window. The client may choose to ignore this request, or show a
|
||||
* dialog to ask the user to save their data...
|
||||
*/
|
||||
void (*close)(void *data,
|
||||
struct xdg_surface *xdg_surface);
|
||||
};
|
||||
|
||||
static inline int
|
||||
xdg_surface_add_listener(struct xdg_surface *xdg_surface,
|
||||
const struct xdg_surface_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) xdg_surface,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define XDG_SURFACE_DESTROY 0
|
||||
#define XDG_SURFACE_SET_PARENT 1
|
||||
#define XDG_SURFACE_SET_TITLE 2
|
||||
#define XDG_SURFACE_SET_APP_ID 3
|
||||
#define XDG_SURFACE_SHOW_WINDOW_MENU 4
|
||||
#define XDG_SURFACE_MOVE 5
|
||||
#define XDG_SURFACE_RESIZE 6
|
||||
#define XDG_SURFACE_ACK_CONFIGURE 7
|
||||
#define XDG_SURFACE_SET_WINDOW_GEOMETRY 8
|
||||
#define XDG_SURFACE_SET_MAXIMIZED 9
|
||||
#define XDG_SURFACE_UNSET_MAXIMIZED 10
|
||||
#define XDG_SURFACE_SET_FULLSCREEN 11
|
||||
#define XDG_SURFACE_UNSET_FULLSCREEN 12
|
||||
#define XDG_SURFACE_SET_MINIMIZED 13
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
xdg_surface_get_user_data(struct xdg_surface *xdg_surface)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_destroy(struct xdg_surface *xdg_surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_surface);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_parent(struct xdg_surface *xdg_surface, struct xdg_surface *parent)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_PARENT, parent);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_title(struct xdg_surface *xdg_surface, const char *title)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_TITLE, title);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_app_id(struct xdg_surface *xdg_surface, const char *app_id)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_APP_ID, app_id);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_show_window_menu(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_move(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_MOVE, seat, serial);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_resize(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_RESIZE, seat, serial, edges);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_ACK_CONFIGURE, serial);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_maximized(struct xdg_surface *xdg_surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_MAXIMIZED);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_unset_maximized(struct xdg_surface *xdg_surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_UNSET_MAXIMIZED);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_fullscreen(struct xdg_surface *xdg_surface, struct wl_output *output)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_FULLSCREEN, output);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_unset_fullscreen(struct xdg_surface *xdg_surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_UNSET_FULLSCREEN);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_surface_set_minimized(struct xdg_surface *xdg_surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_surface,
|
||||
XDG_SURFACE_SET_MINIMIZED);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_popup - short-lived, popup surfaces for menus
|
||||
* @popup_done: popup interaction is done
|
||||
*
|
||||
* A popup surface is a short-lived, temporary surface that can be used
|
||||
* to implement menus. It takes an explicit grab on the surface that will
|
||||
* be dismissed when the user dismisses the popup. This can be done by the
|
||||
* user clicking outside the surface, using the keyboard, or even locking
|
||||
* the screen through closing the lid or a timeout.
|
||||
*
|
||||
* When the popup is dismissed, a popup_done event will be sent out, and at
|
||||
* the same time the surface will be unmapped. The xdg_popup object is now
|
||||
* inert and cannot be reactivated, so clients should destroy it.
|
||||
* Explicitly destroying the xdg_popup object will also dismiss the popup
|
||||
* and unmap the surface.
|
||||
*
|
||||
* Clients will receive events for all their surfaces during this grab
|
||||
* (which is an "owner-events" grab in X11 parlance). This is done so that
|
||||
* users can navigate through submenus and other "nested" popup windows
|
||||
* without having to dismiss the topmost popup.
|
||||
*
|
||||
* Clients that want to dismiss the popup when another surface of their own
|
||||
* is clicked should dismiss the popup using the destroy request.
|
||||
*
|
||||
* The parent surface must have either an xdg_surface or xdg_popup role.
|
||||
*
|
||||
* Specifying an xdg_popup for the parent means that the popups are nested,
|
||||
* with this popup now being the topmost popup. Nested popups must be
|
||||
* destroyed in the reverse order they were created in, e.g. the only popup
|
||||
* you are allowed to destroy at all times is the topmost one.
|
||||
*
|
||||
* If there is an existing popup when creating a new popup, the parent must
|
||||
* be the current topmost popup.
|
||||
*
|
||||
* A parent surface must be mapped before the new popup is mapped.
|
||||
*
|
||||
* When compositors choose to dismiss a popup, they will likely dismiss
|
||||
* every nested popup as well. When a compositor dismisses popups, it will
|
||||
* follow the same dismissing order as required from the client.
|
||||
*
|
||||
* The x and y arguments passed when creating the popup object specify
|
||||
* where the top left of the popup should be placed, relative to the local
|
||||
* surface coordinates of the parent surface. See xdg_shell.get_xdg_popup.
|
||||
*
|
||||
* The client must call wl_surface.commit on the corresponding wl_surface
|
||||
* for the xdg_popup state to take effect.
|
||||
*
|
||||
* For a surface to be mapped by the compositor the client must have
|
||||
* committed both the xdg_popup state and a buffer.
|
||||
*/
|
||||
struct xdg_popup_listener {
|
||||
/**
|
||||
* popup_done - popup interaction is done
|
||||
*
|
||||
* The popup_done event is sent out when a popup is dismissed by
|
||||
* the compositor. The client should destroy the xdg_popup object
|
||||
* at this point.
|
||||
*/
|
||||
void (*popup_done)(void *data,
|
||||
struct xdg_popup *xdg_popup);
|
||||
};
|
||||
|
||||
static inline int
|
||||
xdg_popup_add_listener(struct xdg_popup *xdg_popup,
|
||||
const struct xdg_popup_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define XDG_POPUP_DESTROY 0
|
||||
|
||||
static inline void
|
||||
xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
xdg_popup_get_user_data(struct xdg_popup *xdg_popup)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xdg_popup_destroy(struct xdg_popup *xdg_popup)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_popup);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright © 2008-2013 Kristian Høgsberg
|
||||
* Copyright © 2013 Rafael Antognolli
|
||||
* Copyright © 2013 Jasper St. Pierre
|
||||
* Copyright © 2010-2013 Intel Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this
|
||||
* software and its documentation for any purpose is hereby granted
|
||||
* without fee, provided that the above copyright notice appear in
|
||||
* all copies and that both that copyright notice and this permission
|
||||
* notice appear in supporting documentation, and that the name of
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_output_interface;
|
||||
extern const struct wl_interface wl_seat_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface xdg_popup_interface;
|
||||
extern const struct wl_interface xdg_surface_interface;
|
||||
|
||||
static const struct wl_interface *types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&xdg_surface_interface,
|
||||
&wl_surface_interface,
|
||||
&xdg_popup_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&xdg_surface_interface,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
NULL,
|
||||
&wl_output_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_shell_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "use_unstable_version", "i", types + 0 },
|
||||
{ "get_xdg_surface", "no", types + 4 },
|
||||
{ "get_xdg_popup", "nooouii", types + 6 },
|
||||
{ "pong", "u", types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_shell_events[] = {
|
||||
{ "ping", "u", types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_shell_interface = {
|
||||
"xdg_shell", 1,
|
||||
5, xdg_shell_requests,
|
||||
1, xdg_shell_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_surface_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "set_parent", "?o", types + 13 },
|
||||
{ "set_title", "s", types + 0 },
|
||||
{ "set_app_id", "s", types + 0 },
|
||||
{ "show_window_menu", "ouii", types + 14 },
|
||||
{ "move", "ou", types + 18 },
|
||||
{ "resize", "ouu", types + 20 },
|
||||
{ "ack_configure", "u", types + 0 },
|
||||
{ "set_window_geometry", "iiii", types + 0 },
|
||||
{ "set_maximized", "", types + 0 },
|
||||
{ "unset_maximized", "", types + 0 },
|
||||
{ "set_fullscreen", "?o", types + 23 },
|
||||
{ "unset_fullscreen", "", types + 0 },
|
||||
{ "set_minimized", "", types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_surface_events[] = {
|
||||
{ "configure", "iiau", types + 0 },
|
||||
{ "close", "", types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_surface_interface = {
|
||||
"xdg_surface", 1,
|
||||
14, xdg_surface_requests,
|
||||
2, xdg_surface_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_popup_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_popup_events[] = {
|
||||
{ "popup_done", "", types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_popup_interface = {
|
||||
"xdg_popup", 1,
|
||||
1, xdg_popup_requests,
|
||||
1, xdg_popup_events,
|
||||
};
|
||||
|
|
@ -334,6 +334,7 @@ _ecore_key_press(int event,
|
|||
KeySym sym;
|
||||
XComposeStatus status;
|
||||
int val;
|
||||
int key_len, keyname_len, compose_len;
|
||||
|
||||
_ecore_x_last_event_mouse_move = 0;
|
||||
keyname = XKeysymToString(_ecore_x_XKeycodeToKeysym(xevent->display,
|
||||
|
@ -370,14 +371,18 @@ _ecore_key_press(int event,
|
|||
if (!key)
|
||||
key = keyname;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
|
||||
(compose ? strlen(compose) : 0) + 3);
|
||||
key_len = strlen(key);
|
||||
keyname_len = strlen(keyname);
|
||||
compose_len = (compose) ? strlen(compose) : 0;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Event_Key) + key_len + keyname_len +
|
||||
compose_len + 3);
|
||||
if (!e)
|
||||
goto on_error;
|
||||
|
||||
e->keyname = (char *)(e + 1);
|
||||
e->key = e->keyname + strlen(keyname) + 1;
|
||||
e->compose = (compose) ? e->key + strlen(key) + 1 : NULL;
|
||||
e->key = e->keyname + keyname_len + 1;
|
||||
e->compose = (compose) ? e->key + key_len + 1 : NULL;
|
||||
e->string = e->compose;
|
||||
|
||||
strcpy((char *)e->keyname, keyname);
|
||||
|
|
|
@ -113,16 +113,6 @@ typedef Eo Ector_Renderer;
|
|||
// FIXME: Enable that when we have merged Emile
|
||||
/* typedef Evas_Colorspace Ector_Colorspace; */
|
||||
|
||||
/**
|
||||
* Raster operations at pixel level
|
||||
*/
|
||||
typedef enum _Ector_Rop
|
||||
{
|
||||
ECTOR_ROP_BLEND, /**< D = S + D(1 - Sa) */
|
||||
ECTOR_ROP_COPY, /**< D = S */
|
||||
ECTOR_ROP_LAST
|
||||
} Ector_Rop;
|
||||
|
||||
/**
|
||||
* Quality values
|
||||
*/
|
||||
|
|
|
@ -13,6 +13,7 @@ typedef Eo Ector_Cairo_Surface;
|
|||
typedef struct _cairo_t cairo_t;
|
||||
|
||||
#include "cairo/ector_cairo_surface.eo.h"
|
||||
#include "cairo/ector_cairo_software_surface.eo.h"
|
||||
#include "cairo/ector_renderer_cairo_base.eo.h"
|
||||
#include "cairo/ector_renderer_cairo_shape.eo.h"
|
||||
#include "cairo/ector_renderer_cairo_gradient_linear.eo.h"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef ECTOR_CAIRO_PRIVATE_H_
|
||||
# define ECTOR_CAIRO_PRIVATE_H_
|
||||
|
||||
#include "draw.h"
|
||||
|
||||
typedef void cairo_pattern_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -58,15 +60,12 @@ _ector_cairo_extent_get(Efl_Gfx_Gradient_Spread s)
|
|||
if (!Sym) return Error;
|
||||
|
||||
static inline void *
|
||||
_ector_cairo_symbol_get(Eo *obj, const char *name)
|
||||
_ector_cairo_symbol_get(Ector_Renderer_Generic_Base_Data *base,
|
||||
const char *name)
|
||||
{
|
||||
Eo *parent;
|
||||
void *sym;
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
if (!parent) return NULL;
|
||||
|
||||
eo_do(parent, sym = ector_cairo_surface_symbol_get(name));
|
||||
eo_do(base->surface, sym = ector_cairo_surface_symbol_get(name));
|
||||
return sym;
|
||||
}
|
||||
|
||||
|
@ -74,15 +73,12 @@ extern void (*cairo_pattern_add_color_stop_rgba)(cairo_pattern_t *pattern, doubl
|
|||
double red, double green, double blue, double alpha);
|
||||
|
||||
static inline void
|
||||
_ector_renderer_cairo_gradient_prepare(Eo *obj,
|
||||
cairo_pattern_t *pat,
|
||||
_ector_renderer_cairo_gradient_prepare(cairo_pattern_t *pat,
|
||||
Ector_Renderer_Generic_Gradient_Data *src,
|
||||
unsigned int mul_col)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
USE(obj, cairo_pattern_add_color_stop_rgba, );
|
||||
|
||||
for (i = 0; i < src->colors_count; i++)
|
||||
{
|
||||
int r,g,b,a;
|
||||
|
|
|
@ -2,15 +2,13 @@
|
|||
#include "config.h" /* so that EAPI in Evas.h is correctly defined */
|
||||
#endif
|
||||
|
||||
#include <Ector.h>
|
||||
|
||||
#include <cairo/Ector_Cairo.h>
|
||||
#include "Ector_Cairo.h"
|
||||
#include "ector_private.h"
|
||||
#include <software/Ector_Software.h>
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include "evas_private.h"
|
||||
#include "ector_cairo_software_surface.eo.h"
|
||||
|
||||
#define MY_CLASS ECTOR_CAIRO_SOFTWARE_SURFACE_CLASS
|
||||
|
||||
#define USE(Obj, Sym, Error) \
|
||||
if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
|
||||
if (!Sym) return Error;
|
||||
|
@ -49,57 +47,76 @@ typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_D
|
|||
struct _Ector_Cairo_Software_Surface_Data
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
void *pixels;
|
||||
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
Ector_Software_Buffer_Base_Data *base;
|
||||
};
|
||||
|
||||
void
|
||||
_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height)
|
||||
EOLIAN static Eina_Bool
|
||||
_ector_cairo_software_surface_ector_generic_buffer_pixels_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd,
|
||||
void *pixels, int width, int height, int stride,
|
||||
Efl_Gfx_Colorspace cspace, Eina_Bool writable,
|
||||
unsigned char l, unsigned char r, unsigned char t, unsigned char b)
|
||||
{
|
||||
cairo_t *ctx = NULL;
|
||||
Eina_Bool ok = EINA_FALSE;
|
||||
|
||||
USE(obj, cairo_image_surface_create_for_data, );
|
||||
USE(obj, cairo_surface_destroy, );
|
||||
USE(obj, cairo_create, );
|
||||
USE(obj, cairo_destroy, );
|
||||
if ((cspace != EFL_GFX_COLORSPACE_ARGB8888) || !writable)
|
||||
{
|
||||
ERR("Unsupported surface type!");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL;
|
||||
USE(obj, cairo_image_surface_create_for_data, EINA_FALSE);
|
||||
USE(obj, cairo_surface_destroy, EINA_FALSE);
|
||||
USE(obj, cairo_create, EINA_FALSE);
|
||||
USE(obj, cairo_destroy, EINA_FALSE);
|
||||
|
||||
pd->pixels = NULL;
|
||||
pd->width = 0;
|
||||
pd->height = 0;
|
||||
if (pd->surface)
|
||||
cairo_surface_destroy(pd->surface);
|
||||
pd->surface = NULL;
|
||||
|
||||
if (pixels)
|
||||
eo_do_super(obj, MY_CLASS,
|
||||
ok = ector_buffer_pixels_set(pixels, width, height, stride,
|
||||
cspace, writable, l, r, t, b));
|
||||
|
||||
if (ok && pixels)
|
||||
{
|
||||
pd->surface = cairo_image_surface_create_for_data(pixels,
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
width, height, width * sizeof (int));
|
||||
width, height, pd->base->stride);
|
||||
if (!pd->surface) goto end;
|
||||
|
||||
ctx = cairo_create(pd->surface);
|
||||
}
|
||||
|
||||
pd->pixels = pixels;
|
||||
pd->width = width;
|
||||
pd->height = height;
|
||||
|
||||
end:
|
||||
evas_common_cpu_end_opt();
|
||||
|
||||
eo_do(obj,
|
||||
ector_cairo_surface_context_set(ctx),
|
||||
ector_surface_size_set(pd->width, pd->height));
|
||||
/* evas_common_cpu_end_opt(); // do we need this? */
|
||||
eo_do(obj, ector_cairo_surface_context_set(ctx));
|
||||
return ok;
|
||||
}
|
||||
|
||||
void
|
||||
_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height)
|
||||
{
|
||||
if (pixels) *pixels = pd->pixels;
|
||||
if (width) *width = pd->width;
|
||||
if (height) *height = pd->height;
|
||||
if (pixels) *pixels = pd->base->pixels.u8;
|
||||
if (width) *width = pd->base->generic->w;
|
||||
if (height) *height = pd->base->generic->h;
|
||||
}
|
||||
|
||||
static Eo_Base *
|
||||
_ector_cairo_software_surface_eo_base_constructor(Eo *obj, Ector_Cairo_Software_Surface_Data *pd)
|
||||
{
|
||||
eo_do_super(obj, MY_CLASS, obj = eo_constructor());
|
||||
pd->base = eo_data_ref(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
|
||||
pd->base->generic = eo_data_ref(obj, ECTOR_GENERIC_BUFFER_MIXIN);
|
||||
pd->base->generic->eo = obj;
|
||||
return obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_ector_cairo_software_surface_eo_base_destructor(Eo *obj, Ector_Cairo_Software_Surface_Data *pd)
|
||||
{
|
||||
eo_data_unref(obj, pd->base);
|
||||
eo_do_super(obj, MY_CLASS, eo_destructor());
|
||||
}
|
||||
|
||||
#include "ector_cairo_software_surface.eo.c"
|
|
@ -0,0 +1,11 @@
|
|||
class Ector.Cairo_Software.Surface (Ector.Cairo.Surface, Ector.Software.Buffer.Base)
|
||||
{
|
||||
eo_prefix: ector_cairo_software_surface;
|
||||
legacy_prefix: null;
|
||||
methods {}
|
||||
implements {
|
||||
Ector.Generic.Buffer.pixels_set;
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.destructor;
|
||||
}
|
||||
}
|
|
@ -62,11 +62,15 @@ _ector_cairo_surface_ector_generic_surface_renderer_factory_new(Eo *obj,
|
|||
const Eo_Class *type)
|
||||
{
|
||||
if (type == ECTOR_RENDERER_GENERIC_SHAPE_MIXIN)
|
||||
return eo_add(ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj);
|
||||
return eo_add(ECTOR_RENDERER_CAIRO_SHAPE_CLASS, NULL,
|
||||
ector_renderer_surface_set(obj));
|
||||
else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN)
|
||||
return eo_add(ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, obj);
|
||||
return eo_add(ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, NULL,
|
||||
ector_renderer_surface_set(obj));
|
||||
else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN)
|
||||
return eo_add(ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, obj);
|
||||
return eo_add(ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, NULL,
|
||||
ector_renderer_surface_set(obj));
|
||||
|
||||
ERR("Couldn't find class for type: %s\n", eo_class_name_get(type));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -82,18 +86,13 @@ static cairo_t *(*cairo_create)(cairo_surface_t *target) = NULL;
|
|||
static cairo_surface_t *internal = NULL;
|
||||
|
||||
static void
|
||||
_ector_cairo_surface_context_set(Eo *obj,
|
||||
_ector_cairo_surface_context_set(Eo *obj EINA_UNUSED,
|
||||
Ector_Cairo_Surface_Data *pd,
|
||||
cairo_t *ctx)
|
||||
{
|
||||
USE(obj, cairo_destroy, );
|
||||
|
||||
if (pd->cairo) cairo_destroy(pd->cairo);
|
||||
if (!ctx)
|
||||
{
|
||||
USE(obj, cairo_image_surface_create, );
|
||||
USE(obj, cairo_create, );
|
||||
|
||||
if (!internal) internal = cairo_image_surface_create(0, 1, 1);
|
||||
ctx = cairo_create(internal);
|
||||
}
|
||||
|
@ -121,7 +120,13 @@ static Eo *
|
|||
_ector_cairo_surface_eo_base_constructor(Eo *obj,
|
||||
Ector_Cairo_Surface_Data *pd)
|
||||
{
|
||||
obj = eo_do_super_ret(obj, ECTOR_CAIRO_SURFACE_CLASS, obj, eo_constructor());
|
||||
USE(obj, cairo_destroy, NULL);
|
||||
USE(obj, cairo_image_surface_create, NULL);
|
||||
USE(obj, cairo_create, NULL);
|
||||
|
||||
eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, obj = eo_constructor());
|
||||
if (!obj) return NULL;
|
||||
|
||||
_cairo_count++;
|
||||
|
||||
_ector_cairo_surface_context_set(obj, pd, NULL);
|
||||
|
@ -135,8 +140,6 @@ _ector_cairo_surface_eo_base_destructor(Eo *obj EINA_UNUSED,
|
|||
{
|
||||
eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, eo_destructor());
|
||||
|
||||
|
||||
|
||||
if (--_cairo_count) return ;
|
||||
if (_cairo_so) eina_module_free(_cairo_so);
|
||||
_cairo_so = NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Ector.Cairo.Surface (Ector.Generic.Surface)
|
||||
class Ector.Cairo.Surface (Eo.Base, Ector.Generic.Surface)
|
||||
{
|
||||
eo_prefix: ector_cairo_surface;
|
||||
legacy_prefix: null;
|
||||
|
|
|
@ -99,16 +99,10 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_prepare(Eo *obj, Ector_Re
|
|||
{
|
||||
if (!pd->parent)
|
||||
{
|
||||
Eo *parent;
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
if (!parent) return EINA_FALSE;
|
||||
pd->parent = eo_data_xref(parent, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
pd->parent = eo_data_xref(pd->generic->surface, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
}
|
||||
if (pd->generic->m)
|
||||
{
|
||||
USE(obj, cairo_matrix_init, EINA_FALSE);
|
||||
|
||||
if (!pd->m) pd->m = malloc(sizeof (cairo_matrix_t));
|
||||
cairo_matrix_init(pd->m,
|
||||
pd->generic->m->xx, pd->generic->m->yx,
|
||||
|
@ -125,9 +119,9 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_prepare(Eo *obj, Ector_Re
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
|
||||
_ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED,
|
||||
Ector_Renderer_Cairo_Base_Data *pd,
|
||||
Ector_Rop op,
|
||||
Efl_Gfx_Render_Op op,
|
||||
Eina_Array *clips EINA_UNUSED,
|
||||
unsigned int mul_col)
|
||||
{
|
||||
|
@ -135,17 +129,12 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
|
|||
cairo_operator_t cop;
|
||||
double cx, cy;
|
||||
|
||||
USE(obj, cairo_translate, EINA_FALSE);
|
||||
USE(obj, cairo_set_source_rgba, EINA_FALSE);
|
||||
USE(obj, cairo_transform, EINA_FALSE);
|
||||
USE(obj, cairo_set_operator, EINA_FALSE);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case ECTOR_ROP_BLEND:
|
||||
case EFL_GFX_RENDER_OP_BLEND:
|
||||
cop = CAIRO_OPERATOR_OVER;
|
||||
break;
|
||||
case ECTOR_ROP_COPY:
|
||||
case EFL_GFX_RENDER_OP_COPY:
|
||||
default:
|
||||
cop = CAIRO_OPERATOR_SOURCE;
|
||||
break;
|
||||
|
@ -159,11 +148,6 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
|
|||
|
||||
cairo_set_operator(pd->parent->cairo, cop);
|
||||
|
||||
|
||||
USE(obj, cairo_new_path, EINA_FALSE);
|
||||
USE(obj, cairo_rectangle, EINA_FALSE);
|
||||
USE(obj, cairo_clip, EINA_FALSE);
|
||||
USE(obj, cairo_device_to_user, EINA_FALSE);
|
||||
if (clips)
|
||||
{
|
||||
int clip_count = eina_array_count(clips);
|
||||
|
@ -198,11 +182,30 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
|
|||
static Eo *
|
||||
_ector_renderer_cairo_base_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Base_Data *pd EINA_UNUSED)
|
||||
{
|
||||
obj = eo_do_super_ret(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, obj, eo_constructor());
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, obj = eo_constructor());
|
||||
if (!obj) return NULL;
|
||||
|
||||
pd->generic = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
|
||||
|
||||
USE(obj, cairo_matrix_init_identity, NULL);
|
||||
return obj;
|
||||
}
|
||||
|
||||
static Eo_Base *
|
||||
_ector_renderer_cairo_base_eo_base_finalize(Eo *obj, Ector_Renderer_Cairo_Base_Data *pd)
|
||||
{
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, obj = eo_finalize());
|
||||
if (!obj) return NULL;
|
||||
|
||||
USE(pd->generic, cairo_matrix_init, NULL);
|
||||
USE(pd->generic, cairo_translate, NULL);
|
||||
USE(pd->generic, cairo_set_source_rgba, NULL);
|
||||
USE(pd->generic, cairo_transform, NULL);
|
||||
USE(pd->generic, cairo_set_operator, NULL);
|
||||
USE(pd->generic, cairo_new_path, NULL);
|
||||
USE(pd->generic, cairo_rectangle, NULL);
|
||||
USE(pd->generic, cairo_clip, NULL);
|
||||
USE(pd->generic, cairo_device_to_user, NULL);
|
||||
USE(pd->generic, cairo_matrix_init_identity, NULL);
|
||||
|
||||
cairo_matrix_init_identity(&identity);
|
||||
|
||||
|
@ -212,14 +215,14 @@ _ector_renderer_cairo_base_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Bas
|
|||
static void
|
||||
_ector_renderer_cairo_base_eo_base_destructor(Eo *obj, Ector_Renderer_Cairo_Base_Data *pd)
|
||||
{
|
||||
Eo *parent;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
eo_data_xunref(base->surface, pd->parent, obj);
|
||||
eo_data_xunref(obj, pd->generic, obj);
|
||||
|
||||
free(pd->m);
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
eo_data_xunref(parent, pd->parent, obj);
|
||||
eo_data_xunref(obj, pd->generic, obj);
|
||||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, eo_destructor());
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ abstract Ector.Renderer.Cairo.Base (Ector.Renderer.Generic.Base)
|
|||
Ector.Renderer.Generic.Base.color.set;
|
||||
Ector.Renderer.Generic.Base.color.get;
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.finalize;
|
||||
Eo.Base.destructor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,21 +27,18 @@ struct _Ector_Renderer_Cairo_Gradient_Linear_Data
|
|||
};
|
||||
|
||||
static cairo_pattern_t *
|
||||
_ector_renderer_cairo_gradient_linear_prepare(Eo *obj,
|
||||
_ector_renderer_cairo_gradient_linear_prepare(Eo *obj EINA_UNUSED,
|
||||
Ector_Renderer_Generic_Gradient_Linear_Data *gld,
|
||||
Ector_Renderer_Generic_Gradient_Data *gd,
|
||||
unsigned int mul_col)
|
||||
{
|
||||
cairo_pattern_t *pat;
|
||||
|
||||
USE(obj, cairo_pattern_create_linear, NULL);
|
||||
|
||||
pat = cairo_pattern_create_linear(gld->start.x, gld->start.y,
|
||||
gld->end.x, gld->end.y);
|
||||
if (!pat) return NULL;
|
||||
_ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col);
|
||||
_ector_renderer_cairo_gradient_prepare(pat, gd, mul_col);
|
||||
|
||||
USE(obj, cairo_pattern_set_extend, NULL);
|
||||
cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s));
|
||||
|
||||
return pat;
|
||||
|
@ -55,11 +52,10 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_prepare(Eo *ob
|
|||
|
||||
if (!pd->parent)
|
||||
{
|
||||
Eo *parent;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
if (!parent) return EINA_FALSE;
|
||||
pd->parent = eo_data_xref(parent, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
pd->parent = eo_data_xref(base->surface, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
|
@ -68,7 +64,7 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_prepare(Eo *ob
|
|||
static Eina_Bool
|
||||
_ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj,
|
||||
Ector_Renderer_Cairo_Gradient_Linear_Data *pd,
|
||||
Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
|
||||
Efl_Gfx_Render_Op op, Eina_Array *clips, unsigned int mul_col)
|
||||
{
|
||||
Ector_Renderer_Generic_Gradient_Linear_Data *gld;
|
||||
Ector_Renderer_Generic_Gradient_Data *gd;
|
||||
|
@ -84,11 +80,6 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj,
|
|||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, mul_col));
|
||||
|
||||
USE(obj, cairo_rectangle, EINA_FALSE);
|
||||
USE(obj, cairo_fill, EINA_FALSE);
|
||||
USE(obj, cairo_pattern_destroy, EINA_FALSE);
|
||||
USE(obj, cairo_set_source, EINA_FALSE);
|
||||
|
||||
cairo_rectangle(pd->parent->cairo, gld->start.x, gld->start.y,
|
||||
gld->end.x - gld->start.x,
|
||||
gld->end.y - gld->start.y);
|
||||
|
@ -115,9 +106,6 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_cairo_base_fill(Eo *obj,
|
|||
pat = _ector_renderer_cairo_gradient_linear_prepare(obj, gld, gd, mul_col);
|
||||
if (!pat) return EINA_FALSE;
|
||||
|
||||
USE(obj, cairo_set_source, EINA_FALSE);
|
||||
USE(obj, cairo_pattern_destroy, EINA_FALSE);
|
||||
|
||||
cairo_set_source(pd->parent->cairo, pat);
|
||||
cairo_pattern_destroy(pat);
|
||||
|
||||
|
@ -141,19 +129,42 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_bounds_get(Eo
|
|||
gld->end.y - gld->start.x);
|
||||
}
|
||||
|
||||
void
|
||||
static Eo_Base *
|
||||
_ector_renderer_cairo_gradient_linear_eo_base_finalize(Eo *obj, Ector_Renderer_Cairo_Gradient_Linear_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, obj = eo_finalize());
|
||||
if (!obj) return NULL;
|
||||
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
|
||||
USE(base, cairo_set_source, NULL);
|
||||
USE(base, cairo_pattern_destroy, NULL);
|
||||
USE(base, cairo_rectangle, NULL);
|
||||
USE(base, cairo_fill, NULL);
|
||||
USE(base, cairo_pattern_destroy, NULL);
|
||||
USE(base, cairo_set_source, NULL);
|
||||
USE(base, cairo_pattern_set_extend, NULL);
|
||||
USE(base, cairo_pattern_create_linear, NULL);
|
||||
USE(base, cairo_pattern_add_color_stop_rgba, NULL);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj,
|
||||
Ector_Renderer_Cairo_Gradient_Linear_Data *pd)
|
||||
{
|
||||
Eo *parent;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
eo_data_xunref(parent, pd->parent, obj);
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
eo_data_xunref(base->surface, pd->parent, obj);
|
||||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, eo_destructor());
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
_ector_renderer_cairo_gradient_linear_efl_gfx_gradient_base_stop_set(Eo *obj,
|
||||
Ector_Renderer_Cairo_Gradient_Linear_Data *pd EINA_UNUSED,
|
||||
const Efl_Gfx_Gradient_Stop *colors,
|
||||
|
|
|
@ -8,6 +8,7 @@ class Ector.Renderer.Cairo.Gradient_Linear (Ector.Renderer.Cairo.Base, Ector.Ren
|
|||
Ector.Renderer.Generic.Base.bounds_get;
|
||||
Ector.Renderer.Generic.Base.crc.get;
|
||||
Ector.Renderer.Cairo.Base.fill;
|
||||
Eo.Base.finalize;
|
||||
Eo.Base.destructor;
|
||||
Efl.Gfx.Gradient.Base.stop.set;
|
||||
}
|
||||
|
|
|
@ -38,33 +38,29 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_prepare(Eo *ob
|
|||
|
||||
if (!pd->parent)
|
||||
{
|
||||
Eo *parent;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
if (!parent) return EINA_FALSE;
|
||||
pd->parent = eo_data_xref(parent, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
pd->parent = eo_data_xref(base->surface, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static cairo_pattern_t *
|
||||
_ector_renderer_cairo_gradient_radial_prepare(Eo *obj,
|
||||
_ector_renderer_cairo_gradient_radial_prepare(Eo *obj EINA_UNUSED,
|
||||
Ector_Renderer_Generic_Gradient_Radial_Data *grd,
|
||||
Ector_Renderer_Generic_Gradient_Data *gd,
|
||||
unsigned int mul_col)
|
||||
{
|
||||
cairo_pattern_t *pat;
|
||||
|
||||
USE(obj, cairo_pattern_create_radial, NULL);
|
||||
|
||||
pat = cairo_pattern_create_radial(grd->focal.x, grd->focal.y, 0,
|
||||
grd->radial.x, grd->radial.y, grd->radius);
|
||||
if (!pat) return NULL;
|
||||
|
||||
_ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col);
|
||||
_ector_renderer_cairo_gradient_prepare(pat, gd, mul_col);
|
||||
|
||||
USE(obj, cairo_pattern_set_extend, NULL);
|
||||
cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s));
|
||||
|
||||
return pat;
|
||||
|
@ -72,7 +68,7 @@ _ector_renderer_cairo_gradient_radial_prepare(Eo *obj,
|
|||
|
||||
// Clearly duplicated and should be in a common place...
|
||||
static Eina_Bool
|
||||
_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
|
||||
_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Efl_Gfx_Render_Op op, Eina_Array *clips, unsigned int mul_col)
|
||||
{
|
||||
Ector_Renderer_Generic_Gradient_Radial_Data *grd;
|
||||
Ector_Renderer_Generic_Gradient_Data *gd;
|
||||
|
@ -88,11 +84,6 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj,
|
|||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, mul_col));
|
||||
|
||||
USE(obj, cairo_arc, EINA_FALSE);
|
||||
USE(obj, cairo_fill, EINA_FALSE);
|
||||
USE(obj, cairo_set_source, EINA_FALSE);
|
||||
USE(obj, cairo_pattern_destroy, EINA_FALSE);
|
||||
|
||||
cairo_arc(pd->parent->cairo,
|
||||
grd->radial.x, grd->radial.y,
|
||||
grd->radius,
|
||||
|
@ -121,9 +112,6 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_cairo_base_fill(Eo *obj,
|
|||
pat = _ector_renderer_cairo_gradient_radial_prepare(obj, grd, gd, mul_col);
|
||||
if (!pat) return EINA_FALSE;
|
||||
|
||||
USE(obj, cairo_set_source, EINA_FALSE);
|
||||
USE(obj, cairo_pattern_destroy, EINA_FALSE);
|
||||
|
||||
cairo_set_source(pd->parent->cairo, pat);
|
||||
cairo_pattern_destroy(pat);
|
||||
|
||||
|
@ -146,19 +134,41 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_bounds_get(Eo
|
|||
gld->radius * 2, gld->radius * 2);
|
||||
}
|
||||
|
||||
void
|
||||
static Eo_Base *
|
||||
_ector_renderer_cairo_gradient_radial_eo_base_finalize(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, obj = eo_finalize());
|
||||
if (!obj) return NULL;
|
||||
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
|
||||
USE(base, cairo_set_source, NULL);
|
||||
USE(base, cairo_pattern_destroy, NULL);
|
||||
USE(base, cairo_arc, NULL);
|
||||
USE(base, cairo_fill, NULL);
|
||||
USE(base, cairo_set_source, NULL);
|
||||
USE(base, cairo_pattern_destroy, NULL);
|
||||
USE(base, cairo_pattern_set_extend, NULL);
|
||||
USE(base, cairo_pattern_create_radial, NULL);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj,
|
||||
Ector_Renderer_Cairo_Gradient_Radial_Data *pd)
|
||||
{
|
||||
Eo *parent;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
eo_data_xunref(parent, pd->parent, obj);
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
eo_data_xunref(base->surface, pd->parent, obj);
|
||||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, eo_destructor());
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
_ector_renderer_cairo_gradient_radial_efl_gfx_gradient_base_stop_set(Eo *obj,
|
||||
Ector_Renderer_Cairo_Gradient_Radial_Data *pd EINA_UNUSED,
|
||||
const Efl_Gfx_Gradient_Stop *colors,
|
||||
|
|
|
@ -9,6 +9,7 @@ class Ector.Renderer.Cairo.Gradient_Radial (Ector.Renderer.Cairo.Base, Ector.Ren
|
|||
Ector.Renderer.Generic.Base.crc.get;
|
||||
Ector.Renderer.Cairo.Base.fill;
|
||||
Eo.Base.destructor;
|
||||
Eo.Base.finalize;
|
||||
Efl.Gfx.Gradient.Base.stop.set;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@ typedef enum _cairo_line_join {
|
|||
CAIRO_LINE_JOIN_BEVEL
|
||||
} cairo_line_join_t;
|
||||
|
||||
typedef enum _cairo_fill_rule {
|
||||
CAIRO_FILL_RULE_WINDING,
|
||||
CAIRO_FILL_RULE_EVEN_ODD
|
||||
} cairo_fill_rule_t;
|
||||
|
||||
static void (*cairo_move_to)(cairo_t *cr, double x, double y) = NULL;
|
||||
static void (*cairo_line_to)(cairo_t *cr, double x, double y) = NULL;
|
||||
static void (*cairo_curve_to)(cairo_t *cr,
|
||||
|
@ -56,23 +61,25 @@ static void (*cairo_save)(cairo_t *cr) = NULL;
|
|||
static void (*cairo_restore)(cairo_t *cr) = NULL;
|
||||
|
||||
static void (*cairo_set_dash) (cairo_t *cr, const double *dashes, int num_dashes, double offset) = NULL;
|
||||
static void (*cairo_set_fill_rule) (cairo_t *cr, cairo_fill_rule_t fill_rule);
|
||||
|
||||
typedef struct _Ector_Renderer_Cairo_Shape_Data Ector_Renderer_Cairo_Shape_Data;
|
||||
struct _Ector_Renderer_Cairo_Shape_Data
|
||||
{
|
||||
Efl_Gfx_Shape_Public *public_shape;
|
||||
|
||||
Ector_Cairo_Surface_Data *parent;
|
||||
Ector_Renderer_Generic_Shape_Data *shape;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
cairo_path_t *path;
|
||||
};
|
||||
|
||||
static Eina_Bool
|
||||
_ector_renderer_cairo_shape_path_changed(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
_ector_renderer_cairo_shape_path_changed(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Ector_Renderer_Cairo_Shape_Data *pd = data;
|
||||
|
||||
USE(obj, cairo_path_destroy, EINA_TRUE);
|
||||
|
||||
if (pd->path) cairo_path_destroy(pd->path);
|
||||
pd->path = NULL;
|
||||
|
||||
|
@ -97,19 +104,15 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
|
|||
// shouldn't that be moved to the cairo base object
|
||||
if (!pd->parent)
|
||||
{
|
||||
Eo *parent;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
if (!parent) return EINA_FALSE;
|
||||
pd->parent = eo_data_xref(parent, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
if (!pd->parent) return EINA_FALSE;
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
pd->parent = eo_data_xref(base->surface, ECTOR_CAIRO_SURFACE_CLASS, obj);
|
||||
}
|
||||
|
||||
eo_do(obj, efl_gfx_shape_path_get(&cmds, &pts));
|
||||
if (!pd->path && cmds)
|
||||
{
|
||||
USE(obj, cairo_new_path, EINA_FALSE);
|
||||
|
||||
cairo_new_path(pd->parent->cairo);
|
||||
|
||||
for (; *cmds != EFL_GFX_PATH_COMMAND_TYPE_END; cmds++)
|
||||
|
@ -117,34 +120,24 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
|
|||
switch (*cmds)
|
||||
{
|
||||
case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO:
|
||||
USE(obj, cairo_move_to, EINA_FALSE);
|
||||
|
||||
cairo_move_to(pd->parent->cairo, pts[0], pts[1]);
|
||||
|
||||
pts += 2;
|
||||
break;
|
||||
case EFL_GFX_PATH_COMMAND_TYPE_LINE_TO:
|
||||
USE(obj, cairo_line_to, EINA_FALSE);
|
||||
|
||||
cairo_line_to(pd->parent->cairo, pts[0], pts[1]);
|
||||
|
||||
pts += 2;
|
||||
break;
|
||||
case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO:
|
||||
USE(obj, cairo_curve_to, EINA_FALSE);
|
||||
|
||||
// Be careful, we do have a different order than
|
||||
// cairo, first is destination point, followed by
|
||||
// the control point. The opposite of cairo.
|
||||
cairo_curve_to(pd->parent->cairo,
|
||||
pts[2], pts[3], pts[4], pts[5], // control points
|
||||
pts[0], pts[1]); // destination point
|
||||
pts[0], pts[1], pts[2], pts[3], // control points
|
||||
pts[4], pts[5]); // destination point
|
||||
|
||||
pts += 6;
|
||||
break;
|
||||
case EFL_GFX_PATH_COMMAND_TYPE_CLOSE:
|
||||
USE(obj, cairo_close_path, EINA_FALSE);
|
||||
|
||||
cairo_close_path(pd->parent->cairo);
|
||||
break;
|
||||
case EFL_GFX_PATH_COMMAND_TYPE_LAST:
|
||||
|
@ -153,8 +146,6 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
|
|||
}
|
||||
}
|
||||
|
||||
USE(obj, cairo_copy_path, EINA_FALSE);
|
||||
|
||||
pd->path = cairo_copy_path(pd->parent->cairo);
|
||||
}
|
||||
|
||||
|
@ -162,78 +153,70 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
|
||||
_ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd, Efl_Gfx_Render_Op op, Eina_Array *clips, unsigned int mul_col)
|
||||
{
|
||||
int r, g, b, a;
|
||||
unsigned i;
|
||||
Efl_Gfx_Fill_Rule fill_rule;
|
||||
|
||||
if (pd->path == NULL) return EINA_FALSE;
|
||||
|
||||
USE(obj, cairo_save, EINA_FALSE);
|
||||
cairo_save(pd->parent->cairo);
|
||||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, ector_renderer_draw(op, clips, mul_col));
|
||||
|
||||
USE(obj, cairo_new_path, EINA_FALSE);
|
||||
USE(obj, cairo_append_path, EINA_FALSE);
|
||||
|
||||
cairo_new_path(pd->parent->cairo);
|
||||
cairo_append_path(pd->parent->cairo, pd->path);
|
||||
|
||||
eo_do(obj, fill_rule = efl_gfx_shape_fill_rule_get());
|
||||
if (fill_rule == EFL_GFX_FILL_RULE_ODD_EVEN)
|
||||
cairo_set_fill_rule(pd->parent->cairo, CAIRO_FILL_RULE_EVEN_ODD);
|
||||
else
|
||||
cairo_set_fill_rule(pd->parent->cairo, CAIRO_FILL_RULE_WINDING);
|
||||
|
||||
if (pd->shape->fill)
|
||||
eo_do(pd->shape->fill, ector_renderer_cairo_base_fill(mul_col));
|
||||
|
||||
if (pd->shape->stroke.fill || pd->shape->stroke.color.a > 0)
|
||||
if (pd->shape->stroke.fill || pd->public_shape->stroke.color.a > 0)
|
||||
{
|
||||
USE(obj, cairo_fill_preserve, EINA_FALSE);
|
||||
USE(obj, cairo_set_source_rgba, EINA_FALSE);
|
||||
USE(obj, cairo_stroke, EINA_FALSE);
|
||||
USE(obj, cairo_set_line_width, EINA_FALSE);
|
||||
USE(obj, cairo_set_line_cap, EINA_FALSE);
|
||||
USE(obj, cairo_set_line_join, EINA_FALSE);
|
||||
|
||||
cairo_fill_preserve(pd->parent->cairo);
|
||||
|
||||
if (pd->shape->stroke.fill)
|
||||
eo_do(pd->shape->stroke.fill, ector_renderer_cairo_base_fill(mul_col));
|
||||
else
|
||||
{
|
||||
r = (((pd->shape->stroke.color.r * R_VAL(&mul_col)) + 0xff) >> 8);
|
||||
g = (((pd->shape->stroke.color.g * G_VAL(&mul_col)) + 0xff) >> 8);
|
||||
b = (((pd->shape->stroke.color.b * B_VAL(&mul_col)) + 0xff) >> 8);
|
||||
a = (((pd->shape->stroke.color.a * A_VAL(&mul_col)) + 0xff) >> 8);
|
||||
r = (((pd->public_shape->stroke.color.r * R_VAL(&mul_col)) + 0xff) >> 8);
|
||||
g = (((pd->public_shape->stroke.color.g * G_VAL(&mul_col)) + 0xff) >> 8);
|
||||
b = (((pd->public_shape->stroke.color.b * B_VAL(&mul_col)) + 0xff) >> 8);
|
||||
a = (((pd->public_shape->stroke.color.a * A_VAL(&mul_col)) + 0xff) >> 8);
|
||||
ector_color_argb_unpremul(a, &r, &g, &b);
|
||||
cairo_set_source_rgba(pd->parent->cairo, r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
if (pd->shape->stroke.dash)
|
||||
if (pd->public_shape->stroke.dash)
|
||||
{
|
||||
double *dashinfo;
|
||||
|
||||
USE(obj, cairo_set_dash, EINA_FALSE);
|
||||
|
||||
dashinfo = (double *) malloc(2 * pd->shape->stroke.dash_length * sizeof(double));
|
||||
for (i = 0; i < pd->shape->stroke.dash_length; i++)
|
||||
dashinfo = (double *) malloc(2 * pd->public_shape->stroke.dash_length * sizeof(double));
|
||||
for (i = 0; i < pd->public_shape->stroke.dash_length; i++)
|
||||
{
|
||||
dashinfo[i*2] = pd->shape->stroke.dash[i].length;
|
||||
dashinfo[i*2 + 1] = pd->shape->stroke.dash[i].gap;
|
||||
dashinfo[i*2] = pd->public_shape->stroke.dash[i].length;
|
||||
dashinfo[i*2 + 1] = pd->public_shape->stroke.dash[i].gap;
|
||||
}
|
||||
cairo_set_dash(pd->parent->cairo, dashinfo, pd->shape->stroke.dash_length * 2, 0);
|
||||
cairo_set_dash(pd->parent->cairo, dashinfo, pd->public_shape->stroke.dash_length * 2, 0);
|
||||
free(dashinfo);
|
||||
}
|
||||
}
|
||||
|
||||
// Set dash, cap and join
|
||||
cairo_set_line_width(pd->parent->cairo, (pd->shape->stroke.width * pd->shape->stroke.scale * 2));
|
||||
cairo_set_line_cap(pd->parent->cairo, (cairo_line_cap_t) pd->shape->stroke.cap);
|
||||
cairo_set_line_join(pd->parent->cairo, (cairo_line_join_t) pd->shape->stroke.join);
|
||||
cairo_set_line_width(pd->parent->cairo, (pd->public_shape->stroke.width * pd->public_shape->stroke.scale * 2));
|
||||
cairo_set_line_cap(pd->parent->cairo, (cairo_line_cap_t) pd->public_shape->stroke.cap);
|
||||
cairo_set_line_join(pd->parent->cairo, (cairo_line_join_t) pd->public_shape->stroke.join);
|
||||
cairo_stroke(pd->parent->cairo);
|
||||
}
|
||||
else
|
||||
{
|
||||
USE(obj, cairo_fill, EINA_FALSE);
|
||||
cairo_fill(pd->parent->cairo);
|
||||
}
|
||||
|
||||
USE(obj, cairo_restore, EINA_FALSE);
|
||||
cairo_restore(pd->parent->cairo);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -267,33 +250,66 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_bounds_get(Eo *obj,
|
|||
Eo *
|
||||
_ector_renderer_cairo_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd)
|
||||
{
|
||||
obj = eo_do_super_ret(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj, eo_constructor());
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj = eo_constructor());
|
||||
|
||||
if (!obj) return NULL;
|
||||
|
||||
pd->public_shape = eo_data_xref(obj, EFL_GFX_SHAPE_MIXIN, obj);
|
||||
pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj);
|
||||
pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
|
||||
|
||||
eo_do(obj,
|
||||
eo_event_callback_add(EFL_GFX_PATH_CHANGED, _ector_renderer_cairo_shape_path_changed, pd));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static Eo_Base *
|
||||
_ector_renderer_cairo_shape_eo_base_finalize(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd)
|
||||
{
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj = eo_finalize());
|
||||
if (!obj) return NULL;
|
||||
|
||||
USE(pd->base, cairo_path_destroy, NULL);
|
||||
USE(pd->base, cairo_restore, NULL);
|
||||
USE(pd->base, cairo_fill, NULL);
|
||||
USE(pd->base, cairo_set_dash, NULL);
|
||||
USE(pd->base, cairo_fill_preserve, NULL);
|
||||
USE(pd->base, cairo_set_source_rgba, NULL);
|
||||
USE(pd->base, cairo_stroke, NULL);
|
||||
USE(pd->base, cairo_set_line_width, NULL);
|
||||
USE(pd->base, cairo_set_line_cap, NULL);
|
||||
USE(pd->base, cairo_set_line_join, NULL);
|
||||
USE(pd->base, cairo_new_path, NULL);
|
||||
USE(pd->base, cairo_append_path, NULL);
|
||||
USE(pd->base, cairo_save, NULL);
|
||||
USE(pd->base, cairo_copy_path, NULL);
|
||||
USE(pd->base, cairo_close_path, NULL);
|
||||
USE(pd->base, cairo_curve_to, NULL);
|
||||
USE(pd->base, cairo_line_to, NULL);
|
||||
USE(pd->base, cairo_move_to, NULL);
|
||||
USE(pd->base, cairo_set_fill_rule, NULL);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
void
|
||||
_ector_renderer_cairo_shape_eo_base_destructor(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd)
|
||||
{
|
||||
Eo *parent;
|
||||
Ector_Renderer_Generic_Base_Data *base;
|
||||
|
||||
//FIXME, As base class destructor can't call destructor of mixin class.
|
||||
// call explicit API to free shape data.
|
||||
eo_do(obj, efl_gfx_shape_reset());
|
||||
|
||||
eo_do(obj, parent = eo_parent_get());
|
||||
eo_data_xunref(parent, pd->parent, obj);
|
||||
base = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS);
|
||||
eo_data_xunref(base->surface, pd->parent, obj);
|
||||
|
||||
eo_data_xunref(obj, pd->shape, obj);
|
||||
eo_data_xunref(obj, pd->base, obj);
|
||||
|
||||
eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, eo_destructor());
|
||||
|
||||
USE(obj, cairo_path_destroy, );
|
||||
if (pd->path) cairo_path_destroy(pd->path);
|
||||
}
|
||||
|
||||
|
@ -307,17 +323,17 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_crc_get(Eo *obj,
|
|||
crc = ector_renderer_crc_get());
|
||||
|
||||
crc = eina_crc((void*) &pd->shape->stroke.marker, sizeof (pd->shape->stroke.marker), crc, EINA_FALSE);
|
||||
crc = eina_crc((void*) &pd->shape->stroke.scale, sizeof (pd->shape->stroke.scale) * 3, crc, EINA_FALSE); // scale, width, centered
|
||||
crc = eina_crc((void*) &pd->shape->stroke.color, sizeof (pd->shape->stroke.color), crc, EINA_FALSE);
|
||||
crc = eina_crc((void*) &pd->shape->stroke.cap, sizeof (pd->shape->stroke.cap), crc, EINA_FALSE);
|
||||
crc = eina_crc((void*) &pd->shape->stroke.join, sizeof (pd->shape->stroke.join), crc, EINA_FALSE);
|
||||
crc = eina_crc((void*) &pd->public_shape->stroke.scale, sizeof (pd->public_shape->stroke.scale) * 3, crc, EINA_FALSE); // scale, width, centered
|
||||
crc = eina_crc((void*) &pd->public_shape->stroke.color, sizeof (pd->public_shape->stroke.color), crc, EINA_FALSE);
|
||||
crc = eina_crc((void*) &pd->public_shape->stroke.cap, sizeof (pd->public_shape->stroke.cap), crc, EINA_FALSE);
|
||||
crc = eina_crc((void*) &pd->public_shape->stroke.join, sizeof (pd->public_shape->stroke.join), crc, EINA_FALSE);
|
||||
|
||||
if (pd->shape->fill) crc = _renderer_crc_get(pd->shape->fill, crc);
|
||||
if (pd->shape->stroke.fill) crc = _renderer_crc_get(pd->shape->stroke.fill, crc);
|
||||
if (pd->shape->stroke.marker) crc = _renderer_crc_get(pd->shape->stroke.marker, crc);
|
||||
if (pd->shape->stroke.dash_length)
|
||||
if (pd->public_shape->stroke.dash_length)
|
||||
{
|
||||
crc = eina_crc((void*) pd->shape->stroke.dash, sizeof (Efl_Gfx_Dash) * pd->shape->stroke.dash_length, crc, EINA_FALSE);
|
||||
crc = eina_crc((void*) pd->public_shape->stroke.dash, sizeof (Efl_Gfx_Dash) * pd->public_shape->stroke.dash_length, crc, EINA_FALSE);
|
||||
}
|
||||
|
||||
return crc;
|
||||
|
|
|
@ -9,6 +9,7 @@ class Ector.Renderer.Cairo.Shape (Ector.Renderer.Cairo.Base, Ector.Renderer.Gene
|
|||
Ector.Renderer.Generic.Base.crc.get;
|
||||
Ector.Renderer.Cairo.Base.fill;
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.finalize;
|
||||
Eo.Base.destructor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef ECTOR_BUFFER_H
|
||||
#define ECTOR_BUFFER_H
|
||||
|
||||
#include <Ector.h>
|
||||
|
||||
#include "ector_generic_buffer.eo.h"
|
||||
#include "software/ector_software_buffer_base.eo.h"
|
||||
|
||||
typedef struct _Ector_Generic_Buffer_Data
|
||||
{
|
||||
Eo *eo;
|
||||
unsigned int w, h;
|
||||
unsigned char l, r, t, b;
|
||||
Efl_Gfx_Colorspace cspace;
|
||||
} Ector_Generic_Buffer_Data;
|
||||
|
||||
typedef struct _Ector_Software_Buffer_Base_Data
|
||||
{
|
||||
Ector_Generic_Buffer_Data *generic; /* ugly */
|
||||
union {
|
||||
unsigned int *u32;
|
||||
unsigned char *u8;
|
||||
} pixels;
|
||||
unsigned int stride;
|
||||
unsigned int pixel_size; // in bytes
|
||||
unsigned int map_count;
|
||||
Eina_Bool writable : 1;
|
||||
Eina_Bool nofree : 1; // pixel data should not be free()'ed
|
||||
Eina_Bool span_free : 1;
|
||||
} Ector_Software_Buffer_Base_Data;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,40 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#else
|
||||
# define EFL_BETA_API_SUPPORT
|
||||
#endif
|
||||
|
||||
#include <Eo.h>
|
||||
#include "ector_private.h"
|
||||
#include "ector_generic_buffer.eo.h"
|
||||
|
||||
EOLIAN static Efl_Gfx_Colorspace
|
||||
_ector_generic_buffer_cspace_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd)
|
||||
{
|
||||
return pd->cspace;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_ector_generic_buffer_border_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd EINA_UNUSED, int *l, int *r, int *t, int *b)
|
||||
{
|
||||
if (l) *l = pd->l;
|
||||
if (r) *r = pd->r;
|
||||
if (t) *t = pd->t;
|
||||
if (b) *b = pd->b;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_ector_generic_buffer_size_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd, int *w, int *h)
|
||||
{
|
||||
if (w) *w = pd->w;
|
||||
if (h) *h = pd->h;
|
||||
}
|
||||
|
||||
EOLIAN static Ector_Buffer_Flag
|
||||
_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return ECTOR_BUFFER_FLAG_NONE;
|
||||
}
|
||||
|
||||
#include "ector_generic_buffer.eo.c"
|
||||
#include "ector_generic_surface.eo.c"
|
|
@ -0,0 +1,131 @@
|
|||
enum Ector.Buffer.Flag {
|
||||
none = 0x00, [[Buffer may not have any backing]]
|
||||
cpu_readable = 0x01, [[Can be read from the CPU after map. Reading may still be very slow.]]
|
||||
cpu_writable = 0x02, [[Can be written to by the CPU after map. Writing may still be very slow.]]
|
||||
renderable = 0x04, [[Can be rendered to, ie CPU memory for SW rendering, or an FBO for GL engine]]
|
||||
cpu_readable_fast = 0x08, [[Can be read by the CPU at high speed, ie no need for glReadPixels]]
|
||||
cpu_writable_fast = 0x0A, [[Can be written by the CPU at high speed, ie no need for GPU texture upload]]
|
||||
uncached = 0x10, [[Backed by uncached memory, ie. slow-ish reads but faster than glReadPixels]]
|
||||
/* non_coherent = 0x20, [[Memory may be mapped but will not be coherent between GPU and CPU. Call flush or invalidate to synchronize it.]] */
|
||||
}
|
||||
|
||||
enum Ector.Buffer.Access_Flag {
|
||||
none = 0x0,
|
||||
read = 0x1,
|
||||
write = 0x2,
|
||||
}
|
||||
|
||||
mixin Ector.Generic.Buffer
|
||||
{
|
||||
[[2D pixel buffer interface for Ector
|
||||
@since 1.17
|
||||
]]
|
||||
eo_prefix: ector_buffer;
|
||||
legacy_prefix: null;
|
||||
methods {
|
||||
@property size {
|
||||
get {
|
||||
[[Retrieves the (rectangular) size of the pixel buffer.]]
|
||||
}
|
||||
values {
|
||||
w: int;
|
||||
h: int;
|
||||
}
|
||||
}
|
||||
@property cspace {
|
||||
get {}
|
||||
values {
|
||||
cspace: Efl.Gfx.Colorspace;
|
||||
}
|
||||
}
|
||||
map {
|
||||
[[Map a region of this buffer for read or write access by the CPU,
|
||||
fetch data from the GPU if needed.
|
||||
]]
|
||||
params {
|
||||
@out offset: int; [[Byte offset to the first requested pixel]]
|
||||
@out length: uint; [[Accessible buffer size in bytes]]
|
||||
@in mode: Ector.Buffer.Access_Flag;
|
||||
@in x: uint;
|
||||
@in y: uint;
|
||||
@in w: uint; [[If 0, defaults to the buffer width]]
|
||||
@in h: uint; [[If 0, defaults to the buffer height]]
|
||||
@in cspace: Efl.Gfx.Colorspace; [[Requested colorspace. If difference from the internal cspace, map may either fail or convert slowly]]
|
||||
@out stride: uint; [[Optional]]
|
||||
}
|
||||
return: uint8* @warn_unused; [[Top-left pixel is at offset bytes after this address. Returns $null in case of failure]]
|
||||
}
|
||||
unmap {
|
||||
[[Unmap a region of this buffer, and upload data to the GPU (if needed).]]
|
||||
params {
|
||||
@in data: void*; [[Data pointer returned by a previous call to map]]
|
||||
@in offset: int;
|
||||
@in length: uint;
|
||||
}
|
||||
}
|
||||
pixels_set {
|
||||
[[Set the source pixels for this buffer, or allocate a new memory region]]
|
||||
params {
|
||||
@in pixels: void*; [[If $null, allocates an empty buffer]]
|
||||
@in width: int;
|
||||
@in height: int;
|
||||
@in stride: int; [[Can be 0]]
|
||||
@in cspace: Efl.Gfx.Colorspace;
|
||||
@in writable: bool;
|
||||
@in l: ubyte; [[Left border pixels, usually 0 or 1]]
|
||||
@in r: ubyte; [[Right border pixels, usually 0 or 1]]
|
||||
@in t: ubyte; [[Top border pixels, usually 0 or 1]]
|
||||
@in b: ubyte; [[Bottom border pixels, usually 0 or 1]]
|
||||
}
|
||||
return: bool;
|
||||
}
|
||||
span_get {
|
||||
[[Get a single horizontal span of length w starting from (x,y)
|
||||
|
||||
Call span_free() to release it. This function will try not to
|
||||
allocate any new buffer, whenever possible. This means the data
|
||||
might be mapped directly from the backing memory buffer.
|
||||
]]
|
||||
params {
|
||||
@in x: int; [[Ranges from -l to w+r-1]]
|
||||
@in y: int; [[Ranges from -t to h+b-1]]
|
||||
@in w: uint; [[Ranges from 1 to w+l+r]]
|
||||
@in cspace: Efl.Gfx.Colorspace; [[Requested colorspace, may trigger conversion on the fly.]]
|
||||
@out length: uint; [[Length in bytes of the returned buffer]]
|
||||
}
|
||||
return: uint8*; [[A temporary memory buffer containing the pixels requested.]]
|
||||
}
|
||||
span_free {
|
||||
[[Must be called as soon as possible after span_get]]
|
||||
params {
|
||||
data: uint8*;
|
||||
}
|
||||
}
|
||||
@property flags {
|
||||
get { [[Get the capabilities of this buffer]] }
|
||||
values {
|
||||
flag: Ector.Buffer.Flag; [[A bitmask of capability flags]]
|
||||
}
|
||||
}
|
||||
@property border {
|
||||
[[Duplicated pixel borders of this buffer, used for GL scaling]]
|
||||
get {}
|
||||
values {
|
||||
l: int;
|
||||
r: int;
|
||||
t: int;
|
||||
b: int;
|
||||
}
|
||||
}
|
||||
}
|
||||
events {
|
||||
detached; [[Emitted whenever the previously attached pixels are detached during pixels_set]]
|
||||
}
|
||||
implements {
|
||||
@virtual .pixels_set;
|
||||
@virtual .span_get;
|
||||
@virtual .span_free;
|
||||
@virtual .map;
|
||||
@virtual .unmap;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue