Merge lp:~compiz-team/compiz/compiz.gles into lp:compiz/0.9.8
- compiz.gles
- Merge into 0.9.8
Proposed by
Sam Spilsbury
Status: | Rejected |
---|---|
Rejected by: | Sam Spilsbury |
Proposed branch: | lp:~compiz-team/compiz/compiz.gles |
Merge into: | lp:compiz/0.9.8 |
Diff against target: |
13017 lines (+5133/-4363) 68 files modified
CMakeLists.txt (+3/-0) cmake/CMakeLists.txt (+2/-0) cmake/CompizCommon.cmake (+12/-0) cmake/CompizPlugin.cmake (+14/-10) cmake/FindOpenGLES2.cmake (+51/-0) cmake/base.cmake (+3/-1) cmake/plugin_extensions/CompizOpenGLFixups.cmake (+22/-0) gtk/config.h.gtk.in (+0/-25) gtk/window-decorator/actionmenu.c (+0/-133) gtk/window-decorator/blurprops.c (+0/-89) gtk/window-decorator/forcequit.c (+0/-201) gtk/window-decorator/gdk.c (+0/-106) gtk/window-decorator/style.c (+0/-66) gtk/window-decorator/util.c (+0/-299) plugins/annotate/src/annotate.cpp (+151/-73) plugins/blur/CMakeLists.txt (+12/-12) plugins/clone/src/clone.cpp (+0/-5) plugins/compiztoolbox/src/compiztoolbox.cpp (+14/-28) plugins/copytex/src/copytex.cpp (+9/-0) plugins/cube/CMakeLists.txt (+1/-1) plugins/cube/include/cube/cube.h (+9/-6) plugins/cube/src/cube.cpp (+85/-80) plugins/decor/src/decor.cpp (+34/-22) plugins/decor/src/decor.h (+3/-3) plugins/imgsvg/src/imgsvg.cpp (+12/-9) plugins/imgsvg/src/imgsvg.h (+2/-1) plugins/obs/src/obs.cpp (+9/-8) plugins/obs/src/obs.h (+1/-1) plugins/opengl/CMakeLists.txt (+9/-4) plugins/opengl/compiz-opengl.pc.in (+2/-2) plugins/opengl/include/opengl/fragment.h (+0/-125) plugins/opengl/include/opengl/framebufferobject.h (+107/-0) plugins/opengl/include/opengl/matrix.h (+2/-0) plugins/opengl/include/opengl/opengl.h (+264/-72) plugins/opengl/include/opengl/program.h (+75/-0) plugins/opengl/include/opengl/programcache.h (+51/-0) plugins/opengl/include/opengl/shadercache.h (+100/-0) plugins/opengl/include/opengl/texture.h (+5/-0) plugins/opengl/include/opengl/vector.h (+3/-3) plugins/opengl/include/opengl/vertexbuffer.h (+123/-0) plugins/opengl/src/fragment.cpp (+0/-1146) plugins/opengl/src/framebufferobject.cpp (+191/-0) plugins/opengl/src/matrix.cpp (+54/-0) plugins/opengl/src/paint.cpp (+410/-419) plugins/opengl/src/privatefragment.h (+0/-54) plugins/opengl/src/privates.h (+36/-11) plugins/opengl/src/privatetexture.h (+32/-0) plugins/opengl/src/privatevertexbuffer.h (+141/-0) plugins/opengl/src/program.cpp (+262/-0) plugins/opengl/src/programcache.cpp (+175/-0) plugins/opengl/src/screen.cpp (+548/-69) plugins/opengl/src/shadercache.cpp (+246/-0) plugins/opengl/src/texture.cpp (+136/-11) plugins/opengl/src/vector.cpp (+4/-4) plugins/opengl/src/vertexbuffer.cpp (+567/-0) plugins/opengl/src/window.cpp (+69/-84) plugins/resize/src/resize.cpp (+95/-39) plugins/rotate/CMakeLists.txt (+1/-1) plugins/scale/src/scale.cpp (+12/-24) plugins/screenshot/src/screenshot.cpp (+52/-25) plugins/switcher/src/switcher.cpp (+49/-48) plugins/water/CMakeLists.txt (+1/-1) plugins/water/src/shaders.h (+200/-0) plugins/water/src/water.cpp (+265/-803) plugins/water/src/water.h (+37/-67) plugins/water/water.xml.in (+26/-2) plugins/wobbly/src/wobbly.cpp (+334/-169) plugins/wobbly/src/wobbly.h (+0/-1) |
To merge this branch: | bzr merge lp:~compiz-team/compiz/compiz.gles |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Compiz Maintainers | Pending | ||
Review via email: mp+106096@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 3198. By Sam Spilsbury
-
Merged lp:compiz/0.9.8
- 3199. By Sam Spilsbury
-
Merge lp:compiz/0.9.8
- 3200. By Sam Spilsbury
-
Merge lp:compiz/0.9.8
- 3201. By Sam Spilsbury
-
Merge lp:compiz/0.9.8
Unmerged revisions
- 3201. By Sam Spilsbury
-
Merge lp:compiz/0.9.8
- 3200. By Sam Spilsbury
-
Merge lp:compiz/0.9.8
- 3199. By Sam Spilsbury
-
Merge lp:compiz/0.9.8
- 3198. By Sam Spilsbury
-
Merged lp:compiz/0.9.8
- 3197. By Sam Spilsbury
-
Merged branch gles into compiz-core
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2012-05-17 06:22:24 +0000 | |||
3 | +++ CMakeLists.txt 2012-05-17 07:01:21 +0000 | |||
4 | @@ -119,6 +119,9 @@ | |||
5 | 119 | DESTINATION ${COMPIZ_DESTDIR}${libdir}/pkgconfig | 119 | DESTINATION ${COMPIZ_DESTDIR}${libdir}/pkgconfig |
6 | 120 | ) | 120 | ) |
7 | 121 | 121 | ||
8 | 122 | # temporarily disable plugins that aren't ported yed | ||
9 | 123 | set (COMPIZ_DISABLE_PLUGIN_BLUR ON) | ||
10 | 124 | |||
11 | 122 | # Build Google Test and make its headers known | 125 | # Build Google Test and make its headers known |
12 | 123 | find_package (GTest) | 126 | find_package (GTest) |
13 | 124 | 127 | ||
14 | 125 | 128 | ||
15 | === modified file 'cmake/CMakeLists.txt' | |||
16 | --- cmake/CMakeLists.txt 2011-07-27 16:13:28 +0000 | |||
17 | +++ cmake/CMakeLists.txt 2012-05-17 07:01:21 +0000 | |||
18 | @@ -15,6 +15,8 @@ | |||
19 | 15 | plugin_extensions/CompizGenInstallData.cmake) | 15 | plugin_extensions/CompizGenInstallData.cmake) |
20 | 16 | list (APPEND _PluginExtensionFiles | 16 | list (APPEND _PluginExtensionFiles |
21 | 17 | plugin_extensions/CompizGenInstallImages.cmake) | 17 | plugin_extensions/CompizGenInstallImages.cmake) |
22 | 18 | list (APPEND _PluginExtensionFiles | ||
23 | 19 | plugin_extensions/CompizOpenGLFixups.cmake) | ||
24 | 18 | 20 | ||
25 | 19 | if (USE_GCONF) | 21 | if (USE_GCONF) |
26 | 20 | list (APPEND _files CompizGconf.cmake) | 22 | list (APPEND _files CompizGconf.cmake) |
27 | 21 | 23 | ||
28 | === modified file 'cmake/CompizCommon.cmake' | |||
29 | --- cmake/CompizCommon.cmake 2012-05-17 05:09:25 +0000 | |||
30 | +++ cmake/CompizCommon.cmake 2012-05-17 07:01:21 +0000 | |||
31 | @@ -18,6 +18,7 @@ | |||
32 | 18 | 18 | ||
33 | 19 | set (CMAKE_SKIP_RPATH FALSE) | 19 | set (CMAKE_SKIP_RPATH FALSE) |
34 | 20 | 20 | ||
35 | 21 | option (BUILD_GLES "Build against GLESv2 instead of GL" OFF) | ||
36 | 21 | option (COMPIZ_BUILD_WITH_RPATH "Leave as ON unless building packages" ON) | 22 | option (COMPIZ_BUILD_WITH_RPATH "Leave as ON unless building packages" ON) |
37 | 22 | option (COMPIZ_RUN_LDCONFIG "Leave OFF unless you need to run ldconfig after install") | 23 | option (COMPIZ_RUN_LDCONFIG "Leave OFF unless you need to run ldconfig after install") |
38 | 23 | option (COMPIZ_PACKAGING_ENABLED "Enable to manually set prefix, exec_prefix, libdir, includedir, datadir" OFF) | 24 | option (COMPIZ_PACKAGING_ENABLED "Enable to manually set prefix, exec_prefix, libdir, includedir, datadir" OFF) |
39 | @@ -75,6 +76,17 @@ | |||
40 | 75 | set(IS_BZR_REPO 0) | 76 | set(IS_BZR_REPO 0) |
41 | 76 | endif (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.bzr) | 77 | endif (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.bzr) |
42 | 77 | 78 | ||
43 | 79 | set (USE_GLES ${BUILD_GLES}) | ||
44 | 80 | |||
45 | 81 | if (USE_GLES) | ||
46 | 82 | find_package(OpenGLES2) | ||
47 | 83 | |||
48 | 84 | if (NOT OPENGLES2_FOUND) | ||
49 | 85 | set (USE_GLES 0) | ||
50 | 86 | message (SEND_ERROR "OpenGLESv2 not found") | ||
51 | 87 | endif (NOT OPENGLES2_FOUND) | ||
52 | 88 | endif (USE_GLES) | ||
53 | 89 | |||
54 | 78 | function (compiz_ensure_linkage) | 90 | function (compiz_ensure_linkage) |
55 | 79 | find_program (LDCONFIG_EXECUTABLE ldconfig) | 91 | find_program (LDCONFIG_EXECUTABLE ldconfig) |
56 | 80 | mark_as_advanced (FORCE LDCONFIG_EXECUTABLE) | 92 | mark_as_advanced (FORCE LDCONFIG_EXECUTABLE) |
57 | 81 | 93 | ||
58 | === modified file 'cmake/CompizPlugin.cmake' | |||
59 | --- cmake/CompizPlugin.cmake 2012-02-07 06:39:28 +0000 | |||
60 | +++ cmake/CompizPlugin.cmake 2012-05-17 07:01:21 +0000 | |||
61 | @@ -257,6 +257,16 @@ | |||
62 | 257 | NO_DEFAULT_PATH | 257 | NO_DEFAULT_PATH |
63 | 258 | ) | 258 | ) |
64 | 259 | 259 | ||
65 | 260 | set (COMPIZ_CURRENT_PLUGIN ${plugin}) | ||
66 | 261 | set (COMPIZ_CURRENT_XML_FILE ${_translated_xml}) | ||
67 | 262 | |||
68 | 263 | # find extension files | ||
69 | 264 | file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake") | ||
70 | 265 | |||
71 | 266 | foreach (_file ${_extension_files}) | ||
72 | 267 | include (${_file}) | ||
73 | 268 | endforeach () | ||
74 | 269 | |||
75 | 260 | # generate pkgconfig file and install it and the plugin header file | 270 | # generate pkgconfig file and install it and the plugin header file |
76 | 261 | if (_${plugin}_pkg AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}) | 271 | if (_${plugin}_pkg AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}) |
77 | 262 | if ("${PLUGIN_BUILDTYPE}" STREQUAL "local") | 272 | if ("${PLUGIN_BUILDTYPE}" STREQUAL "local") |
78 | @@ -269,11 +279,15 @@ | |||
79 | 269 | set (VERSION 0.0.1-git) | 279 | set (VERSION 0.0.1-git) |
80 | 270 | endif (NOT VERSION) | 280 | endif (NOT VERSION) |
81 | 271 | 281 | ||
82 | 282 | #add CFLAGSADD so pkg-config file has correct flags | ||
83 | 283 | set (COMPIZ_CFLAGS ${COMPIZ_CFLAGS} ${${_PLUGIN}_CFLAGSADD}) | ||
84 | 284 | |||
85 | 272 | compiz_configure_file ( | 285 | compiz_configure_file ( |
86 | 273 | ${_${plugin}_pkg} | 286 | ${_${plugin}_pkg} |
87 | 274 | ${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc | 287 | ${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc |
88 | 275 | COMPIZ_REQUIRES | 288 | COMPIZ_REQUIRES |
89 | 276 | COMPIZ_CFLAGS | 289 | COMPIZ_CFLAGS |
90 | 290 | PKGCONFIG_LIBS | ||
91 | 277 | ) | 291 | ) |
92 | 278 | 292 | ||
93 | 279 | install ( | 293 | install ( |
94 | @@ -287,16 +301,6 @@ | |||
95 | 287 | endif () | 301 | endif () |
96 | 288 | endif () | 302 | endif () |
97 | 289 | 303 | ||
98 | 290 | set (COMPIZ_CURRENT_PLUGIN ${plugin}) | ||
99 | 291 | set (COMPIZ_CURRENT_XML_FILE ${_translated_xml}) | ||
100 | 292 | |||
101 | 293 | # find extension files | ||
102 | 294 | file (GLOB _extension_files "${COMPIZ_CMAKE_MODULE_PATH}/plugin_extensions/*.cmake") | ||
103 | 295 | |||
104 | 296 | foreach (_file ${_extension_files}) | ||
105 | 297 | include (${_file}) | ||
106 | 298 | endforeach () | ||
107 | 299 | |||
108 | 300 | # find files for build | 304 | # find files for build |
109 | 301 | file (GLOB _h_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h") | 305 | file (GLOB _h_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h") |
110 | 302 | file (GLOB _h_ins_files "${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}/*.h") | 306 | file (GLOB _h_ins_files "${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}/*.h") |
111 | 303 | 307 | ||
112 | === added file 'cmake/FindOpenGLES2.cmake' | |||
113 | --- cmake/FindOpenGLES2.cmake 1970-01-01 00:00:00 +0000 | |||
114 | +++ cmake/FindOpenGLES2.cmake 2012-05-17 07:01:21 +0000 | |||
115 | @@ -0,0 +1,51 @@ | |||
116 | 1 | # - Try to find OpenGLES | ||
117 | 2 | # Once done this will define | ||
118 | 3 | # | ||
119 | 4 | # OPENGLES2_FOUND - system has OpenGLES | ||
120 | 5 | # OPENGLES2_INCLUDE_DIR - the GLES include directory | ||
121 | 6 | # OPENGLES2_LIBRARY - the GLES library | ||
122 | 7 | # OPENGLES2_LIBRARIES - Link this to use OpenGLES | ||
123 | 8 | # | ||
124 | 9 | |||
125 | 10 | FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h | ||
126 | 11 | /usr/openwin/share/include | ||
127 | 12 | /opt/graphics/OpenGL/include /usr/X11R6/include | ||
128 | 13 | /usr/include | ||
129 | 14 | ) | ||
130 | 15 | |||
131 | 16 | FIND_LIBRARY(OPENGLES2_LIBRARY | ||
132 | 17 | NAMES GLESv2 | ||
133 | 18 | PATHS /opt/graphics/OpenGL/lib | ||
134 | 19 | /usr/openwin/lib | ||
135 | 20 | /usr/shlib /usr/X11R6/lib | ||
136 | 21 | /usr/lib | ||
137 | 22 | ) | ||
138 | 23 | |||
139 | 24 | FIND_LIBRARY(OPENGLES2_EGL_LIBRARY | ||
140 | 25 | NAMES EGL | ||
141 | 26 | PATHS /usr/shlib /usr/X11R6/lib | ||
142 | 27 | /usr/lib | ||
143 | 28 | ) | ||
144 | 29 | |||
145 | 30 | # On Unix OpenGL most certainly always requires X11. | ||
146 | 31 | # Feel free to tighten up these conditions if you don't | ||
147 | 32 | # think this is always true. | ||
148 | 33 | # It's not true on OSX. | ||
149 | 34 | |||
150 | 35 | IF (OPENGLES2_LIBRARY) | ||
151 | 36 | IF(NOT X11_FOUND) | ||
152 | 37 | INCLUDE(FindX11) | ||
153 | 38 | ENDIF(NOT X11_FOUND) | ||
154 | 39 | IF (X11_FOUND) | ||
155 | 40 | IF (NOT APPLE) | ||
156 | 41 | SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES}) | ||
157 | 42 | ENDIF (NOT APPLE) | ||
158 | 43 | ENDIF (X11_FOUND) | ||
159 | 44 | ENDIF(OPENGLES2_LIBRARY) | ||
160 | 45 | |||
161 | 46 | SET( OPENGLES2_FOUND "NO" ) | ||
162 | 47 | IF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY) | ||
163 | 48 | SET( OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${OPENGLES2_EGL_LIBRARY} ${OPENGLES2_LIBRARIES}) | ||
164 | 49 | SET( OPENGLES2_FOUND "YES" ) | ||
165 | 50 | ENDIF(OPENGLES2_LIBRARY AND OPENGLES2_EGL_LIBRARY) | ||
166 | 51 | |||
167 | 0 | 52 | ||
168 | === modified file 'cmake/base.cmake' | |||
169 | --- cmake/base.cmake 2011-07-27 16:13:28 +0000 | |||
170 | +++ cmake/base.cmake 2012-05-17 07:01:21 +0000 | |||
171 | @@ -24,6 +24,7 @@ | |||
172 | 24 | compiz_print_configure_header ("Compiz") | 24 | compiz_print_configure_header ("Compiz") |
173 | 25 | compiz_color_message ("\n${_escape}[4mOptional features:${_escape}[0m\n") | 25 | compiz_color_message ("\n${_escape}[4mOptional features:${_escape}[0m\n") |
174 | 26 | 26 | ||
175 | 27 | compiz_print_result_message ("GLESv2" USE_GLES) | ||
176 | 27 | compiz_print_result_message ("gtk window decorator" USE_GTK) | 28 | compiz_print_result_message ("gtk window decorator" USE_GTK) |
177 | 28 | compiz_print_result_message ("metacity theme support" USE_METACITY) | 29 | compiz_print_result_message ("metacity theme support" USE_METACITY) |
178 | 29 | compiz_print_result_message ("gconf schemas" USE_GCONF) | 30 | compiz_print_result_message ("gconf schemas" USE_GCONF) |
179 | @@ -46,7 +47,8 @@ | |||
180 | 46 | endif () | 47 | endif () |
181 | 47 | add_custom_target (findcompiz_install | 48 | add_custom_target (findcompiz_install |
182 | 48 | ${CMAKE_COMMAND} -E make_directory ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules && | 49 | ${CMAKE_COMMAND} -E make_directory ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules && |
184 | 49 | ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules | 50 | ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules && |
185 | 51 | ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindOpenGLES2.cmake ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules | ||
186 | 50 | ) | 52 | ) |
187 | 51 | endfunction () | 53 | endfunction () |
188 | 52 | 54 | ||
189 | 53 | 55 | ||
190 | === added file 'cmake/plugin_extensions/CompizOpenGLFixups.cmake' | |||
191 | --- cmake/plugin_extensions/CompizOpenGLFixups.cmake 1970-01-01 00:00:00 +0000 | |||
192 | +++ cmake/plugin_extensions/CompizOpenGLFixups.cmake 2012-05-17 07:01:21 +0000 | |||
193 | @@ -0,0 +1,22 @@ | |||
194 | 1 | |||
195 | 2 | # modify pkg-config libs for opengl based on if we found GLES or not | ||
196 | 3 | if (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl") | ||
197 | 4 | if (USE_GLES) | ||
198 | 5 | set (PKGCONFIG_LIBS "-lGLESv2 -lEGL") | ||
199 | 6 | else (USE_GLES) | ||
200 | 7 | set (PKGCONFIG_LIBS "-lGL") | ||
201 | 8 | endif (USE_GLES) | ||
202 | 9 | endif (${COMPIZ_CURRENT_PLUGIN} STREQUAL "opengl") | ||
203 | 10 | |||
204 | 11 | # if plugin is using opengl plugin check for GLES library and set correct define | ||
205 | 12 | if (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "") | ||
206 | 13 | string (REGEX MATCH "opengl" opengl_found ${${_PLUGIN}_PLUGINDEPS}) | ||
207 | 14 | |||
208 | 15 | if (opengl_found STREQUAL "opengl") | ||
209 | 16 | if (USE_GLES) | ||
210 | 17 | set (${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD} " -DUSE_GLES") | ||
211 | 18 | string (REPLACE ";" " " ${_PLUGIN}_CFLAGSADD ${${_PLUGIN}_CFLAGSADD}) | ||
212 | 19 | endif (USE_GLES) | ||
213 | 20 | endif (opengl_found STREQUAL "opengl") | ||
214 | 21 | endif (NOT "${${_PLUGIN}_PLUGINDEPS}" STREQUAL "") | ||
215 | 22 | |||
216 | 0 | 23 | ||
217 | === added file 'gtk/config.h.gtk.in' | |||
218 | --- gtk/config.h.gtk.in 1970-01-01 00:00:00 +0000 | |||
219 | +++ gtk/config.h.gtk.in 2012-05-17 07:01:21 +0000 | |||
220 | @@ -0,0 +1,25 @@ | |||
221 | 1 | /* Define to 1 if Metacity support is enabled */ | ||
222 | 2 | #cmakedefine USE_METACITY 1 | ||
223 | 3 | |||
224 | 4 | /* Define to 1 if Gconf support is enabled */ | ||
225 | 5 | #cmakedefine USE_GCONF 1 | ||
226 | 6 | |||
227 | 7 | /* Define to 1 if you have the `wnck_window_has_name' function. */ | ||
228 | 8 | #cmakedefine HAVE_WNCK_WINDOW_HAS_NAME 1 | ||
229 | 9 | |||
230 | 10 | /* Define to 1 if libwnck version >= 2_18_1 */ | ||
231 | 11 | #cmakedefine HAVE_LIBWNCK_2_18_1 1 | ||
232 | 12 | |||
233 | 13 | /* Define to 1 if libwnck version >= 2_19_4 */ | ||
234 | 14 | #cmakedefine HAVE_LIBWNCK_2_19_4 1 | ||
235 | 15 | |||
236 | 16 | /* Define to 1 if metacity version >= 2.15.21 */ | ||
237 | 17 | #cmakedefine HAVE_METACITY_2_15_21 1 | ||
238 | 18 | |||
239 | 19 | /* Define to 1 if metacity version >= 2.17.0 */ | ||
240 | 20 | #cmakedefine HAVE_METACITY_2_17_0 1 | ||
241 | 21 | |||
242 | 22 | /* Define to 1 if metacity version >= 2.23.2 */ | ||
243 | 23 | #cmakedefine HAVE_METACITY_2_23_2 1 | ||
244 | 24 | |||
245 | 25 | #define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}" | ||
246 | 0 | 26 | ||
247 | === removed file 'gtk/config.h.gtk.in' | |||
248 | --- gtk/config.h.gtk.in 2008-10-14 10:27:55 +0000 | |||
249 | +++ gtk/config.h.gtk.in 1970-01-01 00:00:00 +0000 | |||
250 | @@ -1,25 +0,0 @@ | |||
251 | 1 | /* Define to 1 if Metacity support is enabled */ | ||
252 | 2 | #cmakedefine USE_METACITY 1 | ||
253 | 3 | |||
254 | 4 | /* Define to 1 if Gconf support is enabled */ | ||
255 | 5 | #cmakedefine USE_GCONF 1 | ||
256 | 6 | |||
257 | 7 | /* Define to 1 if you have the `wnck_window_has_name' function. */ | ||
258 | 8 | #cmakedefine HAVE_WNCK_WINDOW_HAS_NAME 1 | ||
259 | 9 | |||
260 | 10 | /* Define to 1 if libwnck version >= 2_18_1 */ | ||
261 | 11 | #cmakedefine HAVE_LIBWNCK_2_18_1 1 | ||
262 | 12 | |||
263 | 13 | /* Define to 1 if libwnck version >= 2_19_4 */ | ||
264 | 14 | #cmakedefine HAVE_LIBWNCK_2_19_4 1 | ||
265 | 15 | |||
266 | 16 | /* Define to 1 if metacity version >= 2.15.21 */ | ||
267 | 17 | #cmakedefine HAVE_METACITY_2_15_21 1 | ||
268 | 18 | |||
269 | 19 | /* Define to 1 if metacity version >= 2.17.0 */ | ||
270 | 20 | #cmakedefine HAVE_METACITY_2_17_0 1 | ||
271 | 21 | |||
272 | 22 | /* Define to 1 if metacity version >= 2.23.2 */ | ||
273 | 23 | #cmakedefine HAVE_METACITY_2_23_2 1 | ||
274 | 24 | |||
275 | 25 | #define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}" | ||
276 | 26 | 0 | ||
277 | === added file 'gtk/window-decorator/actionmenu.c' | |||
278 | --- gtk/window-decorator/actionmenu.c 1970-01-01 00:00:00 +0000 | |||
279 | +++ gtk/window-decorator/actionmenu.c 2012-05-17 07:01:21 +0000 | |||
280 | @@ -0,0 +1,133 @@ | |||
281 | 1 | /* | ||
282 | 2 | * Copyright © 2006 Novell, Inc. | ||
283 | 3 | * | ||
284 | 4 | * This library is free software; you can redistribute it and/or | ||
285 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
286 | 6 | * License as published by the Free Software Foundation; either | ||
287 | 7 | * version 2 of the License, or (at your option) any later version. | ||
288 | 8 | * | ||
289 | 9 | * This library is distributed in the hope that it will be useful, | ||
290 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
291 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
292 | 12 | * Lesser General Public License for more details. | ||
293 | 13 | * | ||
294 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
295 | 15 | * License along with this library; if not, write to the | ||
296 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
297 | 17 | * Boston, MA 02111-1307, USA. | ||
298 | 18 | * | ||
299 | 19 | * Author: David Reveman <davidr@novell.com> | ||
300 | 20 | */ | ||
301 | 21 | |||
302 | 22 | #include "gtk-window-decorator.h" | ||
303 | 23 | |||
304 | 24 | static void | ||
305 | 25 | action_menu_unmap (GObject *object) | ||
306 | 26 | { | ||
307 | 27 | action_menu_mapped = FALSE; | ||
308 | 28 | } | ||
309 | 29 | |||
310 | 30 | static void | ||
311 | 31 | position_action_menu (GtkMenu *menu, | ||
312 | 32 | gint *x, | ||
313 | 33 | gint *y, | ||
314 | 34 | gboolean *push_in, | ||
315 | 35 | gpointer user_data) | ||
316 | 36 | { | ||
317 | 37 | WnckWindow *win = (WnckWindow *) user_data; | ||
318 | 38 | decor_frame_t *frame = gwd_get_decor_frame (get_frame_type (win)); | ||
319 | 39 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
320 | 40 | gint bx, by, width, height; | ||
321 | 41 | |||
322 | 42 | wnck_window_get_client_window_geometry (win, x, y, &width, &height); | ||
323 | 43 | |||
324 | 44 | if ((*theme_get_button_position) (d, BUTTON_MENU, width, height, | ||
325 | 45 | &bx, &by, &width, &height)) | ||
326 | 46 | *x = *x - frame->win_extents.left + bx; | ||
327 | 47 | |||
328 | 48 | gwd_decor_frame_unref (frame); | ||
329 | 49 | |||
330 | 50 | if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) | ||
331 | 51 | { | ||
332 | 52 | GtkRequisition req; | ||
333 | 53 | |||
334 | 54 | gtk_widget_size_request (GTK_WIDGET (menu), &req); | ||
335 | 55 | *x = MAX (0, *x - req.width + width); | ||
336 | 56 | } | ||
337 | 57 | |||
338 | 58 | *push_in = TRUE; | ||
339 | 59 | } | ||
340 | 60 | |||
341 | 61 | void | ||
342 | 62 | action_menu_map (WnckWindow *win, | ||
343 | 63 | long button, | ||
344 | 64 | Time time) | ||
345 | 65 | { | ||
346 | 66 | GdkDisplay *gdkdisplay; | ||
347 | 67 | GdkScreen *screen; | ||
348 | 68 | |||
349 | 69 | gdkdisplay = gdk_display_get_default (); | ||
350 | 70 | screen = gdk_display_get_default_screen (gdkdisplay); | ||
351 | 71 | |||
352 | 72 | if (action_menu) | ||
353 | 73 | { | ||
354 | 74 | if (action_menu_mapped) | ||
355 | 75 | { | ||
356 | 76 | gtk_widget_destroy (action_menu); | ||
357 | 77 | action_menu_mapped = FALSE; | ||
358 | 78 | action_menu = NULL; | ||
359 | 79 | return; | ||
360 | 80 | } | ||
361 | 81 | else | ||
362 | 82 | gtk_widget_destroy (action_menu); | ||
363 | 83 | } | ||
364 | 84 | |||
365 | 85 | switch (wnck_window_get_window_type (win)) { | ||
366 | 86 | case WNCK_WINDOW_DESKTOP: | ||
367 | 87 | case WNCK_WINDOW_DOCK: | ||
368 | 88 | /* don't allow window action */ | ||
369 | 89 | return; | ||
370 | 90 | case WNCK_WINDOW_NORMAL: | ||
371 | 91 | case WNCK_WINDOW_DIALOG: | ||
372 | 92 | |||
373 | 93 | #ifndef HAVE_LIBWNCK_2_19_4 | ||
374 | 94 | case WNCK_WINDOW_MODAL_DIALOG: | ||
375 | 95 | #endif | ||
376 | 96 | |||
377 | 97 | case WNCK_WINDOW_TOOLBAR: | ||
378 | 98 | case WNCK_WINDOW_MENU: | ||
379 | 99 | case WNCK_WINDOW_UTILITY: | ||
380 | 100 | case WNCK_WINDOW_SPLASHSCREEN: | ||
381 | 101 | /* allow window action menu */ | ||
382 | 102 | break; | ||
383 | 103 | } | ||
384 | 104 | |||
385 | 105 | action_menu = wnck_create_window_action_menu (win); | ||
386 | 106 | |||
387 | 107 | gtk_menu_set_screen (GTK_MENU (action_menu), screen); | ||
388 | 108 | |||
389 | 109 | g_signal_connect_object (G_OBJECT (action_menu), "unmap", | ||
390 | 110 | G_CALLBACK (action_menu_unmap), | ||
391 | 111 | 0, 0); | ||
392 | 112 | |||
393 | 113 | gtk_widget_show (action_menu); | ||
394 | 114 | |||
395 | 115 | if (!button || button == 1) | ||
396 | 116 | { | ||
397 | 117 | gtk_menu_popup (GTK_MENU (action_menu), | ||
398 | 118 | NULL, NULL, | ||
399 | 119 | position_action_menu, (gpointer) win, | ||
400 | 120 | button, | ||
401 | 121 | time); | ||
402 | 122 | } | ||
403 | 123 | else | ||
404 | 124 | { | ||
405 | 125 | gtk_menu_popup (GTK_MENU (action_menu), | ||
406 | 126 | NULL, NULL, | ||
407 | 127 | NULL, NULL, | ||
408 | 128 | button, | ||
409 | 129 | time); | ||
410 | 130 | } | ||
411 | 131 | |||
412 | 132 | action_menu_mapped = TRUE; | ||
413 | 133 | } | ||
414 | 0 | 134 | ||
415 | === removed file 'gtk/window-decorator/actionmenu.c' | |||
416 | --- gtk/window-decorator/actionmenu.c 2011-05-07 08:58:10 +0000 | |||
417 | +++ gtk/window-decorator/actionmenu.c 1970-01-01 00:00:00 +0000 | |||
418 | @@ -1,133 +0,0 @@ | |||
419 | 1 | /* | ||
420 | 2 | * Copyright © 2006 Novell, Inc. | ||
421 | 3 | * | ||
422 | 4 | * This library is free software; you can redistribute it and/or | ||
423 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
424 | 6 | * License as published by the Free Software Foundation; either | ||
425 | 7 | * version 2 of the License, or (at your option) any later version. | ||
426 | 8 | * | ||
427 | 9 | * This library is distributed in the hope that it will be useful, | ||
428 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
429 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
430 | 12 | * Lesser General Public License for more details. | ||
431 | 13 | * | ||
432 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
433 | 15 | * License along with this library; if not, write to the | ||
434 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
435 | 17 | * Boston, MA 02111-1307, USA. | ||
436 | 18 | * | ||
437 | 19 | * Author: David Reveman <davidr@novell.com> | ||
438 | 20 | */ | ||
439 | 21 | |||
440 | 22 | #include "gtk-window-decorator.h" | ||
441 | 23 | |||
442 | 24 | static void | ||
443 | 25 | action_menu_unmap (GObject *object) | ||
444 | 26 | { | ||
445 | 27 | action_menu_mapped = FALSE; | ||
446 | 28 | } | ||
447 | 29 | |||
448 | 30 | static void | ||
449 | 31 | position_action_menu (GtkMenu *menu, | ||
450 | 32 | gint *x, | ||
451 | 33 | gint *y, | ||
452 | 34 | gboolean *push_in, | ||
453 | 35 | gpointer user_data) | ||
454 | 36 | { | ||
455 | 37 | WnckWindow *win = (WnckWindow *) user_data; | ||
456 | 38 | decor_frame_t *frame = gwd_get_decor_frame (get_frame_type (win)); | ||
457 | 39 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
458 | 40 | gint bx, by, width, height; | ||
459 | 41 | |||
460 | 42 | wnck_window_get_client_window_geometry (win, x, y, &width, &height); | ||
461 | 43 | |||
462 | 44 | if ((*theme_get_button_position) (d, BUTTON_MENU, width, height, | ||
463 | 45 | &bx, &by, &width, &height)) | ||
464 | 46 | *x = *x - frame->win_extents.left + bx; | ||
465 | 47 | |||
466 | 48 | gwd_decor_frame_unref (frame); | ||
467 | 49 | |||
468 | 50 | if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) | ||
469 | 51 | { | ||
470 | 52 | GtkRequisition req; | ||
471 | 53 | |||
472 | 54 | gtk_widget_size_request (GTK_WIDGET (menu), &req); | ||
473 | 55 | *x = MAX (0, *x - req.width + width); | ||
474 | 56 | } | ||
475 | 57 | |||
476 | 58 | *push_in = TRUE; | ||
477 | 59 | } | ||
478 | 60 | |||
479 | 61 | void | ||
480 | 62 | action_menu_map (WnckWindow *win, | ||
481 | 63 | long button, | ||
482 | 64 | Time time) | ||
483 | 65 | { | ||
484 | 66 | GdkDisplay *gdkdisplay; | ||
485 | 67 | GdkScreen *screen; | ||
486 | 68 | |||
487 | 69 | gdkdisplay = gdk_display_get_default (); | ||
488 | 70 | screen = gdk_display_get_default_screen (gdkdisplay); | ||
489 | 71 | |||
490 | 72 | if (action_menu) | ||
491 | 73 | { | ||
492 | 74 | if (action_menu_mapped) | ||
493 | 75 | { | ||
494 | 76 | gtk_widget_destroy (action_menu); | ||
495 | 77 | action_menu_mapped = FALSE; | ||
496 | 78 | action_menu = NULL; | ||
497 | 79 | return; | ||
498 | 80 | } | ||
499 | 81 | else | ||
500 | 82 | gtk_widget_destroy (action_menu); | ||
501 | 83 | } | ||
502 | 84 | |||
503 | 85 | switch (wnck_window_get_window_type (win)) { | ||
504 | 86 | case WNCK_WINDOW_DESKTOP: | ||
505 | 87 | case WNCK_WINDOW_DOCK: | ||
506 | 88 | /* don't allow window action */ | ||
507 | 89 | return; | ||
508 | 90 | case WNCK_WINDOW_NORMAL: | ||
509 | 91 | case WNCK_WINDOW_DIALOG: | ||
510 | 92 | |||
511 | 93 | #ifndef HAVE_LIBWNCK_2_19_4 | ||
512 | 94 | case WNCK_WINDOW_MODAL_DIALOG: | ||
513 | 95 | #endif | ||
514 | 96 | |||
515 | 97 | case WNCK_WINDOW_TOOLBAR: | ||
516 | 98 | case WNCK_WINDOW_MENU: | ||
517 | 99 | case WNCK_WINDOW_UTILITY: | ||
518 | 100 | case WNCK_WINDOW_SPLASHSCREEN: | ||
519 | 101 | /* allow window action menu */ | ||
520 | 102 | break; | ||
521 | 103 | } | ||
522 | 104 | |||
523 | 105 | action_menu = wnck_create_window_action_menu (win); | ||
524 | 106 | |||
525 | 107 | gtk_menu_set_screen (GTK_MENU (action_menu), screen); | ||
526 | 108 | |||
527 | 109 | g_signal_connect_object (G_OBJECT (action_menu), "unmap", | ||
528 | 110 | G_CALLBACK (action_menu_unmap), | ||
529 | 111 | 0, 0); | ||
530 | 112 | |||
531 | 113 | gtk_widget_show (action_menu); | ||
532 | 114 | |||
533 | 115 | if (!button || button == 1) | ||
534 | 116 | { | ||
535 | 117 | gtk_menu_popup (GTK_MENU (action_menu), | ||
536 | 118 | NULL, NULL, | ||
537 | 119 | position_action_menu, (gpointer) win, | ||
538 | 120 | button, | ||
539 | 121 | time); | ||
540 | 122 | } | ||
541 | 123 | else | ||
542 | 124 | { | ||
543 | 125 | gtk_menu_popup (GTK_MENU (action_menu), | ||
544 | 126 | NULL, NULL, | ||
545 | 127 | NULL, NULL, | ||
546 | 128 | button, | ||
547 | 129 | time); | ||
548 | 130 | } | ||
549 | 131 | |||
550 | 132 | action_menu_mapped = TRUE; | ||
551 | 133 | } | ||
552 | 134 | 0 | ||
553 | === added file 'gtk/window-decorator/blurprops.c' | |||
554 | --- gtk/window-decorator/blurprops.c 1970-01-01 00:00:00 +0000 | |||
555 | +++ gtk/window-decorator/blurprops.c 2012-05-17 07:01:21 +0000 | |||
556 | @@ -0,0 +1,89 @@ | |||
557 | 1 | /* | ||
558 | 2 | * Copyright © 2006 Novell, Inc. | ||
559 | 3 | * | ||
560 | 4 | * This library is free software; you can redistribute it and/or | ||
561 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
562 | 6 | * License as published by the Free Software Foundation; either | ||
563 | 7 | * version 2 of the License, or (at your option) any later version. | ||
564 | 8 | * | ||
565 | 9 | * This library is distributed in the hope that it will be useful, | ||
566 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
567 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
568 | 12 | * Lesser General Public License for more details. | ||
569 | 13 | * | ||
570 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
571 | 15 | * License along with this library; if not, write to the | ||
572 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
573 | 17 | * Boston, MA 02111-1307, USA. | ||
574 | 18 | * | ||
575 | 19 | * Author: David Reveman <davidr@novell.com> | ||
576 | 20 | */ | ||
577 | 21 | |||
578 | 22 | #include "gtk-window-decorator.h" | ||
579 | 23 | |||
580 | 24 | void | ||
581 | 25 | decor_update_blur_property (decor_t *d, | ||
582 | 26 | int width, | ||
583 | 27 | int height, | ||
584 | 28 | Region top_region, | ||
585 | 29 | int top_offset, | ||
586 | 30 | Region bottom_region, | ||
587 | 31 | int bottom_offset, | ||
588 | 32 | Region left_region, | ||
589 | 33 | int left_offset, | ||
590 | 34 | Region right_region, | ||
591 | 35 | int right_offset) | ||
592 | 36 | { | ||
593 | 37 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
594 | 38 | long *data = NULL; | ||
595 | 39 | int size = 0; | ||
596 | 40 | |||
597 | 41 | if (settings->blur_type != BLUR_TYPE_ALL) | ||
598 | 42 | { | ||
599 | 43 | bottom_region = NULL; | ||
600 | 44 | left_region = NULL; | ||
601 | 45 | right_region = NULL; | ||
602 | 46 | |||
603 | 47 | if (settings->blur_type != BLUR_TYPE_TITLEBAR) | ||
604 | 48 | top_region = NULL; | ||
605 | 49 | } | ||
606 | 50 | |||
607 | 51 | if (top_region) | ||
608 | 52 | size += top_region->numRects; | ||
609 | 53 | if (bottom_region) | ||
610 | 54 | size += bottom_region->numRects; | ||
611 | 55 | if (left_region) | ||
612 | 56 | size += left_region->numRects; | ||
613 | 57 | if (right_region) | ||
614 | 58 | size += right_region->numRects; | ||
615 | 59 | |||
616 | 60 | if (size) | ||
617 | 61 | data = (long *) malloc (sizeof (long) * (2 + size * 6)); | ||
618 | 62 | |||
619 | 63 | if (data) | ||
620 | 64 | { | ||
621 | 65 | decor_region_to_blur_property (data, 4, 0, width, height, | ||
622 | 66 | top_region, top_offset, | ||
623 | 67 | bottom_region, bottom_offset, | ||
624 | 68 | left_region, left_offset, | ||
625 | 69 | right_region, right_offset); | ||
626 | 70 | |||
627 | 71 | gdk_error_trap_push (); | ||
628 | 72 | XChangeProperty (xdisplay, d->prop_xid, | ||
629 | 73 | win_blur_decor_atom, | ||
630 | 74 | XA_INTEGER, | ||
631 | 75 | 32, PropModeReplace, (guchar *) data, | ||
632 | 76 | 2 + size * 6); | ||
633 | 77 | gdk_display_sync (gdk_display_get_default ()); | ||
634 | 78 | gdk_error_trap_pop (); | ||
635 | 79 | |||
636 | 80 | free (data); | ||
637 | 81 | } | ||
638 | 82 | else | ||
639 | 83 | { | ||
640 | 84 | gdk_error_trap_push (); | ||
641 | 85 | XDeleteProperty (xdisplay, d->prop_xid, win_blur_decor_atom); | ||
642 | 86 | gdk_display_sync (gdk_display_get_default ()); | ||
643 | 87 | gdk_error_trap_pop (); | ||
644 | 88 | } | ||
645 | 89 | } | ||
646 | 0 | 90 | ||
647 | === removed file 'gtk/window-decorator/blurprops.c' | |||
648 | --- gtk/window-decorator/blurprops.c 2011-02-21 09:53:08 +0000 | |||
649 | +++ gtk/window-decorator/blurprops.c 1970-01-01 00:00:00 +0000 | |||
650 | @@ -1,89 +0,0 @@ | |||
651 | 1 | /* | ||
652 | 2 | * Copyright © 2006 Novell, Inc. | ||
653 | 3 | * | ||
654 | 4 | * This library is free software; you can redistribute it and/or | ||
655 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
656 | 6 | * License as published by the Free Software Foundation; either | ||
657 | 7 | * version 2 of the License, or (at your option) any later version. | ||
658 | 8 | * | ||
659 | 9 | * This library is distributed in the hope that it will be useful, | ||
660 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
661 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
662 | 12 | * Lesser General Public License for more details. | ||
663 | 13 | * | ||
664 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
665 | 15 | * License along with this library; if not, write to the | ||
666 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
667 | 17 | * Boston, MA 02111-1307, USA. | ||
668 | 18 | * | ||
669 | 19 | * Author: David Reveman <davidr@novell.com> | ||
670 | 20 | */ | ||
671 | 21 | |||
672 | 22 | #include "gtk-window-decorator.h" | ||
673 | 23 | |||
674 | 24 | void | ||
675 | 25 | decor_update_blur_property (decor_t *d, | ||
676 | 26 | int width, | ||
677 | 27 | int height, | ||
678 | 28 | Region top_region, | ||
679 | 29 | int top_offset, | ||
680 | 30 | Region bottom_region, | ||
681 | 31 | int bottom_offset, | ||
682 | 32 | Region left_region, | ||
683 | 33 | int left_offset, | ||
684 | 34 | Region right_region, | ||
685 | 35 | int right_offset) | ||
686 | 36 | { | ||
687 | 37 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
688 | 38 | long *data = NULL; | ||
689 | 39 | int size = 0; | ||
690 | 40 | |||
691 | 41 | if (settings->blur_type != BLUR_TYPE_ALL) | ||
692 | 42 | { | ||
693 | 43 | bottom_region = NULL; | ||
694 | 44 | left_region = NULL; | ||
695 | 45 | right_region = NULL; | ||
696 | 46 | |||
697 | 47 | if (settings->blur_type != BLUR_TYPE_TITLEBAR) | ||
698 | 48 | top_region = NULL; | ||
699 | 49 | } | ||
700 | 50 | |||
701 | 51 | if (top_region) | ||
702 | 52 | size += top_region->numRects; | ||
703 | 53 | if (bottom_region) | ||
704 | 54 | size += bottom_region->numRects; | ||
705 | 55 | if (left_region) | ||
706 | 56 | size += left_region->numRects; | ||
707 | 57 | if (right_region) | ||
708 | 58 | size += right_region->numRects; | ||
709 | 59 | |||
710 | 60 | if (size) | ||
711 | 61 | data = (long *) malloc (sizeof (long) * (2 + size * 6)); | ||
712 | 62 | |||
713 | 63 | if (data) | ||
714 | 64 | { | ||
715 | 65 | decor_region_to_blur_property (data, 4, 0, width, height, | ||
716 | 66 | top_region, top_offset, | ||
717 | 67 | bottom_region, bottom_offset, | ||
718 | 68 | left_region, left_offset, | ||
719 | 69 | right_region, right_offset); | ||
720 | 70 | |||
721 | 71 | gdk_error_trap_push (); | ||
722 | 72 | XChangeProperty (xdisplay, d->prop_xid, | ||
723 | 73 | win_blur_decor_atom, | ||
724 | 74 | XA_INTEGER, | ||
725 | 75 | 32, PropModeReplace, (guchar *) data, | ||
726 | 76 | 2 + size * 6); | ||
727 | 77 | gdk_display_sync (gdk_display_get_default ()); | ||
728 | 78 | gdk_error_trap_pop (); | ||
729 | 79 | |||
730 | 80 | free (data); | ||
731 | 81 | } | ||
732 | 82 | else | ||
733 | 83 | { | ||
734 | 84 | gdk_error_trap_push (); | ||
735 | 85 | XDeleteProperty (xdisplay, d->prop_xid, win_blur_decor_atom); | ||
736 | 86 | gdk_display_sync (gdk_display_get_default ()); | ||
737 | 87 | gdk_error_trap_pop (); | ||
738 | 88 | } | ||
739 | 89 | } | ||
740 | 90 | 0 | ||
741 | === added file 'gtk/window-decorator/forcequit.c' | |||
742 | --- gtk/window-decorator/forcequit.c 1970-01-01 00:00:00 +0000 | |||
743 | +++ gtk/window-decorator/forcequit.c 2012-05-17 07:01:21 +0000 | |||
744 | @@ -0,0 +1,201 @@ | |||
745 | 1 | /* | ||
746 | 2 | * Copyright © 2006 Novell, Inc. | ||
747 | 3 | * | ||
748 | 4 | * This library is free software; you can redistribute it and/or | ||
749 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
750 | 6 | * License as published by the Free Software Foundation; either | ||
751 | 7 | * version 2 of the License, or (at your option) any later version. | ||
752 | 8 | * | ||
753 | 9 | * This library is distributed in the hope that it will be useful, | ||
754 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
755 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
756 | 12 | * Lesser General Public License for more details. | ||
757 | 13 | * | ||
758 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
759 | 15 | * License along with this library; if not, write to the | ||
760 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
761 | 17 | * Boston, MA 02111-1307, USA. | ||
762 | 18 | * | ||
763 | 19 | * Author: David Reveman <davidr@novell.com> | ||
764 | 20 | * | ||
765 | 21 | * 2D Mode: Copyright © 2010 Sam Spilsbury <smspillaz@gmail.com> | ||
766 | 22 | * Frames Management: Copright © 2011 Canonical Ltd. | ||
767 | 23 | * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
768 | 24 | */ | ||
769 | 25 | |||
770 | 26 | #include "gtk-window-decorator.h" | ||
771 | 27 | |||
772 | 28 | static char * | ||
773 | 29 | get_client_machine (Window xwindow) | ||
774 | 30 | { | ||
775 | 31 | Atom atom, type; | ||
776 | 32 | gulong nitems, bytes_after; | ||
777 | 33 | guchar *str = NULL; | ||
778 | 34 | int format, result; | ||
779 | 35 | char *retval; | ||
780 | 36 | |||
781 | 37 | atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "WM_CLIENT_MACHINE", FALSE); | ||
782 | 38 | |||
783 | 39 | gdk_error_trap_push (); | ||
784 | 40 | |||
785 | 41 | result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), | ||
786 | 42 | xwindow, atom, | ||
787 | 43 | 0, G_MAXLONG, | ||
788 | 44 | FALSE, XA_STRING, &type, &format, &nitems, | ||
789 | 45 | &bytes_after, &str); | ||
790 | 46 | |||
791 | 47 | gdk_error_trap_pop (); | ||
792 | 48 | |||
793 | 49 | if (result != Success) | ||
794 | 50 | return NULL; | ||
795 | 51 | |||
796 | 52 | if (type != XA_STRING) | ||
797 | 53 | { | ||
798 | 54 | XFree (str); | ||
799 | 55 | return NULL; | ||
800 | 56 | } | ||
801 | 57 | |||
802 | 58 | retval = g_strdup ((gchar *) str); | ||
803 | 59 | |||
804 | 60 | XFree (str); | ||
805 | 61 | |||
806 | 62 | return retval; | ||
807 | 63 | } | ||
808 | 64 | |||
809 | 65 | static void | ||
810 | 66 | kill_window (WnckWindow *win) | ||
811 | 67 | { | ||
812 | 68 | WnckApplication *app; | ||
813 | 69 | |||
814 | 70 | app = wnck_window_get_application (win); | ||
815 | 71 | if (app) | ||
816 | 72 | { | ||
817 | 73 | gchar buf[257], *client_machine; | ||
818 | 74 | int pid; | ||
819 | 75 | |||
820 | 76 | pid = wnck_application_get_pid (app); | ||
821 | 77 | client_machine = get_client_machine (wnck_application_get_xid (app)); | ||
822 | 78 | |||
823 | 79 | if (client_machine && pid > 0) | ||
824 | 80 | { | ||
825 | 81 | if (gethostname (buf, sizeof (buf) - 1) == 0) | ||
826 | 82 | { | ||
827 | 83 | if (strcmp (buf, client_machine) == 0) | ||
828 | 84 | kill (pid, 9); | ||
829 | 85 | } | ||
830 | 86 | } | ||
831 | 87 | |||
832 | 88 | if (client_machine) | ||
833 | 89 | g_free (client_machine); | ||
834 | 90 | } | ||
835 | 91 | |||
836 | 92 | gdk_error_trap_push (); | ||
837 | 93 | XKillClient (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wnck_window_get_xid (win)); | ||
838 | 94 | gdk_display_sync (gdk_display_get_default ()); | ||
839 | 95 | gdk_error_trap_pop (); | ||
840 | 96 | } | ||
841 | 97 | |||
842 | 98 | static void | ||
843 | 99 | force_quit_dialog_realize (GtkWidget *dialog, | ||
844 | 100 | void *data) | ||
845 | 101 | { | ||
846 | 102 | WnckWindow *win = data; | ||
847 | 103 | |||
848 | 104 | gdk_error_trap_push (); | ||
849 | 105 | XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), | ||
850 | 106 | GDK_WINDOW_XID (dialog->window), | ||
851 | 107 | wnck_window_get_xid (win)); | ||
852 | 108 | gdk_display_sync (gdk_display_get_default ()); | ||
853 | 109 | gdk_error_trap_pop (); | ||
854 | 110 | } | ||
855 | 111 | |||
856 | 112 | static void | ||
857 | 113 | force_quit_dialog_response (GtkWidget *dialog, | ||
858 | 114 | gint response, | ||
859 | 115 | void *data) | ||
860 | 116 | { | ||
861 | 117 | WnckWindow *win = data; | ||
862 | 118 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
863 | 119 | |||
864 | 120 | if (response == GTK_RESPONSE_ACCEPT) | ||
865 | 121 | kill_window (win); | ||
866 | 122 | |||
867 | 123 | if (d->force_quit_dialog) | ||
868 | 124 | { | ||
869 | 125 | d->force_quit_dialog = NULL; | ||
870 | 126 | gtk_widget_destroy (dialog); | ||
871 | 127 | } | ||
872 | 128 | } | ||
873 | 129 | |||
874 | 130 | void | ||
875 | 131 | show_force_quit_dialog (WnckWindow *win, | ||
876 | 132 | Time timestamp) | ||
877 | 133 | { | ||
878 | 134 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
879 | 135 | GtkWidget *dialog; | ||
880 | 136 | gchar *str, *tmp; | ||
881 | 137 | |||
882 | 138 | if (d->force_quit_dialog) | ||
883 | 139 | return; | ||
884 | 140 | |||
885 | 141 | tmp = g_markup_escape_text (wnck_window_get_name (win), -1); | ||
886 | 142 | str = g_strdup_printf (_("The window \"%s\" is not responding."), tmp); | ||
887 | 143 | |||
888 | 144 | g_free (tmp); | ||
889 | 145 | |||
890 | 146 | dialog = gtk_message_dialog_new (NULL, 0, | ||
891 | 147 | GTK_MESSAGE_WARNING, | ||
892 | 148 | GTK_BUTTONS_NONE, | ||
893 | 149 | "<b>%s</b>\n\n%s", | ||
894 | 150 | str, | ||
895 | 151 | _("Forcing this application to " | ||
896 | 152 | "quit will cause you to lose any " | ||
897 | 153 | "unsaved changes.")); | ||
898 | 154 | g_free (str); | ||
899 | 155 | |||
900 | 156 | gtk_window_set_icon_name (GTK_WINDOW (dialog), "force-quit"); | ||
901 | 157 | |||
902 | 158 | gtk_label_set_use_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), | ||
903 | 159 | TRUE); | ||
904 | 160 | gtk_label_set_line_wrap (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), | ||
905 | 161 | TRUE); | ||
906 | 162 | |||
907 | 163 | gtk_dialog_add_buttons (GTK_DIALOG (dialog), | ||
908 | 164 | GTK_STOCK_CANCEL, | ||
909 | 165 | GTK_RESPONSE_REJECT, | ||
910 | 166 | _("_Force Quit"), | ||
911 | 167 | GTK_RESPONSE_ACCEPT, | ||
912 | 168 | NULL); | ||
913 | 169 | |||
914 | 170 | gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_REJECT); | ||
915 | 171 | |||
916 | 172 | g_signal_connect (G_OBJECT (dialog), "realize", | ||
917 | 173 | G_CALLBACK (force_quit_dialog_realize), | ||
918 | 174 | win); | ||
919 | 175 | |||
920 | 176 | g_signal_connect (G_OBJECT (dialog), "response", | ||
921 | 177 | G_CALLBACK (force_quit_dialog_response), | ||
922 | 178 | win); | ||
923 | 179 | |||
924 | 180 | gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); | ||
925 | 181 | |||
926 | 182 | gtk_widget_realize (dialog); | ||
927 | 183 | |||
928 | 184 | gdk_x11_window_set_user_time (dialog->window, timestamp); | ||
929 | 185 | |||
930 | 186 | gtk_widget_show (dialog); | ||
931 | 187 | |||
932 | 188 | d->force_quit_dialog = dialog; | ||
933 | 189 | } | ||
934 | 190 | |||
935 | 191 | void | ||
936 | 192 | hide_force_quit_dialog (WnckWindow *win) | ||
937 | 193 | { | ||
938 | 194 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
939 | 195 | |||
940 | 196 | if (d->force_quit_dialog) | ||
941 | 197 | { | ||
942 | 198 | gtk_widget_destroy (d->force_quit_dialog); | ||
943 | 199 | d->force_quit_dialog = NULL; | ||
944 | 200 | } | ||
945 | 201 | } | ||
946 | 0 | 202 | ||
947 | === removed file 'gtk/window-decorator/forcequit.c' | |||
948 | --- gtk/window-decorator/forcequit.c 2011-02-21 09:53:08 +0000 | |||
949 | +++ gtk/window-decorator/forcequit.c 1970-01-01 00:00:00 +0000 | |||
950 | @@ -1,201 +0,0 @@ | |||
951 | 1 | /* | ||
952 | 2 | * Copyright © 2006 Novell, Inc. | ||
953 | 3 | * | ||
954 | 4 | * This library is free software; you can redistribute it and/or | ||
955 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
956 | 6 | * License as published by the Free Software Foundation; either | ||
957 | 7 | * version 2 of the License, or (at your option) any later version. | ||
958 | 8 | * | ||
959 | 9 | * This library is distributed in the hope that it will be useful, | ||
960 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
961 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
962 | 12 | * Lesser General Public License for more details. | ||
963 | 13 | * | ||
964 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
965 | 15 | * License along with this library; if not, write to the | ||
966 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
967 | 17 | * Boston, MA 02111-1307, USA. | ||
968 | 18 | * | ||
969 | 19 | * Author: David Reveman <davidr@novell.com> | ||
970 | 20 | * | ||
971 | 21 | * 2D Mode: Copyright © 2010 Sam Spilsbury <smspillaz@gmail.com> | ||
972 | 22 | * Frames Management: Copright © 2011 Canonical Ltd. | ||
973 | 23 | * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
974 | 24 | */ | ||
975 | 25 | |||
976 | 26 | #include "gtk-window-decorator.h" | ||
977 | 27 | |||
978 | 28 | static char * | ||
979 | 29 | get_client_machine (Window xwindow) | ||
980 | 30 | { | ||
981 | 31 | Atom atom, type; | ||
982 | 32 | gulong nitems, bytes_after; | ||
983 | 33 | guchar *str = NULL; | ||
984 | 34 | int format, result; | ||
985 | 35 | char *retval; | ||
986 | 36 | |||
987 | 37 | atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "WM_CLIENT_MACHINE", FALSE); | ||
988 | 38 | |||
989 | 39 | gdk_error_trap_push (); | ||
990 | 40 | |||
991 | 41 | result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), | ||
992 | 42 | xwindow, atom, | ||
993 | 43 | 0, G_MAXLONG, | ||
994 | 44 | FALSE, XA_STRING, &type, &format, &nitems, | ||
995 | 45 | &bytes_after, &str); | ||
996 | 46 | |||
997 | 47 | gdk_error_trap_pop (); | ||
998 | 48 | |||
999 | 49 | if (result != Success) | ||
1000 | 50 | return NULL; | ||
1001 | 51 | |||
1002 | 52 | if (type != XA_STRING) | ||
1003 | 53 | { | ||
1004 | 54 | XFree (str); | ||
1005 | 55 | return NULL; | ||
1006 | 56 | } | ||
1007 | 57 | |||
1008 | 58 | retval = g_strdup ((gchar *) str); | ||
1009 | 59 | |||
1010 | 60 | XFree (str); | ||
1011 | 61 | |||
1012 | 62 | return retval; | ||
1013 | 63 | } | ||
1014 | 64 | |||
1015 | 65 | static void | ||
1016 | 66 | kill_window (WnckWindow *win) | ||
1017 | 67 | { | ||
1018 | 68 | WnckApplication *app; | ||
1019 | 69 | |||
1020 | 70 | app = wnck_window_get_application (win); | ||
1021 | 71 | if (app) | ||
1022 | 72 | { | ||
1023 | 73 | gchar buf[257], *client_machine; | ||
1024 | 74 | int pid; | ||
1025 | 75 | |||
1026 | 76 | pid = wnck_application_get_pid (app); | ||
1027 | 77 | client_machine = get_client_machine (wnck_application_get_xid (app)); | ||
1028 | 78 | |||
1029 | 79 | if (client_machine && pid > 0) | ||
1030 | 80 | { | ||
1031 | 81 | if (gethostname (buf, sizeof (buf) - 1) == 0) | ||
1032 | 82 | { | ||
1033 | 83 | if (strcmp (buf, client_machine) == 0) | ||
1034 | 84 | kill (pid, 9); | ||
1035 | 85 | } | ||
1036 | 86 | } | ||
1037 | 87 | |||
1038 | 88 | if (client_machine) | ||
1039 | 89 | g_free (client_machine); | ||
1040 | 90 | } | ||
1041 | 91 | |||
1042 | 92 | gdk_error_trap_push (); | ||
1043 | 93 | XKillClient (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wnck_window_get_xid (win)); | ||
1044 | 94 | gdk_display_sync (gdk_display_get_default ()); | ||
1045 | 95 | gdk_error_trap_pop (); | ||
1046 | 96 | } | ||
1047 | 97 | |||
1048 | 98 | static void | ||
1049 | 99 | force_quit_dialog_realize (GtkWidget *dialog, | ||
1050 | 100 | void *data) | ||
1051 | 101 | { | ||
1052 | 102 | WnckWindow *win = data; | ||
1053 | 103 | |||
1054 | 104 | gdk_error_trap_push (); | ||
1055 | 105 | XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), | ||
1056 | 106 | GDK_WINDOW_XID (dialog->window), | ||
1057 | 107 | wnck_window_get_xid (win)); | ||
1058 | 108 | gdk_display_sync (gdk_display_get_default ()); | ||
1059 | 109 | gdk_error_trap_pop (); | ||
1060 | 110 | } | ||
1061 | 111 | |||
1062 | 112 | static void | ||
1063 | 113 | force_quit_dialog_response (GtkWidget *dialog, | ||
1064 | 114 | gint response, | ||
1065 | 115 | void *data) | ||
1066 | 116 | { | ||
1067 | 117 | WnckWindow *win = data; | ||
1068 | 118 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
1069 | 119 | |||
1070 | 120 | if (response == GTK_RESPONSE_ACCEPT) | ||
1071 | 121 | kill_window (win); | ||
1072 | 122 | |||
1073 | 123 | if (d->force_quit_dialog) | ||
1074 | 124 | { | ||
1075 | 125 | d->force_quit_dialog = NULL; | ||
1076 | 126 | gtk_widget_destroy (dialog); | ||
1077 | 127 | } | ||
1078 | 128 | } | ||
1079 | 129 | |||
1080 | 130 | void | ||
1081 | 131 | show_force_quit_dialog (WnckWindow *win, | ||
1082 | 132 | Time timestamp) | ||
1083 | 133 | { | ||
1084 | 134 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
1085 | 135 | GtkWidget *dialog; | ||
1086 | 136 | gchar *str, *tmp; | ||
1087 | 137 | |||
1088 | 138 | if (d->force_quit_dialog) | ||
1089 | 139 | return; | ||
1090 | 140 | |||
1091 | 141 | tmp = g_markup_escape_text (wnck_window_get_name (win), -1); | ||
1092 | 142 | str = g_strdup_printf (_("The window \"%s\" is not responding."), tmp); | ||
1093 | 143 | |||
1094 | 144 | g_free (tmp); | ||
1095 | 145 | |||
1096 | 146 | dialog = gtk_message_dialog_new (NULL, 0, | ||
1097 | 147 | GTK_MESSAGE_WARNING, | ||
1098 | 148 | GTK_BUTTONS_NONE, | ||
1099 | 149 | "<b>%s</b>\n\n%s", | ||
1100 | 150 | str, | ||
1101 | 151 | _("Forcing this application to " | ||
1102 | 152 | "quit will cause you to lose any " | ||
1103 | 153 | "unsaved changes.")); | ||
1104 | 154 | g_free (str); | ||
1105 | 155 | |||
1106 | 156 | gtk_window_set_icon_name (GTK_WINDOW (dialog), "force-quit"); | ||
1107 | 157 | |||
1108 | 158 | gtk_label_set_use_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), | ||
1109 | 159 | TRUE); | ||
1110 | 160 | gtk_label_set_line_wrap (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), | ||
1111 | 161 | TRUE); | ||
1112 | 162 | |||
1113 | 163 | gtk_dialog_add_buttons (GTK_DIALOG (dialog), | ||
1114 | 164 | GTK_STOCK_CANCEL, | ||
1115 | 165 | GTK_RESPONSE_REJECT, | ||
1116 | 166 | _("_Force Quit"), | ||
1117 | 167 | GTK_RESPONSE_ACCEPT, | ||
1118 | 168 | NULL); | ||
1119 | 169 | |||
1120 | 170 | gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_REJECT); | ||
1121 | 171 | |||
1122 | 172 | g_signal_connect (G_OBJECT (dialog), "realize", | ||
1123 | 173 | G_CALLBACK (force_quit_dialog_realize), | ||
1124 | 174 | win); | ||
1125 | 175 | |||
1126 | 176 | g_signal_connect (G_OBJECT (dialog), "response", | ||
1127 | 177 | G_CALLBACK (force_quit_dialog_response), | ||
1128 | 178 | win); | ||
1129 | 179 | |||
1130 | 180 | gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); | ||
1131 | 181 | |||
1132 | 182 | gtk_widget_realize (dialog); | ||
1133 | 183 | |||
1134 | 184 | gdk_x11_window_set_user_time (dialog->window, timestamp); | ||
1135 | 185 | |||
1136 | 186 | gtk_widget_show (dialog); | ||
1137 | 187 | |||
1138 | 188 | d->force_quit_dialog = dialog; | ||
1139 | 189 | } | ||
1140 | 190 | |||
1141 | 191 | void | ||
1142 | 192 | hide_force_quit_dialog (WnckWindow *win) | ||
1143 | 193 | { | ||
1144 | 194 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | ||
1145 | 195 | |||
1146 | 196 | if (d->force_quit_dialog) | ||
1147 | 197 | { | ||
1148 | 198 | gtk_widget_destroy (d->force_quit_dialog); | ||
1149 | 199 | d->force_quit_dialog = NULL; | ||
1150 | 200 | } | ||
1151 | 201 | } | ||
1152 | 202 | 0 | ||
1153 | === added file 'gtk/window-decorator/gdk.c' | |||
1154 | --- gtk/window-decorator/gdk.c 1970-01-01 00:00:00 +0000 | |||
1155 | +++ gtk/window-decorator/gdk.c 2012-05-17 07:01:21 +0000 | |||
1156 | @@ -0,0 +1,106 @@ | |||
1157 | 1 | /* | ||
1158 | 2 | * Copyright © 2006 Novell, Inc. | ||
1159 | 3 | * | ||
1160 | 4 | * This library is free software; you can redistribute it and/or | ||
1161 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
1162 | 6 | * License as published by the Free Software Foundation; either | ||
1163 | 7 | * version 2 of the License, or (at your option) any later version. | ||
1164 | 8 | * | ||
1165 | 9 | * This library is distributed in the hope that it will be useful, | ||
1166 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1167 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1168 | 12 | * Lesser General Public License for more details. | ||
1169 | 13 | * | ||
1170 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
1171 | 15 | * License along with this library; if not, write to the | ||
1172 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
1173 | 17 | * Boston, MA 02111-1307, USA. | ||
1174 | 18 | * | ||
1175 | 19 | * Author: David Reveman <davidr@novell.com> | ||
1176 | 20 | */ | ||
1177 | 21 | |||
1178 | 22 | #include "gtk-window-decorator.h" | ||
1179 | 23 | |||
1180 | 24 | GdkPixmap * | ||
1181 | 25 | pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, GtkWidget *parent) | ||
1182 | 26 | { | ||
1183 | 27 | GdkPixmap *pixmap; | ||
1184 | 28 | guint width, height; | ||
1185 | 29 | cairo_t *cr; | ||
1186 | 30 | |||
1187 | 31 | width = gdk_pixbuf_get_width (pixbuf); | ||
1188 | 32 | height = gdk_pixbuf_get_height (pixbuf); | ||
1189 | 33 | |||
1190 | 34 | pixmap = create_pixmap (width, height, parent); | ||
1191 | 35 | if (!pixmap) | ||
1192 | 36 | return NULL; | ||
1193 | 37 | |||
1194 | 38 | cr = (cairo_t *) gdk_cairo_create (GDK_DRAWABLE (pixmap)); | ||
1195 | 39 | gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); | ||
1196 | 40 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); | ||
1197 | 41 | cairo_paint (cr); | ||
1198 | 42 | cairo_destroy (cr); | ||
1199 | 43 | |||
1200 | 44 | return pixmap; | ||
1201 | 45 | } | ||
1202 | 46 | |||
1203 | 47 | |||
1204 | 48 | void | ||
1205 | 49 | gdk_cairo_set_source_color_alpha (cairo_t *cr, | ||
1206 | 50 | GdkColor *color, | ||
1207 | 51 | double alpha) | ||
1208 | 52 | { | ||
1209 | 53 | cairo_set_source_rgba (cr, | ||
1210 | 54 | color->red / 65535.0, | ||
1211 | 55 | color->green / 65535.0, | ||
1212 | 56 | color->blue / 65535.0, | ||
1213 | 57 | alpha); | ||
1214 | 58 | } | ||
1215 | 59 | |||
1216 | 60 | inline GdkWindow * | ||
1217 | 61 | create_gdk_window (Window xframe) | ||
1218 | 62 | { | ||
1219 | 63 | GdkDisplay *display = gdk_display_get_default (); | ||
1220 | 64 | GdkScreen *screen = gdk_display_get_default_screen (display); | ||
1221 | 65 | GdkWindow *window = create_foreign_window (xframe); | ||
1222 | 66 | GdkColormap *cmap = gdk_screen_get_rgb_colormap (screen); | ||
1223 | 67 | |||
1224 | 68 | gdk_drawable_set_colormap (GDK_DRAWABLE (window), cmap); | ||
1225 | 69 | |||
1226 | 70 | return window; | ||
1227 | 71 | } | ||
1228 | 72 | |||
1229 | 73 | GdkColormap * | ||
1230 | 74 | get_colormap_for_drawable (GdkDrawable *d) | ||
1231 | 75 | { | ||
1232 | 76 | GdkDisplay *display = gdk_display_get_default (); | ||
1233 | 77 | GdkScreen *screen = gdk_display_get_default_screen (display); | ||
1234 | 78 | |||
1235 | 79 | if (gdk_drawable_get_depth (d) == 32) | ||
1236 | 80 | return gdk_screen_get_rgba_colormap (screen); | ||
1237 | 81 | |||
1238 | 82 | return gdk_screen_get_rgb_colormap (screen); | ||
1239 | 83 | } | ||
1240 | 84 | |||
1241 | 85 | XRenderPictFormat * | ||
1242 | 86 | get_format_for_drawable (decor_t *d, GdkDrawable *drawable) | ||
1243 | 87 | { | ||
1244 | 88 | if (!d->frame_window || gdk_drawable_get_depth (drawable) == 32) | ||
1245 | 89 | return xformat_rgba; | ||
1246 | 90 | |||
1247 | 91 | return xformat_rgb; | ||
1248 | 92 | } | ||
1249 | 93 | |||
1250 | 94 | GdkPixmap * | ||
1251 | 95 | create_pixmap (int w, | ||
1252 | 96 | int h, | ||
1253 | 97 | GtkWidget *parent_style_window) | ||
1254 | 98 | { | ||
1255 | 99 | GdkWindow *window; | ||
1256 | 100 | |||
1257 | 101 | if (w == 0 || h == 0) | ||
1258 | 102 | abort (); | ||
1259 | 103 | |||
1260 | 104 | window = gtk_widget_get_window (parent_style_window); | ||
1261 | 105 | return gdk_pixmap_new (GDK_DRAWABLE (window), w, h, -1 /* CopyFromParent */); | ||
1262 | 106 | } | ||
1263 | 0 | 107 | ||
1264 | === removed file 'gtk/window-decorator/gdk.c' | |||
1265 | --- gtk/window-decorator/gdk.c 2011-02-23 18:11:11 +0000 | |||
1266 | +++ gtk/window-decorator/gdk.c 1970-01-01 00:00:00 +0000 | |||
1267 | @@ -1,106 +0,0 @@ | |||
1268 | 1 | /* | ||
1269 | 2 | * Copyright © 2006 Novell, Inc. | ||
1270 | 3 | * | ||
1271 | 4 | * This library is free software; you can redistribute it and/or | ||
1272 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
1273 | 6 | * License as published by the Free Software Foundation; either | ||
1274 | 7 | * version 2 of the License, or (at your option) any later version. | ||
1275 | 8 | * | ||
1276 | 9 | * This library is distributed in the hope that it will be useful, | ||
1277 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1278 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1279 | 12 | * Lesser General Public License for more details. | ||
1280 | 13 | * | ||
1281 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
1282 | 15 | * License along with this library; if not, write to the | ||
1283 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
1284 | 17 | * Boston, MA 02111-1307, USA. | ||
1285 | 18 | * | ||
1286 | 19 | * Author: David Reveman <davidr@novell.com> | ||
1287 | 20 | */ | ||
1288 | 21 | |||
1289 | 22 | #include "gtk-window-decorator.h" | ||
1290 | 23 | |||
1291 | 24 | GdkPixmap * | ||
1292 | 25 | pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, GtkWidget *parent) | ||
1293 | 26 | { | ||
1294 | 27 | GdkPixmap *pixmap; | ||
1295 | 28 | guint width, height; | ||
1296 | 29 | cairo_t *cr; | ||
1297 | 30 | |||
1298 | 31 | width = gdk_pixbuf_get_width (pixbuf); | ||
1299 | 32 | height = gdk_pixbuf_get_height (pixbuf); | ||
1300 | 33 | |||
1301 | 34 | pixmap = create_pixmap (width, height, parent); | ||
1302 | 35 | if (!pixmap) | ||
1303 | 36 | return NULL; | ||
1304 | 37 | |||
1305 | 38 | cr = (cairo_t *) gdk_cairo_create (GDK_DRAWABLE (pixmap)); | ||
1306 | 39 | gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); | ||
1307 | 40 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); | ||
1308 | 41 | cairo_paint (cr); | ||
1309 | 42 | cairo_destroy (cr); | ||
1310 | 43 | |||
1311 | 44 | return pixmap; | ||
1312 | 45 | } | ||
1313 | 46 | |||
1314 | 47 | |||
1315 | 48 | void | ||
1316 | 49 | gdk_cairo_set_source_color_alpha (cairo_t *cr, | ||
1317 | 50 | GdkColor *color, | ||
1318 | 51 | double alpha) | ||
1319 | 52 | { | ||
1320 | 53 | cairo_set_source_rgba (cr, | ||
1321 | 54 | color->red / 65535.0, | ||
1322 | 55 | color->green / 65535.0, | ||
1323 | 56 | color->blue / 65535.0, | ||
1324 | 57 | alpha); | ||
1325 | 58 | } | ||
1326 | 59 | |||
1327 | 60 | inline GdkWindow * | ||
1328 | 61 | create_gdk_window (Window xframe) | ||
1329 | 62 | { | ||
1330 | 63 | GdkDisplay *display = gdk_display_get_default (); | ||
1331 | 64 | GdkScreen *screen = gdk_display_get_default_screen (display); | ||
1332 | 65 | GdkWindow *window = create_foreign_window (xframe); | ||
1333 | 66 | GdkColormap *cmap = gdk_screen_get_rgb_colormap (screen); | ||
1334 | 67 | |||
1335 | 68 | gdk_drawable_set_colormap (GDK_DRAWABLE (window), cmap); | ||
1336 | 69 | |||
1337 | 70 | return window; | ||
1338 | 71 | } | ||
1339 | 72 | |||
1340 | 73 | GdkColormap * | ||
1341 | 74 | get_colormap_for_drawable (GdkDrawable *d) | ||
1342 | 75 | { | ||
1343 | 76 | GdkDisplay *display = gdk_display_get_default (); | ||
1344 | 77 | GdkScreen *screen = gdk_display_get_default_screen (display); | ||
1345 | 78 | |||
1346 | 79 | if (gdk_drawable_get_depth (d) == 32) | ||
1347 | 80 | return gdk_screen_get_rgba_colormap (screen); | ||
1348 | 81 | |||
1349 | 82 | return gdk_screen_get_rgb_colormap (screen); | ||
1350 | 83 | } | ||
1351 | 84 | |||
1352 | 85 | XRenderPictFormat * | ||
1353 | 86 | get_format_for_drawable (decor_t *d, GdkDrawable *drawable) | ||
1354 | 87 | { | ||
1355 | 88 | if (!d->frame_window || gdk_drawable_get_depth (drawable) == 32) | ||
1356 | 89 | return xformat_rgba; | ||
1357 | 90 | |||
1358 | 91 | return xformat_rgb; | ||
1359 | 92 | } | ||
1360 | 93 | |||
1361 | 94 | GdkPixmap * | ||
1362 | 95 | create_pixmap (int w, | ||
1363 | 96 | int h, | ||
1364 | 97 | GtkWidget *parent_style_window) | ||
1365 | 98 | { | ||
1366 | 99 | GdkWindow *window; | ||
1367 | 100 | |||
1368 | 101 | if (w == 0 || h == 0) | ||
1369 | 102 | abort (); | ||
1370 | 103 | |||
1371 | 104 | window = gtk_widget_get_window (parent_style_window); | ||
1372 | 105 | return gdk_pixmap_new (GDK_DRAWABLE (window), w, h, -1 /* CopyFromParent */); | ||
1373 | 106 | } | ||
1374 | 107 | 0 | ||
1375 | === added file 'gtk/window-decorator/style.c' | |||
1376 | --- gtk/window-decorator/style.c 1970-01-01 00:00:00 +0000 | |||
1377 | +++ gtk/window-decorator/style.c 2012-05-17 07:01:21 +0000 | |||
1378 | @@ -0,0 +1,66 @@ | |||
1379 | 1 | /* | ||
1380 | 2 | * Copyright © 2006 Novell, Inc. | ||
1381 | 3 | * | ||
1382 | 4 | * This library is free software; you can redistribute it and/or | ||
1383 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
1384 | 6 | * License as published by the Free Software Foundation; either | ||
1385 | 7 | * version 2 of the License, or (at your option) any later version. | ||
1386 | 8 | * | ||
1387 | 9 | * This library is distributed in the hope that it will be useful, | ||
1388 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1389 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1390 | 12 | * Lesser General Public License for more details. | ||
1391 | 13 | * | ||
1392 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
1393 | 15 | * License along with this library; if not, write to the | ||
1394 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
1395 | 17 | * Boston, MA 02111-1307, USA. | ||
1396 | 18 | * | ||
1397 | 19 | * Author: David Reveman <davidr@novell.com> | ||
1398 | 20 | */ | ||
1399 | 21 | |||
1400 | 22 | #include "gtk-window-decorator.h" | ||
1401 | 23 | |||
1402 | 24 | void | ||
1403 | 25 | update_style (GtkWidget *widget) | ||
1404 | 26 | { | ||
1405 | 27 | GtkStyle *style; | ||
1406 | 28 | decor_color_t spot_color; | ||
1407 | 29 | |||
1408 | 30 | style = gtk_widget_get_style (widget); | ||
1409 | 31 | g_object_ref (G_OBJECT (style)); | ||
1410 | 32 | |||
1411 | 33 | style = gtk_style_attach (style, widget->window); | ||
1412 | 34 | |||
1413 | 35 | spot_color.r = style->bg[GTK_STATE_SELECTED].red / 65535.0; | ||
1414 | 36 | spot_color.g = style->bg[GTK_STATE_SELECTED].green / 65535.0; | ||
1415 | 37 | spot_color.b = style->bg[GTK_STATE_SELECTED].blue / 65535.0; | ||
1416 | 38 | |||
1417 | 39 | g_object_unref (G_OBJECT (style)); | ||
1418 | 40 | |||
1419 | 41 | shade (&spot_color, &_title_color[0], 1.05); | ||
1420 | 42 | shade (&_title_color[0], &_title_color[1], 0.85); | ||
1421 | 43 | |||
1422 | 44 | } | ||
1423 | 45 | |||
1424 | 46 | void | ||
1425 | 47 | style_changed (GtkWidget *widget, | ||
1426 | 48 | void *user_data) | ||
1427 | 49 | { | ||
1428 | 50 | GdkDisplay *gdkdisplay; | ||
1429 | 51 | GdkScreen *gdkscreen; | ||
1430 | 52 | WnckScreen *screen; | ||
1431 | 53 | |||
1432 | 54 | PangoContext *context = (PangoContext *) user_data; | ||
1433 | 55 | |||
1434 | 56 | gdkdisplay = gdk_display_get_default (); | ||
1435 | 57 | gdkscreen = gdk_display_get_default_screen (gdkdisplay); | ||
1436 | 58 | screen = wnck_screen_get_default (); | ||
1437 | 59 | |||
1438 | 60 | update_style (widget); | ||
1439 | 61 | |||
1440 | 62 | pango_cairo_context_set_resolution (context, | ||
1441 | 63 | gdk_screen_get_resolution (gdkscreen)); | ||
1442 | 64 | |||
1443 | 65 | decorations_changed (screen); | ||
1444 | 66 | } | ||
1445 | 0 | 67 | ||
1446 | === removed file 'gtk/window-decorator/style.c' | |||
1447 | --- gtk/window-decorator/style.c 2011-02-21 09:53:08 +0000 | |||
1448 | +++ gtk/window-decorator/style.c 1970-01-01 00:00:00 +0000 | |||
1449 | @@ -1,66 +0,0 @@ | |||
1450 | 1 | /* | ||
1451 | 2 | * Copyright © 2006 Novell, Inc. | ||
1452 | 3 | * | ||
1453 | 4 | * This library is free software; you can redistribute it and/or | ||
1454 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
1455 | 6 | * License as published by the Free Software Foundation; either | ||
1456 | 7 | * version 2 of the License, or (at your option) any later version. | ||
1457 | 8 | * | ||
1458 | 9 | * This library is distributed in the hope that it will be useful, | ||
1459 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1460 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1461 | 12 | * Lesser General Public License for more details. | ||
1462 | 13 | * | ||
1463 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
1464 | 15 | * License along with this library; if not, write to the | ||
1465 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
1466 | 17 | * Boston, MA 02111-1307, USA. | ||
1467 | 18 | * | ||
1468 | 19 | * Author: David Reveman <davidr@novell.com> | ||
1469 | 20 | */ | ||
1470 | 21 | |||
1471 | 22 | #include "gtk-window-decorator.h" | ||
1472 | 23 | |||
1473 | 24 | void | ||
1474 | 25 | update_style (GtkWidget *widget) | ||
1475 | 26 | { | ||
1476 | 27 | GtkStyle *style; | ||
1477 | 28 | decor_color_t spot_color; | ||
1478 | 29 | |||
1479 | 30 | style = gtk_widget_get_style (widget); | ||
1480 | 31 | g_object_ref (G_OBJECT (style)); | ||
1481 | 32 | |||
1482 | 33 | style = gtk_style_attach (style, widget->window); | ||
1483 | 34 | |||
1484 | 35 | spot_color.r = style->bg[GTK_STATE_SELECTED].red / 65535.0; | ||
1485 | 36 | spot_color.g = style->bg[GTK_STATE_SELECTED].green / 65535.0; | ||
1486 | 37 | spot_color.b = style->bg[GTK_STATE_SELECTED].blue / 65535.0; | ||
1487 | 38 | |||
1488 | 39 | g_object_unref (G_OBJECT (style)); | ||
1489 | 40 | |||
1490 | 41 | shade (&spot_color, &_title_color[0], 1.05); | ||
1491 | 42 | shade (&_title_color[0], &_title_color[1], 0.85); | ||
1492 | 43 | |||
1493 | 44 | } | ||
1494 | 45 | |||
1495 | 46 | void | ||
1496 | 47 | style_changed (GtkWidget *widget, | ||
1497 | 48 | void *user_data) | ||
1498 | 49 | { | ||
1499 | 50 | GdkDisplay *gdkdisplay; | ||
1500 | 51 | GdkScreen *gdkscreen; | ||
1501 | 52 | WnckScreen *screen; | ||
1502 | 53 | |||
1503 | 54 | PangoContext *context = (PangoContext *) user_data; | ||
1504 | 55 | |||
1505 | 56 | gdkdisplay = gdk_display_get_default (); | ||
1506 | 57 | gdkscreen = gdk_display_get_default_screen (gdkdisplay); | ||
1507 | 58 | screen = wnck_screen_get_default (); | ||
1508 | 59 | |||
1509 | 60 | update_style (widget); | ||
1510 | 61 | |||
1511 | 62 | pango_cairo_context_set_resolution (context, | ||
1512 | 63 | gdk_screen_get_resolution (gdkscreen)); | ||
1513 | 64 | |||
1514 | 65 | decorations_changed (screen); | ||
1515 | 66 | } | ||
1516 | 67 | 0 | ||
1517 | === added file 'gtk/window-decorator/util.c' | |||
1518 | --- gtk/window-decorator/util.c 1970-01-01 00:00:00 +0000 | |||
1519 | +++ gtk/window-decorator/util.c 2012-05-17 07:01:21 +0000 | |||
1520 | @@ -0,0 +1,299 @@ | |||
1521 | 1 | /* | ||
1522 | 2 | * Copyright © 2006 Novell, Inc. | ||
1523 | 3 | * | ||
1524 | 4 | * This library is free software; you can redistribute it and/or | ||
1525 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
1526 | 6 | * License as published by the Free Software Foundation; either | ||
1527 | 7 | * version 2 of the License, or (at your option) any later version. | ||
1528 | 8 | * | ||
1529 | 9 | * This library is distributed in the hope that it will be useful, | ||
1530 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1531 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1532 | 12 | * Lesser General Public License for more details. | ||
1533 | 13 | * | ||
1534 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
1535 | 15 | * License along with this library; if not, write to the | ||
1536 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
1537 | 17 | * Boston, MA 02111-1307, USA. | ||
1538 | 18 | * | ||
1539 | 19 | * Author: David Reveman <davidr@novell.com> | ||
1540 | 20 | */ | ||
1541 | 21 | |||
1542 | 22 | #include "gtk-window-decorator.h" | ||
1543 | 23 | |||
1544 | 24 | double | ||
1545 | 25 | square (double x) | ||
1546 | 26 | { | ||
1547 | 27 | return x * x; | ||
1548 | 28 | } | ||
1549 | 29 | |||
1550 | 30 | double | ||
1551 | 31 | dist (double x1, double y1, | ||
1552 | 32 | double x2, double y2) | ||
1553 | 33 | { | ||
1554 | 34 | return sqrt (square (x1 - x2) + square (y1 - y2)); | ||
1555 | 35 | } | ||
1556 | 36 | |||
1557 | 37 | gboolean | ||
1558 | 38 | get_window_prop (Window xwindow, | ||
1559 | 39 | Atom atom, | ||
1560 | 40 | Window *val) | ||
1561 | 41 | { | ||
1562 | 42 | Atom type; | ||
1563 | 43 | int format; | ||
1564 | 44 | gulong nitems; | ||
1565 | 45 | gulong bytes_after; | ||
1566 | 46 | Window *w; | ||
1567 | 47 | int err, result; | ||
1568 | 48 | |||
1569 | 49 | *val = 0; | ||
1570 | 50 | |||
1571 | 51 | gdk_error_trap_push (); | ||
1572 | 52 | |||
1573 | 53 | type = None; | ||
1574 | 54 | result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), | ||
1575 | 55 | xwindow, | ||
1576 | 56 | atom, | ||
1577 | 57 | 0, G_MAXLONG, | ||
1578 | 58 | False, XA_WINDOW, &type, &format, &nitems, | ||
1579 | 59 | &bytes_after, (void*) &w); | ||
1580 | 60 | err = gdk_error_trap_pop (); | ||
1581 | 61 | if (err != Success || result != Success) | ||
1582 | 62 | return FALSE; | ||
1583 | 63 | |||
1584 | 64 | if (type != XA_WINDOW) | ||
1585 | 65 | { | ||
1586 | 66 | XFree (w); | ||
1587 | 67 | return FALSE; | ||
1588 | 68 | } | ||
1589 | 69 | |||
1590 | 70 | *val = *w; | ||
1591 | 71 | XFree (w); | ||
1592 | 72 | |||
1593 | 73 | return TRUE; | ||
1594 | 74 | } | ||
1595 | 75 | |||
1596 | 76 | unsigned int | ||
1597 | 77 | get_mwm_prop (Window xwindow) | ||
1598 | 78 | { | ||
1599 | 79 | Display *xdisplay; | ||
1600 | 80 | Atom actual; | ||
1601 | 81 | int err, result, format; | ||
1602 | 82 | unsigned long n, left; | ||
1603 | 83 | unsigned char *data; | ||
1604 | 84 | unsigned int decor = MWM_DECOR_ALL; | ||
1605 | 85 | |||
1606 | 86 | xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
1607 | 87 | |||
1608 | 88 | gdk_error_trap_push (); | ||
1609 | 89 | |||
1610 | 90 | result = XGetWindowProperty (xdisplay, xwindow, mwm_hints_atom, | ||
1611 | 91 | 0L, 20L, FALSE, mwm_hints_atom, | ||
1612 | 92 | &actual, &format, &n, &left, &data); | ||
1613 | 93 | |||
1614 | 94 | err = gdk_error_trap_pop (); | ||
1615 | 95 | if (err != Success || result != Success) | ||
1616 | 96 | return decor; | ||
1617 | 97 | |||
1618 | 98 | if (data) | ||
1619 | 99 | { | ||
1620 | 100 | MwmHints *mwm_hints = (MwmHints *) data; | ||
1621 | 101 | |||
1622 | 102 | if (n >= PROP_MOTIF_WM_HINT_ELEMENTS) | ||
1623 | 103 | { | ||
1624 | 104 | if (mwm_hints->flags & MWM_HINTS_DECORATIONS) | ||
1625 | 105 | decor = mwm_hints->decorations; | ||
1626 | 106 | } | ||
1627 | 107 | |||
1628 | 108 | XFree (data); | ||
1629 | 109 | } | ||
1630 | 110 | |||
1631 | 111 | return decor; | ||
1632 | 112 | } | ||
1633 | 113 | |||
1634 | 114 | /* from clearlooks theme */ | ||
1635 | 115 | static void | ||
1636 | 116 | rgb_to_hls (gdouble *r, | ||
1637 | 117 | gdouble *g, | ||
1638 | 118 | gdouble *b) | ||
1639 | 119 | { | ||
1640 | 120 | gdouble min; | ||
1641 | 121 | gdouble max; | ||
1642 | 122 | gdouble red; | ||
1643 | 123 | gdouble green; | ||
1644 | 124 | gdouble blue; | ||
1645 | 125 | gdouble h, l, s; | ||
1646 | 126 | gdouble delta; | ||
1647 | 127 | |||
1648 | 128 | red = *r; | ||
1649 | 129 | green = *g; | ||
1650 | 130 | blue = *b; | ||
1651 | 131 | |||
1652 | 132 | if (red > green) | ||
1653 | 133 | { | ||
1654 | 134 | if (red > blue) | ||
1655 | 135 | max = red; | ||
1656 | 136 | else | ||
1657 | 137 | max = blue; | ||
1658 | 138 | |||
1659 | 139 | if (green < blue) | ||
1660 | 140 | min = green; | ||
1661 | 141 | else | ||
1662 | 142 | min = blue; | ||
1663 | 143 | } | ||
1664 | 144 | else | ||
1665 | 145 | { | ||
1666 | 146 | if (green > blue) | ||
1667 | 147 | max = green; | ||
1668 | 148 | else | ||
1669 | 149 | max = blue; | ||
1670 | 150 | |||
1671 | 151 | if (red < blue) | ||
1672 | 152 | min = red; | ||
1673 | 153 | else | ||
1674 | 154 | min = blue; | ||
1675 | 155 | } | ||
1676 | 156 | |||
1677 | 157 | l = (max + min) / 2; | ||
1678 | 158 | s = 0; | ||
1679 | 159 | h = 0; | ||
1680 | 160 | |||
1681 | 161 | if (max != min) | ||
1682 | 162 | { | ||
1683 | 163 | if (l <= 0.5) | ||
1684 | 164 | s = (max - min) / (max + min); | ||
1685 | 165 | else | ||
1686 | 166 | s = (max - min) / (2 - max - min); | ||
1687 | 167 | |||
1688 | 168 | delta = max -min; | ||
1689 | 169 | if (red == max) | ||
1690 | 170 | h = (green - blue) / delta; | ||
1691 | 171 | else if (green == max) | ||
1692 | 172 | h = 2 + (blue - red) / delta; | ||
1693 | 173 | else if (blue == max) | ||
1694 | 174 | h = 4 + (red - green) / delta; | ||
1695 | 175 | |||
1696 | 176 | h *= 60; | ||
1697 | 177 | if (h < 0.0) | ||
1698 | 178 | h += 360; | ||
1699 | 179 | } | ||
1700 | 180 | |||
1701 | 181 | *r = h; | ||
1702 | 182 | *g = l; | ||
1703 | 183 | *b = s; | ||
1704 | 184 | } | ||
1705 | 185 | |||
1706 | 186 | static void | ||
1707 | 187 | hls_to_rgb (gdouble *h, | ||
1708 | 188 | gdouble *l, | ||
1709 | 189 | gdouble *s) | ||
1710 | 190 | { | ||
1711 | 191 | gdouble hue; | ||
1712 | 192 | gdouble lightness; | ||
1713 | 193 | gdouble saturation; | ||
1714 | 194 | gdouble m1, m2; | ||
1715 | 195 | gdouble r, g, b; | ||
1716 | 196 | |||
1717 | 197 | lightness = *l; | ||
1718 | 198 | saturation = *s; | ||
1719 | 199 | |||
1720 | 200 | if (lightness <= 0.5) | ||
1721 | 201 | m2 = lightness * (1 + saturation); | ||
1722 | 202 | else | ||
1723 | 203 | m2 = lightness + saturation - lightness * saturation; | ||
1724 | 204 | |||
1725 | 205 | m1 = 2 * lightness - m2; | ||
1726 | 206 | |||
1727 | 207 | if (saturation == 0) | ||
1728 | 208 | { | ||
1729 | 209 | *h = lightness; | ||
1730 | 210 | *l = lightness; | ||
1731 | 211 | *s = lightness; | ||
1732 | 212 | } | ||
1733 | 213 | else | ||
1734 | 214 | { | ||
1735 | 215 | hue = *h + 120; | ||
1736 | 216 | while (hue > 360) | ||
1737 | 217 | hue -= 360; | ||
1738 | 218 | while (hue < 0) | ||
1739 | 219 | hue += 360; | ||
1740 | 220 | |||
1741 | 221 | if (hue < 60) | ||
1742 | 222 | r = m1 + (m2 - m1) * hue / 60; | ||
1743 | 223 | else if (hue < 180) | ||
1744 | 224 | r = m2; | ||
1745 | 225 | else if (hue < 240) | ||
1746 | 226 | r = m1 + (m2 - m1) * (240 - hue) / 60; | ||
1747 | 227 | else | ||
1748 | 228 | r = m1; | ||
1749 | 229 | |||
1750 | 230 | hue = *h; | ||
1751 | 231 | while (hue > 360) | ||
1752 | 232 | hue -= 360; | ||
1753 | 233 | while (hue < 0) | ||
1754 | 234 | hue += 360; | ||
1755 | 235 | |||
1756 | 236 | if (hue < 60) | ||
1757 | 237 | g = m1 + (m2 - m1) * hue / 60; | ||
1758 | 238 | else if (hue < 180) | ||
1759 | 239 | g = m2; | ||
1760 | 240 | else if (hue < 240) | ||
1761 | 241 | g = m1 + (m2 - m1) * (240 - hue) / 60; | ||
1762 | 242 | else | ||
1763 | 243 | g = m1; | ||
1764 | 244 | |||
1765 | 245 | hue = *h - 120; | ||
1766 | 246 | while (hue > 360) | ||
1767 | 247 | hue -= 360; | ||
1768 | 248 | while (hue < 0) | ||
1769 | 249 | hue += 360; | ||
1770 | 250 | |||
1771 | 251 | if (hue < 60) | ||
1772 | 252 | b = m1 + (m2 - m1) * hue / 60; | ||
1773 | 253 | else if (hue < 180) | ||
1774 | 254 | b = m2; | ||
1775 | 255 | else if (hue < 240) | ||
1776 | 256 | b = m1 + (m2 - m1) * (240 - hue) / 60; | ||
1777 | 257 | else | ||
1778 | 258 | b = m1; | ||
1779 | 259 | |||
1780 | 260 | *h = r; | ||
1781 | 261 | *l = g; | ||
1782 | 262 | *s = b; | ||
1783 | 263 | } | ||
1784 | 264 | } | ||
1785 | 265 | |||
1786 | 266 | void | ||
1787 | 267 | shade (const decor_color_t *a, | ||
1788 | 268 | decor_color_t *b, | ||
1789 | 269 | float k) | ||
1790 | 270 | { | ||
1791 | 271 | double red; | ||
1792 | 272 | double green; | ||
1793 | 273 | double blue; | ||
1794 | 274 | |||
1795 | 275 | red = a->r; | ||
1796 | 276 | green = a->g; | ||
1797 | 277 | blue = a->b; | ||
1798 | 278 | |||
1799 | 279 | rgb_to_hls (&red, &green, &blue); | ||
1800 | 280 | |||
1801 | 281 | green *= k; | ||
1802 | 282 | if (green > 1.0) | ||
1803 | 283 | green = 1.0; | ||
1804 | 284 | else if (green < 0.0) | ||
1805 | 285 | green = 0.0; | ||
1806 | 286 | |||
1807 | 287 | blue *= k; | ||
1808 | 288 | if (blue > 1.0) | ||
1809 | 289 | blue = 1.0; | ||
1810 | 290 | else if (blue < 0.0) | ||
1811 | 291 | blue = 0.0; | ||
1812 | 292 | |||
1813 | 293 | hls_to_rgb (&red, &green, &blue); | ||
1814 | 294 | |||
1815 | 295 | b->r = red; | ||
1816 | 296 | b->g = green; | ||
1817 | 297 | b->b = blue; | ||
1818 | 298 | } | ||
1819 | 299 | |||
1820 | 0 | 300 | ||
1821 | === removed file 'gtk/window-decorator/util.c' | |||
1822 | --- gtk/window-decorator/util.c 2011-02-21 09:53:08 +0000 | |||
1823 | +++ gtk/window-decorator/util.c 1970-01-01 00:00:00 +0000 | |||
1824 | @@ -1,299 +0,0 @@ | |||
1825 | 1 | /* | ||
1826 | 2 | * Copyright © 2006 Novell, Inc. | ||
1827 | 3 | * | ||
1828 | 4 | * This library is free software; you can redistribute it and/or | ||
1829 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
1830 | 6 | * License as published by the Free Software Foundation; either | ||
1831 | 7 | * version 2 of the License, or (at your option) any later version. | ||
1832 | 8 | * | ||
1833 | 9 | * This library is distributed in the hope that it will be useful, | ||
1834 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1835 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1836 | 12 | * Lesser General Public License for more details. | ||
1837 | 13 | * | ||
1838 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
1839 | 15 | * License along with this library; if not, write to the | ||
1840 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
1841 | 17 | * Boston, MA 02111-1307, USA. | ||
1842 | 18 | * | ||
1843 | 19 | * Author: David Reveman <davidr@novell.com> | ||
1844 | 20 | */ | ||
1845 | 21 | |||
1846 | 22 | #include "gtk-window-decorator.h" | ||
1847 | 23 | |||
1848 | 24 | double | ||
1849 | 25 | square (double x) | ||
1850 | 26 | { | ||
1851 | 27 | return x * x; | ||
1852 | 28 | } | ||
1853 | 29 | |||
1854 | 30 | double | ||
1855 | 31 | dist (double x1, double y1, | ||
1856 | 32 | double x2, double y2) | ||
1857 | 33 | { | ||
1858 | 34 | return sqrt (square (x1 - x2) + square (y1 - y2)); | ||
1859 | 35 | } | ||
1860 | 36 | |||
1861 | 37 | gboolean | ||
1862 | 38 | get_window_prop (Window xwindow, | ||
1863 | 39 | Atom atom, | ||
1864 | 40 | Window *val) | ||
1865 | 41 | { | ||
1866 | 42 | Atom type; | ||
1867 | 43 | int format; | ||
1868 | 44 | gulong nitems; | ||
1869 | 45 | gulong bytes_after; | ||
1870 | 46 | Window *w; | ||
1871 | 47 | int err, result; | ||
1872 | 48 | |||
1873 | 49 | *val = 0; | ||
1874 | 50 | |||
1875 | 51 | gdk_error_trap_push (); | ||
1876 | 52 | |||
1877 | 53 | type = None; | ||
1878 | 54 | result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), | ||
1879 | 55 | xwindow, | ||
1880 | 56 | atom, | ||
1881 | 57 | 0, G_MAXLONG, | ||
1882 | 58 | False, XA_WINDOW, &type, &format, &nitems, | ||
1883 | 59 | &bytes_after, (void*) &w); | ||
1884 | 60 | err = gdk_error_trap_pop (); | ||
1885 | 61 | if (err != Success || result != Success) | ||
1886 | 62 | return FALSE; | ||
1887 | 63 | |||
1888 | 64 | if (type != XA_WINDOW) | ||
1889 | 65 | { | ||
1890 | 66 | XFree (w); | ||
1891 | 67 | return FALSE; | ||
1892 | 68 | } | ||
1893 | 69 | |||
1894 | 70 | *val = *w; | ||
1895 | 71 | XFree (w); | ||
1896 | 72 | |||
1897 | 73 | return TRUE; | ||
1898 | 74 | } | ||
1899 | 75 | |||
1900 | 76 | unsigned int | ||
1901 | 77 | get_mwm_prop (Window xwindow) | ||
1902 | 78 | { | ||
1903 | 79 | Display *xdisplay; | ||
1904 | 80 | Atom actual; | ||
1905 | 81 | int err, result, format; | ||
1906 | 82 | unsigned long n, left; | ||
1907 | 83 | unsigned char *data; | ||
1908 | 84 | unsigned int decor = MWM_DECOR_ALL; | ||
1909 | 85 | |||
1910 | 86 | xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
1911 | 87 | |||
1912 | 88 | gdk_error_trap_push (); | ||
1913 | 89 | |||
1914 | 90 | result = XGetWindowProperty (xdisplay, xwindow, mwm_hints_atom, | ||
1915 | 91 | 0L, 20L, FALSE, mwm_hints_atom, | ||
1916 | 92 | &actual, &format, &n, &left, &data); | ||
1917 | 93 | |||
1918 | 94 | err = gdk_error_trap_pop (); | ||
1919 | 95 | if (err != Success || result != Success) | ||
1920 | 96 | return decor; | ||
1921 | 97 | |||
1922 | 98 | if (data) | ||
1923 | 99 | { | ||
1924 | 100 | MwmHints *mwm_hints = (MwmHints *) data; | ||
1925 | 101 | |||
1926 | 102 | if (n >= PROP_MOTIF_WM_HINT_ELEMENTS) | ||
1927 | 103 | { | ||
1928 | 104 | if (mwm_hints->flags & MWM_HINTS_DECORATIONS) | ||
1929 | 105 | decor = mwm_hints->decorations; | ||
1930 | 106 | } | ||
1931 | 107 | |||
1932 | 108 | XFree (data); | ||
1933 | 109 | } | ||
1934 | 110 | |||
1935 | 111 | return decor; | ||
1936 | 112 | } | ||
1937 | 113 | |||
1938 | 114 | /* from clearlooks theme */ | ||
1939 | 115 | static void | ||
1940 | 116 | rgb_to_hls (gdouble *r, | ||
1941 | 117 | gdouble *g, | ||
1942 | 118 | gdouble *b) | ||
1943 | 119 | { | ||
1944 | 120 | gdouble min; | ||
1945 | 121 | gdouble max; | ||
1946 | 122 | gdouble red; | ||
1947 | 123 | gdouble green; | ||
1948 | 124 | gdouble blue; | ||
1949 | 125 | gdouble h, l, s; | ||
1950 | 126 | gdouble delta; | ||
1951 | 127 | |||
1952 | 128 | red = *r; | ||
1953 | 129 | green = *g; | ||
1954 | 130 | blue = *b; | ||
1955 | 131 | |||
1956 | 132 | if (red > green) | ||
1957 | 133 | { | ||
1958 | 134 | if (red > blue) | ||
1959 | 135 | max = red; | ||
1960 | 136 | else | ||
1961 | 137 | max = blue; | ||
1962 | 138 | |||
1963 | 139 | if (green < blue) | ||
1964 | 140 | min = green; | ||
1965 | 141 | else | ||
1966 | 142 | min = blue; | ||
1967 | 143 | } | ||
1968 | 144 | else | ||
1969 | 145 | { | ||
1970 | 146 | if (green > blue) | ||
1971 | 147 | max = green; | ||
1972 | 148 | else | ||
1973 | 149 | max = blue; | ||
1974 | 150 | |||
1975 | 151 | if (red < blue) | ||
1976 | 152 | min = red; | ||
1977 | 153 | else | ||
1978 | 154 | min = blue; | ||
1979 | 155 | } | ||
1980 | 156 | |||
1981 | 157 | l = (max + min) / 2; | ||
1982 | 158 | s = 0; | ||
1983 | 159 | h = 0; | ||
1984 | 160 | |||
1985 | 161 | if (max != min) | ||
1986 | 162 | { | ||
1987 | 163 | if (l <= 0.5) | ||
1988 | 164 | s = (max - min) / (max + min); | ||
1989 | 165 | else | ||
1990 | 166 | s = (max - min) / (2 - max - min); | ||
1991 | 167 | |||
1992 | 168 | delta = max -min; | ||
1993 | 169 | if (red == max) | ||
1994 | 170 | h = (green - blue) / delta; | ||
1995 | 171 | else if (green == max) | ||
1996 | 172 | h = 2 + (blue - red) / delta; | ||
1997 | 173 | else if (blue == max) | ||
1998 | 174 | h = 4 + (red - green) / delta; | ||
1999 | 175 | |||
2000 | 176 | h *= 60; | ||
2001 | 177 | if (h < 0.0) | ||
2002 | 178 | h += 360; | ||
2003 | 179 | } | ||
2004 | 180 | |||
2005 | 181 | *r = h; | ||
2006 | 182 | *g = l; | ||
2007 | 183 | *b = s; | ||
2008 | 184 | } | ||
2009 | 185 | |||
2010 | 186 | static void | ||
2011 | 187 | hls_to_rgb (gdouble *h, | ||
2012 | 188 | gdouble *l, | ||
2013 | 189 | gdouble *s) | ||
2014 | 190 | { | ||
2015 | 191 | gdouble hue; | ||
2016 | 192 | gdouble lightness; | ||
2017 | 193 | gdouble saturation; | ||
2018 | 194 | gdouble m1, m2; | ||
2019 | 195 | gdouble r, g, b; | ||
2020 | 196 | |||
2021 | 197 | lightness = *l; | ||
2022 | 198 | saturation = *s; | ||
2023 | 199 | |||
2024 | 200 | if (lightness <= 0.5) | ||
2025 | 201 | m2 = lightness * (1 + saturation); | ||
2026 | 202 | else | ||
2027 | 203 | m2 = lightness + saturation - lightness * saturation; | ||
2028 | 204 | |||
2029 | 205 | m1 = 2 * lightness - m2; | ||
2030 | 206 | |||
2031 | 207 | if (saturation == 0) | ||
2032 | 208 | { | ||
2033 | 209 | *h = lightness; | ||
2034 | 210 | *l = lightness; | ||
2035 | 211 | *s = lightness; | ||
2036 | 212 | } | ||
2037 | 213 | else | ||
2038 | 214 | { | ||
2039 | 215 | hue = *h + 120; | ||
2040 | 216 | while (hue > 360) | ||
2041 | 217 | hue -= 360; | ||
2042 | 218 | while (hue < 0) | ||
2043 | 219 | hue += 360; | ||
2044 | 220 | |||
2045 | 221 | if (hue < 60) | ||
2046 | 222 | r = m1 + (m2 - m1) * hue / 60; | ||
2047 | 223 | else if (hue < 180) | ||
2048 | 224 | r = m2; | ||
2049 | 225 | else if (hue < 240) | ||
2050 | 226 | r = m1 + (m2 - m1) * (240 - hue) / 60; | ||
2051 | 227 | else | ||
2052 | 228 | r = m1; | ||
2053 | 229 | |||
2054 | 230 | hue = *h; | ||
2055 | 231 | while (hue > 360) | ||
2056 | 232 | hue -= 360; | ||
2057 | 233 | while (hue < 0) | ||
2058 | 234 | hue += 360; | ||
2059 | 235 | |||
2060 | 236 | if (hue < 60) | ||
2061 | 237 | g = m1 + (m2 - m1) * hue / 60; | ||
2062 | 238 | else if (hue < 180) | ||
2063 | 239 | g = m2; | ||
2064 | 240 | else if (hue < 240) | ||
2065 | 241 | g = m1 + (m2 - m1) * (240 - hue) / 60; | ||
2066 | 242 | else | ||
2067 | 243 | g = m1; | ||
2068 | 244 | |||
2069 | 245 | hue = *h - 120; | ||
2070 | 246 | while (hue > 360) | ||
2071 | 247 | hue -= 360; | ||
2072 | 248 | while (hue < 0) | ||
2073 | 249 | hue += 360; | ||
2074 | 250 | |||
2075 | 251 | if (hue < 60) | ||
2076 | 252 | b = m1 + (m2 - m1) * hue / 60; | ||
2077 | 253 | else if (hue < 180) | ||
2078 | 254 | b = m2; | ||
2079 | 255 | else if (hue < 240) | ||
2080 | 256 | b = m1 + (m2 - m1) * (240 - hue) / 60; | ||
2081 | 257 | else | ||
2082 | 258 | b = m1; | ||
2083 | 259 | |||
2084 | 260 | *h = r; | ||
2085 | 261 | *l = g; | ||
2086 | 262 | *s = b; | ||
2087 | 263 | } | ||
2088 | 264 | } | ||
2089 | 265 | |||
2090 | 266 | void | ||
2091 | 267 | shade (const decor_color_t *a, | ||
2092 | 268 | decor_color_t *b, | ||
2093 | 269 | float k) | ||
2094 | 270 | { | ||
2095 | 271 | double red; | ||
2096 | 272 | double green; | ||
2097 | 273 | double blue; | ||
2098 | 274 | |||
2099 | 275 | red = a->r; | ||
2100 | 276 | green = a->g; | ||
2101 | 277 | blue = a->b; | ||
2102 | 278 | |||
2103 | 279 | rgb_to_hls (&red, &green, &blue); | ||
2104 | 280 | |||
2105 | 281 | green *= k; | ||
2106 | 282 | if (green > 1.0) | ||
2107 | 283 | green = 1.0; | ||
2108 | 284 | else if (green < 0.0) | ||
2109 | 285 | green = 0.0; | ||
2110 | 286 | |||
2111 | 287 | blue *= k; | ||
2112 | 288 | if (blue > 1.0) | ||
2113 | 289 | blue = 1.0; | ||
2114 | 290 | else if (blue < 0.0) | ||
2115 | 291 | blue = 0.0; | ||
2116 | 292 | |||
2117 | 293 | hls_to_rgb (&red, &green, &blue); | ||
2118 | 294 | |||
2119 | 295 | b->r = red; | ||
2120 | 296 | b->g = green; | ||
2121 | 297 | b->b = blue; | ||
2122 | 298 | } | ||
2123 | 299 | |||
2124 | 300 | 0 | ||
2125 | === modified file 'plugins/annotate/src/annotate.cpp' | |||
2126 | --- plugins/annotate/src/annotate.cpp 2012-01-30 05:12:24 +0000 | |||
2127 | +++ plugins/annotate/src/annotate.cpp 2012-05-17 07:01:21 +0000 | |||
2128 | @@ -629,11 +629,14 @@ | |||
2129 | 629 | 629 | ||
2130 | 630 | if (status) | 630 | if (status) |
2131 | 631 | { | 631 | { |
2132 | 632 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | ||
2133 | 633 | GLfloat vertexData[18]; | ||
2134 | 634 | GLfloat textureData[12]; | ||
2135 | 632 | CompRect rect; | 635 | CompRect rect; |
2136 | 633 | GLMatrix sTransform = transform; | 636 | GLMatrix sTransform = transform; |
2137 | 634 | int numRect; | 637 | int numRect; |
2138 | 635 | int pos = 0; | 638 | int pos = 0; |
2140 | 636 | float vectorX, vectorY, offset; | 639 | float offset; |
2141 | 637 | int angle; | 640 | int angle; |
2142 | 638 | 641 | ||
2143 | 639 | offset = optionGetStrokeWidth () / 2; | 642 | offset = optionGetStrokeWidth () / 2; |
2144 | @@ -641,10 +644,6 @@ | |||
2145 | 641 | /* This replaced prepareXCoords (s, output, -DEFAULT_Z_CAMERA) */ | 644 | /* This replaced prepareXCoords (s, output, -DEFAULT_Z_CAMERA) */ |
2146 | 642 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); | 645 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); |
2147 | 643 | 646 | ||
2148 | 644 | glPushMatrix (); | ||
2149 | 645 | glLoadMatrixf (sTransform.getMatrix ()); | ||
2150 | 646 | |||
2151 | 647 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
2152 | 648 | glEnable (GL_BLEND); | 647 | glEnable (GL_BLEND); |
2153 | 649 | 648 | ||
2154 | 650 | if (content && !region.isEmpty ()) | 649 | if (content && !region.isEmpty ()) |
2155 | @@ -656,34 +655,66 @@ | |||
2156 | 656 | 655 | ||
2157 | 657 | tex->enable (GLTexture::Fast); | 656 | tex->enable (GLTexture::Fast); |
2158 | 658 | 657 | ||
2160 | 659 | glBegin (GL_QUADS); | 658 | streamingBuffer->begin (GL_TRIANGLES); |
2161 | 660 | 659 | ||
2162 | 661 | while (numRect--) | 660 | while (numRect--) |
2163 | 662 | { | 661 | { |
2184 | 663 | glTexCoord2f ( | 662 | GLfloat tx1 = COMP_TEX_COORD_X (tex->matrix (), |
2185 | 664 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()), | 663 | rect.at (pos).x1 ()); |
2186 | 665 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ())); | 664 | GLfloat tx2 = COMP_TEX_COORD_X (tex->matrix (), |
2187 | 666 | glVertex2i (rect.at (pos).x1 (), rect.at (pos).y2 ()); | 665 | rect.at (pos).x2 ()); |
2188 | 667 | 666 | GLfloat ty1 = COMP_TEX_COORD_Y (tex->matrix (), | |
2189 | 668 | glTexCoord2f ( | 667 | rect.at (pos).y1 ()); |
2190 | 669 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()), | 668 | GLfloat ty2 = COMP_TEX_COORD_Y (tex->matrix (), |
2191 | 670 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y2 ())); | 669 | rect.at (pos).y2 ()); |
2192 | 671 | glVertex2i (rect.at (pos).x2 (), rect.at (pos).y2 ()); | 670 | |
2193 | 672 | 671 | vertexData[0] = rect.at (pos).x1 (); | |
2194 | 673 | glTexCoord2f ( | 672 | vertexData[1] = rect.at (pos).y1 (); |
2195 | 674 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x2 ()), | 673 | vertexData[2] = 0.0f; |
2196 | 675 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ())); | 674 | vertexData[3] = rect.at (pos).x1 (); |
2197 | 676 | glVertex2i (rect.at (pos).x2 (), rect.at (pos).y1 ()); | 675 | vertexData[4] = rect.at (pos).y2 (); |
2198 | 677 | 676 | vertexData[5] = 0.0f; | |
2199 | 678 | glTexCoord2f ( | 677 | vertexData[6] = rect.at (pos).x2 (); |
2200 | 679 | COMP_TEX_COORD_X (tex->matrix (), rect.at (pos).x1 ()), | 678 | vertexData[7] = rect.at (pos).y1 (); |
2201 | 680 | COMP_TEX_COORD_Y (tex->matrix (), rect.at (pos).y1 ())); | 679 | vertexData[8] = 0.0f; |
2202 | 681 | glVertex2i (rect.at (pos).x1 (), rect.at (pos).y1 ()); | 680 | vertexData[9] = rect.at (pos).x1 (); |
2203 | 682 | 681 | vertexData[10] = rect.at (pos).y2 (); | |
2204 | 682 | vertexData[11] = 0.0f; | ||
2205 | 683 | |||
2206 | 684 | vertexData[12] = rect.at (pos).x2 (); | ||
2207 | 685 | vertexData[13] = rect.at (pos).y2 (); | ||
2208 | 686 | vertexData[14] = 0.0f; | ||
2209 | 687 | |||
2210 | 688 | vertexData[15] = rect.at (pos).x2 (); | ||
2211 | 689 | vertexData[16] = rect.at (pos).y1 (); | ||
2212 | 690 | vertexData[17] = 0.0f; | ||
2213 | 691 | |||
2214 | 692 | textureData[0] = tx1; | ||
2215 | 693 | textureData[1] = ty1; | ||
2216 | 694 | |||
2217 | 695 | textureData[2] = tx1; | ||
2218 | 696 | textureData[3] = ty2; | ||
2219 | 697 | |||
2220 | 698 | textureData[4] = tx2; | ||
2221 | 699 | textureData[5] = ty1; | ||
2222 | 700 | |||
2223 | 701 | textureData[6] = tx1; | ||
2224 | 702 | textureData[7] = ty2; | ||
2225 | 703 | |||
2226 | 704 | textureData[8] = tx2; | ||
2227 | 705 | textureData[9] = ty2; | ||
2228 | 706 | |||
2229 | 707 | textureData[10] = tx2; | ||
2230 | 708 | textureData[11] = ty1; | ||
2231 | 709 | |||
2232 | 710 | streamingBuffer->addVertices (6, vertexData); | ||
2233 | 711 | streamingBuffer->addTexCoords (0, 6, textureData); | ||
2234 | 683 | pos++; | 712 | pos++; |
2235 | 684 | } | 713 | } |
2236 | 685 | 714 | ||
2238 | 686 | glEnd (); | 715 | streamingBuffer->end (); |
2239 | 716 | streamingBuffer->render (sTransform); | ||
2240 | 717 | |||
2241 | 687 | tex->disable (); | 718 | tex->disable (); |
2242 | 688 | } | 719 | } |
2243 | 689 | } | 720 | } |
2244 | @@ -691,85 +722,132 @@ | |||
2245 | 691 | switch (drawMode) | 722 | switch (drawMode) |
2246 | 692 | { | 723 | { |
2247 | 693 | case LineMode: | 724 | case LineMode: |
2248 | 694 | glColor4usv (optionGetStrokeColor ()); | ||
2249 | 695 | glLineWidth (optionGetStrokeWidth ()); | 725 | glLineWidth (optionGetStrokeWidth ()); |
2254 | 696 | glBegin (GL_LINES); | 726 | |
2255 | 697 | glVertex2i (initialPointerX, initialPointerY); | 727 | streamingBuffer->begin (GL_LINES); |
2256 | 698 | glVertex2i (lineVector.x (), lineVector.y ()); | 728 | |
2257 | 699 | glEnd (); | 729 | streamingBuffer->addColors (1, optionGetStrokeColor ()); |
2258 | 730 | |||
2259 | 731 | vertexData[0] = initialPointerX; | ||
2260 | 732 | vertexData[1] = initialPointerY; | ||
2261 | 733 | vertexData[2] = 0.0f; | ||
2262 | 734 | vertexData[3] = lineVector.x (); | ||
2263 | 735 | vertexData[4] = lineVector.y (); | ||
2264 | 736 | vertexData[5] = 0.0f; | ||
2265 | 737 | streamingBuffer->addVertices (2, vertexData); | ||
2266 | 738 | |||
2267 | 739 | streamingBuffer->end (); | ||
2268 | 740 | streamingBuffer->render (sTransform); | ||
2269 | 700 | break; | 741 | break; |
2270 | 701 | 742 | ||
2271 | 702 | case RectangleMode: | 743 | case RectangleMode: |
2272 | 744 | vertexData[0] = rectangle.x1 (); | ||
2273 | 745 | vertexData[1] = rectangle.y1 (); | ||
2274 | 746 | vertexData[2] = 0.0f; | ||
2275 | 747 | vertexData[3] = rectangle.x1 (); | ||
2276 | 748 | vertexData[4] = rectangle.y2 (); | ||
2277 | 749 | vertexData[5] = 0.0f; | ||
2278 | 750 | vertexData[6] = rectangle.x2 (); | ||
2279 | 751 | vertexData[7] = rectangle.y1 (); | ||
2280 | 752 | vertexData[8] = 0.0f; | ||
2281 | 753 | vertexData[9] = rectangle.x2 (); | ||
2282 | 754 | vertexData[10] = rectangle.y2 (); | ||
2283 | 755 | vertexData[11] = 0.0f; | ||
2284 | 756 | |||
2285 | 703 | /* fill rectangle */ | 757 | /* fill rectangle */ |
2289 | 704 | glColor4usv (optionGetFillColor ()); | 758 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
2290 | 705 | glRecti (rectangle.x1 (), rectangle.y2 (), | 759 | |
2291 | 706 | rectangle.x2 (), rectangle.y1 ()); | 760 | streamingBuffer->addColors (1, optionGetFillColor ()); |
2292 | 761 | streamingBuffer->addVertices (4, vertexData); | ||
2293 | 762 | |||
2294 | 763 | streamingBuffer->end (); | ||
2295 | 764 | streamingBuffer->render (sTransform); | ||
2296 | 707 | 765 | ||
2297 | 708 | /* draw rectangle outline */ | 766 | /* draw rectangle outline */ |
2301 | 709 | glColor4usv (optionGetStrokeColor ()); | 767 | /* streamingBuffer->begin (); |
2302 | 710 | glRecti (rectangle.x1 () - offset, rectangle.y2 (), | 768 | |
2303 | 711 | rectangle.x1 () + offset, rectangle.y1 ()); | 769 | streamingBuffer->addColors (1, optionGetStrokeColor ()); |
2304 | 770 | |||
2305 | 771 | vertexData[0] = rectangle.x1 () - offset; | ||
2306 | 772 | vertexData[3] = rectangle.x1 () - offset; | ||
2307 | 773 | streamingBuffer->addVertices (4, vertexData); | ||
2308 | 774 | |||
2309 | 712 | glRecti (rectangle.x2 () - offset, rectangle.y2 (), | 775 | glRecti (rectangle.x2 () - offset, rectangle.y2 (), |
2310 | 713 | rectangle.x2 () + offset, rectangle.y1 ()); | 776 | rectangle.x2 () + offset, rectangle.y1 ()); |
2311 | 714 | glRecti (rectangle.x1 () - offset, rectangle.y1 () + offset, | 777 | glRecti (rectangle.x1 () - offset, rectangle.y1 () + offset, |
2312 | 715 | rectangle.x2 () + offset, rectangle.y1 () - offset); | 778 | rectangle.x2 () + offset, rectangle.y1 () - offset); |
2313 | 716 | glRecti (rectangle.x1 () - offset, rectangle.y2 () + offset, | 779 | glRecti (rectangle.x1 () - offset, rectangle.y2 () + offset, |
2315 | 717 | rectangle.x2 () + offset, rectangle.y2 () - offset); | 780 | rectangle.x2 () + offset, rectangle.y2 () - offset);*/ |
2316 | 718 | break; | 781 | break; |
2317 | 719 | 782 | ||
2318 | 720 | case EllipseMode: | 783 | case EllipseMode: |
2319 | 721 | /* fill ellipse */ | 784 | /* fill ellipse */ |
2324 | 722 | glColor4usv (optionGetFillColor ()); | 785 | streamingBuffer->begin (GL_TRIANGLE_FAN); |
2325 | 723 | 786 | ||
2326 | 724 | glBegin (GL_TRIANGLE_FAN); | 787 | streamingBuffer->addColors (1, optionGetFillColor ()); |
2327 | 725 | glVertex2d (ellipse.center.x (), ellipse.center.y ()); | 788 | |
2328 | 789 | vertexData[0] = ellipse.center.x (); | ||
2329 | 790 | vertexData[1] = ellipse.center.y (); | ||
2330 | 791 | vertexData[2] = 0.0f; | ||
2331 | 792 | streamingBuffer->addVertices (1, vertexData); | ||
2332 | 793 | |||
2333 | 726 | for (angle = 0; angle <= 360; angle += 1) | 794 | for (angle = 0; angle <= 360; angle += 1) |
2334 | 727 | { | 795 | { |
2340 | 728 | vectorX = ellipse.center.x () + | 796 | vertexData[0] = ellipse.center.x () + |
2341 | 729 | (ellipse.radiusX * sinf (angle * DEG2RAD)); | 797 | (ellipse.radiusX * sinf (angle * DEG2RAD)); |
2342 | 730 | vectorY = ellipse.center.y () + | 798 | vertexData[1] = ellipse.center.y () + |
2343 | 731 | (ellipse.radiusY * cosf (angle * DEG2RAD)); | 799 | (ellipse.radiusY * cosf (angle * DEG2RAD)); |
2344 | 732 | glVertex2d (vectorX, vectorY); | 800 | streamingBuffer->addVertices (1, vertexData); |
2345 | 733 | } | 801 | } |
2349 | 734 | glVertex2d (ellipse.center.x (), ellipse.center.y () + | 802 | |
2350 | 735 | ellipse.radiusY); | 803 | vertexData[0] = ellipse.center.x (); |
2351 | 736 | glEnd(); | 804 | vertexData[1] = ellipse.center.y () + ellipse.radiusY; |
2352 | 805 | streamingBuffer->addVertices (1, vertexData); | ||
2353 | 806 | |||
2354 | 807 | streamingBuffer->end (); | ||
2355 | 808 | streamingBuffer->render (sTransform); | ||
2356 | 737 | 809 | ||
2357 | 738 | /* draw ellipse outline */ | 810 | /* draw ellipse outline */ |
2358 | 739 | glColor4usv (optionGetStrokeColor ()); | ||
2359 | 740 | glLineWidth (optionGetStrokeWidth ()); | 811 | glLineWidth (optionGetStrokeWidth ()); |
2360 | 741 | 812 | ||
2364 | 742 | glBegin (GL_TRIANGLE_STRIP); | 813 | streamingBuffer->begin (GL_TRIANGLE_STRIP); |
2365 | 743 | glVertex2d (ellipse.center.x (), ellipse.center.y () + | 814 | |
2366 | 744 | ellipse.radiusY - offset); | 815 | streamingBuffer->addColors (1, optionGetStrokeColor ()); |
2367 | 816 | |||
2368 | 817 | |||
2369 | 818 | vertexData[0] = ellipse.center.x (); | ||
2370 | 819 | vertexData[1] = ellipse.center.y () + ellipse.radiusY - offset; | ||
2371 | 820 | vertexData[2] = 0.0f; | ||
2372 | 821 | streamingBuffer->addVertices (1, vertexData); | ||
2373 | 822 | |||
2374 | 745 | for (angle = 360; angle >= 0; angle -= 1) | 823 | for (angle = 360; angle >= 0; angle -= 1) |
2375 | 746 | { | 824 | { |
2386 | 747 | vectorX = ellipse.center.x () + ((ellipse.radiusX - | 825 | vertexData[0] = ellipse.center.x () + ((ellipse.radiusX - |
2387 | 748 | offset) * sinf (angle * DEG2RAD)); | 826 | offset) * sinf (angle * DEG2RAD)); |
2388 | 749 | vectorY = ellipse.center.y () + ((ellipse.radiusY - | 827 | vertexData[1] = ellipse.center.y () + ((ellipse.radiusY - |
2389 | 750 | offset) * cosf (angle * DEG2RAD)); | 828 | offset) * cosf (angle * DEG2RAD)); |
2390 | 751 | glVertex2d (vectorX, vectorY); | 829 | vertexData[2] = 0.0f; |
2391 | 752 | vectorX = ellipse.center.x () + ((ellipse.radiusX + | 830 | vertexData[3] = ellipse.center.x () + ((ellipse.radiusX + |
2392 | 753 | offset) * sinf (angle * DEG2RAD)); | 831 | offset) * sinf (angle * DEG2RAD)); |
2393 | 754 | vectorY = ellipse.center.y () + ((ellipse.radiusY + | 832 | vertexData[4] = ellipse.center.y () + ((ellipse.radiusY + |
2394 | 755 | offset) * cosf (angle * DEG2RAD)); | 833 | offset) * cosf (angle * DEG2RAD)); |
2395 | 756 | glVertex2d (vectorX, vectorY); | 834 | vertexData[5] = 0.0f; |
2396 | 835 | streamingBuffer->addVertices (2, vertexData); | ||
2397 | 757 | } | 836 | } |
2401 | 758 | glVertex2d (ellipse.center.x (), ellipse.center.y () + | 837 | |
2402 | 759 | ellipse.radiusY + offset); | 838 | vertexData[0] = ellipse.center.x (); |
2403 | 760 | glEnd(); | 839 | vertexData[1] = ellipse.center.y () + ellipse.radiusY + offset; |
2404 | 840 | streamingBuffer->addVertices (1, vertexData); | ||
2405 | 841 | |||
2406 | 842 | streamingBuffer->end (); | ||
2407 | 843 | streamingBuffer->render (sTransform); | ||
2408 | 761 | break; | 844 | break; |
2409 | 762 | 845 | ||
2410 | 763 | default: | 846 | default: |
2411 | 764 | break; | 847 | break; |
2412 | 765 | } | 848 | } |
2413 | 766 | 849 | ||
2414 | 767 | /* clean up */ | ||
2415 | 768 | glColor4usv (defaultColor); | ||
2416 | 769 | glDisable (GL_BLEND); | 850 | glDisable (GL_BLEND); |
2417 | 770 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
2418 | 771 | |||
2419 | 772 | glPopMatrix (); | ||
2420 | 773 | } | 851 | } |
2421 | 774 | 852 | ||
2422 | 775 | return status; | 853 | return status; |
2423 | 776 | 854 | ||
2424 | === modified file 'plugins/blur/CMakeLists.txt' | |||
2425 | --- plugins/blur/CMakeLists.txt 2011-01-24 06:28:52 +0000 | |||
2426 | +++ plugins/blur/CMakeLists.txt 2012-05-17 07:01:21 +0000 | |||
2427 | @@ -2,15 +2,15 @@ | |||
2428 | 2 | 2 | ||
2429 | 3 | include (CompizPlugin) | 3 | include (CompizPlugin) |
2430 | 4 | 4 | ||
2443 | 5 | find_package (OpenGL) | 5 | #find_package (OpenGL) |
2444 | 6 | 6 | ||
2445 | 7 | if (OPENGL_GLU_FOUND) | 7 | #if (OPENGL_GLU_FOUND) |
2446 | 8 | compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) | 8 | # compiz_plugin(blur PLUGINDEPS composite opengl LIBRARIES decoration ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) |
2447 | 9 | 9 | ||
2448 | 10 | if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) | 10 | # if (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) |
2449 | 11 | set_target_properties ( | 11 | # set_target_properties ( |
2450 | 12 | blur PROPERTIES | 12 | # blur PROPERTIES |
2451 | 13 | INSTALL_RPATH "${COMPIZ_LIBDIR}" | 13 | # INSTALL_RPATH "${COMPIZ_LIBDIR}" |
2452 | 14 | ) | 14 | # ) |
2453 | 15 | endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) | 15 | # endif (COMPIZ_BUILD_WITH_RPATH AND NOT COMPIZ_DISABLE_PLUGIN_BLUR) |
2454 | 16 | endif () | 16 | #endif () |
2455 | 17 | 17 | ||
2456 | === modified file 'plugins/clone/src/clone.cpp' | |||
2457 | --- plugins/clone/src/clone.cpp 2010-02-04 17:16:02 +0000 | |||
2458 | +++ plugins/clone/src/clone.cpp 2012-05-17 07:01:21 +0000 | |||
2459 | @@ -295,9 +295,6 @@ | |||
2460 | 295 | 0.0f); | 295 | 0.0f); |
2461 | 296 | sTransform.scale (zoomX, zoomY, 1.0f); | 296 | sTransform.scale (zoomX, zoomY, 1.0f); |
2462 | 297 | 297 | ||
2463 | 298 | glPushMatrix (); | ||
2464 | 299 | glLoadMatrixf (sTransform.getMatrix ()); | ||
2465 | 300 | |||
2466 | 301 | filter = gScreen->textureFilter (); | 298 | filter = gScreen->textureFilter (); |
2467 | 302 | 299 | ||
2468 | 303 | if (offset == 0.0f) | 300 | if (offset == 0.0f) |
2469 | @@ -325,8 +322,6 @@ | |||
2470 | 325 | } | 322 | } |
2471 | 326 | 323 | ||
2472 | 327 | gScreen->setTextureFilter (filter); | 324 | gScreen->setTextureFilter (filter); |
2473 | 328 | |||
2474 | 329 | glPopMatrix (); | ||
2475 | 330 | } | 325 | } |
2476 | 331 | 326 | ||
2477 | 332 | return status; | 327 | return status; |
2478 | 333 | 328 | ||
2479 | === modified file 'plugins/compiztoolbox/src/compiztoolbox.cpp' | |||
2480 | --- plugins/compiztoolbox/src/compiztoolbox.cpp 2012-01-18 16:26:45 +0000 | |||
2481 | +++ plugins/compiztoolbox/src/compiztoolbox.cpp 2012-05-17 07:01:21 +0000 | |||
2482 | @@ -465,9 +465,7 @@ | |||
2483 | 465 | sAttrib.yTranslate = wy - g.y () + | 465 | sAttrib.yTranslate = wy - g.y () + |
2484 | 466 | window->border ().top * sAttrib.yScale; | 466 | window->border ().top * sAttrib.yScale; |
2485 | 467 | 467 | ||
2489 | 468 | GLFragment::Attrib fragment (sAttrib); | 468 | if (window->alpha () || sAttrib.opacity != OPAQUE) |
2487 | 469 | |||
2488 | 470 | if (window->alpha () || fragment.getOpacity () != OPAQUE) | ||
2490 | 471 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; | 469 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; |
2491 | 472 | 470 | ||
2492 | 473 | wTransform.translate (g.x (), g.y (), 0.0f); | 471 | wTransform.translate (g.x (), g.y (), 0.0f); |
2493 | @@ -476,9 +474,6 @@ | |||
2494 | 476 | sAttrib.yTranslate / sAttrib.yScale - g.y (), | 474 | sAttrib.yTranslate / sAttrib.yScale - g.y (), |
2495 | 477 | 0.0f); | 475 | 0.0f); |
2496 | 478 | 476 | ||
2497 | 479 | glPushMatrix (); | ||
2498 | 480 | glLoadMatrixf (wTransform.getMatrix ()); | ||
2499 | 481 | |||
2500 | 482 | filter = gScreen->textureFilter (); | 477 | filter = gScreen->textureFilter (); |
2501 | 483 | 478 | ||
2502 | 484 | if (baseScreen->getMipmap ()) | 479 | if (baseScreen->getMipmap ()) |
2503 | @@ -488,13 +483,11 @@ | |||
2504 | 488 | very ugly but necessary until the vertex stage has been made | 483 | very ugly but necessary until the vertex stage has been made |
2505 | 489 | fully pluggable. */ | 484 | fully pluggable. */ |
2506 | 490 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); | 485 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); |
2508 | 491 | gWindow->glDraw (wTransform, fragment, infiniteRegion, mask); | 486 | gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask); |
2509 | 492 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); | 487 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); |
2510 | 493 | 488 | ||
2511 | 494 | gScreen->setTextureFilter (filter); | 489 | gScreen->setTextureFilter (filter); |
2512 | 495 | 490 | ||
2513 | 496 | glPopMatrix (); | ||
2514 | 497 | |||
2515 | 498 | if (iconMode != HideIcon) | 491 | if (iconMode != HideIcon) |
2516 | 499 | { | 492 | { |
2517 | 500 | icon = gWindow->getIcon (MAX_ICON_SIZE, MAX_ICON_SIZE); | 493 | icon = gWindow->getIcon (MAX_ICON_SIZE, MAX_ICON_SIZE); |
2518 | @@ -535,30 +528,23 @@ | |||
2519 | 535 | sAttrib.xTranslate = wx - g.x (); | 528 | sAttrib.xTranslate = wx - g.x (); |
2520 | 536 | sAttrib.yTranslate = wy - g.y (); | 529 | sAttrib.yTranslate = wy - g.y (); |
2521 | 537 | 530 | ||
2523 | 538 | gWindow->geometry ().reset (); | 531 | gWindow->vertexBuffer ()->begin (); |
2524 | 539 | 532 | ||
2525 | 540 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); | 533 | gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); |
2526 | 541 | gWindow->glAddGeometry (matrix, iconReg, infiniteRegion); | 534 | gWindow->glAddGeometry (matrix, iconReg, infiniteRegion); |
2527 | 542 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); | 535 | gWindow->glAddGeometrySetCurrentIndex (addWindowGeometryIndex); |
2528 | 543 | 536 | ||
2547 | 544 | if (gWindow->geometry ().vCount) | 537 | gWindow->vertexBuffer ()->end (); |
2548 | 545 | { | 538 | |
2549 | 546 | GLFragment::Attrib fragment (sAttrib); | 539 | GLMatrix wTransform (transform); |
2550 | 547 | GLMatrix wTransform (transform); | 540 | |
2551 | 548 | 541 | wTransform.translate (g.x (), g.y (), 0.0f); | |
2552 | 549 | wTransform.translate (g.x (), g.y (), 0.0f); | 542 | wTransform.scale (sAttrib.xScale, sAttrib.yScale, 1.0f); |
2553 | 550 | wTransform.scale (sAttrib.xScale, sAttrib.yScale, 1.0f); | 543 | wTransform.translate (sAttrib.xTranslate / sAttrib.xScale - g.x (), |
2554 | 551 | wTransform.translate (sAttrib.xTranslate / sAttrib.xScale - g.x (), | 544 | sAttrib.yTranslate / sAttrib.yScale - g.y (), |
2555 | 552 | sAttrib.yTranslate / sAttrib.yScale - g.y (), | 545 | 0.0f); |
2556 | 553 | 0.0f); | 546 | |
2557 | 554 | 547 | gWindow->glDrawTexture (icon, wTransform, sAttrib, mask); | |
2540 | 555 | glPushMatrix (); | ||
2541 | 556 | glLoadMatrixf (wTransform.getMatrix ()); | ||
2542 | 557 | |||
2543 | 558 | gWindow->glDrawTexture (icon, fragment, mask); | ||
2544 | 559 | |||
2545 | 560 | glPopMatrix (); | ||
2546 | 561 | } | ||
2558 | 562 | } | 548 | } |
2559 | 563 | } | 549 | } |
2560 | 564 | 550 | ||
2561 | 565 | 551 | ||
2562 | === modified file 'plugins/copytex/src/copytex.cpp' | |||
2563 | --- plugins/copytex/src/copytex.cpp 2011-06-01 03:33:04 +0000 | |||
2564 | +++ plugins/copytex/src/copytex.cpp 2012-05-17 07:01:21 +0000 | |||
2565 | @@ -112,6 +112,14 @@ | |||
2566 | 112 | GLenum target; | 112 | GLenum target; |
2567 | 113 | GLTexture::Matrix matrix = _identity_matrix; | 113 | GLTexture::Matrix matrix = _identity_matrix; |
2568 | 114 | 114 | ||
2569 | 115 | #ifdef USE_GLES | ||
2570 | 116 | target = GL_TEXTURE_2D; | ||
2571 | 117 | matrix.xx = 1.0f / dim.width (); | ||
2572 | 118 | matrix.yy = 1.0f / dim.height (); | ||
2573 | 119 | matrix.x0 = -dim.x () * matrix.xx; | ||
2574 | 120 | matrix.y0 = -dim.y () * matrix.yy; | ||
2575 | 121 | #else | ||
2576 | 122 | |||
2577 | 115 | if (GL::textureNonPowerOfTwo || | 123 | if (GL::textureNonPowerOfTwo || |
2578 | 116 | (POWER_OF_TWO (dim.width ()) && POWER_OF_TWO (dim.height ()))) | 124 | (POWER_OF_TWO (dim.width ()) && POWER_OF_TWO (dim.height ()))) |
2579 | 117 | { | 125 | { |
2580 | @@ -129,6 +137,7 @@ | |||
2581 | 129 | matrix.x0 = -dim.x (); | 137 | matrix.x0 = -dim.x (); |
2582 | 130 | matrix.y0 = -dim.y (); | 138 | matrix.y0 = -dim.y (); |
2583 | 131 | } | 139 | } |
2584 | 140 | #endif | ||
2585 | 132 | 141 | ||
2586 | 133 | setData (target, matrix, false); | 142 | setData (target, matrix, false); |
2587 | 134 | setGeometry (dim.x1 (), dim.y1 (), dim.x2 () - dim.x1 (), dim.y2 () - dim.y1 ()); | 143 | setGeometry (dim.x1 (), dim.y1 (), dim.x2 () - dim.x1 (), dim.y2 () - dim.y1 ()); |
2588 | 135 | 144 | ||
2589 | === modified file 'plugins/cube/CMakeLists.txt' | |||
2590 | --- plugins/cube/CMakeLists.txt 2009-11-03 20:14:43 +0000 | |||
2591 | +++ plugins/cube/CMakeLists.txt 2012-05-17 07:01:21 +0000 | |||
2592 | @@ -2,4 +2,4 @@ | |||
2593 | 2 | 2 | ||
2594 | 3 | include (CompizPlugin) | 3 | include (CompizPlugin) |
2595 | 4 | 4 | ||
2596 | 5 | compiz_plugin(cube PLUGINDEPS composite opengl) | ||
2597 | 6 | \ No newline at end of file | 5 | \ No newline at end of file |
2598 | 6 | compiz_plugin(cube PLUGINDEPS composite opengl) | ||
2599 | 7 | 7 | ||
2600 | === modified file 'plugins/cube/include/cube/cube.h' | |||
2601 | --- plugins/cube/include/cube/cube.h 2012-01-18 16:26:45 +0000 | |||
2602 | +++ plugins/cube/include/cube/cube.h 2012-05-17 07:01:21 +0000 | |||
2603 | @@ -62,15 +62,18 @@ | |||
2604 | 62 | virtual void cubePaintTop (const GLScreenPaintAttrib &sAttrib, | 62 | virtual void cubePaintTop (const GLScreenPaintAttrib &sAttrib, |
2605 | 63 | const GLMatrix &transform, | 63 | const GLMatrix &transform, |
2606 | 64 | CompOutput *output, | 64 | CompOutput *output, |
2608 | 65 | int size); | 65 | int size, |
2609 | 66 | const GLVector &normal); | ||
2610 | 66 | virtual void cubePaintBottom (const GLScreenPaintAttrib &sAttrib, | 67 | virtual void cubePaintBottom (const GLScreenPaintAttrib &sAttrib, |
2611 | 67 | const GLMatrix &transform, | 68 | const GLMatrix &transform, |
2612 | 68 | CompOutput *output, | 69 | CompOutput *output, |
2614 | 69 | int size); | 70 | int size, |
2615 | 71 | const GLVector &normal); | ||
2616 | 70 | virtual void cubePaintInside (const GLScreenPaintAttrib &sAttrib, | 72 | virtual void cubePaintInside (const GLScreenPaintAttrib &sAttrib, |
2617 | 71 | const GLMatrix &transform, | 73 | const GLMatrix &transform, |
2618 | 72 | CompOutput *output, | 74 | CompOutput *output, |
2620 | 73 | int size); | 75 | int size, |
2621 | 76 | const GLVector &normal); | ||
2622 | 74 | virtual bool cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, | 77 | virtual bool cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, |
2623 | 75 | const GLMatrix &transform, | 78 | const GLMatrix &transform, |
2624 | 76 | CompOutput *output, | 79 | CompOutput *output, |
2625 | @@ -120,13 +123,13 @@ | |||
2626 | 120 | float, float); | 123 | float, float); |
2627 | 121 | WRAPABLE_HND (2, CubeScreenInterface, void, cubePaintTop, | 124 | WRAPABLE_HND (2, CubeScreenInterface, void, cubePaintTop, |
2628 | 122 | const GLScreenPaintAttrib &, const GLMatrix &, | 125 | const GLScreenPaintAttrib &, const GLMatrix &, |
2630 | 123 | CompOutput *, int); | 126 | CompOutput *, int, const GLVector &); |
2631 | 124 | WRAPABLE_HND (3, CubeScreenInterface, void, cubePaintBottom, | 127 | WRAPABLE_HND (3, CubeScreenInterface, void, cubePaintBottom, |
2632 | 125 | const GLScreenPaintAttrib &, const GLMatrix &, | 128 | const GLScreenPaintAttrib &, const GLMatrix &, |
2634 | 126 | CompOutput *, int); | 129 | CompOutput *, int, const GLVector &); |
2635 | 127 | WRAPABLE_HND (4, CubeScreenInterface, void, cubePaintInside, | 130 | WRAPABLE_HND (4, CubeScreenInterface, void, cubePaintInside, |
2636 | 128 | const GLScreenPaintAttrib &, const GLMatrix &, | 131 | const GLScreenPaintAttrib &, const GLMatrix &, |
2638 | 129 | CompOutput *, int); | 132 | CompOutput *, int, const GLVector &); |
2639 | 130 | WRAPABLE_HND (5, CubeScreenInterface, bool, cubeCheckOrientation, | 133 | WRAPABLE_HND (5, CubeScreenInterface, bool, cubeCheckOrientation, |
2640 | 131 | const GLScreenPaintAttrib &, const GLMatrix &, | 134 | const GLScreenPaintAttrib &, const GLMatrix &, |
2641 | 132 | CompOutput *, std::vector<GLVector> &); | 135 | CompOutput *, std::vector<GLVector> &); |
2642 | 133 | 136 | ||
2643 | === modified file 'plugins/cube/src/cube.cpp' | |||
2644 | --- plugins/cube/src/cube.cpp 2012-01-16 09:50:28 +0000 | |||
2645 | +++ plugins/cube/src/cube.cpp 2012-05-17 07:01:21 +0000 | |||
2646 | @@ -55,22 +55,25 @@ | |||
2647 | 55 | CubeScreenInterface::cubePaintTop (const GLScreenPaintAttrib &sAttrib, | 55 | CubeScreenInterface::cubePaintTop (const GLScreenPaintAttrib &sAttrib, |
2648 | 56 | const GLMatrix &transform, | 56 | const GLMatrix &transform, |
2649 | 57 | CompOutput *output, | 57 | CompOutput *output, |
2652 | 58 | int size) | 58 | int size, |
2653 | 59 | WRAPABLE_DEF (cubePaintTop, sAttrib, transform, output, size) | 59 | const GLVector &normal) |
2654 | 60 | WRAPABLE_DEF (cubePaintTop, sAttrib, transform, output, size, normal) | ||
2655 | 60 | 61 | ||
2656 | 61 | void | 62 | void |
2657 | 62 | CubeScreenInterface::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, | 63 | CubeScreenInterface::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, |
2658 | 63 | const GLMatrix &transform, | 64 | const GLMatrix &transform, |
2659 | 64 | CompOutput *output, | 65 | CompOutput *output, |
2662 | 65 | int size) | 66 | int size, |
2663 | 66 | WRAPABLE_DEF (cubePaintBottom, sAttrib, transform, output, size) | 67 | const GLVector &normal) |
2664 | 68 | WRAPABLE_DEF (cubePaintBottom, sAttrib, transform, output, size, normal) | ||
2665 | 67 | 69 | ||
2666 | 68 | void | 70 | void |
2667 | 69 | CubeScreenInterface::cubePaintInside (const GLScreenPaintAttrib &sAttrib, | 71 | CubeScreenInterface::cubePaintInside (const GLScreenPaintAttrib &sAttrib, |
2668 | 70 | const GLMatrix &transform, | 72 | const GLMatrix &transform, |
2669 | 71 | CompOutput *output, | 73 | CompOutput *output, |
2672 | 72 | int size) | 74 | int size, |
2673 | 73 | WRAPABLE_DEF (cubePaintInside, sAttrib, transform, output, size) | 75 | const GLVector &normal) |
2674 | 76 | WRAPABLE_DEF (cubePaintInside, sAttrib, transform, output, size, normal) | ||
2675 | 74 | 77 | ||
2676 | 75 | bool | 78 | bool |
2677 | 76 | CubeScreenInterface::cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, | 79 | CubeScreenInterface::cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, |
2678 | @@ -433,6 +436,7 @@ | |||
2679 | 433 | } | 436 | } |
2680 | 434 | } | 437 | } |
2681 | 435 | 438 | ||
2682 | 439 | #ifndef USE_GLES | ||
2683 | 436 | static bool | 440 | static bool |
2684 | 437 | fillCircleTable (GLfloat **ppSint, | 441 | fillCircleTable (GLfloat **ppSint, |
2685 | 438 | GLfloat **ppCost, | 442 | GLfloat **ppCost, |
2686 | @@ -467,10 +471,12 @@ | |||
2687 | 467 | 471 | ||
2688 | 468 | return true; | 472 | return true; |
2689 | 469 | } | 473 | } |
2690 | 474 | #endif | ||
2691 | 470 | 475 | ||
2692 | 471 | void | 476 | void |
2693 | 472 | PrivateCubeScreen::updateSkydomeList (GLfloat fRadius) | 477 | PrivateCubeScreen::updateSkydomeList (GLfloat fRadius) |
2694 | 473 | { | 478 | { |
2695 | 479 | #ifndef USE_GLES | ||
2696 | 474 | GLint iSlices = 128; | 480 | GLint iSlices = 128; |
2697 | 475 | GLint iStacks = 64; | 481 | GLint iStacks = 64; |
2698 | 476 | GLfloat afTexCoordX[4]; | 482 | GLfloat afTexCoordX[4]; |
2699 | @@ -532,6 +538,7 @@ | |||
2700 | 532 | afTexCoordX[3] = 1.0f; | 538 | afTexCoordX[3] = 1.0f; |
2701 | 533 | afTexCoordY[3] = 1.0f; | 539 | afTexCoordY[3] = 1.0f; |
2702 | 534 | 540 | ||
2703 | 541 | |||
2704 | 535 | if (!mSkyListId) | 542 | if (!mSkyListId) |
2705 | 536 | mSkyListId = glGenLists (1); | 543 | mSkyListId = glGenLists (1); |
2706 | 537 | 544 | ||
2707 | @@ -616,6 +623,8 @@ | |||
2708 | 616 | free (cost1); | 623 | free (cost1); |
2709 | 617 | free (sint2); | 624 | free (sint2); |
2710 | 618 | free (cost2); | 625 | free (cost2); |
2711 | 626 | |||
2712 | 627 | #endif | ||
2713 | 619 | } | 628 | } |
2714 | 620 | 629 | ||
2715 | 621 | bool | 630 | bool |
2716 | @@ -818,7 +827,7 @@ | |||
2717 | 818 | { | 827 | { |
2718 | 819 | WRAPABLE_HND_FUNCTN_RETURN (bool, cubeCheckOrientation, sAttrib, transform, output, points) | 828 | WRAPABLE_HND_FUNCTN_RETURN (bool, cubeCheckOrientation, sAttrib, transform, output, points) |
2719 | 820 | GLMatrix sTransform = transform; | 829 | GLMatrix sTransform = transform; |
2721 | 821 | GLMatrix mvp, pm (priv->gScreen->projectionMatrix ()); | 830 | GLMatrix mvp, pm (priv->gScreen->projectionMatrix ()->getMatrix ()); |
2722 | 822 | GLVector pntA, pntB, pntC; | 831 | GLVector pntA, pntB, pntC; |
2723 | 823 | GLVector vecA, vecB, ortho; | 832 | GLVector vecA, vecB, ortho; |
2724 | 824 | bool rv = false; | 833 | bool rv = false; |
2725 | @@ -1063,7 +1072,7 @@ | |||
2726 | 1063 | if (priv->mSky.size () > 0) | 1072 | if (priv->mSky.size () > 0) |
2727 | 1064 | { | 1073 | { |
2728 | 1065 | priv->gScreen->setLighting (false); | 1074 | priv->gScreen->setLighting (false); |
2730 | 1066 | 1075 | #ifndef USE_GLES | |
2731 | 1067 | glPushMatrix (); | 1076 | glPushMatrix (); |
2732 | 1068 | 1077 | ||
2733 | 1069 | if (priv->optionGetSkydomeAnimated () && | 1078 | if (priv->optionGetSkydomeAnimated () && |
2734 | @@ -1079,6 +1088,7 @@ | |||
2735 | 1079 | 1088 | ||
2736 | 1080 | glCallList (priv->mSkyListId); | 1089 | glCallList (priv->mSkyListId); |
2737 | 1081 | glPopMatrix (); | 1090 | glPopMatrix (); |
2738 | 1091 | #endif | ||
2739 | 1082 | } | 1092 | } |
2740 | 1083 | else | 1093 | else |
2741 | 1084 | { | 1094 | { |
2742 | @@ -1090,9 +1100,10 @@ | |||
2743 | 1090 | CubeScreen::cubePaintTop (const GLScreenPaintAttrib &sAttrib, | 1100 | CubeScreen::cubePaintTop (const GLScreenPaintAttrib &sAttrib, |
2744 | 1091 | const GLMatrix &transform, | 1101 | const GLMatrix &transform, |
2745 | 1092 | CompOutput *output, | 1102 | CompOutput *output, |
2747 | 1093 | int size) | 1103 | int size, |
2748 | 1104 | const GLVector &normal) | ||
2749 | 1094 | { | 1105 | { |
2751 | 1095 | WRAPABLE_HND_FUNCTN (cubePaintTop, sAttrib, transform, output, size) | 1106 | WRAPABLE_HND_FUNCTN (cubePaintTop, sAttrib, transform, output, size, normal) |
2752 | 1096 | 1107 | ||
2753 | 1097 | GLScreenPaintAttrib sa = sAttrib; | 1108 | GLScreenPaintAttrib sa = sAttrib; |
2754 | 1098 | GLMatrix sTransform = transform; | 1109 | GLMatrix sTransform = transform; |
2755 | @@ -1105,51 +1116,49 @@ | |||
2756 | 1105 | color = priv->optionGetTopColor (); | 1116 | color = priv->optionGetTopColor (); |
2757 | 1106 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; | 1117 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; |
2758 | 1107 | 1118 | ||
2763 | 1108 | glColor4us (color[0] * opacity / 0xffff, | 1119 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); |
2764 | 1109 | color[1] * opacity / 0xffff, | 1120 | std::vector <GLushort> colorData; |
2761 | 1110 | color[2] * opacity / 0xffff, | ||
2762 | 1111 | opacity); | ||
2765 | 1112 | 1121 | ||
2767 | 1113 | glPushMatrix (); | 1122 | colorData.push_back (color[0] * opacity / 0xffff); |
2768 | 1123 | colorData.push_back (color[1] * opacity / 0xffff); | ||
2769 | 1124 | colorData.push_back (color[2] * opacity / 0xffff); | ||
2770 | 1125 | colorData.push_back (opacity); | ||
2771 | 1114 | 1126 | ||
2772 | 1115 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); | 1127 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); |
2773 | 1116 | 1128 | ||
2774 | 1117 | priv->gScreen->glApplyTransform (sa, output, &sTransform); | 1129 | priv->gScreen->glApplyTransform (sa, output, &sTransform); |
2775 | 1118 | 1130 | ||
2779 | 1119 | glLoadMatrixf (sTransform.getMatrix ()); | 1131 | sTransform.translate (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); |
2780 | 1120 | glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); | 1132 | sTransform.scale (priv->mOutputXScale, priv->mOutputYScale, 1.0f); |
2778 | 1121 | glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); | ||
2781 | 1122 | 1133 | ||
2782 | 1123 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) | 1134 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) |
2783 | 1124 | { | 1135 | { |
2784 | 1136 | #ifndef USE_GLES | ||
2785 | 1125 | priv->gScreen->setTexEnvMode (GL_MODULATE); | 1137 | priv->gScreen->setTexEnvMode (GL_MODULATE); |
2787 | 1126 | glEnable (GL_BLEND); | 1138 | #endif |
2788 | 1127 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 1139 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2789 | 1128 | } | 1140 | } |
2790 | 1129 | 1141 | ||
2792 | 1130 | glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); | 1142 | bool withTexture = priv->mInvert == 1 && size == 4 && priv->mTexture.size (); |
2793 | 1131 | 1143 | ||
2796 | 1132 | if (priv->mInvert == 1 && size == 4 && priv->mTexture.size ()) | 1144 | if (withTexture) |
2795 | 1133 | { | ||
2797 | 1134 | priv->mTexture[0]->enable (GLTexture::Good); | 1145 | priv->mTexture[0]->enable (GLTexture::Good); |
2800 | 1135 | glTexCoordPointer (2, GL_FLOAT, 0, priv->mTc); | 1146 | |
2801 | 1136 | glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); | 1147 | streamingBuffer->begin (GL_TRIANGLE_FAN); |
2802 | 1148 | streamingBuffer->addColors (1, &(colorData[0])); | ||
2803 | 1149 | streamingBuffer->addVertices (priv->mNVertices >> 1, priv->mVertices); | ||
2804 | 1150 | streamingBuffer->addNormals (1, const_cast <GLfloat *> (&normal[0])); | ||
2805 | 1151 | |||
2806 | 1152 | if (withTexture) | ||
2807 | 1153 | streamingBuffer->addTexCoords (0, 2, priv->mTc); | ||
2808 | 1154 | |||
2809 | 1155 | streamingBuffer->end (); | ||
2810 | 1156 | streamingBuffer->render (sTransform); | ||
2811 | 1157 | |||
2812 | 1158 | if (withTexture) | ||
2813 | 1137 | priv->mTexture[0]->disable (); | 1159 | priv->mTexture[0]->disable (); |
2814 | 1138 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
2815 | 1139 | } | ||
2816 | 1140 | else | ||
2817 | 1141 | { | ||
2818 | 1142 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | ||
2819 | 1143 | glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); | ||
2820 | 1144 | } | ||
2821 | 1145 | |||
2822 | 1146 | glPopMatrix (); | ||
2823 | 1147 | |||
2824 | 1148 | glColor4usv (defaultColor); | ||
2825 | 1149 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
2826 | 1150 | 1160 | ||
2827 | 1151 | priv->gScreen->setTexEnvMode (GL_REPLACE); | 1161 | priv->gScreen->setTexEnvMode (GL_REPLACE); |
2828 | 1152 | glDisable (GL_BLEND); | ||
2829 | 1153 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 1162 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
2830 | 1154 | } | 1163 | } |
2831 | 1155 | 1164 | ||
2832 | @@ -1157,9 +1166,10 @@ | |||
2833 | 1157 | CubeScreen::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, | 1166 | CubeScreen::cubePaintBottom (const GLScreenPaintAttrib &sAttrib, |
2834 | 1158 | const GLMatrix &transform, | 1167 | const GLMatrix &transform, |
2835 | 1159 | CompOutput *output, | 1168 | CompOutput *output, |
2837 | 1160 | int size) | 1169 | int size, |
2838 | 1170 | const GLVector &normal) | ||
2839 | 1161 | { | 1171 | { |
2841 | 1162 | WRAPABLE_HND_FUNCTN (cubePaintBottom, sAttrib, transform, output, size) | 1172 | WRAPABLE_HND_FUNCTN (cubePaintBottom, sAttrib, transform, output, size, normal) |
2842 | 1163 | 1173 | ||
2843 | 1164 | GLScreenPaintAttrib sa = sAttrib; | 1174 | GLScreenPaintAttrib sa = sAttrib; |
2844 | 1165 | GLMatrix sTransform = transform; | 1175 | GLMatrix sTransform = transform; |
2845 | @@ -1172,41 +1182,40 @@ | |||
2846 | 1172 | color = priv->optionGetBottomColor (); | 1182 | color = priv->optionGetBottomColor (); |
2847 | 1173 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; | 1183 | opacity = priv->mDesktopOpacity * color[3] / 0xffff; |
2848 | 1174 | 1184 | ||
2853 | 1175 | glColor4us (color[0] * opacity / 0xffff, | 1185 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); |
2854 | 1176 | color[1] * opacity / 0xffff, | 1186 | std::vector <GLushort> colorData; |
2851 | 1177 | color[2] * opacity / 0xffff, | ||
2852 | 1178 | opacity); | ||
2855 | 1179 | 1187 | ||
2857 | 1180 | glPushMatrix (); | 1188 | colorData.push_back (color[0] * opacity / 0xffff); |
2858 | 1189 | colorData.push_back (color[1] * opacity / 0xffff); | ||
2859 | 1190 | colorData.push_back (color[2] * opacity / 0xffff); | ||
2860 | 1191 | colorData.push_back (opacity); | ||
2861 | 1181 | 1192 | ||
2862 | 1182 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); | 1193 | sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); |
2863 | 1183 | 1194 | ||
2864 | 1184 | priv->gScreen->glApplyTransform (sa, output, &sTransform); | 1195 | priv->gScreen->glApplyTransform (sa, output, &sTransform); |
2865 | 1185 | 1196 | ||
2869 | 1186 | glLoadMatrixf (sTransform.getMatrix ()); | 1197 | sTransform.translate (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); |
2870 | 1187 | glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); | 1198 | sTransform.scale (priv->mOutputXScale, priv->mOutputYScale, 1.0f); |
2868 | 1188 | glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); | ||
2871 | 1189 | 1199 | ||
2872 | 1190 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) | 1200 | if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) |
2873 | 1191 | { | 1201 | { |
2874 | 1202 | #ifndef USE_GLES | ||
2875 | 1192 | priv->gScreen->setTexEnvMode (GL_MODULATE); | 1203 | priv->gScreen->setTexEnvMode (GL_MODULATE); |
2877 | 1193 | glEnable (GL_BLEND); | 1204 | #endif |
2878 | 1194 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 1205 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2879 | 1195 | } | 1206 | } |
2880 | 1196 | 1207 | ||
2891 | 1197 | glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); | 1208 | streamingBuffer->begin (GL_TRIANGLE_FAN); |
2892 | 1198 | 1209 | streamingBuffer->addColors (1, &(colorData[0])); | |
2893 | 1199 | 1210 | streamingBuffer->addVertices (priv->mNVertices, priv->mVertices); | |
2894 | 1200 | glDisableClientState (GL_TEXTURE_COORD_ARRAY); | 1211 | streamingBuffer->addNormals (1, const_cast <GLfloat *> (&normal[0])); |
2895 | 1201 | glDrawArrays (GL_TRIANGLE_FAN, priv->mNVertices >> 1, priv->mNVertices >> 1); | 1212 | streamingBuffer->setVertexOffset (priv->mNVertices >> 1); |
2896 | 1202 | 1213 | streamingBuffer->setMaxVertices (priv->mNVertices >> 1); | |
2897 | 1203 | glPopMatrix (); | 1214 | |
2898 | 1204 | 1215 | streamingBuffer->end (); | |
2899 | 1205 | glColor4usv (defaultColor); | 1216 | streamingBuffer->render (sTransform); |
2890 | 1206 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); | ||
2900 | 1207 | 1217 | ||
2901 | 1208 | priv->gScreen->setTexEnvMode (GL_REPLACE); | 1218 | priv->gScreen->setTexEnvMode (GL_REPLACE); |
2902 | 1209 | glDisable (GL_BLEND); | ||
2903 | 1210 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 1219 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
2904 | 1211 | } | 1220 | } |
2905 | 1212 | 1221 | ||
2906 | @@ -1214,9 +1223,10 @@ | |||
2907 | 1214 | CubeScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib, | 1223 | CubeScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib, |
2908 | 1215 | const GLMatrix &transform, | 1224 | const GLMatrix &transform, |
2909 | 1216 | CompOutput *output, | 1225 | CompOutput *output, |
2911 | 1217 | int size) | 1226 | int size, |
2912 | 1227 | const GLVector &normal) | ||
2913 | 1218 | { | 1228 | { |
2915 | 1219 | WRAPABLE_HND_FUNCTN (cubePaintInside, sAttrib, transform, output, size) | 1229 | WRAPABLE_HND_FUNCTN (cubePaintInside, sAttrib, transform, output, size, normal) |
2916 | 1220 | } | 1230 | } |
2917 | 1221 | 1231 | ||
2918 | 1222 | void | 1232 | void |
2919 | @@ -1226,6 +1236,8 @@ | |||
2920 | 1226 | { | 1236 | { |
2921 | 1227 | if (mRotationState != CubeScreen::RotationNone) | 1237 | if (mRotationState != CubeScreen::RotationNone) |
2922 | 1228 | { | 1238 | { |
2923 | 1239 | /* FIXME: No output clipping in OpenGL|ES yet */ | ||
2924 | 1240 | #ifndef USE_GLES | ||
2925 | 1229 | glPushMatrix (); | 1241 | glPushMatrix (); |
2926 | 1230 | glLoadMatrixf (transform.getMatrix ()); | 1242 | glLoadMatrixf (transform.getMatrix ()); |
2927 | 1231 | glTranslatef (mOutputXOffset, -mOutputYOffset, 0.0f); | 1243 | glTranslatef (mOutputXOffset, -mOutputYOffset, 0.0f); |
2928 | @@ -1260,6 +1272,7 @@ | |||
2929 | 1260 | glEnable (GL_CLIP_PLANE3); | 1272 | glEnable (GL_CLIP_PLANE3); |
2930 | 1261 | 1273 | ||
2931 | 1262 | glPopMatrix (); | 1274 | glPopMatrix (); |
2932 | 1275 | #endif | ||
2933 | 1263 | } | 1276 | } |
2934 | 1264 | else | 1277 | else |
2935 | 1265 | gScreen->glEnableOutputClipping (transform, region, output); | 1278 | gScreen->glEnableOutputClipping (transform, region, output); |
2936 | @@ -1447,38 +1460,28 @@ | |||
2937 | 1447 | 1460 | ||
2938 | 1448 | if (topDir && bottomDir) | 1461 | if (topDir && bottomDir) |
2939 | 1449 | { | 1462 | { |
2940 | 1450 | glNormal3f (0.0f, -1.0f, 0.0f); | ||
2941 | 1451 | if (allCaps) | 1463 | if (allCaps) |
2942 | 1452 | { | 1464 | { |
2947 | 1453 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); | 1465 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
2948 | 1454 | glNormal3f (0.0f, 0.0f, -1.0f); | 1466 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f)); |
2945 | 1455 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); | ||
2946 | 1456 | glNormal3f (0.0f, -1.0f, 0.0f); | ||
2949 | 1457 | } | 1467 | } |
2951 | 1458 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); | 1468 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
2952 | 1459 | } | 1469 | } |
2953 | 1460 | else if (!topDir && !bottomDir) | 1470 | else if (!topDir && !bottomDir) |
2954 | 1461 | { | 1471 | { |
2955 | 1462 | glNormal3f (0.0f, 1.0f, 0.0f); | ||
2956 | 1463 | if (allCaps) | 1472 | if (allCaps) |
2957 | 1464 | { | 1473 | { |
2962 | 1465 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); | 1474 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, 1.0f, 0.0f, 1.0f)); |
2963 | 1466 | glNormal3f (0.0f, 0.0f, -1.0f); | 1475 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f)); |
2960 | 1467 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); | ||
2961 | 1468 | glNormal3f (0.0f, 1.0f, 0.0f); | ||
2964 | 1469 | } | 1476 | } |
2966 | 1470 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); | 1477 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
2967 | 1471 | } | 1478 | } |
2968 | 1472 | else if (allCaps) | 1479 | else if (allCaps) |
2969 | 1473 | { | 1480 | { |
2976 | 1474 | glNormal3f (0.0f, 1.0f, 0.0f); | 1481 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize, GLVector (0.0f, 1.0f, 0.0f, 1.0f)); |
2977 | 1475 | cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); | 1482 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize, GLVector (0.0f, -1.0f, 0.0f, 1.0f)); |
2978 | 1476 | glNormal3f (0.0f, -1.0f, 0.0f); | 1483 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize, GLVector (0.0f, 0.0f, -1.0f, 1.0f)); |
2973 | 1477 | cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); | ||
2974 | 1478 | glNormal3f (0.0f, 0.0f, -1.0f); | ||
2975 | 1479 | cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); | ||
2979 | 1480 | } | 1484 | } |
2980 | 1481 | glNormal3f (0.0f, 0.0f, -1.0f); | ||
2981 | 1482 | } | 1485 | } |
2982 | 1483 | 1486 | ||
2983 | 1484 | if (wasCulled) | 1487 | if (wasCulled) |
2984 | @@ -1705,8 +1708,10 @@ | |||
2985 | 1705 | if (mVertices) | 1708 | if (mVertices) |
2986 | 1706 | free (mVertices); | 1709 | free (mVertices); |
2987 | 1707 | 1710 | ||
2988 | 1711 | #ifndef USE_GLES | ||
2989 | 1708 | if (mSkyListId) | 1712 | if (mSkyListId) |
2990 | 1709 | glDeleteLists (mSkyListId, 1); | 1713 | glDeleteLists (mSkyListId, 1); |
2991 | 1714 | #endif | ||
2992 | 1710 | } | 1715 | } |
2993 | 1711 | 1716 | ||
2994 | 1712 | 1717 | ||
2995 | 1713 | 1718 | ||
2996 | === modified file 'plugins/decor/src/decor.cpp' | |||
2997 | --- plugins/decor/src/decor.cpp 2012-05-10 15:40:25 +0000 | |||
2998 | +++ plugins/decor/src/decor.cpp 2012-05-17 07:01:21 +0000 | |||
2999 | @@ -177,15 +177,13 @@ | |||
3000 | 177 | */ | 177 | */ |
3001 | 178 | 178 | ||
3002 | 179 | bool | 179 | bool |
3007 | 180 | DecorWindow::glDraw (const GLMatrix &transform, | 180 | DecorWindow::glDraw (const GLMatrix &transform, |
3008 | 181 | GLFragment::Attrib &attrib, | 181 | const GLWindowPaintAttrib &attrib, |
3009 | 182 | const CompRegion ®ion, | 182 | const CompRegion ®ion, |
3010 | 183 | unsigned int mask) | 183 | unsigned int mask) |
3011 | 184 | { | 184 | { |
3012 | 185 | bool status; | 185 | bool status; |
3013 | 186 | 186 | ||
3014 | 187 | status = gWindow->glDraw (transform, attrib, region, mask); | ||
3015 | 188 | |||
3016 | 189 | /* Don't render dock decorations (shadows) on just any old window */ | 187 | /* Don't render dock decorations (shadows) on just any old window */ |
3017 | 190 | if (!(window->type () & CompWindowTypeDockMask)) | 188 | if (!(window->type () & CompWindowTypeDockMask)) |
3018 | 191 | { | 189 | { |
3019 | @@ -205,15 +203,19 @@ | |||
3020 | 205 | } | 203 | } |
3021 | 206 | } | 204 | } |
3022 | 207 | 205 | ||
3023 | 206 | status = gWindow->glDraw (transform, attrib, region, mask); | ||
3024 | 207 | |||
3025 | 208 | return status; | 208 | return status; |
3026 | 209 | } | 209 | } |
3027 | 210 | 210 | ||
3028 | 211 | void | 211 | void |
3033 | 212 | DecorWindow::glDecorate (const GLMatrix &transform, | 212 | DecorWindow::glDecorate (const GLMatrix &transform, |
3034 | 213 | GLFragment::Attrib &attrib, | 213 | const GLWindowPaintAttrib &attrib, |
3035 | 214 | const CompRegion ®ion, | 214 | const CompRegion ®ion, |
3036 | 215 | unsigned int mask) | 215 | unsigned int mask) |
3037 | 216 | { | 216 | { |
3038 | 217 | GLboolean isBlendingEnabled; | ||
3039 | 218 | |||
3040 | 217 | if (wd && | 219 | if (wd && |
3041 | 218 | wd->decor->type == WINDOW_DECORATION_TYPE_PIXMAP) | 220 | wd->decor->type == WINDOW_DECORATION_TYPE_PIXMAP) |
3042 | 219 | { | 221 | { |
3043 | @@ -221,6 +223,7 @@ | |||
3044 | 221 | GLTexture::MatrixList ml (1); | 223 | GLTexture::MatrixList ml (1); |
3045 | 222 | mask |= PAINT_WINDOW_BLEND_MASK; | 224 | mask |= PAINT_WINDOW_BLEND_MASK; |
3046 | 223 | 225 | ||
3047 | 226 | gWindow->vertexBuffer ()->begin (); | ||
3048 | 224 | const CompRegion *preg = NULL; | 227 | const CompRegion *preg = NULL; |
3049 | 225 | 228 | ||
3050 | 226 | if ((mask & (PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK | | 229 | if ((mask & (PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK | |
3051 | @@ -247,8 +250,6 @@ | |||
3052 | 247 | 250 | ||
3053 | 248 | const CompRegion ® (*preg); | 251 | const CompRegion ® (*preg); |
3054 | 249 | 252 | ||
3055 | 250 | gWindow->geometry ().reset (); | ||
3056 | 251 | |||
3057 | 252 | if (updateMatrix) | 253 | if (updateMatrix) |
3058 | 253 | updateDecorationScale (); | 254 | updateDecorationScale (); |
3059 | 254 | 255 | ||
3060 | @@ -267,9 +268,14 @@ | |||
3061 | 267 | } | 268 | } |
3062 | 268 | } | 269 | } |
3063 | 269 | 270 | ||
3067 | 270 | if (gWindow->geometry ().vCount) | 271 | gWindow->vertexBuffer ()->end (); |
3068 | 271 | gWindow->glDrawTexture (wd->decor->texture->textures[0], | 272 | |
3069 | 272 | attrib, mask); | 273 | glGetBooleanv (GL_BLEND, &isBlendingEnabled); |
3070 | 274 | glEnable (GL_BLEND); | ||
3071 | 275 | gWindow->glDrawTexture (wd->decor->texture->textures[0], transform, | ||
3072 | 276 | attrib, mask); | ||
3073 | 277 | if (!isBlendingEnabled) | ||
3074 | 278 | glDisable (GL_BLEND); | ||
3075 | 273 | } | 279 | } |
3076 | 274 | else if (wd && wd->decor->type == WINDOW_DECORATION_TYPE_WINDOW) | 280 | else if (wd && wd->decor->type == WINDOW_DECORATION_TYPE_WINDOW) |
3077 | 275 | { | 281 | { |
3078 | @@ -282,15 +288,18 @@ | |||
3079 | 282 | 288 | ||
3080 | 283 | if (updateMatrix) | 289 | if (updateMatrix) |
3081 | 284 | updateDecorationScale (); | 290 | updateDecorationScale (); |
3082 | 291 | glGetBooleanv (GL_BLEND, &isBlendingEnabled); | ||
3083 | 292 | glEnable (GL_BLEND); | ||
3084 | 285 | 293 | ||
3085 | 286 | if (gWindow->textures ().size () == 1) | 294 | if (gWindow->textures ().size () == 1) |
3086 | 287 | { | 295 | { |
3087 | 288 | ml[0] = gWindow->matrices ()[0]; | 296 | ml[0] = gWindow->matrices ()[0]; |
3089 | 289 | gWindow->geometry ().reset (); | 297 | gWindow->vertexBuffer ()->begin (); |
3090 | 290 | gWindow->glAddGeometry (ml, window->frameRegion (), region); | 298 | gWindow->glAddGeometry (ml, window->frameRegion (), region); |
3091 | 299 | gWindow->vertexBuffer ()->end (); | ||
3092 | 291 | 300 | ||
3095 | 292 | if (gWindow->geometry ().vCount) | 301 | gWindow->glDrawTexture (gWindow->textures ()[0], transform, |
3096 | 293 | gWindow->glDrawTexture (gWindow->textures ()[0], attrib, mask); | 302 | attrib, mask); |
3097 | 294 | } | 303 | } |
3098 | 295 | else | 304 | else |
3099 | 296 | { | 305 | { |
3100 | @@ -299,14 +308,17 @@ | |||
3101 | 299 | for (unsigned int i = 0; i < gWindow->textures ().size (); i++) | 308 | for (unsigned int i = 0; i < gWindow->textures ().size (); i++) |
3102 | 300 | { | 309 | { |
3103 | 301 | ml[0] = gWindow->matrices ()[i]; | 310 | ml[0] = gWindow->matrices ()[i]; |
3105 | 302 | gWindow->geometry ().reset (); | 311 | gWindow->vertexBuffer ()->begin (); |
3106 | 303 | gWindow->glAddGeometry (ml, regions[i], region); | 312 | gWindow->glAddGeometry (ml, regions[i], region); |
3107 | 313 | gWindow->vertexBuffer ()->end (); | ||
3108 | 304 | 314 | ||
3112 | 305 | if (gWindow->geometry ().vCount) | 315 | gWindow->glDrawTexture (gWindow->textures ()[i], transform, |
3113 | 306 | gWindow->glDrawTexture (gWindow->textures ()[i], attrib, | 316 | attrib, mask); |
3111 | 307 | mask); | ||
3114 | 308 | } | 317 | } |
3115 | 309 | } | 318 | } |
3116 | 319 | |||
3117 | 320 | if (!isBlendingEnabled) | ||
3118 | 321 | glDisable (GL_BLEND); | ||
3119 | 310 | } | 322 | } |
3120 | 311 | } | 323 | } |
3121 | 312 | 324 | ||
3122 | 313 | 325 | ||
3123 | === modified file 'plugins/decor/src/decor.h' | |||
3124 | --- plugins/decor/src/decor.h 2012-05-10 15:40:25 +0000 | |||
3125 | +++ plugins/decor/src/decor.h 2012-05-17 07:01:21 +0000 | |||
3126 | @@ -276,10 +276,10 @@ | |||
3127 | 276 | 276 | ||
3128 | 277 | bool damageRect (bool, const CompRect &); | 277 | bool damageRect (bool, const CompRect &); |
3129 | 278 | 278 | ||
3131 | 279 | bool glDraw (const GLMatrix &, GLFragment::Attrib &, | 279 | bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &, |
3132 | 280 | const CompRegion &, unsigned int); | 280 | const CompRegion &, unsigned int); |
3135 | 281 | void glDecorate (const GLMatrix &, GLFragment::Attrib &, | 281 | void glDecorate (const GLMatrix &, const GLWindowPaintAttrib &, |
3136 | 282 | const CompRegion &, unsigned int); | 282 | const CompRegion &, unsigned int); |
3137 | 283 | 283 | ||
3138 | 284 | void windowNotify (CompWindowNotify n); | 284 | void windowNotify (CompWindowNotify n); |
3139 | 285 | 285 | ||
3140 | 286 | 286 | ||
3141 | === modified file 'plugins/imgsvg/src/imgsvg.cpp' | |||
3142 | --- plugins/imgsvg/src/imgsvg.cpp 2012-01-18 16:26:45 +0000 | |||
3143 | +++ plugins/imgsvg/src/imgsvg.cpp 2012-05-17 07:01:21 +0000 | |||
3144 | @@ -220,12 +220,12 @@ | |||
3145 | 220 | } | 220 | } |
3146 | 221 | 221 | ||
3147 | 222 | bool | 222 | bool |
3152 | 223 | SvgWindow::glDraw (const GLMatrix &transform, | 223 | SvgWindow::glDraw (const GLMatrix &transform, |
3153 | 224 | GLFragment::Attrib &fragment, | 224 | const GLWindowPaintAttrib &attrib, |
3154 | 225 | const CompRegion ®ion, | 225 | const CompRegion ®ion, |
3155 | 226 | unsigned int mask) | 226 | unsigned int mask) |
3156 | 227 | { | 227 | { |
3158 | 228 | bool status = gWindow->glDraw (transform, fragment, region, mask); | 228 | bool status = gWindow->glDraw (transform, attrib, region, mask); |
3159 | 229 | 229 | ||
3160 | 230 | if (!status) | 230 | if (!status) |
3161 | 231 | return status; | 231 | return status; |
3162 | @@ -251,13 +251,15 @@ | |||
3163 | 251 | { | 251 | { |
3164 | 252 | matrix[0] = context->texture[0].matrices[i]; | 252 | matrix[0] = context->texture[0].matrices[i]; |
3165 | 253 | 253 | ||
3167 | 254 | gWindow->geometry ().reset (); | 254 | gWindow->vertexBuffer ()->begin (); |
3168 | 255 | gWindow->glAddGeometry (matrix, context->box, reg); | 255 | gWindow->glAddGeometry (matrix, context->box, reg); |
3169 | 256 | gWindow->vertexBuffer ()->end (); | ||
3170 | 256 | 257 | ||
3171 | 257 | if (mask & PAINT_WINDOW_TRANSLUCENT_MASK) | 258 | if (mask & PAINT_WINDOW_TRANSLUCENT_MASK) |
3172 | 258 | mask |= PAINT_WINDOW_BLEND_MASK; | 259 | mask |= PAINT_WINDOW_BLEND_MASK; |
3173 | 259 | 260 | ||
3175 | 260 | gWindow->glDrawTexture (context->texture[0].textures[i], fragment, mask); | 261 | gWindow->glDrawTexture (context->texture[0].textures[i], transform, |
3176 | 262 | attrib, mask); | ||
3177 | 261 | 263 | ||
3178 | 262 | if (rect.width () > 0 && rect.height () > 0) | 264 | if (rect.width () > 0 && rect.height () > 0) |
3179 | 263 | { | 265 | { |
3180 | @@ -321,11 +323,12 @@ | |||
3181 | 321 | saveFilter = gScreen->filter (SCREEN_TRANS_FILTER); | 323 | saveFilter = gScreen->filter (SCREEN_TRANS_FILTER); |
3182 | 322 | gScreen->setFilter (SCREEN_TRANS_FILTER, GLTexture::Good); | 324 | gScreen->setFilter (SCREEN_TRANS_FILTER, GLTexture::Good); |
3183 | 323 | 325 | ||
3185 | 324 | gWindow->geometry ().reset (); | 326 | gWindow->vertexBuffer ()->begin (); |
3186 | 325 | gWindow->glAddGeometry (matrix, r, reg); | 327 | gWindow->glAddGeometry (matrix, r, reg); |
3187 | 328 | gWindow->vertexBuffer ()->end (); | ||
3188 | 326 | 329 | ||
3189 | 327 | gWindow->glDrawTexture (context->texture[1].textures[j], | 330 | gWindow->glDrawTexture (context->texture[1].textures[j], |
3191 | 328 | fragment, mask); | 331 | transform, attrib, mask); |
3192 | 329 | 332 | ||
3193 | 330 | gScreen->setFilter (SCREEN_TRANS_FILTER, saveFilter); | 333 | gScreen->setFilter (SCREEN_TRANS_FILTER, saveFilter); |
3194 | 331 | } | 334 | } |
3195 | 332 | 335 | ||
3196 | === modified file 'plugins/imgsvg/src/imgsvg.h' | |||
3197 | --- plugins/imgsvg/src/imgsvg.h 2012-01-18 16:26:45 +0000 | |||
3198 | +++ plugins/imgsvg/src/imgsvg.h 2012-05-17 07:01:21 +0000 | |||
3199 | @@ -76,7 +76,8 @@ | |||
3200 | 76 | SvgWindow (CompWindow *window); | 76 | SvgWindow (CompWindow *window); |
3201 | 77 | ~SvgWindow (); | 77 | ~SvgWindow (); |
3202 | 78 | 78 | ||
3204 | 79 | bool glDraw (const GLMatrix &transform, GLFragment::Attrib &fragment, | 79 | bool glDraw (const GLMatrix &transform, |
3205 | 80 | const GLWindowPaintAttrib &attrib, | ||
3206 | 80 | const CompRegion ®ion, unsigned int mask); | 81 | const CompRegion ®ion, unsigned int mask); |
3207 | 81 | void moveNotify (int dx, int dy, bool immediate); | 82 | void moveNotify (int dx, int dy, bool immediate); |
3208 | 82 | void resizeNotify (int dx, int dy, int dwidth, int dheight); | 83 | void resizeNotify (int dx, int dy, int dwidth, int dheight); |
3209 | 83 | 84 | ||
3210 | === modified file 'plugins/obs/src/obs.cpp' | |||
3211 | --- plugins/obs/src/obs.cpp 2010-07-02 02:49:24 +0000 | |||
3212 | +++ plugins/obs/src/obs.cpp 2012-05-17 07:01:21 +0000 | |||
3213 | @@ -151,29 +151,30 @@ | |||
3214 | 151 | we wrap into glDrawWindow here */ | 151 | we wrap into glDrawWindow here */ |
3215 | 152 | 152 | ||
3216 | 153 | bool | 153 | bool |
3221 | 154 | ObsWindow::glDraw (const GLMatrix& transform, | 154 | ObsWindow::glDraw (const GLMatrix &transform, |
3222 | 155 | GLFragment::Attrib& attrib, | 155 | const GLWindowPaintAttrib &attrib, |
3223 | 156 | const CompRegion& region, | 156 | const CompRegion ®ion, |
3224 | 157 | unsigned int mask) | 157 | unsigned int mask) |
3225 | 158 | { | 158 | { |
3226 | 159 | GLWindowPaintAttrib wAttrib (attrib); | ||
3227 | 159 | int factor; | 160 | int factor; |
3228 | 160 | 161 | ||
3229 | 161 | factor = customFactor[MODIFIER_OPACITY]; | 162 | factor = customFactor[MODIFIER_OPACITY]; |
3230 | 162 | if (factor != 100) | 163 | if (factor != 100) |
3231 | 163 | { | 164 | { |
3233 | 164 | attrib.setOpacity (factor * attrib.getOpacity () / 100); | 165 | wAttrib.opacity = factor * wAttrib.opacity / 100; |
3234 | 165 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; | 166 | mask |= PAINT_WINDOW_TRANSLUCENT_MASK; |
3235 | 166 | } | 167 | } |
3236 | 167 | 168 | ||
3237 | 168 | factor = customFactor[MODIFIER_BRIGHTNESS]; | 169 | factor = customFactor[MODIFIER_BRIGHTNESS]; |
3238 | 169 | if (factor != 100) | 170 | if (factor != 100) |
3240 | 170 | attrib.setBrightness (factor * attrib.getBrightness () / 100); | 171 | wAttrib.brightness = factor * wAttrib.brightness / 100; |
3241 | 171 | 172 | ||
3242 | 172 | factor = customFactor[MODIFIER_SATURATION]; | 173 | factor = customFactor[MODIFIER_SATURATION]; |
3243 | 173 | if (factor != 100) | 174 | if (factor != 100) |
3245 | 174 | attrib.setSaturation (factor * attrib.getSaturation () / 100); | 175 | wAttrib.saturation = factor * wAttrib.saturation / 100; |
3246 | 175 | 176 | ||
3248 | 176 | return gWindow->glDraw (transform, attrib, region, mask); | 177 | return gWindow->glDraw (transform, wAttrib, region, mask); |
3249 | 177 | } | 178 | } |
3250 | 178 | 179 | ||
3251 | 179 | void | 180 | void |
3252 | 180 | 181 | ||
3253 | === modified file 'plugins/obs/src/obs.h' | |||
3254 | --- plugins/obs/src/obs.h 2012-01-18 16:26:45 +0000 | |||
3255 | +++ plugins/obs/src/obs.h 2012-05-17 07:01:21 +0000 | |||
3256 | @@ -66,7 +66,7 @@ | |||
3257 | 66 | 66 | ||
3258 | 67 | bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &, | 67 | bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &, |
3259 | 68 | const CompRegion &, unsigned int); | 68 | const CompRegion &, unsigned int); |
3261 | 69 | bool glDraw (const GLMatrix &, GLFragment::Attrib &, | 69 | bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &, |
3262 | 70 | const CompRegion &, unsigned int); | 70 | const CompRegion &, unsigned int); |
3263 | 71 | 71 | ||
3264 | 72 | void changePaintModifier (unsigned int, int); | 72 | void changePaintModifier (unsigned int, int); |
3265 | 73 | 73 | ||
3266 | === modified file 'plugins/opengl/CMakeLists.txt' | |||
3267 | --- plugins/opengl/CMakeLists.txt 2009-03-15 05:09:18 +0000 | |||
3268 | +++ plugins/opengl/CMakeLists.txt 2012-05-17 07:01:21 +0000 | |||
3269 | @@ -2,7 +2,12 @@ | |||
3270 | 2 | 2 | ||
3271 | 3 | include (CompizPlugin) | 3 | include (CompizPlugin) |
3272 | 4 | 4 | ||
3273 | 5 | find_package (OpenGL) | ||
3274 | 6 | if (OPENGL_FOUND) | ||
3275 | 7 | compiz_plugin(opengl PLUGINDEPS composite LIBRARIES ${OPENGL_gl_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) | ||
3276 | 8 | endif () | ||
3277 | 9 | \ No newline at end of file | 5 | \ No newline at end of file |
3278 | 6 | if (USE_GLES) | ||
3279 | 7 | compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD "-DUSE_GLES -std=c++0x" LIBRARIES ${OPENGLES2_LIBRARIES} INCDIRS ${OPENGLES2_INCLUDE_DIR}) | ||
3280 | 8 | else (USE_GLES) | ||
3281 | 9 | find_package (OpenGL) | ||
3282 | 10 | if (OPENGL_FOUND) | ||
3283 | 11 | compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD -std=c++0x LIBRARIES ${OPENGL_gl_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) | ||
3284 | 12 | endif (OPENGL_FOUND) | ||
3285 | 13 | endif (USE_GLES) | ||
3286 | 14 | |||
3287 | 10 | 15 | ||
3288 | === modified file 'plugins/opengl/compiz-opengl.pc.in' | |||
3289 | --- plugins/opengl/compiz-opengl.pc.in 2009-03-15 05:09:18 +0000 | |||
3290 | +++ plugins/opengl/compiz-opengl.pc.in 2012-05-17 07:01:21 +0000 | |||
3291 | @@ -8,5 +8,5 @@ | |||
3292 | 8 | Version: @VERSION@ | 8 | Version: @VERSION@ |
3293 | 9 | 9 | ||
3294 | 10 | Requires: compiz compiz-composite | 10 | Requires: compiz compiz-composite |
3295 | 11 | Libs: -lGL -L${libdir} -lopengl | ||
3296 | 12 | Cflags: @COMPIZ_CFLAGS@ -I${includedir}/compiz | ||
3297 | 13 | \ No newline at end of file | 11 | \ No newline at end of file |
3298 | 12 | Libs: @PKGCONFIG_LIBS@ -L${libdir} -lopengl | ||
3299 | 13 | Cflags: @COMPIZ_CFLAGS@ -I${includedir}/compiz | ||
3300 | 14 | 14 | ||
3301 | === removed file 'plugins/opengl/include/opengl/fragment.h' | |||
3302 | --- plugins/opengl/include/opengl/fragment.h 2012-01-18 16:26:45 +0000 | |||
3303 | +++ plugins/opengl/include/opengl/fragment.h 1970-01-01 00:00:00 +0000 | |||
3304 | @@ -1,125 +0,0 @@ | |||
3305 | 1 | /* | ||
3306 | 2 | * Copyright © 2008 Dennis Kasprzyk | ||
3307 | 3 | * Copyright © 2007 Novell, Inc. | ||
3308 | 4 | * | ||
3309 | 5 | * Permission to use, copy, modify, distribute, and sell this software | ||
3310 | 6 | * and its documentation for any purpose is hereby granted without | ||
3311 | 7 | * fee, provided that the above copyright notice appear in all copies | ||
3312 | 8 | * and that both that copyright notice and this permission notice | ||
3313 | 9 | * appear in supporting documentation, and that the name of | ||
3314 | 10 | * Dennis Kasprzyk not be used in advertising or publicity pertaining to | ||
3315 | 11 | * distribution of the software without specific, written prior permission. | ||
3316 | 12 | * Dennis Kasprzyk makes no representations about the suitability of this | ||
3317 | 13 | * software for any purpose. It is provided "as is" without express or | ||
3318 | 14 | * implied warranty. | ||
3319 | 15 | * | ||
3320 | 16 | * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
3321 | 17 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
3322 | 18 | * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
3323 | 19 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
3324 | 20 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
3325 | 21 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
3326 | 22 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
3327 | 23 | * | ||
3328 | 24 | * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> | ||
3329 | 25 | * David Reveman <davidr@novell.com> | ||
3330 | 26 | */ | ||
3331 | 27 | |||
3332 | 28 | #ifndef _GLFRAGMENT_H | ||
3333 | 29 | #define _GLFRAGMENT_H | ||
3334 | 30 | |||
3335 | 31 | #define MAX_FRAGMENT_FUNCTIONS 16 | ||
3336 | 32 | |||
3337 | 33 | #define COMP_FETCH_TARGET_2D 0 | ||
3338 | 34 | #define COMP_FETCH_TARGET_RECT 1 | ||
3339 | 35 | #define COMP_FETCH_TARGET_NUM 2 | ||
3340 | 36 | |||
3341 | 37 | struct GLWindowPaintAttrib; | ||
3342 | 38 | class GLScreen; | ||
3343 | 39 | class GLTexture; | ||
3344 | 40 | |||
3345 | 41 | /** | ||
3346 | 42 | * Describes a texture modification fragment program | ||
3347 | 43 | * for a texture | ||
3348 | 44 | */ | ||
3349 | 45 | namespace GLFragment { | ||
3350 | 46 | |||
3351 | 47 | class Storage; | ||
3352 | 48 | |||
3353 | 49 | typedef unsigned int FunctionId; | ||
3354 | 50 | |||
3355 | 51 | class PrivateFunctionData; | ||
3356 | 52 | class PrivateAttrib; | ||
3357 | 53 | |||
3358 | 54 | class FunctionData { | ||
3359 | 55 | public: | ||
3360 | 56 | FunctionData (); | ||
3361 | 57 | ~FunctionData (); | ||
3362 | 58 | |||
3363 | 59 | /** | ||
3364 | 60 | * Returns the status of this fragment program | ||
3365 | 61 | * (valid or invalid) | ||
3366 | 62 | */ | ||
3367 | 63 | bool status (); | ||
3368 | 64 | |||
3369 | 65 | void addTempHeaderOp (const char *name); | ||
3370 | 66 | |||
3371 | 67 | void addParamHeaderOp (const char *name); | ||
3372 | 68 | |||
3373 | 69 | void addAttribHeaderOp (const char *name); | ||
3374 | 70 | |||
3375 | 71 | |||
3376 | 72 | void addFetchOp (const char *dst, const char *offset, int target); | ||
3377 | 73 | |||
3378 | 74 | void addColorOp (const char *dst, const char *src); | ||
3379 | 75 | |||
3380 | 76 | void addDataOp (const char *str, ...); | ||
3381 | 77 | |||
3382 | 78 | void addBlendOp (const char *str, ...); | ||
3383 | 79 | |||
3384 | 80 | FunctionId createFragmentFunction (const char *name); | ||
3385 | 81 | |||
3386 | 82 | private: | ||
3387 | 83 | PrivateFunctionData *priv; | ||
3388 | 84 | }; | ||
3389 | 85 | |||
3390 | 86 | class Attrib { | ||
3391 | 87 | public: | ||
3392 | 88 | Attrib (const GLWindowPaintAttrib &paint); | ||
3393 | 89 | Attrib (const Attrib&); | ||
3394 | 90 | ~Attrib (); | ||
3395 | 91 | |||
3396 | 92 | Attrib &operator= (const Attrib &rhs); | ||
3397 | 93 | |||
3398 | 94 | unsigned int allocTextureUnits (unsigned int nTexture); | ||
3399 | 95 | |||
3400 | 96 | unsigned int allocParameters (unsigned int nParam); | ||
3401 | 97 | |||
3402 | 98 | void addFunction (FunctionId function); | ||
3403 | 99 | |||
3404 | 100 | bool enable (bool *blending); | ||
3405 | 101 | void disable (); | ||
3406 | 102 | |||
3407 | 103 | unsigned short getSaturation (); | ||
3408 | 104 | unsigned short getBrightness (); | ||
3409 | 105 | unsigned short getOpacity (); | ||
3410 | 106 | |||
3411 | 107 | void setSaturation (unsigned short); | ||
3412 | 108 | void setBrightness (unsigned short); | ||
3413 | 109 | void setOpacity (unsigned short); | ||
3414 | 110 | |||
3415 | 111 | bool hasFunctions (); | ||
3416 | 112 | |||
3417 | 113 | private: | ||
3418 | 114 | PrivateAttrib *priv; | ||
3419 | 115 | }; | ||
3420 | 116 | |||
3421 | 117 | void destroyFragmentFunction (FunctionId id); | ||
3422 | 118 | |||
3423 | 119 | FunctionId getSaturateFragmentFunction (GLTexture *texture, | ||
3424 | 120 | int param); | ||
3425 | 121 | }; | ||
3426 | 122 | |||
3427 | 123 | |||
3428 | 124 | |||
3429 | 125 | #endif | ||
3430 | 126 | 0 | ||
3431 | === added file 'plugins/opengl/include/opengl/framebufferobject.h' | |||
3432 | --- plugins/opengl/include/opengl/framebufferobject.h 1970-01-01 00:00:00 +0000 | |||
3433 | +++ plugins/opengl/include/opengl/framebufferobject.h 2012-05-17 07:01:21 +0000 | |||
3434 | @@ -0,0 +1,107 @@ | |||
3435 | 1 | /* | ||
3436 | 2 | * Copyright (c) 2011 Collabora, Ltd. | ||
3437 | 3 | * | ||
3438 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
3439 | 5 | * and its documentation for any purpose is hereby granted without | ||
3440 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
3441 | 7 | * and that both that copyright notice and this permission notice | ||
3442 | 8 | * appear in supporting documentation, and that the name of | ||
3443 | 9 | * Collabora Ltd. not be used in advertising or publicity pertaining to | ||
3444 | 10 | * distribution of the software without specific, written prior permission. | ||
3445 | 11 | * Collabora Ltd. makes no representations about the suitability of this | ||
3446 | 12 | * software for any purpose. It is provided "as is" without express or | ||
3447 | 13 | * implied warranty. | ||
3448 | 14 | * | ||
3449 | 15 | * COLLABORA LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
3450 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
3451 | 17 | * NO EVENT SHALL COLLABORA LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
3452 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
3453 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
3454 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
3455 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
3456 | 22 | * | ||
3457 | 23 | * Authors: Pekka Paalanen <ppaalanen@gmail.com> | ||
3458 | 24 | */ | ||
3459 | 25 | |||
3460 | 26 | #ifndef _COMPIZ_GLFRAMEBUFFEROBJECT_H | ||
3461 | 27 | #define _COMPIZ_GLFRAMEBUFFEROBJECT_H | ||
3462 | 28 | |||
3463 | 29 | #include <opengl/opengl.h> | ||
3464 | 30 | |||
3465 | 31 | struct PrivateGLFramebufferObject; | ||
3466 | 32 | |||
3467 | 33 | /** | ||
3468 | 34 | * Class representing a framebuffer object in GL, supporting only one | ||
3469 | 35 | * color attachment as per GLES 2 spec. The color attachment is referred | ||
3470 | 36 | * to as the texture (of the FBO). | ||
3471 | 37 | * | ||
3472 | 38 | * Usage: | ||
3473 | 39 | * 1. create a GLFramebufferObject (requires a GL context) | ||
3474 | 40 | * 2. call allocate (size), and check status () | ||
3475 | 41 | * 3. old = bind () | ||
3476 | 42 | * 4. do your rendering | ||
3477 | 43 | * 5. rebind (old) | ||
3478 | 44 | * 6. use the rendered texture via tex () | ||
3479 | 45 | * 7. go to 2 or 3, or delete to quit (requires a GL context) | ||
3480 | 46 | * | ||
3481 | 47 | * TODO: add depth/stencil attachments | ||
3482 | 48 | * FIXME: written for OpenGL ES 2 only, desktop OpenGL might not work. | ||
3483 | 49 | */ | ||
3484 | 50 | class GLFramebufferObject | ||
3485 | 51 | { | ||
3486 | 52 | public: | ||
3487 | 53 | GLFramebufferObject (); | ||
3488 | 54 | ~GLFramebufferObject (); | ||
3489 | 55 | |||
3490 | 56 | /** | ||
3491 | 57 | * Ensure the texture is of the given size, recreating it if needed, | ||
3492 | 58 | * and replace the FBO color attachment with it. The texture contents | ||
3493 | 59 | * become undefined, unless specified in the 'image' argument. | ||
3494 | 60 | * When specifying 'image', it's also possible to pass-in the | ||
3495 | 61 | * desired image's 'format' and 'type'. | ||
3496 | 62 | * | ||
3497 | 63 | * Returns true on success, and false on texture allocation failure. | ||
3498 | 64 | */ | ||
3499 | 65 | bool allocate (const CompSize &size, | ||
3500 | 66 | const char *image = NULL, | ||
3501 | 67 | GLenum format = GL_RGBA, | ||
3502 | 68 | GLenum type = GL_UNSIGNED_BYTE); | ||
3503 | 69 | |||
3504 | 70 | /** | ||
3505 | 71 | * Bind this as the current FBO, previous binding in GL context is | ||
3506 | 72 | * undone. GL rendering is now targeted to this FBO. | ||
3507 | 73 | * Returns a pointer to the previously bound FBO, or NULL if | ||
3508 | 74 | * the previous binding was zero (the window system provided | ||
3509 | 75 | * framebuffer). | ||
3510 | 76 | * | ||
3511 | 77 | * The previous FBO is no longer bound, so you can use its | ||
3512 | 78 | * texture. To restore the previous FBO, call rebind (FBO) with | ||
3513 | 79 | * the returned pointer as the argument. | ||
3514 | 80 | */ | ||
3515 | 81 | GLFramebufferObject *bind (); | ||
3516 | 82 | |||
3517 | 83 | /** | ||
3518 | 84 | * Bind the given FBO as the current FBO, without looking up the | ||
3519 | 85 | * previous binding. The argument can be NULL, in which case the | ||
3520 | 86 | * window system provided framebuffer gets bound (FBO is unbound). | ||
3521 | 87 | */ | ||
3522 | 88 | static void rebind (GLFramebufferObject *fbo); | ||
3523 | 89 | |||
3524 | 90 | /** | ||
3525 | 91 | * Check the FBO completeness. Returns true on complete. | ||
3526 | 92 | * Otherwise returns false and reports the error to log. | ||
3527 | 93 | */ | ||
3528 | 94 | bool checkStatus (); | ||
3529 | 95 | |||
3530 | 96 | /** | ||
3531 | 97 | * Return a pointer to the texture that is the color attachment. | ||
3532 | 98 | * This will return NULL, if allocate () has not been called, or | ||
3533 | 99 | * the last allocate () call failed. | ||
3534 | 100 | */ | ||
3535 | 101 | GLTexture *tex (); | ||
3536 | 102 | |||
3537 | 103 | private: | ||
3538 | 104 | PrivateGLFramebufferObject *priv; | ||
3539 | 105 | }; | ||
3540 | 106 | |||
3541 | 107 | #endif // _COMPIZ_GLFRAMEBUFFEROBJECT_H | ||
3542 | 0 | 108 | ||
3543 | === modified file 'plugins/opengl/include/opengl/matrix.h' | |||
3544 | --- plugins/opengl/include/opengl/matrix.h 2009-03-15 05:09:18 +0000 | |||
3545 | +++ plugins/opengl/include/opengl/matrix.h 2012-05-17 07:01:21 +0000 | |||
3546 | @@ -44,6 +44,8 @@ | |||
3547 | 44 | void reset (); | 44 | void reset (); |
3548 | 45 | void toScreenSpace (const CompOutput *output, float z); | 45 | void toScreenSpace (const CompOutput *output, float z); |
3549 | 46 | 46 | ||
3550 | 47 | bool invert (); | ||
3551 | 48 | |||
3552 | 47 | void rotate (const float angle, const float x, | 49 | void rotate (const float angle, const float x, |
3553 | 48 | const float y, const float z); | 50 | const float y, const float z); |
3554 | 49 | void rotate (const float angle, const GLVector& vector); | 51 | void rotate (const float angle, const GLVector& vector); |
3555 | 50 | 52 | ||
3556 | === modified file 'plugins/opengl/include/opengl/opengl.h' | |||
3557 | --- plugins/opengl/include/opengl/opengl.h 2012-01-20 09:05:56 +0000 | |||
3558 | +++ plugins/opengl/include/opengl/opengl.h 2012-05-17 07:01:21 +0000 | |||
3559 | @@ -28,16 +28,45 @@ | |||
3560 | 28 | #ifndef _COMPIZ_OPENGL_H | 28 | #ifndef _COMPIZ_OPENGL_H |
3561 | 29 | #define _COMPIZ_OPENGL_H | 29 | #define _COMPIZ_OPENGL_H |
3562 | 30 | 30 | ||
3563 | 31 | #ifdef USE_GLES | ||
3564 | 32 | #define SUPPORT_X11 | ||
3565 | 33 | #include <GLES2/gl2.h> | ||
3566 | 34 | #include <GLES2/gl2ext.h> | ||
3567 | 35 | #include <EGL/egl.h> | ||
3568 | 36 | #include <EGL/eglext.h> | ||
3569 | 37 | #else | ||
3570 | 31 | #include <GL/gl.h> | 38 | #include <GL/gl.h> |
3571 | 32 | #include <GL/glx.h> | 39 | #include <GL/glx.h> |
3572 | 40 | #endif | ||
3573 | 41 | |||
3574 | 42 | #include <core/size.h> | ||
3575 | 43 | #include <core/pluginclasshandler.h> | ||
3576 | 33 | 44 | ||
3577 | 34 | #include <opengl/matrix.h> | 45 | #include <opengl/matrix.h> |
3578 | 35 | #include <opengl/texture.h> | 46 | #include <opengl/texture.h> |
3580 | 36 | #include <opengl/fragment.h> | 47 | #include <opengl/framebufferobject.h> |
3581 | 48 | #include <opengl/vertexbuffer.h> | ||
3582 | 49 | #include <opengl/program.h> | ||
3583 | 50 | #include <opengl/programcache.h> | ||
3584 | 51 | #include <opengl/shadercache.h> | ||
3585 | 37 | 52 | ||
3586 | 38 | #define COMPIZ_OPENGL_ABI 4 | 53 | #define COMPIZ_OPENGL_ABI 4 |
3587 | 39 | 54 | ||
3589 | 40 | #include <core/pluginclasshandler.h> | 55 | #if !defined(GL_BGRA) |
3590 | 56 | #if !defined(GL_BGRA_EXT) | ||
3591 | 57 | #error GL_BGRA support is required | ||
3592 | 58 | #else | ||
3593 | 59 | #define GL_BGRA GL_BGRA_EXT | ||
3594 | 60 | #endif | ||
3595 | 61 | #endif | ||
3596 | 62 | |||
3597 | 63 | #if !defined(GL_BGRA) | ||
3598 | 64 | #if !defined(GL_BGRA_EXT) | ||
3599 | 65 | #error GL_BGRA support is required | ||
3600 | 66 | #else | ||
3601 | 67 | #define GL_BGRA GL_BGRA_EXT | ||
3602 | 68 | #endif | ||
3603 | 69 | #endif | ||
3604 | 41 | 70 | ||
3605 | 42 | /** | 71 | /** |
3606 | 43 | * camera distance from screen, 0.5 * tan (FOV) | 72 | * camera distance from screen, 0.5 * tan (FOV) |
3607 | @@ -75,8 +104,26 @@ | |||
3608 | 75 | #endif | 104 | #endif |
3609 | 76 | 105 | ||
3610 | 77 | namespace GL { | 106 | namespace GL { |
3612 | 78 | 107 | #ifdef USE_GLES | |
3613 | 108 | typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy, | ||
3614 | 109 | EGLContext ctx, | ||
3615 | 110 | EGLenum target, | ||
3616 | 111 | EGLClientBuffer buffer, | ||
3617 | 112 | const EGLint *attrib_list); | ||
3618 | 113 | typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy, | ||
3619 | 114 | EGLImageKHR image); | ||
3620 | 115 | |||
3621 | 116 | typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target, | ||
3622 | 117 | GLeglImageOES image); | ||
3623 | 118 | |||
3624 | 119 | typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy, | ||
3625 | 120 | EGLSurface surface, | ||
3626 | 121 | EGLint x, EGLint y, | ||
3627 | 122 | EGLint width, EGLint height); | ||
3628 | 123 | |||
3629 | 124 | #else | ||
3630 | 79 | typedef void (*FuncPtr) (void); | 125 | typedef void (*FuncPtr) (void); |
3631 | 126 | |||
3632 | 80 | typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); | 127 | typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); |
3633 | 81 | 128 | ||
3634 | 82 | typedef void (*GLXBindTexImageProc) (Display *display, | 129 | typedef void (*GLXBindTexImageProc) (Display *display, |
3635 | @@ -122,11 +169,6 @@ | |||
3636 | 122 | const int *attribList); | 169 | const int *attribList); |
3637 | 123 | typedef void (*GLXDestroyPixmapProc) (Display *display, | 170 | typedef void (*GLXDestroyPixmapProc) (Display *display, |
3638 | 124 | GLXPixmap pixmap); | 171 | GLXPixmap pixmap); |
3639 | 125 | |||
3640 | 126 | typedef void (*GLActiveTextureProc) (GLenum texture); | ||
3641 | 127 | typedef void (*GLClientActiveTextureProc) (GLenum texture); | ||
3642 | 128 | typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat); | ||
3643 | 129 | |||
3644 | 130 | typedef void (*GLGenProgramsProc) (GLsizei n, | 172 | typedef void (*GLGenProgramsProc) (GLsizei n, |
3645 | 131 | GLuint *programs); | 173 | GLuint *programs); |
3646 | 132 | typedef void (*GLDeleteProgramsProc) (GLsizei n, | 174 | typedef void (*GLDeleteProgramsProc) (GLsizei n, |
3647 | @@ -146,11 +188,16 @@ | |||
3648 | 146 | typedef void (*GLGetProgramivProc) (GLenum target, | 188 | typedef void (*GLGetProgramivProc) (GLenum target, |
3649 | 147 | GLenum pname, | 189 | GLenum pname, |
3650 | 148 | int *params); | 190 | int *params); |
3651 | 191 | #endif | ||
3652 | 192 | |||
3653 | 193 | typedef void (*GLActiveTextureProc) (GLenum texture); | ||
3654 | 194 | typedef void (*GLClientActiveTextureProc) (GLenum texture); | ||
3655 | 195 | typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat); | ||
3656 | 149 | 196 | ||
3657 | 150 | typedef void (*GLGenFramebuffersProc) (GLsizei n, | 197 | typedef void (*GLGenFramebuffersProc) (GLsizei n, |
3658 | 151 | GLuint *framebuffers); | 198 | GLuint *framebuffers); |
3659 | 152 | typedef void (*GLDeleteFramebuffersProc) (GLsizei n, | 199 | typedef void (*GLDeleteFramebuffersProc) (GLsizei n, |
3661 | 153 | GLuint *framebuffers); | 200 | const GLuint *framebuffers); |
3662 | 154 | typedef void (*GLBindFramebufferProc) (GLenum target, | 201 | typedef void (*GLBindFramebufferProc) (GLenum target, |
3663 | 155 | GLuint framebuffer); | 202 | GLuint framebuffer); |
3664 | 156 | typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target); | 203 | typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target); |
3665 | @@ -161,6 +208,96 @@ | |||
3666 | 161 | GLint level); | 208 | GLint level); |
3667 | 162 | typedef void (*GLGenerateMipmapProc) (GLenum target); | 209 | typedef void (*GLGenerateMipmapProc) (GLenum target); |
3668 | 163 | 210 | ||
3669 | 211 | typedef void (*GLBindBufferProc) (GLenum target, | ||
3670 | 212 | GLuint buffer); | ||
3671 | 213 | typedef void (*GLDeleteBuffersProc) (GLsizei n, | ||
3672 | 214 | const GLuint *buffers); | ||
3673 | 215 | typedef void (*GLGenBuffersProc) (GLsizei n, | ||
3674 | 216 | GLuint *buffers); | ||
3675 | 217 | typedef void (*GLBufferDataProc) (GLenum target, | ||
3676 | 218 | GLsizeiptr size, | ||
3677 | 219 | const GLvoid *data, | ||
3678 | 220 | GLenum usage); | ||
3679 | 221 | typedef void (*GLBufferSubDataProc) (GLenum target, | ||
3680 | 222 | GLintptr offset, | ||
3681 | 223 | GLsizeiptr size, | ||
3682 | 224 | const GLvoid *data); | ||
3683 | 225 | |||
3684 | 226 | typedef void (*GLGetShaderivProc) (GLuint shader, | ||
3685 | 227 | GLenum pname, | ||
3686 | 228 | GLint *params); | ||
3687 | 229 | typedef void (*GLGetShaderInfoLogProc) (GLuint shader, | ||
3688 | 230 | GLsizei bufsize, | ||
3689 | 231 | GLsizei *length, | ||
3690 | 232 | GLchar *infoLog); | ||
3691 | 233 | typedef void (*GLGetProgramivProc) (GLuint program, | ||
3692 | 234 | GLenum pname, | ||
3693 | 235 | GLint* params); | ||
3694 | 236 | typedef void (*GLGetProgramInfoLogProc) (GLuint program, | ||
3695 | 237 | GLsizei bufsize, | ||
3696 | 238 | GLsizei *length, | ||
3697 | 239 | GLchar *infoLog); | ||
3698 | 240 | typedef GLuint (*GLCreateShaderProc) (GLenum type); | ||
3699 | 241 | typedef void (*GLShaderSourceProc) (GLuint shader, | ||
3700 | 242 | GLsizei count, | ||
3701 | 243 | const GLchar **string, | ||
3702 | 244 | const GLint* length); | ||
3703 | 245 | typedef void (*GLCompileShaderProc) (GLuint shader); | ||
3704 | 246 | typedef GLuint (*GLCreateProgramProc) (); | ||
3705 | 247 | typedef void (*GLAttachShaderProc) (GLuint program, | ||
3706 | 248 | GLuint shader); | ||
3707 | 249 | typedef void (*GLLinkProgramProc) (GLuint program); | ||
3708 | 250 | typedef void (*GLValidateProgramProc) (GLuint program); | ||
3709 | 251 | typedef void (*GLDeleteShaderProc) (GLuint shader); | ||
3710 | 252 | typedef void (*GLDeleteProgramProc) (GLuint program); | ||
3711 | 253 | typedef void (*GLUseProgramProc) (GLuint program); | ||
3712 | 254 | typedef int (*GLGetUniformLocationProc) (GLuint program, | ||
3713 | 255 | const GLchar* name); | ||
3714 | 256 | typedef void (*GLUniform1fProc) (GLint location, GLfloat x); | ||
3715 | 257 | typedef void (*GLUniform1iProc) (GLint location, GLint x); | ||
3716 | 258 | typedef void (*GLUniform2fProc) (GLint location, GLfloat x, GLfloat y); | ||
3717 | 259 | typedef void (*GLUniform3fProc) (GLint location, | ||
3718 | 260 | GLfloat x, | ||
3719 | 261 | GLfloat y, | ||
3720 | 262 | GLfloat z); | ||
3721 | 263 | typedef void (*GLUniform4fProc) (GLint location, | ||
3722 | 264 | GLfloat x, | ||
3723 | 265 | GLfloat y, | ||
3724 | 266 | GLfloat z, | ||
3725 | 267 | GLfloat w); | ||
3726 | 268 | typedef void (*GLUniform2iProc) (GLint location, GLint x, GLint y); | ||
3727 | 269 | typedef void (*GLUniform3iProc) (GLint location, | ||
3728 | 270 | GLint x, | ||
3729 | 271 | GLint y, | ||
3730 | 272 | GLint z); | ||
3731 | 273 | typedef void (*GLUniform4iProc) (GLint location, | ||
3732 | 274 | GLint x, | ||
3733 | 275 | GLint y, | ||
3734 | 276 | GLint z, | ||
3735 | 277 | GLint w); | ||
3736 | 278 | typedef void (*GLUniformMatrix4fvProc) (GLint location, | ||
3737 | 279 | GLsizei count, | ||
3738 | 280 | GLboolean transpose, | ||
3739 | 281 | const GLfloat *value); | ||
3740 | 282 | typedef int (*GLGetAttribLocationProc) (GLuint program, | ||
3741 | 283 | const GLchar *name); | ||
3742 | 284 | |||
3743 | 285 | typedef void (*GLEnableVertexAttribArrayProc) (GLuint index); | ||
3744 | 286 | typedef void (*GLDisableVertexAttribArrayProc) (GLuint index); | ||
3745 | 287 | typedef void (*GLVertexAttribPointerProc) (GLuint index, | ||
3746 | 288 | GLint size, | ||
3747 | 289 | GLenum type, | ||
3748 | 290 | GLboolean normalized, | ||
3749 | 291 | GLsizei stride, | ||
3750 | 292 | const GLvoid *ptr); | ||
3751 | 293 | |||
3752 | 294 | #ifdef USE_GLES | ||
3753 | 295 | extern EGLCreateImageKHRProc createImage; | ||
3754 | 296 | extern EGLDestroyImageKHRProc destroyImage; | ||
3755 | 297 | |||
3756 | 298 | extern GLEGLImageTargetTexture2DOESProc eglImageTargetTexture; | ||
3757 | 299 | |||
3758 | 300 | #else | ||
3759 | 164 | extern GLXBindTexImageProc bindTexImage; | 301 | extern GLXBindTexImageProc bindTexImage; |
3760 | 165 | extern GLXReleaseTexImageProc releaseTexImage; | 302 | extern GLXReleaseTexImageProc releaseTexImage; |
3761 | 166 | extern GLXQueryDrawableProc queryDrawable; | 303 | extern GLXQueryDrawableProc queryDrawable; |
3762 | @@ -172,11 +309,6 @@ | |||
3763 | 172 | extern GLXGetFBConfigAttribProc getFBConfigAttrib; | 309 | extern GLXGetFBConfigAttribProc getFBConfigAttrib; |
3764 | 173 | extern GLXCreatePixmapProc createPixmap; | 310 | extern GLXCreatePixmapProc createPixmap; |
3765 | 174 | extern GLXDestroyPixmapProc destroyPixmap; | 311 | extern GLXDestroyPixmapProc destroyPixmap; |
3766 | 175 | |||
3767 | 176 | extern GLActiveTextureProc activeTexture; | ||
3768 | 177 | extern GLClientActiveTextureProc clientActiveTexture; | ||
3769 | 178 | extern GLMultiTexCoord2fProc multiTexCoord2f; | ||
3770 | 179 | |||
3771 | 180 | extern GLGenProgramsProc genPrograms; | 312 | extern GLGenProgramsProc genPrograms; |
3772 | 181 | extern GLDeleteProgramsProc deletePrograms; | 313 | extern GLDeleteProgramsProc deletePrograms; |
3773 | 182 | extern GLBindProgramProc bindProgram; | 314 | extern GLBindProgramProc bindProgram; |
3774 | @@ -184,6 +316,11 @@ | |||
3775 | 184 | extern GLProgramParameter4fProc programEnvParameter4f; | 316 | extern GLProgramParameter4fProc programEnvParameter4f; |
3776 | 185 | extern GLProgramParameter4fProc programLocalParameter4f; | 317 | extern GLProgramParameter4fProc programLocalParameter4f; |
3777 | 186 | extern GLGetProgramivProc getProgramiv; | 318 | extern GLGetProgramivProc getProgramiv; |
3778 | 319 | #endif | ||
3779 | 320 | |||
3780 | 321 | extern GLActiveTextureProc activeTexture; | ||
3781 | 322 | extern GLClientActiveTextureProc clientActiveTexture; | ||
3782 | 323 | extern GLMultiTexCoord2fProc multiTexCoord2f; | ||
3783 | 187 | 324 | ||
3784 | 188 | extern GLGenFramebuffersProc genFramebuffers; | 325 | extern GLGenFramebuffersProc genFramebuffers; |
3785 | 189 | extern GLDeleteFramebuffersProc deleteFramebuffers; | 326 | extern GLDeleteFramebuffersProc deleteFramebuffers; |
3786 | @@ -192,16 +329,56 @@ | |||
3787 | 192 | extern GLFramebufferTexture2DProc framebufferTexture2D; | 329 | extern GLFramebufferTexture2DProc framebufferTexture2D; |
3788 | 193 | extern GLGenerateMipmapProc generateMipmap; | 330 | extern GLGenerateMipmapProc generateMipmap; |
3789 | 194 | 331 | ||
3790 | 332 | extern GLBindBufferProc bindBuffer; | ||
3791 | 333 | extern GLDeleteBuffersProc deleteBuffers; | ||
3792 | 334 | extern GLGenBuffersProc genBuffers; | ||
3793 | 335 | extern GLBufferDataProc bufferData; | ||
3794 | 336 | extern GLBufferSubDataProc bufferSubData; | ||
3795 | 337 | |||
3796 | 338 | |||
3797 | 339 | extern GLGetShaderivProc getShaderiv; | ||
3798 | 340 | extern GLGetShaderInfoLogProc getShaderInfoLog; | ||
3799 | 341 | extern GLGetProgramivProc getProgramiv; | ||
3800 | 342 | extern GLGetProgramInfoLogProc getProgramInfoLog; | ||
3801 | 343 | extern GLCreateShaderProc createShader; | ||
3802 | 344 | extern GLShaderSourceProc shaderSource; | ||
3803 | 345 | extern GLCompileShaderProc compileShader; | ||
3804 | 346 | extern GLCreateProgramProc createProgram; | ||
3805 | 347 | extern GLAttachShaderProc attachShader; | ||
3806 | 348 | extern GLLinkProgramProc linkProgram; | ||
3807 | 349 | extern GLValidateProgramProc validateProgram; | ||
3808 | 350 | extern GLDeleteShaderProc deleteShader; | ||
3809 | 351 | extern GLDeleteProgramProc deleteProgram; | ||
3810 | 352 | extern GLUseProgramProc useProgram; | ||
3811 | 353 | extern GLGetUniformLocationProc getUniformLocation; | ||
3812 | 354 | extern GLUniform1fProc uniform1f; | ||
3813 | 355 | extern GLUniform1iProc uniform1i; | ||
3814 | 356 | extern GLUniform2fProc uniform2f; | ||
3815 | 357 | extern GLUniform2iProc uniform2i; | ||
3816 | 358 | extern GLUniform3fProc uniform3f; | ||
3817 | 359 | extern GLUniform3iProc uniform3i; | ||
3818 | 360 | extern GLUniform4fProc uniform4f; | ||
3819 | 361 | extern GLUniform4iProc uniform4i; | ||
3820 | 362 | extern GLUniformMatrix4fvProc uniformMatrix4fv; | ||
3821 | 363 | extern GLGetAttribLocationProc getAttribLocation; | ||
3822 | 364 | |||
3823 | 365 | extern GLEnableVertexAttribArrayProc enableVertexAttribArray; | ||
3824 | 366 | extern GLDisableVertexAttribArrayProc disableVertexAttribArray; | ||
3825 | 367 | extern GLVertexAttribPointerProc vertexAttribPointer; | ||
3826 | 368 | |||
3827 | 369 | |||
3828 | 195 | extern bool textureFromPixmap; | 370 | extern bool textureFromPixmap; |
3829 | 196 | extern bool textureRectangle; | 371 | extern bool textureRectangle; |
3830 | 197 | extern bool textureNonPowerOfTwo; | 372 | extern bool textureNonPowerOfTwo; |
3831 | 373 | extern bool textureNonPowerOfTwoMipmap; | ||
3832 | 198 | extern bool textureEnvCombine; | 374 | extern bool textureEnvCombine; |
3833 | 199 | extern bool textureEnvCrossbar; | 375 | extern bool textureEnvCrossbar; |
3834 | 200 | extern bool textureBorderClamp; | 376 | extern bool textureBorderClamp; |
3835 | 201 | extern bool textureCompression; | 377 | extern bool textureCompression; |
3836 | 202 | extern GLint maxTextureSize; | 378 | extern GLint maxTextureSize; |
3837 | 203 | extern bool fbo; | 379 | extern bool fbo; |
3839 | 204 | extern bool fragmentProgram; | 380 | extern bool vbo; |
3840 | 381 | extern bool shaders; | ||
3841 | 205 | extern GLint maxTextureUnits; | 382 | extern GLint maxTextureUnits; |
3842 | 206 | 383 | ||
3843 | 207 | extern bool canDoSaturated; | 384 | extern bool canDoSaturated; |
3844 | @@ -220,6 +397,7 @@ | |||
3845 | 220 | 397 | ||
3846 | 221 | #define MAX_DEPTH 32 | 398 | #define MAX_DEPTH 32 |
3847 | 222 | 399 | ||
3848 | 400 | #ifndef USE_GLES | ||
3849 | 223 | struct GLFBConfig { | 401 | struct GLFBConfig { |
3850 | 224 | GLXFBConfig fbConfig; | 402 | GLXFBConfig fbConfig; |
3851 | 225 | int yInverted; | 403 | int yInverted; |
3852 | @@ -227,6 +405,7 @@ | |||
3853 | 227 | int textureFormat; | 405 | int textureFormat; |
3854 | 228 | int textureTargets; | 406 | int textureTargets; |
3855 | 229 | }; | 407 | }; |
3856 | 408 | #endif | ||
3857 | 230 | 409 | ||
3858 | 231 | #define NOTHING_TRANS_FILTER 0 | 410 | #define NOTHING_TRANS_FILTER 0 |
3859 | 232 | #define SCREEN_TRANS_FILTER 1 | 411 | #define SCREEN_TRANS_FILTER 1 |
3860 | @@ -236,6 +415,7 @@ | |||
3861 | 236 | extern GLScreenPaintAttrib defaultScreenPaintAttrib; | 415 | extern GLScreenPaintAttrib defaultScreenPaintAttrib; |
3862 | 237 | 416 | ||
3863 | 238 | class GLScreen; | 417 | class GLScreen; |
3864 | 418 | class GLFramebufferObject; | ||
3865 | 239 | 419 | ||
3866 | 240 | class GLScreenInterface : | 420 | class GLScreenInterface : |
3867 | 241 | public WrapableInterface<GLScreen, GLScreenInterface> | 421 | public WrapableInterface<GLScreen, GLScreenInterface> |
3868 | @@ -302,11 +482,24 @@ | |||
3869 | 302 | CompOutput *); | 482 | CompOutput *); |
3870 | 303 | virtual void glDisableOutputClipping (); | 483 | virtual void glDisableOutputClipping (); |
3871 | 304 | 484 | ||
3872 | 485 | virtual GLMatrix *projectionMatrix (); | ||
3873 | 486 | |||
3874 | 487 | /** | ||
3875 | 488 | * Hookable function used by plugins to shade the final composited | ||
3876 | 489 | * Output. | ||
3877 | 490 | * | ||
3878 | 491 | * @param tmpRegion Describes the final composited output region | ||
3879 | 492 | * @param scratchFbo Describes the final composited FBO that is | ||
3880 | 493 | * to be rendered. | ||
3881 | 494 | */ | ||
3882 | 495 | virtual void glPaintCompositedOutput (const CompRegion ®ion, | ||
3883 | 496 | GLFramebufferObject *fbo, | ||
3884 | 497 | unsigned int mask); | ||
3885 | 305 | }; | 498 | }; |
3886 | 306 | 499 | ||
3887 | 307 | 500 | ||
3888 | 308 | class GLScreen : | 501 | class GLScreen : |
3890 | 309 | public WrapableHandler<GLScreenInterface, 6>, | 502 | public WrapableHandler<GLScreenInterface, 7>, |
3891 | 310 | public PluginClassHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI>, | 503 | public PluginClassHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI>, |
3892 | 311 | public CompOption::Class | 504 | public CompOption::Class |
3893 | 312 | { | 505 | { |
3894 | @@ -332,7 +525,9 @@ | |||
3895 | 332 | /** | 525 | /** |
3896 | 333 | * Gets the libGL address of a particular openGL functor | 526 | * Gets the libGL address of a particular openGL functor |
3897 | 334 | */ | 527 | */ |
3898 | 528 | #ifndef USE_GLES | ||
3899 | 335 | GL::FuncPtr getProcAddress (const char *name); | 529 | GL::FuncPtr getProcAddress (const char *name); |
3900 | 530 | #endif | ||
3901 | 336 | 531 | ||
3902 | 337 | void updateBackground (); | 532 | void updateBackground (); |
3903 | 338 | 533 | ||
3904 | @@ -346,8 +541,6 @@ | |||
3905 | 346 | */ | 541 | */ |
3906 | 347 | void setFilter (int, GLTexture::Filter); | 542 | void setFilter (int, GLTexture::Filter); |
3907 | 348 | 543 | ||
3908 | 349 | GLFragment::Storage * fragmentStorage (); | ||
3909 | 350 | |||
3910 | 351 | /** | 544 | /** |
3911 | 352 | * Sets a new compiz-wid openGL texture environment mode | 545 | * Sets a new compiz-wid openGL texture environment mode |
3912 | 353 | */ | 546 | */ |
3913 | @@ -356,7 +549,6 @@ | |||
3914 | 356 | /** | 549 | /** |
3915 | 357 | * Turns lighting on and off | 550 | * Turns lighting on and off |
3916 | 358 | */ | 551 | */ |
3917 | 359 | |||
3918 | 360 | void setLighting (bool lighting); | 552 | void setLighting (bool lighting); |
3919 | 361 | 553 | ||
3920 | 362 | /** | 554 | /** |
3921 | @@ -371,7 +563,28 @@ | |||
3922 | 371 | GLTexture::BindPixmapHandle registerBindPixmap (GLTexture::BindPixmapProc); | 563 | GLTexture::BindPixmapHandle registerBindPixmap (GLTexture::BindPixmapProc); |
3923 | 372 | void unregisterBindPixmap (GLTexture::BindPixmapHandle); | 564 | void unregisterBindPixmap (GLTexture::BindPixmapHandle); |
3924 | 373 | 565 | ||
3925 | 566 | #ifndef USE_GLES | ||
3926 | 374 | GLFBConfig * glxPixmapFBConfig (unsigned int depth); | 567 | GLFBConfig * glxPixmapFBConfig (unsigned int depth); |
3927 | 568 | #endif | ||
3928 | 569 | |||
3929 | 570 | #ifdef USE_GLES | ||
3930 | 571 | EGLContext getEGLContext (); | ||
3931 | 572 | #endif | ||
3932 | 573 | |||
3933 | 574 | /** | ||
3934 | 575 | * Returns a GLProgram from the cache or creates one and caches it | ||
3935 | 576 | */ | ||
3936 | 577 | GLProgram *getProgram (std::list<const GLShaderData*>); | ||
3937 | 578 | |||
3938 | 579 | /** | ||
3939 | 580 | * Returns a GLShaderData from the cache or creates one and caches it | ||
3940 | 581 | */ | ||
3941 | 582 | const GLShaderData *getShaderData (GLShaderParameters ¶ms); | ||
3942 | 583 | |||
3943 | 584 | /** | ||
3944 | 585 | * Returns the FBO compiz is using for the screen | ||
3945 | 586 | */ | ||
3946 | 587 | GLFramebufferObject *fbo (); | ||
3947 | 375 | 588 | ||
3948 | 376 | /** | 589 | /** |
3949 | 377 | * Returns a default icon texture | 590 | * Returns a default icon texture |
3950 | @@ -380,12 +593,6 @@ | |||
3951 | 380 | 593 | ||
3952 | 381 | void resetRasterPos (); | 594 | void resetRasterPos (); |
3953 | 382 | 595 | ||
3954 | 383 | /** | ||
3955 | 384 | * Returns a 4x4 const float array which | ||
3956 | 385 | * represents the current projection matrix | ||
3957 | 386 | */ | ||
3958 | 387 | const float * projectionMatrix (); | ||
3959 | 388 | |||
3960 | 389 | bool glInitContext (XVisualInfo *); | 596 | bool glInitContext (XVisualInfo *); |
3961 | 390 | 597 | ||
3962 | 391 | WRAPABLE_HND (0, GLScreenInterface, bool, glPaintOutput, | 598 | WRAPABLE_HND (0, GLScreenInterface, bool, glPaintOutput, |
3963 | @@ -402,7 +609,12 @@ | |||
3964 | 402 | const GLMatrix &, const CompRegion &, CompOutput *); | 609 | const GLMatrix &, const CompRegion &, CompOutput *); |
3965 | 403 | WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping); | 610 | WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping); |
3966 | 404 | 611 | ||
3967 | 612 | WRAPABLE_HND (5, GLScreenInterface, GLMatrix *, projectionMatrix); | ||
3968 | 613 | WRAPABLE_HND (6, GLScreenInterface, void, glPaintCompositedOutput, | ||
3969 | 614 | const CompRegion &, GLFramebufferObject *, unsigned int); | ||
3970 | 615 | |||
3971 | 405 | friend class GLTexture; | 616 | friend class GLTexture; |
3972 | 617 | friend class GLWindow; | ||
3973 | 406 | 618 | ||
3974 | 407 | private: | 619 | private: |
3975 | 408 | PrivateGLScreen *priv; | 620 | PrivateGLScreen *priv; |
3976 | @@ -453,10 +665,10 @@ | |||
3977 | 453 | * @param region Describes which region will be drawn | 665 | * @param region Describes which region will be drawn |
3978 | 454 | * @param mask Bitmask which describes how this window is drawn | 666 | * @param mask Bitmask which describes how this window is drawn |
3979 | 455 | */ | 667 | */ |
3984 | 456 | virtual bool glDraw (const GLMatrix &matrix, | 668 | virtual bool glDraw (const GLMatrix &matrix, |
3985 | 457 | GLFragment::Attrib &attrib, | 669 | const GLWindowPaintAttrib &attrib, |
3986 | 458 | const CompRegion ®ion, | 670 | const CompRegion ®ion, |
3987 | 459 | unsigned int mask); | 671 | unsigned int mask); |
3988 | 460 | 672 | ||
3989 | 461 | /** | 673 | /** |
3990 | 462 | * Hookable function to add points to a window | 674 | * Hookable function to add points to a window |
3991 | @@ -479,51 +691,18 @@ | |||
3992 | 479 | const CompRegion &clipRegion, | 691 | const CompRegion &clipRegion, |
3993 | 480 | unsigned int min = MAXSHORT, | 692 | unsigned int min = MAXSHORT, |
3994 | 481 | unsigned int max = MAXSHORT); | 693 | unsigned int max = MAXSHORT); |
3998 | 482 | virtual void glDrawTexture (GLTexture *texture, GLFragment::Attrib &, | 694 | virtual void glDrawTexture (GLTexture *texture, const GLMatrix &, |
3999 | 483 | unsigned int); | 695 | const GLWindowPaintAttrib &, unsigned int); |
3997 | 484 | virtual void glDrawGeometry (); | ||
4000 | 485 | }; | 696 | }; |
4001 | 486 | 697 | ||
4002 | 487 | class GLWindow : | 698 | class GLWindow : |
4004 | 488 | public WrapableHandler<GLWindowInterface, 5>, | 699 | public WrapableHandler<GLWindowInterface, 4>, |
4005 | 489 | public PluginClassHandler<GLWindow, CompWindow, COMPIZ_OPENGL_ABI> | 700 | public PluginClassHandler<GLWindow, CompWindow, COMPIZ_OPENGL_ABI> |
4006 | 490 | { | 701 | { |
4007 | 491 | public: | 702 | public: |
4008 | 492 | 703 | ||
4009 | 493 | /** | ||
4010 | 494 | * Class which describes the texture geometry and transformation points | ||
4011 | 495 | * of a window | ||
4012 | 496 | */ | ||
4013 | 497 | class Geometry { | ||
4014 | 498 | public: | ||
4015 | 499 | Geometry (); | ||
4016 | 500 | ~Geometry (); | ||
4017 | 501 | |||
4018 | 502 | void reset (); | ||
4019 | 503 | |||
4020 | 504 | /** | ||
4021 | 505 | * Set the number of vertices in the texture geometry | ||
4022 | 506 | */ | ||
4023 | 507 | bool moreVertices (int newSize); | ||
4024 | 508 | |||
4025 | 509 | /** | ||
4026 | 510 | * Set the number of indices in the texture geometry | ||
4027 | 511 | */ | ||
4028 | 512 | bool moreIndices (int newSize); | ||
4029 | 513 | |||
4030 | 514 | public: | ||
4031 | 515 | GLfloat *vertices; | ||
4032 | 516 | int vertexSize; | ||
4033 | 517 | int vertexStride; | ||
4034 | 518 | GLushort *indices; | ||
4035 | 519 | int indexSize; | ||
4036 | 520 | int vCount; | ||
4037 | 521 | int texUnits; | ||
4038 | 522 | int texCoordSize; | ||
4039 | 523 | int indexCount; | ||
4040 | 524 | }; | ||
4041 | 525 | |||
4042 | 526 | static GLWindowPaintAttrib defaultPaintAttrib; | 704 | static GLWindowPaintAttrib defaultPaintAttrib; |
4043 | 705 | |||
4044 | 527 | public: | 706 | public: |
4045 | 528 | 707 | ||
4046 | 529 | GLWindow (CompWindow *w); | 708 | GLWindow (CompWindow *w); |
4047 | @@ -566,9 +745,20 @@ | |||
4048 | 566 | void updatePaintAttribs (); | 745 | void updatePaintAttribs (); |
4049 | 567 | 746 | ||
4050 | 568 | /** | 747 | /** |
4054 | 569 | * Returns the window texture geometry | 748 | * Returns the window vertex buffer object |
4055 | 570 | */ | 749 | */ |
4056 | 571 | Geometry & geometry (); | 750 | GLVertexBuffer * vertexBuffer (); |
4057 | 751 | |||
4058 | 752 | /** | ||
4059 | 753 | * Add a vertex and/or fragment shader function to the pipeline. | ||
4060 | 754 | * | ||
4061 | 755 | * @param name Name of the plugin adding the functions | ||
4062 | 756 | * @param vertex_shader Function to add to the vertex shader | ||
4063 | 757 | * @param fragment_shader Function to add to the fragment shader | ||
4064 | 758 | */ | ||
4065 | 759 | void addShaders (std::string name, | ||
4066 | 760 | std::string vertex_shader, | ||
4067 | 761 | std::string fragment_shader); | ||
4068 | 572 | 762 | ||
4069 | 573 | GLTexture *getIcon (int width, int height); | 763 | GLTexture *getIcon (int width, int height); |
4070 | 574 | 764 | ||
4071 | @@ -576,14 +766,15 @@ | |||
4072 | 576 | const GLWindowPaintAttrib &, const GLMatrix &, | 766 | const GLWindowPaintAttrib &, const GLMatrix &, |
4073 | 577 | const CompRegion &, unsigned int); | 767 | const CompRegion &, unsigned int); |
4074 | 578 | WRAPABLE_HND (1, GLWindowInterface, bool, glDraw, const GLMatrix &, | 768 | WRAPABLE_HND (1, GLWindowInterface, bool, glDraw, const GLMatrix &, |
4076 | 579 | GLFragment::Attrib &, const CompRegion &, unsigned int); | 769 | const GLWindowPaintAttrib &, const CompRegion &, |
4077 | 770 | unsigned int); | ||
4078 | 580 | WRAPABLE_HND (2, GLWindowInterface, void, glAddGeometry, | 771 | WRAPABLE_HND (2, GLWindowInterface, void, glAddGeometry, |
4079 | 581 | const GLTexture::MatrixList &, const CompRegion &, | 772 | const GLTexture::MatrixList &, const CompRegion &, |
4080 | 582 | const CompRegion &, | 773 | const CompRegion &, |
4081 | 583 | unsigned int = MAXSHORT, unsigned int = MAXSHORT); | 774 | unsigned int = MAXSHORT, unsigned int = MAXSHORT); |
4082 | 584 | WRAPABLE_HND (3, GLWindowInterface, void, glDrawTexture, | 775 | WRAPABLE_HND (3, GLWindowInterface, void, glDrawTexture, |
4085 | 585 | GLTexture *texture, GLFragment::Attrib &, unsigned int); | 776 | GLTexture *texture, const GLMatrix &, |
4086 | 586 | WRAPABLE_HND (4, GLWindowInterface, void, glDrawGeometry); | 777 | const GLWindowPaintAttrib &, unsigned int); |
4087 | 587 | 778 | ||
4088 | 588 | friend class GLScreen; | 779 | friend class GLScreen; |
4089 | 589 | friend class PrivateGLScreen; | 780 | friend class PrivateGLScreen; |
4090 | @@ -593,3 +784,4 @@ | |||
4091 | 593 | }; | 784 | }; |
4092 | 594 | 785 | ||
4093 | 595 | #endif | 786 | #endif |
4094 | 787 | |||
4095 | 596 | 788 | ||
4096 | === added file 'plugins/opengl/include/opengl/program.h' | |||
4097 | --- plugins/opengl/include/opengl/program.h 1970-01-01 00:00:00 +0000 | |||
4098 | +++ plugins/opengl/include/opengl/program.h 2012-05-17 07:01:21 +0000 | |||
4099 | @@ -0,0 +1,75 @@ | |||
4100 | 1 | /* | ||
4101 | 2 | * Copyright © 2011 Linaro Ltd. | ||
4102 | 3 | * | ||
4103 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
4104 | 5 | * and its documentation for any purpose is hereby granted without | ||
4105 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
4106 | 7 | * and that both that copyright notice and this permission notice | ||
4107 | 8 | * appear in supporting documentation, and that the name of | ||
4108 | 9 | * Linaro Ltd. not be used in advertising or publicity pertaining to | ||
4109 | 10 | * distribution of the software without specific, written prior permission. | ||
4110 | 11 | * Linaro Ltd. makes no representations about the suitability of this | ||
4111 | 12 | * software for any purpose. It is provided "as is" without express or | ||
4112 | 13 | * implied warranty. | ||
4113 | 14 | * | ||
4114 | 15 | * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4115 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4116 | 17 | * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4117 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4118 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4119 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4120 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4121 | 22 | * | ||
4122 | 23 | * Authors: Travis Watkins <travis.watkins@linaro.org> | ||
4123 | 24 | */ | ||
4124 | 25 | |||
4125 | 26 | #ifndef _COMPIZ_GLPROGRAM_H | ||
4126 | 27 | #define _COMPIZ_GLPROGRAM_H | ||
4127 | 28 | |||
4128 | 29 | #ifdef USE_GLES | ||
4129 | 30 | #include <GLES2/gl2.h> | ||
4130 | 31 | #else | ||
4131 | 32 | #include <GL/gl.h> | ||
4132 | 33 | #endif | ||
4133 | 34 | |||
4134 | 35 | #include <core/core.h> | ||
4135 | 36 | #include <opengl/matrix.h> | ||
4136 | 37 | |||
4137 | 38 | class PrivateProgram; | ||
4138 | 39 | |||
4139 | 40 | class GLProgram | ||
4140 | 41 | { | ||
4141 | 42 | public: | ||
4142 | 43 | GLProgram (CompString &vertexShader, CompString &fragmentShader); | ||
4143 | 44 | ~GLProgram (); | ||
4144 | 45 | |||
4145 | 46 | bool valid (); | ||
4146 | 47 | void bind (); | ||
4147 | 48 | void unbind (); | ||
4148 | 49 | |||
4149 | 50 | bool setUniform (const char *name, GLfloat value); | ||
4150 | 51 | bool setUniform (const char *name, GLint value); | ||
4151 | 52 | bool setUniform (const char *name, const GLMatrix &value); | ||
4152 | 53 | bool setUniform2f (const char *name, GLfloat x, GLfloat y); | ||
4153 | 54 | bool setUniform3f (const char *name, GLfloat x, GLfloat y, GLfloat z); | ||
4154 | 55 | bool setUniform4f (const char *name, | ||
4155 | 56 | GLfloat x, | ||
4156 | 57 | GLfloat y, | ||
4157 | 58 | GLfloat z, | ||
4158 | 59 | GLfloat w); | ||
4159 | 60 | bool setUniform2i (const char *name, GLint x, GLint y); | ||
4160 | 61 | bool setUniform3i (const char *name, GLint x, GLint y, GLint z); | ||
4161 | 62 | bool setUniform4i (const char *name, | ||
4162 | 63 | GLint x, | ||
4163 | 64 | GLint y, | ||
4164 | 65 | GLint z, | ||
4165 | 66 | GLint w); | ||
4166 | 67 | |||
4167 | 68 | GLuint attributeLocation (const char *name); | ||
4168 | 69 | |||
4169 | 70 | private: | ||
4170 | 71 | PrivateProgram *priv; | ||
4171 | 72 | }; | ||
4172 | 73 | |||
4173 | 74 | #endif // _COMPIZ_GLPROGRAM_H | ||
4174 | 75 | |||
4175 | 0 | 76 | ||
4176 | === added file 'plugins/opengl/include/opengl/programcache.h' | |||
4177 | --- plugins/opengl/include/opengl/programcache.h 1970-01-01 00:00:00 +0000 | |||
4178 | +++ plugins/opengl/include/opengl/programcache.h 2012-05-17 07:01:21 +0000 | |||
4179 | @@ -0,0 +1,51 @@ | |||
4180 | 1 | /* | ||
4181 | 2 | * Copyright © 2011 Linaro Ltd. | ||
4182 | 3 | * | ||
4183 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
4184 | 5 | * and its documentation for any purpose is hereby granted without | ||
4185 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
4186 | 7 | * and that both that copyright notice and this permission notice | ||
4187 | 8 | * appear in supporting documentation, and that the name of | ||
4188 | 9 | * Linaro Ltd. not be used in advertising or publicity pertaining to | ||
4189 | 10 | * distribution of the software without specific, written prior permission. | ||
4190 | 11 | * Linaro Ltd. makes no representations about the suitability of this | ||
4191 | 12 | * software for any purpose. It is provided "as is" without express or | ||
4192 | 13 | * implied warranty. | ||
4193 | 14 | * | ||
4194 | 15 | * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4195 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4196 | 17 | * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4197 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4198 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4199 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4200 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4201 | 22 | * | ||
4202 | 23 | * Authors: Travis Watkins <travis.watkins@linaro.org> | ||
4203 | 24 | */ | ||
4204 | 25 | |||
4205 | 26 | #ifndef _COMPIZ_GLPROGRAMCACHE_H | ||
4206 | 27 | #define _COMPIZ_GLPROGRAMCACHE_H | ||
4207 | 28 | |||
4208 | 29 | #include <string> | ||
4209 | 30 | #include <list> | ||
4210 | 31 | #include <map> | ||
4211 | 32 | #include <boost/bind.hpp> | ||
4212 | 33 | #include <opengl/program.h> | ||
4213 | 34 | |||
4214 | 35 | class PrivateProgramCache; | ||
4215 | 36 | struct GLShaderData; | ||
4216 | 37 | |||
4217 | 38 | class GLProgramCache | ||
4218 | 39 | { | ||
4219 | 40 | private: | ||
4220 | 41 | PrivateProgramCache *priv; | ||
4221 | 42 | |||
4222 | 43 | public: | ||
4223 | 44 | GLProgramCache (size_t); | ||
4224 | 45 | ~GLProgramCache (); | ||
4225 | 46 | |||
4226 | 47 | GLProgram* operator () (std::list<const GLShaderData*>); | ||
4227 | 48 | }; | ||
4228 | 49 | |||
4229 | 50 | #endif // _COMPIZ_GLPROGRAMCACHE_H | ||
4230 | 51 | |||
4231 | 0 | 52 | ||
4232 | === added file 'plugins/opengl/include/opengl/shadercache.h' | |||
4233 | --- plugins/opengl/include/opengl/shadercache.h 1970-01-01 00:00:00 +0000 | |||
4234 | +++ plugins/opengl/include/opengl/shadercache.h 2012-05-17 07:01:21 +0000 | |||
4235 | @@ -0,0 +1,100 @@ | |||
4236 | 1 | /* | ||
4237 | 2 | * Copyright © 2012 Linaro Ltd. | ||
4238 | 3 | * | ||
4239 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
4240 | 5 | * and its documentation for any purpose is hereby granted without | ||
4241 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
4242 | 7 | * and that both that copyright notice and this permission notice | ||
4243 | 8 | * appear in supporting documentation, and that the name of | ||
4244 | 9 | * Linaro Ltd. not be used in advertising or publicity pertaining to | ||
4245 | 10 | * distribution of the software without specific, written prior permission. | ||
4246 | 11 | * Linaro Ltd. makes no representations about the suitability of this | ||
4247 | 12 | * software for any purpose. It is provided "as is" without express or | ||
4248 | 13 | * implied warranty. | ||
4249 | 14 | * | ||
4250 | 15 | * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4251 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4252 | 17 | * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4253 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4254 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4255 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4256 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4257 | 22 | * | ||
4258 | 23 | * Authors: Alexandros Frantzis <alexandros.frantzis@linaro.org> | ||
4259 | 24 | */ | ||
4260 | 25 | #ifndef GL_SHADER_CACHE_H_ | ||
4261 | 26 | #define GL_SHADER_CACHE_H_ | ||
4262 | 27 | |||
4263 | 28 | #include <string> | ||
4264 | 29 | |||
4265 | 30 | /** | ||
4266 | 31 | * How to use a variable in a shader. | ||
4267 | 32 | */ | ||
4268 | 33 | enum GLShaderVariableType | ||
4269 | 34 | { | ||
4270 | 35 | /** The variable is not used */ | ||
4271 | 36 | GLShaderVariableNone, | ||
4272 | 37 | /** The variable value is held in a uniform */ | ||
4273 | 38 | GLShaderVariableUniform, | ||
4274 | 39 | /** The variable value is held in a varying (from a vertex attribute) */ | ||
4275 | 40 | GLShaderVariableVarying, | ||
4276 | 41 | }; | ||
4277 | 42 | |||
4278 | 43 | /** | ||
4279 | 44 | * Parameters that define a vertex-fragment shader pair. | ||
4280 | 45 | */ | ||
4281 | 46 | struct GLShaderParameters | ||
4282 | 47 | { | ||
4283 | 48 | /** Whether this shader supports opacity */ | ||
4284 | 49 | bool opacity; | ||
4285 | 50 | /** Whether this shader supports brightness */ | ||
4286 | 51 | bool brightness; | ||
4287 | 52 | /** Whether this shader supports saturation */ | ||
4288 | 53 | bool saturation; | ||
4289 | 54 | /** Whether this shader supports color and how */ | ||
4290 | 55 | GLShaderVariableType color; | ||
4291 | 56 | /** Whether this shader supports normals and how */ | ||
4292 | 57 | GLShaderVariableType normal; | ||
4293 | 58 | /** The number of textures this shader uses */ | ||
4294 | 59 | int numTextures; | ||
4295 | 60 | |||
4296 | 61 | /** Gets a minimalistic string representation of the parameters */ | ||
4297 | 62 | std::string id() const; | ||
4298 | 63 | /** Gets a unique hash value for this set of parameters */ | ||
4299 | 64 | int hash() const; | ||
4300 | 65 | }; | ||
4301 | 66 | |||
4302 | 67 | /** | ||
4303 | 68 | * An object representing a named vertex-fragment shader pair. | ||
4304 | 69 | */ | ||
4305 | 70 | struct GLShaderData | ||
4306 | 71 | { | ||
4307 | 72 | std::string name; | ||
4308 | 73 | std::string vertexShader; | ||
4309 | 74 | std::string fragmentShader; | ||
4310 | 75 | }; | ||
4311 | 76 | |||
4312 | 77 | class PrivateShaderCache; | ||
4313 | 78 | |||
4314 | 79 | /** | ||
4315 | 80 | * A cache of vertex-fragment shader pairs (GLShaderData). | ||
4316 | 81 | */ | ||
4317 | 82 | class GLShaderCache | ||
4318 | 83 | { | ||
4319 | 84 | public: | ||
4320 | 85 | GLShaderCache (); | ||
4321 | 86 | |||
4322 | 87 | /** | ||
4323 | 88 | * Gets the GLShaderData associated with the specified parameters. | ||
4324 | 89 | * | ||
4325 | 90 | * @param params the parameters to get the GLShaderData for. | ||
4326 | 91 | * | ||
4327 | 92 | * @return the GLShaderData | ||
4328 | 93 | */ | ||
4329 | 94 | const GLShaderData &getShaderData (const GLShaderParameters ¶ms); | ||
4330 | 95 | |||
4331 | 96 | private: | ||
4332 | 97 | PrivateShaderCache *priv; | ||
4333 | 98 | }; | ||
4334 | 99 | |||
4335 | 100 | #endif | ||
4336 | 0 | 101 | ||
4337 | === modified file 'plugins/opengl/include/opengl/texture.h' | |||
4338 | --- plugins/opengl/include/opengl/texture.h 2012-01-18 16:26:45 +0000 | |||
4339 | +++ plugins/opengl/include/opengl/texture.h 2012-05-17 07:01:21 +0000 | |||
4340 | @@ -32,7 +32,12 @@ | |||
4341 | 32 | #include "core/string.h" | 32 | #include "core/string.h" |
4342 | 33 | 33 | ||
4343 | 34 | #include <X11/Xlib-xcb.h> | 34 | #include <X11/Xlib-xcb.h> |
4344 | 35 | |||
4345 | 36 | #ifdef USE_GLES | ||
4346 | 37 | #include <GLES2/gl2.h> | ||
4347 | 38 | #else | ||
4348 | 35 | #include <GL/gl.h> | 39 | #include <GL/gl.h> |
4349 | 40 | #endif | ||
4350 | 36 | 41 | ||
4351 | 37 | #include <boost/function.hpp> | 42 | #include <boost/function.hpp> |
4352 | 38 | 43 | ||
4353 | 39 | 44 | ||
4354 | === modified file 'plugins/opengl/include/opengl/vector.h' | |||
4355 | --- plugins/opengl/include/opengl/vector.h 2010-04-03 16:24:05 +0000 | |||
4356 | +++ plugins/opengl/include/opengl/vector.h 2012-05-17 07:01:21 +0000 | |||
4357 | @@ -40,7 +40,7 @@ | |||
4358 | 40 | } VectorCoordsEnum; | 40 | } VectorCoordsEnum; |
4359 | 41 | 41 | ||
4360 | 42 | GLVector (); | 42 | GLVector (); |
4362 | 43 | GLVector (float x, float y, float z, float w); | 43 | GLVector (float x, float y, float z, float w = 0.0f); |
4363 | 44 | 44 | ||
4364 | 45 | /** | 45 | /** |
4365 | 46 | * Returns a reference to the x, y, z or w value by using | 46 | * Returns a reference to the x, y, z or w value by using |
4366 | @@ -58,13 +58,13 @@ | |||
4367 | 58 | * Returns a readonly x, y, z or w value by using | 58 | * Returns a readonly x, y, z or w value by using |
4368 | 59 | * 0, 1, 2, 3 as array-access items | 59 | * 0, 1, 2, 3 as array-access items |
4369 | 60 | */ | 60 | */ |
4371 | 61 | const float operator[] (int item) const; | 61 | const float & operator[] (int item) const; |
4372 | 62 | 62 | ||
4373 | 63 | /** | 63 | /** |
4374 | 64 | * Returns a readonly x, y, z or w value by using | 64 | * Returns a readonly x, y, z or w value by using |
4375 | 65 | * x, y, z, w as array-access items | 65 | * x, y, z, w as array-access items |
4376 | 66 | */ | 66 | */ |
4378 | 67 | const float operator[] (VectorCoordsEnum coord) const; | 67 | const float & operator[] (VectorCoordsEnum coord) const; |
4379 | 68 | 68 | ||
4380 | 69 | /** | 69 | /** |
4381 | 70 | * Adds all elements in a GLVector | 70 | * Adds all elements in a GLVector |
4382 | 71 | 71 | ||
4383 | === added file 'plugins/opengl/include/opengl/vertexbuffer.h' | |||
4384 | --- plugins/opengl/include/opengl/vertexbuffer.h 1970-01-01 00:00:00 +0000 | |||
4385 | +++ plugins/opengl/include/opengl/vertexbuffer.h 2012-05-17 07:01:21 +0000 | |||
4386 | @@ -0,0 +1,123 @@ | |||
4387 | 1 | /* | ||
4388 | 2 | * Copyright © 2011 Linaro Ltd. | ||
4389 | 3 | * | ||
4390 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
4391 | 5 | * and its documentation for any purpose is hereby granted without | ||
4392 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
4393 | 7 | * and that both that copyright notice and this permission notice | ||
4394 | 8 | * appear in supporting documentation, and that the name of | ||
4395 | 9 | * Linaro Ltd. not be used in advertising or publicity pertaining to | ||
4396 | 10 | * distribution of the software without specific, written prior permission. | ||
4397 | 11 | * Linaro Ltd. makes no representations about the suitability of this | ||
4398 | 12 | * software for any purpose. It is provided "as is" without express or | ||
4399 | 13 | * implied warranty. | ||
4400 | 14 | * | ||
4401 | 15 | * LINARO LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4402 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4403 | 17 | * NO EVENT SHALL LINARO LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4404 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4405 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4406 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4407 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4408 | 22 | * | ||
4409 | 23 | * Authors: Travis Watkins <travis.watkins@linaro.org> | ||
4410 | 24 | * Frederic Plourde <frederic.plourde@collabora.co.uk> | ||
4411 | 25 | */ | ||
4412 | 26 | |||
4413 | 27 | #ifndef _COMPIZ_GLVERTEXBUFFER_H | ||
4414 | 28 | #define _COMPIZ_GLVERTEXBUFFER_H | ||
4415 | 29 | |||
4416 | 30 | #ifdef USE_GLES | ||
4417 | 31 | #include <GLES2/gl2.h> | ||
4418 | 32 | #else | ||
4419 | 33 | #include <GL/gl.h> | ||
4420 | 34 | #endif | ||
4421 | 35 | |||
4422 | 36 | #include <core/core.h> | ||
4423 | 37 | #include <opengl/program.h> | ||
4424 | 38 | #include <opengl/shadercache.h> | ||
4425 | 39 | |||
4426 | 40 | class PrivateVertexBuffer; | ||
4427 | 41 | struct GLWindowPaintAttrib; | ||
4428 | 42 | |||
4429 | 43 | namespace compiz | ||
4430 | 44 | { | ||
4431 | 45 | namespace gl | ||
4432 | 46 | { | ||
4433 | 47 | class AutoProgram | ||
4434 | 48 | { | ||
4435 | 49 | public: | ||
4436 | 50 | virtual ~AutoProgram () {} | ||
4437 | 51 | |||
4438 | 52 | virtual GLProgram *getProgram(GLShaderParameters ¶ms) = 0; | ||
4439 | 53 | }; | ||
4440 | 54 | } | ||
4441 | 55 | } | ||
4442 | 56 | |||
4443 | 57 | class GLVertexBuffer | ||
4444 | 58 | { | ||
4445 | 59 | public: | ||
4446 | 60 | |||
4447 | 61 | GLVertexBuffer (); | ||
4448 | 62 | GLVertexBuffer (GLenum usage); | ||
4449 | 63 | ~GLVertexBuffer (); | ||
4450 | 64 | |||
4451 | 65 | typedef compiz::gl::AutoProgram AutoProgram; | ||
4452 | 66 | |||
4453 | 67 | static GLVertexBuffer *streamingBuffer (); | ||
4454 | 68 | |||
4455 | 69 | void begin (GLenum primitiveType); | ||
4456 | 70 | // default primitiveType is GL_TRIANGLES | ||
4457 | 71 | void begin (); | ||
4458 | 72 | int end (); | ||
4459 | 73 | |||
4460 | 74 | // vertices and normals are 3 parts, count is number of xyz groups | ||
4461 | 75 | void addVertices (GLuint nVertices, GLfloat *vertices); | ||
4462 | 76 | void addNormals (GLuint nNormals, GLfloat *normals); | ||
4463 | 77 | |||
4464 | 78 | // color is always RGBA (4 parts), count is number of rgba groups | ||
4465 | 79 | void addColors (GLuint nColors, GLushort *colors); | ||
4466 | 80 | |||
4467 | 81 | // texture is index, texcoords are 2 parts, count is number of pairs | ||
4468 | 82 | void addTexCoords (GLuint texture, | ||
4469 | 83 | GLuint nTexcoords, | ||
4470 | 84 | GLfloat *texcoords); | ||
4471 | 85 | |||
4472 | 86 | void addUniform (const char *name, GLfloat value); | ||
4473 | 87 | void addUniform (const char *name, GLint value); | ||
4474 | 88 | bool addUniform (const char *name, const GLMatrix &value); | ||
4475 | 89 | void addUniform2f (const char *name, GLfloat x, GLfloat y); | ||
4476 | 90 | void addUniform3f (const char *name, GLfloat x, GLfloat y, GLfloat z); | ||
4477 | 91 | void addUniform4f (const char *name, GLfloat x, GLfloat y, | ||
4478 | 92 | GLfloat z, GLfloat w); | ||
4479 | 93 | void addUniform2i (const char *name, GLint x, GLint y); | ||
4480 | 94 | void addUniform3i (const char *name, GLint x, GLint y, GLint z); | ||
4481 | 95 | void addUniform4i (const char *name, GLint x, GLint y, | ||
4482 | 96 | GLint z, GLint w); | ||
4483 | 97 | |||
4484 | 98 | void setProgram (GLProgram *program); | ||
4485 | 99 | |||
4486 | 100 | void setAutoProgram (AutoProgram *autoProgram); | ||
4487 | 101 | |||
4488 | 102 | // This no-argument render () function is intended for use by plugins | ||
4489 | 103 | // that have custom programs. | ||
4490 | 104 | int render (); | ||
4491 | 105 | |||
4492 | 106 | int render (const GLMatrix &modelview); | ||
4493 | 107 | |||
4494 | 108 | int render (const GLMatrix &modelview, | ||
4495 | 109 | const GLWindowPaintAttrib &attrib); | ||
4496 | 110 | |||
4497 | 111 | int render (const GLMatrix &projection, | ||
4498 | 112 | const GLMatrix &modelview, | ||
4499 | 113 | const GLWindowPaintAttrib &attrib); | ||
4500 | 114 | |||
4501 | 115 | void setVertexOffset (GLuint vOffset); | ||
4502 | 116 | void setMaxVertices (GLint vMax); | ||
4503 | 117 | |||
4504 | 118 | private: | ||
4505 | 119 | PrivateVertexBuffer *priv; | ||
4506 | 120 | }; | ||
4507 | 121 | |||
4508 | 122 | #endif // _COMPIZ_GLVERTEXBUFFER_H | ||
4509 | 123 | |||
4510 | 0 | 124 | ||
4511 | === removed file 'plugins/opengl/src/fragment.cpp' | |||
4512 | --- plugins/opengl/src/fragment.cpp 2012-01-18 16:26:45 +0000 | |||
4513 | +++ plugins/opengl/src/fragment.cpp 1970-01-01 00:00:00 +0000 | |||
4514 | @@ -1,1146 +0,0 @@ | |||
4515 | 1 | /* | ||
4516 | 2 | * Copyright © 2007 Novell, Inc. | ||
4517 | 3 | * | ||
4518 | 4 | * Permission to use, copy, modify, distribute, and sell this software | ||
4519 | 5 | * and its documentation for any purpose is hereby granted without | ||
4520 | 6 | * fee, provided that the above copyright notice appear in all copies | ||
4521 | 7 | * and that both that copyright notice and this permission notice | ||
4522 | 8 | * appear in supporting documentation, and that the name of | ||
4523 | 9 | * Novell, Inc. not be used in advertising or publicity pertaining to | ||
4524 | 10 | * distribution of the software without specific, written prior permission. | ||
4525 | 11 | * Novell, Inc. makes no representations about the suitability of this | ||
4526 | 12 | * software for any purpose. It is provided "as is" without express or | ||
4527 | 13 | * implied warranty. | ||
4528 | 14 | * | ||
4529 | 15 | * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
4530 | 16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
4531 | 17 | * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
4532 | 18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
4533 | 19 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
4534 | 20 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
4535 | 21 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4536 | 22 | * | ||
4537 | 23 | * Author: David Reveman <davidr@novell.com> | ||
4538 | 24 | */ | ||
4539 | 25 | |||
4540 | 26 | #include "privatefragment.h" | ||
4541 | 27 | #include "privates.h" | ||
4542 | 28 | |||
4543 | 29 | #include "core/string.h" | ||
4544 | 30 | |||
4545 | 31 | #include <boost/function.hpp> | ||
4546 | 32 | #include <boost/bind.hpp> | ||
4547 | 33 | #include <boost/foreach.hpp> | ||
4548 | 34 | #define foreach BOOST_FOREACH | ||
4549 | 35 | |||
4550 | 36 | #include <opengl/texture.h> | ||
4551 | 37 | |||
4552 | 38 | #include <string.h> | ||
4553 | 39 | #include <stdlib.h> | ||
4554 | 40 | #include <stdarg.h> | ||
4555 | 41 | |||
4556 | 42 | #define COMP_FUNCTION_TYPE_ARB 0 | ||
4557 | 43 | #define COMP_FUNCTION_TYPE_NUM 1 | ||
4558 | 44 | |||
4559 | 45 | #define COMP_FUNCTION_ARB_MASK (1 << 0) | ||
4560 | 46 | #define COMP_FUNCTION_MASK (COMP_FUNCTION_ARB_MASK) | ||
4561 | 47 | |||
4562 | 48 | namespace GLFragment { | ||
4563 | 49 | |||
4564 | 50 | class Program { | ||
4565 | 51 | public: | ||
4566 | 52 | Program () : | ||
4567 | 53 | signature (0), | ||
4568 | 54 | blending (false), | ||
4569 | 55 | name (0), | ||
4570 | 56 | type (GL_FRAGMENT_PROGRAM_ARB) | ||
4571 | 57 | {}; | ||
4572 | 58 | ~Program () | ||
4573 | 59 | { | ||
4574 | 60 | if (name) | ||
4575 | 61 | (*GL::deletePrograms) (1, &name); | ||
4576 | 62 | }; | ||
4577 | 63 | |||
4578 | 64 | public: | ||
4579 | 65 | std::vector<FunctionId> signature; | ||
4580 | 66 | |||
4581 | 67 | bool blending; | ||
4582 | 68 | |||
4583 | 69 | GLuint name; | ||
4584 | 70 | GLenum type; | ||
4585 | 71 | }; | ||
4586 | 72 | |||
4587 | 73 | typedef enum { | ||
4588 | 74 | OpTypeData, | ||
4589 | 75 | OpTypeDataStore, | ||
4590 | 76 | OpTypeDataOffset, | ||
4591 | 77 | OpTypeDataBlend, | ||
4592 | 78 | OpTypeHeaderTemp, | ||
4593 | 79 | OpTypeHeaderParam, | ||
4594 | 80 | OpTypeHeaderAttrib, | ||
4595 | 81 | OpTypeColor, | ||
4596 | 82 | OpTypeFetch, | ||
4597 | 83 | OpTypeLoad | ||
4598 | 84 | } OpType; | ||
4599 | 85 | |||
4600 | 86 | class HeaderOp { | ||
4601 | 87 | public: | ||
4602 | 88 | HeaderOp () : type (OpTypeHeaderTemp), name ("") {} | ||
4603 | 89 | public: | ||
4604 | 90 | OpType type; | ||
4605 | 91 | CompString name; | ||
4606 | 92 | }; | ||
4607 | 93 | |||
4608 | 94 | class BodyOp { | ||
4609 | 95 | public: | ||
4610 | 96 | BodyOp () : | ||
4611 | 97 | type (OpTypeData), | ||
4612 | 98 | data (""), | ||
4613 | 99 | dst (""), | ||
4614 | 100 | src (""), | ||
4615 | 101 | target (0) | ||
4616 | 102 | { | ||
4617 | 103 | foreach (CompString &str, noOffset) | ||
4618 | 104 | str = ""; | ||
4619 | 105 | foreach (CompString &str, offset) | ||
4620 | 106 | str = ""; | ||
4621 | 107 | }; | ||
4622 | 108 | |||
4623 | 109 | public: | ||
4624 | 110 | OpType type; | ||
4625 | 111 | CompString data; | ||
4626 | 112 | CompString dst; | ||
4627 | 113 | CompString src; | ||
4628 | 114 | unsigned int target; | ||
4629 | 115 | CompString noOffset[COMP_FETCH_TARGET_NUM]; | ||
4630 | 116 | CompString offset[COMP_FETCH_TARGET_NUM]; | ||
4631 | 117 | |||
4632 | 118 | }; | ||
4633 | 119 | |||
4634 | 120 | class PrivateFunctionData { | ||
4635 | 121 | public: | ||
4636 | 122 | PrivateFunctionData () : header (0), body (0), status (true) {} | ||
4637 | 123 | PrivateFunctionData (const PrivateFunctionData&, CompString); | ||
4638 | 124 | |||
4639 | 125 | public: | ||
4640 | 126 | std::vector<HeaderOp> header; | ||
4641 | 127 | std::vector<BodyOp> body; | ||
4642 | 128 | bool status; | ||
4643 | 129 | }; | ||
4644 | 130 | |||
4645 | 131 | class Function { | ||
4646 | 132 | public: | ||
4647 | 133 | Function (): | ||
4648 | 134 | id (0), | ||
4649 | 135 | name (""), | ||
4650 | 136 | mask (0) | ||
4651 | 137 | {}; | ||
4652 | 138 | |||
4653 | 139 | public: | ||
4654 | 140 | FunctionId id; | ||
4655 | 141 | CompString name; | ||
4656 | 142 | PrivateFunctionData data[COMP_FUNCTION_TYPE_NUM]; | ||
4657 | 143 | unsigned int mask; | ||
4658 | 144 | }; | ||
4659 | 145 | |||
4660 | 146 | class PrivateAttrib { | ||
4661 | 147 | public: | ||
4662 | 148 | PrivateAttrib () : | ||
4663 | 149 | opacity (0xffff), | ||
4664 | 150 | brightness (0xffff), | ||
4665 | 151 | saturation (0xffff), | ||
4666 | 152 | nTexture (0), | ||
4667 | 153 | nFunction (0), | ||
4668 | 154 | nParam (0) | ||
4669 | 155 | {} | ||
4670 | 156 | |||
4671 | 157 | PrivateAttrib (const PrivateAttrib &pa) : | ||
4672 | 158 | opacity (pa.opacity), | ||
4673 | 159 | brightness (pa.brightness), | ||
4674 | 160 | saturation (pa.saturation), | ||
4675 | 161 | nTexture (pa.nTexture), | ||
4676 | 162 | nFunction (pa.nFunction), | ||
4677 | 163 | nParam (pa.nParam) | ||
4678 | 164 | { | ||
4679 | 165 | for (int i = 0; i < MAX_FRAGMENT_FUNCTIONS; i++) | ||
4680 | 166 | function[i] = pa.function[i]; | ||
4681 | 167 | } | ||
4682 | 168 | |||
4683 | 169 | public: | ||
4684 | 170 | GLushort opacity; | ||
4685 | 171 | GLushort brightness; | ||
4686 | 172 | GLushort saturation; | ||
4687 | 173 | int nTexture; | ||
4688 | 174 | FunctionId function[MAX_FRAGMENT_FUNCTIONS]; | ||
4689 | 175 | int nFunction; | ||
4690 | 176 | int nParam; | ||
4691 | 177 | }; | ||
4692 | 178 | |||
4693 | 179 | typedef boost::function<void (BodyOp *, int)> DataOpCallBack; | ||
4694 | 180 | |||
4695 | 181 | class InitialLoadFunction : public Function { | ||
4696 | 182 | public: | ||
4697 | 183 | InitialLoadFunction () | ||
4698 | 184 | { | ||
4699 | 185 | id = 0; | ||
4700 | 186 | name = "__core_load"; | ||
4701 | 187 | mask = COMP_FUNCTION_MASK; | ||
4702 | 188 | |||
4703 | 189 | BodyOp b; | ||
4704 | 190 | b.type = OpTypeLoad; | ||
4705 | 191 | b.noOffset[0] = "TEX output, fragment.texcoord[0], texture[0], 2D;"; | ||
4706 | 192 | b.noOffset[1] = "TEX output, fragment.texcoord[0], texture[0], RECT;"; | ||
4707 | 193 | b.offset[0] = "TEX output, __tmp_texcoord0, texture[0], 2D;"; | ||
4708 | 194 | b.offset[1] = "TEX output, __tmp_texcoord0, texture[0], RECT;"; | ||
4709 | 195 | data[0].body.push_back (b); | ||
4710 | 196 | }; | ||
4711 | 197 | }; | ||
4712 | 198 | |||
4713 | 199 | static InitialLoadFunction initialLoadFunction; | ||
4714 | 200 | |||
4715 | 201 | static Function * | ||
4716 | 202 | findFragmentFunction (GLScreen *s, | ||
4717 | 203 | FunctionId id) | ||
4718 | 204 | { | ||
4719 | 205 | foreach (Function *f, s->fragmentStorage ()->functions) | ||
4720 | 206 | if (f->id == id) | ||
4721 | 207 | return f; | ||
4722 | 208 | return NULL; | ||
4723 | 209 | } | ||
4724 | 210 | |||
4725 | 211 | static Function * | ||
4726 | 212 | findFragmentFunctionWithName (GLScreen *s, | ||
4727 | 213 | CompString name) | ||
4728 | 214 | { | ||
4729 | 215 | foreach (Function *f, s->fragmentStorage ()->functions) | ||
4730 | 216 | if (f->name.compare (name) == 0) | ||
4731 | 217 | return f; | ||
4732 | 218 | return NULL; | ||
4733 | 219 | } | ||
4734 | 220 | |||
4735 | 221 | static Program * | ||
4736 | 222 | findFragmentProgram (GLScreen *s, | ||
4737 | 223 | FunctionId *signature, | ||
4738 | 224 | unsigned int nSignature) | ||
4739 | 225 | { | ||
4740 | 226 | unsigned int i; | ||
4741 | 227 | |||
4742 | 228 | foreach (Program *p, s->fragmentStorage ()->programs) | ||
4743 | 229 | { | ||
4744 | 230 | if (p->signature.size () != nSignature) | ||
4745 | 231 | continue; | ||
4746 | 232 | |||
4747 | 233 | for (i = 0; i < nSignature; i++) | ||
4748 | 234 | if (signature[i] != p->signature[i]) | ||
4749 | 235 | break; | ||
4750 | 236 | |||
4751 | 237 | if (i == nSignature) | ||
4752 | 238 | return p; | ||
4753 | 239 | } | ||
4754 | 240 | return NULL; | ||
4755 | 241 | } | ||
4756 | 242 | |||
4757 | 243 | static unsigned int | ||
4758 | 244 | functionMaskToType (int mask) | ||
4759 | 245 | { | ||
4760 | 246 | static struct { | ||
4761 | 247 | unsigned int type; | ||
4762 | 248 | unsigned int mask; | ||
4763 | 249 | } maskToType[] = { | ||
4764 | 250 | { COMP_FUNCTION_TYPE_ARB, COMP_FUNCTION_ARB_MASK } | ||
4765 | 251 | }; | ||
4766 | 252 | |||
4767 | 253 | unsigned int i; | ||
4768 | 254 | |||
4769 | 255 | for (i = 0; i < sizeof (maskToType) / sizeof (maskToType[0]); i++) | ||
4770 | 256 | if (mask & maskToType[i].mask) | ||
4771 | 257 | return maskToType[i].type; | ||
4772 | 258 | |||
4773 | 259 | return 0; | ||
4774 | 260 | } | ||
4775 | 261 | |||
4776 | 262 | static void | ||
4777 | 263 | forEachDataOpInFunction (std::vector<Function *> list, | ||
4778 | 264 | int index, | ||
4779 | 265 | int type, | ||
4780 | 266 | int loadTarget, | ||
4781 | 267 | CompString loadOffset, | ||
4782 | 268 | bool *color, | ||
4783 | 269 | bool *blend, | ||
4784 | 270 | DataOpCallBack callBack) | ||
4785 | 271 | { | ||
4786 | 272 | Function *f = list[index]; | ||
4787 | 273 | BodyOp dataOp; | ||
4788 | 274 | bool colorDone = false; | ||
4789 | 275 | bool blendDone = false; | ||
4790 | 276 | |||
4791 | 277 | *color = false; | ||
4792 | 278 | *blend = false; | ||
4793 | 279 | |||
4794 | 280 | foreach (BodyOp &bodyOp, f->data[type].body) | ||
4795 | 281 | { | ||
4796 | 282 | switch (bodyOp.type) { | ||
4797 | 283 | case OpTypeFetch: { | ||
4798 | 284 | CompString offset = loadOffset; | ||
4799 | 285 | |||
4800 | 286 | /* add offset */ | ||
4801 | 287 | if (bodyOp.data.size ()) | ||
4802 | 288 | { | ||
4803 | 289 | if (loadOffset.size ()) | ||
4804 | 290 | { | ||
4805 | 291 | dataOp.type = OpTypeDataOffset; | ||
4806 | 292 | dataOp.data = | ||
4807 | 293 | compPrintf ("ADD __tmp_texcoord%d, %s, %s;", | ||
4808 | 294 | index, loadOffset.c_str (), | ||
4809 | 295 | bodyOp.data.c_str ()); | ||
4810 | 296 | |||
4811 | 297 | callBack (&dataOp, index); | ||
4812 | 298 | |||
4813 | 299 | offset = compPrintf ("__tmp_texcoord%d", index); | ||
4814 | 300 | } | ||
4815 | 301 | else | ||
4816 | 302 | { | ||
4817 | 303 | offset = bodyOp.data; | ||
4818 | 304 | } | ||
4819 | 305 | } | ||
4820 | 306 | |||
4821 | 307 | forEachDataOpInFunction (list, index - 1, type, | ||
4822 | 308 | bodyOp.target, | ||
4823 | 309 | offset, &colorDone, &blendDone, | ||
4824 | 310 | callBack); | ||
4825 | 311 | |||
4826 | 312 | if (bodyOp.dst.compare ("output")) | ||
4827 | 313 | { | ||
4828 | 314 | dataOp.type = OpTypeDataStore; | ||
4829 | 315 | dataOp.data = | ||
4830 | 316 | compPrintf ("MOV %s, output;", bodyOp.dst.c_str ()); | ||
4831 | 317 | |||
4832 | 318 | /* move to destination */ | ||
4833 | 319 | callBack (&dataOp, index); | ||
4834 | 320 | } | ||
4835 | 321 | } break; | ||
4836 | 322 | case OpTypeLoad: | ||
4837 | 323 | if (loadOffset.size ()) | ||
4838 | 324 | { | ||
4839 | 325 | dataOp.type = OpTypeDataOffset; | ||
4840 | 326 | dataOp.data = | ||
4841 | 327 | compPrintf ("ADD __tmp_texcoord0, fragment.texcoord[0], %s;", | ||
4842 | 328 | loadOffset.c_str ()); | ||
4843 | 329 | |||
4844 | 330 | callBack (&dataOp, index); | ||
4845 | 331 | |||
4846 | 332 | dataOp.data = bodyOp.offset[loadTarget]; | ||
4847 | 333 | } | ||
4848 | 334 | else | ||
4849 | 335 | { | ||
4850 | 336 | dataOp.data = bodyOp.noOffset[loadTarget]; | ||
4851 | 337 | } | ||
4852 | 338 | |||
4853 | 339 | dataOp.type = OpTypeData; | ||
4854 | 340 | |||
4855 | 341 | callBack (&dataOp, index); | ||
4856 | 342 | |||
4857 | 343 | break; | ||
4858 | 344 | case OpTypeColor: | ||
4859 | 345 | if (!colorDone) | ||
4860 | 346 | { | ||
4861 | 347 | dataOp.type = OpTypeData; | ||
4862 | 348 | dataOp.data = | ||
4863 | 349 | compPrintf ("MUL %s, fragment.color, %s;", | ||
4864 | 350 | bodyOp.dst.c_str (), | ||
4865 | 351 | bodyOp.src.c_str ()); | ||
4866 | 352 | |||
4867 | 353 | callBack (&dataOp, index); | ||
4868 | 354 | } | ||
4869 | 355 | else if (bodyOp.dst.compare (bodyOp.src)) | ||
4870 | 356 | { | ||
4871 | 357 | dataOp.type = OpTypeData; | ||
4872 | 358 | dataOp.data = | ||
4873 | 359 | compPrintf ("MOV %s, %s;", | ||
4874 | 360 | bodyOp.dst.c_str (), | ||
4875 | 361 | bodyOp.src.c_str ()); | ||
4876 | 362 | |||
4877 | 363 | callBack (&dataOp, index); | ||
4878 | 364 | } | ||
4879 | 365 | *color = true; | ||
4880 | 366 | break; | ||
4881 | 367 | case OpTypeDataBlend: | ||
4882 | 368 | *blend = true; | ||
4883 | 369 | /* fall-through */ | ||
4884 | 370 | case OpTypeData: | ||
4885 | 371 | callBack (&bodyOp, index); | ||
4886 | 372 | break; | ||
4887 | 373 | case OpTypeDataStore: | ||
4888 | 374 | case OpTypeDataOffset: | ||
4889 | 375 | case OpTypeHeaderTemp: | ||
4890 | 376 | case OpTypeHeaderParam: | ||
4891 | 377 | case OpTypeHeaderAttrib: | ||
4892 | 378 | break; | ||
4893 | 379 | } | ||
4894 | 380 | } | ||
4895 | 381 | |||
4896 | 382 | if (colorDone) | ||
4897 | 383 | *color = true; | ||
4898 | 384 | |||
4899 | 385 | if (blendDone) | ||
4900 | 386 | *blend = true; | ||
4901 | 387 | } | ||
4902 | 388 | |||
4903 | 389 | static int | ||
4904 | 390 | forEachHeaderOpWithType (std::vector<HeaderOp> list, | ||
4905 | 391 | int index, | ||
4906 | 392 | OpType type, | ||
4907 | 393 | CompString prefix, | ||
4908 | 394 | CompString functionPrefix, | ||
4909 | 395 | int count, | ||
4910 | 396 | DataOpCallBack callBack) | ||
4911 | 397 | { | ||
4912 | 398 | BodyOp dataOp; | ||
4913 | 399 | |||
4914 | 400 | dataOp.type = OpTypeData; | ||
4915 | 401 | |||
4916 | 402 | foreach (HeaderOp &header, list) | ||
4917 | 403 | { | ||
4918 | 404 | if (header.type == type) | ||
4919 | 405 | { | ||
4920 | 406 | if (count) | ||
4921 | 407 | { | ||
4922 | 408 | dataOp.data = ", "; | ||
4923 | 409 | } | ||
4924 | 410 | else | ||
4925 | 411 | { | ||
4926 | 412 | dataOp.data = prefix; | ||
4927 | 413 | } | ||
4928 | 414 | |||
4929 | 415 | dataOp.data += functionPrefix; | ||
4930 | 416 | dataOp.data += "_"; | ||
4931 | 417 | dataOp.data += header.name; | ||
4932 | 418 | |||
4933 | 419 | callBack (&dataOp, index); | ||
4934 | 420 | |||
4935 | 421 | count++; | ||
4936 | 422 | } | ||
4937 | 423 | } | ||
4938 | 424 | |||
4939 | 425 | return count; | ||
4940 | 426 | } | ||
4941 | 427 | |||
4942 | 428 | static bool | ||
4943 | 429 | forEachDataOp (std::vector<Function *> list, | ||
4944 | 430 | int type, | ||
4945 | 431 | DataOpCallBack callBack) | ||
4946 | 432 | { | ||
4947 | 433 | BodyOp dataOp; | ||
4948 | 434 | bool colorDone; | ||
4949 | 435 | bool blendDone; | ||
4950 | 436 | int count, nList = list.size (); | ||
4951 | 437 | |||
4952 | 438 | dataOp.type = OpTypeData; | ||
4953 | 439 | |||
4954 | 440 | count = 1; | ||
4955 | 441 | |||
4956 | 442 | dataOp.data = "TEMP output"; | ||
4957 | 443 | |||
4958 | 444 | callBack (&dataOp, nList); | ||
4959 | 445 | |||
4960 | 446 | foreach (Function *f, list) | ||
4961 | 447 | count = forEachHeaderOpWithType (f->data[type].header, | ||
4962 | 448 | nList, OpTypeHeaderTemp, | ||
4963 | 449 | "", f->name, count, callBack); | ||
4964 | 450 | |||
4965 | 451 | dataOp.data = ";"; | ||
4966 | 452 | |||
4967 | 453 | callBack (&dataOp, nList); | ||
4968 | 454 | |||
4969 | 455 | count = 0; | ||
4970 | 456 | |||
4971 | 457 | foreach (Function *f, list) | ||
4972 | 458 | count = forEachHeaderOpWithType (f->data[type].header, | ||
4973 | 459 | nList, OpTypeHeaderParam, | ||
4974 | 460 | "PARAM ", f->name, count, | ||
4975 | 461 | callBack); | ||
4976 | 462 | |||
4977 | 463 | if (count) | ||
4978 | 464 | { | ||
4979 | 465 | dataOp.data = ";"; | ||
4980 | 466 | |||
4981 | 467 | callBack (&dataOp, nList); | ||
4982 | 468 | } | ||
4983 | 469 | |||
4984 | 470 | count = 0; | ||
4985 | 471 | |||
4986 | 472 | foreach (Function *f, list) | ||
4987 | 473 | count = forEachHeaderOpWithType (f->data[type].header, | ||
4988 | 474 | nList, OpTypeHeaderAttrib, | ||
4989 | 475 | "ATTRIB ", f->name, count, | ||
4990 | 476 | callBack); | ||
4991 | 477 | |||
4992 | 478 | if (count) | ||
4993 | 479 | { | ||
4994 | 480 | dataOp.data = ";"; | ||
4995 | 481 | |||
4996 | 482 | callBack (&dataOp, nList); | ||
4997 | 483 | } | ||
4998 | 484 | |||
4999 | 485 | forEachDataOpInFunction (list, nList - 1, type, 0, "", | ||
5000 | 486 | &colorDone, &blendDone, |
The diff has been truncated for viewing.