diff options
author | Gediminas Liktaras <gliktaras@gmail.com> | 2011-12-08 13:34:09 (GMT) |
---|---|---|
committer | Paul Tagliamonte <paultag@fluxbox.org> | 2011-12-10 16:13:19 (GMT) |
commit | cd339169d1961eb508ea89cee2609ec6d0fc0c15 (patch) | |
tree | 01acd158a03fb17a72e067ff0b36701da75e49dc /util/fbcompose/OpenGLWindow.hh | |
parent | 85ac5c4b2c6a526992f483a6e91867dc2f82a19e (diff) | |
download | fluxbox_paul-cd339169d1961eb508ea89cee2609ec6d0fc0c15.zip fluxbox_paul-cd339169d1961eb508ea89cee2609ec6d0fc0c15.tar.bz2 |
fbcompose - A compositing addon for fluxbox window manager.
fbcompose(1) is an optional compositing addon for fluxbox window manager. It
augments fluxbox with a number of graphical features. Most notably, fbcompose
allows fluxbox to properly display applications that require compositing
(docky, for example), adds support for true window transparency (as opposed to
fluxbox's pseudo transparency) and provides a plugin framework to extend the
compositor's functionality.
As this is still a beta version of the compositor, the bugs are likely.
Diffstat (limited to 'util/fbcompose/OpenGLWindow.hh')
-rw-r--r-- | util/fbcompose/OpenGLWindow.hh | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/util/fbcompose/OpenGLWindow.hh b/util/fbcompose/OpenGLWindow.hh new file mode 100644 index 0000000..de99912 --- /dev/null +++ b/util/fbcompose/OpenGLWindow.hh | |||
@@ -0,0 +1,152 @@ | |||
1 | /** OpenGLWindow.hh file for the fluxbox compositor. */ | ||
2 | |||
3 | // Copyright (c) 2011 Gediminas Liktaras (gliktaras at gmail dot com) | ||
4 | // | ||
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | // of this software and associated documentation files (the "Software"), to deal | ||
7 | // in the Software without restriction, including without limitation the rights | ||
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | // copies of the Software, and to permit persons to whom the Software is | ||
10 | // furnished to do so, subject to the following conditions: | ||
11 | // | ||
12 | // The above copyright notice and this permission notice shall be included in | ||
13 | // all copies or substantial portions of the Software. | ||
14 | // | ||
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | // THE SOFTWARE. | ||
22 | |||
23 | |||
24 | #ifndef FBCOMPOSITOR_XRENDERAUTOWINDOW_HH | ||
25 | #define FBCOMPOSITOR_XRENDERAUTOWINDOW_HH | ||
26 | |||
27 | |||
28 | #include "BaseCompWindow.hh" | ||
29 | #include "Exceptions.hh" | ||
30 | #include "OpenGLUtility.hh" | ||
31 | #include "OpenGLResources.hh" | ||
32 | #include "OpenGLTexPartitioner.hh" | ||
33 | |||
34 | #include <GL/glxew.h> | ||
35 | #include <GL/glx.h> | ||
36 | |||
37 | #include <vector> | ||
38 | |||
39 | |||
40 | namespace FbCompositor { | ||
41 | |||
42 | class InitException; | ||
43 | class OpenGLWindow; | ||
44 | |||
45 | |||
46 | /** | ||
47 | * Manages windows in OpenGL rendering mode. | ||
48 | */ | ||
49 | class OpenGLWindow : public BaseCompWindow { | ||
50 | public : | ||
51 | //--- CONSTRUCTORS AND DESTRUCTORS ------------------------------------- | ||
52 | |||
53 | /** Constructor. */ | ||
54 | OpenGLWindow(const OpenGLScreen &screen, Window window_xid); | ||
55 | |||
56 | /** Destructor. */ | ||
57 | virtual ~OpenGLWindow(); | ||
58 | |||
59 | |||
60 | //--- ACCESSORS -------------------------------------------------------- | ||
61 | |||
62 | /** \returns the number of content partitions. */ | ||
63 | int partitionCount() const; | ||
64 | |||
65 | |||
66 | /** \returns the specified content texture partiton. */ | ||
67 | const OpenGL2DTexturePtr contentTexturePartition(int id) const; | ||
68 | |||
69 | /** \returns the specified shape texture partition. */ | ||
70 | const OpenGL2DTexturePtr shapeTexturePartition(int id) const; | ||
71 | |||
72 | /** \returns the adjacent borders of the given partition. */ | ||
73 | unsigned int partitionBorders(int id) const; | ||
74 | |||
75 | /** \returns the array buffer, containing the position of the given partition. */ | ||
76 | const OpenGLBufferPtr partitionPosBuffer(int id) const; | ||
77 | |||
78 | |||
79 | /** \returns the window's screen, cast into the correct class. */ | ||
80 | const OpenGLScreen &openGLScreen() const; | ||
81 | |||
82 | |||
83 | //--- WINDOW UPDATE FUNCTIONS ------------------------------------------ | ||
84 | |||
85 | /** Updates the window's contents. */ | ||
86 | void updateContents(); | ||
87 | |||
88 | /** Updates window's geometry. */ | ||
89 | void updateGeometry(); | ||
90 | |||
91 | /** Updates the window's shape. */ | ||
92 | void updateShape(); | ||
93 | |||
94 | /** Updates the window position vertex array. */ | ||
95 | void updateWindowPos(); | ||
96 | |||
97 | |||
98 | private : | ||
99 | //--- RENDERING-RELATED VARIABLES -------------------------------------- | ||
100 | |||
101 | /** Window's content texture. */ | ||
102 | OpenGL2DTexturePartitionPtr m_content_tex_partition; | ||
103 | |||
104 | /** Window's shape texture. */ | ||
105 | OpenGL2DTexturePartitionPtr m_shape_tex_partition; | ||
106 | |||
107 | /** Window position buffer holder. */ | ||
108 | std::vector<OpenGLBufferPtr> m_window_pos_buffers; | ||
109 | }; | ||
110 | |||
111 | |||
112 | //--- INLINE FUNCTIONS ------------------------------------------------- | ||
113 | |||
114 | // Returns the specified content texture partiton. | ||
115 | inline const OpenGL2DTexturePtr OpenGLWindow::contentTexturePartition(int id) const { | ||
116 | if ((id < 0) || (id >= partitionCount())) { | ||
117 | throw IndexException("Out of bounds index in OpenGLWindow::contentTexturePartition."); | ||
118 | } | ||
119 | return m_content_tex_partition->partitions()[id].texture; | ||
120 | } | ||
121 | |||
122 | // Returns the adjacent borders of the given partition. | ||
123 | inline unsigned int OpenGLWindow::partitionBorders(int id) const { | ||
124 | if ((id < 0) || (id >= partitionCount())) { | ||
125 | throw IndexException("Out of bounds index in OpenGLWindow::partitionBorders."); | ||
126 | } | ||
127 | return m_content_tex_partition->partitions()[id].borders; | ||
128 | } | ||
129 | |||
130 | // Returns the number of contents' partitions. | ||
131 | inline int OpenGLWindow::partitionCount() const { | ||
132 | return m_content_tex_partition->partitions().size(); | ||
133 | } | ||
134 | |||
135 | // Returns the array buffer, containing the position of the given partition. | ||
136 | inline const OpenGLBufferPtr OpenGLWindow::partitionPosBuffer(int id) const { | ||
137 | if ((id < 0) || (id >= partitionCount())) { | ||
138 | throw IndexException("Out of bounds index in OpenGLWindow::partitionPosBuffer."); | ||
139 | } | ||
140 | return m_window_pos_buffers[id]; | ||
141 | } | ||
142 | |||
143 | // Returns the specified shape texture partition. | ||
144 | inline const OpenGL2DTexturePtr OpenGLWindow::shapeTexturePartition(int id) const { | ||
145 | if ((id < 0) || (id >= partitionCount())) { | ||
146 | throw IndexException("Out of bounds index in OpenGLWindow::shapeTexturePartition."); | ||
147 | } | ||
148 | return m_shape_tex_partition->partitions()[id].texture; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | #endif // FBCOMPOSITOR_XRENDERAUTOWINDOW_HH | ||