Compare commits
555 Commits
temp-keyma
...
ui_layout_
Author | SHA1 | Date | |
---|---|---|---|
8ae25e307e | |||
ec8a20fec0 | |||
5159ce640f | |||
4319e9499e | |||
5979ea96a5 | |||
2b83d81f68 | |||
70f8eaf1b7 | |||
638de72277 | |||
2ca8230f67 | |||
fb565ddb68 | |||
56a47e58f4 | |||
09ce794dc8 | |||
8f40af6dcd | |||
964c5421df | |||
9bcced83ee | |||
3bbef95747 | |||
337aab59e9 | |||
a1b42b79b3 | |||
7ce81484f8 | |||
6f4c7f1f01 | |||
b492a0e767 | |||
f3427cbc98 | |||
03f0ecca93 | |||
86660aa294 | |||
dd2e187344 | |||
528dc6440b | |||
5165d62931 | |||
d1ab958fd4 | |||
4f2eac3b39 | |||
bf77efb684 | |||
1857823839 | |||
2dc7555522 | |||
![]() |
f8d7df6f16 | ||
f2fd5987d0 | |||
3e86bb2d0b | |||
1ce55693f5 | |||
![]() |
9d59d20957 | ||
0417f205f5 | |||
![]() |
f638ad61b8 | ||
![]() |
856a79e1fb | ||
cbbf8bbbb4 | |||
![]() |
fc85096dc8 | ||
4df45e18dc | |||
249a41bc7c | |||
ba31c4d684 | |||
2a771cbc58 | |||
335e030753 | |||
934b9e80d0 | |||
06357b23a2 | |||
9f2447cbd8 | |||
70b3fb3781 | |||
6739bb195e | |||
540e85d567 | |||
0dd9a9e66a | |||
f504306671 | |||
97e7d9f90b | |||
d97df0d0e6 | |||
4127aeb7a5 | |||
e36ecb8a66 | |||
94aa4d1657 | |||
ae3e59fb61 | |||
aff6cc9cf1 | |||
fb1915d870 | |||
33437719c1 | |||
0c7fc3a961 | |||
7b6af843c2 | |||
c5904574cb | |||
3926ec6aa1 | |||
1f1e26f1ab | |||
d38c7db5e1 | |||
4017b48331 | |||
378e42e119 | |||
9600c7cb05 | |||
691282e571 | |||
55606dbdbc | |||
346a1d445e | |||
0297274720 | |||
dff8a7db73 | |||
b3c8ffcb3e | |||
4d16d00154 | |||
3d681108bf | |||
20367898fe | |||
e3fe8ce00b | |||
908b6960c0 | |||
a25c11fd8d | |||
d352a0adc5 | |||
009c38df53 | |||
8b5ce6e843 | |||
30cd35a37b | |||
cfc4805455 | |||
8f49299134 | |||
cfc1ddeff7 | |||
![]() |
18e316bcb9 | ||
![]() |
57da454872 | ||
![]() |
1962ae69b1 | ||
![]() |
56f2293a51 | ||
![]() |
e5bc37eb5e | ||
![]() |
d17094b256 | ||
![]() |
85e2871382 | ||
d32b59fc18 | |||
630019d5f8 | |||
28817c82f1 | |||
9a873d0ab2 | |||
5852c66125 | |||
20d3ce57d0 | |||
ef7b7efd11 | |||
3b556a477d | |||
5593baea1b | |||
0859492c75 | |||
a3773dcc4f | |||
80dcb2ced8 | |||
00233f5f78 | |||
f9ca750bdf | |||
3823287179 | |||
d274c64d22 | |||
8dc33a81b0 | |||
df4525d1d9 | |||
f0815b1322 | |||
863e395ad8 | |||
fcc5d7c29e | |||
64e0ab6a00 | |||
86aaa3efba | |||
e19686a35a | |||
819ad49d29 | |||
1e4722eeab | |||
8a2db3ed21 | |||
d9d3e7778c | |||
a3f520170c | |||
6242940639 | |||
a16d835f7b | |||
8366c3ecd8 | |||
30ec94561c | |||
da8d33e2e3 | |||
5330f1c5d1 | |||
c63f804222 | |||
508e34d0bf | |||
4e014727f6 | |||
![]() |
3126f85d26 | ||
b3a7a75a26 | |||
d1474371fa | |||
a867e63dd6 | |||
cdbda1c3d8 | |||
366ac88d68 | |||
16017178b2 | |||
a54235e0c6 | |||
613faa0987 | |||
72cfd5134b | |||
1aa89d9a1c | |||
df0253be33 | |||
54f9cd5283 | |||
e27759152a | |||
e43065596b | |||
d88314ee5b | |||
5b0f96f97c | |||
f447411a82 | |||
7fb216d800 | |||
2d2f23de10 | |||
a60d4f33c6 | |||
409cfba1a3 | |||
ba80d8440f | |||
1c4b04f1fd | |||
0e68751b8a | |||
70b705b5fe | |||
4165a57a66 | |||
![]() |
f818ff411a | ||
![]() |
04dfca5b9d | ||
![]() |
4e213d4216 | ||
![]() |
9a0506ea18 | ||
36000e6da3 | |||
c44acc7fb8 | |||
0ee4785675 | |||
bb7202495a | |||
19d651ca9a | |||
d706101559 | |||
bb09556be5 | |||
f55f418867 | |||
f884ba02a2 | |||
de702a4803 | |||
48e871ab1d | |||
fcf720a135 | |||
89042f576e | |||
7fee5f5643 | |||
f1fd5ed74f | |||
4a52531a11 | |||
4c4fa3d49b | |||
3b8ae85e3d | |||
a8ae68aa5c | |||
2088bb0d49 | |||
b58e5d4f2c | |||
1295e85de0 | |||
528cdf9b50 | |||
e3324c3a8e | |||
22370929fe | |||
7810c60fe3 | |||
695747aad1 | |||
5a14af62d0 | |||
82ec06cbfa | |||
ca7de1ff22 | |||
1a0cb28ae2 | |||
180e8f8bfb | |||
9f255db4fe | |||
7a76223f1f | |||
8a0e6a3143 | |||
5e180ebffc | |||
c4ce4034e6 | |||
3e87c039ba | |||
1d86bdf16b | |||
03b8e4f608 | |||
23db3a5ade | |||
783d31c3a3 | |||
abccde4d68 | |||
5f543915e8 | |||
274453ef73 | |||
a9f9236670 | |||
bfbd85e9d6 | |||
ab375079df | |||
6ff89166a8 | |||
52502ad0a4 | |||
14251d4615 | |||
1889eec918 | |||
c1a880bc5e | |||
3c9e2e82fa | |||
851829c1fb | |||
e394a78b4c | |||
d5ce40a5ed | |||
713027b832 | |||
983811607d | |||
cd58ce85c2 | |||
5e44324b79 | |||
7ff07ddd01 | |||
1628a6858e | |||
f0d9dbae0d | |||
ce6db959c7 | |||
a9ed50514c | |||
7436fb2ef1 | |||
481cdb08ed | |||
1d97e948d2 | |||
c68429bc03 | |||
d94df18550 | |||
7a612c3799 | |||
60aee3943f | |||
d860d23e1a | |||
2cc6e06bdb | |||
b6d920bbd5 | |||
2891fb645b | |||
24bd483ee1 | |||
09f780c1b0 | |||
6d7327f607 | |||
0d47a4d2fe | |||
df1d319a79 | |||
856d36e4b8 | |||
cb42ad8c75 | |||
cd8613c6e7 | |||
342dd5a771 | |||
a3815f8777 | |||
ade710500d | |||
f1a3b68e76 | |||
b9db470636 | |||
0be9d8db65 | |||
99dd3b0156 | |||
5d628c519b | |||
0941b8b672 | |||
83db7a0070 | |||
1df228a416 | |||
80d86f303a | |||
88b46a6ce9 | |||
![]() |
17e9870221 | ||
6fee105943 | |||
da53c3f020 | |||
58e8c71cbd | |||
f6740993f7 | |||
c8af234f85 | |||
84becb870f | |||
747534af00 | |||
![]() |
2b4d2de253 | ||
ce5e9b599c | |||
784a3ccf79 | |||
101c277e3d | |||
349d416949 | |||
18e8350cd1 | |||
bda0175984 | |||
570804882d | |||
4b5670ac11 | |||
3b4c7a8c9b | |||
0e8edbbc01 | |||
2b22a61152 | |||
52f9023fbf | |||
07f0046203 | |||
1dc31f5b98 | |||
e47e60a9b9 | |||
736a84ec66 | |||
![]() |
acb5bbf9b2 | ||
a46ced5076 | |||
f430f14df4 | |||
7277f8973b | |||
c2ff37455e | |||
95011f6d48 | |||
44505b38df | |||
0911acb5cf | |||
6654e109df | |||
5b64301834 | |||
2d3d76693a | |||
7719c11006 | |||
854db8951b | |||
ba65f7093b | |||
f6743fcaa4 | |||
d7c2b78822 | |||
9b01e7bc27 | |||
d3fe033875 | |||
81dbf08eb4 | |||
38eb91c848 | |||
25ff7a4f2a | |||
06dd89b0ca | |||
beca377c27 | |||
e657a4af13 | |||
4c4eb1ce20 | |||
d0f7ab27a8 | |||
335b193336 | |||
778a19a13a | |||
32c5972653 | |||
38bf3b8d23 | |||
6221180963 | |||
18a4553838 | |||
815b1f24fa | |||
04d9316cf3 | |||
c55e90da4c | |||
2ef695fabf | |||
6c6c4da718 | |||
bc6358a580 | |||
f25e459f8f | |||
98e4d548a1 | |||
119423b252 | |||
8ace49dedc | |||
1de73fc6c3 | |||
08a2c5f224 | |||
4430bd3644 | |||
![]() |
0736460dfb | ||
![]() |
fec317de8d | ||
53c9fbef60 | |||
6de656b4f2 | |||
58efa7d686 | |||
0de0cee9a2 | |||
9cd2e4fa3f | |||
b608133075 | |||
a08a8aa928 | |||
c140f11946 | |||
![]() |
bb8770b976 | ||
8433ed76b2 | |||
d18cd768bb | |||
bfe1d0e0dc | |||
75fc1c3507 | |||
297bf7235b | |||
c0dd355926 | |||
4fccb8a023 | |||
e44743736f | |||
e4a727626e | |||
56dc2bf0c5 | |||
9e09900a30 | |||
![]() |
15e5dbc2c3 | ||
0706b410bd | |||
eef18d39cb | |||
051e186d5c | |||
b3be71e07a | |||
72a360827b | |||
44a8070db3 | |||
06c4106d03 | |||
75b2729488 | |||
50afc430fd | |||
![]() |
27881e9948 | ||
13ca63d2ad | |||
3b05034935 | |||
ddf2a58282 | |||
82b8fd8eaf | |||
32c12d057f | |||
be8016908d | |||
4faf9bfbe9 | |||
b85d5b6d52 | |||
83a41ccd0a | |||
cfdadc7d61 | |||
4eb47c303d | |||
0c18024a8d | |||
c771bbc27e | |||
01c75c3765 | |||
719e782f2c | |||
bcbee4b9a3 | |||
1bc801e020 | |||
14c55a5828 | |||
![]() |
e35dab0fec | ||
0bddf5315f | |||
8f24d404fe | |||
e614a8290c | |||
e8142ad7dc | |||
4683091369 | |||
d5a359b1d4 | |||
c450966e95 | |||
3b2d3a3cd1 | |||
7bdc67f5f3 | |||
fe09aa602a | |||
c338ac9454 | |||
3cefb27830 | |||
266fc1c1ff | |||
5736157b5e | |||
a6395cebb7 | |||
c87cfcc8de | |||
63785a889c | |||
35efa1d3d3 | |||
![]() |
a63b55f642 | ||
![]() |
a4bb1a5881 | ||
995fa1f4c0 | |||
14dee6d7a5 | |||
7c75c2db4f | |||
![]() |
e51cbce646 | ||
bf4ce5755f | |||
712885c30e | |||
f43e3d0b6b | |||
494470ba23 | |||
8789490f96 | |||
71c904433c | |||
2feed9bdef | |||
f71efafe8f | |||
cfea9c261c | |||
df22cd9ce1 | |||
3352dd3a3f | |||
126e6c8e1d | |||
59a516913e | |||
b5b1f9d11c | |||
7a4b0ff358 | |||
d4daf9c00d | |||
cd702db338 | |||
48ea2131aa | |||
cb614107d3 | |||
5a82aee9e6 | |||
8d53e8cd02 | |||
da11e33b26 | |||
361b3eb88e | |||
eb1feb9f4a | |||
0b396bc15b | |||
16100f8261 | |||
b809340960 | |||
b53d358261 | |||
3248ac5e83 | |||
![]() |
25e5ec245c | ||
![]() |
d0af8edcd1 | ||
![]() |
eaad4caa56 | ||
54e92bbd29 | |||
4e96bff938 | |||
f56a9fbad5 | |||
9b4e56c091 | |||
d41bf6b8e8 | |||
46508430f8 | |||
28369f725c | |||
23e375a281 | |||
24b03729ae | |||
9948e26e14 | |||
1e6108e972 | |||
46cfa605c3 | |||
17f458ff32 | |||
24d1829243 | |||
fcfe1963a6 | |||
5cbad89637 | |||
12ab59a2d6 | |||
84a9647f22 | |||
d9324b61d5 | |||
e4afccf388 | |||
e910765ad0 | |||
81bf9a41e1 | |||
![]() |
6c0705009e | ||
fbd614f1fa | |||
16d3f4db4c | |||
264a4a8f97 | |||
84e5c981dc | |||
f5f25b843e | |||
eb0fcd4574 | |||
1f693aefca | |||
61fc9fcffa | |||
0b6603d9b6 | |||
c0f42a7526 | |||
c86437cc83 | |||
cce16df10f | |||
17ce968c59 | |||
08862b8246 | |||
85ce4d957c | |||
9fabe3ef53 | |||
efd0333a9c | |||
1272936773 | |||
7661f8a65b | |||
41fac4fa76 | |||
25d4d43491 | |||
cdfa517760 | |||
23b455a891 | |||
92e3b3839b | |||
10a2562bc5 | |||
f1f1c32849 | |||
![]() |
5b8fe8324b | ||
38957c1838 | |||
5954a5c465 | |||
375c1eab65 | |||
d0d2fc9819 | |||
30fb455977 | |||
35a6d9ec55 | |||
acaf46db0e | |||
29f9a19708 | |||
da16cb1511 | |||
f03953ae06 | |||
ccb7f1d4f1 | |||
26f42a1928 | |||
5c17dbd991 | |||
8ed723745e | |||
292125bfd3 | |||
9c2db1455f | |||
eb24c9a1e1 | |||
03ec3a6141 | |||
48ceeead10 | |||
10c0bba28e | |||
7e8fd563c6 | |||
93de6ca2db | |||
0488b728eb | |||
10f6450ef2 | |||
501c0b1df8 | |||
328f8dc21c | |||
2faef3473c | |||
e0e3038b1e | |||
ec6da3d72e | |||
201952aed2 | |||
3bc0cb08b8 | |||
7b9a0ed8c4 | |||
08d325805f | |||
72f4ac99c7 | |||
e55c1a9b5a | |||
edc1e65809 | |||
6afa0a7a50 | |||
9abbf73d3f | |||
a01244cade | |||
47a8d3b880 | |||
e054b7f251 | |||
01f9e13c30 | |||
d709705203 | |||
301a27187c | |||
b54cc68365 | |||
0ed2e254bb | |||
cb22caa8c7 | |||
18c12803bd | |||
0e0502cbdf | |||
2c03d6a12b | |||
9992079d59 | |||
36e6d44c90 | |||
00dc1c08aa | |||
f8908f0d43 | |||
e9cd2fb23b | |||
341dbce1b7 | |||
c1db8d6983 | |||
ffb515410c | |||
658a7cb46f | |||
51be9ff07a | |||
2de27897f3 |
@@ -523,9 +523,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
-fsanitize=enum \
|
||||
-fsanitize=float-cast-overflow \
|
||||
-fsanitize=float-divide-by-zero \
|
||||
-fsanitize=leak \
|
||||
-fsanitize=nonnull-attribute \
|
||||
-fsanitize=object-size \
|
||||
-fsanitize=returns-nonnull-attribute \
|
||||
-fsanitize=signed-integer-overflow \
|
||||
-fsanitize=undefined \
|
||||
@@ -533,6 +531,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
-fno-sanitize=alignment \
|
||||
")
|
||||
|
||||
if(NOT MSVC) # not all sanitizers are supported with clang-cl, these two however are very vocal about it
|
||||
set(_asan_defaults "${_asan_defaults} -fsanitize=leak -fsanitize=object-size" )
|
||||
endif()
|
||||
set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
|
||||
mark_as_advanced(COMPILER_ASAN_CFLAGS)
|
||||
set(COMPILER_ASAN_CXXFLAGS "${_asan_defaults}" CACHE STRING "C++ flags for address sanitizer")
|
||||
@@ -540,9 +541,15 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
unset(_asan_defaults)
|
||||
|
||||
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
|
||||
if(NOT MSVC)
|
||||
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
|
||||
else()
|
||||
find_library( COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
|
||||
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
|
||||
)
|
||||
endif()
|
||||
mark_as_advanced(COMPILER_ASAN_LIBRARY)
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -810,14 +817,20 @@ set(PLATFORM_LINKLIBS "")
|
||||
set(PLATFORM_LINKFLAGS "")
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "")
|
||||
|
||||
if(WITH_COMPILER_ASAN)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
if(WITH_COMPILER_ASAN)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
|
||||
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
|
||||
if(MSVC)
|
||||
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
|
||||
endif()
|
||||
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
|
||||
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
@@ -39,5 +39,6 @@ if(BUILD_MODE STREQUAL Release)
|
||||
PREFIX ${BUILD_DIR}/openal
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openal ${DEFAULT_CMAKE_FLAGS} ${OPENAL_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/openal
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openal/src/external_openal < ${PATCH_DIR}/openal.diff
|
||||
)
|
||||
endif()
|
||||
|
@@ -56,24 +56,27 @@ if(WIN32)
|
||||
# For OIIO and OSL
|
||||
set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
|
||||
|
||||
# TODO FIXME highly MSVC specific
|
||||
if(WITH_OPTIMIZED_DEBUG)
|
||||
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
else()
|
||||
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
if(MSVC_VERSION GREATER 1909)
|
||||
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
|
||||
endif()
|
||||
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
|
||||
if(WITH_OPTIMIZED_DEBUG)
|
||||
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
else()
|
||||
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
endif()
|
||||
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MT ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
|
||||
if(WITH_OPTIMIZED_DEBUG)
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
else()
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
endif()
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MT /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||
|
||||
set(PLATFORM_FLAGS)
|
||||
set(PLATFORM_CXX_FLAGS)
|
||||
|
13
build_files/build_environment/patches/openal.diff
Normal file
13
build_files/build_environment/patches/openal.diff
Normal file
@@ -0,0 +1,13 @@
|
||||
diff -Naur external_openal_original/CMakeLists.txt external_openal/CMakeLists.txt
|
||||
--- external_openal_original/CMakeLists.txt 2016-01-24 20:12:39 -0700
|
||||
+++ external_openal/CMakeLists.txt 2018-06-02 12:16:52 -0600
|
||||
@@ -885,7 +885,8 @@
|
||||
OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
|
||||
IF(HAVE_WINDOWS_H)
|
||||
# Check MMSystem backend
|
||||
- CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
|
||||
+ set(CMAKE_REQUIRED_FLAGS "-D_WIN32_WINNT=0x0502")
|
||||
+ CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
|
||||
IF(HAVE_MMSYSTEM_H)
|
||||
CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
|
||||
IF(HAVE_LIBWINMM)
|
@@ -10,8 +10,8 @@ diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_o
|
||||
MAIN_DEPENDENCY ${flexsrc}
|
||||
DEPENDS ${${compiler_headers}}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
--- a/src/include/OSL/oslconfig.h 2016-10-31 16:48:19 -0600
|
||||
+++ b/src/include/OSL/oslconfig.h 2018-05-27 11:18:08 -0600
|
||||
--- osl/src/external_osl/src/include/OSL/oslconfig.h 2016-10-31 16:48:19 -0600
|
||||
+++ osl/src/external_osl/src/include/OSL/oslconfig.h 2018-05-27 11:18:08 -0600
|
||||
@@ -44,12 +44,18 @@
|
||||
// same if another packages is compiling against OSL and using these headers
|
||||
// (OSL may be C++11 but the client package may be older, or vice versa --
|
||||
|
@@ -14,10 +14,18 @@ if NOT "%1" == "" (
|
||||
set BuildDir=VS14
|
||||
goto par2
|
||||
)
|
||||
if "%1" == "2017" (
|
||||
echo "Building for VS2017"
|
||||
set VSVER=15.0
|
||||
set VSVER_SHORT=15
|
||||
set BuildDir=VS15
|
||||
goto par2
|
||||
)
|
||||
|
||||
)
|
||||
:usage
|
||||
|
||||
Echo Usage build_deps 2013/2015 x64/x86
|
||||
Echo Usage build_deps 2013/2015/2017 x64/x86
|
||||
goto exit
|
||||
:par2
|
||||
if NOT "%2" == "" (
|
||||
@@ -31,6 +39,10 @@ if NOT "%2" == "" (
|
||||
if "%1" == "2015" (
|
||||
set CMAKE_BUILDER=Visual Studio 14 2015
|
||||
)
|
||||
if "%1" == "2017" (
|
||||
set CMAKE_BUILDER=Visual Studio 15 2017
|
||||
)
|
||||
|
||||
goto start
|
||||
)
|
||||
if "%2" == "x64" (
|
||||
@@ -43,6 +55,10 @@ if NOT "%2" == "" (
|
||||
if "%1" == "2015" (
|
||||
set CMAKE_BUILDER=Visual Studio 14 2015 Win64
|
||||
)
|
||||
if "%1" == "2017" (
|
||||
set CMAKE_BUILDER=Visual Studio 15 2017 Win64
|
||||
)
|
||||
|
||||
goto start
|
||||
)
|
||||
)
|
||||
|
@@ -32,6 +32,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
|
||||
${EXTRA_LIBS}
|
||||
${PLATFORM_LINKLIBS}
|
||||
bf_testing_main
|
||||
bf_intern_eigen
|
||||
bf_intern_guardedalloc
|
||||
extern_gtest
|
||||
extern_gmock
|
||||
|
@@ -352,6 +352,11 @@ function(SETUP_LIBDIRS)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(setup_platform_linker_flags)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
endmacro()
|
||||
|
||||
function(setup_liblinks
|
||||
target
|
||||
)
|
||||
|
@@ -31,7 +31,8 @@ endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(MSVC_CLANG On)
|
||||
set(MSVC_REDIST_DIR $ENV{VCToolsRedistDir})
|
||||
set(VC_TOOLS_DIR $ENV{VCToolsRedistDir} CACHE STRING "Location of the msvc redistributables")
|
||||
set(MSVC_REDIST_DIR ${VC_TOOLS_DIR})
|
||||
if (DEFINED MSVC_REDIST_DIR)
|
||||
file(TO_CMAKE_PATH ${MSVC_REDIST_DIR} MSVC_REDIST_DIR)
|
||||
else()
|
||||
@@ -149,7 +150,7 @@ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
|
||||
|
||||
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
|
||||
|
||||
# Ignore meaningless for us linker warnings.
|
||||
@@ -162,7 +163,7 @@ else()
|
||||
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
|
||||
endif()
|
||||
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
|
||||
|
||||
if(NOT DEFINED LIBDIR)
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS%
|
||||
|
||||
if "%BUILD_ARCH%"=="x64" (
|
||||
set MSBUILD_PLATFORM=x64
|
||||
) else if "%BUILD_ARCH%"=="x86" (
|
||||
@@ -11,8 +9,17 @@ if "%BUILD_ARCH%"=="x64" (
|
||||
)
|
||||
|
||||
if "%WITH_CLANG%"=="1" (
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -T"LLVM-vs2017"
|
||||
set CLANG_CMAKE_ARGS=-T"LLVM-vs2017"
|
||||
if "%WITH_ASAN%"=="1" (
|
||||
set ASAN_CMAKE_ARGS=-DWITH_COMPILER_ASAN=On
|
||||
)
|
||||
) else (
|
||||
if "%WITH_ASAN%"=="1" (
|
||||
echo ASAN is only supported with clang.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS%
|
||||
|
||||
if NOT EXIST %BUILD_DIR%\nul (
|
||||
mkdir %BUILD_DIR%
|
||||
|
@@ -1,3 +1,9 @@
|
||||
ninja --version 1>NUL 2>&1
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo "Ninja not detected in the path"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
|
||||
|
||||
if "%WITH_CLANG%" == "1" (
|
||||
@@ -27,6 +33,16 @@ set LLVM_DIR=
|
||||
rem build and tested against 2017 15.7
|
||||
set CFLAGS=-m64 -fmsc-version=1914
|
||||
set CXXFLAGS=-m64 -fmsc-version=1914
|
||||
if "%WITH_ASAN%"=="1" (
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
|
||||
)
|
||||
)
|
||||
|
||||
if "%WITH_ASAN%"=="1" (
|
||||
if "%WITH_CLANG%" == "" (
|
||||
echo ASAN is only supported with clang.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
if NOT "%verbose%" == "" (
|
||||
|
@@ -12,6 +12,11 @@ if not exist "%vs_where%" (
|
||||
goto FAIL
|
||||
)
|
||||
)
|
||||
|
||||
if NOT "%verbose%" == "" (
|
||||
echo "%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`
|
||||
)
|
||||
|
||||
for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do (
|
||||
if /i "%%i"=="installationPath" set VS_InstallDir=%%j
|
||||
)
|
||||
|
@@ -42,6 +42,8 @@ if NOT "%1" == "" (
|
||||
) else if "%1" == "release" (
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake"
|
||||
set TARGET=Release
|
||||
) else if "%1" == "asan" (
|
||||
set WITH_ASAN=1
|
||||
) else if "%1" == "x86" (
|
||||
set BUILD_ARCH=x86
|
||||
) else if "%1" == "x64" (
|
||||
@@ -51,6 +53,10 @@ if NOT "%1" == "" (
|
||||
) else if "%1" == "2017pre" (
|
||||
set BUILD_VS_YEAR=2017
|
||||
set VSWHERE_ARGS=-prerelease
|
||||
set BUILD_VS_YEAR=2017
|
||||
) else if "%1" == "2017b" (
|
||||
set BUILD_VS_YEAR=2017
|
||||
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
|
||||
) else if "%1" == "2015" (
|
||||
set BUILD_VS_YEAR=2015
|
||||
) else if "%1" == "2013" (
|
||||
|
@@ -21,4 +21,7 @@ set BUILD_UPDATE=
|
||||
set BUILD_SHOW_HASHES=
|
||||
set SHOW_HELP=
|
||||
set BUILD_WITH_NINJA=
|
||||
set WITH_CLANG=
|
||||
set WITH_CLANG=
|
||||
set WITH_ASAN=
|
||||
set CLANG_CMAKE_ARGS=
|
||||
set ASAN_CMAKE_ARGS=
|
||||
|
@@ -23,7 +23,13 @@ echo - buildir [newdir] ^(override default build folder^)
|
||||
echo - x86 ^(override host auto-detect and build 32 bit code^)
|
||||
echo - x64 ^(override host auto-detect and build 64 bit code^)
|
||||
echo - 2013 ^(build with visual studio 2013^)
|
||||
echo - 2015 ^(build with visual studio 2015^) [EXPERIMENTAL]
|
||||
echo - 2017 ^(build with visual studio 2017^) [EXPERIMENTAL]
|
||||
echo - 2017pre ^(build with visual studio 2017 pre-release^) [EXPERIMENTAL]
|
||||
echo.
|
||||
echo Experimental options
|
||||
echo - 2015 ^(build with visual studio 2015^)
|
||||
echo - 2017 ^(build with visual studio 2017^)
|
||||
echo - 2017pre ^(build with visual studio 2017 pre-release^)
|
||||
echo - 2017b ^(build with visual studio 2017 Build Tools^)
|
||||
echo - clang ^(enable building with clang^)
|
||||
echo - asan ^(enable asan when building with clang^)
|
||||
echo - ninja ^(enable building with ninja instead of msbuild^)
|
||||
echo.
|
||||
|
2
extern/audaspace/plugins/ffmpeg/FFMPEG.cpp
vendored
2
extern/audaspace/plugins/ffmpeg/FFMPEG.cpp
vendored
@@ -23,7 +23,9 @@ AUD_NAMESPACE_BEGIN
|
||||
|
||||
FFMPEG::FFMPEG()
|
||||
{
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
||||
av_register_all();
|
||||
#endif
|
||||
}
|
||||
|
||||
void FFMPEG::registerPlugin()
|
||||
|
124
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
124
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
@@ -22,37 +22,37 @@
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avio.h>
|
||||
#include <libavutil/avutil.h>
|
||||
}
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
||||
#define FFMPEG_OLD_CODE
|
||||
#endif
|
||||
|
||||
int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
{
|
||||
AVFrame* frame = nullptr;
|
||||
int buf_size = buffer.getSize();
|
||||
int buf_pos = 0;
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
int got_frame;
|
||||
int read_length;
|
||||
uint8_t* orig_data = packet.data;
|
||||
int orig_size = packet.size;
|
||||
|
||||
int buf_size = buffer.getSize();
|
||||
int buf_pos = 0;
|
||||
|
||||
while(packet.size > 0)
|
||||
{
|
||||
got_frame = 0;
|
||||
|
||||
if(!frame)
|
||||
frame = av_frame_alloc();
|
||||
else
|
||||
av_frame_unref(frame);
|
||||
|
||||
read_length = avcodec_decode_audio4(m_codecCtx, frame, &got_frame, &packet);
|
||||
read_length = avcodec_decode_audio4(m_codecCtx, m_frame, &got_frame, &packet);
|
||||
if(read_length < 0)
|
||||
break;
|
||||
|
||||
if(got_frame)
|
||||
{
|
||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
||||
|
||||
if(buf_size - buf_pos < data_size)
|
||||
{
|
||||
@@ -62,18 +62,18 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
|
||||
if(m_tointerleave)
|
||||
{
|
||||
int single_size = data_size / m_codecCtx->channels / frame->nb_samples;
|
||||
int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
|
||||
for(int channel = 0; channel < m_codecCtx->channels; channel++)
|
||||
{
|
||||
for(int i = 0; i < frame->nb_samples; i++)
|
||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
||||
{
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
||||
frame->data[channel] + i * single_size, single_size);
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, frame->data[0], data_size);
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, m_frame->data[0], data_size);
|
||||
|
||||
buf_pos += data_size;
|
||||
}
|
||||
@@ -83,7 +83,42 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
|
||||
packet.data = orig_data;
|
||||
packet.size = orig_size;
|
||||
av_free(frame);
|
||||
#else
|
||||
avcodec_send_packet(m_codecCtx, &packet);
|
||||
|
||||
while(true)
|
||||
{
|
||||
auto ret = avcodec_receive_frame(m_codecCtx, m_frame);
|
||||
|
||||
if(ret != 0)
|
||||
break;
|
||||
|
||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
||||
|
||||
if(buf_size - buf_pos < data_size)
|
||||
{
|
||||
buffer.resize(buf_size + data_size, true);
|
||||
buf_size += data_size;
|
||||
}
|
||||
|
||||
if(m_tointerleave)
|
||||
{
|
||||
int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
|
||||
for(int channel = 0; channel < m_codecCtx->channels; channel++)
|
||||
{
|
||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
||||
{
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, m_frame->data[0], data_size);
|
||||
|
||||
buf_pos += data_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
return buf_pos;
|
||||
}
|
||||
@@ -101,7 +136,11 @@ void FFMPEGReader::init()
|
||||
|
||||
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
|
||||
{
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
#else
|
||||
if((m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
#endif
|
||||
&& (m_stream < 0))
|
||||
{
|
||||
m_stream=i;
|
||||
@@ -112,12 +151,34 @@ void FFMPEGReader::init()
|
||||
if(m_stream == -1)
|
||||
AUD_THROW(FileException, "File couldn't be read, no audio stream found by ffmpeg.");
|
||||
|
||||
m_codecCtx = m_formatCtx->streams[m_stream]->codec;
|
||||
|
||||
// get a decoder and open it
|
||||
AVCodec* aCodec = avcodec_find_decoder(m_codecCtx->codec_id);
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
AVCodec* aCodec = avcodec_find_decoder(m_formatCtx->streams[m_stream]->codecpar->codec_id);
|
||||
|
||||
if(!aCodec)
|
||||
AUD_THROW(FileException, "File couldn't be read, no decoder found with ffmpeg.");
|
||||
#endif
|
||||
|
||||
m_frame = av_frame_alloc();
|
||||
|
||||
if(!m_frame)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg frame couldn't be allocated.");
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_codecCtx = m_formatCtx->streams[m_stream]->codec;
|
||||
|
||||
AVCodec* aCodec = avcodec_find_decoder(m_codecCtx->codec_id);
|
||||
#else
|
||||
m_codecCtx = avcodec_alloc_context3(aCodec);
|
||||
#endif
|
||||
|
||||
if(!m_codecCtx)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg context couldn't be allocated.");
|
||||
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
if(avcodec_parameters_to_context(m_codecCtx, m_formatCtx->streams[m_stream]->codecpar) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg decoder parameters couldn't be copied to decoder context.");
|
||||
#endif
|
||||
|
||||
if(avcodec_open2(m_codecCtx, aCodec, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg codec couldn't be opened.");
|
||||
@@ -157,6 +218,8 @@ void FFMPEGReader::init()
|
||||
FFMPEGReader::FFMPEGReader(std::string filename) :
|
||||
m_pkgbuf(),
|
||||
m_formatCtx(nullptr),
|
||||
m_codecCtx(nullptr),
|
||||
m_frame(nullptr),
|
||||
m_aviocontext(nullptr),
|
||||
m_membuf(nullptr)
|
||||
{
|
||||
@@ -177,12 +240,14 @@ FFMPEGReader::FFMPEGReader(std::string filename) :
|
||||
|
||||
FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
|
||||
m_pkgbuf(),
|
||||
m_codecCtx(nullptr),
|
||||
m_frame(nullptr),
|
||||
m_membuffer(buffer),
|
||||
m_membufferpos(0)
|
||||
{
|
||||
m_membuf = reinterpret_cast<data_t*>(av_malloc(FF_MIN_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE));
|
||||
m_membuf = reinterpret_cast<data_t*>(av_malloc(AV_INPUT_BUFFER_MIN_SIZE + AV_INPUT_BUFFER_PADDING_SIZE));
|
||||
|
||||
m_aviocontext = avio_alloc_context(m_membuf, FF_MIN_BUFFER_SIZE, 0, this, read_packet, nullptr, seek_packet);
|
||||
m_aviocontext = avio_alloc_context(m_membuf, AV_INPUT_BUFFER_MIN_SIZE, 0, this, read_packet, nullptr, seek_packet);
|
||||
|
||||
if(!m_aviocontext)
|
||||
{
|
||||
@@ -212,7 +277,14 @@ FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
|
||||
|
||||
FFMPEGReader::~FFMPEGReader()
|
||||
{
|
||||
if(m_frame)
|
||||
av_frame_free(&m_frame);
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
avcodec_close(m_codecCtx);
|
||||
#else
|
||||
if(m_codecCtx)
|
||||
avcodec_free_context(&m_codecCtx);
|
||||
#endif
|
||||
avformat_close_input(&m_formatCtx);
|
||||
}
|
||||
|
||||
@@ -312,7 +384,7 @@ void FFMPEGReader::seek(int position)
|
||||
}
|
||||
}
|
||||
}
|
||||
av_free_packet(&packet);
|
||||
av_packet_unref(&packet);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -343,7 +415,7 @@ Specs FFMPEGReader::getSpecs() const
|
||||
void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
{
|
||||
// read packages and decode them
|
||||
AVPacket packet;
|
||||
AVPacket packet = {};
|
||||
int data_size = 0;
|
||||
int pkgbuf_pos;
|
||||
int left = length;
|
||||
@@ -359,7 +431,7 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||
left -= data_size/sample_size;
|
||||
left -= data_size / sample_size;
|
||||
}
|
||||
|
||||
// for each frame read as long as there isn't enough data already
|
||||
@@ -375,9 +447,9 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||
left -= data_size/sample_size;
|
||||
left -= data_size / sample_size;
|
||||
}
|
||||
av_free_packet(&packet);
|
||||
av_packet_unref(&packet);
|
||||
}
|
||||
// read more data than necessary?
|
||||
if(pkgbuf_pos > data_size)
|
||||
|
@@ -79,6 +79,11 @@ private:
|
||||
*/
|
||||
AVCodecContext* m_codecCtx;
|
||||
|
||||
/**
|
||||
* The AVFrame structure for using ffmpeg.
|
||||
*/
|
||||
AVFrame* m_frame;
|
||||
|
||||
/**
|
||||
* The AVIOContext to read the data from.
|
||||
*/
|
||||
|
218
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
vendored
218
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
vendored
@@ -27,6 +27,10 @@ extern "C" {
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
||||
#define FFMPEG_OLD_CODE
|
||||
#endif
|
||||
|
||||
void FFMPEGWriter::encode()
|
||||
{
|
||||
sample_t* data = m_input_buffer.getBuffer();
|
||||
@@ -58,82 +62,106 @@ void FFMPEGWriter::encode()
|
||||
if(m_input_size)
|
||||
m_convert(reinterpret_cast<data_t*>(data), reinterpret_cast<data_t*>(data), m_input_samples * m_specs.channels);
|
||||
|
||||
AVPacket packet;
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_packet->data = nullptr;
|
||||
m_packet->size = 0;
|
||||
|
||||
packet.data = nullptr;
|
||||
packet.size = 0;
|
||||
av_init_packet(m_packet);
|
||||
|
||||
av_init_packet(&packet);
|
||||
|
||||
AVFrame* frame = av_frame_alloc();
|
||||
av_frame_unref(frame);
|
||||
av_frame_unref(m_frame);
|
||||
int got_packet;
|
||||
#endif
|
||||
|
||||
frame->nb_samples = m_input_samples;
|
||||
frame->format = m_codecCtx->sample_fmt;
|
||||
frame->channel_layout = m_codecCtx->channel_layout;
|
||||
m_frame->nb_samples = m_input_samples;
|
||||
m_frame->format = m_codecCtx->sample_fmt;
|
||||
m_frame->channel_layout = m_codecCtx->channel_layout;
|
||||
|
||||
if(avcodec_fill_audio_frame(frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
|
||||
if(avcodec_fill_audio_frame(m_frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, filling the audio frame failed with ffmpeg.");
|
||||
|
||||
AVRational sample_time = { 1, static_cast<int>(m_specs.rate) };
|
||||
frame->pts = av_rescale_q(m_position - m_input_samples, m_codecCtx->time_base, sample_time);
|
||||
m_frame->pts = av_rescale_q(m_position - m_input_samples, m_codecCtx->time_base, sample_time);
|
||||
|
||||
if(avcodec_encode_audio2(m_codecCtx, &packet, frame, &got_packet))
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
if(avcodec_encode_audio2(m_codecCtx, m_packet, m_frame, &got_packet))
|
||||
{
|
||||
av_frame_free(&frame);
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
||||
}
|
||||
|
||||
if(got_packet)
|
||||
{
|
||||
packet.flags |= AV_PKT_FLAG_KEY;
|
||||
packet.stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, &packet) < 0)
|
||||
m_packet->flags |= AV_PKT_FLAG_KEY;
|
||||
m_packet->stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
||||
{
|
||||
av_free_packet(&packet);
|
||||
av_frame_free(&frame);
|
||||
av_free_packet(m_packet);
|
||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
av_free_packet(&packet);
|
||||
av_free_packet(m_packet);
|
||||
}
|
||||
#else
|
||||
if(avcodec_send_frame(m_codecCtx, m_frame) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
||||
|
||||
av_frame_free(&frame);
|
||||
while(avcodec_receive_packet(m_codecCtx, m_packet) == 0)
|
||||
{
|
||||
m_packet->stream_index = m_stream->index;
|
||||
|
||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void FFMPEGWriter::close()
|
||||
{
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
int got_packet = true;
|
||||
|
||||
while(got_packet)
|
||||
{
|
||||
AVPacket packet;
|
||||
m_packet->data = nullptr;
|
||||
m_packet->size = 0;
|
||||
|
||||
packet.data = nullptr;
|
||||
packet.size = 0;
|
||||
av_init_packet(m_packet);
|
||||
|
||||
av_init_packet(&packet);
|
||||
|
||||
if(avcodec_encode_audio2(m_codecCtx, &packet, nullptr, &got_packet))
|
||||
if(avcodec_encode_audio2(m_codecCtx, m_packet, nullptr, &got_packet))
|
||||
AUD_THROW(FileException, "File end couldn't be written, audio encoding failed with ffmpeg.");
|
||||
|
||||
if(got_packet)
|
||||
{
|
||||
packet.flags |= AV_PKT_FLAG_KEY;
|
||||
packet.stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, &packet))
|
||||
m_packet->flags |= AV_PKT_FLAG_KEY;
|
||||
m_packet->stream_index = m_stream->index;
|
||||
if(av_write_frame(m_formatCtx, m_packet))
|
||||
{
|
||||
av_free_packet(&packet);
|
||||
av_free_packet(m_packet);
|
||||
AUD_THROW(FileException, "Final frames couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
av_free_packet(&packet);
|
||||
av_free_packet(m_packet);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(avcodec_send_frame(m_codecCtx, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
||||
|
||||
while(avcodec_receive_packet(m_codecCtx, m_packet) == 0)
|
||||
{
|
||||
m_packet->stream_index = m_stream->index;
|
||||
|
||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) :
|
||||
m_position(0),
|
||||
m_specs(specs),
|
||||
m_formatCtx(nullptr),
|
||||
m_codecCtx(nullptr),
|
||||
m_stream(nullptr),
|
||||
m_packet(nullptr),
|
||||
m_frame(nullptr),
|
||||
m_input_samples(0),
|
||||
m_deinterleave(false)
|
||||
{
|
||||
@@ -142,75 +170,105 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
if(avformat_alloc_output_context2(&m_formatCtx, nullptr, formats[format], filename.c_str()) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, format couldn't be found with ffmpeg.");
|
||||
|
||||
m_outputFmt = m_formatCtx->oformat;
|
||||
AVOutputFormat* outputFmt = m_formatCtx->oformat;
|
||||
|
||||
if(!m_outputFmt) {
|
||||
if(!outputFmt) {
|
||||
avformat_free_context(m_formatCtx);
|
||||
AUD_THROW(FileException, "File couldn't be written, output format couldn't be found with ffmpeg.");
|
||||
}
|
||||
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
|
||||
switch(codec)
|
||||
{
|
||||
case CODEC_AAC:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_AAC;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_AAC;
|
||||
break;
|
||||
case CODEC_AC3:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_AC3;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_AC3;
|
||||
break;
|
||||
case CODEC_FLAC:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_FLAC;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_FLAC;
|
||||
break;
|
||||
case CODEC_MP2:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_MP2;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_MP2;
|
||||
break;
|
||||
case CODEC_MP3:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_MP3;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_MP3;
|
||||
break;
|
||||
case CODEC_OPUS:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_OPUS;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_OPUS;
|
||||
break;
|
||||
case CODEC_PCM:
|
||||
switch(specs.format)
|
||||
{
|
||||
case FORMAT_U8:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_U8;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_U8;
|
||||
break;
|
||||
case FORMAT_S16:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S16LE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S16LE;
|
||||
break;
|
||||
case FORMAT_S24:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S24LE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S24LE;
|
||||
break;
|
||||
case FORMAT_S32:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S32LE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S32LE;
|
||||
break;
|
||||
case FORMAT_FLOAT32:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_F32LE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_F32LE;
|
||||
break;
|
||||
case FORMAT_FLOAT64:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_F64LE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_F64LE;
|
||||
break;
|
||||
default:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CODEC_VORBIS:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_VORBIS;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_VORBIS;
|
||||
break;
|
||||
default:
|
||||
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
uint64_t channel_layout = 0;
|
||||
|
||||
switch(m_specs.channels)
|
||||
{
|
||||
case CHANNELS_MONO:
|
||||
channel_layout = AV_CH_LAYOUT_MONO;
|
||||
break;
|
||||
case CHANNELS_STEREO:
|
||||
channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
break;
|
||||
case CHANNELS_STEREO_LFE:
|
||||
channel_layout = AV_CH_LAYOUT_2POINT1;
|
||||
break;
|
||||
case CHANNELS_SURROUND4:
|
||||
channel_layout = AV_CH_LAYOUT_QUAD;
|
||||
break;
|
||||
case CHANNELS_SURROUND5:
|
||||
channel_layout = AV_CH_LAYOUT_5POINT0_BACK;
|
||||
break;
|
||||
case CHANNELS_SURROUND51:
|
||||
channel_layout = AV_CH_LAYOUT_5POINT1_BACK;
|
||||
break;
|
||||
case CHANNELS_SURROUND61:
|
||||
channel_layout = AV_CH_LAYOUT_6POINT1_BACK;
|
||||
break;
|
||||
case CHANNELS_SURROUND71:
|
||||
channel_layout = AV_CH_LAYOUT_7POINT1;
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if(m_outputFmt->audio_codec == AV_CODEC_ID_NONE)
|
||||
if(outputFmt->audio_codec == AV_CODEC_ID_NONE)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio codec not found with ffmpeg.");
|
||||
|
||||
AVCodec* codec = avcodec_find_encoder(m_outputFmt->audio_codec);
|
||||
AVCodec* codec = avcodec_find_encoder(outputFmt->audio_codec);
|
||||
if(!codec)
|
||||
AUD_THROW(FileException, "File couldn't be written, audio encoder couldn't be found with ffmpeg.");
|
||||
|
||||
@@ -220,7 +278,14 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
|
||||
m_stream->id = m_formatCtx->nb_streams - 1;
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_codecCtx = m_stream->codec;
|
||||
#else
|
||||
m_codecCtx = avcodec_alloc_context3(codec);
|
||||
#endif
|
||||
|
||||
if(!m_codecCtx)
|
||||
AUD_THROW(FileException, "File couldn't be written, context creation failed with ffmpeg.");
|
||||
|
||||
switch(m_specs.format)
|
||||
{
|
||||
@@ -247,7 +312,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
}
|
||||
|
||||
if(m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
m_codecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||
m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
bool format_supported = false;
|
||||
|
||||
@@ -328,9 +393,13 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
|
||||
m_specs.rate = m_codecCtx->sample_rate;
|
||||
|
||||
m_codecCtx->codec_id = m_outputFmt->audio_codec;
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_codecCtx->codec_id = outputFmt->audio_codec;
|
||||
#endif
|
||||
|
||||
m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
m_codecCtx->bit_rate = bitrate;
|
||||
m_codecCtx->channel_layout = channel_layout;
|
||||
m_codecCtx->channels = m_specs.channels;
|
||||
m_stream->time_base.num = m_codecCtx->time_base.num = 1;
|
||||
m_stream->time_base.den = m_codecCtx->time_base.den = m_codecCtx->sample_rate;
|
||||
@@ -338,6 +407,11 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
if(avcodec_open2(m_codecCtx, codec, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, encoder couldn't be opened with ffmpeg.");
|
||||
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
if(avcodec_parameters_from_context(m_stream->codecpar, m_codecCtx) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, codec parameters couldn't be copied to the context.");
|
||||
#endif
|
||||
|
||||
int samplesize = std::max(int(AUD_SAMPLE_SIZE(m_specs)), AUD_DEVICE_SAMPLE_SIZE(m_specs));
|
||||
|
||||
if((m_input_size = m_codecCtx->frame_size))
|
||||
@@ -346,13 +420,26 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
if(avio_open(&m_formatCtx->pb, filename.c_str(), AVIO_FLAG_WRITE))
|
||||
AUD_THROW(FileException, "File couldn't be written, file opening failed with ffmpeg.");
|
||||
|
||||
avformat_write_header(m_formatCtx, nullptr);
|
||||
if(avformat_write_header(m_formatCtx, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be written, writing the header failed.");
|
||||
}
|
||||
catch(Exception&)
|
||||
{
|
||||
#ifndef FFMPEG_OLD_CODE
|
||||
if(m_codecCtx)
|
||||
avcodec_free_context(&m_codecCtx);
|
||||
#endif
|
||||
avformat_free_context(m_formatCtx);
|
||||
throw;
|
||||
}
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_packet = new AVPacket({});
|
||||
#else
|
||||
m_packet = av_packet_alloc();
|
||||
#endif
|
||||
|
||||
m_frame = av_frame_alloc();
|
||||
}
|
||||
|
||||
FFMPEGWriter::~FFMPEGWriter()
|
||||
@@ -365,9 +452,26 @@ FFMPEGWriter::~FFMPEGWriter()
|
||||
|
||||
av_write_trailer(m_formatCtx);
|
||||
|
||||
avcodec_close(m_codecCtx);
|
||||
if(m_frame)
|
||||
av_frame_free(&m_frame);
|
||||
|
||||
avio_close(m_formatCtx->pb);
|
||||
if(m_packet)
|
||||
{
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
delete m_packet;
|
||||
#else
|
||||
av_packet_free(&m_packet);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
avcodec_close(m_codecCtx);
|
||||
#else
|
||||
if(m_codecCtx)
|
||||
avcodec_free_context(&m_codecCtx);
|
||||
#endif
|
||||
|
||||
avio_closep(&m_formatCtx->pb);
|
||||
avformat_free_context(m_formatCtx);
|
||||
}
|
||||
|
||||
|
15
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.h
vendored
15
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.h
vendored
@@ -65,16 +65,21 @@ private:
|
||||
*/
|
||||
AVCodecContext* m_codecCtx;
|
||||
|
||||
/**
|
||||
* The AVOutputFormat structure for using ffmpeg.
|
||||
*/
|
||||
AVOutputFormat* m_outputFmt;
|
||||
|
||||
/**
|
||||
* The AVStream structure for using ffmpeg.
|
||||
*/
|
||||
AVStream* m_stream;
|
||||
|
||||
/**
|
||||
* The AVPacket structure for using ffmpeg.
|
||||
*/
|
||||
AVPacket* m_packet;
|
||||
|
||||
/**
|
||||
* The AVFrame structure for using ffmpeg.
|
||||
*/
|
||||
AVFrame* m_frame;
|
||||
|
||||
/**
|
||||
* The input buffer for the format converted data before encoding.
|
||||
*/
|
||||
|
@@ -78,7 +78,7 @@ class CyclesRender(bpy.types.RenderEngine):
|
||||
|
||||
engine.reset(self, data, depsgraph)
|
||||
|
||||
def render_to_image(self, depsgraph):
|
||||
def render(self, depsgraph):
|
||||
engine.render(self, depsgraph)
|
||||
|
||||
def bake(self, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
|
||||
@@ -93,7 +93,7 @@ class CyclesRender(bpy.types.RenderEngine):
|
||||
engine.reset(self, context.blend_data, context.depsgraph)
|
||||
engine.sync(self, context.depsgraph, context.blend_data)
|
||||
|
||||
def render_to_view(self, context):
|
||||
def view_draw(self, context):
|
||||
engine.draw(self, context.depsgraph, context.region, context.space_data, context.region_data)
|
||||
|
||||
def update_script_node(self, node):
|
||||
|
@@ -1154,7 +1154,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
|
||||
default='THICK',
|
||||
)
|
||||
cls.cull_backfacing = BoolProperty(
|
||||
name="Cull back-faces",
|
||||
name="Cull Back-faces",
|
||||
description="Do not test the back-face of each strand",
|
||||
default=True,
|
||||
)
|
||||
@@ -1330,49 +1330,6 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
|
||||
del bpy.types.ViewLayer.cycles
|
||||
|
||||
|
||||
class CyclesCurveSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
bpy.types.ParticleSettings.cycles = PointerProperty(
|
||||
name="Cycles Hair Settings",
|
||||
description="Cycles hair settings",
|
||||
type=cls,
|
||||
)
|
||||
cls.radius_scale = FloatProperty(
|
||||
name="Radius Scaling",
|
||||
description="Multiplier of width properties",
|
||||
min=0.0, max=1000.0,
|
||||
default=0.01,
|
||||
)
|
||||
cls.root_width = FloatProperty(
|
||||
name="Root Size",
|
||||
description="Strand's width at root",
|
||||
min=0.0, max=1000.0,
|
||||
default=1.0,
|
||||
)
|
||||
cls.tip_width = FloatProperty(
|
||||
name="Tip Multiplier",
|
||||
description="Strand's width at tip",
|
||||
min=0.0, max=1000.0,
|
||||
default=0.0,
|
||||
)
|
||||
cls.shape = FloatProperty(
|
||||
name="Strand Shape",
|
||||
description="Strand shape parameter",
|
||||
min=-1.0, max=1.0,
|
||||
default=0.0,
|
||||
)
|
||||
cls.use_closetip = BoolProperty(
|
||||
name="Close tip",
|
||||
description="Set tip radius to zero",
|
||||
default=True,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
del bpy.types.ParticleSettings.cycles
|
||||
|
||||
|
||||
class CyclesDeviceSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
@@ -1503,7 +1460,6 @@ def register():
|
||||
bpy.utils.register_class(CyclesMeshSettings)
|
||||
bpy.utils.register_class(CyclesObjectSettings)
|
||||
bpy.utils.register_class(CyclesCurveRenderSettings)
|
||||
bpy.utils.register_class(CyclesCurveSettings)
|
||||
bpy.utils.register_class(CyclesDeviceSettings)
|
||||
bpy.utils.register_class(CyclesPreferences)
|
||||
bpy.utils.register_class(CyclesRenderLayerSettings)
|
||||
@@ -1519,7 +1475,6 @@ def unregister():
|
||||
bpy.utils.unregister_class(CyclesObjectSettings)
|
||||
bpy.utils.unregister_class(CyclesVisibilitySettings)
|
||||
bpy.utils.unregister_class(CyclesCurveRenderSettings)
|
||||
bpy.utils.unregister_class(CyclesCurveSettings)
|
||||
bpy.utils.unregister_class(CyclesDeviceSettings)
|
||||
bpy.utils.unregister_class(CyclesPreferences)
|
||||
bpy.utils.unregister_class(CyclesRenderLayerSettings)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -433,3 +433,14 @@ def do_versions(self):
|
||||
(bpy.data.version >= (2, 80, 0) and bpy.data.version <= (2, 80, 4)):
|
||||
# Switch to squared roughness convention
|
||||
square_roughness_nodes_insert()
|
||||
|
||||
if bpy.data.version <= (2, 80, 15):
|
||||
# Copy cycles hair settings to internal settings
|
||||
for part in bpy.data.particles:
|
||||
cpart = part.get("cycles", None)
|
||||
if cpart:
|
||||
part.shape = cpart.get("shape", 0.0)
|
||||
part.root_radius = cpart.get("root_width", 1.0)
|
||||
part.tip_radius = cpart.get("tip_width", 0.0)
|
||||
part.radius_scale = cpart.get("radius_scale", 0.01)
|
||||
part.use_close_tip = cpart.get("use_closetip", True)
|
||||
|
@@ -149,18 +149,16 @@ static bool ObtainCacheParticleData(Mesh *mesh,
|
||||
if(b_part.kink() == BL::ParticleSettings::kink_SPIRAL)
|
||||
ren_step += b_part.kink_extra_steps();
|
||||
|
||||
PointerRNA cpsys = RNA_pointer_get(&b_part.ptr, "cycles");
|
||||
|
||||
CData->psys_firstcurve.push_back_slow(curvenum);
|
||||
CData->psys_curvenum.push_back_slow(totcurves);
|
||||
CData->psys_shader.push_back_slow(shader);
|
||||
|
||||
float radius = get_float(cpsys, "radius_scale") * 0.5f;
|
||||
float radius = b_part.radius_scale() * 0.5f;
|
||||
|
||||
CData->psys_rootradius.push_back_slow(radius * get_float(cpsys, "root_width"));
|
||||
CData->psys_tipradius.push_back_slow(radius * get_float(cpsys, "tip_width"));
|
||||
CData->psys_shape.push_back_slow(get_float(cpsys, "shape"));
|
||||
CData->psys_closetip.push_back_slow(get_boolean(cpsys, "use_closetip"));
|
||||
CData->psys_rootradius.push_back_slow(radius * b_part.root_radius());
|
||||
CData->psys_tipradius.push_back_slow(radius * b_part.tip_radius());
|
||||
CData->psys_shape.push_back_slow(b_part.shape());
|
||||
CData->psys_closetip.push_back_slow(b_part.use_close_tip());
|
||||
|
||||
int pa_no = 0;
|
||||
if(!(b_part.child_type() == 0) && totchild != 0)
|
||||
|
@@ -1173,7 +1173,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph& b_depsgraph,
|
||||
* freed data from the blender side.
|
||||
*/
|
||||
if(preview && b_ob.type() != BL::Object::type_MESH)
|
||||
b_ob.update_from_editmode();
|
||||
b_ob.update_from_editmode(b_data);
|
||||
|
||||
bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
|
||||
|
||||
|
@@ -278,25 +278,25 @@ void BlenderSync::sync_background_light(bool use_portal)
|
||||
/* Object */
|
||||
|
||||
Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
BL::Depsgraph::duplis_iterator& b_dupli_iter,
|
||||
BL::DepsgraphObjectInstance& b_instance,
|
||||
uint layer_flag,
|
||||
float motion_time,
|
||||
bool hide_tris,
|
||||
BlenderObjectCulling& culling,
|
||||
bool *use_portal)
|
||||
{
|
||||
const bool is_instance = b_dupli_iter->is_instance();
|
||||
BL::Object b_ob = b_dupli_iter->object();
|
||||
BL::Object b_parent = is_instance ? b_dupli_iter->parent()
|
||||
: b_dupli_iter->object();
|
||||
BL::Object b_ob_instance = is_instance ? b_dupli_iter->instance_object()
|
||||
const bool is_instance = b_instance.is_instance();
|
||||
BL::Object b_ob = b_instance.object();
|
||||
BL::Object b_parent = is_instance ? b_instance.parent()
|
||||
: b_instance.object();
|
||||
BL::Object b_ob_instance = is_instance ? b_instance.instance_object()
|
||||
: b_ob;
|
||||
const bool motion = motion_time != 0.0f;
|
||||
/*const*/ Transform tfm = get_transform(b_ob.matrix_world());
|
||||
int *persistent_id = NULL;
|
||||
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id_array;
|
||||
if(is_instance) {
|
||||
persistent_id_array = b_dupli_iter->persistent_id();
|
||||
persistent_id_array = b_instance.persistent_id();
|
||||
persistent_id = persistent_id_array.data;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
persistent_id,
|
||||
b_ob,
|
||||
b_ob_instance,
|
||||
is_instance ? b_dupli_iter->random_id() : 0,
|
||||
is_instance ? b_instance.random_id() : 0,
|
||||
tfm,
|
||||
use_portal);
|
||||
}
|
||||
@@ -448,12 +448,12 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
|
||||
/* dupli texture coordinates and random_id */
|
||||
if(is_instance) {
|
||||
object->dupli_generated = 0.5f*get_float3(b_dupli_iter->orco()) - make_float3(0.5f, 0.5f, 0.5f);
|
||||
object->dupli_uv = get_float2(b_dupli_iter->uv());
|
||||
object->random_id = b_dupli_iter->random_id();
|
||||
object->dupli_generated = 0.5f*get_float3(b_instance.orco()) - make_float3(0.5f, 0.5f, 0.5f);
|
||||
object->dupli_uv = get_float2(b_instance.uv());
|
||||
object->random_id = b_instance.random_id();
|
||||
|
||||
/* Sync possible particle data. */
|
||||
sync_dupli_particle(b_ob, *b_dupli_iter, object);
|
||||
sync_dupli_particle(b_ob, b_instance, object);
|
||||
}
|
||||
else {
|
||||
object->dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
|
||||
@@ -482,7 +482,8 @@ static bool object_render_hide_original(BL::Object::type_enum ob_type,
|
||||
static bool object_render_hide(BL::Object& b_ob,
|
||||
bool top_level,
|
||||
bool parent_hide,
|
||||
bool& hide_triangles)
|
||||
bool& hide_triangles,
|
||||
BL::Depsgraph::mode_enum depsgraph_mode)
|
||||
{
|
||||
/* check if we should render or hide particle emitter */
|
||||
BL::Object::particle_systems_iterator b_psys;
|
||||
@@ -501,11 +502,16 @@ static bool object_render_hide(BL::Object& b_ob,
|
||||
has_particles = true;
|
||||
}
|
||||
|
||||
/* Both mode_PREVIEW and mode_VIEWPORT are treated the same here.*/
|
||||
const bool show_duplicator = depsgraph_mode == BL::Depsgraph::mode_RENDER
|
||||
? b_ob.show_duplicator_for_render()
|
||||
: b_ob.show_duplicator_for_viewport();
|
||||
|
||||
if(has_particles) {
|
||||
show_emitter = b_ob.show_duplicator_for_render();
|
||||
show_emitter = show_duplicator;
|
||||
hide_emitter = !show_emitter;
|
||||
} else if(b_ob.is_duplicator()) {
|
||||
if(top_level || b_ob.show_duplicator_for_render()) {
|
||||
if(top_level || show_duplicator) {
|
||||
hide_as_dupli_parent = true;
|
||||
}
|
||||
}
|
||||
@@ -563,12 +569,15 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
|
||||
bool cancel = false;
|
||||
bool use_portal = false;
|
||||
|
||||
BL::Depsgraph::duplis_iterator b_dupli_iter;
|
||||
for(b_depsgraph.duplis.begin(b_dupli_iter);
|
||||
b_dupli_iter != b_depsgraph.duplis.end() && !cancel;
|
||||
++b_dupli_iter)
|
||||
BL::Depsgraph::mode_enum depsgraph_mode = b_depsgraph.mode();
|
||||
|
||||
BL::Depsgraph::object_instances_iterator b_instance_iter;
|
||||
for(b_depsgraph.object_instances.begin(b_instance_iter);
|
||||
b_instance_iter != b_depsgraph.object_instances.end() && !cancel;
|
||||
++b_instance_iter)
|
||||
{
|
||||
BL::Object b_ob = b_dupli_iter->object();
|
||||
BL::DepsgraphObjectInstance b_instance = *b_instance_iter;
|
||||
BL::Object b_ob = b_instance.object();
|
||||
if(!b_ob.is_visible()) {
|
||||
continue;
|
||||
}
|
||||
@@ -581,10 +590,10 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
|
||||
/* test if object needs to be hidden */
|
||||
bool hide_tris;
|
||||
|
||||
if(!object_render_hide(b_ob, true, true, hide_tris)) {
|
||||
if(!object_render_hide(b_ob, true, true, hide_tris, depsgraph_mode)) {
|
||||
/* object itself */
|
||||
sync_object(b_depsgraph,
|
||||
b_dupli_iter,
|
||||
b_instance,
|
||||
~(0), /* until we get rid of layers */
|
||||
motion_time,
|
||||
hide_tris,
|
||||
|
@@ -28,11 +28,11 @@ CCL_NAMESPACE_BEGIN
|
||||
/* Utilities */
|
||||
|
||||
bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
|
||||
BL::DepsgraphIter& b_dup,
|
||||
BL::DepsgraphObjectInstance& b_instance,
|
||||
Object *object)
|
||||
{
|
||||
/* test if this dupli was generated from a particle sytem */
|
||||
BL::ParticleSystem b_psys = b_dup.particle_system();
|
||||
BL::ParticleSystem b_psys = b_instance.particle_system();
|
||||
if(!b_psys)
|
||||
return false;
|
||||
|
||||
@@ -43,7 +43,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
|
||||
return false;
|
||||
|
||||
/* don't handle child particles yet */
|
||||
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup.persistent_id();
|
||||
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_instance.persistent_id();
|
||||
|
||||
if(persistent_id[0] >= b_psys.particles.length())
|
||||
return false;
|
||||
@@ -53,7 +53,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
|
||||
ParticleSystem *psys;
|
||||
|
||||
bool first_use = !particle_system_map.is_used(key);
|
||||
bool need_update = particle_system_map.sync(&psys, b_ob, b_dup.object(), key);
|
||||
bool need_update = particle_system_map.sync(&psys, b_ob, b_instance.object(), key);
|
||||
|
||||
/* no update needed? */
|
||||
if(!need_update && !object->mesh->need_update && !scene->object_manager->need_update)
|
||||
|
@@ -773,7 +773,7 @@ void BlenderSession::synchronize(BL::Depsgraph& b_depsgraph_)
|
||||
|
||||
/* copy recalc flags, outside of mutex so we can decide to do the real
|
||||
* synchronization at a later time to not block on running updates */
|
||||
sync->sync_recalc();
|
||||
sync->sync_recalc(b_depsgraph_);
|
||||
|
||||
/* don't do synchronization if on pause */
|
||||
if(session_pause) {
|
||||
|
@@ -659,7 +659,9 @@ static ShaderNode *add_node(Scene *scene,
|
||||
image->animated = b_image_node.image_user().use_auto_refresh();
|
||||
image->use_alpha = b_image.use_alpha();
|
||||
|
||||
/* TODO: restore */
|
||||
/* TODO(sergey): Does not work properly when we change builtin type. */
|
||||
#if 0
|
||||
if(b_image.is_updated()) {
|
||||
scene->image_manager->tag_reload_image(
|
||||
image->filename.string(),
|
||||
@@ -668,6 +670,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
get_image_extension(b_image_node),
|
||||
image->use_alpha);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
image->color_space = (NodeImageColorSpace)b_image_node.color_space();
|
||||
image->projection = (NodeImageProjection)b_image_node.projection();
|
||||
@@ -707,7 +710,9 @@ static ShaderNode *add_node(Scene *scene,
|
||||
env->animated = b_env_node.image_user().use_auto_refresh();
|
||||
env->use_alpha = b_image.use_alpha();
|
||||
|
||||
/* TODO: restore */
|
||||
/* TODO(sergey): Does not work properly when we change builtin type. */
|
||||
#if 0
|
||||
if(b_image.is_updated()) {
|
||||
scene->image_manager->tag_reload_image(
|
||||
env->filename.string(),
|
||||
@@ -716,6 +721,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
EXTENSION_REPEAT,
|
||||
env->use_alpha);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
env->color_space = (NodeImageColorSpace)b_env_node.color_space();
|
||||
env->interpolation = get_image_interpolation(b_env_node);
|
||||
@@ -1238,33 +1244,32 @@ void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
TaskPool pool;
|
||||
set<Shader*> updated_shaders;
|
||||
|
||||
/* material loop */
|
||||
BL::BlendData::materials_iterator b_mat_orig;
|
||||
for(b_data.materials.begin(b_mat_orig);
|
||||
b_mat_orig != b_data.materials.end();
|
||||
++b_mat_orig)
|
||||
{
|
||||
/* TODO(sergey): Iterate over evaluated data rather than using mapping. */
|
||||
BL::Material b_mat_(b_depsgraph.id_eval_get(*b_mat_orig));
|
||||
BL::Material *b_mat = &b_mat_;
|
||||
BL::Depsgraph::ids_iterator b_id;
|
||||
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
|
||||
if (!b_id->is_a(&RNA_Material)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BL::Material b_mat(*b_id);
|
||||
Shader *shader;
|
||||
|
||||
/* test if we need to sync */
|
||||
if(shader_map.sync(&shader, *b_mat) || update_all) {
|
||||
if(shader_map.sync(&shader, b_mat) || shader->need_sync_object || update_all) {
|
||||
ShaderGraph *graph = new ShaderGraph();
|
||||
|
||||
shader->name = b_mat->name().c_str();
|
||||
shader->pass_id = b_mat->pass_index();
|
||||
shader->name = b_mat.name().c_str();
|
||||
shader->pass_id = b_mat.pass_index();
|
||||
shader->need_sync_object = false;
|
||||
|
||||
/* create nodes */
|
||||
if(b_mat->use_nodes() && b_mat->node_tree()) {
|
||||
BL::ShaderNodeTree b_ntree(b_mat->node_tree());
|
||||
if(b_mat.use_nodes() && b_mat.node_tree()) {
|
||||
BL::ShaderNodeTree b_ntree(b_mat.node_tree());
|
||||
|
||||
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
|
||||
}
|
||||
else {
|
||||
DiffuseBsdfNode *diffuse = new DiffuseBsdfNode();
|
||||
diffuse->color = get_float3(b_mat->diffuse_color());
|
||||
diffuse->color = get_float3(b_mat.diffuse_color());
|
||||
graph->add(diffuse);
|
||||
|
||||
ShaderNode *out = graph->output();
|
||||
@@ -1272,7 +1277,7 @@ void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
}
|
||||
|
||||
/* settings */
|
||||
PointerRNA cmat = RNA_pointer_get(&b_mat->ptr, "cycles");
|
||||
PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles");
|
||||
shader->use_mis = get_boolean(cmat, "sample_as_light");
|
||||
shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow");
|
||||
shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume");
|
||||
@@ -1412,41 +1417,39 @@ void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
{
|
||||
shader_map.set_default(scene->default_light);
|
||||
|
||||
/* lamp loop */
|
||||
BL::BlendData::lamps_iterator b_lamp_orig;
|
||||
for(b_data.lamps.begin(b_lamp_orig);
|
||||
b_lamp_orig != b_data.lamps.end();
|
||||
++b_lamp_orig)
|
||||
{
|
||||
/* TODO(sergey): Iterate over evaluated data rather than using mapping. */
|
||||
BL::Lamp b_lamp_(b_depsgraph.id_eval_get(*b_lamp_orig));
|
||||
BL::Lamp *b_lamp = &b_lamp_;
|
||||
BL::Depsgraph::ids_iterator b_id;
|
||||
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
|
||||
if (!b_id->is_a(&RNA_Lamp)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BL::Lamp b_lamp(*b_id);
|
||||
Shader *shader;
|
||||
|
||||
/* test if we need to sync */
|
||||
if(shader_map.sync(&shader, *b_lamp) || update_all) {
|
||||
if(shader_map.sync(&shader, b_lamp) || update_all) {
|
||||
ShaderGraph *graph = new ShaderGraph();
|
||||
|
||||
/* create nodes */
|
||||
if(b_lamp->use_nodes() && b_lamp->node_tree()) {
|
||||
shader->name = b_lamp->name().c_str();
|
||||
if(b_lamp.use_nodes() && b_lamp.node_tree()) {
|
||||
shader->name = b_lamp.name().c_str();
|
||||
|
||||
BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
|
||||
BL::ShaderNodeTree b_ntree(b_lamp.node_tree());
|
||||
|
||||
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
|
||||
}
|
||||
else {
|
||||
float strength = 1.0f;
|
||||
|
||||
if(b_lamp->type() == BL::Lamp::type_POINT ||
|
||||
b_lamp->type() == BL::Lamp::type_SPOT ||
|
||||
b_lamp->type() == BL::Lamp::type_AREA)
|
||||
if(b_lamp.type() == BL::Lamp::type_POINT ||
|
||||
b_lamp.type() == BL::Lamp::type_SPOT ||
|
||||
b_lamp.type() == BL::Lamp::type_AREA)
|
||||
{
|
||||
strength = 100.0f;
|
||||
}
|
||||
|
||||
EmissionNode *emission = new EmissionNode();
|
||||
emission->color = get_float3(b_lamp->color());
|
||||
emission->color = get_float3(b_lamp.color());
|
||||
emission->strength = strength;
|
||||
graph->add(emission);
|
||||
|
||||
|
@@ -76,31 +76,12 @@ BlenderSync::~BlenderSync()
|
||||
|
||||
/* Sync */
|
||||
|
||||
bool BlenderSync::sync_recalc()
|
||||
void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
|
||||
{
|
||||
/* sync recalc flags from blender to cycles. actual update is done separate,
|
||||
* so we can do it later on if doing it immediate is not suitable */
|
||||
|
||||
BL::BlendData::materials_iterator b_mat;
|
||||
bool has_updated_objects = b_data.objects.is_updated();
|
||||
for(b_data.materials.begin(b_mat); b_mat != b_data.materials.end(); ++b_mat) {
|
||||
if(b_mat->is_updated() || (b_mat->node_tree() && b_mat->node_tree().is_updated())) {
|
||||
shader_map.set_recalc(*b_mat);
|
||||
}
|
||||
else {
|
||||
Shader *shader = shader_map.find(*b_mat);
|
||||
if(has_updated_objects && shader != NULL && shader->has_object_dependency) {
|
||||
shader_map.set_recalc(*b_mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BL::BlendData::lamps_iterator b_lamp;
|
||||
|
||||
for(b_data.lamps.begin(b_lamp); b_lamp != b_data.lamps.end(); ++b_lamp)
|
||||
if(b_lamp->is_updated() || (b_lamp->node_tree() && b_lamp->node_tree().is_updated()))
|
||||
shader_map.set_recalc(*b_lamp);
|
||||
/* Sync recalc flags from blender to cycles. Actual update is done separate,
|
||||
* so we can do it later on if doing it immediate is not suitable. */
|
||||
|
||||
bool has_updated_objects = b_depsgraph.id_type_updated(BL::DriverTarget::id_type_OBJECT);
|
||||
bool dicing_prop_changed = false;
|
||||
|
||||
if(experimental) {
|
||||
@@ -122,70 +103,77 @@ bool BlenderSync::sync_recalc()
|
||||
}
|
||||
}
|
||||
|
||||
BL::BlendData::objects_iterator b_ob;
|
||||
/* Iterate over all IDs in this depsgraph. */
|
||||
BL::Depsgraph::updates_iterator b_update;
|
||||
for(b_depsgraph.updates.begin(b_update); b_update != b_depsgraph.updates.end(); ++b_update) {
|
||||
BL::ID b_id(b_update->id());
|
||||
|
||||
for(b_data.objects.begin(b_ob); b_ob != b_data.objects.end(); ++b_ob) {
|
||||
if(b_ob->is_updated()) {
|
||||
object_map.set_recalc(*b_ob);
|
||||
light_map.set_recalc(*b_ob);
|
||||
/* Material */
|
||||
if (b_id.is_a(&RNA_Material)) {
|
||||
BL::Material b_mat(b_id);
|
||||
shader_map.set_recalc(b_mat);
|
||||
}
|
||||
/* Lamp */
|
||||
else if (b_id.is_a(&RNA_Lamp)) {
|
||||
BL::Lamp b_lamp(b_id);
|
||||
shader_map.set_recalc(b_lamp);
|
||||
}
|
||||
/* Object */
|
||||
else if (b_id.is_a(&RNA_Object)) {
|
||||
BL::Object b_ob(b_id);
|
||||
const bool updated_geometry = b_update->updated_geometry();
|
||||
|
||||
if(object_is_mesh(*b_ob)) {
|
||||
if(b_ob->is_updated_data() || b_ob->data().is_updated() ||
|
||||
(dicing_prop_changed && object_subdivision_type(*b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE))
|
||||
{
|
||||
BL::ID key = BKE_object_is_modified(*b_ob)? *b_ob: b_ob->data();
|
||||
mesh_map.set_recalc(key);
|
||||
if (b_update->updated_transform()) {
|
||||
object_map.set_recalc(b_ob);
|
||||
light_map.set_recalc(b_ob);
|
||||
}
|
||||
}
|
||||
else if(object_is_light(*b_ob)) {
|
||||
if(b_ob->is_updated_data() || b_ob->data().is_updated())
|
||||
light_map.set_recalc(*b_ob);
|
||||
}
|
||||
|
||||
if(b_ob->is_updated_data()) {
|
||||
BL::Object::particle_systems_iterator b_psys;
|
||||
for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
|
||||
particle_system_map.set_recalc(*b_ob);
|
||||
}
|
||||
}
|
||||
|
||||
BL::BlendData::meshes_iterator b_mesh;
|
||||
|
||||
for(b_data.meshes.begin(b_mesh); b_mesh != b_data.meshes.end(); ++b_mesh) {
|
||||
if(b_mesh->is_updated()) {
|
||||
mesh_map.set_recalc(*b_mesh);
|
||||
}
|
||||
}
|
||||
|
||||
BL::BlendData::worlds_iterator b_world;
|
||||
|
||||
for(b_data.worlds.begin(b_world); b_world != b_data.worlds.end(); ++b_world) {
|
||||
if(world_map == b_world->ptr.data) {
|
||||
if(b_world->is_updated() ||
|
||||
(b_world->node_tree() && b_world->node_tree().is_updated()))
|
||||
{
|
||||
world_recalc = true;
|
||||
}
|
||||
else if(b_world->node_tree() && b_world->use_nodes()) {
|
||||
Shader *shader = scene->default_background;
|
||||
if(has_updated_objects && shader->has_object_dependency) {
|
||||
world_recalc = true;
|
||||
if(object_is_mesh(b_ob)) {
|
||||
if(updated_geometry ||
|
||||
(dicing_prop_changed && object_subdivision_type(b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE))
|
||||
{
|
||||
BL::ID key = BKE_object_is_modified(b_ob)? b_ob: b_ob.data();
|
||||
mesh_map.set_recalc(key);
|
||||
}
|
||||
}
|
||||
else if(object_is_light(b_ob)) {
|
||||
if(updated_geometry) {
|
||||
light_map.set_recalc(b_ob);
|
||||
}
|
||||
}
|
||||
|
||||
if(updated_geometry) {
|
||||
BL::Object::particle_systems_iterator b_psys;
|
||||
for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys)
|
||||
particle_system_map.set_recalc(b_ob);
|
||||
}
|
||||
}
|
||||
/* Mesh */
|
||||
else if (b_id.is_a(&RNA_Mesh)) {
|
||||
BL::Mesh b_mesh(b_id);
|
||||
mesh_map.set_recalc(b_mesh);
|
||||
}
|
||||
/* World */
|
||||
else if (b_id.is_a(&RNA_World)) {
|
||||
BL::World b_world(b_id);
|
||||
if(world_map == b_world.ptr.data) {
|
||||
world_recalc = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool recalc =
|
||||
shader_map.has_recalc() ||
|
||||
object_map.has_recalc() ||
|
||||
light_map.has_recalc() ||
|
||||
mesh_map.has_recalc() ||
|
||||
particle_system_map.has_recalc() ||
|
||||
BlendDataObjects_is_updated_get(&b_data.ptr) ||
|
||||
world_recalc;
|
||||
/* Updates shader with object dependency if objects changed. */
|
||||
if (has_updated_objects) {
|
||||
if(scene->default_background->has_object_dependency) {
|
||||
world_recalc = true;
|
||||
}
|
||||
|
||||
return recalc;
|
||||
foreach(Shader *shader, scene->shaders) {
|
||||
if (shader->has_object_dependency) {
|
||||
shader->need_sync_object = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BlenderSync::sync_data(BL::RenderSettings& b_render,
|
||||
|
@@ -59,7 +59,7 @@ public:
|
||||
~BlenderSync();
|
||||
|
||||
/* sync */
|
||||
bool sync_recalc();
|
||||
void sync_recalc(BL::Depsgraph& b_depsgraph);
|
||||
void sync_data(BL::RenderSettings& b_render,
|
||||
BL::Depsgraph& b_depsgraph,
|
||||
BL::SpaceView3D& b_v3d,
|
||||
@@ -126,7 +126,7 @@ private:
|
||||
bool motion,
|
||||
int motion_step = 0);
|
||||
Object *sync_object(BL::Depsgraph& b_depsgraph,
|
||||
BL::Depsgraph::duplis_iterator& b_dupli_iter,
|
||||
BL::DepsgraphObjectInstance& b_instance,
|
||||
uint layer_flag,
|
||||
float motion_time,
|
||||
bool hide_tris,
|
||||
@@ -151,7 +151,7 @@ private:
|
||||
|
||||
/* particles */
|
||||
bool sync_dupli_particle(BL::Object& b_ob,
|
||||
BL::DepsgraphIter& b_dup,
|
||||
BL::DepsgraphObjectInstance& b_instance,
|
||||
Object *object);
|
||||
|
||||
/* Images. */
|
||||
|
@@ -59,12 +59,15 @@ ccl_device_inline void kernel_split_path_end(KernelGlobals *kg, int ray_index)
|
||||
ccl_global char *ray_state = kernel_split_state.ray_state;
|
||||
|
||||
#ifdef __BRANCHED_PATH__
|
||||
# ifdef __SUBSURFACE__
|
||||
ccl_addr_space SubsurfaceIndirectRays *ss_indirect = &kernel_split_state.ss_rays[ray_index];
|
||||
|
||||
if(ss_indirect->num_rays) {
|
||||
ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER);
|
||||
}
|
||||
else if(IS_FLAG(ray_state, ray_index, RAY_BRANCHED_INDIRECT_SHARED)) {
|
||||
else
|
||||
# endif /* __SUBSURFACE__ */
|
||||
if(IS_FLAG(ray_state, ray_index, RAY_BRANCHED_INDIRECT_SHARED)) {
|
||||
int orig_ray = kernel_split_state.branched_state[ray_index].original_ray;
|
||||
|
||||
PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
|
||||
|
@@ -202,6 +202,7 @@ Shader::Shader()
|
||||
|
||||
need_update = true;
|
||||
need_update_mesh = true;
|
||||
need_sync_object = false;
|
||||
}
|
||||
|
||||
Shader::~Shader()
|
||||
|
@@ -99,6 +99,7 @@ public:
|
||||
/* synchronization */
|
||||
bool need_update;
|
||||
bool need_update_mesh;
|
||||
bool need_sync_object;
|
||||
|
||||
/* If the shader has only volume components, the surface is assumed to
|
||||
* be transparent.
|
||||
|
@@ -36,10 +36,12 @@ set(SRC
|
||||
|
||||
intern/eigenvalues.cc
|
||||
intern/linear_solver.cc
|
||||
intern/matrix.cc
|
||||
intern/svd.cc
|
||||
|
||||
intern/eigenvalues.h
|
||||
intern/linear_solver.h
|
||||
intern/matrix.h
|
||||
intern/svd.h
|
||||
)
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "intern/eigenvalues.h"
|
||||
#include "intern/linear_solver.h"
|
||||
#include "intern/matrix.h"
|
||||
#include "intern/svd.h"
|
||||
|
||||
#endif /* __EIGEN_C_API_H__ */
|
||||
|
55
intern/eigen/intern/matrix.cc
Normal file
55
intern/eigen/intern/matrix.cc
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2018 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __EIGEN3_MATRIX_C_API_CC__
|
||||
#define __EIGEN3_MATRIX_C_API_CC__
|
||||
|
||||
/* Eigen gives annoying huge amount of warnings here, silence them! */
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic ignored "-Wlogical-op"
|
||||
#endif
|
||||
|
||||
#ifdef __EIGEN3_MATRIX_C_API_CC__ /* quiet warning */
|
||||
#endif
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include "matrix.h"
|
||||
|
||||
using Eigen::Map;
|
||||
using Eigen::Matrix4f;
|
||||
|
||||
bool EIG_invert_m4_m4(float inverse[4][4], const float matrix[4][4])
|
||||
{
|
||||
Map<Matrix4f> M = Map<Matrix4f>((float*)matrix);
|
||||
Matrix4f R;
|
||||
bool invertible = true;
|
||||
M.computeInverseWithCheck(R, invertible, 0.0f);
|
||||
memcpy(inverse, R.data(), sizeof(float)*4*4);
|
||||
return invertible;
|
||||
}
|
||||
|
||||
#endif /* __EIGEN3_MATRIX_C_API_CC__ */
|
40
intern/eigen/intern/matrix.h
Normal file
40
intern/eigen/intern/matrix.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2015 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation,
|
||||
* Bastien Montagne
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __EIGEN3_MATRIX_C_API_H__
|
||||
#define __EIGEN3_MATRIX_C_API_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool EIG_invert_m4_m4(float inverse[4][4], const float matrix[4][4]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __EIGEN3_MATRIX_C_API_H__ */
|
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/SVD>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include "svd.h"
|
||||
|
||||
@@ -51,6 +52,8 @@ using Eigen::MatrixXf;
|
||||
using Eigen::VectorXf;
|
||||
using Eigen::Map;
|
||||
|
||||
using Eigen::Matrix4f;
|
||||
|
||||
void EIG_svd_square_matrix(const int size, const float *matrix, float *r_U, float *r_S, float *r_V)
|
||||
{
|
||||
/* Since our matrix is squared, we can use thinU/V. */
|
||||
|
@@ -33,4 +33,4 @@
|
||||
# define GWN_INLINE static __forceinline
|
||||
#else
|
||||
# define GWN_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__))
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -179,7 +179,7 @@ int GWN_batch_vertbuf_add_ex(
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we only make it this far if there is no room for another Gwn_VertBuf
|
||||
#if TRUST_NO_ONE
|
||||
assert(false);
|
||||
|
@@ -47,7 +47,7 @@ typedef struct {
|
||||
|
||||
GLuint vbo_id;
|
||||
GLuint vao_id;
|
||||
|
||||
|
||||
GLuint bound_program;
|
||||
const Gwn_ShaderInterface* shader_interface;
|
||||
Gwn_AttrBinding attrib_binding;
|
||||
|
@@ -280,7 +280,7 @@ elseif(WIN32)
|
||||
if(NOT WITH_GL_EGL)
|
||||
list(APPEND SRC
|
||||
intern/GHOST_ContextWGL.cpp
|
||||
|
||||
|
||||
intern/GHOST_ContextWGL.h
|
||||
)
|
||||
endif()
|
||||
@@ -307,7 +307,7 @@ endif()
|
||||
if(WITH_GL_EGL AND NOT (WITH_HEADLESS OR WITH_GHOST_SDL))
|
||||
list(APPEND SRC
|
||||
intern/GHOST_ContextEGL.cpp
|
||||
|
||||
|
||||
intern/GHOST_ContextEGL.h
|
||||
)
|
||||
endif()
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include "GHOST_Types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
|
||||
|
||||
/**
|
||||
* Installs a timer.
|
||||
* Note that, on most operating systems, messages need to be processed in order
|
||||
* Note that, on most operating systems, messages need to be processed in order
|
||||
* for the timer callbacks to be invoked.
|
||||
* \param systemhandle The handle to the system
|
||||
* \param delay The time to wait for the first call to the timerProc (in milliseconds)
|
||||
@@ -165,7 +165,7 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||
|
||||
/**
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param systemhandle The handle to the system
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
@@ -218,7 +218,7 @@ extern GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandl
|
||||
* \param windowhandle The handle to the window
|
||||
* \param userdata The window user data.
|
||||
*/
|
||||
extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
|
||||
extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
|
||||
GHOST_TUserDataPtr userdata);
|
||||
|
||||
/**
|
||||
@@ -488,7 +488,7 @@ extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle);
|
||||
extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle);
|
||||
|
||||
/**
|
||||
* Returns the window this event was generated on,
|
||||
* Returns the window this event was generated on,
|
||||
* or NULL if it is a 'system' event.
|
||||
* \param eventhandle The handle to the event
|
||||
* \return The generating window.
|
||||
@@ -566,7 +566,7 @@ extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
|
||||
/**
|
||||
* Returns the title displayed in the title bar. The title
|
||||
* should be free'd with free().
|
||||
*
|
||||
*
|
||||
* \param windowhandle The handle to the window
|
||||
* \return The title, free with free().
|
||||
*/
|
||||
|
@@ -42,8 +42,8 @@ class GHOST_IWindow;
|
||||
* Interface class for events received from GHOST.
|
||||
* You should not need to inherit this class. The system will pass these events
|
||||
* to the GHOST_IEventConsumer::processEvent() method of event consumers.<br>
|
||||
* Use the getType() method to retrieve the type of event and the getData()
|
||||
* method to get the event data out. Using the event type you can cast the
|
||||
* Use the getType() method to retrieve the type of event and the getData()
|
||||
* method to get the event data out. Using the event type you can cast the
|
||||
* event data to the correct event dat structure.
|
||||
* \see GHOST_IEventConsumer#processEvent
|
||||
* \see GHOST_TEventType
|
||||
@@ -73,18 +73,18 @@ public:
|
||||
virtual GHOST_TUns64 getTime() = 0;
|
||||
|
||||
/**
|
||||
* Returns the window this event was generated on,
|
||||
* Returns the window this event was generated on,
|
||||
* or NULL if it is a 'system' event.
|
||||
* \return The generating window.
|
||||
*/
|
||||
virtual GHOST_IWindow *getWindow() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the event data.
|
||||
* \return The event data.
|
||||
*/
|
||||
virtual GHOST_TEventDataPtr getData() = 0;
|
||||
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IEvent")
|
||||
#endif
|
||||
|
@@ -315,7 +315,7 @@ public:
|
||||
* \return The current status.
|
||||
*/
|
||||
virtual bool getFullScreen(void) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Native pixel size support (MacBook 'retina').
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -18,7 +18,7 @@
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
@@ -39,11 +39,11 @@
|
||||
/**
|
||||
* Interface for a timer task.
|
||||
* Timer tasks are created by the system and can be installed by the system.
|
||||
* After installation, the timer callback-procedure or "timerProc" will be called
|
||||
* After installation, the timer callback-procedure or "timerProc" will be called
|
||||
* periodically. You should not need to inherit this class. It is passed to the
|
||||
* application in the timer-callback.<br>
|
||||
* <br>
|
||||
* Note that GHOST processes timers in the UI thread. You should ask GHOST
|
||||
* Note that GHOST processes timers in the UI thread. You should ask GHOST
|
||||
* process messages in order for the timer-callbacks to be called.
|
||||
* \see GHOST_ISystem#installTimer
|
||||
* \see GHOST_TimerProcPtr
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
* \return The timer user data.
|
||||
*/
|
||||
virtual GHOST_TUserDataPtr getUserData() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Changes the time user data.
|
||||
* \param userData: The timer user data.
|
||||
|
@@ -361,7 +361,7 @@ public:
|
||||
*/
|
||||
virtual void endIME() = 0;
|
||||
#endif /* WITH_INPUT_IME */
|
||||
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IWindow")
|
||||
#endif
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include "GHOST_Types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GHOST_DECLARE_HANDLE(GHOST_SystemPathsHandle);
|
||||
@@ -79,7 +79,7 @@ extern const GHOST_TUns8 *GHOST_getBinaryDir(void);
|
||||
extern void GHOST_addToSystemRecentFiles(const char *filename);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -77,7 +77,7 @@ typedef enum {
|
||||
GHOST_kSuccess
|
||||
} GHOST_TSuccess;
|
||||
|
||||
/* Xtilt and Ytilt represent how much the pen is tilted away from
|
||||
/* Xtilt and Ytilt represent how much the pen is tilted away from
|
||||
* vertically upright in either the X or Y direction, with X and Y the
|
||||
* axes of the tablet surface.
|
||||
* In other words, Xtilt and Ytilt are components of a vector created by projecting
|
||||
@@ -190,12 +190,12 @@ typedef enum {
|
||||
GHOST_kEventWindowSize,
|
||||
GHOST_kEventWindowMove,
|
||||
GHOST_kEventWindowDPIHintChanged,
|
||||
|
||||
|
||||
GHOST_kEventDraggingEntered,
|
||||
GHOST_kEventDraggingUpdated,
|
||||
GHOST_kEventDraggingExited,
|
||||
GHOST_kEventDraggingDropDone,
|
||||
|
||||
|
||||
GHOST_kEventOpenMainFile, // Needed for Cocoa to open double-clicked .blend file at startup
|
||||
GHOST_kEventNativeResolutionChange, // Needed for Cocoa when window moves to other display
|
||||
|
||||
@@ -214,9 +214,9 @@ typedef enum {
|
||||
GHOST_kStandardCursorDefault = 0,
|
||||
GHOST_kStandardCursorRightArrow,
|
||||
GHOST_kStandardCursorLeftArrow,
|
||||
GHOST_kStandardCursorInfo,
|
||||
GHOST_kStandardCursorInfo,
|
||||
GHOST_kStandardCursorDestroy,
|
||||
GHOST_kStandardCursorHelp,
|
||||
GHOST_kStandardCursorHelp,
|
||||
GHOST_kStandardCursorCycle,
|
||||
GHOST_kStandardCursorSpray,
|
||||
GHOST_kStandardCursorWait,
|
||||
@@ -233,7 +233,7 @@ typedef enum {
|
||||
GHOST_kStandardCursorBottomRightCorner,
|
||||
GHOST_kStandardCursorBottomLeftCorner,
|
||||
GHOST_kStandardCursorCopy,
|
||||
GHOST_kStandardCursorCustom,
|
||||
GHOST_kStandardCursorCustom,
|
||||
GHOST_kStandardCursorPencil,
|
||||
|
||||
GHOST_kStandardCursorNumCursors
|
||||
@@ -247,7 +247,7 @@ typedef enum {
|
||||
GHOST_kKeyLinefeed,
|
||||
GHOST_kKeyClear,
|
||||
GHOST_kKeyEnter = 0x0D,
|
||||
|
||||
|
||||
GHOST_kKeyEsc = 0x1B,
|
||||
GHOST_kKeySpace = ' ',
|
||||
GHOST_kKeyQuote = 0x27,
|
||||
@@ -305,7 +305,7 @@ typedef enum {
|
||||
GHOST_kKeyBackslash = 0x5C,
|
||||
GHOST_kKeyAccentGrave = '`',
|
||||
|
||||
|
||||
|
||||
GHOST_kKeyLeftShift = 0x100,
|
||||
GHOST_kKeyRightShift,
|
||||
GHOST_kKeyLeftControl,
|
||||
@@ -377,7 +377,7 @@ typedef enum {
|
||||
GHOST_kKeyF22,
|
||||
GHOST_kKeyF23,
|
||||
GHOST_kKeyF24,
|
||||
|
||||
|
||||
// Multimedia keypad buttons
|
||||
GHOST_kKeyMediaPlay,
|
||||
GHOST_kKeyMediaStop,
|
||||
@@ -418,7 +418,7 @@ typedef enum {
|
||||
GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */
|
||||
GHOST_kTrackpadEventMagnify
|
||||
} GHOST_TTrackpadEventSubTypes;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/** The event subtype */
|
||||
|
@@ -38,7 +38,7 @@
|
||||
|
||||
/**
|
||||
* This struct stores the state of the mouse buttons.
|
||||
* Buttons can be set using button masks.
|
||||
* Buttons can be set using button masks.
|
||||
* \author Maarten Gribnau
|
||||
* \date May 15, 2001
|
||||
*/
|
||||
|
@@ -119,7 +119,7 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||
GHOST_TUns32 *height)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
|
||||
|
||||
system->getMainDisplayDimensions(*width, *height);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
|
||||
|
||||
return system->disposeWindow(window);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
|
||||
|
||||
return (int) system->validWindow(window);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
||||
bstereoVisual = true;
|
||||
else
|
||||
bstereoVisual = false;
|
||||
|
||||
|
||||
system->beginFullScreen(*setting, &window, bstereoVisual);
|
||||
|
||||
return (GHOST_WindowHandle)window;
|
||||
@@ -240,7 +240,7 @@ int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
|
||||
int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
|
||||
|
||||
return (int) system->processEvents(waitForEvent ? true : false);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent)
|
||||
void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
|
||||
|
||||
system->dispatchEvents();
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
|
||||
GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
|
||||
|
||||
return system->addEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle);
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
||||
GHOST_TInt32 *y)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
|
||||
|
||||
return system->getCursorPosition(*x, *y);
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
|
||||
GHOST_TInt32 y)
|
||||
{
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
|
||||
|
||||
return system->setCursorPosition(x, y);
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
GHOST_TSuccess result;
|
||||
bool isdown = false;
|
||||
|
||||
|
||||
result = system->getModifierKeyState(mask, isdown);
|
||||
*isDown = (int) isdown;
|
||||
|
||||
@@ -414,7 +414,7 @@ GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
|
||||
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||
GHOST_TSuccess result;
|
||||
bool isdown = false;
|
||||
|
||||
|
||||
result = system->getButtonState(mask, isdown);
|
||||
*isDown = (int) isdown;
|
||||
|
||||
@@ -441,7 +441,7 @@ void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 c
|
||||
GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
|
||||
{
|
||||
GHOST_IEvent *event = (GHOST_IEvent *) eventhandle;
|
||||
|
||||
|
||||
return event->getType();
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
|
||||
GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
|
||||
{
|
||||
GHOST_IEvent *event = (GHOST_IEvent *) eventhandle;
|
||||
|
||||
|
||||
return event->getData();
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
|
||||
GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
|
||||
{
|
||||
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||
|
||||
|
||||
return timertask->getTimerProc();
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
|
||||
GHOST_TimerProcPtr timerproc)
|
||||
{
|
||||
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||
|
||||
|
||||
timertask->setTimerProc(timerproc);
|
||||
}
|
||||
|
||||
@@ -504,13 +504,13 @@ void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
|
||||
GHOST_TUserDataPtr userdata)
|
||||
{
|
||||
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||
|
||||
|
||||
timertask->setUserData(userdata);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int GHOST_GetValid(GHOST_WindowHandle windowhandle)
|
||||
int GHOST_GetValid(GHOST_WindowHandle windowhandle)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
|
||||
@@ -542,7 +542,7 @@ void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
|
||||
const char *title)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
|
||||
|
||||
window->setTitle(title);
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ char *GHOST_GetTitle(GHOST_WindowHandle windowhandle)
|
||||
|
||||
|
||||
|
||||
GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
|
||||
GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
GHOST_Rect *rectangle = NULL;
|
||||
@@ -580,7 +580,7 @@ GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
|
||||
|
||||
|
||||
|
||||
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
|
||||
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
GHOST_Rect *rectangle = NULL;
|
||||
@@ -678,16 +678,16 @@ GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
|
||||
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, GHOST_TUns8 isUnsavedChanges)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
|
||||
|
||||
return window->setModifiedState(isUnsavedChanges);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
|
||||
GHOST_TWindowOrder order)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
|
||||
|
||||
return window->setOrder(order);
|
||||
}
|
||||
|
||||
@@ -725,7 +725,7 @@ GHOST_TUns16 GHOST_GetNumOfAASamples(GHOST_WindowHandle windowhandle)
|
||||
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||
|
||||
|
||||
return window->activateDrawingContext();
|
||||
}
|
||||
|
||||
|
@@ -158,7 +158,7 @@ private:
|
||||
const int m_contextResetNotificationStrategy;
|
||||
|
||||
HGLRC m_hGLRC;
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
const char *m_dummyVendor;
|
||||
const char *m_dummyRenderer;
|
||||
|
@@ -40,9 +40,9 @@
|
||||
# endif // DEBUG
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
# define GHOST_DEBUG // spit ghost events to stdout
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
# include <iostream>
|
||||
|
@@ -179,9 +179,9 @@ GHOST_DisplayManager::findMatch(
|
||||
best = score;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
match = m_settings[display][found];
|
||||
|
||||
|
||||
GHOST_PRINT("GHOST_DisplayManager::findMatch(): settings of match:\n");
|
||||
GHOST_PRINT(" setting.xPixels=" << match.xPixels << "\n");
|
||||
GHOST_PRINT(" setting.yPixels=" << match.yPixels << "\n");
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
* Constructor.
|
||||
*/
|
||||
GHOST_DisplayManager(void);
|
||||
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
GHOST_TInt32& numSettings) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param index The setting index to be returned.
|
||||
* \param setting The setting of the display device with this index.
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
GHOST_DisplaySetting& setting) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param setting The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
@@ -128,7 +128,7 @@ protected:
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess initializeSettings(void);
|
||||
|
||||
|
||||
/** Tells whether the list of display modes has been stored already. */
|
||||
bool m_settingsInitialized;
|
||||
/** The list with display settings for the main display. */
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param index The setting index to be returned.
|
||||
* \param setting The setting of the display device with this index.
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param setting The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
@@ -86,14 +86,14 @@ public:
|
||||
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const;
|
||||
|
||||
/**
|
||||
* Changes the current setting for this display device.
|
||||
* Changes the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param setting The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
//Do not cache values as OS X supports screen hot plug
|
||||
/** Cached number of displays. */
|
||||
//CGDisplayCount m_numDisplays;
|
||||
|
@@ -62,11 +62,11 @@ static BOOL get_dd(DWORD d, DISPLAY_DEVICE *dd)
|
||||
}
|
||||
|
||||
/*
|
||||
* When you call EnumDisplaySettings with iModeNum set to zero, the operating system
|
||||
* initializes and caches information about the display device. When you call
|
||||
* EnumDisplaySettings with iModeNum set to a non-zero value, the function returns
|
||||
* When you call EnumDisplaySettings with iModeNum set to zero, the operating system
|
||||
* initializes and caches information about the display device. When you call
|
||||
* EnumDisplaySettings with iModeNum set to a non-zero value, the function returns
|
||||
* the information that was cached the last time the function was called with iModeNum
|
||||
* set to zero.
|
||||
* set to zero.
|
||||
*/
|
||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const
|
||||
{
|
||||
@@ -98,9 +98,9 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display,
|
||||
setting.bpp = dm.dmBitsPerPel;
|
||||
/* When you call the EnumDisplaySettings function, the dmDisplayFrequency member
|
||||
* may return with the value 0 or 1. These values represent the display hardware's
|
||||
* default refresh rate. This default rate is typically set by switches on a display
|
||||
* card or computer motherboard, or by a configuration program that does not use
|
||||
* Win32 display functions such as ChangeDisplaySettings.
|
||||
* default refresh rate. This default rate is typically set by switches on a display
|
||||
* card or computer motherboard, or by a configuration program that does not use
|
||||
* Win32 display functions such as ChangeDisplaySettings.
|
||||
*/
|
||||
/* First, we tried to explicitly set the frequency to 60 if EnumDisplaySettings
|
||||
* returned 0 or 1 but this doesn't work since later on an exact match will
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param index The setting index to be returned.
|
||||
* \param setting The setting of the display device with this index.
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param setting The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const;
|
||||
|
||||
/**
|
||||
* Changes the current setting for this display device.
|
||||
* Changes the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param setting The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
|
@@ -158,7 +158,7 @@ getDisplaySetting(
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
|
||||
GHOST_TSuccess
|
||||
GHOST_DisplayManagerX11::
|
||||
getCurrentDisplaySetting(
|
||||
|
@@ -76,7 +76,7 @@ public:
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param index The setting index to be returned.
|
||||
* \param setting The setting of the display device with this index.
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Returns the current setting for this display device.
|
||||
* Returns the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param setting The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Changes the current setting for this display device.
|
||||
* Changes the current setting for this display device.
|
||||
* \param display The index of the display to query with 0 <= display < getNumDisplays().
|
||||
* \param setting The current setting of the display device with this index.
|
||||
* \return Indication of success.
|
||||
@@ -119,5 +119,5 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif //
|
||||
#endif //
|
||||
|
||||
|
@@ -29,7 +29,7 @@
|
||||
* \ingroup GHOST
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "GHOST_Debug.h"
|
||||
#include "GHOST_DropTargetWin32.h"
|
||||
#include <shellapi.h>
|
||||
@@ -59,7 +59,7 @@ GHOST_DropTargetWin32::~GHOST_DropTargetWin32()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* IUnknown::QueryInterface
|
||||
*/
|
||||
HRESULT __stdcall GHOST_DropTargetWin32::QueryInterface(REFIID riid, void **ppvObj)
|
||||
@@ -81,8 +81,8 @@ HRESULT __stdcall GHOST_DropTargetWin32::QueryInterface(REFIID riid, void **ppvO
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* IUnknown::AddRef
|
||||
/*
|
||||
* IUnknown::AddRef
|
||||
*/
|
||||
|
||||
ULONG __stdcall GHOST_DropTargetWin32::AddRef(void)
|
||||
@@ -90,13 +90,13 @@ ULONG __stdcall GHOST_DropTargetWin32::AddRef(void)
|
||||
return ::InterlockedIncrement(&m_cRef);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* IUnknown::Release
|
||||
*/
|
||||
ULONG __stdcall GHOST_DropTargetWin32::Release(void)
|
||||
{
|
||||
ULONG refs = ::InterlockedDecrement(&m_cRef);
|
||||
|
||||
|
||||
if (refs == 0) {
|
||||
delete this;
|
||||
return 0;
|
||||
@@ -106,7 +106,7 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Implementation of IDropTarget::DragEnter
|
||||
*/
|
||||
HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||
@@ -114,13 +114,13 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *pDataObject, DWO
|
||||
// we accept all drop by default
|
||||
m_window->setAcceptDragOperation(true);
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
|
||||
|
||||
m_draggedObjectType = getGhostType(pDataObject);
|
||||
m_system->pushDragDropEvent(GHOST_kEventDraggingEntered, m_draggedObjectType, m_window, pt.x, pt.y, NULL);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Implementation of IDropTarget::DragOver
|
||||
*/
|
||||
HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||
@@ -136,7 +136,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Implementation of IDropTarget::DragLeave
|
||||
*/
|
||||
HRESULT __stdcall GHOST_DropTargetWin32::DragLeave(void)
|
||||
@@ -147,7 +147,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragLeave(void)
|
||||
}
|
||||
|
||||
/* Implementation of IDropTarget::Drop
|
||||
* This function will not be called if pdwEffect is set to DROPEFFECT_NONE in
|
||||
* This function will not be called if pdwEffect is set to DROPEFFECT_NONE in
|
||||
* the implementation of IDropTarget::DragOver
|
||||
*/
|
||||
HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||
@@ -162,15 +162,15 @@ HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject *pDataObject, DWORD gr
|
||||
}
|
||||
if (data)
|
||||
m_system->pushDragDropEvent(GHOST_kEventDraggingDropDone, m_draggedObjectType, m_window, pt.x, pt.y, data);
|
||||
|
||||
|
||||
m_draggedObjectType = GHOST_kDragnDropTypeUnknown;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
|
||||
DWORD GHOST_DropTargetWin32::allowedDropEffect(DWORD dwAllowed)
|
||||
{
|
||||
DWORD dwEffect = DROPEFFECT_NONE;
|
||||
@@ -264,7 +264,7 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
|
||||
// Free up memory.
|
||||
::GlobalUnlock(stgmed.hGlobal);
|
||||
::ReleaseStgMedium(&stgmed);
|
||||
|
||||
|
||||
return strArray;
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
|
||||
if (pDataObject->QueryGetData(&fmtetc) == S_OK) {
|
||||
if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) {
|
||||
char *str = (char *)::GlobalLock(stgmed.hGlobal);
|
||||
|
||||
|
||||
tmp_string = (char *)::malloc(::strlen(str) + 1);
|
||||
if (!tmp_string) {
|
||||
::GlobalUnlock(stgmed.hGlobal);
|
||||
@@ -320,7 +320,7 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
|
||||
return tmp_string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
|
||||
0,
|
||||
NULL, NULL
|
||||
);
|
||||
|
||||
|
||||
if (!size) {
|
||||
#ifdef GHOST_DEBUG
|
||||
::printLastError();
|
||||
|
@@ -41,11 +41,11 @@ class GHOST_DropTargetWin32 : public IDropTarget
|
||||
{
|
||||
public:
|
||||
/* IUnknownd implementation.
|
||||
* Enables clients to get pointers to other interfaces on a given object
|
||||
* Enables clients to get pointers to other interfaces on a given object
|
||||
* through the QueryInterface method, and manage the existence of the object
|
||||
* through the AddRef and Release methods. All other COM interfaces are
|
||||
* inherited, directly or indirectly, from IUnknown. Therefore, the three
|
||||
* methods in IUnknown are the first entries in the VTable for every interface.
|
||||
* through the AddRef and Release methods. All other COM interfaces are
|
||||
* inherited, directly or indirectly, from IUnknown. Therefore, the three
|
||||
* methods in IUnknown are the first entries in the VTable for every interface.
|
||||
*/
|
||||
HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj);
|
||||
ULONG __stdcall AddRef(void);
|
||||
@@ -56,20 +56,20 @@ public:
|
||||
* provide drag-and-drop operations in your application. It contains methods
|
||||
* used in any application that can be a target for data during a
|
||||
* drag-and-drop operation. A drop-target application is responsible for:
|
||||
*
|
||||
*
|
||||
* - Determining the effect of the drop on the target application.
|
||||
* - Incorporating any valid dropped data when the drop occurs.
|
||||
* - Communicating target feedback to the source so the source application
|
||||
* can provide appropriate visual feedback such as setting the cursor.
|
||||
* - Implementing drag scrolling.
|
||||
* - Registering and revoking its application windows as drop targets.
|
||||
*
|
||||
* The IDropTarget interface contains methods that handle all these
|
||||
* responsibilities except registering and revoking the application window
|
||||
* as a drop target, for which you must call the RegisterDragDrop and the
|
||||
*
|
||||
* The IDropTarget interface contains methods that handle all these
|
||||
* responsibilities except registering and revoking the application window
|
||||
* as a drop target, for which you must call the RegisterDragDrop and the
|
||||
* RevokeDragDrop functions.
|
||||
*/
|
||||
|
||||
|
||||
HRESULT __stdcall DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
||||
HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
||||
HRESULT __stdcall DragLeave(void);
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
|
||||
/**
|
||||
* Convert Unicode to ANSI, replacing unconvertable chars with '?'.
|
||||
* The ANSI codepage is the system default codepage,
|
||||
* The ANSI codepage is the system default codepage,
|
||||
* and can change from system to system.
|
||||
* \param in LPCWSTR.
|
||||
* \param out char *. Is set to NULL on failure.
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
* \return The event type.
|
||||
*/
|
||||
GHOST_TEventType getType()
|
||||
{
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the window this event was generated on,
|
||||
* Returns the window this event was generated on,
|
||||
* or NULL if it is a 'system' event.
|
||||
* \return The generating window.
|
||||
*/
|
||||
|
@@ -41,9 +41,9 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* Drag & drop event
|
||||
*
|
||||
*
|
||||
* The dragging sequence is performed in four phases:
|
||||
*
|
||||
*
|
||||
* <li> Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started.
|
||||
* Already gives the object data type, and the entering mouse location
|
||||
*
|
||||
@@ -93,13 +93,13 @@ public:
|
||||
m_dragnDropEventData.data = data;
|
||||
m_data = &m_dragnDropEventData;
|
||||
}
|
||||
|
||||
|
||||
~GHOST_EventDragnDrop()
|
||||
{
|
||||
//Free the dropped object data
|
||||
if (m_dragnDropEventData.data == NULL)
|
||||
return;
|
||||
|
||||
|
||||
switch (m_dragnDropEventData.dataType) {
|
||||
case GHOST_kDragnDropTypeBitmap:
|
||||
IMB_freeImBuf((ImBuf *)m_dragnDropEventData.data);
|
||||
@@ -108,10 +108,10 @@ public:
|
||||
{
|
||||
GHOST_TStringArray *strArray = (GHOST_TStringArray *)m_dragnDropEventData.data;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < strArray->count; i++)
|
||||
free(strArray->strings[i]);
|
||||
|
||||
|
||||
free(strArray->strings);
|
||||
free(strArray);
|
||||
}
|
||||
@@ -124,8 +124,8 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
/** The x,y-coordinates of the cursor position. */
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
m_keyEventData.utf8_buf[0] = '\0';
|
||||
m_data = &m_keyEventData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* \param msec The time this event was generated.
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
else m_keyEventData.utf8_buf[0] = '\0';
|
||||
m_data = &m_keyEventData;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
/** The key event data. */
|
||||
GHOST_TEventKeyData m_keyEventData;
|
||||
|
@@ -127,7 +127,7 @@ GHOST_TSuccess GHOST_EventManager::addConsumer(GHOST_IEventConsumer *consumer)
|
||||
{
|
||||
GHOST_TSuccess success;
|
||||
GHOST_ASSERT(consumer, "invalid consumer");
|
||||
|
||||
|
||||
// Check to see whether the consumer is already in our list
|
||||
TConsumerVector::const_iterator iter = std::find(m_consumers.begin(), m_consumers.end(), consumer);
|
||||
|
||||
|
@@ -143,7 +143,7 @@ protected:
|
||||
|
||||
/** A stack with events. */
|
||||
typedef std::deque<GHOST_IEvent *> TEventStack;
|
||||
|
||||
|
||||
/** The event stack. */
|
||||
std::deque<GHOST_IEvent *> m_events;
|
||||
std::deque<GHOST_IEvent *> m_handled_events;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@@ -41,7 +41,7 @@
|
||||
bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
|
||||
{
|
||||
bool handled = true;
|
||||
|
||||
|
||||
GHOST_ASSERT(event, "event==0");
|
||||
|
||||
if (event->getType() == GHOST_kEventWindowUpdate) return false;
|
||||
@@ -95,7 +95,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
|
||||
std::cout << "GHOST_kEventKeyDown, key: " << str;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GHOST_kEventDraggingEntered:
|
||||
{
|
||||
GHOST_TEventDragnDropData *dragnDropData = (GHOST_TEventDragnDropData *)((GHOST_IEvent *)event)->getData();
|
||||
@@ -103,7 +103,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
|
||||
std::cout << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GHOST_kEventDraggingUpdated:
|
||||
{
|
||||
GHOST_TEventDragnDropData *dragnDropData = (GHOST_TEventDragnDropData *)((GHOST_IEvent *)event)->getData();
|
||||
@@ -118,7 +118,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
|
||||
std::cout << "GHOST_kEventDraggingExited, dragged object type : " << dragnDropData->dataType;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GHOST_kEventDraggingDropDone:
|
||||
{
|
||||
GHOST_TEventDragnDropData *dragnDropData = (GHOST_TEventDragnDropData *)((GHOST_IEvent *)event)->getData();
|
||||
@@ -148,14 +148,14 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
|
||||
case GHOST_kEventOpenMainFile:
|
||||
{
|
||||
GHOST_TEventDataPtr eventData = ((GHOST_IEvent *)event)->getData();
|
||||
|
||||
|
||||
if (eventData)
|
||||
std::cout << "GHOST_kEventOpenMainFile for path : " << (char *)eventData;
|
||||
else
|
||||
std::cout << "GHOST_kEventOpenMainFile with no path specified!!";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GHOST_kEventQuit:
|
||||
std::cout << "GHOST_kEventQuit";
|
||||
break;
|
||||
|
@@ -67,7 +67,7 @@ GHOST_TSuccess GHOST_ISystemPaths::create()
|
||||
# else
|
||||
m_systemPaths = new GHOST_SystemPathsUnix();
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
success = m_systemPaths != NULL ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
else {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GHOST_NDOFMANAGERUNIX_H__
|
||||
#define __GHOST_NDOFMANAGERUNIX_H__
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@@ -108,7 +108,7 @@ void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
|
||||
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h)
|
||||
{
|
||||
long w_2, h_2;
|
||||
|
||||
|
||||
w_2 = w >> 1;
|
||||
h_2 = h >> 1;
|
||||
m_l = cx - w_2;
|
||||
|
@@ -113,7 +113,7 @@ GHOST_TSuccess GHOST_System::disposeWindow(GHOST_IWindow *window)
|
||||
|
||||
/*
|
||||
* Remove all pending events for the window.
|
||||
*/
|
||||
*/
|
||||
if (m_windowManager->getWindowFound(window)) {
|
||||
m_eventManager->removeWindowEvents(window);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent *event)
|
||||
GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const
|
||||
{
|
||||
GHOST_ModifierKeys keys;
|
||||
// Get the state of all modifier keys
|
||||
// Get the state of all modifier keys
|
||||
GHOST_TSuccess success = getModifierKeys(keys);
|
||||
if (success) {
|
||||
// Isolate the state of the key requested
|
||||
@@ -306,7 +306,7 @@ GHOST_TSuccess GHOST_System::init()
|
||||
m_timerManager = new GHOST_TimerManager();
|
||||
m_windowManager = new GHOST_WindowManager();
|
||||
m_eventManager = new GHOST_EventManager();
|
||||
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
if (m_eventManager) {
|
||||
m_eventPrinter = new GHOST_EventPrinter();
|
||||
|
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
/**
|
||||
* Installs a timer.
|
||||
* Note that, on most operating systems, messages need to be processed in order
|
||||
* Note that, on most operating systems, messages need to be processed in order
|
||||
* for the timer callbacks to be invoked.
|
||||
* \param delay The time to wait for the first call to the timerProc (in milliseconds)
|
||||
* \param interval The interval between calls to the timerProc
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
/***************************************************************************************
|
||||
* Display/window management functionality
|
||||
***************************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Inherited from GHOST_ISystem but left pure virtual
|
||||
*
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
*/
|
||||
bool getFullScreen(void);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Native pixel size support (MacBook 'retina').
|
||||
* \return The pixel size in float.
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const;
|
||||
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
/***************************************************************************************
|
||||
* Access to 3D mouse.
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
*
|
||||
*/
|
||||
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Put data to the Clipboard
|
||||
* \param buffer The buffer to copy to the clipboard
|
||||
@@ -324,7 +324,7 @@ public:
|
||||
*/
|
||||
virtual bool supportsNativeDialogs(void);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Initialize the system.
|
||||
@@ -362,7 +362,7 @@ protected:
|
||||
/** The N-degree of freedom device manager */
|
||||
GHOST_NDOFManager *m_ndofManager;
|
||||
#endif
|
||||
|
||||
|
||||
/** Prints all the events. */
|
||||
#ifdef GHOST_DEBUG
|
||||
GHOST_EventPrinter *m_eventPrinter;
|
||||
@@ -370,7 +370,7 @@ protected:
|
||||
|
||||
/** Settings of the display before the display went fullscreen. */
|
||||
GHOST_DisplaySetting m_preFullScreenSetting;
|
||||
|
||||
|
||||
};
|
||||
|
||||
inline GHOST_TimerManager *GHOST_System::getTimerManager() const
|
||||
|
@@ -88,7 +88,7 @@ public:
|
||||
* \return The dimension of the main display.
|
||||
*/
|
||||
void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
|
||||
|
||||
|
||||
/** Returns the combine dimensions of all monitors.
|
||||
* \return The dimension of the workspace.
|
||||
*/
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
const bool exclusive = false,
|
||||
const GHOST_TEmbedderWindowID parentWindow = 0
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
@@ -152,19 +152,19 @@ public:
|
||||
* \return Indication of the presence of events.
|
||||
*/
|
||||
bool processEvents(bool waitForEvent);
|
||||
|
||||
|
||||
/**
|
||||
* Handle User request to quit, from Menu bar Quit, and Cmd+Q
|
||||
* Display alert panel if changes performed since last save
|
||||
*/
|
||||
GHOST_TUns8 handleQuitRequest();
|
||||
|
||||
|
||||
/**
|
||||
* Handle Cocoa openFile event
|
||||
* Display confirmation request panel if changes performed since last save
|
||||
*/
|
||||
bool handleOpenDocumentRequest(void *filepathStr);
|
||||
|
||||
|
||||
/**
|
||||
* Handles a drag'n'drop destination event. Called by GHOST_WindowCocoa window subclass
|
||||
* \param eventType The type of drag'n'drop event
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
*/
|
||||
GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,
|
||||
GHOST_WindowCocoa *window, int mouseX, int mouseY, void *data);
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* Cursor management functionality
|
||||
***************************************************************************************/
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
* \return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
* Access to mouse button and keyboard states.
|
||||
***************************************************************************************/
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
* \return Returns the selected buffer
|
||||
*/
|
||||
GHOST_TUns8 *getClipboard(bool selection) const;
|
||||
|
||||
|
||||
/**
|
||||
* Puts buffer to system clipboard
|
||||
* \param buffer The buffer to be copied
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
* \return Indication whether the event was handled.
|
||||
*/
|
||||
GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa *window);
|
||||
|
||||
|
||||
/**
|
||||
* Handles the Cocoa event telling the application has become active (again)
|
||||
* \return Indication whether the event was handled.
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
int toggleConsole(int action) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles a tablet event.
|
||||
* \param eventPtr An NSEvent pointer (casted to void* to enable compilation in standard C++)
|
||||
@@ -279,7 +279,7 @@ public:
|
||||
* \return Indication whether the event was handled.
|
||||
*/
|
||||
GHOST_TSuccess handleKeyEvent(void *eventPtr);
|
||||
|
||||
|
||||
/**
|
||||
* Informs if the system provides native dialogs (eg. confirm quit)
|
||||
*/
|
||||
@@ -303,19 +303,19 @@ protected:
|
||||
|
||||
/** Start time at initialization. */
|
||||
GHOST_TUns64 m_start_time;
|
||||
|
||||
|
||||
/** Event has been processed directly by Cocoa (or NDOF manager) and has sent a ghost event to be dispatched */
|
||||
bool m_outsideLoopEventProcessed;
|
||||
|
||||
|
||||
/** Raised window is not yet known by the window manager, so delay application become active event handling */
|
||||
bool m_needDelayedApplicationBecomeActiveEventProcessing;
|
||||
|
||||
|
||||
/** State of the modifiers. */
|
||||
GHOST_TUns32 m_modifierMask;
|
||||
|
||||
/** Ignores window size messages (when window is dragged). */
|
||||
bool m_ignoreWindowSizedMessages;
|
||||
|
||||
|
||||
/** Temporarily ignore momentum scroll events */
|
||||
bool m_ignoreMomentumScroll;
|
||||
/** Is the scroll wheel event generated by a multitouch trackpad or mouse? */
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -18,7 +18,7 @@
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -18,7 +18,7 @@
|
||||
* The Original Code is Copyright (C) 2010 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Contributor(s): Damien Plisson 2010
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -18,7 +18,7 @@
|
||||
* The Original Code is Copyright (C) 2010 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -18,7 +18,7 @@
|
||||
* The Original Code is Copyright (C) 2010 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
* this class should only be instanciated by GHOST_ISystem.
|
||||
*/
|
||||
GHOST_SystemPathsUnix();
|
||||
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* The Original Code is Copyright (C) 2011 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
* Andrea Weikert
|
||||
*
|
||||
|
@@ -240,7 +240,7 @@ GHOST_TUns64 GHOST_SystemWin32::getMilliSeconds() const
|
||||
__int64 delta = 1000 * (count - m_start);
|
||||
|
||||
GHOST_TUns64 t = (GHOST_TUns64)(delta / m_freq);
|
||||
return t;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
|
||||
#else
|
||||
GHOST_TUns64 next = timerMgr->nextFireTime();
|
||||
GHOST_TInt64 maxSleep = next - getMilliSeconds();
|
||||
|
||||
|
||||
if (next == GHOST_kFireTimeNever) {
|
||||
::WaitMessage();
|
||||
}
|
||||
@@ -469,17 +469,17 @@ GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys &keys) cons
|
||||
keys.set(GHOST_kModifierKeyLeftShift, down);
|
||||
down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0;
|
||||
keys.set(GHOST_kModifierKeyRightShift, down);
|
||||
|
||||
|
||||
down = HIBYTE(::GetKeyState(VK_LMENU)) != 0;
|
||||
keys.set(GHOST_kModifierKeyLeftAlt, down);
|
||||
down = HIBYTE(::GetKeyState(VK_RMENU)) != 0;
|
||||
keys.set(GHOST_kModifierKeyRightAlt, down);
|
||||
|
||||
|
||||
down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0;
|
||||
keys.set(GHOST_kModifierKeyLeftControl, down);
|
||||
down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0;
|
||||
keys.set(GHOST_kModifierKeyRightControl, down);
|
||||
|
||||
|
||||
bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
|
||||
bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
|
||||
if (lwindown || rwindown)
|
||||
@@ -512,7 +512,7 @@ GHOST_TSuccess GHOST_SystemWin32::getButtons(GHOST_Buttons &buttons) const
|
||||
GHOST_TSuccess GHOST_SystemWin32::init()
|
||||
{
|
||||
GHOST_TSuccess success = GHOST_System::init();
|
||||
|
||||
|
||||
/* Disable scaling on high DPI displays on Vista */
|
||||
HMODULE
|
||||
user32 = ::LoadLibraryA("user32.dll");
|
||||
@@ -542,12 +542,12 @@ GHOST_TSuccess GHOST_SystemWin32::init()
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = ::GetModuleHandle(0);
|
||||
wc.hIcon = ::LoadIcon(wc.hInstance, "APPICON");
|
||||
|
||||
|
||||
if (!wc.hIcon) {
|
||||
::LoadIcon(NULL, IDI_APPLICATION);
|
||||
}
|
||||
wc.hCursor = ::LoadCursor(0, IDC_ARROW);
|
||||
wc.hbrBackground =
|
||||
wc.hbrBackground =
|
||||
#ifdef INW32_COMPISITING
|
||||
(HBRUSH)CreateSolidBrush
|
||||
#endif
|
||||
@@ -560,7 +560,7 @@ GHOST_TSuccess GHOST_SystemWin32::init()
|
||||
success = GHOST_kFailure;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw, int *keyDown, char *v
|
||||
*keyDown = !(raw.data.keyboard.Flags & RI_KEY_BREAK) && msg != WM_KEYUP && msg != WM_SYSKEYUP;
|
||||
|
||||
key = this->convertKey(raw.data.keyboard.VKey, raw.data.keyboard.MakeCode, (raw.data.keyboard.Flags & (RI_KEY_E1 | RI_KEY_E0)));
|
||||
|
||||
|
||||
// extra handling of modifier keys: don't send repeats out from GHOST
|
||||
if (key >= GHOST_kKeyLeftShift && key <= GHOST_kKeyRightAlt) {
|
||||
bool changed = false;
|
||||
@@ -628,7 +628,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw, int *keyDown, char *v
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (changed) {
|
||||
modifiers.set(modifier, (bool)*keyDown);
|
||||
system->storeModifierKeys(modifiers);
|
||||
@@ -637,7 +637,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw, int *keyDown, char *v
|
||||
key = GHOST_kKeyUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (vk) *vk = raw.data.keyboard.VKey;
|
||||
|
||||
@@ -682,7 +682,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(short vKey, short scanCode, short exten
|
||||
switch (vKey) {
|
||||
case VK_RETURN:
|
||||
key = (extend) ? GHOST_kKeyNumpadEnter : GHOST_kKeyEnter; break;
|
||||
|
||||
|
||||
case VK_BACK: key = GHOST_kKeyBackSpace; break;
|
||||
case VK_TAB: key = GHOST_kKeyTab; break;
|
||||
case VK_ESCAPE: key = GHOST_kKeyEsc; break;
|
||||
@@ -782,7 +782,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(short vKey, short scanCode, short exten
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
|
||||
{
|
||||
GHOST_TInt32 x_screen, y_screen;
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *) getSystem();
|
||||
|
||||
|
||||
system->getCursorPosition(x_screen, y_screen);
|
||||
|
||||
/* TODO: CHECK IF THIS IS A TABLET EVENT */
|
||||
@@ -856,7 +856,7 @@ void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wPar
|
||||
|
||||
int acc = system->m_wheelDeltaAccum;
|
||||
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
|
||||
|
||||
if (acc * delta < 0) {
|
||||
// scroll direction reversed.
|
||||
acc = 0;
|
||||
@@ -864,7 +864,7 @@ void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wPar
|
||||
acc += delta;
|
||||
int direction = (acc >= 0) ? 1 : -1;
|
||||
acc = abs(acc);
|
||||
|
||||
|
||||
while (acc >= WHEEL_DELTA) {
|
||||
system->pushEvent(new GHOST_EventWheel(system->getMilliSeconds(), window, direction));
|
||||
acc -= WHEEL_DELTA;
|
||||
@@ -1178,10 +1178,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
*/
|
||||
case WM_DEADCHAR:
|
||||
/* The WM_DEADCHAR message is posted to the window with the keyboard focus when a
|
||||
* WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR
|
||||
* specifies a character code generated by a dead key. A dead key is a key that
|
||||
* generates a character, such as the umlaut (double-dot), that is combined with
|
||||
* another character to form a composite character. For example, the umlaut-O
|
||||
* WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR
|
||||
* specifies a character code generated by a dead key. A dead key is a key that
|
||||
* generates a character, such as the umlaut (double-dot), that is combined with
|
||||
* another character to form a composite character. For example, the umlaut-O
|
||||
* character (Ö) is generated by typing the dead key for the umlaut character, and
|
||||
* then typing the O key.
|
||||
*/
|
||||
@@ -1193,16 +1193,16 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* a dead key that is pressed while holding down the alt key.
|
||||
*/
|
||||
case WM_SYSCHAR:
|
||||
/* The WM_SYSCHAR message is sent to the window with the keyboard focus when
|
||||
* a WM_SYSCHAR message is translated by the TranslateMessage function.
|
||||
* WM_SYSCHAR specifies the character code of a dead key - that is,
|
||||
/* The WM_SYSCHAR message is sent to the window with the keyboard focus when
|
||||
* a WM_SYSCHAR message is translated by the TranslateMessage function.
|
||||
* WM_SYSCHAR specifies the character code of a dead key - that is,
|
||||
* a dead key that is pressed while holding down the alt key.
|
||||
* To prevent the sound, DefWindowProc must be avoided by return
|
||||
*/
|
||||
break;
|
||||
case WM_SYSCOMMAND:
|
||||
/* The WM_SYSCHAR message is sent to the window when system commands such as
|
||||
* maximize, minimize or close the window are triggered. Also it is sent when ALT
|
||||
/* The WM_SYSCHAR message is sent to the window when system commands such as
|
||||
* maximize, minimize or close the window are triggered. Also it is sent when ALT
|
||||
* button is press for menu. To prevent this we must return preventing DefWindowProc.
|
||||
*/
|
||||
if (wParam == SC_KEYMENU) {
|
||||
@@ -1269,11 +1269,11 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
break;
|
||||
case WM_MOUSEWHEEL:
|
||||
{
|
||||
/* The WM_MOUSEWHEEL message is sent to the focus window
|
||||
* when the mouse wheel is rotated. The DefWindowProc
|
||||
/* The WM_MOUSEWHEEL message is sent to the focus window
|
||||
* when the mouse wheel is rotated. The DefWindowProc
|
||||
* function propagates the message to the window's parent.
|
||||
* There should be no internal forwarding of the message,
|
||||
* since DefWindowProc propagates it up the parent chain
|
||||
* There should be no internal forwarding of the message,
|
||||
* since DefWindowProc propagates it up the parent chain
|
||||
* until it finds a window that processes it.
|
||||
*/
|
||||
|
||||
@@ -1281,7 +1281,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
POINT mouse_pos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
|
||||
HWND mouse_hwnd = ChildWindowFromPoint(HWND_DESKTOP, mouse_pos);
|
||||
GHOST_WindowWin32 *mouse_window = (GHOST_WindowWin32 *)::GetWindowLongPtr(mouse_hwnd, GWLP_USERDATA);
|
||||
|
||||
|
||||
processWheelEvent(mouse_window ? mouse_window : window , wParam, lParam);
|
||||
eventHandled = true;
|
||||
#ifdef BROKEN_PEEK_TOUCHPAD
|
||||
@@ -1293,7 +1293,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
/* The WM_SETCURSOR message is sent to a window if the mouse causes the cursor
|
||||
* to move within a window and mouse input is not captured.
|
||||
* This means we have to set the cursor shape every time the mouse moves!
|
||||
* The DefWindowProc function uses this message to set the cursor to an
|
||||
* The DefWindowProc function uses this message to set the cursor to an
|
||||
* arrow if it is not in the client area.
|
||||
*/
|
||||
if (LOWORD(lParam) == HTCLIENT) {
|
||||
@@ -1301,7 +1301,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
|
||||
// Bypass call to DefWindowProc
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Outside of client area show standard cursor
|
||||
window->loadCursor(true, GHOST_kStandardCursorDefault);
|
||||
@@ -1317,10 +1317,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* that contains the cursor. If a window has captured the mouse, this message is not posted.
|
||||
*/
|
||||
case WM_NCHITTEST:
|
||||
/* The WM_NCHITTEST message is sent to a window when the cursor moves, or
|
||||
* when a mouse button is pressed or released. If the mouse is not captured,
|
||||
* the message is sent to the window beneath the cursor. Otherwise, the message
|
||||
* is sent to the window that has captured the mouse.
|
||||
/* The WM_NCHITTEST message is sent to a window when the cursor moves, or
|
||||
* when a mouse button is pressed or released. If the mouse is not captured,
|
||||
* the message is sent to the window beneath the cursor. Otherwise, the message
|
||||
* is sent to the window that has captured the mouse.
|
||||
*/
|
||||
break;
|
||||
|
||||
@@ -1332,11 +1332,11 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
event = processWindowEvent(GHOST_kEventWindowClose, window);
|
||||
break;
|
||||
case WM_ACTIVATE:
|
||||
/* The WM_ACTIVATE message is sent to both the window being activated and the window being
|
||||
* deactivated. If the windows use the same input queue, the message is sent synchronously,
|
||||
/* The WM_ACTIVATE message is sent to both the window being activated and the window being
|
||||
* deactivated. If the windows use the same input queue, the message is sent synchronously,
|
||||
* first to the window procedure of the top-level window being deactivated, then to the window
|
||||
* procedure of the top-level window being activated. If the windows use different input queues,
|
||||
* the message is sent asynchronously, so the window is activated immediately.
|
||||
* the message is sent asynchronously, so the window is activated immediately.
|
||||
*/
|
||||
{
|
||||
GHOST_ModifierKeys modifiers;
|
||||
@@ -1353,12 +1353,12 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
break;
|
||||
}
|
||||
case WM_ENTERSIZEMOVE:
|
||||
/* The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving
|
||||
* or sizing modal loop. The window enters the moving or sizing modal loop when the user
|
||||
* clicks the window's title bar or sizing border, or when the window passes the
|
||||
* WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the
|
||||
* message specifies the SC_MOVE or SC_SIZE value. The operation is complete when
|
||||
* DefWindowProc returns.
|
||||
/* The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving
|
||||
* or sizing modal loop. The window enters the moving or sizing modal loop when the user
|
||||
* clicks the window's title bar or sizing border, or when the window passes the
|
||||
* WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the
|
||||
* message specifies the SC_MOVE or SC_SIZE value. The operation is complete when
|
||||
* DefWindowProc returns.
|
||||
*/
|
||||
window->m_inLiveResize = 1;
|
||||
break;
|
||||
@@ -1366,11 +1366,11 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
window->m_inLiveResize = 0;
|
||||
break;
|
||||
case WM_PAINT:
|
||||
/* An application sends the WM_PAINT message when the system or another application
|
||||
/* An application sends the WM_PAINT message when the system or another application
|
||||
* makes a request to paint a portion of an application's window. The message is sent
|
||||
* when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage
|
||||
* function when the application obtains a WM_PAINT message by using the GetMessage or
|
||||
* PeekMessage function.
|
||||
* when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage
|
||||
* function when the application obtains a WM_PAINT message by using the GetMessage or
|
||||
* PeekMessage function.
|
||||
*/
|
||||
if (!window->m_inLiveResize) {
|
||||
event = processWindowEvent(GHOST_kEventWindowUpdate, window);
|
||||
@@ -1381,10 +1381,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
}
|
||||
break;
|
||||
case WM_GETMINMAXINFO:
|
||||
/* The WM_GETMINMAXINFO message is sent to a window when the size or
|
||||
* position of the window is about to change. An application can use
|
||||
* this message to override the window's default maximized size and
|
||||
* position, or its default minimum or maximum tracking size.
|
||||
/* The WM_GETMINMAXINFO message is sent to a window when the size or
|
||||
* position of the window is about to change. An application can use
|
||||
* this message to override the window's default maximized size and
|
||||
* position, or its default minimum or maximum tracking size.
|
||||
*/
|
||||
processMinMaxInfo((MINMAXINFO *) lParam);
|
||||
/* Let DefWindowProc handle it. */
|
||||
@@ -1392,9 +1392,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
case WM_SIZING:
|
||||
case WM_SIZE:
|
||||
/* The WM_SIZE message is sent to a window after its size has changed.
|
||||
* The WM_SIZE and WM_MOVE messages are not sent if an application handles the
|
||||
* The WM_SIZE and WM_MOVE messages are not sent if an application handles the
|
||||
* WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient
|
||||
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
|
||||
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
|
||||
* message without calling DefWindowProc.
|
||||
*/
|
||||
/* we get first WM_SIZE before we fully init. So, do not dispatch before we continiously resizng */
|
||||
@@ -1415,10 +1415,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* and, if needed, change its size or position.
|
||||
*/
|
||||
case WM_MOVE:
|
||||
/* The WM_SIZE and WM_MOVE messages are not sent if an application handles the
|
||||
/* The WM_SIZE and WM_MOVE messages are not sent if an application handles the
|
||||
* WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient
|
||||
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
|
||||
* message without calling DefWindowProc.
|
||||
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
|
||||
* message without calling DefWindowProc.
|
||||
*/
|
||||
/* see WM_SIZE comment*/
|
||||
if (window->m_inLiveResize) {
|
||||
@@ -1487,13 +1487,13 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* that all child windows still exist.
|
||||
*/
|
||||
case WM_NCDESTROY:
|
||||
/* The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The
|
||||
/* The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The
|
||||
* DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY
|
||||
* message. WM_DESTROY is used to free the allocated memory object associated with the window.
|
||||
* message. WM_DESTROY is used to free the allocated memory object associated with the window.
|
||||
*/
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
|
||||
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
|
||||
* We want to prevent this if a window is still active and it loses focus to nowhere*/
|
||||
if (!wParam && hwnd == ::GetActiveWindow())
|
||||
::SetFocus(hwnd);
|
||||
@@ -1526,7 +1526,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* when a timer expires. You can process the message by providing a WM_TIMER
|
||||
* case in the window procedure. Otherwise, the default window procedure will
|
||||
* call the TimerProc callback function specified in the call to the SetTimer
|
||||
* function used to install the timer.
|
||||
* function used to install the timer.
|
||||
*
|
||||
* In GHOST, we let DefWindowProc call the timer callback.
|
||||
*/
|
||||
@@ -1565,7 +1565,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
GHOST_TUns8 *GHOST_SystemWin32::getClipboard(bool selection) const
|
||||
{
|
||||
char *temp_buff;
|
||||
|
||||
|
||||
if (IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL) ) {
|
||||
wchar_t *buffer;
|
||||
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
|
||||
@@ -1578,14 +1578,14 @@ GHOST_TUns8 *GHOST_SystemWin32::getClipboard(bool selection) const
|
||||
CloseClipboard();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
temp_buff = alloc_utf_8_from_16(buffer, 0);
|
||||
|
||||
|
||||
/* Buffer mustn't be accessed after CloseClipboard
|
||||
* it would like accessing free-d memory */
|
||||
GlobalUnlock(hData);
|
||||
CloseClipboard();
|
||||
|
||||
|
||||
return (GHOST_TUns8 *)temp_buff;
|
||||
}
|
||||
else if (IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
|
||||
@@ -1601,17 +1601,17 @@ GHOST_TUns8 *GHOST_SystemWin32::getClipboard(bool selection) const
|
||||
CloseClipboard();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
len = strlen(buffer);
|
||||
temp_buff = (char *) malloc(len + 1);
|
||||
strncpy(temp_buff, buffer, len);
|
||||
temp_buff[len] = '\0';
|
||||
|
||||
|
||||
/* Buffer mustn't be accessed after CloseClipboard
|
||||
* it would like accessing free-d memory */
|
||||
GlobalUnlock(hData);
|
||||
CloseClipboard();
|
||||
|
||||
|
||||
return (GHOST_TUns8 *)temp_buff;
|
||||
}
|
||||
else {
|
||||
@@ -1626,11 +1626,11 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
||||
if (OpenClipboard(NULL)) {
|
||||
HLOCAL clipbuffer;
|
||||
wchar_t *data;
|
||||
|
||||
|
||||
if (buffer) {
|
||||
size_t len = count_utf_16_from_8(buffer);
|
||||
EmptyClipboard();
|
||||
|
||||
|
||||
clipbuffer = LocalAlloc(LMEM_FIXED, sizeof(wchar_t) * len);
|
||||
data = (wchar_t *)GlobalLock(clipbuffer);
|
||||
|
||||
@@ -1686,7 +1686,7 @@ static bool getProcessName(int pid, char *buffer, int max_len)
|
||||
static bool isStartedFromCommandPrompt()
|
||||
{
|
||||
HWND hwnd = GetConsoleWindow();
|
||||
|
||||
|
||||
if (hwnd) {
|
||||
DWORD pid = (DWORD)-1;
|
||||
DWORD ppid = GetParentProcessID();
|
||||
|
@@ -110,7 +110,7 @@ public:
|
||||
|
||||
/**
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
* \return Indication of the presence of events.
|
||||
*/
|
||||
bool processEvents(bool waitForEvent);
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Cursor management functionality
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
* \return Returns the Clipboard
|
||||
*/
|
||||
GHOST_TUns8 *getClipboard(bool selection) const;
|
||||
|
||||
|
||||
/**
|
||||
* Puts buffer to system clipboard
|
||||
* \param selection Used by X11 only
|
||||
@@ -212,7 +212,7 @@ public:
|
||||
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
|
||||
|
||||
/**
|
||||
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
|
||||
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
|
||||
* Called by GHOST_DropTargetWin32 class.
|
||||
* \param eventType The type of drag'n'drop event
|
||||
* \param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
* \return Indication whether the event was handled.
|
||||
*/
|
||||
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_WindowWin32 *window, int mouseX, int mouseY, void *data);
|
||||
|
||||
|
||||
/**
|
||||
* Confirms quitting he program when there is just one window left open
|
||||
* in the application
|
||||
@@ -242,7 +242,7 @@ protected:
|
||||
* \return A success value.
|
||||
*/
|
||||
GHOST_TSuccess exit();
|
||||
|
||||
|
||||
/**
|
||||
* Converts raw WIN32 key codes from the wndproc to GHOST keys.
|
||||
* \param vKey The virtual key from hardKey
|
||||
@@ -303,7 +303,7 @@ protected:
|
||||
*/
|
||||
GHOST_TKey processSpecialKey(short vKey, short scanCode) const;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Creates a window event.
|
||||
* \param type The type of event to create.
|
||||
* \param window The window receiving the event (the active window).
|
||||
@@ -351,7 +351,7 @@ protected:
|
||||
* param keys The new state of the modifier keys.
|
||||
*/
|
||||
inline void storeModifierKeys(const GHOST_ModifierKeys& keys);
|
||||
|
||||
|
||||
/**
|
||||
* Check current key layout for AltGr
|
||||
*/
|
||||
@@ -373,7 +373,7 @@ protected:
|
||||
* \return current status (1 -visible, 0 - hidden)
|
||||
*/
|
||||
int toggleConsole(int action);
|
||||
|
||||
|
||||
/** The current state of the modifier keys. */
|
||||
GHOST_ModifierKeys m_modifierKeys;
|
||||
/** State variable set at initialization. */
|
||||
|
@@ -101,7 +101,12 @@
|
||||
* See T47228 and D1746 */
|
||||
#define USE_NON_LATIN_KB_WORKAROUND
|
||||
|
||||
static GHOST_TKey convertXKey(KeySym key);
|
||||
static GHOST_TKey ghost_key_from_keysym(
|
||||
const KeySym key);
|
||||
static GHOST_TKey ghost_key_from_keycode(
|
||||
const XkbDescPtr xkb_descr, const KeyCode keycode);
|
||||
static GHOST_TKey ghost_key_from_keysym_or_keycode(
|
||||
const KeySym key, const XkbDescPtr xkb_descr, const KeyCode keycode);
|
||||
|
||||
/* these are for copy and select copy */
|
||||
static char *txt_cut_buffer = NULL;
|
||||
@@ -117,11 +122,12 @@ GHOST_SystemX11::
|
||||
GHOST_SystemX11(
|
||||
)
|
||||
: GHOST_System(),
|
||||
m_xkb_descr(NULL),
|
||||
m_start_time(0)
|
||||
{
|
||||
XInitThreads();
|
||||
m_display = XOpenDisplay(NULL);
|
||||
|
||||
|
||||
if (!m_display) {
|
||||
std::cerr << "Unable to open a display" << std::endl;
|
||||
abort(); /* was return before, but this would just mean it will crash later */
|
||||
@@ -179,19 +185,24 @@ GHOST_SystemX11(
|
||||
if (gettimeofday(&tv, NULL) == -1) {
|
||||
GHOST_ASSERT(false, "Could not instantiate timer!");
|
||||
}
|
||||
|
||||
|
||||
/* Taking care not to overflow the tv.tv_sec * 1000 */
|
||||
m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000;
|
||||
|
||||
|
||||
|
||||
|
||||
/* use detectable autorepeate, mac and windows also do this */
|
||||
int use_xkb;
|
||||
int xkb_opcode, xkb_event, xkb_error;
|
||||
int xkb_major = XkbMajorVersion, xkb_minor = XkbMinorVersion;
|
||||
|
||||
|
||||
use_xkb = XkbQueryExtension(m_display, &xkb_opcode, &xkb_event, &xkb_error, &xkb_major, &xkb_minor);
|
||||
if (use_xkb) {
|
||||
XkbSetDetectableAutoRepeat(m_display, true, NULL);
|
||||
|
||||
m_xkb_descr = XkbGetMap(m_display, 0, XkbUseCoreKbd);
|
||||
if (m_xkb_descr) {
|
||||
XkbGetNames(m_display, XkbKeyNamesMask, m_xkb_descr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_XWAYLAND_HACK
|
||||
@@ -244,11 +255,15 @@ GHOST_SystemX11::
|
||||
/* close tablet devices */
|
||||
if (m_xtablet.StylusDevice)
|
||||
XCloseDevice(m_display, m_xtablet.StylusDevice);
|
||||
|
||||
|
||||
if (m_xtablet.EraserDevice)
|
||||
XCloseDevice(m_display, m_xtablet.EraserDevice);
|
||||
#endif /* WITH_X11_XINPUT */
|
||||
|
||||
if (m_xkb_descr) {
|
||||
XkbFreeNames(m_xkb_descr, XkbKeyNamesMask, false);
|
||||
}
|
||||
|
||||
XCloseDisplay(m_display);
|
||||
}
|
||||
|
||||
@@ -285,7 +300,7 @@ getMilliSeconds() const
|
||||
/* Taking care not to overflow the tv.tv_sec * 1000 */
|
||||
return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time;
|
||||
}
|
||||
|
||||
|
||||
GHOST_TUns8
|
||||
GHOST_SystemX11::
|
||||
getNumDisplays() const
|
||||
@@ -358,9 +373,9 @@ createWindow(const STR_String& title,
|
||||
const GHOST_TEmbedderWindowID parentWindow)
|
||||
{
|
||||
GHOST_WindowX11 *window = NULL;
|
||||
|
||||
|
||||
if (!m_display) return 0;
|
||||
|
||||
|
||||
window = new GHOST_WindowX11(this, m_display, title,
|
||||
left, top, width, height,
|
||||
state, parentWindow, type,
|
||||
@@ -386,7 +401,7 @@ createWindow(const STR_String& title,
|
||||
return window;
|
||||
}
|
||||
|
||||
bool GHOST_SystemX11::supportsNativeDialogs(void)
|
||||
bool GHOST_SystemX11::supportsNativeDialogs(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -516,7 +531,7 @@ GHOST_SystemX11::
|
||||
findGhostWindow(
|
||||
Window xwind) const
|
||||
{
|
||||
|
||||
|
||||
if (xwind == 0) return NULL;
|
||||
|
||||
/* It is not entirely safe to do this as the backptr may point
|
||||
@@ -528,7 +543,7 @@ findGhostWindow(
|
||||
|
||||
vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
|
||||
vector<GHOST_IWindow *>::const_iterator win_end = win_vec.end();
|
||||
|
||||
|
||||
for (; win_it != win_end; ++win_it) {
|
||||
GHOST_WindowX11 *window = static_cast<GHOST_WindowX11 *>(*win_it);
|
||||
if (window->getXWindow() == xwind) {
|
||||
@@ -536,14 +551,14 @@ findGhostWindow(
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void SleepTillEvent(Display *display, GHOST_TInt64 maxSleep)
|
||||
{
|
||||
int fd = ConnectionNumber(display);
|
||||
fd_set fds;
|
||||
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fd, &fds);
|
||||
|
||||
@@ -555,7 +570,7 @@ static void SleepTillEvent(Display *display, GHOST_TInt64 maxSleep)
|
||||
|
||||
tv.tv_sec = maxSleep / 1000;
|
||||
tv.tv_usec = (maxSleep - tv.tv_sec * 1000) * 1000;
|
||||
|
||||
|
||||
select(fd + 1, &fds, NULL, NULL, &tv);
|
||||
}
|
||||
}
|
||||
@@ -618,15 +633,15 @@ processEvents(
|
||||
{
|
||||
/* Get all the current events -- translate them into
|
||||
* ghost events and call base class pushEvent() method. */
|
||||
|
||||
|
||||
bool anyProcessed = false;
|
||||
|
||||
|
||||
do {
|
||||
GHOST_TimerManager *timerMgr = getTimerManager();
|
||||
|
||||
|
||||
if (waitForEvent && m_dirty_windows.empty() && !XPending(m_display)) {
|
||||
GHOST_TUns64 next = timerMgr->nextFireTime();
|
||||
|
||||
|
||||
if (next == GHOST_kFireTimeNever) {
|
||||
SleepTillEvent(m_display, -1);
|
||||
}
|
||||
@@ -637,11 +652,11 @@ processEvents(
|
||||
SleepTillEvent(m_display, next - getMilliSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (timerMgr->fireTimers(getMilliSeconds())) {
|
||||
anyProcessed = true;
|
||||
}
|
||||
|
||||
|
||||
while (XPending(m_display)) {
|
||||
XEvent xevent;
|
||||
XNextEvent(m_display, &xevent);
|
||||
@@ -669,10 +684,8 @@ processEvents(
|
||||
}
|
||||
|
||||
/* dispatch event to XIM server */
|
||||
if ((XFilterEvent(&xevent, (Window)NULL) == True) && (xevent.type != KeyRelease)) {
|
||||
/* do nothing now, the event is consumed by XIM.
|
||||
* however, KeyRelease event should be processed
|
||||
* here, otherwise modifiers remain activated. */
|
||||
if ((XFilterEvent(&xevent, (Window)NULL) == True)) {
|
||||
/* do nothing now, the event is consumed by XIM. */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@@ -726,7 +739,7 @@ processEvents(
|
||||
getMilliSeconds(),
|
||||
GHOST_kEventKeyDown,
|
||||
window,
|
||||
convertXKey(modifiers[i]),
|
||||
ghost_key_from_keysym(modifiers[i]),
|
||||
'\0',
|
||||
NULL));
|
||||
}
|
||||
@@ -738,7 +751,7 @@ processEvents(
|
||||
#endif /* USE_UNITY_WORKAROUND */
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (generateWindowExposeEvents()) {
|
||||
anyProcessed = true;
|
||||
}
|
||||
@@ -748,9 +761,9 @@ processEvents(
|
||||
anyProcessed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} while (waitForEvent && !anyProcessed);
|
||||
|
||||
|
||||
return anyProcessed;
|
||||
}
|
||||
|
||||
@@ -956,7 +969,6 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
{
|
||||
XKeyEvent *xke = &(xe->xkey);
|
||||
KeySym key_sym;
|
||||
KeySym key_sym_str;
|
||||
char ascii;
|
||||
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
|
||||
/* utf8_array[] is initial buffer used for Xutf8LookupString().
|
||||
@@ -971,7 +983,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
#else
|
||||
char *utf8_buf = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
GHOST_TEventType type = (xke->type == KeyPress) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
||||
|
||||
GHOST_TKey gkey;
|
||||
@@ -983,7 +995,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
* is unmodified (or anyone swapping the keys with xmodmap).
|
||||
*
|
||||
* - XLookupKeysym seems to always use first defined keymap (see T47228), which generates
|
||||
* keycodes unusable by convertXKey for non-latin-compatible keymaps.
|
||||
* keycodes unusable by ghost_key_from_keysym for non-latin-compatible keymaps.
|
||||
*
|
||||
* To address this, we:
|
||||
*
|
||||
@@ -1001,6 +1013,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
*
|
||||
* [1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/KeyBind.c
|
||||
*/
|
||||
KeySym key_sym_str;
|
||||
/* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled, we do not want to apply
|
||||
* that 'forced number' hack. */
|
||||
const unsigned int mode_switch_mask = XkbKeysymToModifiers(xke->display, XK_Mode_switch);
|
||||
@@ -1021,7 +1034,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
|
||||
/* Only allow a limited set of keys from XLookupKeysym, all others we take from XLookupString,
|
||||
* unless it gives unknown key... */
|
||||
gkey = convertXKey(key_sym);
|
||||
gkey = ghost_key_from_keysym_or_keycode(key_sym, m_xkb_descr, xke->keycode);
|
||||
switch (gkey) {
|
||||
case GHOST_kKeyRightAlt:
|
||||
case GHOST_kKeyLeftAlt:
|
||||
@@ -1058,10 +1071,12 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
case GHOST_kKeyNumpadSlash:
|
||||
break;
|
||||
default:
|
||||
GHOST_TKey gkey_str = convertXKey(key_sym_str);
|
||||
{
|
||||
GHOST_TKey gkey_str = ghost_key_from_keysym(key_sym_str);
|
||||
if (gkey_str != GHOST_kKeyUnknown) {
|
||||
gkey = gkey_str;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* In keyboards like latin ones,
|
||||
@@ -1083,8 +1098,8 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
key_sym = XLookupKeysym(xke, 0);
|
||||
}
|
||||
|
||||
gkey = convertXKey(key_sym);
|
||||
|
||||
gkey = ghost_key_from_keysym_or_keycode(key_sym, m_xkb_descr, xke->keycode);
|
||||
|
||||
if (!XLookupString(xke, &ascii, 1, NULL, NULL)) {
|
||||
ascii = '\0';
|
||||
}
|
||||
@@ -1178,7 +1193,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
if (utf8_buf != utf8_array)
|
||||
free(utf8_buf);
|
||||
#endif
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1187,7 +1202,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
{
|
||||
XButtonEvent & xbe = xe->xbutton;
|
||||
GHOST_TButtonMask gbmask = GHOST_kButtonMaskLeft;
|
||||
GHOST_TEventType type = (xbe.type == ButtonPress) ?
|
||||
GHOST_TEventType type = (xbe.type == ButtonPress) ?
|
||||
GHOST_kEventButtonDown : GHOST_kEventButtonUp;
|
||||
|
||||
/* process wheel mouse events and break, only pass on press events */
|
||||
@@ -1201,7 +1216,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
g_event = new GHOST_EventWheel(getMilliSeconds(), window, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* process rest of normal mouse buttons */
|
||||
if (xbe.button == Button1)
|
||||
gbmask = GHOST_kButtonMaskLeft;
|
||||
@@ -1233,13 +1248,13 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* change of size, border, layer etc. */
|
||||
case ConfigureNotify:
|
||||
{
|
||||
/* XConfigureEvent & xce = xe->xconfigure; */
|
||||
|
||||
g_event = new
|
||||
g_event = new
|
||||
GHOST_Event(
|
||||
getMilliSeconds(),
|
||||
GHOST_kEventWindowSize,
|
||||
@@ -1255,10 +1270,10 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
|
||||
/* TODO: make sure this is the correct place for activate/deactivate */
|
||||
// printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
|
||||
|
||||
|
||||
/* May have to look at the type of event and filter some out. */
|
||||
|
||||
GHOST_TEventType gtype = (xfe.type == FocusIn) ?
|
||||
GHOST_TEventType gtype = (xfe.type == FocusIn) ?
|
||||
GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate;
|
||||
|
||||
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
|
||||
@@ -1271,7 +1286,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
}
|
||||
#endif
|
||||
|
||||
g_event = new
|
||||
g_event = new
|
||||
GHOST_Event(
|
||||
getMilliSeconds(),
|
||||
gtype,
|
||||
@@ -1285,7 +1300,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
XClientMessageEvent & xcme = xe->xclient;
|
||||
|
||||
if (((Atom)xcme.data.l[0]) == m_atom.WM_DELETE_WINDOW) {
|
||||
g_event = new
|
||||
g_event = new
|
||||
GHOST_Event(
|
||||
getMilliSeconds(),
|
||||
GHOST_kEventWindowClose,
|
||||
@@ -1329,14 +1344,14 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case DestroyNotify:
|
||||
::exit(-1);
|
||||
/* We're not interested in the following things.(yet...) */
|
||||
case NoExpose:
|
||||
case GraphicsExpose:
|
||||
break;
|
||||
|
||||
|
||||
case EnterNotify:
|
||||
case LeaveNotify:
|
||||
{
|
||||
@@ -1349,7 +1364,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
*/
|
||||
XCrossingEvent &xce = xe->xcrossing;
|
||||
if (xce.mode == NotifyNormal) {
|
||||
g_event = new
|
||||
g_event = new
|
||||
GHOST_EventCursor(
|
||||
getMilliSeconds(),
|
||||
GHOST_kEventCursorMove,
|
||||
@@ -1397,18 +1412,18 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
XEvent nxe;
|
||||
Atom target, utf8_string, string, compound_text, c_string;
|
||||
XSelectionRequestEvent *xse = &xe->xselectionrequest;
|
||||
|
||||
|
||||
target = XInternAtom(m_display, "TARGETS", False);
|
||||
utf8_string = XInternAtom(m_display, "UTF8_STRING", False);
|
||||
string = XInternAtom(m_display, "STRING", False);
|
||||
compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
|
||||
c_string = XInternAtom(m_display, "C_STRING", False);
|
||||
|
||||
|
||||
/* support obsolete clients */
|
||||
if (xse->property == None) {
|
||||
xse->property = xse->target;
|
||||
}
|
||||
|
||||
|
||||
nxe.xselection.type = SelectionNotify;
|
||||
nxe.xselection.requestor = xse->requestor;
|
||||
nxe.xselection.property = xse->property;
|
||||
@@ -1416,7 +1431,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
nxe.xselection.selection = xse->selection;
|
||||
nxe.xselection.target = xse->target;
|
||||
nxe.xselection.time = xse->time;
|
||||
|
||||
|
||||
/* Check to see if the requestor is asking for String */
|
||||
if (xse->target == utf8_string ||
|
||||
xse->target == string ||
|
||||
@@ -1447,13 +1462,13 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
/* Change property to None because we do not support anything but STRING */
|
||||
nxe.xselection.property = None;
|
||||
}
|
||||
|
||||
|
||||
/* Send the event to the client 0 0 == False, SelectionNotify */
|
||||
XSendEvent(m_display, xse->requestor, 0, 0, &nxe);
|
||||
XFlush(m_display);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
{
|
||||
#ifdef WITH_X11_XINPUT
|
||||
@@ -1584,7 +1599,7 @@ getButtons(
|
||||
}
|
||||
else {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
}
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
@@ -1688,7 +1703,7 @@ setCursorPosition(
|
||||
#endif
|
||||
|
||||
XSync(m_display, 0); /* Sync to process all requests */
|
||||
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
@@ -1699,7 +1714,7 @@ addDirtyWindow(
|
||||
GHOST_WindowX11 *bad_wind)
|
||||
{
|
||||
GHOST_ASSERT((bad_wind != NULL), "addDirtyWindow() NULL ptr trapped (window)");
|
||||
|
||||
|
||||
m_dirty_windows.push_back(bad_wind);
|
||||
}
|
||||
|
||||
@@ -1711,7 +1726,7 @@ generateWindowExposeEvents()
|
||||
vector<GHOST_WindowX11 *>::iterator w_start = m_dirty_windows.begin();
|
||||
vector<GHOST_WindowX11 *>::const_iterator w_end = m_dirty_windows.end();
|
||||
bool anyProcessed = false;
|
||||
|
||||
|
||||
for (; w_start != w_end; ++w_start) {
|
||||
GHOST_Event *g_event = new
|
||||
GHOST_Event(
|
||||
@@ -1721,7 +1736,7 @@ generateWindowExposeEvents()
|
||||
);
|
||||
|
||||
(*w_start)->validate();
|
||||
|
||||
|
||||
if (g_event) {
|
||||
pushEvent(g_event);
|
||||
anyProcessed = true;
|
||||
@@ -1732,10 +1747,22 @@ generateWindowExposeEvents()
|
||||
return anyProcessed;
|
||||
}
|
||||
|
||||
static GHOST_TKey
|
||||
ghost_key_from_keysym_or_keycode(const KeySym keysym, XkbDescPtr xkb_descr, const KeyCode keycode)
|
||||
{
|
||||
GHOST_TKey type = ghost_key_from_keysym(keysym);
|
||||
if (type == GHOST_kKeyUnknown) {
|
||||
if (xkb_descr) {
|
||||
type = ghost_key_from_keycode(xkb_descr, keycode);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
#define GXMAP(k, x, y) case x: k = y; break
|
||||
|
||||
static GHOST_TKey
|
||||
convertXKey(KeySym key)
|
||||
ghost_key_from_keysym(const KeySym key)
|
||||
{
|
||||
GHOST_TKey type;
|
||||
|
||||
@@ -1844,6 +1871,9 @@ convertXKey(KeySym key)
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
#ifdef GHOST_DEBUG
|
||||
printf("%s: unknown key: %lu / 0x%lx\n", __func__, key, key);
|
||||
#endif
|
||||
type = GHOST_kKeyUnknown;
|
||||
break;
|
||||
}
|
||||
@@ -1854,6 +1884,33 @@ convertXKey(KeySym key)
|
||||
|
||||
#undef GXMAP
|
||||
|
||||
#define MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
|
||||
|
||||
static GHOST_TKey
|
||||
ghost_key_from_keycode(const XkbDescPtr xkb_descr, const KeyCode keycode)
|
||||
{
|
||||
GHOST_ASSERT(XkbKeyNameLength == 4, "Name length is invalid!");
|
||||
if (keycode >= xkb_descr->min_key_code && keycode <= xkb_descr->max_key_code) {
|
||||
const char *id_str = xkb_descr->names->keys[keycode].name;
|
||||
const uint32_t id = MAKE_ID(id_str[0], id_str[1], id_str[2], id_str[3]);
|
||||
switch (id) {
|
||||
case MAKE_ID('T', 'L', 'D', 'E'):
|
||||
return GHOST_kKeyAccentGrave;
|
||||
#ifdef GHOST_DEBUG
|
||||
default:
|
||||
printf("%s unhandled keycode: %.*s\n", __func__, XkbKeyNameLength, id_str);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
GHOST_ASSERT(false, "KeyCode out of range!");
|
||||
}
|
||||
return GHOST_kKeyUnknown;
|
||||
}
|
||||
|
||||
#undef MAKE_ID
|
||||
|
||||
/* from xclip.c xcout() v0.11 */
|
||||
|
||||
#define XCLIB_XCOUT_NONE 0 /* no context */
|
||||
@@ -2110,12 +2167,12 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
|
||||
unsigned char *tmp_data = (unsigned char *) malloc(sel_len + 1);
|
||||
memcpy((char *)tmp_data, (char *)sel_buf, sel_len);
|
||||
tmp_data[sel_len] = '\0';
|
||||
|
||||
|
||||
if (sseln == m_atom.STRING)
|
||||
XFree(sel_buf);
|
||||
else
|
||||
free(sel_buf);
|
||||
|
||||
|
||||
return tmp_data;
|
||||
}
|
||||
return(NULL);
|
||||
@@ -2156,7 +2213,7 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
||||
}
|
||||
|
||||
#ifdef WITH_XDND
|
||||
GHOST_TSuccess GHOST_SystemX11::pushDragDropEvent(GHOST_TEventType eventType,
|
||||
GHOST_TSuccess GHOST_SystemX11::pushDragDropEvent(GHOST_TEventType eventType,
|
||||
GHOST_TDragnDropTypes draggedObjectType,
|
||||
GHOST_IWindow *window,
|
||||
int mouseX, int mouseY,
|
||||
@@ -2322,7 +2379,7 @@ void GHOST_SystemX11::refreshXInputDevices()
|
||||
|
||||
for (int i = 0; i < device_count; ++i) {
|
||||
char *device_type = device_info[i].type ? XGetAtomName(m_display, device_info[i].type) : NULL;
|
||||
|
||||
|
||||
// printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
|
||||
|
||||
|
||||
@@ -2355,7 +2412,7 @@ void GHOST_SystemX11::refreshXInputDevices()
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ici = (XAnyClassPtr)(((char *)ici) + ici->length);
|
||||
}
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#define __GHOST_SYSTEMX11_H__
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/XKBlib.h> /* allow detectable autorepeate */
|
||||
|
||||
#include "GHOST_System.h"
|
||||
#include "../GHOST_Types.h"
|
||||
@@ -86,7 +87,7 @@ public:
|
||||
|
||||
GHOST_SystemX11(
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
@@ -114,7 +115,7 @@ public:
|
||||
GHOST_TUns64
|
||||
getMilliSeconds(
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of displays on this system.
|
||||
@@ -146,7 +147,7 @@ public:
|
||||
|
||||
/**
|
||||
* Create a new window.
|
||||
* The new window is added to the list of windows managed.
|
||||
* The new window is added to the list of windows managed.
|
||||
* Never explicitly delete the window, use disposeWindow() instead.
|
||||
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
|
||||
* \param left The coordinate of the left edge of the window.
|
||||
@@ -210,7 +211,7 @@ public:
|
||||
GHOST_TInt32& x,
|
||||
GHOST_TInt32& y
|
||||
) const;
|
||||
|
||||
|
||||
GHOST_TSuccess
|
||||
setCursorPosition(
|
||||
GHOST_TInt32 x,
|
||||
@@ -239,15 +240,15 @@ public:
|
||||
|
||||
/**
|
||||
* Flag a window as dirty. This will
|
||||
* generate a GHOST window update event on a call to processEvents()
|
||||
* generate a GHOST window update event on a call to processEvents()
|
||||
*/
|
||||
|
||||
void
|
||||
addDirtyWindow(
|
||||
GHOST_WindowX11 *bad_wind
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* return a pointer to the X11 display structure
|
||||
*/
|
||||
@@ -256,7 +257,7 @@ public:
|
||||
getXDisplay(
|
||||
) {
|
||||
return m_display;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
|
||||
XIM
|
||||
@@ -277,7 +278,7 @@ public:
|
||||
* \return Returns the Clipboard indicated by Flag
|
||||
*/
|
||||
GHOST_TUns8 *getClipboard(bool selection) const;
|
||||
|
||||
|
||||
/**
|
||||
* Puts buffer to system clipboard
|
||||
* \param buffer The buffer to copy to the clipboard
|
||||
@@ -287,14 +288,14 @@ public:
|
||||
|
||||
#ifdef WITH_XDND
|
||||
/**
|
||||
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
|
||||
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
|
||||
* Called by GHOST_DropTargetX11 class.
|
||||
* \param eventType The type of drag'n'drop event
|
||||
* \param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
|
||||
* \param mouseX x mouse coordinate (in window coordinates)
|
||||
* \param mouseY y mouse coordinate
|
||||
* \param window The window on which the event occurred
|
||||
* \return Indication whether the event was handled.
|
||||
* \return Indication whether the event was handled.
|
||||
*/
|
||||
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_IWindow *window, int mouseX, int mouseY, void *data);
|
||||
#endif
|
||||
@@ -373,6 +374,10 @@ public:
|
||||
private:
|
||||
|
||||
Display *m_display;
|
||||
|
||||
/* Use for scancode lookups. */
|
||||
XkbDescRec *m_xkb_descr;
|
||||
|
||||
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
|
||||
XIM m_xim;
|
||||
#endif
|
||||
|
@@ -87,7 +87,7 @@ typedef enum TBPFLAG {
|
||||
TBPF_PAUSED = 0x8,
|
||||
} TBPFLAG;
|
||||
|
||||
#define THBN_CLICKED 0x1800
|
||||
#define THBN_CLICKED 0x1800
|
||||
|
||||
extern "C" {
|
||||
const GUID IID_ITaskList3 = {0xEA1AFB91, 0x9E28, 0x4B86, {0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF}};
|
||||
|
@@ -127,4 +127,4 @@ void GHOST_TaskBarX11::set_progress_enabled(bool enabled)
|
||||
assert(is_valid());
|
||||
unity_set_progress_visible(handle, enabled ? 1 : 0);
|
||||
unity_event_loop(NULL, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -102,14 +102,14 @@ GHOST_TUns64 GHOST_TimerManager::nextFireTime()
|
||||
{
|
||||
GHOST_TUns64 smallest = GHOST_kFireTimeNever;
|
||||
TTimerVector::iterator iter;
|
||||
|
||||
|
||||
for (iter = m_timers.begin(); iter != m_timers.end(); ++iter) {
|
||||
GHOST_TUns64 next = (*iter)->getNext();
|
||||
|
||||
|
||||
if (next < smallest)
|
||||
smallest = next;
|
||||
}
|
||||
|
||||
|
||||
return smallest;
|
||||
}
|
||||
|
||||
|
@@ -90,11 +90,11 @@ public:
|
||||
|
||||
/**
|
||||
* Finds the soonest time the next timer would fire.
|
||||
* \return The soonest time the next timer would fire,
|
||||
* \return The soonest time the next timer would fire,
|
||||
* or GHOST_kFireTimeNever if no timers exist.
|
||||
*/
|
||||
GHOST_TUns64 nextFireTime();
|
||||
|
||||
|
||||
/**
|
||||
* Checks all timer tasks to see if they are expired and fires them if needed.
|
||||
* \param time The current time.
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
* \param start The timer start time.
|
||||
*/
|
||||
void setStart(GHOST_TUns64 start)
|
||||
{
|
||||
{
|
||||
m_start = start;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
* \param interval The timer interval.
|
||||
*/
|
||||
void setInterval(GHOST_TUns64 interval)
|
||||
{
|
||||
{
|
||||
m_interval = interval;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
* \param next The time the timerProc will be called.
|
||||
*/
|
||||
void setNext(GHOST_TUns64 next)
|
||||
{
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes the time user data.
|
||||
* \param userData: The timer user data.
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
* \param auxData The auxiliary storage room.
|
||||
*/
|
||||
void setAuxData(GHOST_TUns32 auxData)
|
||||
{
|
||||
{
|
||||
m_auxData = auxData;
|
||||
}
|
||||
|
||||
|
@@ -58,12 +58,12 @@ GHOST_Window::GHOST_Window(
|
||||
{
|
||||
m_isUnsavedChanges = false;
|
||||
m_canAcceptDragOperation = false;
|
||||
|
||||
|
||||
m_progressBarVisible = false;
|
||||
|
||||
|
||||
m_cursorGrabAccumPos[0] = 0;
|
||||
m_cursorGrabAccumPos[1] = 0;
|
||||
|
||||
|
||||
m_nativePixelSize = 1.0f;
|
||||
|
||||
m_fullScreen = state == GHOST_kWindowStateFullScreen;
|
||||
@@ -208,7 +208,7 @@ GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHO
|
||||
16, 16, hotX, hotY, 0, 1);
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
int sizex, int sizey, int hotX, int hotY,
|
||||
int fg_color, int bg_color)
|
||||
{
|
||||
@@ -234,7 +234,7 @@ bool GHOST_Window::canAcceptDragOperation() const
|
||||
GHOST_TSuccess GHOST_Window::setModifiedState(bool isUnsavedChanges)
|
||||
{
|
||||
m_isUnsavedChanges = isUnsavedChanges;
|
||||
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ class GHOST_Context;
|
||||
|
||||
/**
|
||||
* Platform independent implementation of GHOST_IWindow.
|
||||
* Dimensions are given in screen coordinates that are relative to the
|
||||
* Dimensions are given in screen coordinates that are relative to the
|
||||
* upper-left corner of the screen.
|
||||
* Implements part of the GHOST_IWindow interface and adds some methods to
|
||||
* be implemented by childs of this class.
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
* virtual GHOST_TSuccess activateDrawingContext() = 0;
|
||||
* virtual GHOST_TSuccess invalidate() = 0;
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* Closes the window and disposes resources allocated.
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
* Returns indication as to whether the window is valid.
|
||||
* \return The validity of the window.
|
||||
*/
|
||||
virtual bool getValid() const {
|
||||
virtual bool getValid() const {
|
||||
return m_context != NULL;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
* \return The associated OS object/handle
|
||||
*/
|
||||
virtual void *getOSWindow() const;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current cursor shape.
|
||||
* \return The current cursor shape.
|
||||
@@ -185,14 +185,14 @@ public:
|
||||
virtual GHOST_TSuccess setProgressBar(float /*progress*/) {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hides the progress bar in the icon
|
||||
*/
|
||||
virtual GHOST_TSuccess endProgressBar() {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the swap interval for swapBuffers.
|
||||
* \param interval The swap interval to use.
|
||||
@@ -216,26 +216,26 @@ public:
|
||||
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
||||
*/
|
||||
void setAcceptDragOperation(bool canAccept);
|
||||
|
||||
|
||||
/**
|
||||
* Returns acceptance of the dropped object
|
||||
* Usually called by the "object dropped" event handling function
|
||||
*/
|
||||
bool canAcceptDragOperation() const;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the window "modified" status, indicating unsaved changes
|
||||
* \param isUnsavedChanges Unsaved changes or not
|
||||
* \return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the window "modified" status, indicating unsaved changes
|
||||
* \return True if there are unsaved changes
|
||||
*/
|
||||
virtual bool getModifiedState();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the type of drawing context used in this window.
|
||||
* \return The current type of drawing context.
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes the window user data.
|
||||
* \param userData: The window user data.
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
{
|
||||
m_userData = userData;
|
||||
}
|
||||
|
||||
|
||||
float getNativePixelSize(void)
|
||||
{
|
||||
if (m_nativePixelSize > 0.0f)
|
||||
@@ -341,7 +341,7 @@ protected:
|
||||
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode /*mode*/) {
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the cursor shape on the window using
|
||||
* native window system calls.
|
||||
@@ -355,15 +355,15 @@ protected:
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
|
||||
GHOST_TUns8 mask[16][2],
|
||||
int hotX, int hotY) = 0;
|
||||
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
int szx, int szy, int hotX, int hotY, int fg, int bg) = 0;
|
||||
|
||||
GHOST_TSuccess releaseNativeHandles();
|
||||
|
||||
/** The drawing context installed in this window. */
|
||||
GHOST_TDrawingContextType m_drawingContextType;
|
||||
|
||||
|
||||
/** The window user data */
|
||||
GHOST_TUserDataPtr m_userData;
|
||||
|
||||
@@ -384,16 +384,16 @@ protected:
|
||||
|
||||
/** The current shape of the cursor */
|
||||
GHOST_TStandardCursor m_cursorShape;
|
||||
|
||||
|
||||
/** The presence of progress indicator with the application icon */
|
||||
bool m_progressBarVisible;
|
||||
|
||||
|
||||
/** The acceptance of the "drop candidate" of the current drag'n'drop operation */
|
||||
bool m_canAcceptDragOperation;
|
||||
|
||||
|
||||
/** Modified state : are there unsaved changes */
|
||||
bool m_isUnsavedChanges;
|
||||
|
||||
|
||||
/** Stores whether this is a full screen window. */
|
||||
bool m_fullScreen;
|
||||
|
||||
@@ -407,7 +407,7 @@ protected:
|
||||
GHOST_TUns32 m_fullScreenWidth;
|
||||
/** Full-screen height */
|
||||
GHOST_TUns32 m_fullScreenHeight;
|
||||
|
||||
|
||||
/* OSX only, retina screens */
|
||||
float m_nativePixelSize;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user