Merge lp:~vanvugt/compiz/back-to-raring into lp:compiz/0.9.9

Proposed by Daniel van Vugt
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: 3646
Merged at revision: 3644
Proposed branch: lp:~vanvugt/compiz/back-to-raring
Merge into: lp:compiz/0.9.9
Diff against target: 7432 lines (+663/-5659)
40 files modified
compizconfig/tests/compizconfig_backend_concept_test.h (+1/-1)
debian/changelog (+80/-0)
debian/compiz-plugins.install (+0/-1)
gtk/window-decorator/tests/test_gwd_settings.cpp (+2/-2)
include/core/window.h (+2/-0)
plugins/CMakeLists.txt (+0/-1)
plugins/composite/src/pixmapbinding/tests/test-composite-pixmapbinding.cpp (+7/-7)
plugins/decor/src/decor.cpp (+3/-3)
plugins/decor/src/pixmap-requests/tests/test-decor-pixmap-requests.cpp (+1/-1)
plugins/expo/src/expo.cpp (+1/-0)
plugins/freewins/AUTHORS (+0/-8)
plugins/freewins/CMakeLists.txt (+0/-8)
plugins/freewins/COPYING (+0/-340)
plugins/freewins/freewins.xml.in (+0/-398)
plugins/freewins/src/action.cpp (+0/-761)
plugins/freewins/src/events.cpp (+0/-853)
plugins/freewins/src/freewins.cpp (+0/-271)
plugins/freewins/src/freewins.h (+0/-589)
plugins/freewins/src/input.cpp (+0/-397)
plugins/freewins/src/paint.cpp (+0/-527)
plugins/freewins/src/util.cpp (+0/-526)
plugins/grid/src/grid.cpp (+292/-282)
plugins/group/src/group.cpp (+1/-0)
plugins/group/src/queues.cpp (+1/-0)
plugins/group/src/tab.cpp (+2/-0)
plugins/move/src/move.cpp (+7/-0)
plugins/put/src/put.cpp (+5/-12)
plugins/rotate/src/rotate.cpp (+5/-0)
plugins/shelf/src/shelf.cpp (+1/-0)
plugins/showdesktop/showdesktop.xml.in (+5/-29)
plugins/showdesktop/src/showdesktop.cpp (+123/-414)
plugins/showdesktop/src/showdesktop.h (+16/-91)
plugins/snap/src/snap.cpp (+2/-0)
plugins/wall/src/wall.cpp (+9/-0)
plugins/wobbly/src/wobbly.cpp (+1/-0)
plugins/workspacenames/src/workspacenames.cpp (+39/-72)
plugins/workspacenames/src/workspacenames.h (+0/-10)
src/string/tests/printf/src/test-string-printf.cpp (+8/-8)
src/window.cpp (+13/-11)
tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp (+36/-36)
To merge this branch: bzr merge lp:~vanvugt/compiz/back-to-raring
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Didier Roche-Tolomelli Needs Fixing
Sam Spilsbury Approve
Review via email: mp+156459@code.launchpad.net

Commit message

Make lp:compiz/0.9.9 identical to lp:compiz/raring, so we can use it for
raring maintenance and eliminate lp:compiz/raring.

The changes that this proposal "undoes" have not been lost. They have just
moved to the new development series: lp:compiz/0.9.10 (lp:compiz now points
to this)

Description of the change

To review this proposal, all you need to do is verify that it makes lp:compiz/0.9.9 identical to lp:compiz/raring

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Thanks.

Can you make sure that that lp:~compiz-team/compiz/0.9.10 is set to append_only revisions? That way we can eliminate any potential February 10 disasters before they happen again.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yep, I already set append_only a few minutes ago.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Awesome, thanks.

On Tue, Apr 2, 2013 at 3:13 PM, Daniel van Vugt
<email address hidden> wrote:
> Yep, I already set append_only a few minutes ago.
> --
> https://code.launchpad.net/~vanvugt/compiz/back-to-raring/+merge/156459
> You are reviewing the proposed merge of lp:~vanvugt/compiz/back-to-raring into lp:compiz/0.9.9.

--
Sam Spilsbury

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

@Daniel: if you are wanting to make 0.9.9 the new "raring" branch, it's better to do the other way around:
- having lp:compiz/raring being 0.9.9
- merging the old 0.9.9 (moved elsewhere) merged in this 0.9.9 branch which was raring

-> This is needed for "Automatic snapshot from revision 3641" as rev 3641 will not correspond to anything otherwise.
Another way will be to add a changelog with a fake Automatic snapshot from revision <…> which will be the first revision not in raring but in old 0.9.9.

review: Needs Fixing
lp:~vanvugt/compiz/back-to-raring updated
3645. By Daniel van Vugt

Update debian changelog

3646. By Daniel van Vugt

Modify changelog comment so that robots can understand it and insert accurate
bug info.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'compizconfig/tests/compizconfig_backend_concept_test.h'
2--- compizconfig/tests/compizconfig_backend_concept_test.h 2013-03-06 13:44:06 +0000
3+++ compizconfig/tests/compizconfig_backend_concept_test.h 2013-04-02 07:48:28 +0000
4@@ -90,7 +90,7 @@
5 CCSBackendConceptTestEnvironmentInterface::Ptr
6 ConstructTestEnv ()
7 {
8- return boost::make_shared <I> ();
9+ return boost::shared_static_cast <I> (boost::make_shared <I> ());
10 }
11 };
12
13
14=== modified file 'debian/changelog'
15--- debian/changelog 2013-02-28 04:02:41 +0000
16+++ debian/changelog 2013-04-02 07:48:28 +0000
17@@ -1,3 +1,83 @@
18+compiz (1:0.9.9~daily13.04.02-0ubuntu1) UNRELEASED; urgency=low
19+
20+ [Daniel van Vugt]
21+ * Merge lp:compiz/raring back in to lp:compiz/0.9.9 so we can maintain
22+ raring from lp:compiz/0.9.9. The last common revision was 3629, so...
23+ * Automatic snapshot from revision 3629
24+
25+ -- Daniel van Vugt <daniel.van.vugt@canonical.com> Tue, 02 Apr 2013 15:22:54 +0800
26+
27+compiz (1:0.9.9~daily13.03.29-0ubuntu1) raring; urgency=low
28+
29+ [ Michael Terry ]
30+ * [regression-r3635] Guake window appears placed by offset non-
31+ existent decoration (LP: #1159324)
32+
33+ [ Ubuntu daily release ]
34+ * Automatic snapshot from revision 3641
35+
36+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 29 Mar 2013 07:23:54 +0000
37+
38+compiz (1:0.9.9~daily13.03.25-0ubuntu1) raring; urgency=low
39+
40+ [ Michael Terry ]
41+ * [regression] Unmaximized windows can't be closed, minimized, moved
42+ (LP: #1158161)
43+
44+ [ MC Return ]
45+ * Multimonitor: Grid plugin: Wrong calculation of top left mouse-grid-
46+ resize corner coordinates (LP: #1139835)
47+
48+ [ Ubuntu daily release ]
49+ * Automatic snapshot from revision 3639
50+
51+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 25 Mar 2013 04:02:57 +0000
52+
53+compiz (1:0.9.9~daily13.03.20-0ubuntu1) raring; urgency=low
54+
55+ [ Sam Spilsbury ]
56+ * Latest compiz update breaks Java Swing decorations (LP: #1138517)
57+ * [regression-r3623] Wallpaper bleeds through on top right when a
58+ window is opened maximized (LP: #1140505)
59+
60+ [ Ubuntu daily release ]
61+ * Automatic snapshot from revision 3636
62+
63+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 20 Mar 2013 04:02:51 +0000
64+
65+compiz (1:0.9.9~daily13.03.08-0ubuntu1) raring; urgency=low
66+
67+ [ Brandon Schaefer ]
68+ * [regression] Shortcut overlay does not hide when modifier key is
69+ pressed (LP: #1075207)
70+ * Unity blocks other programs from binding globally to Super+* (* =
71+ any key) (LP: #950160)
72+
73+ [ Automatic PS uploader ]
74+ * Automatic snapshot from revision 3633
75+
76+ -- Automatic PS uploader <ps-jenkins@lists.canonical.com> Fri, 08 Mar 2013 10:34:21 +0000
77+
78+compiz (1:0.9.9~daily13.03.06-0ubuntu1) raring; urgency=low
79+
80+ [ Łukasz 'sil2100' Zemczak ]
81+ * Latest compiz update breaks Java Swing decorations (LP: #1138517)
82+
83+ [ Automatic PS uploader ]
84+ * Automatic snapshot from revision 3631
85+
86+ -- Automatic PS uploader <ps-jenkins@lists.canonical.com> Wed, 06 Mar 2013 13:26:19 +0000
87+
88+compiz (1:0.9.9~daily13.03.01-0ubuntu1) raring; urgency=low
89+
90+ [ MC Return ]
91+ * Multiple minor code and style issues (LP: #1134251)
92+
93+ [ Automatic PS uploader ]
94+ * Automatic snapshot from revision 3629
95+
96+ -- Automatic PS uploader <ps-jenkins@lists.canonical.com> Fri, 01 Mar 2013 04:02:19 +0000
97+
98 compiz (1:0.9.9~daily13.02.28-0ubuntu1) raring; urgency=low
99
100 [ Sam Spilsbury ]
101
102=== modified file 'debian/compiz-plugins.install'
103--- debian/compiz-plugins.install 2013-02-26 16:48:27 +0000
104+++ debian/compiz-plugins.install 2013-04-02 07:48:28 +0000
105@@ -11,7 +11,6 @@
106 debian/tmp/usr/*/compiz/*extrawm.*
107 debian/tmp/usr/*/compiz/*fadedesktop.*
108 debian/tmp/usr/*/compiz/*firepaint.*
109-debian/tmp/usr/*/compiz/*freewins.*
110 debian/tmp/usr/*/compiz/*gears.*
111 debian/tmp/usr/*/compiz/*imgjpeg.*
112 debian/tmp/usr/*/compiz/*imgsvg.*
113
114=== modified file 'gtk/window-decorator/tests/test_gwd_settings.cpp'
115--- gtk/window-decorator/tests/test_gwd_settings.cpp 2013-03-06 13:44:06 +0000
116+++ gtk/window-decorator/tests/test_gwd_settings.cpp 2013-04-02 07:48:28 +0000
117@@ -1473,7 +1473,7 @@
118 };
119
120 INSTANTIATE_TEST_CASE_P (MockStorageUpdates, GWDSettingsTestStorageUpdates,
121- ::testing::Values (boost::shared_ptr <GWDSettingsStorageFactoryWrapperInterface> (new GWDMockSettingsStorageFactoryWrapper ())));
122+ ::testing::Values (boost::shared_static_cast <GWDSettingsStorageFactoryWrapperInterface> (boost::make_shared <GWDMockSettingsStorageFactoryWrapper> ())));
123
124 #ifdef USE_GSETTINGS
125 class GWDSettingsStorageGSettingsTest :
126@@ -1625,6 +1625,6 @@
127 };
128
129 INSTANTIATE_TEST_CASE_P (GSettingsStorageUpdates, GWDSettingsTestStorageUpdates,
130- ::testing::Values (boost::shared_ptr <GWDSettingsStorageFactoryWrapperInterface> (new GWDSettingsStorageGSettingsFactoryWrapper ())));
131+ ::testing::Values (boost::shared_static_cast <GWDSettingsStorageFactoryWrapperInterface> (boost::make_shared <GWDSettingsStorageGSettingsFactoryWrapper> ())));
132
133 #endif
134
135=== modified file 'include/core/window.h'
136--- include/core/window.h 2013-03-26 22:02:39 +0000
137+++ include/core/window.h 2013-04-02 07:48:28 +0000
138@@ -440,6 +440,8 @@
139
140 void move (int dx, int dy, bool immediate = true);
141
142+ void syncPosition ();
143+
144 void moveInputFocusTo ();
145
146 void moveInputFocusToOtherWindow ();
147
148=== modified file 'plugins/CMakeLists.txt'
149--- plugins/CMakeLists.txt 2013-03-08 18:42:22 +0000
150+++ plugins/CMakeLists.txt 2013-04-02 07:48:28 +0000
151@@ -23,7 +23,6 @@
152 # disable plugins which won't work on ES2 builds
153 if (BUILD_GLES)
154
155- set (COMPIZ_DISABLE_PLUGIN_FREEWINS ON)
156 set (COMPIZ_DISABLE_PLUGIN_GEARS ON)
157 set (COMPIZ_DISABLE_PLUGIN_TD ON)
158 set (COMPIZ_DISABLE_PLUGIN_COLORFILTER ON)
159
160=== modified file 'plugins/composite/src/pixmapbinding/tests/test-composite-pixmapbinding.cpp'
161--- plugins/composite/src/pixmapbinding/tests/test-composite-pixmapbinding.cpp 2013-03-06 13:44:06 +0000
162+++ plugins/composite/src/pixmapbinding/tests/test-composite-pixmapbinding.cpp 2013-04-02 07:48:28 +0000
163@@ -167,7 +167,7 @@
164 EXPECT_CALL (msg, grabServer ());
165 EXPECT_CALL (msg, syncServer ()).Times (2);
166 EXPECT_CALL (mwag, getAttributes (_)).WillOnce (Invoke (&fwag, &FakeWindowAttributesGet::getAttributes));
167- EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (wp));
168+ EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (boost::shared_static_cast <WindowPixmapInterface> (wp)));
169
170 EXPECT_CALL (*wp, pixmap ()).WillOnce (Return (1));
171
172@@ -214,7 +214,7 @@
173 EXPECT_CALL (msg, grabServer ());
174 EXPECT_CALL (msg, syncServer ()).Times (2);
175 EXPECT_CALL (mwag, getAttributes (_)).WillOnce (Invoke (&fwag, &FakeWindowAttributesGet::getAttributes));
176- EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (wp));
177+ EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (boost::shared_static_cast <WindowPixmapInterface> (wp)));
178
179 EXPECT_CALL (*wp, pixmap ()).WillOnce (Return (1));
180
181@@ -262,7 +262,7 @@
182 EXPECT_CALL (msg, grabServer ());
183 EXPECT_CALL (msg, syncServer ()).Times (2);
184 EXPECT_CALL (mwag, getAttributes (_)).WillOnce (Invoke (&fwag, &FakeWindowAttributesGet::getAttributes));
185- EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (wp));
186+ EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (boost::shared_static_cast <WindowPixmapInterface> (wp)));
187
188 EXPECT_CALL (*wp, pixmap ()).WillOnce (Return (1));
189
190@@ -284,7 +284,7 @@
191 EXPECT_CALL (msg, grabServer ());
192 EXPECT_CALL (msg, syncServer ()).Times (2);
193 EXPECT_CALL (mwag, getAttributes (_)).WillOnce (Invoke (&fwag, &FakeWindowAttributesGet::getAttributes));
194- EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (wp));
195+ EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (boost::shared_static_cast <WindowPixmapInterface> (wp)));
196
197 EXPECT_CALL (*wp, pixmap ()).WillOnce (Return (1));
198
199@@ -331,7 +331,7 @@
200 EXPECT_CALL (msg, grabServer ());
201 EXPECT_CALL (msg, syncServer ()).Times (2);
202 EXPECT_CALL (mwag, getAttributes (_)).WillOnce (Invoke (&fwag, &FakeWindowAttributesGet::getAttributes));
203- EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (wp));
204+ EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (boost::shared_static_cast <WindowPixmapInterface> (wp)));
205
206 EXPECT_CALL (*wp, pixmap ()).WillOnce (Return (1));
207
208@@ -450,7 +450,7 @@
209 EXPECT_CALL (msg, grabServer ());
210 EXPECT_CALL (msg, syncServer ()).Times (2);
211 EXPECT_CALL (mwag, getAttributes (_)).WillOnce (Invoke (&fwag, &FakeWindowAttributesGet::getAttributes));
212- EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (wp));
213+ EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (boost::shared_static_cast <WindowPixmapInterface> (wp)));
214
215 EXPECT_CALL (*wp, pixmap ()).WillOnce (Return (0));
216
217@@ -510,7 +510,7 @@
218 EXPECT_CALL (msg, grabServer ());
219 EXPECT_CALL (msg, syncServer ()).Times (2);
220 EXPECT_CALL (mwag, getAttributes (_)).WillOnce (Invoke (&fwag2, &FakeWindowAttributesGet::getAttributes));
221- EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (wp));
222+ EXPECT_CALL (mwpg, getPixmap ()).WillOnce (Return (boost::shared_static_cast <WindowPixmapInterface> (wp)));
223
224 EXPECT_CALL (msg, ungrabServer ());
225
226
227=== modified file 'plugins/decor/src/decor.cpp'
228--- plugins/decor/src/decor.cpp 2013-03-27 01:31:21 +0000
229+++ plugins/decor/src/decor.cpp 2013-04-02 07:48:28 +0000
230@@ -395,7 +395,7 @@
231
232 DecorPixmap::Ptr pm = boost::make_shared <DecorPixmap> (pixmap, mReleasePool);
233
234- DecorTexture *texture = new DecorTexture (pm);
235+ DecorTexture *texture = new DecorTexture (boost::shared_static_cast <DecorPixmapInterface> (pm));
236
237 if (!texture->status)
238 {
239@@ -1297,7 +1297,7 @@
240 if (d->frameType == frameType &&
241 d->frameState == frameState &&
242 d->frameActions == frameActions)
243- return d;
244+ return boost::shared_static_cast <DecorationInterface> (d);
245 }
246
247 return DecorationInterface::Ptr ();
248@@ -3106,7 +3106,7 @@
249 0,
250 0,
251 None,
252- boost::shared_array <decor_quad_t> (static_cast <decor_quad_t *> (NULL)),
253+ boost::shared_array <decor_quad_t> (NULL),
254 0,
255 screen->root (),
256 NULL)),
257
258=== modified file 'plugins/decor/src/pixmap-requests/tests/test-decor-pixmap-requests.cpp'
259--- plugins/decor/src/pixmap-requests/tests/test-decor-pixmap-requests.cpp 2013-03-06 13:44:06 +0000
260+++ plugins/decor/src/pixmap-requests/tests/test-decor-pixmap-requests.cpp 2013-04-02 07:48:28 +0000
261@@ -45,7 +45,7 @@
262 TEST(DecorPixmapRequestsTest, TestDestroyPixmapDeletes)
263 {
264 boost::shared_ptr <MockDecorPixmapDeletor> mockDeletor = boost::make_shared <MockDecorPixmapDeletor> ();
265- DecorPixmap pm (1, mockDeletor);
266+ DecorPixmap pm (1, boost::shared_static_cast<PixmapDestroyQueue> (mockDeletor));
267
268 EXPECT_CALL (*(mockDeletor.get ()), destroyUnusedPixmap (1)).WillOnce (Return (1));
269 }
270
271=== modified file 'plugins/expo/src/expo.cpp'
272--- plugins/expo/src/expo.cpp 2013-03-26 22:02:39 +0000
273+++ plugins/expo/src/expo.cpp 2013-04-02 07:48:28 +0000
274@@ -247,6 +247,7 @@
275 void
276 ExpoScreen::finishWindowMovement ()
277 {
278+ dndWindow->syncPosition ();
279 dndWindow->ungrabNotify ();
280
281 screen->moveViewport (screen->vp ().x () - selectedVp.x (),
282
283=== removed directory 'plugins/freewins'
284=== removed file 'plugins/freewins/AUTHORS'
285--- plugins/freewins/AUTHORS 2012-07-22 08:50:52 +0000
286+++ plugins/freewins/AUTHORS 1970-01-01 00:00:00 +0000
287@@ -1,8 +0,0 @@
288-The freewins plugin was written by:
289-
290-Rodolfo D. Granata (warlock_mza) <warlock.cc@gmail.com>
291-Sam Spilsbury (smspillaz) <smspillaz@gmail.com>
292-
293-Modifications by
294-
295-enigma_0Z <enigma.0ZA@gmail.com>
296
297=== removed file 'plugins/freewins/CMakeLists.txt'
298--- plugins/freewins/CMakeLists.txt 2012-07-22 08:50:52 +0000
299+++ plugins/freewins/CMakeLists.txt 1970-01-01 00:00:00 +0000
300@@ -1,8 +0,0 @@
301-find_package (Compiz REQUIRED)
302-
303-include (CompizPlugin)
304-include (FindOpenGL)
305-
306-if (OPENGL_GLU_FOUND)
307-compiz_plugin (freewins PLUGINDEPS composite opengl PKGDEPS cairo-xlib cairo LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR} LDFLAGSADD)
308-endif (OPENGL_GLU_FOUND)
309
310=== removed file 'plugins/freewins/COPYING'
311--- plugins/freewins/COPYING 2012-07-22 08:50:52 +0000
312+++ plugins/freewins/COPYING 1970-01-01 00:00:00 +0000
313@@ -1,340 +0,0 @@
314- GNU GENERAL PUBLIC LICENSE
315- Version 2, June 1991
316-
317- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
318- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
319- Everyone is permitted to copy and distribute verbatim copies
320- of this license document, but changing it is not allowed.
321-
322- Preamble
323-
324- The licenses for most software are designed to take away your
325-freedom to share and change it. By contrast, the GNU General Public
326-License is intended to guarantee your freedom to share and change free
327-software--to make sure the software is free for all its users. This
328-General Public License applies to most of the Free Software
329-Foundation's software and to any other program whose authors commit to
330-using it. (Some other Free Software Foundation software is covered by
331-the GNU Library General Public License instead.) You can apply it to
332-your programs, too.
333-
334- When we speak of free software, we are referring to freedom, not
335-price. Our General Public Licenses are designed to make sure that you
336-have the freedom to distribute copies of free software (and charge for
337-this service if you wish), that you receive source code or can get it
338-if you want it, that you can change the software or use pieces of it
339-in new free programs; and that you know you can do these things.
340-
341- To protect your rights, we need to make restrictions that forbid
342-anyone to deny you these rights or to ask you to surrender the rights.
343-These restrictions translate to certain responsibilities for you if you
344-distribute copies of the software, or if you modify it.
345-
346- For example, if you distribute copies of such a program, whether
347-gratis or for a fee, you must give the recipients all the rights that
348-you have. You must make sure that they, too, receive or can get the
349-source code. And you must show them these terms so they know their
350-rights.
351-
352- We protect your rights with two steps: (1) copyright the software, and
353-(2) offer you this license which gives you legal permission to copy,
354-distribute and/or modify the software.
355-
356- Also, for each author's protection and ours, we want to make certain
357-that everyone understands that there is no warranty for this free
358-software. If the software is modified by someone else and passed on, we
359-want its recipients to know that what they have is not the original, so
360-that any problems introduced by others will not reflect on the original
361-authors' reputations.
362-
363- Finally, any free program is threatened constantly by software
364-patents. We wish to avoid the danger that redistributors of a free
365-program will individually obtain patent licenses, in effect making the
366-program proprietary. To prevent this, we have made it clear that any
367-patent must be licensed for everyone's free use or not licensed at all.
368-
369- The precise terms and conditions for copying, distribution and
370-modification follow.
371-
372- GNU GENERAL PUBLIC LICENSE
373- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
374-
375- 0. This License applies to any program or other work which contains
376-a notice placed by the copyright holder saying it may be distributed
377-under the terms of this General Public License. The "Program", below,
378-refers to any such program or work, and a "work based on the Program"
379-means either the Program or any derivative work under copyright law:
380-that is to say, a work containing the Program or a portion of it,
381-either verbatim or with modifications and/or translated into another
382-language. (Hereinafter, translation is included without limitation in
383-the term "modification".) Each licensee is addressed as "you".
384-
385-Activities other than copying, distribution and modification are not
386-covered by this License; they are outside its scope. The act of
387-running the Program is not restricted, and the output from the Program
388-is covered only if its contents constitute a work based on the
389-Program (independent of having been made by running the Program).
390-Whether that is true depends on what the Program does.
391-
392- 1. You may copy and distribute verbatim copies of the Program's
393-source code as you receive it, in any medium, provided that you
394-conspicuously and appropriately publish on each copy an appropriate
395-copyright notice and disclaimer of warranty; keep intact all the
396-notices that refer to this License and to the absence of any warranty;
397-and give any other recipients of the Program a copy of this License
398-along with the Program.
399-
400-You may charge a fee for the physical act of transferring a copy, and
401-you may at your option offer warranty protection in exchange for a fee.
402-
403- 2. You may modify your copy or copies of the Program or any portion
404-of it, thus forming a work based on the Program, and copy and
405-distribute such modifications or work under the terms of Section 1
406-above, provided that you also meet all of these conditions:
407-
408- a) You must cause the modified files to carry prominent notices
409- stating that you changed the files and the date of any change.
410-
411- b) You must cause any work that you distribute or publish, that in
412- whole or in part contains or is derived from the Program or any
413- part thereof, to be licensed as a whole at no charge to all third
414- parties under the terms of this License.
415-
416- c) If the modified program normally reads commands interactively
417- when run, you must cause it, when started running for such
418- interactive use in the most ordinary way, to print or display an
419- announcement including an appropriate copyright notice and a
420- notice that there is no warranty (or else, saying that you provide
421- a warranty) and that users may redistribute the program under
422- these conditions, and telling the user how to view a copy of this
423- License. (Exception: if the Program itself is interactive but
424- does not normally print such an announcement, your work based on
425- the Program is not required to print an announcement.)
426-
427
428-These requirements apply to the modified work as a whole. If
429-identifiable sections of that work are not derived from the Program,
430-and can be reasonably considered independent and separate works in
431-themselves, then this License, and its terms, do not apply to those
432-sections when you distribute them as separate works. But when you
433-distribute the same sections as part of a whole which is a work based
434-on the Program, the distribution of the whole must be on the terms of
435-this License, whose permissions for other licensees extend to the
436-entire whole, and thus to each and every part regardless of who wrote it.
437-
438-Thus, it is not the intent of this section to claim rights or contest
439-your rights to work written entirely by you; rather, the intent is to
440-exercise the right to control the distribution of derivative or
441-collective works based on the Program.
442-
443-In addition, mere aggregation of another work not based on the Program
444-with the Program (or with a work based on the Program) on a volume of
445-a storage or distribution medium does not bring the other work under
446-the scope of this License.
447-
448- 3. You may copy and distribute the Program (or a work based on it,
449-under Section 2) in object code or executable form under the terms of
450-Sections 1 and 2 above provided that you also do one of the following:
451-
452- a) Accompany it with the complete corresponding machine-readable
453- source code, which must be distributed under the terms of Sections
454- 1 and 2 above on a medium customarily used for software interchange; or,
455-
456- b) Accompany it with a written offer, valid for at least three
457- years, to give any third party, for a charge no more than your
458- cost of physically performing source distribution, a complete
459- machine-readable copy of the corresponding source code, to be
460- distributed under the terms of Sections 1 and 2 above on a medium
461- customarily used for software interchange; or,
462-
463- c) Accompany it with the information you received as to the offer
464- to distribute corresponding source code. (This alternative is
465- allowed only for noncommercial distribution and only if you
466- received the program in object code or executable form with such
467- an offer, in accord with Subsection b above.)
468-
469-The source code for a work means the preferred form of the work for
470-making modifications to it. For an executable work, complete source
471-code means all the source code for all modules it contains, plus any
472-associated interface definition files, plus the scripts used to
473-control compilation and installation of the executable. However, as a
474-special exception, the source code distributed need not include
475-anything that is normally distributed (in either source or binary
476-form) with the major components (compiler, kernel, and so on) of the
477-operating system on which the executable runs, unless that component
478-itself accompanies the executable.
479-
480-If distribution of executable or object code is made by offering
481-access to copy from a designated place, then offering equivalent
482-access to copy the source code from the same place counts as
483-distribution of the source code, even though third parties are not
484-compelled to copy the source along with the object code.
485-
486
487- 4. You may not copy, modify, sublicense, or distribute the Program
488-except as expressly provided under this License. Any attempt
489-otherwise to copy, modify, sublicense or distribute the Program is
490-void, and will automatically terminate your rights under this License.
491-However, parties who have received copies, or rights, from you under
492-this License will not have their licenses terminated so long as such
493-parties remain in full compliance.
494-
495- 5. You are not required to accept this License, since you have not
496-signed it. However, nothing else grants you permission to modify or
497-distribute the Program or its derivative works. These actions are
498-prohibited by law if you do not accept this License. Therefore, by
499-modifying or distributing the Program (or any work based on the
500-Program), you indicate your acceptance of this License to do so, and
501-all its terms and conditions for copying, distributing or modifying
502-the Program or works based on it.
503-
504- 6. Each time you redistribute the Program (or any work based on the
505-Program), the recipient automatically receives a license from the
506-original licensor to copy, distribute or modify the Program subject to
507-these terms and conditions. You may not impose any further
508-restrictions on the recipients' exercise of the rights granted herein.
509-You are not responsible for enforcing compliance by third parties to
510-this License.
511-
512- 7. If, as a consequence of a court judgment or allegation of patent
513-infringement or for any other reason (not limited to patent issues),
514-conditions are imposed on you (whether by court order, agreement or
515-otherwise) that contradict the conditions of this License, they do not
516-excuse you from the conditions of this License. If you cannot
517-distribute so as to satisfy simultaneously your obligations under this
518-License and any other pertinent obligations, then as a consequence you
519-may not distribute the Program at all. For example, if a patent
520-license would not permit royalty-free redistribution of the Program by
521-all those who receive copies directly or indirectly through you, then
522-the only way you could satisfy both it and this License would be to
523-refrain entirely from distribution of the Program.
524-
525-If any portion of this section is held invalid or unenforceable under
526-any particular circumstance, the balance of the section is intended to
527-apply and the section as a whole is intended to apply in other
528-circumstances.
529-
530-It is not the purpose of this section to induce you to infringe any
531-patents or other property right claims or to contest validity of any
532-such claims; this section has the sole purpose of protecting the
533-integrity of the free software distribution system, which is
534-implemented by public license practices. Many people have made
535-generous contributions to the wide range of software distributed
536-through that system in reliance on consistent application of that
537-system; it is up to the author/donor to decide if he or she is willing
538-to distribute software through any other system and a licensee cannot
539-impose that choice.
540-
541-This section is intended to make thoroughly clear what is believed to
542-be a consequence of the rest of this License.
543-
544
545- 8. If the distribution and/or use of the Program is restricted in
546-certain countries either by patents or by copyrighted interfaces, the
547-original copyright holder who places the Program under this License
548-may add an explicit geographical distribution limitation excluding
549-those countries, so that distribution is permitted only in or among
550-countries not thus excluded. In such case, this License incorporates
551-the limitation as if written in the body of this License.
552-
553- 9. The Free Software Foundation may publish revised and/or new versions
554-of the General Public License from time to time. Such new versions will
555-be similar in spirit to the present version, but may differ in detail to
556-address new problems or concerns.
557-
558-Each version is given a distinguishing version number. If the Program
559-specifies a version number of this License which applies to it and "any
560-later version", you have the option of following the terms and conditions
561-either of that version or of any later version published by the Free
562-Software Foundation. If the Program does not specify a version number of
563-this License, you may choose any version ever published by the Free Software
564-Foundation.
565-
566- 10. If you wish to incorporate parts of the Program into other free
567-programs whose distribution conditions are different, write to the author
568-to ask for permission. For software which is copyrighted by the Free
569-Software Foundation, write to the Free Software Foundation; we sometimes
570-make exceptions for this. Our decision will be guided by the two goals
571-of preserving the free status of all derivatives of our free software and
572-of promoting the sharing and reuse of software generally.
573-
574- NO WARRANTY
575-
576- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
577-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
578-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
579-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
580-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
581-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
582-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
583-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
584-REPAIR OR CORRECTION.
585-
586- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
587-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
588-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
589-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
590-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
591-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
592-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
593-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
594-POSSIBILITY OF SUCH DAMAGES.
595-
596- END OF TERMS AND CONDITIONS
597-
598
599- How to Apply These Terms to Your New Programs
600-
601- If you develop a new program, and you want it to be of the greatest
602-possible use to the public, the best way to achieve this is to make it
603-free software which everyone can redistribute and change under these terms.
604-
605- To do so, attach the following notices to the program. It is safest
606-to attach them to the start of each source file to most effectively
607-convey the exclusion of warranty; and each file should have at least
608-the "copyright" line and a pointer to where the full notice is found.
609-
610- <one line to give the program's name and a brief idea of what it does.>
611- Copyright (C) <year> <name of author>
612-
613- This program is free software; you can redistribute it and/or modify
614- it under the terms of the GNU General Public License as published by
615- the Free Software Foundation; either version 2 of the License, or
616- (at your option) any later version.
617-
618- This program is distributed in the hope that it will be useful,
619- but WITHOUT ANY WARRANTY; without even the implied warranty of
620- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
621- GNU General Public License for more details.
622-
623- You should have received a copy of the GNU General Public License
624- along with this program; if not, write to the Free Software
625- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
626-
627-
628-Also add information on how to contact you by electronic and paper mail.
629-
630-If the program is interactive, make it output a short notice like this
631-when it starts in an interactive mode:
632-
633- Gnomovision version 69, Copyright (C) year name of author
634- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
635- This is free software, and you are welcome to redistribute it
636- under certain conditions; type `show c' for details.
637-
638-The hypothetical commands `show w' and `show c' should show the appropriate
639-parts of the General Public License. Of course, the commands you use may
640-be called something other than `show w' and `show c'; they could even be
641-mouse-clicks or menu items--whatever suits your program.
642-
643-You should also get your employer (if you work as a programmer) or your
644-school, if any, to sign a "copyright disclaimer" for the program, if
645-necessary. Here is a sample; alter the names:
646-
647- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
648- `Gnomovision' (which makes passes at compilers) written by James Hacker.
649-
650- <signature of Ty Coon>, 1 April 1989
651- Ty Coon, President of Vice
652-
653-This General Public License does not permit incorporating your program into
654-proprietary programs. If your program is a subroutine library, you may
655-consider it more useful to permit linking proprietary applications with the
656-library. If this is what you want to do, use the GNU Library General
657-Public License instead of this License.
658
659=== removed file 'plugins/freewins/freewins.xml.in'
660--- plugins/freewins/freewins.xml.in 2013-02-20 11:06:38 +0000
661+++ plugins/freewins/freewins.xml.in 1970-01-01 00:00:00 +0000
662@@ -1,398 +0,0 @@
663-<?xml version="1.0" encoding="UTF-8"?>
664-<compiz>
665- <plugin name="freewins" useBcop="true">
666- <_short>Freely Transformable Windows</_short>
667- <_long>Freely transform windows</_long>
668- <category>Effects</category>
669- <deps>
670- <requirement>
671- <plugin>opengl</plugin>
672- </requirement>
673- <relation type="after">
674- <plugin>opengl</plugin>
675- <plugin>scale</plugin>
676- <plugin>ring</plugin>
677- <plugin>shift</plugin>
678- <plugin>shelf</plugin>
679- <plugin>group</plugin>
680- <plugin>wobbly</plugin>
681- <plugin>animation</plugin>
682- <plugin>water</plugin>
683- <plugin>cubeaddon</plugin>
684- <plugin>3d</plugin>
685- </relation>
686- </deps>
687- <options>
688- <option name='rotate' type='action'/>
689- <option name='increment_rotate' type='action'/>
690- <option name='scale' type='action'/>
691- <group>
692- <_short>Free Transformation</_short>
693- <option type="button" name="initiate_rotation_button">
694- <_short>Initiate Rotation Button</_short>
695- <_long>Mouse button to start free rotation.</_long>
696- <default>&lt;Control&gt;&lt;Shift&gt;Button1</default>
697- </option>
698- <option type="button" name="initiate_scale_button">
699- <_short>Initiate Scaling Button</_short>
700- <_long>Mouse button to start free scaling.</_long>
701- <default>&lt;Control&gt;&lt;Shift&gt;Button3</default>
702- </option>
703- <option type="button" name="reset_button">
704- <_short>Reset Transformation Button</_short>
705- <_long>Mouse button to reset the transformation.</_long>
706- <default>&lt;Control&gt;&lt;Shift&gt;Button2</default>
707- </option>
708- <option type="key" name="reset_key">
709- <_short>Reset Transformation Key</_short>
710- <_long>Keyboard shortcut to reset the transformation.</_long>
711- <default>&lt;Control&gt;&lt;Shift&gt;r</default>
712- </option>
713- <option type="key" name="toggle_axis_key">
714- <_short>Axis Help Toggle</_short>
715- <_long>Keyboard shortcut to toggle the visibility of the axis selection helper.</_long>
716- <default>&lt;Control&gt;&lt;Shift&gt;h</default>
717- </option>
718- <subgroup>
719- <_short>Transformation Behaviour</_short>
720- <option name="snap_mods" type="list">
721- <_short>Snap Modifier</_short>
722- <_long>Use these bindings to enable/disable snapping.</_long>
723- <type>int</type>
724- <min>0</min>
725- <max>3</max>
726- <desc>
727- <value>0</value>
728- <_name>Shift</_name>
729- </desc>
730- <desc>
731- <value>1</value>
732- <_name>Alt</_name>
733- </desc>
734- <desc>
735- <value>2</value>
736- <_name>Control</_name>
737- </desc>
738- <desc>
739- <value>3</value>
740- <_name>Meta</_name>
741- </desc>
742- </option>
743- </subgroup>
744- <subgroup>
745- <_short>Rotation</_short>
746- <option name="invert_mods" type="list">
747- <_short>Invert Modifier</_short>
748- <_long>Use these bindings to invert the rotation mode.</_long>
749- <type>int</type>
750- <min>0</min>
751- <max>3</max>
752- <desc>
753- <value>0</value>
754- <_name>Shift</_name>
755- </desc>
756- <desc>
757- <value>1</value>
758- <_name>Alt</_name>
759- </desc>
760- <desc>
761- <value>2</value>
762- <_name>Control</_name>
763- </desc>
764- <desc>
765- <value>3</value>
766- <_name>Meta</_name>
767- </desc>
768- </option>
769- </subgroup>
770- </group>
771- <group>
772- <_short>Manual Transformation</_short>
773- <subgroup>
774- <_short>Scaling</_short>
775- <option type="button" name="scale_up_button">
776- <_short>Scale Up Button</_short>
777- <_long>Mouse button to scale the window up by one increment.</_long>
778- <default>&lt;Control&gt;&lt;Shift&gt;Button4</default>
779- </option>
780- <option type="button" name="scale_down_button">
781- <_short>Scale Down Button</_short>
782- <_long>Mouse button to scale the window down by one increment.</_long>
783- <default>&lt;Control&gt;&lt;Shift&gt;Button5</default>
784- </option>
785- <_short>Scaling</_short>
786- <option type="key" name="scale_up_key">
787- <_short>Scale Up Key</_short>
788- <_long>Keyboard shortcut to scale the window up by one increment.</_long>
789- <default>&lt;Control&gt;&lt;Shift&gt;Page_Up</default>
790- </option>
791- <option type="key" name="scale_down_key">
792- <_short>Scale Down Key</_short>
793- <_long>Keyboard shortcut to scale the window down by one increment.</_long>
794- <default>&lt;Control&gt;&lt;Shift&gt;Page_Down</default>
795- </option>
796- </subgroup>
797- <subgroup>
798- <_short>Rotation</_short>
799- <option type="key" name="rotate_up_key">
800- <_short>Rotate Up Key</_short>
801- <_long>Keyboard shortcut to rotate the window up by one increment.</_long>
802- <default>&lt;Control&gt;&lt;Shift&gt;w</default>
803- </option>
804- <option type="key" name="rotate_down_key">
805- <_short>Rotate Down Key</_short>
806- <_long>Keyboard shortcut to rotate the window down by one increment.</_long>
807- <default>&lt;Control&gt;&lt;Shift&gt;s</default>
808- </option>
809- <option type="key" name="rotate_left_key">
810- <_short>Rotate Left Key</_short>
811- <_long>Keyboard shortcut to rotate the window left by one increment.</_long>
812- <default>&lt;Control&gt;&lt;Shift&gt;d</default>
813- </option>
814- <option type="key" name="rotate_right_key">
815- <_short>Rotate Right Key</_short>
816- <_long>Keyboard shortcut to rotate the window right by one increment.</_long>
817- <default>&lt;Control&gt;&lt;Shift&gt;a</default>
818- </option>
819- <option type="key" name="rotate_c_key">
820- <_short>Rotate Clockwise Key</_short>
821- <_long>Keyboard shortcut to rotate the window clockwise by one increment.</_long>
822- <default>&lt;Control&gt;&lt;Shift&gt;e</default>
823- </option>
824- <option type="key" name="rotate_cc_key">
825- <_short>Rotate Counter-Clockwise Key</_short>
826- <_long>Keyboard shortcut to rotate the window counter-clockwise by one increment.</_long>
827- <default>&lt;Control&gt;&lt;Shift&gt;q</default>
828- </option>
829- </subgroup>
830- </group>
831- <group>
832- <_short>Free Transformation</_short>
833- <subgroup>
834- <_short>Transformation Behaviour</_short>
835- <option type="bool" name="snap">
836- <_short>Snap By Default</_short>
837- <_long>Snap to common points by default.</_long>
838- <default>False</default>
839- </option>
840- <option type="int" name="snap_threshold">
841- <_short>Snap Threshold</_short>
842- <_long>Snap to every one of these angles.</_long>
843- <min>1</min>
844- <max>100</max>
845- </option>
846- <option type="float" name="mouse_sensitivity">
847- <_short>Mouse Sensitivity</_short>
848- <_long>Adjust how sensitive the mouse movement should be.</_long>
849- <default>1.0</default>
850- <min>0.1</min>
851- <max>10.0</max>
852- </option>
853- </subgroup>
854- <subgroup>
855- <_short>Scaling</_short>
856- <option type="int" name="scale_mode">
857- <_short>Scale Mode</_short>
858- <_long>Select the method to scale windows.</_long>
859- <desc>
860- <value>0</value><name>To Centre</name>
861- </desc>
862- <desc>
863- <value>1</value><name>To Opposite Corner</name>
864- </desc>
865- <min>0</min>
866- <max>0</max>
867- <default>0</default>
868- </option>
869- <option type="bool" name="allow_negative">
870- <_short>Allow Negative</_short>
871- <_long>Allow negative scaling</_long>
872- <default>True</default>
873- </option>
874- <option type="bool" name="scale_uniform">
875- <_short>Maintain Aspect Ratio</_short>
876- <_long>Keep the aspect ratio of the window constant when scaling.</_long>
877- <default>True</default>
878- </option>
879- <option type="float" name="min_scale">
880- <_short>Minimum scale</_short>
881- <_long>How small the scale is allowed to be when 'Allow Negative' is not activated.</_long>
882- <default>0.1</default>
883- <min>0.01</min>
884- <max>1.0</max>
885- </option>
886- </subgroup>
887- <subgroup>
888- <_short>Rotation</_short>
889- <option type="int" name="z_axis_rotation">
890- <_short>Rotation Type</_short>
891- <_long>Choose the type of the rotation.</_long>
892- <desc>
893- <value>0</value><name>Always 2D</name>
894- </desc>
895- <desc>
896- <value>1</value><name>Always 3D</name>
897- </desc>
898- <desc>
899- <value>2</value><name>Determine On Click</name>
900- </desc>
901- <desc>
902- <value>3</value><name>Interchangeable</name>
903- </desc>
904- <desc>
905- <value>4</value><name>Switch</name>
906- </desc>
907- <desc>
908- <value>5</value><name>Trackball</name>
909- </desc>
910- <default>2</default>
911- <min>0</min><max>3</max>
912- </option>
913- <option type="int" name="rotation_axis">
914- <_short>Rotation Axis</_short>
915- <_long>How Freely Transformable Windows should determine the rotation axis.</_long>
916- <desc>
917- <value>0</value><name>Always Centre</name>
918- </desc>
919- <desc>
920- <value>1</value><name>Click Point</name>
921- </desc>
922- <desc>
923- <value>2</value><name>Opposite to Click</name>
924- </desc>
925- <desc>
926- <value>3</value><name>Nearest Corner</name>
927- </desc>
928- <min>0</min>
929- <max>2</max>
930- <default>0</default>
931- </option>
932- <option type="float" name="TD_percent">
933- <_short>3D Rotation Percentage</_short>
934- <_long>The percentage of the window area used for 3D rotation.</_long>
935- <default>35.0</default>
936- <min>10.0</min>
937- <max>90.0</max>
938- </option>
939- <option type="bool" name="auto_zoom">
940- <_short>Auto-Zoom</_short>
941- <_long>Auto-Zoom when rotating so that windows do not get too large.</_long>
942- <default>False</default>
943- </option>
944- <option type="bool" name="disable_on_transformed_screen">
945- <_short>Disable On Transformed Screen</_short>
946- <_long>Disable the rotation on a transformed screen. This prevents ugly looking clipped windows when the screen is transformed.</_long>
947- <default>False</default>
948- </option>
949- </subgroup>
950- <subgroup>
951- <_short>Transformation Behaviour</_short>
952- <option type="float" name="speed">
953- <_short>Window Rotation Speed</_short>
954- <_long>How fast the window should rotate.</_long>
955- <default>5.0</default>
956- <min>0.1</min>
957- <max>15.0</max>
958- </option>
959- </subgroup>
960- </group>
961- <group>
962- <_short>Manual Transformation</_short>
963- <subgroup>
964- <_short>Rotation</_short>
965- <option type="float" name="rotate_increment_amount">
966- <_short>Rotate Increment Amount</_short>
967- <_long>How far to rotate a window when rotating by an 'increment'.</_long>
968- <default>10.0</default>
969- <min>1.0</min>
970- <max>100.0</max>
971- </option>
972- </subgroup>
973- <subgroup>
974- <_short>Scaling</_short>
975- <option type="float" name="scale_increment_amount">
976- <_short>Scale Increment Amount</_short>
977- <_long>How much to scale a window by when scaling by an 'increment'.</_long>
978- <default>0.3</default>
979- <min>0.01</min>
980- <max>0.5</max>
981- </option>
982- </subgroup>
983- </group>
984- <group>
985- <_short>Misc</_short>
986- <subgroup>
987- <_short>Input Prevention</_short>
988- <option name="shape_window_types" type="match">
989- <_short>Prevented Input Window Types</_short>
990- <_long>Window types that should be shaped. Disable problematic windows here.</_long>
991- <default>(Toolbar | Utility | Dialog | ModalDialog | Normal)</default>
992- </option>
993- <option type="bool" name="do_shape_input">
994- <_short>Prevent Input</_short>
995- <_long>Prevent input for transformed windows.</_long>
996- <default>True</default>
997- </option>
998- <option type="bool" name="immediate_moves">
999- <_short>Immediate Moves</_short>
1000- <_long>Don't allow plugins like wobbly to manipulate the transformed window while it's being moved.</_long>
1001- <default>True</default>
1002- </option>
1003- </subgroup>
1004- <subgroup>
1005- <_short>Helper Options</_short>
1006- <option type="color" name="circle_color" >
1007- <_short>Helper Circle Color</_short>
1008- <_long>Color and opacity of the circle.</_long>
1009- <default>
1010- <red>0x5400</red>
1011- <green>0xBE00</green>
1012- <blue>0xFB00</blue>
1013- <alpha>0x8000</alpha>
1014- </default>
1015- </option>
1016- <option type="color" name="line_color" >
1017- <_short>Helper Line Color</_short>
1018- <_long>Color and opacity of the helper line around the circle.</_long>
1019- <default>
1020- <red>0x1800</red>
1021- <green>0x0000</green>
1022- <blue>0xFF00</blue>
1023- <alpha>0xFFFF</alpha>
1024- </default>
1025- </option>
1026- <option type="color" name="cross_line_color" >
1027- <_short>Helper Cross Line Color</_short>
1028- <_long>Color and opacity of the cross lines.</_long>
1029- <default>
1030- <red>0x1800</red>
1031- <green>0x0000</green>
1032- <blue>0xFF00</blue>
1033- <alpha>0xFFFF</alpha>
1034- </default>
1035- </option>
1036- <option type="bool" name="show_circle">
1037- <_short>Show 3D Rotation Circle</_short>
1038- <_long>Show the click area for 3D rotation.</_long>
1039- <default>True</default>
1040- </option>
1041- <option type="bool" name="show_gizmo">
1042- <_short>Show Rotation Gizmo</_short>
1043- <_long>Show the rotation axis info.</_long>
1044- <default>True</default>
1045- </option>
1046- <option type="bool" name="show_cross">
1047- <_short>Show Crosshair</_short>
1048- <_long>Show the crosshair for scaling click regions.</_long>
1049- <default>True</default>
1050- </option>
1051- <option type="bool" name="show_region">
1052- <_short>Show Input Regions</_short>
1053- <_long>Show the input region rectangle.</_long>
1054- <default>True</default>
1055- </option>
1056- </subgroup>
1057- </group>
1058- </options>
1059- </plugin>
1060-</compiz>
1061
1062=== removed directory 'plugins/freewins/src'
1063=== removed file 'plugins/freewins/src/action.cpp'
1064--- plugins/freewins/src/action.cpp 2013-03-26 22:02:39 +0000
1065+++ plugins/freewins/src/action.cpp 1970-01-01 00:00:00 +0000
1066@@ -1,761 +0,0 @@
1067-/**
1068- * Compiz Fusion Freewins plugin
1069- *
1070- * action.cpp
1071- *
1072- * Copyright (C) 2007 Rodolfo Granata <warlock.cc@gmail.com>
1073- *
1074- * This program is free software; you can redistribute it and/or
1075- * modify it under the terms of the GNU General Public License
1076- * as published by the Free Software Foundation; either version 2
1077- * of the License, or (at your option) any later version.
1078- *
1079- * This program is distributed in the hope that it will be useful,
1080- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1081- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1082- * GNU General Public License for more details.
1083- *
1084- * Author(s):
1085- * Rodolfo Granata <warlock.cc@gmail.com>
1086- * Sam Spilsbury <smspillaz@gmail.com>
1087- *
1088- * Button binding support and Reset added by:
1089- * enigma_0Z <enigma.0ZA@gmail.com>
1090- *
1091- * Most of the input handling here is based on
1092- * the shelf plugin by
1093- * : Kristian Lyngstøl <kristian@bohemians.org>
1094- * : Danny Baumann <maniac@opencompositing.org>
1095- *
1096- * Description:
1097- *
1098- * This plugin allows you to freely transform the texture of a window,
1099- * whether that be rotation or scaling to make better use of screen space
1100- * or just as a toy.
1101- *
1102- * Todo:
1103- * - Fully implement an input redirection system by
1104- * finding an inverse matrix, multiplying by it,
1105- * translating to the actual window co-ords and
1106- * XSendEvent() the co-ords to the actual window.
1107- * - Code could be cleaner
1108- * - Add timestep and speed options to animation
1109- * - Add window hover-over info via paintOutput : i.e
1110- * - Resize borders
1111- * - 'Reset' Button
1112- * - 'Scale' Button
1113- * - 'Rotate' Button
1114- */
1115-
1116-/* TODO: Finish porting stuff to actions */
1117-
1118-#include "freewins.h"
1119-
1120-
1121-/* ------ Actions -------------------------------------------------------*/
1122-
1123-/* Initiate Mouse Rotation */
1124-bool
1125-FWScreen::initiateFWRotate (CompAction *action,
1126- CompAction::State state,
1127- CompOption::Vector options)
1128-{
1129- CompWindow* w;
1130- CompWindow *useW;
1131- Window xid;
1132-
1133- xid = CompOption::getIntOptionNamed (options, "window", 0);
1134-
1135- w = screen->findWindow (xid);
1136- useW = screen->findWindow (xid);
1137-
1138- if (w)
1139- {
1140-
1141- foreach (FWWindowInputInfo *info, mTransformedWindows)
1142- {
1143- if (info->ipw)
1144- if (w->id () == info->ipw)
1145- /* The window we just grabbed was actually
1146- * an IPW, get the real window instead
1147- */
1148- useW = getRealWindow (w);
1149- }
1150-
1151- mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1152-
1153- if (!screen->otherGrabExist ("freewins", 0))
1154- if (!mGrabIndex)
1155- {
1156- mGrabIndex = screen->pushGrab (0, "freewins");
1157- }
1158- }
1159-
1160- if (useW)
1161- {
1162- if (true || optionGetShapeWindowTypes ().evaluate (useW))
1163- {
1164- FREEWINS_WINDOW (useW);
1165-
1166- int x = CompOption::getIntOptionNamed (options, "x",
1167- useW->x () + (useW->width () / 2));
1168- int y = CompOption::getIntOptionNamed (options, "y",
1169- useW->y () + (useW->height () / 2));
1170-
1171- int mods = CompOption::getIntOptionNamed (options, "modifiers", 0);
1172-
1173- mGrabWindow = useW;
1174-
1175- fww->mGrab = grabRotate;
1176-
1177- /* Save current scales and angles */
1178-
1179- fww->mAnimate.oldAngX = fww->mTransform.angX;
1180- fww->mAnimate.oldAngY = fww->mTransform.angY;
1181- fww->mAnimate.oldAngZ = fww->mTransform.angZ;
1182- fww->mAnimate.oldScaleX = fww->mTransform.scaleX;
1183- fww->mAnimate.oldScaleY = fww->mTransform.scaleY;
1184-
1185- if (pointerY > fww->mIMidY)
1186- {
1187- if (pointerX > fww->mIMidX)
1188- fww->mCorner = CornerBottomRight;
1189- else if (pointerX < fww->mIMidX)
1190- fww->mCorner = CornerBottomLeft;
1191- }
1192- else if (pointerY < fww->mIMidY)
1193- {
1194- if (pointerX > fww->mIMidX)
1195- fww->mCorner = CornerTopRight;
1196- else if (pointerX < fww->mIMidX)
1197- fww->mCorner = CornerTopLeft;
1198- }
1199-
1200- switch (optionGetZAxisRotation ())
1201- {
1202- case ZAxisRotationAlways3d:
1203- fww->mCan3D = TRUE;
1204- fww->mCan2D = FALSE;
1205- break;
1206-
1207- case ZAxisRotationAlways2d:
1208- fww->mCan3D = FALSE;
1209- fww->mCan2D = TRUE;
1210- break;
1211-
1212- case ZAxisRotationDetermineOnClick:
1213- case ZAxisRotationSwitch:
1214- fww->determineZAxisClick (pointerX, pointerY, FALSE);
1215- break;
1216-
1217- case ZAxisRotationInterchangeable:
1218- fww->mCan3D = TRUE;
1219- fww->mCan2D = TRUE;
1220- break;
1221-
1222- default:
1223- break;
1224- }
1225-
1226- /* Set the rotation axis */
1227-
1228- switch (optionGetRotationAxis ())
1229- {
1230- case RotationAxisAlwaysCentre:
1231- default:
1232- fww->calculateInputOrigin (WIN_REAL_X (mGrabWindow) +
1233- WIN_REAL_W (mGrabWindow) / 2.0f,
1234- WIN_REAL_Y (mGrabWindow) +
1235- WIN_REAL_H (mGrabWindow) / 2.0f);
1236- fww->calculateOutputOrigin (WIN_OUTPUT_X (mGrabWindow) +
1237- WIN_OUTPUT_W (mGrabWindow) / 2.0f,
1238- WIN_OUTPUT_Y (mGrabWindow) +
1239- WIN_OUTPUT_H (mGrabWindow) / 2.0f);
1240- break;
1241-
1242- case RotationAxisClickPoint:
1243- fww->calculateInputOrigin (mClick_root_x, mClick_root_y);
1244- fww->calculateOutputOrigin (mClick_root_x, mClick_root_y);
1245- break;
1246-
1247- case RotationAxisOppositeToClick:
1248- fww->calculateInputOrigin (useW->x () + useW->width () - mClick_root_x,
1249- useW->y () + useW->height () - mClick_root_y);
1250- fww->calculateOutputOrigin (useW->x () + useW->width () - mClick_root_x,
1251- useW->y () + useW->height () - mClick_root_y);
1252- break;
1253- }
1254-
1255- /* Announce that we grabbed the window */
1256- useW->grabNotify (x, y, mods, CompWindowGrabMoveMask |
1257- CompWindowGrabButtonMask);
1258-
1259- /* Shape the window beforehand and avoid a stale grab */
1260- if (fww->canShape ())
1261- if (fww->handleWindowInputInfo ())
1262- fww->adjustIPW ();
1263-
1264- cScreen->damageScreen ();
1265-
1266- if (state & CompAction::StateInitButton)
1267- action->setState (action->state () | CompAction::StateTermButton);
1268-
1269- }
1270- }
1271- return true;
1272-}
1273-
1274-bool
1275-FWScreen::terminateFWRotate (CompAction *action,
1276- CompAction::State state,
1277- CompOption::Vector options)
1278-{
1279- if (mGrabWindow && mGrabIndex)
1280- {
1281- FREEWINS_WINDOW (mGrabWindow);
1282- if (fww->mGrab == grabRotate)
1283- {
1284- int distX, distY;
1285-
1286- fww->window->ungrabNotify ();
1287-
1288- switch (optionGetRotationAxis ())
1289- {
1290- case RotationAxisClickPoint:
1291- case RotationAxisOppositeToClick:
1292-
1293- distX = (fww->mOutputRect.x1 () +
1294- (fww->mOutputRect.width ()) / 2.0f) -
1295- (WIN_REAL_X (mGrabWindow) +
1296- WIN_REAL_W (mGrabWindow) / 2.0f);
1297- distY = (fww->mOutputRect.y1 () +
1298- (fww->mOutputRect.height ()) / 2.0f) -
1299- (WIN_REAL_Y (mGrabWindow) +
1300- WIN_REAL_H (mGrabWindow) / 2.0f);
1301-
1302- mGrabWindow->move (distX, distY, true);
1303-
1304- fww->calculateInputOrigin (WIN_REAL_X (mGrabWindow) +
1305- WIN_REAL_W (mGrabWindow) / 2.0f,
1306- WIN_REAL_Y (mGrabWindow) +
1307- WIN_REAL_H (mGrabWindow) / 2.0f);
1308- fww->calculateOutputOrigin (WIN_OUTPUT_X (mGrabWindow) +
1309- WIN_OUTPUT_W (mGrabWindow) / 2.0f,
1310- WIN_OUTPUT_Y (mGrabWindow) +
1311- WIN_OUTPUT_H (mGrabWindow) / 2.0f);
1312-
1313- break;
1314- default:
1315- break;
1316- }
1317-
1318- if (fww->canShape ())
1319- if (fww->handleWindowInputInfo ())
1320- fww->adjustIPW ();
1321-
1322- screen->removeGrab (mGrabIndex, 0);
1323- mGrabIndex = 0;
1324- mGrabWindow = NULL;
1325- fww->mGrab = grabNone;
1326- }
1327- }
1328-
1329- action->setState (action->state () & ~(CompAction::StateTermKey |
1330- CompAction::StateTermButton));
1331-
1332- return false;
1333-}
1334-
1335-/*static void FWMoveWindowToCorrectPosition (CompWindow *w, float distX, float distY)
1336-{
1337-
1338- FREEWINS_WINDOW (w); action->setState (action->state () & ~(CompAction::StateTermKey |
1339- CompAction::StateTermButton));
1340-
1341- fprintf(stderr, "distX is %f distY is %f midX and midY are %f %f\n", distX, distY, fww->mIMidX, fww->mIMidY);
1342-
1343- moveWindow (w, distX * (1 + (1 - fww->mTransform.scaleX)), distY * (1 + (1 - fww->mTransform.scaleY)), TRUE, FALSE);
1344-
1345- syncWindowPosition (w);
1346-}*/
1347-
1348-/* Initiate Scaling */
1349-bool
1350-FWScreen::initiateFWScale (CompAction *action,
1351- CompAction::State state,
1352- CompOption::Vector options)
1353-{
1354- CompWindow* w;
1355- CompWindow *useW;
1356- Window xid;
1357-
1358- xid = CompOption::getIntOptionNamed (options, "window", 0);
1359- w = screen->findWindow (xid);
1360- useW = screen->findWindow (xid);
1361-
1362- if (w)
1363- {
1364- foreach (FWWindowInputInfo *info, mTransformedWindows)
1365- {
1366- if (info->ipw)
1367- if (w->id () == info->ipw)
1368- /* The window we just grabbed was actually
1369- * an IPW, get the real window instead
1370- */
1371- useW = getRealWindow (w);
1372- }
1373-
1374- mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1375-
1376- if (!screen->otherGrabExist ("freewins", 0))
1377- if (!mGrabIndex)
1378- mGrabIndex = screen->pushGrab (mRotateCursor, "freewins");
1379- }
1380-
1381- if (useW)
1382- {
1383- if (optionGetShapeWindowTypes ().evaluate (useW))
1384- {
1385- FREEWINS_WINDOW (useW);
1386-
1387- int x = CompOption::getIntOptionNamed (options, "x",
1388- useW->x () + (useW->width () / 2));
1389- int y = CompOption::getIntOptionNamed (options, "y",
1390- useW->y () + (useW->height () / 2));
1391-
1392- int mods = CompOption::getIntOptionNamed (options, "modifiers", 0);
1393-
1394- mGrabWindow = useW;
1395-
1396- /* Find out the corner we clicked in */
1397-
1398- float MidX = fww->mInputRect.centerX ();
1399- float MidY = fww->mInputRect.centerY ();
1400-
1401- /* Check for Y axis clicking (Top / Bottom) */
1402- if (pointerY > MidY)
1403- {
1404- /* Check for X axis clicking (Left / Right) */
1405- if (pointerX > MidX)
1406- fww->mCorner = CornerBottomRight;
1407- else if (pointerX < MidX)
1408- fww->mCorner = CornerBottomLeft;
1409- }
1410- else if (pointerY < MidY)
1411- {
1412- /* Check for X axis clicking (Left / Right) */
1413- if (pointerX > MidX)
1414- fww->mCorner = CornerTopRight;
1415- else if (pointerX < MidX)
1416- fww->mCorner = CornerTopLeft;
1417- }
1418-
1419- switch (optionGetScaleMode ())
1420- {
1421- case ScaleModeToCentre:
1422- fww->calculateInputOrigin(WIN_REAL_X (useW) + WIN_REAL_W (useW) / 2.0f,
1423- WIN_REAL_Y (useW) + WIN_REAL_H (useW) / 2.0f);
1424- fww->calculateOutputOrigin(WIN_OUTPUT_X (useW) + WIN_OUTPUT_W (useW) / 2.0f,
1425- WIN_OUTPUT_Y (useW) + WIN_OUTPUT_H (useW) / 2.0f);
1426- break;
1427- /*
1428- *Experimental scale to corners mode
1429- */
1430- case ScaleModeToOppositeCorner:
1431- switch (fww->mCorner)
1432- {
1433- case CornerBottomRight:
1434- /* Translate origin to the top left of the window */
1435- //FWMoveWindowToCorrectPosition (w, fww->inputRect.x1 - WIN_REAL_X (useW), fww->inputRect.y1 - WIN_REAL_Y (useW));
1436- fww->calculateInputOrigin (WIN_REAL_X (useW), WIN_REAL_Y (useW));
1437- break;
1438-
1439- case CornerBottomLeft:
1440- /* Translate origin to the top right of the window */
1441- //FWMoveWindowToCorrectPosition (w, fww->inputRect.x2 - (WIN_REAL_X (useW) + WIN_REAL_W (useW)), fww->inputRect.y1 - WIN_REAL_Y (useW));
1442- fww->calculateInputOrigin (WIN_REAL_X (useW) + (WIN_REAL_W (useW)), WIN_REAL_Y (useW));
1443- break;
1444-
1445- case CornerTopRight:
1446- /* Translate origin to the bottom left of the window */
1447- //FWMoveWindowToCorrectPosition (w, fww->inputRect.x1 - WIN_REAL_X (useW) , fww->inputRect.y1 - (WIN_REAL_Y (useW) + WIN_REAL_H (useW)));
1448- fww->calculateInputOrigin (WIN_REAL_X (useW), WIN_REAL_Y (useW) + (WIN_REAL_H (useW)));
1449- break;
1450-
1451- case CornerTopLeft:
1452- /* Translate origin to the bottom right of the window */
1453- //FWMoveWindowToCorrectPosition (w, fww->inputRect.x1 -(WIN_REAL_X (useW) + WIN_REAL_W (useW)) , fww->inputRect.y1 - (WIN_REAL_Y (useW) + WIN_REAL_H (useW)));
1454- fww->calculateInputOrigin (WIN_REAL_X (useW) + (WIN_REAL_W (useW)), WIN_REAL_Y (useW) + (WIN_REAL_H (useW)));
1455- break;
1456- }
1457- break;
1458- }
1459-
1460- fww->mGrab = grabScale;
1461-
1462- /* Announce that we grabbed the window */
1463- useW->grabNotify (x, y, mods, CompWindowGrabMoveMask |
1464- CompWindowGrabButtonMask);
1465-
1466- cScreen->damageScreen ();
1467-
1468- /* Shape the window beforehand and avoid a stale grab */
1469- if (fww->canShape ())
1470- if (fww->handleWindowInputInfo ())
1471- fww->adjustIPW ();
1472-
1473-
1474- if (state & CompAction::StateInitButton)
1475- action->setState (action->state () | CompAction::StateTermButton);
1476- }
1477- }
1478-
1479- return TRUE;
1480-}
1481-
1482-bool
1483-FWScreen::terminateFWScale (CompAction *action,
1484- CompAction::State state,
1485- CompOption::Vector options)
1486-{
1487- if (mGrabWindow && mGrabIndex)
1488- {
1489- FREEWINS_WINDOW (mGrabWindow);
1490- if (fww->mGrab == grabScale)
1491- {
1492- fww->window->ungrabNotify ();
1493-
1494- switch (optionGetScaleMode ())
1495- {
1496- int distX, distY;
1497-
1498- case ScaleModeToOppositeCorner:
1499- distX = (fww->mOutputRect.x1 () + (fww->mOutputRect.width () / 2.0f) - (WIN_REAL_X (mGrabWindow) + WIN_REAL_W (mGrabWindow) / 2.0f));
1500- distY = (fww->mOutputRect.y1 () + (fww->mOutputRect.width () / 2.0f) - (WIN_REAL_Y (mGrabWindow) + WIN_REAL_H (mGrabWindow) / 2.0f));
1501-
1502- mGrabWindow->move (distX, distY, true);
1503-
1504- fww->calculateInputOrigin (WIN_REAL_X (mGrabWindow) +
1505- WIN_REAL_W (mGrabWindow) / 2.0f,
1506- WIN_REAL_Y (mGrabWindow) +
1507- WIN_REAL_H (mGrabWindow) / 2.0f);
1508- fww->calculateOutputOrigin (WIN_OUTPUT_X (mGrabWindow) +
1509- WIN_OUTPUT_W (mGrabWindow) / 2.0f,
1510- WIN_OUTPUT_Y (mGrabWindow) +
1511- WIN_OUTPUT_H (mGrabWindow) / 2.0f);
1512-
1513- break;
1514-
1515- default:
1516- break;
1517-
1518- }
1519-
1520- screen->removeGrab (mGrabIndex, 0);
1521- mGrabIndex = 0;
1522- mGrabWindow = NULL;
1523- fww->mGrab = grabNone;
1524- }
1525- }
1526-
1527- action->setState (action->state () & ~(CompAction::StateTermKey |
1528- CompAction::StateTermButton));
1529-
1530- return FALSE;
1531-}
1532-
1533-/* Repetitive Stuff */
1534-
1535-void
1536-FWWindow::setPrepareRotation (float dx,
1537- float dy,
1538- float dz,
1539- float dsu,
1540- float dsd)
1541-{
1542- if (FWScreen::get (screen)->optionGetShapeWindowTypes ().evaluate (window))
1543- {
1544- calculateInputOrigin (WIN_REAL_X (window) +
1545- WIN_REAL_W (window) / 2.0f,
1546- WIN_REAL_Y (window) +
1547- WIN_REAL_H (window) / 2.0f);
1548- calculateOutputOrigin (WIN_OUTPUT_X (window) +
1549- WIN_OUTPUT_W (window) / 2.0f,
1550- WIN_OUTPUT_Y (window) +
1551- WIN_OUTPUT_H (window) / 2.0f);
1552-
1553- mTransform.unsnapAngX += dy;
1554- mTransform.unsnapAngY -= dx;
1555- mTransform.unsnapAngZ += dz;
1556-
1557- mTransform.unsnapScaleX += dsu;
1558- mTransform.unsnapScaleY += dsd;
1559-
1560- mAnimate.oldAngX = mTransform.angX;
1561- mAnimate.oldAngY = mTransform.angY;
1562- mAnimate.oldAngZ = mTransform.angZ;
1563-
1564- mAnimate.oldScaleX = mTransform.scaleX;
1565- mAnimate.oldScaleY = mTransform.scaleY;
1566-
1567- mAnimate.destAngX = mTransform.angX + dy;
1568- mAnimate.destAngY = mTransform.angY - dx;
1569- mAnimate.destAngZ = mTransform.angZ + dz;
1570-
1571- mAnimate.destScaleX = mTransform.scaleX + dsu;
1572- mAnimate.destScaleY = mTransform.scaleY + dsd;
1573-
1574- }
1575-}
1576-
1577-#define ROTATE_INC freewinsGetRotateIncrementAmount (w->screen)
1578-#define NEG_ROTATE_INC freewinsGetRotateIncrementAmount (w->screen) *-1
1579-
1580-#define SCALE_INC freewinsGetScaleIncrementAmount (w->screen)
1581-#define NEG_SCALE_INC freewinsGetScaleIncrementAmount (w->screen) *-1
1582-
1583-bool
1584-FWScreen::rotate (CompAction *action,
1585- CompAction::State state,
1586- CompOption::Vector options, int dx, int dy, int dz)
1587-{
1588- CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
1589- "window",
1590- 0));
1591- foreach (FWWindowInputInfo *info, mTransformedWindows)
1592- {
1593- if (info->ipw == w->id ())
1594- {
1595- w = getRealWindow (w);
1596- }
1597- }
1598-
1599- FREEWINS_WINDOW (w);
1600-
1601- fww->setPrepareRotation (dx, dy, dz, 0, 0);
1602-
1603- if (fww->canShape ())
1604- if (fww->handleWindowInputInfo ())
1605- fww->adjustIPW ();
1606-
1607- return true;
1608-}
1609-
1610-bool
1611-FWScreen::scale (CompAction *action,
1612- CompAction::State state,
1613- CompOption::Vector options,
1614- int scale)
1615-{
1616- CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
1617- "window",
1618- 0));
1619- foreach (FWWindowInputInfo *info, mTransformedWindows)
1620- {
1621- if (info->ipw == w->id ())
1622- {
1623- w = getRealWindow (w);
1624- }
1625- }
1626-
1627- FREEWINS_WINDOW (w);
1628-
1629- fww->setPrepareRotation (0, 0, 0, scale, scale);
1630- fww->cWindow->addDamage ();
1631-
1632- if (fww->canShape ())
1633- if (fww->handleWindowInputInfo ())
1634- fww->adjustIPW ();
1635-
1636- if (!optionGetAllowNegative ())
1637- {
1638- float minScale = optionGetMinScale ();
1639-
1640- if (fww->mAnimate.destScaleX < minScale)
1641- fww->mAnimate.destScaleX = minScale;
1642-
1643- if (fww->mAnimate.destScaleY < minScale)
1644- fww->mAnimate.destScaleY = minScale;
1645- }
1646-
1647- return true;
1648-}
1649-
1650-/* Reset the Rotation and Scale to 0 and 1 */
1651-bool
1652-FWScreen::resetFWTransform (CompAction *action,
1653- CompAction::State state,
1654- CompOption::Vector options)
1655-{
1656- CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
1657- "window",
1658- 0));
1659- foreach (FWWindowInputInfo *info, mTransformedWindows)
1660- {
1661- if (info->ipw == w->id ())
1662- {
1663- w = getRealWindow (w);
1664- }
1665- }
1666-
1667- if (w)
1668- {
1669- FREEWINS_WINDOW (w);
1670- fww->setPrepareRotation (fww->mTransform.angY,
1671- -fww->mTransform.angX,
1672- -fww->mTransform.angZ,
1673- (1 - fww->mTransform.scaleX),
1674- (1 - fww->mTransform.scaleY));
1675- fww->cWindow->addDamage ();
1676-
1677- fww->mTransformed = FALSE;
1678-
1679- if (fww->canShape ())
1680- if (fww->handleWindowInputInfo ())
1681- fww->adjustIPW ();
1682-
1683- fww->mResetting = TRUE;
1684- }
1685-
1686- return TRUE;
1687-}
1688-
1689-/* Callable action to rotate a window to the angle provided
1690- * x: Set angle to x degrees
1691- * y: Set angle to y degrees
1692- * z: Set angle to z degrees
1693- * window: The window to apply the transformation to
1694- */
1695-bool
1696-FWScreen::rotateAction (CompAction *action,
1697- CompAction::State state,
1698- CompOption::Vector options)
1699-{
1700- CompWindow *w;
1701-
1702- w = screen->findWindow (CompOption::getIntOptionNamed (options, "window", 0));
1703-
1704- if (w)
1705- {
1706- FREEWINS_WINDOW (w);
1707-
1708- float x = CompOption::getFloatOptionNamed(options, "x", 0.0f);
1709- float y = CompOption::getFloatOptionNamed(options, "y", 0.0f);
1710- float z = CompOption::getFloatOptionNamed(options, "z", 0.0f);
1711-
1712- fww->setPrepareRotation (x - fww->mAnimate.destAngX,
1713- y - fww->mAnimate.destAngY,
1714- z - fww->mAnimate.destAngZ, 0, 0);
1715- fww->cWindow->addDamage ();
1716-
1717- }
1718- else
1719- {
1720- return false;
1721- }
1722-
1723- return true;
1724-}
1725-
1726-/* Callable action to increment window rotation by the angles provided
1727- * x: Increment angle by x degrees
1728- * y: Increment angle by y degrees
1729- * z: Increment angle by z degrees
1730- * window: The window to apply the transformation to
1731- */
1732-bool
1733-FWScreen::incrementRotateAction (CompAction *action,
1734- CompAction::State state,
1735- CompOption::Vector options)
1736-{
1737- CompWindow *w;
1738-
1739- w = screen->findWindow (CompOption::getIntOptionNamed (options, "window", 0));
1740-
1741- if (w)
1742- {
1743- FREEWINS_WINDOW (w);
1744-
1745- float x = CompOption::getFloatOptionNamed(options, "x", 0.0f);
1746- float y = CompOption::getFloatOptionNamed(options, "y", 0.0f);
1747- float z = CompOption::getFloatOptionNamed(options, "z", 0.0f);
1748-
1749- fww->setPrepareRotation (x,
1750- y,
1751- z, 0, 0);
1752- fww->cWindow->addDamage ();
1753-
1754- }
1755- else
1756- {
1757- return false;
1758- }
1759-
1760- return true;
1761-}
1762-
1763-/* Callable action to scale a window to the scale provided
1764- * x: Set scale to x factor
1765- * y: Set scale to y factor
1766- * window: The window to apply the transformation to
1767- */
1768-bool
1769-FWScreen::scaleAction (CompAction *action,
1770- CompAction::State state,
1771- CompOption::Vector options)
1772-{
1773- CompWindow *w;
1774-
1775- w = screen->findWindow (CompOption::getIntOptionNamed (options, "window", 0));
1776-
1777- if (w)
1778- {
1779- FREEWINS_WINDOW (w);
1780-
1781- float x = CompOption::getFloatOptionNamed (options, "x", 0.0f);
1782- float y = CompOption::getFloatOptionNamed (options, "y", 0.0f);
1783-
1784- fww->setPrepareRotation (0, 0, 0,
1785- x - fww->mAnimate.destScaleX,
1786- y - fww->mAnimate.destScaleY);
1787- if (fww->canShape ())
1788- if (fww->handleWindowInputInfo ())
1789- fww->adjustIPW ();
1790-
1791- /* Stop scale at threshold specified */
1792- if (!optionGetAllowNegative ())
1793- {
1794- float minScale = optionGetMinScale ();
1795- if (fww->mAnimate.destScaleX < minScale)
1796- fww->mAnimate.destScaleX = minScale;
1797-
1798- if (fww->mAnimate.destScaleY < minScale)
1799- fww->mAnimate.destScaleY = minScale;
1800- }
1801-
1802- fww->cWindow->addDamage ();
1803-
1804- if (fww->canShape ())
1805- fww->handleWindowInputInfo ();
1806-
1807- }
1808- else
1809- {
1810- return false;
1811- }
1812-
1813- return true;
1814-}
1815-
1816-/* Toggle Axis-Help Display */
1817-bool
1818-FWScreen::toggleFWAxis (CompAction *action,
1819- CompAction::State state,
1820- CompOption::Vector options)
1821-{
1822- mAxisHelp = !mAxisHelp;
1823-
1824- cScreen->damageScreen ();
1825-
1826- return TRUE;
1827-}
1828
1829=== removed file 'plugins/freewins/src/events.cpp'
1830--- plugins/freewins/src/events.cpp 2013-03-26 22:02:39 +0000
1831+++ plugins/freewins/src/events.cpp 1970-01-01 00:00:00 +0000
1832@@ -1,853 +0,0 @@
1833-/**
1834- * Compiz Fusion Freewins plugin
1835- *
1836- * events.cpp
1837- *
1838- * Copyright (C) 2007 Rodolfo Granata <warlock.cc@gmail.com>
1839- *
1840- * This program is free software; you can redistribute it and/or
1841- * modify it under the terms of the GNU General Public License
1842- * as published by the Free Software Foundation; either version 2
1843- * of the License, or (at your option) any later version.
1844- *
1845- * This program is distributed in the hope that it will be useful,
1846- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1847- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1848- * GNU General Public License for more details.
1849- *
1850- * Author(s):
1851- * Rodolfo Granata <warlock.cc@gmail.com>
1852- * Sam Spilsbury <smspillaz@gmail.com>
1853- *
1854- * Button binding support and Reset added by:
1855- * enigma_0Z <enigma.0ZA@gmail.com>
1856- *
1857- * Most of the input handling here is based on
1858- * the shelf plugin by
1859- * : Kristian Lyngstøl <kristian@bohemians.org>
1860- * : Danny Baumann <maniac@opencompositing.org>
1861- *
1862- * Description:
1863- *
1864- * This plugin allows you to freely transform the texture of a window,
1865- * whether that be rotation or scaling to make better use of screen space
1866- * or just as a toy.
1867- *
1868- * Todo:
1869- * - Fully implement an input redirection system by
1870- * finding an inverse matrix, multiplying by it,
1871- * translating to the actual window co-ords and
1872- * XSendEvent() the co-ords to the actual window.
1873- * - X Input Redirection
1874- * - Code could be cleaner
1875- * - Add timestep and speed options to animation
1876- * - Add window hover-over info via paintOutput : i.e
1877- * - Resize borders
1878- * - 'Reset' Button
1879- * - 'Scale' Button
1880- * - 'Rotate' Button
1881- */
1882-
1883-#include "freewins.h"
1884-
1885-
1886-/* ------ Event Handlers ------------------------------------------------*/
1887-
1888-void
1889-FWWindow::handleIPWResizeInitiate ()
1890-{
1891- FREEWINS_SCREEN (screen);
1892-
1893- window->activate ();
1894- mGrab = grabResize;
1895- fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_plus);
1896- if(!screen->otherGrabExist ("freewins", "resize", 0))
1897- if(!fws->mGrabIndex)
1898- {
1899- unsigned int mods = 0;
1900- mods &= CompNoMask;
1901- fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize");
1902- window->grabNotify (window->x () + (window->width () / 2),
1903- window->y () + (window->height () / 2), mods,
1904- CompWindowGrabMoveMask | CompWindowGrabButtonMask);
1905- fws->mGrabWindow = window;
1906- }
1907-}
1908-
1909-void
1910-FWWindow::handleIPWMoveInitiate ()
1911-{
1912- FREEWINS_SCREEN (screen);
1913-
1914- window->activate ();
1915- mGrab = grabMove;
1916- fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1917- if(!screen->otherGrabExist ("freewins", "resize", 0))
1918- if(!fws->mGrabIndex)
1919- {
1920- unsigned int mods = 0;
1921- mods &= CompNoMask;
1922- fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize");
1923- window->grabNotify (window->x () + (window->width () / 2),
1924- window->y () + (window->height () / 2), mods,
1925- CompWindowGrabResizeMask | CompWindowGrabButtonMask);
1926- fws->mGrabWindow = window;
1927- }
1928-}
1929-
1930-void
1931-FWWindow::handleIPWMoveMotionEvent (unsigned int x,
1932- unsigned int y)
1933-{
1934- FREEWINS_SCREEN (screen);
1935-
1936- int dx = x - lastPointerX;
1937- int dy = y - lastPointerY;
1938-
1939- if (!fws->mGrabIndex)
1940- return;
1941-
1942- window->move (dx, dy, fws->optionGetImmediateMoves ());
1943-
1944-}
1945-
1946-void
1947-FWWindow::handleIPWResizeMotionEvent (unsigned int x,
1948- unsigned int y)
1949-{
1950- int dx = (x - lastPointerX) * 10;
1951- int dy = (y - lastPointerY) * 10;
1952-
1953- mWinH += dy;
1954- mWinW += dx;
1955-
1956- /* In order to prevent a window redraw on resize
1957- * on every motion event we have a threshold
1958- */
1959-
1960- /* FIXME: cf-love: Instead of actually resizing the window, scale it up, then resize it */
1961-
1962- if (mWinH - 10 > window->height () || mWinW - 10 > window->width ())
1963- {
1964- XWindowChanges xwc;
1965- unsigned int mask = CWX | CWY | CWWidth | CWHeight;
1966-
1967- xwc.x = window->serverX ();
1968- xwc.y = window->serverY ();
1969- xwc.width = mWinW;
1970- xwc.height = mWinH;
1971-
1972- if (xwc.width == window->serverWidth ())
1973- mask &= ~CWWidth;
1974-
1975- if (xwc.height == window->serverHeight ())
1976- mask &= ~CWHeight;
1977-
1978- if (window->mapNum () && (mask & (CWWidth | CWHeight)))
1979- window->sendSyncRequest ();
1980-
1981- window->configureXWindow (mask, &xwc);
1982- }
1983-}
1984-
1985-/* Handle Rotation */
1986-void
1987-FWWindow::handleRotateMotionEvent (float dx,
1988- float dy,
1989- int x,
1990- int y)
1991-{
1992- FREEWINS_SCREEN (screen);
1993-
1994- x -= 100;
1995- y -= 100;
1996-
1997- int oldX = lastPointerX - 100;
1998- int oldY = lastPointerY - 100;
1999-
2000- float midX = WIN_REAL_X (window) + WIN_REAL_W (window)/2.0;
2001- float midY = WIN_REAL_Y (window) + WIN_REAL_H (window)/2.0;
2002-
2003- float angX;
2004- float angY;
2005- float angZ;
2006-
2007- /* Save the current angles so we can work with them */
2008- if (fws->optionGetSnap () || fws->mSnap)
2009- {
2010- angX = mTransform.unsnapAngX;
2011- angY = mTransform.unsnapAngY;
2012- angZ = mTransform.unsnapAngZ;
2013- }
2014- else
2015- {
2016- angX = mAnimate.destAngX;
2017- angY = mAnimate.destAngY;
2018- angZ = mAnimate.destAngZ;
2019- }
2020-
2021- /* Check for Y axis clicking (Top / Bottom) */
2022- if (pointerY > midY)
2023- {
2024- /* Check for X axis clicking (Left / Right) */
2025- if (pointerX > midX)
2026- mCorner = CornerBottomRight;
2027- else if (pointerX < midX)
2028- mCorner = CornerBottomLeft;
2029- }
2030- else if (pointerY < midY)
2031- {
2032- /* Check for X axis clicking (Left / Right) */
2033- if (pointerX > midX)
2034- mCorner = CornerTopRight;
2035- else if (pointerX < midX)
2036- mCorner = CornerTopLeft;
2037- }
2038-
2039- float percentFromXAxis = 0.0, percentFromYAxis = 0.0;
2040-
2041- if (fws->optionGetZAxisRotation () == FreewinsOptions::ZAxisRotationInterchangeable)
2042- {
2043-
2044- /* Trackball rotation was too hard to implement. If anyone can implement it,
2045- * please come forward so I can replace this hacky solution to the problem.
2046- * Anyways, what happens here, is that we determine how far away we are from
2047- * each axis (y and x). The further we are away from the y axis, the more
2048- * up / down movements become Z axis movements and the further we are away from
2049- * the x-axis, the more left / right movements become z rotations. */
2050-
2051- /* We determine this by taking a percentage of how far away the cursor is from
2052- * each axis. We divide the 3D rotation by this percentage ( and divide by the
2053- * percentage squared in order to ensure that rotation is not too violent when we
2054- * are quite close to the origin. We multiply the 2D rotation by this percentage also
2055- * so we are essentially rotating in 3D and 2D all the time, but this is only really
2056- * noticeable when you move the cursor over to the extremes of a window. In every case
2057- * percentage can be defined as decimal-percentage (i.e 0.036 == 3.6%). Like I mentioned
2058- * earlier, if you can replace this with trackball rotation, please come forward! */
2059-
2060- float halfWidth = WIN_REAL_W (window) / 2.0f;
2061- float halfHeight = WIN_REAL_H (window) / 2.0f;
2062-
2063- float distFromXAxis = fabs (mIMidX - pointerX);
2064- float distFromYAxis = fabs (mIMidY - pointerY);
2065-
2066- percentFromXAxis = distFromXAxis / halfWidth;
2067- percentFromYAxis = distFromYAxis / halfHeight;
2068-
2069- }
2070- else if (fws->optionGetZAxisRotation () == FreewinsOptions::ZAxisRotationSwitch)
2071- determineZAxisClick (pointerX, pointerY, TRUE);
2072-
2073- dx *= 360;
2074- dy *= 360;
2075-
2076- /* Handle inversion */
2077-
2078- bool can2D = mCan2D, can3D = mCan3D;
2079-
2080- if (fws->mInvert && fws->optionGetZAxisRotation () != FreewinsOptions::ZAxisRotationInterchangeable)
2081- {
2082- can2D = !mCan2D;
2083- can3D = !mCan3D;
2084- }
2085-
2086- if(can2D)
2087- {
2088-
2089- float zX = 1.0f;
2090- float zY = 1.0f;
2091-
2092- if (fws->optionGetZAxisRotation () == FreewinsOptions::ZAxisRotationInterchangeable)
2093- {
2094- zX = percentFromXAxis;
2095- zY = percentFromYAxis;
2096- }
2097-
2098- zX = zX > 1.0f ? 1.0f : zX;
2099- zY = zY > 1.0f ? 1.0f : zY;
2100-
2101- switch (mCorner)
2102- {
2103- case CornerTopRight:
2104-
2105- if (x < oldX)
2106- angZ -= dx * zX;
2107- else if (x > oldX)
2108- angZ += dx * zX;
2109-
2110- if (y < oldY)
2111- angZ -= dy * zY;
2112- else if (y > oldY)
2113- angZ += dy * zY;
2114-
2115- break;
2116-
2117- case CornerTopLeft:
2118-
2119- if (x < oldX)
2120- angZ -= dx * zX;
2121- else if (x > oldX)
2122- angZ += dx * zX;
2123-
2124- if (y < oldY)
2125- angZ += dy * zY;
2126- else if (y > oldY)
2127- angZ -= dy * zY;
2128-
2129- break;
2130-
2131- case CornerBottomLeft:
2132-
2133- if (x < oldX)
2134- angZ += dx * zX;
2135- else if (x > oldX)
2136- angZ -= dx * zX;
2137-
2138- if (y < oldY)
2139- angZ += dy * zY;
2140- else if (y > oldY)
2141- angZ -= dy * zY;
2142-
2143- break;
2144-
2145- case CornerBottomRight:
2146-
2147- if (x < oldX)
2148- angZ += dx * zX;
2149- else if (x > oldX)
2150- angZ -= dx * zX;
2151-
2152- if (y < oldY)
2153- angZ -= dy * zY;
2154- else if (y > oldY)
2155- angZ += dy * zY;
2156-
2157- break;
2158- }
2159- }
2160-
2161- if (can3D)
2162- {
2163- if (fws->optionGetZAxisRotation () != FreewinsOptions::ZAxisRotationInterchangeable)
2164- {
2165- percentFromXAxis = 0.0f;
2166- percentFromYAxis = 0.0f;
2167- }
2168-
2169- angX -= dy * (1 - percentFromXAxis);
2170- angY += dx * (1 - percentFromYAxis);
2171- }
2172-
2173- /* Restore angles */
2174-
2175- if (fws->optionGetSnap () || fws->mSnap)
2176- {
2177- mTransform.unsnapAngX = angX;
2178- mTransform.unsnapAngY = angY;
2179- mTransform.unsnapAngZ = angZ;
2180- }
2181- else
2182- {
2183- mAnimate.destAngX = angX;
2184- mAnimate.destAngY = angY;
2185- mAnimate.destAngZ = angZ;
2186- }
2187-
2188- handleSnap ();
2189-}
2190-
2191-/* Handle Scaling */
2192-void
2193-FWWindow::handleScaleMotionEvent (float dx,
2194- float dy,
2195- int x,
2196- int y)
2197-{
2198- FREEWINS_SCREEN (screen);
2199-
2200- x -= 100.0;
2201- y -= 100.0;
2202-
2203- int oldX = lastPointerX - 100;
2204- int oldY = lastPointerY - 100;
2205-
2206- float scaleX, scaleY;
2207-
2208- if (fws->optionGetSnap () || fws->mSnap)
2209- {
2210- scaleX = mTransform.unsnapScaleX;
2211- scaleY = mTransform.unsnapScaleY;
2212- }
2213- else
2214- {
2215- scaleX = mAnimate.destScaleX;
2216- scaleY = mAnimate.destScaleY;
2217- }
2218-
2219- calculateInputRect ();
2220-
2221- switch (mCorner)
2222- {
2223- case CornerTopLeft:
2224-
2225- // Check X Direction
2226- if (x < oldX)
2227- scaleX -= dx;
2228- else if (x > oldX)
2229- scaleX -= dx;
2230-
2231- // Check Y Direction
2232- if (y < oldY)
2233- scaleY -= dy;
2234- else if (y > oldY)
2235- scaleY -= dy;
2236-
2237- break;
2238-
2239- case CornerTopRight:
2240-
2241- // Check X Direction
2242- if (x < oldX)
2243- scaleX += dx;
2244- else if (x > oldX)
2245- scaleX += dx;
2246-
2247- // Check Y Direction
2248- if (y < oldY)
2249- scaleY -= dy;
2250- else if (y > oldY)
2251- scaleY -= dy;
2252-
2253- break;
2254-
2255- case CornerBottomLeft:
2256-
2257- // Check X Direction
2258- if (x < oldX)
2259- scaleX -= dx;
2260- else if (y > oldX)
2261- scaleX -= dx;
2262-
2263- // Check Y Direction
2264- if (y < oldY)
2265- scaleY += dy;
2266- else if (y > oldY)
2267- scaleY += dy;
2268-
2269- break;
2270-
2271- case CornerBottomRight:
2272-
2273- // Check X Direction
2274- if (x < oldX)
2275- scaleX += dx;
2276- else if (x > oldX)
2277- scaleX += dx;
2278-
2279- // Check Y Direction
2280- if (y < oldY)
2281- scaleY += dy;
2282- else if (y > oldY)
2283- scaleY += dy;
2284-
2285- break;
2286- }
2287-
2288- if (fws->optionGetSnap () || fws->mSnap)
2289- {
2290- mTransform.unsnapScaleX = scaleX;
2291- mTransform.unsnapScaleY = scaleY;
2292- }
2293- else
2294- {
2295- mAnimate.destScaleX = scaleX;
2296- mAnimate.destScaleY = scaleY;
2297- }
2298-
2299- /* Stop scale at threshold specified */
2300- if (!fws->optionGetAllowNegative ())
2301- {
2302- float minScale = fws->optionGetMinScale ();
2303- if (mAnimate.destScaleX < minScale)
2304- mAnimate.destScaleX = minScale;
2305-
2306- if (mAnimate.destScaleY < minScale)
2307- mAnimate.destScaleY = minScale;
2308- }
2309-
2310- /* Change scales for maintaining aspect ratio */
2311- if (fws->optionGetScaleUniform ())
2312- {
2313- float tempscaleX = mAnimate.destScaleX;
2314- float tempscaleY = mAnimate.destScaleY;
2315- mAnimate.destScaleX = (tempscaleX + tempscaleY) / 2;
2316- mAnimate.destScaleY = (tempscaleX + tempscaleY) / 2;
2317- mTransform.unsnapScaleX = (tempscaleX + tempscaleY) / 2;
2318- mTransform.unsnapScaleY = (tempscaleX + tempscaleY) / 2;
2319- }
2320-
2321- handleSnap ();
2322-}
2323-
2324-void
2325-FWWindow::handleButtonReleaseEvent ()
2326-{
2327- FREEWINS_SCREEN (screen);
2328-
2329- if (mGrab == grabMove || mGrab == grabResize)
2330- {
2331- screen->removeGrab (fws->mGrabIndex, NULL);
2332- window->ungrabNotify ();
2333- window->moveInputFocusTo ();
2334- adjustIPW ();
2335- fws->mGrabIndex = 0;
2336- fws->mGrabWindow = NULL;
2337- mGrab = grabNone;
2338- }
2339-}
2340-
2341-void
2342-FWWindow::handleEnterNotify (XEvent *xev)
2343-{
2344- XEvent EnterNotifyEvent;
2345-
2346- memcpy (&EnterNotifyEvent.xcrossing, &xev->xcrossing,
2347- sizeof (XCrossingEvent));
2348-/*
2349- if (window)
2350- {
2351- EnterNotifyEvent.xcrossing.window = window->id ();
2352- XSendEvent (screen->dpy (), window->id (),
2353- FALSE, EnterWindowMask, &EnterNotifyEvent);
2354- }
2355-*/
2356-}
2357-
2358-void
2359-FWWindow::handleLeaveNotify (XEvent *xev)
2360-{
2361- XEvent LeaveNotifyEvent;
2362-
2363- memcpy (&LeaveNotifyEvent.xcrossing, &xev->xcrossing,
2364- sizeof (XCrossingEvent));
2365- LeaveNotifyEvent.xcrossing.window = window->id ();
2366-
2367- //XSendEvent (screen->dpy (), window->id (), FALSE,
2368- // LeaveWindowMask, &LeaveNotifyEvent);
2369-}
2370-
2371-/* X Event Handler */
2372-void
2373-FWScreen::handleEvent (XEvent *ev)
2374-{
2375- float dx, dy;
2376- CompWindow *oldPrev, *oldNext, *w;
2377-
2378- /* Check our modifiers first */
2379-
2380- if (ev->type == screen->xkbEvent ())
2381- {
2382- XkbAnyEvent *xkbEvent = (XkbAnyEvent *) ev;
2383-
2384- if (xkbEvent->xkb_type == XkbStateNotify)
2385- {
2386- XkbStateNotifyEvent *stateEvent = (XkbStateNotifyEvent *) ev;
2387- unsigned int snapMods = 0xffffffff;
2388- unsigned int invertMods = 0xffffffff;
2389-
2390- if (mSnapMask)
2391- snapMods = mSnapMask;
2392-
2393- if ((stateEvent->mods & snapMods) == snapMods)
2394- mSnap = TRUE;
2395- else
2396- mSnap = FALSE;
2397-
2398- if (mInvertMask)
2399- invertMods = mInvertMask;
2400-
2401- if ((stateEvent->mods & invertMods) == invertMods)
2402- mInvert = TRUE;
2403- else
2404- mInvert = FALSE;
2405-
2406- }
2407- }
2408-
2409- switch(ev->type)
2410- {
2411- case EnterNotify:
2412- {
2413- CompWindow *btnW;
2414- btnW = screen->findWindow (ev->xbutton.subwindow);
2415-
2416- /* It wasn't the subwindow, try the window */
2417- if (!btnW)
2418- btnW = screen->findWindow (ev->xbutton.window);
2419-
2420- /* We have established the CompWindow we clicked
2421- * on. Get the real window */
2422- if (btnW)
2423- {
2424- FREEWINS_WINDOW (btnW);
2425- if (fww->canShape () && !mGrabWindow && !screen->otherGrabExist (0))
2426- mHoverWindow = btnW;
2427- btnW = getRealWindow (btnW);
2428- }
2429-
2430- if (btnW)
2431- {
2432- FREEWINS_WINDOW (btnW);
2433- if (fww->canShape () && !mGrabWindow && !screen->otherGrabExist (0))
2434- mHoverWindow = btnW;
2435- fww->handleEnterNotify (ev);
2436- }
2437- }
2438- break;
2439-
2440- case LeaveNotify:
2441- {
2442- CompWindow *btnW;
2443- btnW = screen->findWindow (ev->xbutton.subwindow);
2444-
2445- /* It wasn't the subwindow, try the window */
2446- if (!btnW)
2447- btnW = screen->findWindow (ev->xbutton.window);
2448-
2449- /* We have established the CompWindow we clicked
2450- * on. Get the real window */
2451- if (btnW)
2452- btnW = getRealWindow (btnW);
2453-
2454- if (btnW)
2455- FWWindow::get (btnW)->handleLeaveNotify (ev);
2456- }
2457- break;
2458-
2459- case MotionNotify:
2460- {
2461- if (mGrabWindow)
2462- {
2463- FREEWINS_WINDOW (mGrabWindow);
2464-
2465- dx = ((float)(pointerX - lastPointerX) / screen->width ()) * \
2466- optionGetMouseSensitivity ();
2467- dy = ((float)(pointerY - lastPointerY) / screen->height ()) * \
2468- optionGetMouseSensitivity ();
2469-
2470- if (optionGetShapeWindowTypes ().evaluate (mGrabWindow))
2471- {
2472- if (fww->mGrab == grabMove || fww->mGrab == grabResize)
2473- {
2474- FWWindowInputInfo *info;
2475-// CompWindow *w = mGrabWindow;
2476- foreach (info, mTransformedWindows)
2477- {
2478- if (mGrabWindow->id () == info->ipw)
2479- /* The window we just grabbed was actually
2480- * an IPW, get the real window instead
2481- */
2482- w = getRealWindow (mGrabWindow);
2483- }
2484- }
2485- switch (fww->mGrab)
2486- {
2487- case grabMove:
2488- fww->handleIPWMoveMotionEvent (pointerX, pointerY); break;
2489- case grabResize:
2490- fww->handleIPWResizeMotionEvent (pointerX, pointerY); break;
2491- default:
2492- break;
2493- }
2494- }
2495-
2496- if (fww->mGrab == grabRotate)
2497- {
2498- fww->handleRotateMotionEvent(dx, dy, ev->xmotion.x, ev->xmotion.y);
2499- }
2500-
2501- if (fww->mGrab == grabScale)
2502- {
2503- fww->handleScaleMotionEvent(dx * 3, dy * 3, ev->xmotion.x, ev->xmotion.y);
2504- }
2505-
2506- //if(dx != 0.0 || dy != 0.0)
2507- // fww->damageArea ();
2508- }
2509- }
2510- break;
2511-
2512- /* Button Press and Release */
2513- case ButtonPress:
2514- {
2515- CompWindow *btnW;
2516- btnW = screen->findWindow (ev->xbutton.subwindow);
2517-
2518- /* It wasn't the subwindow, try the window */
2519- if (!btnW)
2520- btnW = screen->findWindow (ev->xbutton.window);
2521-
2522- /* We have established the CompWindow we clicked
2523- * on. Get the real window
2524- * FIXME: Free btnW and use another CompWindow * such as realW
2525- */
2526- if (btnW)
2527- btnW = getRealWindow (btnW);
2528-
2529- if (btnW)
2530- {
2531- FREEWINS_WINDOW (btnW);
2532-
2533- if (optionGetShapeWindowTypes ().evaluate (btnW))
2534- switch (ev->xbutton.button)
2535- {
2536- case Button1:
2537- fww->handleIPWMoveInitiate ();
2538- break;
2539-
2540- case Button3:
2541- fww->handleIPWResizeInitiate ();
2542- break;
2543-
2544- default:
2545- break;
2546- }
2547- }
2548-
2549- mClick_root_x = ev->xbutton.x_root;
2550- mClick_root_y = ev->xbutton.y_root;
2551- }
2552- break;
2553-
2554- case ButtonRelease:
2555- {
2556- if (mGrabWindow)
2557- {
2558- FREEWINS_WINDOW (mGrabWindow);
2559-
2560- if (optionGetShapeWindowTypes ().evaluate (mGrabWindow))
2561- if (fww->mGrab == grabMove || fww->mGrab == grabResize)
2562- {
2563- fww->handleButtonReleaseEvent ();
2564- mGrabWindow = 0;
2565- }
2566- }
2567- }
2568- break;
2569-
2570- case ConfigureNotify:
2571- {
2572- w = screen->findWindow (ev->xconfigure.window);
2573- if (w)
2574- {
2575- oldPrev = w->prev;
2576- oldNext = w->next;
2577-
2578- FREEWINS_WINDOW (w);
2579-
2580- fww->mWinH = WIN_REAL_H (w);
2581- fww->mWinW = WIN_REAL_W (w);
2582- }
2583- }
2584- break;
2585-
2586-#if 0
2587- case ClientMessage:
2588- {
2589- if (ev->xclient.message_type == Atoms::desktopViewport)
2590- {
2591- /* Viewport change occurred, or something like that - adjust the IPW's */
2592- CompWindow *adjW, *actualW;
2593-
2594- foreach (adjW, screen->windows ())
2595- {
2596- int vX = 0, vY = 0, dX, dY;
2597-
2598- actualW = getRealWindow (adjW);
2599-
2600- if (!actualW)
2601- actualW = adjW;
2602-
2603- if (actualW)
2604- {
2605- CompWindow *ipw;
2606-
2607- FREEWINS_WINDOW (actualW);
2608-
2609- if (!fww->mInput || fww->mInput->ipw)
2610- break;
2611-
2612- ipw = screen->findWindow (fww->mInput->ipw);
2613-
2614- if (ipw)
2615- {
2616- dX = screen->vp ().x () - vX;
2617- dY = screen->vp ().y () - vY;
2618-
2619- CompPoint p = actualW->defaultViewport ();
2620-
2621- vX = p.x ();
2622- vY = p.y ();
2623-
2624- ipw->moveToViewportPosition (ipw->x () - dX * screen->width (),
2625- ipw->y () - dY * screen->height (),
2626- true); // ???
2627- }
2628- }
2629- }
2630- }
2631- }
2632- break;
2633-#endif
2634- default:
2635- break;
2636-#if 0
2637- if (ev->type == screen->shapeEvent () + ShapeNotify)
2638- {
2639- XShapeEvent *se = (XShapeEvent *) ev;
2640- if (se->kind == ShapeInput)
2641- {
2642- CompWindow *w;
2643- w = screen->findWindow (se->window);
2644- if (w)
2645- {
2646- FREEWINS_WINDOW (w);
2647-
2648- if (fww->canShape () && (fww->mTransform.scaleX != 1.0f || fww->mTransform.scaleY != 1.0f))
2649- {
2650- // Reset the window back to normal
2651- fww->mTransform.scaleX = 1.0f;
2652- fww->mTransform.scaleY = 1.0f;
2653- fww->mTransform.angX = 0.0f;
2654- fww->mTransform.angY = 0.0f;
2655- fww->mTransform.angZ = 0.0f;
2656- /*FWShapeInput (w); - Disabled due to problems it causes*/
2657- }
2658- }
2659- }
2660- }
2661-#endif
2662- }
2663-
2664- screen->handleEvent (ev);
2665-
2666- /* Now we can find out if a restacking occurred while we were handing events */
2667- switch (ev->type)
2668- {
2669- case ConfigureNotify:
2670- {
2671- w = screen->findWindow (ev->xconfigure.window);
2672- if (w)
2673- {
2674- oldPrev = w->prev;
2675- oldNext = w->next;
2676- if (w->prev != oldPrev || w->next != oldNext)
2677- {
2678- /* restacking occured, ensure ipw stacking */
2679- adjustIPWStacking ();
2680- }
2681- }
2682- }
2683- break;
2684- }
2685-}
2686
2687=== removed file 'plugins/freewins/src/freewins.cpp'
2688--- plugins/freewins/src/freewins.cpp 2013-02-19 16:21:42 +0000
2689+++ plugins/freewins/src/freewins.cpp 1970-01-01 00:00:00 +0000
2690@@ -1,271 +0,0 @@
2691-/**
2692- * Compiz Fusion Freewins plugin
2693- *
2694- * freewins.cpp
2695- *
2696- * Copyright (C) 2007 Rodolfo Granata <warlock.cc@gmail.com>
2697- *
2698- * This program is free software; you can redistribute it and/or
2699- * modify it under the terms of the GNU General Public License
2700- * as published by the Free Software Foundation; either version 2
2701- * of the License, or (at your option) any later version.
2702- *
2703- * This program is distributed in the hope that it will be useful,
2704- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2705- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2706- * GNU General Public License for more details.
2707- *
2708- * Author(s):
2709- * Rodolfo Granata <warlock.cc@gmail.com>
2710- * Sam Spilsbury <smspillaz@gmail.com>
2711- *
2712- * Button binding support and Reset added by:
2713- * enigma_0Z <enigma.0ZA@gmail.com>
2714- *
2715- * Most of the input handling here is based on
2716- * the shelf plugin by
2717- * : Kristian Lyngstøl <kristian@bohemians.org>
2718- * : Danny Baumann <maniac@opencompositing.org>
2719- *
2720- * Description:
2721- *
2722- * This plugin allows you to freely transform the texture of a window,
2723- * whether that be rotation or scaling to make better use of screen space
2724- * or just as a toy.
2725- *
2726- * Todo:
2727- * - Modifier key to rotate on the Z Axis
2728- * - Fully implement an input redirection system by
2729- * finding an inverse matrix, multiplying by it,
2730- * translating to the actual window co-ords and
2731- * XSendEvent() the co-ords to the actual window.
2732- * - Code could be cleaner
2733- * - Add timestep and speed options to animation
2734- * - Add window hover-over info via paintOutput : i.e
2735- * - Resize borders
2736- * - 'Reset' Button
2737- * - 'Scale' Button
2738- * - 'Rotate' Button
2739- */
2740-
2741-#include "freewins.h"
2742-
2743-COMPIZ_PLUGIN_20090315 (freewins, FWPluginVTable);
2744-
2745-/* Information on window resize */
2746-void
2747-FWWindow::resizeNotify (int dx,
2748- int dy,
2749- int dw,
2750- int dh)
2751-{
2752- calculateInputRect ();
2753-
2754- int x = WIN_REAL_X(window) + WIN_REAL_W(window)/2.0;
2755- int y = WIN_REAL_Y(window) + WIN_REAL_H(window)/2.0;
2756-
2757- mRadius = sqrt(pow((x - WIN_REAL_X (window)), 2) + pow((y - WIN_REAL_Y (window)), 2));
2758-
2759- window->resizeNotify (dx, dy, dw, dh);
2760-}
2761-
2762-void
2763-FWWindow::moveNotify (int dx,
2764- int dy,
2765- bool immediate)
2766-{
2767- FREEWINS_SCREEN (screen);
2768-
2769- /* Did we move and IPW and not the actual window? */
2770- CompWindow *useWindow = fws->getRealWindow (window);
2771-
2772- if (useWindow)
2773- useWindow->move (dx, dy, fws->optionGetImmediateMoves ());
2774- else if (window != fws->mGrabWindow)
2775- adjustIPW ();
2776-
2777- if (!useWindow)
2778- useWindow = window;
2779-
2780- int x = WIN_REAL_X (useWindow) + WIN_REAL_W (useWindow) /2.0;
2781- int y = WIN_REAL_Y (useWindow) + WIN_REAL_H (useWindow) /2.0;
2782-
2783-
2784- mRadius = sqrt (pow((x - WIN_REAL_X (useWindow)), 2) + pow ((y - WIN_REAL_Y (useWindow)), 2));
2785-
2786- useWindow->moveNotify (dx, dy, immediate);
2787-}
2788-
2789-void
2790-FWScreen::reloadSnapKeys ()
2791-{
2792- unsigned int imask = optionGetInvertModsMask ();
2793- mInvertMask = 0;
2794-
2795- if (imask & InvertModsShiftMask)
2796- mInvertMask |= ShiftMask;
2797- if (imask & InvertModsAltMask)
2798- mInvertMask |= CompAltMask;
2799- if (imask & InvertModsControlMask)
2800- mInvertMask |= ControlMask;
2801- if (imask & InvertModsMetaMask)
2802- mInvertMask |= CompMetaMask;
2803-
2804- unsigned int smask = optionGetSnapModsMask ();
2805- mSnapMask = 0;
2806- if (smask & SnapModsShiftMask)
2807- mSnapMask |= ShiftMask;
2808- if (smask & SnapModsAltMask)
2809- mSnapMask |= CompAltMask;
2810- if (smask & SnapModsControlMask)
2811- mSnapMask |= ControlMask;
2812- if (smask & SnapModsMetaMask)
2813- mSnapMask |= CompMetaMask;
2814-}
2815-
2816-void
2817-FWScreen::optionChanged (CompOption *option,
2818- FreewinsOptions::Options num)
2819-{
2820- switch (num)
2821- {
2822- case FreewinsOptions::SnapMods:
2823- case FreewinsOptions::InvertMods:
2824- reloadSnapKeys ();
2825- break;
2826- default:
2827- break;
2828- }
2829-}
2830-
2831-/* ------ Plugin Initialisation ---------------------------------------*/
2832-
2833-/* Window initialisation / cleaning */
2834-
2835-FWWindow::FWWindow (CompWindow *w) :
2836- PluginClassHandler <FWWindow, CompWindow> (w),
2837- window (w),
2838- cWindow (CompositeWindow::get (w)),
2839- gWindow (GLWindow::get (w)),
2840- mIMidX (WIN_REAL_W (w) / 2.0),
2841- mIMidY (WIN_REAL_H (w) / 2.0),
2842- mOMidX (0.0f),
2843- mOMidY (0.0f),
2844- mAdjustX (0.0f),
2845- mAdjustY (0.0f),
2846- mOldWinX (0),
2847- mOldWinY (0),
2848- mWinH (0),
2849- mWinW (0),
2850- mDirection (UpDown),
2851- mCorner (CornerTopLeft),
2852- mInput (NULL),
2853- mOutputRect (w->outputRect ()),
2854- mInputRect (w->borderRect ()),
2855- mResetting (false),
2856- mIsAnimating (false),
2857- mCan2D (false),
2858- mCan3D (false),
2859- mTransformed (false),
2860- mGrab (grabNone)
2861-{
2862- WindowInterface::setHandler (window);
2863- CompositeWindowInterface::setHandler (cWindow);
2864- GLWindowInterface::setHandler (gWindow);
2865-
2866- int x = WIN_REAL_X (w) + WIN_REAL_W (w) /2.0;
2867- int y = WIN_REAL_Y (w) + WIN_REAL_H (w) /2.0;
2868-
2869- mRadius = sqrt (pow ((x - WIN_REAL_X (w)), 2) + pow ((y - WIN_REAL_Y (w)), 2));
2870-}
2871-
2872-FWWindow::~FWWindow ()
2873-{
2874- if (canShape ())
2875- handleWindowInputInfo ();
2876-
2877- FREEWINS_SCREEN (screen);
2878-
2879- if (fws->mGrabWindow == window)
2880- fws->mGrabWindow = NULL;
2881-}
2882-
2883-#define ROTATE_INC optionGetRotateIncrementAmount ()
2884-#define NEG_ROTATE_INC optionGetRotateIncrementAmount () *-1
2885-
2886-#define SCALE_INC optionGetScaleIncrementAmount ()
2887-#define NEG_SCALE_INC optionGetScaleIncrementAmount () *-1
2888-
2889-FWScreen::FWScreen (CompScreen *screen) :
2890- PluginClassHandler <FWScreen, CompScreen> (screen),
2891- cScreen (CompositeScreen::get (screen)),
2892- gScreen (GLScreen::get (screen)),
2893- mClick_root_x (0),
2894- mClick_root_y (0),
2895- mGrabWindow (NULL),
2896- mHoverWindow (NULL),
2897- mLastGrabWindow (NULL),
2898- mAxisHelp (false),
2899- mSnap (false),
2900- mInvert (false),
2901- mSnapMask (0),
2902- mInvertMask (0),
2903- mGrabIndex (0)
2904-{
2905- ScreenInterface::setHandler (screen);
2906- CompositeScreenInterface::setHandler (cScreen);
2907- GLScreenInterface::setHandler (gScreen);
2908-
2909- /* TODO: warning about shape! */
2910-
2911- /* BCOP Action initiation */
2912- optionSetInitiateRotationButtonInitiate (boost::bind (&FWScreen::initiateFWRotate, this, _1, _2, _3));
2913- optionSetInitiateRotationButtonTerminate (boost::bind (&FWScreen::terminateFWRotate, this, _1, _2, _3));
2914- optionSetInitiateScaleButtonInitiate (boost::bind (&FWScreen::initiateFWScale, this, _1, _2, _3));
2915- optionSetInitiateScaleButtonTerminate (boost::bind (&FWScreen::terminateFWScale, this, _1, _2, _3));
2916- optionSetResetButtonInitiate (boost::bind (&FWScreen::resetFWTransform, this, _1, _2, _3));
2917- optionSetResetKeyInitiate (boost::bind (&FWScreen::resetFWTransform, this, _1, _2, _3));
2918- optionSetToggleAxisKeyInitiate (boost::bind (&FWScreen::toggleFWAxis, this, _1, _2, _3));
2919-
2920- // Rotate / Scale Up Down Left Right TODO: rebind these actions on option change
2921-
2922- optionSetScaleUpButtonInitiate (boost::bind (&FWScreen::scale, this, _1, _2, _3, SCALE_INC));
2923- optionSetScaleDownButtonInitiate (boost::bind (&FWScreen::scale, this, _1, _2, _3, NEG_SCALE_INC));
2924- optionSetScaleUpKeyInitiate (boost::bind (&FWScreen::scale, this, _1, _2, _3, SCALE_INC));
2925- optionSetScaleDownKeyInitiate (boost::bind (&FWScreen::scale, this, _1, _2, _3, NEG_SCALE_INC));
2926-
2927- optionSetRotateUpKeyInitiate (boost::bind (&FWScreen::rotate, this, _1, _2, _3, 0, ROTATE_INC, 0));
2928- optionSetRotateDownKeyInitiate (boost::bind (&FWScreen::rotate, this, _1, _2, _3, 0, NEG_ROTATE_INC, 0));
2929- optionSetRotateLeftKeyInitiate (boost::bind (&FWScreen::rotate, this, _1, _2, _3, ROTATE_INC, 0, 0));
2930- optionSetRotateRightKeyInitiate (boost::bind (&FWScreen::rotate, this, _1, _2, _3, NEG_ROTATE_INC, 0, 0));
2931- optionSetRotateCKeyInitiate (boost::bind (&FWScreen::rotate, this, _1, _2, _3, 0, 0, ROTATE_INC));
2932- optionSetRotateCcKeyInitiate (boost::bind (&FWScreen::rotate, this, _1, _2, _3, 0, 0, NEG_ROTATE_INC));
2933-
2934- optionSetRotateInitiate (boost::bind (&FWScreen::rotateAction, this, _1, _2, _3));
2935- optionSetIncrementRotateInitiate (boost::bind (&FWScreen::incrementRotateAction, this, _1, _2, _3));
2936- optionSetScaleInitiate (boost::bind (&FWScreen::scaleAction, this, _1, _2, _3));
2937-
2938- optionSetSnapModsNotify (boost::bind (&FWScreen::optionChanged, this, _1, _2));
2939- optionSetInvertModsNotify (boost::bind (&FWScreen::optionChanged, this, _1, _2));
2940-
2941- reloadSnapKeys ();
2942-}
2943-
2944-bool
2945-FWPluginVTable::init ()
2946-{
2947- if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
2948- return false;
2949- if (!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI))
2950- return false;
2951- if (!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
2952- return false;
2953-
2954- if (!screen->XShape ())
2955- {
2956- compLogMessage ("shelf", CompLogLevelError,
2957- "No Shape extension found. IPW Usage not enabled \n");
2958- }
2959-
2960- return true;
2961-}
2962
2963=== removed file 'plugins/freewins/src/freewins.h'
2964--- plugins/freewins/src/freewins.h 2013-02-20 14:24:30 +0000
2965+++ plugins/freewins/src/freewins.h 1970-01-01 00:00:00 +0000
2966@@ -1,589 +0,0 @@
2967-/**
2968- * Compiz Fusion Freewins plugin
2969- *
2970- * freewins.h
2971- *
2972- * Copyright (C) 2007 Rodolfo Granata <warlock.cc@gmail.com>
2973- *
2974- * This program is free software; you can redistribute it and/or
2975- * modify it under the terms of the GNU General Public License
2976- * as published by the Free Software Foundation; either version 2
2977- * of the License, or (at your option) any later version.
2978- *
2979- * This program is distributed in the hope that it will be useful,
2980- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2981- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2982- * GNU General Public License for more details.
2983- *
2984- * Author(s):
2985- * Rodolfo Granata <warlock.cc@gmail.com>
2986- *
2987- * Button binding support and Reset added by:
2988- * enigma_0Z <enigma.0ZA@gmail.com>
2989- *
2990- * Scaling, Animation, Input-Shaping, Snapping
2991- * and Key-Based Transformation added by:
2992- * Sam Spilsbury <smspillaz@gmail.com>
2993- *
2994- * Most of the input handling here is based on
2995- * the shelf plugin by
2996- * : Kristian Lyngstøl <kristian@bohemians.org>
2997- * : Danny Baumann <maniac@opencompositing.org>
2998- *
2999- * Description:
3000- *
3001- * This plugin allows you to freely transform the texture of a window,
3002- * whether that be rotation or scaling to make better use of screen space
3003- * or just as a toy.
3004- *
3005- * Todo:
3006- * - Fully implement an input redirection system by
3007- * finding an inverse matrix, multiplying by it,
3008- * translating to the actual window co-ords and
3009- * XSendEvent() the co-ords to the actual window.
3010- * - Code could be cleaner
3011- * - Add timestep and speed options to animation
3012- * - Add window hover-over info via paintOutput : i.e
3013- * - Resize borders
3014- * - 'Reset' Button
3015- * - 'Scale' Button
3016- * - 'Rotate' Button
3017- */
3018-
3019-#include <core/core.h>
3020-#include <core/pluginclasshandler.h>
3021-#include <composite/composite.h>
3022-#include <opengl/opengl.h>
3023-#include <core/atoms.h>
3024-
3025-#include <cmath>
3026-#include <cstdio>
3027-#include <cstring>
3028-
3029-#include <X11/cursorfont.h>
3030-#include <X11/extensions/shape.h>
3031-
3032-#include <GL/glu.h>
3033-#include <GL/gl.h>
3034-
3035-#include "freewins_options.h"
3036-
3037-/* #define ABS(x) ((x)>0?(x):-(x)) */
3038-#define D2R(x) ((x) * (M_PI / 180.0))
3039-#define R2D(x) ((x) * (180 / M_PI))
3040-
3041-/* ------ Macros ---------------------------------------------------------*/
3042-
3043-#define WIN_OUTPUT_X(w) (w->x () - w->output ().left)
3044-#define WIN_OUTPUT_Y(w) (w->y () - w->output ().top)
3045-
3046-#define WIN_OUTPUT_W(w) (w->width () + w->output ().left + w->output ().right)
3047-#define WIN_OUTPUT_H(w) (w->height () + w->output ().top + w->output ().bottom)
3048-
3049-#define WIN_REAL_X(w) (w->x () - w->border ().left)
3050-#define WIN_REAL_Y(w) (w->y () - w->border ().top)
3051-
3052-#define WIN_REAL_W(w) (w->width () + w->border ().left + w->border ().right)
3053-#define WIN_REAL_H(w) (w->height () + w->border ().top + w->border ().bottom)
3054-
3055-#define WIN_CORNER1(w) GLVector ic1 = GLVector (WIN_REAL_X (w), WIN_REAL_Y (w), 0.0f, 1.0f);
3056-#define WIN_CORNER2(w) GLVector ic2 = GLVector (WIN_REAL_X (w) + WIN_REAL_W (w), WIN_REAL_Y (w), 0.0f, 1.0f);
3057-#define WIN_CORNER3(w) GLVector ic3 = GLVector (WIN_REAL_X (w), WIN_REAL_Y (w) + WIN_REAL_H (w), 0.0f, 1.0f);
3058-#define WIN_CORNER4(w) GLVector ic4 = GLVector (WIN_REAL_X (w) + WIN_REAL_W (w), WIN_REAL_Y (w) + WIN_REAL_H (w), 0.0f, 1.0f);
3059-
3060-#define WIN_OCORNER1(w) GLVector oc1 = GLVector (WIN_OUTPUT_X (w), WIN_OUTPUT_Y (w), 0.0f, 1.0f);
3061-#define WIN_OCORNER2(w) GLVector oc2 = GLVector (WIN_OUTPUT_X (w) + WIN_OUTPUT_W (w), WIN_OUTPUT_Y (w), 0.0f, 1.0f);
3062-#define WIN_OCORNER3(w) GLVector oc3 = GLVector (WIN_OUTPUT_X (w), WIN_OUTPUT_Y (w) + WIN_OUTPUT_H (w), 0.0f, 1.0f);
3063-#define WIN_OCORNER4(w) GLVector oc4 = GLVector ( WIN_OUTPUT_X (w) + WIN_OUTPUT_W (w), WIN_OUTPUT_Y (w) + WIN_OUTPUT_H (w), 0.0f, 1.0f);
3064-
3065-/* ------ Structures and Enums ------------------------------------------*/
3066-
3067-/* Enums */
3068-typedef enum _StartCorner
3069-{
3070- CornerTopLeft = 0,
3071- CornerTopRight = 1,
3072- CornerBottomLeft = 2,
3073- CornerBottomRight = 3
3074-} StartCorner;
3075-
3076-typedef enum _FWGrabType
3077-{
3078- grabNone = 0,
3079- grabRotate,
3080- grabScale,
3081- grabMove,
3082- grabResize
3083-} FWGrabType;
3084-
3085-typedef enum _Direction
3086-{
3087- UpDown = 0,
3088- LeftRight = 1
3089-} Direction;
3090-
3091-typedef enum _FWAxisType
3092-{
3093- axisX = 0,
3094- axisY,
3095- axisZ,
3096- axisXY,
3097- axisXZ,
3098-} FWAxisType;
3099-
3100-/* Shape info / restoration */
3101-class FWWindowInputInfo
3102-{
3103- public:
3104-
3105- FWWindowInputInfo (CompWindow *);
3106- ~FWWindowInputInfo ();
3107-
3108- public:
3109- CompWindow *w;
3110-
3111- Window ipw;
3112-
3113- XRectangle *inputRects;
3114- int nInputRects;
3115- int inputRectOrdering;
3116-
3117- XRectangle *frameInputRects;
3118- int frameNInputRects;
3119- int frameInputRectOrdering;
3120-};
3121-
3122-class FWWindowOutputInfo
3123-{
3124- public:
3125- float shapex1;
3126- float shapex2;
3127- float shapex3;
3128- float shapex4;
3129- float shapey1;
3130- float shapey2;
3131- float shapey3;
3132- float shapey4;
3133-};
3134-
3135-/* Trackball */
3136-
3137-/*typedef struct _FWTrackball
3138-{
3139- CompVector mouseX;
3140- CompVector mouse0;
3141- CompVector tr_axis;
3142- float tr_ang;
3143- float tr_radius;
3144-
3145-} FWTrackball;*/
3146-
3147-/* Transformation info */
3148-class FWTransformedWindowInfo
3149-{
3150- public:
3151- FWTransformedWindowInfo () :
3152- angX (0),
3153- angY (0),
3154- angZ (0),
3155- scaleX (1.0f),
3156- scaleY (1.0f),
3157- unsnapAngX (0),
3158- unsnapAngY (0),
3159- unsnapAngZ (0),
3160- unsnapScaleX (0),
3161- unsnapScaleY (0) {}
3162-
3163- //FWTrackball trackball;
3164-
3165- float angX;
3166- float angY;
3167- float angZ;
3168-
3169- float scaleX;
3170- float scaleY;
3171-
3172- // Window transformation
3173-
3174- /* Used for snapping */
3175-
3176- float unsnapAngX;
3177- float unsnapAngY;
3178- float unsnapAngZ;
3179-
3180- float unsnapScaleX;
3181- float unsnapScaleY;
3182-};
3183-
3184-class FWAnimationInfo
3185-{
3186- public:
3187-
3188- FWAnimationInfo () :
3189- oldAngX (0),
3190- oldAngY (0),
3191- oldAngZ (0),
3192- oldScaleX (1.0f),
3193- oldScaleY (1.0f),
3194- destAngX (0),
3195- destAngY (0),
3196- destAngZ (0),
3197- destScaleX (1.0f),
3198- destScaleY (1.0f),
3199- steps (0) {}
3200-
3201- // Old values to animate from
3202- float oldAngX;
3203- float oldAngY;
3204- float oldAngZ;
3205-
3206- float oldScaleX;
3207- float oldScaleY;
3208-
3209- // New values to animate to
3210- float destAngX;
3211- float destAngY;
3212- float destAngZ;
3213-
3214- float destScaleX;
3215- float destScaleY;
3216-
3217- // For animation
3218- float steps;
3219-};
3220-
3221-class FWScreen :
3222- public PluginClassHandler <FWScreen, CompScreen>,
3223- public ScreenInterface,
3224- public CompositeScreenInterface,
3225- public GLScreenInterface,
3226- public FreewinsOptions
3227-{
3228- public:
3229-
3230- FWScreen (CompScreen *screen);
3231-
3232- CompositeScreen *cScreen;
3233- GLScreen *gScreen;
3234-
3235- std::list <FWWindowInputInfo *> mTransformedWindows;
3236-
3237- int mClick_root_x;
3238- int mClick_root_y;
3239-
3240- CompWindow *mGrabWindow;
3241- CompWindow *mHoverWindow;
3242- CompWindow *mLastGrabWindow;
3243-
3244- bool mAxisHelp;
3245- bool mSnap;
3246- bool mInvert;
3247- int mSnapMask;
3248- int mInvertMask;
3249-
3250- Cursor mRotateCursor;
3251-
3252- CompScreen::GrabHandle mGrabIndex;
3253-
3254- void preparePaint (int);
3255- bool glPaintOutput (const GLScreenPaintAttrib &,
3256- const GLMatrix &,
3257- const CompRegion &,
3258- CompOutput *,
3259- unsigned int );
3260- void donePaint ();
3261-
3262- void handleEvent (XEvent *);
3263-
3264- void
3265- optionChanged (CompOption *option,
3266- FreewinsOptions::Options num);
3267-
3268- void
3269- reloadSnapKeys ();
3270-
3271- bool
3272- initiateFWRotate (CompAction *action,
3273- CompAction::State state,
3274- CompOption::Vector options);
3275-
3276- bool
3277- terminateFWRotate (CompAction *action,
3278- CompAction::State state,
3279- CompOption::Vector options);
3280-
3281- bool
3282- initiateFWScale (CompAction *action,
3283- CompAction::State state,
3284- CompOption::Vector options);
3285-
3286- bool
3287- terminateFWScale (CompAction *action,
3288- CompAction::State state,
3289- CompOption::Vector options);
3290-
3291- bool
3292- rotate (CompAction *action,
3293- CompAction::State state,
3294- CompOption::Vector options, int dx, int dy, int dz);
3295-
3296- bool
3297- scale (CompAction *action,
3298- CompAction::State state,
3299- CompOption::Vector options,
3300- int scale);
3301- bool
3302- resetFWTransform (CompAction *action,
3303- CompAction::State state,
3304- CompOption::Vector options);
3305-
3306- bool
3307- rotateAction (CompAction *action,
3308- CompAction::State state,
3309- CompOption::Vector options);
3310-
3311- bool
3312- incrementRotateAction (CompAction *action,
3313- CompAction::State state,
3314- CompOption::Vector options);
3315-
3316- bool
3317- scaleAction (CompAction *action,
3318- CompAction::State state,
3319- CompOption::Vector options);
3320-
3321- bool
3322- toggleFWAxis (CompAction *action,
3323- CompAction::State state,
3324- CompOption::Vector options);
3325-
3326- void
3327- addWindowToList (FWWindowInputInfo *info);
3328-
3329- void
3330- removeWindowFromList (FWWindowInputInfo *info);
3331-
3332- void
3333- adjustIPWStacking ();
3334-
3335- void
3336- rotateProjectVector (GLVector &vector,
3337- GLMatrix &transform,
3338- GLdouble *resultX,
3339- GLdouble *resultY,
3340- GLdouble *resultZ);
3341-
3342- void
3343- perspectiveDistortAndResetZ (GLMatrix &transform);
3344-
3345- void
3346- modifyMatrix (GLMatrix &transform,
3347- float angX, float angY, float angZ,
3348- float tX, float tY, float tZ,
3349- float scX, float scY, float scZ,
3350- float adjustX, float adjustY, bool paint);
3351-
3352- CompRect
3353- createSizedRect (float xScreen1,
3354- float xScreen2,
3355- float xScreen3,
3356- float xScreen4,
3357- float yScreen1,
3358- float yScreen2,
3359- float yScreen3,
3360- float yScreen4);
3361-
3362- CompWindow *
3363- getRealWindow (CompWindow *w);
3364-};
3365-
3366-/* Freewins Window Structure */
3367-class FWWindow :
3368- public PluginClassHandler <FWWindow, CompWindow>,
3369- public WindowInterface,
3370- public CompositeWindowInterface,
3371- public GLWindowInterface
3372-{
3373- public:
3374-
3375- FWWindow (CompWindow *w);
3376- ~FWWindow ();
3377-
3378- CompWindow *window;
3379- CompositeWindow *cWindow;
3380- GLWindow *gWindow;
3381-
3382- bool glPaint (const GLWindowPaintAttrib &,
3383- const GLMatrix &,
3384- const CompRegion &,
3385- unsigned int );
3386-
3387- bool damageRect (bool initial,
3388- const CompRect &);
3389-
3390- void moveNotify (int, int, bool);
3391- void resizeNotify (int, int, int, int);
3392-
3393- float mIMidX;
3394- float mIMidY;
3395-
3396- float mOMidX; /* These will be removed */
3397- float mOMidY;
3398-
3399- float mAdjustX;
3400- float mAdjustY;
3401-
3402- float mRadius;
3403-
3404- // Used for determining window movement
3405-
3406- int mOldWinX;
3407- int mOldWinY;
3408-
3409- // Used for resize
3410-
3411- int mWinH;
3412- int mWinW;
3413-
3414- Direction mDirection;
3415-
3416- // Used to determine starting point
3417- StartCorner mCorner;
3418-
3419- // Transformation info
3420- FWTransformedWindowInfo mTransform;
3421-
3422- // Animation Info
3423- FWAnimationInfo mAnimate;
3424-
3425- // Input Info
3426- FWWindowInputInfo *mInput;
3427-
3428- //Output Info
3429- FWWindowOutputInfo mOutput;
3430-
3431- CompRect mOutputRect;
3432- CompRect mInputRect;
3433-
3434- // Used to determine whether to animate the window
3435- bool mResetting;
3436- bool mIsAnimating;
3437-
3438- // Used to determine whether rotating on X and Y axis, or just on Z
3439- bool mCan2D; // These need to be removed
3440- bool mCan3D;
3441-
3442- bool mTransformed; // So does this in favor of FWWindowInputInfo
3443-
3444- FWGrabType mGrab;
3445-
3446- void
3447- shapeIPW ();
3448-
3449- void
3450- saveInputShape (XRectangle **retRects,
3451- int *retCount,
3452- int *retOrdering);
3453-
3454- void
3455- adjustIPW ();
3456-
3457- void
3458- createIPW ();
3459-
3460- bool
3461- handleWindowInputInfo ();
3462-
3463- void
3464- shapeInput ();
3465-
3466- void
3467- unshapeInput ();
3468-
3469- void
3470- handleIPWResizeInitiate ();
3471-
3472- void
3473- handleIPWMoveInitiate ();
3474-
3475- void
3476- handleIPWMoveMotionEvent (unsigned int x,
3477- unsigned int y);
3478-
3479- void
3480- handleIPWResizeMotionEvent (unsigned int x,
3481- unsigned int y);
3482-
3483- void
3484- handleRotateMotionEvent (float dx,
3485- float dy,
3486- int x,
3487- int y);
3488-
3489- void
3490- handleScaleMotionEvent (float dx,
3491- float dy,
3492- int x,
3493- int y);
3494-
3495- void
3496- handleButtonReleaseEvent ();
3497-
3498- void
3499- handleEnterNotify (XEvent *xev);
3500-
3501- void
3502- handleLeaveNotify (XEvent *xev);
3503-
3504- void
3505- damageArea ();
3506-
3507- void
3508- setPrepareRotation (float dx,
3509- float dy,
3510- float dz,
3511- float dsu,
3512- float dsd);
3513-
3514- void
3515- calculateInputOrigin (float x, float y);
3516-
3517- void
3518- calculateOutputOrigin (float x, float y);
3519-
3520- void
3521- calculateOutputRect ();
3522-
3523- void
3524- calculateInputRect ();
3525-
3526- CompRect
3527- calculateWindowRect (GLVector c1,
3528- GLVector c2,
3529- GLVector c3,
3530- GLVector c4);
3531-
3532- void
3533- determineZAxisClick (int px,
3534- int py,
3535- bool motion);
3536- bool
3537- canShape ();
3538-
3539- void
3540- handleSnap ();
3541-};
3542-
3543-#define FREEWINS_SCREEN(screen) \
3544- FWScreen *fws = FWScreen::get (screen);
3545-
3546-#define FREEWINS_WINDOW(window) \
3547- FWWindow *fww = FWWindow::get (window);
3548-
3549-class FWPluginVTable :
3550- public CompPlugin::VTableForScreenAndWindow <FWScreen, FWWindow>
3551-{
3552- public:
3553-
3554- bool init ();
3555-};
3556
3557=== removed file 'plugins/freewins/src/input.cpp'
3558--- plugins/freewins/src/input.cpp 2013-02-20 14:24:30 +0000
3559+++ plugins/freewins/src/input.cpp 1970-01-01 00:00:00 +0000
3560@@ -1,397 +0,0 @@
3561-/**
3562- * Compiz Fusion Freewins plugin
3563- *
3564- * input.cpp
3565- *
3566- * Copyright (C) 2007 Rodolfo Granata <warlock.cc@gmail.com>
3567- *
3568- * This program is free software; you can redistribute it and/or
3569- * modify it under the terms of the GNU General Public License
3570- * as published by the Free Software Foundation; either version 2
3571- * of the License, or (at your option) any later version.
3572- *
3573- * This program is distributed in the hope that it will be useful,
3574- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3575- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3576- * GNU General Public License for more details.
3577- *
3578- * Author(s):
3579- * Rodolfo Granata <warlock.cc@gmail.com>
3580- * Sam Spilsbury <smspillaz@gmail.com>
3581- *
3582- * Button binding support and Reset added by:
3583- * enigma_0Z <enigma.0ZA@gmail.com>
3584- *
3585- * Most of the input handling here is based on
3586- * the shelf plugin by
3587- * : Kristian Lyngstøl <kristian@bohemians.org>
3588- * : Danny Baumann <maniac@opencompositing.org>
3589- *
3590- * Description:
3591- *
3592- * This plugin allows you to freely transform the texture of a window,
3593- * whether that be rotation or scaling to make better use of screen space
3594- * or just as a toy.
3595- *
3596- * Todo:
3597- * - Fully implement an input redirection system by
3598- * finding an inverse matrix, multiplying by it,
3599- * translating to the actual window co-ords and
3600- * XSendEvent() the co-ords to the actual window.
3601- * - Code could be cleaner
3602- * - Add timestep and speed options to animation
3603- * - Add window hover-over info via paintOutput : i.e
3604- * - Resize borders
3605- * - 'Reset' Button
3606- * - 'Scale' Button
3607- * - 'Rotate' Button
3608- */
3609-
3610-#include "freewins.h"
3611-#include <cairo/cairo-xlib.h>
3612-
3613-
3614-/* ------ Input Prevention -------------------------------------------*/
3615-
3616-/* Shape the IPW
3617- * Thanks to Joel Bosveld (b0le)
3618- * for helping me with this section
3619- */
3620-void
3621-FWWindow::shapeIPW ()
3622-{
3623- if (mInput)
3624- {
3625- Window xipw = mInput->ipw;
3626- CompWindow *ipw = screen->findWindow (xipw);
3627-
3628- if (ipw)
3629- {
3630- cairo_t *cr;
3631- int width, height;
3632-
3633- width = mInputRect.width ();
3634- height = mInputRect.height ();
3635-
3636- Pixmap b = XCreatePixmap (screen->dpy (), xipw, width, height, 1);
3637-
3638- cairo_surface_t *bitmap =
3639- cairo_xlib_surface_create_for_bitmap (screen->dpy (),
3640- b,
3641- DefaultScreenOfDisplay (screen->dpy ()),
3642- width, height);
3643-
3644- cr = cairo_create (bitmap);
3645-
3646- cairo_save (cr);
3647- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
3648- cairo_paint (cr);
3649- cairo_restore (cr);
3650-
3651- /* Move to our first corner (TopLeft) */
3652-
3653- cairo_move_to (cr,
3654- mOutput.shapex1 - MIN(mInputRect.x1 (), mInputRect.x2 ()),
3655- mOutput.shapey1 - MIN(mInputRect.y1 (), mInputRect.y2 ()));
3656-
3657- /* Line to TopRight */
3658-
3659- cairo_line_to (cr,
3660- mOutput.shapex2 - MIN(mInputRect.x1 (), mInputRect.x2 ()),
3661- mOutput.shapey2 - MIN(mInputRect.y1 (), mInputRect.y2 ()));
3662-
3663- /* Line to BottomRight */
3664-
3665- cairo_line_to (cr,
3666- mOutput.shapex4 - MIN(mInputRect.x1 (), mInputRect.x2 ()),
3667- mOutput.shapey4 - MIN(mInputRect.y1 (), mInputRect.y2 ()));
3668-
3669- /* Line to BottomLeft */
3670-
3671- cairo_line_to (cr,
3672- mOutput.shapex3 - MIN(mInputRect.x1 (), mInputRect.x2 ()),
3673- mOutput.shapey3 - MIN(mInputRect.y1 (), mInputRect.y2 ()));
3674-
3675- /* Line to TopLeft */
3676-
3677- cairo_line_to (cr,
3678- mOutput.shapex1 - MIN(mInputRect.x1 (), mInputRect.x2 ()),
3679- mOutput.shapey1 - MIN(mInputRect.y1 (), mInputRect.y2 ()));
3680-
3681- /* Ensure it's all closed up */
3682-
3683- cairo_close_path (cr);
3684-
3685- /* Fill in the box */
3686-
3687- cairo_set_source_rgb (cr, 1.0f, 1.0f, 1.0f);
3688- cairo_fill (cr);
3689-
3690- /* This takes the bitmap we just drew with cairo
3691- * and scans out the white bits (You can see these)
3692- * if you uncomment the following line after this
3693- * comment. Then, all the bits we drew on are clickable,
3694- * leaving us with a nice and neat window shape. Yummy.
3695- */
3696-
3697- /* XWriteBitmapFile (ipw->screen->display->display,
3698- "/path/to/your/image.bmp",
3699- b,
3700- ipw->width,
3701- ipw->height,
3702- -1, -1); */
3703-
3704- XShapeCombineMask (screen->dpy (), xipw,
3705- ShapeBounding,
3706- 0,
3707- 0,
3708- b,
3709- ShapeSet);
3710-
3711- XFreePixmap (screen->dpy (), b);
3712- cairo_surface_destroy (bitmap);
3713- cairo_destroy (cr);
3714- }
3715- }
3716-}
3717-
3718-void
3719-FWWindow::saveInputShape (XRectangle **retRects,
3720- int *retCount,
3721- int *retOrdering)
3722-{
3723- XRectangle *rects;
3724- int count = 0, ordering;
3725- Display *dpy = screen->dpy ();
3726-
3727- rects = XShapeGetRectangles (dpy, window->id (), ShapeInput, &count, &ordering);
3728-
3729- /* check if the returned shape exactly matches the window shape -
3730- if that is true, the window currently has no set input shape */
3731- if ((count == 1) &&
3732- (rects[0].x == -window->geometry ().border ()) &&
3733- (rects[0].y == -window->geometry ().border ()) &&
3734- (rects[0].width == (window->serverWidth () +
3735- window->serverGeometry ().border ())) &&
3736- (rects[0].height == (window->serverHeight () +
3737- window->serverGeometry (). border ())))
3738- {
3739- count = 0;
3740- }
3741-
3742- *retRects = rects;
3743- *retCount = count;
3744- *retOrdering = ordering;
3745-}
3746-
3747-void
3748-FWScreen::addWindowToList (FWWindowInputInfo *info)
3749-{
3750- mTransformedWindows.push_back (info);
3751-}
3752-
3753-void
3754-FWScreen::removeWindowFromList (FWWindowInputInfo *info)
3755-{
3756- mTransformedWindows.remove (info);
3757-}
3758-
3759-/* Adjust size and location of the input prevention window */
3760-void
3761-FWWindow::adjustIPW ()
3762-{
3763- XWindowChanges xwc;
3764- Display *dpy = screen->dpy ();
3765- float f_width, f_height;
3766-
3767- if (!mInput || !mInput->ipw)
3768- return;
3769-
3770- f_width = mInputRect.width ();
3771- f_height = mInputRect.height ();
3772-
3773- xwc.x = mInputRect.x ();
3774- xwc.y = mInputRect.y ();
3775- xwc.width = (int) f_width;
3776- xwc.height = (int) f_height;
3777- xwc.stack_mode = Below;
3778- /* XXX: This causes XConfigureWindow to break */
3779- //xwc.sibling = window->id ();
3780-
3781- XMapWindow (dpy, mInput->ipw);
3782-
3783- XConfigureWindow (dpy, mInput->ipw,
3784- CWStackMode | CWX | CWY | CWWidth | CWHeight,
3785- &xwc);
3786-
3787- shapeIPW ();
3788-}
3789-
3790-void
3791-FWScreen::adjustIPWStacking ()
3792-{
3793-
3794- foreach (FWWindowInputInfo *run, mTransformedWindows)
3795- {
3796- if (!run->w->prev || run->w->prev->id () != run->ipw)
3797- FWWindow::get (run->w)->adjustIPW ();
3798- }
3799-}
3800-
3801-/* Create an input prevention window */
3802-void
3803-FWWindow::createIPW ()
3804-{
3805- Window ipw;
3806- XSetWindowAttributes attrib;
3807- XWindowChanges xwc;
3808-
3809- if (!mInput || mInput->ipw)
3810- return;
3811-
3812- attrib.override_redirect = true;
3813- //attrib.event_mask = 0;
3814-
3815- xwc.x = mInputRect.x ();
3816- xwc.y = mInputRect.y ();
3817- xwc.width = mInputRect.width ();
3818- xwc.height = mInputRect.height ();
3819-
3820- ipw = XCreateWindow (screen->dpy (),
3821- screen->root (),
3822- xwc.x, xwc.y, xwc.width, xwc.height, 0, CopyFromParent, InputOnly,
3823- CopyFromParent, CWOverrideRedirect, &attrib);
3824-
3825- XMapWindow (screen->dpy (), ipw);
3826-
3827- //XConfigureWindow (screen->dpy (), ipw, CWStackMode | CWX | CWY | CWWidth | CWHeight, &xwc);
3828-
3829- mInput->ipw = ipw;
3830-
3831- //shapeIPW ();
3832-}
3833-
3834-FWWindowInputInfo::FWWindowInputInfo (CompWindow *window) :
3835- w (window),
3836- ipw (None),
3837- inputRects (NULL),
3838- nInputRects (0),
3839- inputRectOrdering (0),
3840- frameInputRects (NULL),
3841- frameNInputRects (0),
3842- frameInputRectOrdering (0)
3843-{
3844-}
3845-
3846-FWWindowInputInfo::~FWWindowInputInfo ()
3847-{
3848-}
3849-
3850-bool
3851-FWWindow::handleWindowInputInfo ()
3852-{
3853- FREEWINS_SCREEN (screen);
3854-
3855- if (!mTransformed && mInput)
3856- {
3857- if (mInput->ipw)
3858- XDestroyWindow (screen->dpy (), mInput->ipw);
3859-
3860- unshapeInput ();
3861- fws->removeWindowFromList (mInput);
3862-
3863- delete mInput;
3864- mInput = NULL;
3865-
3866- return false;
3867- }
3868- else if (mTransformed && !mInput)
3869- {
3870- mInput = new FWWindowInputInfo (window);
3871- if (!mInput)
3872- return false;
3873-
3874- shapeInput ();
3875- createIPW ();
3876- fws->addWindowToList (mInput);
3877- }
3878-
3879- return true;
3880-}
3881-
3882-/* Shape the input of the window when scaled.
3883- * Since the IPW will be dealing with the input, removing input
3884- * from the window entirely is a perfectly good solution. */
3885-void
3886-FWWindow::shapeInput ()
3887-{
3888- Window frame;
3889- Display *dpy = screen->dpy();
3890-
3891- saveInputShape (&mInput->inputRects,
3892- &mInput->nInputRects,
3893- &mInput->inputRectOrdering);
3894-
3895- frame = window->frame();
3896- if (frame)
3897- {
3898- saveInputShape (&mInput->frameInputRects, &mInput->frameNInputRects,
3899- &mInput->frameInputRectOrdering);
3900- }
3901- else
3902- {
3903- mInput->frameInputRects = NULL;
3904- mInput->frameNInputRects = -1;
3905- mInput->frameInputRectOrdering = 0;
3906- }
3907-
3908- /* clear shape */
3909- XShapeSelectInput (dpy, window->id(), NoEventMask);
3910- XShapeCombineRectangles (dpy, window->id(), ShapeInput, 0, 0,
3911- NULL, 0, ShapeSet, 0);
3912-
3913- if (frame)
3914- XShapeCombineRectangles (dpy, window->frame(), ShapeInput, 0, 0,
3915- NULL, 0, ShapeSet, 0);
3916-
3917- XShapeSelectInput (dpy, window->id(), ShapeNotify);
3918-}
3919-
3920-/* Restores the shape of the window:
3921- * If the window had a custom shape defined by inputRects then we restore
3922- * that in order with XShapeCombineRectangles.
3923- * Most windows have no specific defined shape so we can restore it with
3924- * setting the shape to a 0x0 mask
3925- */
3926-void
3927-FWWindow::unshapeInput ()
3928-{
3929- Display *dpy = screen->dpy ();
3930-
3931- if (mInput->nInputRects)
3932- {
3933- XShapeCombineRectangles (dpy, window->id(), ShapeInput, 0, 0,
3934- mInput->inputRects, mInput->nInputRects,
3935- ShapeSet, mInput->inputRectOrdering);
3936- }
3937- else
3938- {
3939- XShapeCombineMask (dpy, window->id(), ShapeInput, 0, 0, None, ShapeSet);
3940- }
3941-
3942- if (mInput->frameNInputRects >= 0)
3943- {
3944- if (mInput->frameNInputRects)
3945- {
3946- XShapeCombineRectangles (dpy, window->frame(), ShapeInput, 0, 0,
3947- mInput->frameInputRects,
3948- mInput->frameNInputRects,
3949- ShapeSet,
3950- mInput->frameInputRectOrdering);
3951- }
3952- else
3953- {
3954- XShapeCombineMask (dpy, window->frame(), ShapeInput, 0, 0, None, ShapeSet);
3955- }
3956- }
3957-}
3958
3959=== removed file 'plugins/freewins/src/paint.cpp'
3960--- plugins/freewins/src/paint.cpp 2013-02-20 14:24:30 +0000
3961+++ plugins/freewins/src/paint.cpp 1970-01-01 00:00:00 +0000
3962@@ -1,527 +0,0 @@
3963-/**
3964- * Compiz Fusion Freewins plugin
3965- *
3966- * paint.cpp
3967- *
3968- * Copyright (C) 2007 Rodolfo Granata <warlock.cc@gmail.com>
3969- *
3970- * This program is free software; you can redistribute it and/or
3971- * modify it under the terms of the GNU General Public License
3972- * as published by the Free Software Foundation; either version 2
3973- * of the License, or (at your option) any later version.
3974- *
3975- * This program is distributed in the hope that it will be useful,
3976- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3977- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3978- * GNU General Public License for more details.
3979- *
3980- * Author(s):
3981- * Rodolfo Granata <warlock.cc@gmail.com>
3982- * Sam Spilsbury <smspillaz@gmail.com>
3983- *
3984- * Button binding support and Reset added by:
3985- * enigma_0Z <enigma.0ZA@gmail.com>
3986- *
3987- * Most of the input handling here is based on
3988- * the shelf plugin by
3989- * : Kristian Lyngstøl <kristian@bohemians.org>
3990- * : Danny Baumann <maniac@opencompositing.org>
3991- *
3992- * Description:
3993- *
3994- * This plugin allows you to freely transform the texture of a window,
3995- * whether that be rotation or scaling to make better use of screen space
3996- * or just as a toy.
3997- *
3998- * Todo:
3999- * - Fully implement an input redirection system by
4000- * finding an inverse matrix, multiplying by it,
4001- * translating to the actual window co-ords and
4002- * XSendEvent() the co-ords to the actual window.
4003- * - Code could be cleaner
4004- * - Add timestep and speed options to animation
4005- * - Add window hover-over info via paintOutput : i.e
4006- * - Resize borders
4007- * - 'Reset' Button
4008- * - 'Scale' Button
4009- * - 'Rotate' Button
4010- */
4011-
4012-#include "freewins.h"
4013-
4014-
4015-/* ------ Window and Output Painting ------------------------------------*/
4016-
4017-/* Damage util function */
4018-
4019-void
4020-FWWindow::damageArea ()
4021-{
4022- CompositeScreen::get (screen)->damageRegion (mOutputRect);
4023-}
4024-
4025-/* Animation Prep */
4026-void
4027-FWScreen::preparePaint (int ms)
4028-{
4029- /* FIXME: should only loop over all windows if at least one animation is running */
4030- foreach (CompWindow *w, screen->windows ())
4031- {
4032- FREEWINS_WINDOW (w);
4033- float speed = optionGetSpeed ();
4034- fww->mAnimate.steps = ((float) ms / ((20.1 - speed) * 100));
4035-
4036- if (fww->mAnimate.steps < 0.005)
4037- fww->mAnimate.steps = 0.005;
4038-
4039- /* Animation. We calculate how much increment
4040- * a window must rotate / scale per paint by
4041- * using the set destination attributes minus
4042- * the old attributes divided by the time
4043- * remaining.
4044- */
4045-
4046- /* Don't animate if the window is saved */
4047- fww->mTransform.angX += (float) fww->mAnimate.steps * (fww->mAnimate.destAngX - fww->mTransform.angX) * speed;
4048- fww->mTransform.angY += (float) fww->mAnimate.steps * (fww->mAnimate.destAngY - fww->mTransform.angY) * speed;
4049- fww->mTransform.angZ += (float) fww->mAnimate.steps * (fww->mAnimate.destAngZ - fww->mTransform.angZ) * speed;
4050-
4051- fww->mTransform.scaleX += (float) fww->mAnimate.steps * (fww->mAnimate.destScaleX - fww->mTransform.scaleX) * speed;
4052- fww->mTransform.scaleY += (float) fww->mAnimate.steps * (fww->mAnimate.destScaleY - fww->mTransform.scaleY) * speed;
4053-
4054- if (((fww->mTransform.angX >= fww->mAnimate.destAngX - 0.05 &&
4055- fww->mTransform.angX <= fww->mAnimate.destAngX + 0.05 ) &&
4056- (fww->mTransform.angY >= fww->mAnimate.destAngY - 0.05 &&
4057- fww->mTransform.angY <= fww->mAnimate.destAngY + 0.05 ) &&
4058- (fww->mTransform.angZ >= fww->mAnimate.destAngZ - 0.05 &&
4059- fww->mTransform.angZ <= fww->mAnimate.destAngZ + 0.05 ) &&
4060- (fww->mTransform.scaleX >= fww->mAnimate.destScaleX - 0.00005 &&
4061- fww->mTransform.scaleX <= fww->mAnimate.destScaleX + 0.00005 ) &&
4062- (fww->mTransform.scaleY >= fww->mAnimate.destScaleY - 0.00005 &&
4063- fww->mTransform.scaleY <= fww->mAnimate.destScaleY + 0.00005 )))
4064- {
4065- fww->mResetting = FALSE;
4066-
4067- fww->mTransform.angX = fww->mAnimate.destAngX;
4068- fww->mTransform.angY = fww->mAnimate.destAngY;
4069- fww->mTransform.angZ = fww->mAnimate.destAngZ;
4070- fww->mTransform.scaleX = fww->mAnimate.destScaleX;
4071- fww->mTransform.scaleY = fww->mAnimate.destScaleY;
4072-
4073- fww->mTransform.unsnapAngX = fww->mAnimate.destAngX;
4074- fww->mTransform.unsnapAngY = fww->mAnimate.destAngY;
4075- fww->mTransform.unsnapAngZ = fww->mAnimate.destAngZ;
4076- fww->mTransform.unsnapScaleX = fww->mAnimate.destScaleX;
4077- fww->mTransform.unsnapScaleY = fww->mAnimate.destScaleX;
4078- }
4079- //else
4080- // fww->damageArea ();
4081- }
4082-
4083- cScreen->preparePaint (ms);
4084-}
4085-
4086-/* Paint the window rotated or scaled */
4087-bool
4088-FWWindow::glPaint (const GLWindowPaintAttrib &attrib,
4089- const GLMatrix &transform,
4090- const CompRegion &region,
4091- unsigned int mask)
4092-{
4093-
4094- GLMatrix wTransform (transform);
4095- int currentCull, invertCull;
4096- glGetIntegerv (GL_CULL_FACE_MODE, &currentCull);
4097- invertCull = (currentCull == GL_BACK) ? GL_FRONT : GL_BACK;
4098-
4099- bool status;
4100-
4101- FREEWINS_SCREEN (screen);
4102-
4103- /* Has something happened? */
4104-
4105- /* Check to see if we are painting on a transformed screen */
4106- /* Enable this code when we can animate between the two states */
4107-
4108- if ((mTransform.angX != 0.0 ||
4109- mTransform.angY != 0.0 ||
4110- mTransform.angZ != 0.0 ||
4111- mTransform.scaleX != 1.0 ||
4112- mTransform.scaleY != 1.0 ||
4113- mOldWinX != WIN_REAL_X (window) ||
4114- mOldWinY != WIN_REAL_Y (window)) && fws->optionGetShapeWindowTypes ().evaluate (window))
4115- {
4116- mOldWinX = WIN_REAL_X (window);
4117- mOldWinY = WIN_REAL_Y (window);
4118-
4119- /* Figure out where our 'origin' is, don't allow the origin to
4120- * be where we clicked if the window is not grabbed, etc
4121- */
4122-
4123- /* Here we duplicate some of the work the openGL does
4124- * but for different reasons. We have access to the
4125- * window's transformation matrix, so we will create
4126- * our own matrix and apply the same transformations
4127- * to it. From there, we create vectors for each point
4128- * that we wish to track and multiply them by this
4129- * matrix to give us the rotated / scaled co-ordinates.
4130- * From there, we project these co-ordinates onto the flat
4131- * screen that we have using the OGL viewport, projection
4132- * matrix and model matrix. Projection gives us three
4133- * co-ordinates, but we ignore Z and just use X and Y
4134- * to store in a surrounding rectangle. We can use this
4135- * surrounding rectangle to make things like shaping and
4136- * damage a lot more accurate than they used to be.
4137- */
4138-
4139- calculateOutputRect ();
4140-
4141- /* Prepare for transformation by
4142- * doing any necessary adjustments */
4143- float autoScaleX = 1.0f;
4144- float autoScaleY = 1.0f;
4145-
4146- if (fws->optionGetAutoZoom ())
4147- {
4148- float apparantWidth = mOutputRect.width ();
4149- float apparantHeight = mOutputRect.height ();
4150-
4151- autoScaleX = (float) WIN_OUTPUT_W (window) / (float) apparantWidth;
4152- autoScaleY = (float) WIN_OUTPUT_H (window) / (float) apparantHeight;
4153-
4154- if (autoScaleX >= 1.0f)
4155- autoScaleX = 1.0f;
4156- if (autoScaleY >= 1.0f)
4157- autoScaleY = 1.0f;
4158-
4159- autoScaleX = autoScaleY = (autoScaleX + autoScaleY) / 2;
4160-
4161- /* Because we modified the scale after calculating
4162- * the output rect, we need to recalculate again */
4163- calculateOutputRect ();
4164-
4165- }
4166- /*
4167- float scaleX = autoScaleX - (1 - mTransform.scaleX);
4168- float scaleY = autoScaleY - (1 - mTransform.scaleY);
4169- */
4170-
4171- /* Actually Transform the window */
4172- mask |= PAINT_WINDOW_TRANSFORMED_MASK;
4173-
4174- /* Adjust the window in the matrix to prepare for transformation */
4175- if (mGrab != grabRotate && mGrab != grabScale)
4176- {
4177-
4178- calculateInputOrigin (WIN_REAL_X (window) + WIN_REAL_W (window) / 2.0f,
4179- WIN_REAL_Y (window) + WIN_REAL_H (window) / 2.0f);
4180- calculateOutputOrigin (WIN_OUTPUT_X (window) + WIN_OUTPUT_W (window) / 2.0f,
4181- WIN_OUTPUT_Y (window) + WIN_OUTPUT_H (window) / 2.0f);
4182- }
4183-
4184- float adjustX = 0.0f;
4185- float adjustY = 0.0f;
4186- fws->modifyMatrix (wTransform,
4187- mTransform.angX,
4188- mTransform.angY,
4189- mTransform.angZ,
4190- mIMidX, mIMidY , 0.0f,
4191- mTransform.scaleX,
4192- mTransform.scaleY,
4193- 1.0f, adjustX, adjustY, TRUE);
4194-
4195- /* Create rects for input after we've dealt with output */
4196- calculateInputRect ();
4197-
4198- /* Determine if the window is inverted */
4199- Bool xInvert = FALSE;
4200- Bool yInvert = FALSE;
4201-
4202- Bool needsInvert = FALSE;
4203- float renX = fabs (fmodf (mTransform.angX, 360.0f));
4204- float renY = fabs (fmodf (mTransform.angY, 360.0f));
4205-
4206- if (90 < renX && renX < 270)
4207- xInvert = TRUE;
4208-
4209- if (90 < renY && renY < 270)
4210- yInvert = TRUE;
4211-
4212- if ((xInvert || yInvert) && !(xInvert && yInvert))
4213- needsInvert = TRUE;
4214-
4215- if (needsInvert)
4216- glCullFace (invertCull);
4217-
4218- status = gWindow->glPaint (attrib, wTransform, region, mask);
4219-
4220- if (needsInvert)
4221- glCullFace (currentCull);
4222-
4223- }
4224- else
4225- {
4226- status = gWindow->glPaint (attrib, wTransform, region, mask);
4227- }
4228-
4229- // Check if there are rotated windows
4230- if (!((mTransform.angX >= 0.0f - 0.05 &&
4231- mTransform.angX <= 0.0f + 0.05 ) &&
4232- (mTransform.angY >= 0.0f - 0.05 &&
4233- mTransform.angY <= 0.0f + 0.05 ) &&
4234- (mTransform.angZ >= 0.0f - 0.05 &&
4235- mTransform.angZ <= 0.0f + 0.05 ) &&
4236- (mTransform.scaleX >= 1.0f - 0.00005 &&
4237- mTransform.scaleX <= 1.0f + 0.00005 ) &&
4238- (mTransform.scaleY >= 1.0f - 0.00005 &&
4239- mTransform.scaleY <= 1.0f + 0.00005 )) && !mTransformed)
4240- mTransformed = TRUE;
4241- else if (mTransformed)
4242- mTransformed = FALSE;
4243-
4244- /* There is still animation to be done */
4245- if (!(((mTransform.angX >= mAnimate.destAngX - 0.05 &&
4246- mTransform.angX <= mAnimate.destAngX + 0.05 ) &&
4247- (mTransform.angY >= mAnimate.destAngY - 0.05 &&
4248- mTransform.angY <= mAnimate.destAngY + 0.05 ) &&
4249- (mTransform.angZ >= mAnimate.destAngZ - 0.05 &&
4250- mTransform.angZ <= mAnimate.destAngZ + 0.05 ) &&
4251- (mTransform.scaleX >= mAnimate.destScaleX - 0.00005 &&
4252- mTransform.scaleX <= mAnimate.destScaleX + 0.00005 ) &&
4253- (mTransform.scaleY >= mAnimate.destScaleY - 0.00005 &&
4254- mTransform.scaleY <= mAnimate.destScaleY + 0.00005 ))))
4255- {
4256- damageArea ();
4257- mIsAnimating = TRUE;
4258- }
4259- else if (mIsAnimating) /* We're done animating now, and we were animating */
4260- {
4261- if (handleWindowInputInfo ())
4262- adjustIPW ();
4263- mIsAnimating = FALSE;
4264- }
4265-
4266- return status;
4267-}
4268-
4269-/* Paint the window axis help onto the screen */
4270-bool
4271-FWScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
4272- const GLMatrix &transform,
4273- const CompRegion &region,
4274- CompOutput *output,
4275- unsigned int mask)
4276-{
4277- GLMatrix zTransform (transform);
4278-
4279- if (!mTransformedWindows.empty ())
4280- mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
4281-
4282- bool status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
4283-
4284- if (mAxisHelp && mHoverWindow)
4285- {
4286- int j;
4287- float x = WIN_REAL_X(mHoverWindow) + WIN_REAL_W(mHoverWindow)/2.0;
4288- float y = WIN_REAL_Y(mHoverWindow) + WIN_REAL_H(mHoverWindow)/2.0;
4289-
4290- FREEWINS_WINDOW (mHoverWindow);
4291-
4292- float zRad = fww->mRadius * (optionGetTdPercent () / 100);
4293-
4294- bool wasCulled = glIsEnabled (GL_CULL_FACE);
4295-
4296- zTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
4297-
4298- glPushMatrix ();
4299- glLoadMatrixf (zTransform.getMatrix ());
4300-
4301- if (wasCulled)
4302- glDisable (GL_CULL_FACE);
4303-
4304- if (optionGetShowCircle () && optionGetRotationAxis () == RotationAxisAlwaysCentre)
4305- {
4306- glColor4usv (optionGetCircleColor ());
4307- glEnable (GL_BLEND);
4308-
4309- glBegin (GL_POLYGON);
4310- for (j = 0; j < 360; j += 10)
4311- glVertex3f ( x + zRad * cos(D2R(j)), y + zRad * sin(D2R(j)), 0.0 );
4312- glEnd ();
4313-
4314- glDisable (GL_BLEND);
4315- glColor4usv (optionGetLineColor ());
4316- glLineWidth (3.0);
4317-
4318- glBegin (GL_LINE_LOOP);
4319- for (j = 360; j >= 0; j -= 10)
4320- glVertex3f ( x + zRad * cos(D2R(j)), y + zRad * sin(D2R(j)), 0.0 );
4321- glEnd ();
4322-
4323- glBegin (GL_LINE_LOOP);
4324- for (j = 360; j >= 0; j -= 10)
4325- glVertex3f( x + fww->mRadius * cos(D2R(j)), y + fww->mRadius * sin(D2R(j)), 0.0 );
4326- glEnd ();
4327-
4328- }
4329-
4330- /* Draw the 'gizmo' */
4331- if (optionGetShowGizmo ())
4332- {
4333- glPushMatrix ();
4334-
4335- glTranslatef (x, y, 0.0);
4336-
4337- glScalef (zRad, zRad, zRad / (float)screen->width ());
4338-
4339- glRotatef (fww->mTransform.angX, 1.0f, 0.0f, 0.0f);
4340- glRotatef (fww->mTransform.angY, 0.0f, 1.0f, 0.0f);
4341- glRotatef (fww->mTransform.angZ, 0.0f, 0.0f, 1.0f);
4342-
4343- glLineWidth (4.0f);
4344-
4345- for (int i = 0; i < 3; i++)
4346- {
4347- glPushMatrix ();
4348- glColor4f (1.0 * (i==0), 1.0 * (i==1), 1.0 * (i==2), 1.0);
4349- glRotatef (90.0, 1.0 * (i==0), 1.0 * (i==1), 1.0 * (i==2));
4350-
4351- glBegin (GL_LINE_LOOP);
4352- for (j=360; j>=0; j -= 10)
4353- glVertex3f ( cos (D2R (j)), sin (D2R (j)), 0.0 );
4354- glEnd ();
4355- glPopMatrix ();
4356- }
4357-
4358- glPopMatrix ();
4359- glColor4usv (defaultColor);
4360- }
4361-
4362- /* Draw the bounding box */
4363- if (optionGetShowRegion ())
4364- {
4365- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
4366- glEnable (GL_BLEND);
4367- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
4368- glRecti (fww->mInputRect.x1 (), fww->mInputRect.y1 (), fww->mInputRect.x2 (), fww->mInputRect.y2 ());
4369- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
4370- glBegin (GL_LINE_LOOP);
4371- glVertex2i (fww->mInputRect.x1 (), fww->mInputRect.y1 ());
4372- glVertex2i (fww->mInputRect.x2 (), fww->mInputRect.y1 ());
4373- glVertex2i (fww->mInputRect.x1 (), fww->mInputRect.y2 ());
4374- glVertex2i (fww->mInputRect.x2 (), fww->mInputRect.y2 ());
4375- glEnd ();
4376- glColor4usv (defaultColor);
4377- glDisable (GL_BLEND);
4378- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
4379- }
4380-
4381- if (optionGetShowCross ())
4382- {
4383-
4384- glColor4usv (optionGetCrossLineColor ());
4385- glBegin(GL_LINES);
4386- glVertex3f(x, y - (WIN_REAL_H (mHoverWindow) / 2), 0.0f);
4387- glVertex3f(x, y + (WIN_REAL_H (mHoverWindow) / 2), 0.0f);
4388- glEnd ();
4389-
4390- glBegin(GL_LINES);
4391- glVertex3f(x - (WIN_REAL_W (mHoverWindow) / 2), y, 0.0f);
4392- glVertex3f(x + (WIN_REAL_W (mHoverWindow) / 2), y, 0.0f);
4393- glEnd ();
4394-
4395- /* Move to our first corner (TopLeft) */
4396- if (fww->mInput)
4397- {
4398- glBegin(GL_LINES);
4399- glVertex3f(fww->mOutput.shapex1, fww->mOutput.shapey1, 0.0f);
4400- glVertex3f(fww->mOutput.shapex2, fww->mOutput.shapey2, 0.0f);
4401- glEnd ();
4402-
4403- glBegin(GL_LINES);
4404- glVertex3f(fww->mOutput.shapex2, fww->mOutput.shapey2, 0.0f);
4405- glVertex3f(fww->mOutput.shapex4, fww->mOutput.shapey4, 0.0f);
4406- glEnd ();
4407-
4408- glBegin(GL_LINES);
4409- glVertex3f(fww->mOutput.shapex4, fww->mOutput.shapey4, 0.0f);
4410- glVertex3f(fww->mOutput.shapex3, fww->mOutput.shapey3, 0.0f);
4411- glEnd ();
4412-
4413- glBegin(GL_LINES);
4414- glVertex3f(fww->mOutput.shapex3, fww->mOutput.shapey3, 0.0f);
4415- glVertex3f(fww->mOutput.shapex1, fww->mOutput.shapey1, 0.0f);
4416- glEnd ();
4417- }
4418- }
4419- if (wasCulled)
4420- glEnable(GL_CULL_FACE);
4421-
4422- glColor4usv(defaultColor);
4423- glPopMatrix ();
4424- }
4425-
4426- return status;
4427-}
4428-
4429-void
4430-FWScreen::donePaint ()
4431-{
4432-
4433- if (mAxisHelp && mHoverWindow)
4434- {
4435- FREEWINS_WINDOW (mHoverWindow);
4436-
4437- REGION region;
4438-
4439- region.rects = &region.extents;
4440- region.numRects = region.size = 1;
4441-
4442- region.extents.x1 = MIN (WIN_REAL_X (mHoverWindow),
4443- WIN_REAL_X (mHoverWindow)
4444- + WIN_REAL_W (mHoverWindow)
4445- / 2.0f - fww->mRadius);
4446- region.extents.x2 = MAX (WIN_REAL_X (mHoverWindow),
4447- WIN_REAL_X (mHoverWindow)
4448- + WIN_REAL_W (mHoverWindow)
4449- / 2.0f + fww->mRadius);
4450-
4451- region.extents.y1 = MIN (WIN_REAL_Y (mHoverWindow),
4452- WIN_REAL_Y (mHoverWindow)
4453- + WIN_REAL_H (mHoverWindow)
4454- / 2.0f - fww->mRadius);
4455- region.extents.y2 = MAX (WIN_REAL_Y (mHoverWindow),
4456- WIN_REAL_Y (mHoverWindow)
4457- + WIN_REAL_H (mHoverWindow)
4458- / 2.0f + fww->mRadius);
4459-
4460- CompRegion damageRegion (region.extents.x1, region.extents.y1, region.extents.x2 - region.extents.x1, region.extents.y2 - region.extents.y1);
4461-
4462- cScreen->damageRegion (damageRegion);
4463- }
4464-
4465- cScreen->donePaint ();
4466-}
4467-
4468-/* Damage the Window Rect */
4469-bool
4470-FWWindow::damageRect (bool initial,
4471- const CompRect &rect)
4472-{
4473- FREEWINS_SCREEN(screen);
4474-
4475- if (mTransformed)
4476- damageArea ();
4477-
4478- /**
4479- * Special situations where we must damage the screen
4480- * i.e when we are playing with windows and wobbly is
4481- * enabled
4482- */
4483-
4484- if ((mGrab == grabMove && !fws->optionGetImmediateMoves ())
4485- || (mIsAnimating || window->grabbed ()))
4486- fws->cScreen->damageScreen ();
4487-
4488- return cWindow->damageRect (initial, rect);
4489-}
4490
4491=== removed file 'plugins/freewins/src/util.cpp'
4492--- plugins/freewins/src/util.cpp 2013-02-20 14:24:30 +0000
4493+++ plugins/freewins/src/util.cpp 1970-01-01 00:00:00 +0000
4494@@ -1,526 +0,0 @@
4495-/**
4496- * Compiz Fusion Freewins plugin
4497- *
4498- * util.cpp
4499- *
4500- * Copyright (C) 2007 Rodolfo Granata <warlock.cc@gmail.com>
4501- *
4502- * This program is free software; you can redistribute it and/or
4503- * modify it under the terms of the GNU General Public License
4504- * as published by the Free Software Foundation; either version 2
4505- * of the License, or (at your option) any later version.
4506- *
4507- * This program is distributed in the hope that it will be useful,
4508- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4509- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4510- * GNU General Public License for more details.
4511- *
4512- * Author(s):
4513- * Rodolfo Granata <warlock.cc@gmail.com>
4514- * Sam Spilsbury <smspillaz@gmail.com>
4515- *
4516- * Button binding support and Reset added by:
4517- * enigma_0Z <enigma.0ZA@gmail.com>
4518- *
4519- * Most of the input handling here is based on
4520- * the shelf plugin by
4521- * : Kristian Lyngstøl <kristian@bohemians.org>
4522- * : Danny Baumann <maniac@opencompositing.org>
4523- *
4524- * Description:
4525- *
4526- * This plugin allows you to freely transform the texture of a window,
4527- * whether that be rotation or scaling to make better use of screen space
4528- * or just as a toy.
4529- *
4530- * Todo:
4531- * - Fully implement an input redirection system by
4532- * finding an inverse matrix, multiplying by it,
4533- * translating to the actual window co-ords and
4534- * XSendEvent() the co-ords to the actual window.
4535- * - Code could be cleaner
4536- * - Add timestep and speed options to animation
4537- * - Add window hover-over info via paintOutput : i.e
4538- * - Resize borders
4539- * - 'Reset' Button
4540- * - 'Scale' Button
4541- * - 'Rotate' Button
4542- */
4543-
4544-#include "freewins.h"
4545-
4546-
4547-/* ------ Utility Functions ---------------------------------------------*/
4548-
4549-/* Rotate and project individual vectors */
4550-void
4551-FWScreen::rotateProjectVector (GLVector &vector,
4552- GLMatrix &transform,
4553- GLdouble *resultX,
4554- GLdouble *resultY,
4555- GLdouble *resultZ)
4556-{
4557- vector = transform * vector;
4558-
4559- GLint viewport[4]; // Viewport
4560- GLdouble modelview[16]; // Modelview Matrix
4561- GLdouble projection[16]; // Projection Matrix
4562-
4563- glGetIntegerv (GL_VIEWPORT, viewport);
4564- glGetDoublev (GL_MODELVIEW_MATRIX, modelview);
4565- glGetDoublev (GL_PROJECTION_MATRIX, projection);
4566-
4567- gluProject (vector[GLVector::x], vector[GLVector::y], vector[GLVector::z],
4568- modelview, projection, viewport,
4569- resultX, resultY, resultZ);
4570-
4571- /* Y must be negated */
4572- *resultY = screen->height () - *resultY;
4573-}
4574-
4575-/* Scales z by 0 and does perspective distortion so that it
4576- * looks the same wherever on the screen
4577- *
4578- * This code taken from animation.c,
4579- * Copyright (c) 2006 Erkin Bahceci
4580- */
4581-void
4582-FWScreen::perspectiveDistortAndResetZ (GLMatrix &transform)
4583-{
4584- float v = -1.0 / ::screen->width ();
4585- /*
4586- This does
4587- transform = M * transform, where M is
4588- 1, 0, 0, 0,
4589- 0, 1, 0, 0,
4590- 0, 0, 0, v,
4591- 0, 0, 0, 1
4592- */
4593-
4594- transform[8] = v * transform[12];
4595- transform[9] = v * transform[13];
4596- transform[10] = v * transform[14];
4597- transform[11] = v * transform[15];
4598-}
4599-
4600-void
4601-FWScreen::modifyMatrix (GLMatrix &transform,
4602- float angX, float angY, float angZ,
4603- float tX, float tY, float tZ,
4604- float scX, float scY, float scZ,
4605- float adjustX, float adjustY, bool paint)
4606-{
4607- /* Create our transformation Matrix */
4608- transform.translate (tX, tY, 0.0);
4609- if (paint)
4610- perspectiveDistortAndResetZ (transform);
4611- else
4612- transform.scale (1.0f, 1.0f, 1.0f / screen->width ());
4613- transform.rotate (angX, 1.0f, 0.0f, 0.0f);
4614- transform.rotate (angY, 0.0f, 1.0f, 0.0f);
4615- transform.rotate (angZ, 0.0f, 0.0f, 1.0f);
4616- transform.scale (scX, 1.0f, 0.0f);
4617- transform.scale (1.0f, scY, 0.0f);
4618- transform.translate (-(tX), -(tY), 0.0f);
4619-}
4620-
4621-/*
4622-static float det3(float m00, float m01, float m02,
4623- float m10, float m11, float m12,
4624- float m20, float m21, float m22)
4625-{
4626- float ret = 0.0;
4627-
4628- ret += m00 * m11 * m22 - m21 * m12 * m00;
4629- ret += m01 * m12 * m20 - m22 * m10 * m01;
4630- ret += m02 * m10 * m21 - m20 * m11 * m02;
4631-
4632- return ret;
4633-}
4634-
4635-static void FWFindInverseMatrix(CompTransform *m, CompTransform *r)
4636-{
4637- float *mm = m->m;
4638- float d, c[16];
4639-
4640- d = mm[0] * det3(mm[5], mm[6], mm[7],
4641- mm[9], mm[10], mm[11],
4642- mm[13], mm[14], mm[15]) -
4643-
4644- mm[1] * det3(mm[4], mm[6], mm[7],
4645- mm[8], mm[10], mm[11],
4646- mm[12], mm[14], mm[15]) +
4647-
4648- mm[2] * det3(mm[4], mm[5], mm[7],
4649- mm[8], mm[9], mm[11],
4650- mm[12], mm[13], mm[15]) -
4651-
4652- mm[3] * det3(mm[4], mm[5], mm[6],
4653- mm[8], mm[9], mm[10],
4654- mm[12], mm[13], mm[14]);
4655-
4656- c[0] = det3(mm[5], mm[6], mm[7],
4657- mm[9], mm[10], mm[11],
4658- mm[13], mm[14], mm[15]);
4659- c[1] = -det3(mm[4], mm[6], mm[7],
4660- mm[8], mm[10], mm[11],
4661- mm[12], mm[14], mm[15]);
4662- c[2] = det3(mm[4], mm[5], mm[7],
4663- mm[8], mm[9], mm[11],
4664- mm[12], mm[13], mm[15]);
4665- c[3] = -det3(mm[4], mm[5], mm[6],
4666- mm[8], mm[9], mm[10],
4667- mm[12], mm[13], mm[14]);
4668-
4669- c[4] = -det3(mm[1], mm[2], mm[3],
4670- mm[9], mm[10], mm[11],
4671- mm[13], mm[14], mm[15]);
4672- c[5] = det3(mm[0], mm[2], mm[3],
4673- mm[8], mm[10], mm[11],
4674- mm[12], mm[14], mm[15]);
4675- c[6] = -det3(mm[0], mm[1], mm[3],
4676- mm[8], mm[9], mm[11],
4677- mm[12], mm[13], mm[15]);
4678- c[7] = det3(mm[0], mm[1], mm[2],
4679- mm[8], mm[9], mm[10],
4680- mm[12], mm[13], mm[14]);
4681-
4682- c[8] = det3(mm[1], mm[2], mm[3],
4683- mm[5], mm[6], mm[7],
4684- mm[13], mm[14], mm[15]);
4685- c[9] = -det3(mm[0], mm[2], mm[3],
4686- mm[4], mm[6], mm[7],
4687- mm[12], mm[14], mm[15]);
4688- c[10] = det3(mm[0], mm[1], mm[3],
4689- mm[4], mm[5], mm[7],
4690- mm[12], mm[13], mm[15]);
4691- c[11] = -det3(mm[0], mm[1], mm[2],
4692- mm[4], mm[5], mm[6],
4693- mm[12], mm[13], mm[14]);
4694-
4695- c[12] = -det3(mm[1], mm[2], mm[3],
4696- mm[5], mm[6], mm[7],
4697- mm[9], mm[10], mm[11]);
4698- c[13] = det3(mm[0], mm[2], mm[3],
4699- mm[4], mm[6], mm[7],
4700- mm[8], mm[10], mm[11]);
4701- c[14] = -det3(mm[0], mm[1], mm[3],
4702- mm[4], mm[5], mm[7],
4703- mm[8], mm[9], mm[11]);
4704- c[15] = det3(mm[0], mm[1], mm[2],
4705- mm[4], mm[5], mm[6],
4706- mm[8], mm[9], mm[10]);
4707-
4708- r->m[0] = c[0] / d;
4709- r->m[1] = c[4] / d;
4710- r->m[2] = c[8] / d;
4711- r->m[3] = c[12] / d;
4712-
4713- r->m[4] = c[1] / d;
4714- r->m[5] = c[5] / d;
4715- r->m[6] = c[9] / d;
4716- r->m[7] = c[13] / d;
4717-
4718- r->m[8] = c[2] / d;
4719- r->m[9] = c[6] / d;
4720- r->m[10] = c[10] / d;
4721- r->m[11] = c[14] / d;
4722-
4723- r->m[12] = c[3] / d;
4724- r->m[13] = c[7] / d;
4725- r->m[14] = c[11] / d;
4726- r->m[15] = c[15] / d;
4727-
4728- return;
4729-}
4730-*/
4731-
4732-/* Create a rect from 4 screen points */
4733-CompRect
4734-FWScreen::createSizedRect (float xScreen1,
4735- float xScreen2,
4736- float xScreen3,
4737- float xScreen4,
4738- float yScreen1,
4739- float yScreen2,
4740- float yScreen3,
4741- float yScreen4)
4742-{
4743- /* Left most point */
4744- float leftmost = xScreen1;
4745-
4746- if (xScreen2 <= leftmost)
4747- leftmost = xScreen2;
4748-
4749- if (xScreen3 <= leftmost)
4750- leftmost = xScreen3;
4751-
4752- if (xScreen4 <= leftmost)
4753- leftmost = xScreen4;
4754-
4755- /* Right most point */
4756- float rightmost = xScreen1;
4757-
4758- if (xScreen2 >= rightmost)
4759- rightmost = xScreen2;
4760-
4761- if (xScreen3 >= rightmost)
4762- rightmost = xScreen3;
4763-
4764- if (xScreen4 >= rightmost)
4765- rightmost = xScreen4;
4766-
4767- /* Top most point */
4768- float topmost = yScreen1;
4769-
4770- if (yScreen2 <= topmost)
4771- topmost = yScreen2;
4772-
4773- if (yScreen3 <= topmost)
4774- topmost = yScreen3;
4775-
4776- if (yScreen4 <= topmost)
4777- topmost = yScreen4;
4778-
4779- /* Bottom most point */
4780- float bottommost = yScreen1;
4781-
4782- if (yScreen2 >= bottommost)
4783- bottommost = yScreen2;
4784-
4785- if (yScreen3 >= bottommost)
4786- bottommost = yScreen3;
4787-
4788- if (yScreen4 >= bottommost)
4789- bottommost = yScreen4;
4790-/*
4791- Box rect;
4792- rect.x1 = leftmost;
4793- rect.x2 = rightmost;
4794- rect.y1 = topmost;
4795- rect.y2 = bottommost;
4796-*/
4797- return CompRect (leftmost, topmost, rightmost - leftmost, bottommost - topmost);
4798-}
4799-
4800-CompRect
4801-FWWindow::calculateWindowRect (GLVector c1,
4802- GLVector c2,
4803- GLVector c3,
4804- GLVector c4)
4805-{
4806- FREEWINS_SCREEN (screen);
4807-
4808- GLMatrix transform;
4809- GLdouble xScreen1 = 0.0f, yScreen1 = 0.0f, zScreen1 = 0.0f;
4810- GLdouble xScreen2 = 0.0f, yScreen2 = 0.0f, zScreen2 = 0.0f;
4811- GLdouble xScreen3 = 0.0f, yScreen3 = 0.0f, zScreen3 = 0.0f;
4812- GLdouble xScreen4 = 0.0f, yScreen4 = 0.0f, zScreen4 = 0.0f;
4813-
4814- transform.reset ();
4815- fws->modifyMatrix (transform,
4816- mTransform.angX,
4817- mTransform.angY,
4818- mTransform.angZ,
4819- mIMidX, mIMidY, 0.0f,
4820- mTransform.scaleX,
4821- mTransform.scaleY, 0.0f, 0.0f, 0.0f, false);
4822-
4823- fws->rotateProjectVector(c1, transform, &xScreen1, &yScreen1, &zScreen1);
4824- fws->rotateProjectVector(c2, transform, &xScreen2, &yScreen2, &zScreen2);
4825- fws->rotateProjectVector(c3, transform, &xScreen3, &yScreen3, &zScreen3);
4826- fws->rotateProjectVector(c4, transform, &xScreen4, &yScreen4, &zScreen4);
4827-
4828- /* Save the non-rectangular points so that we can shape the rectangular IPW */
4829-
4830- mOutput.shapex1 = xScreen1;
4831- mOutput.shapex2 = xScreen2;
4832- mOutput.shapex3 = xScreen3;
4833- mOutput.shapex4 = xScreen4;
4834- mOutput.shapey1 = yScreen1;
4835- mOutput.shapey2 = yScreen2;
4836- mOutput.shapey3 = yScreen3;
4837- mOutput.shapey4 = yScreen4;
4838-
4839-
4840- return fws->createSizedRect(xScreen1, xScreen2, xScreen3, xScreen4,
4841- yScreen1, yScreen2, yScreen3, yScreen4);
4842-}
4843-
4844-void
4845-FWWindow::calculateOutputRect ()
4846-{
4847- GLVector corner1 = GLVector (WIN_OUTPUT_X (window), WIN_OUTPUT_Y (window), 1.0f, 1.0f);
4848- GLVector corner2 = GLVector (WIN_OUTPUT_X (window) + WIN_OUTPUT_W (window), WIN_OUTPUT_Y (window), 1.0f, 1.0f);
4849- GLVector corner3 = GLVector (WIN_OUTPUT_X (window), WIN_OUTPUT_Y (window) + WIN_OUTPUT_H (window), 1.0f, 1.0f);
4850- GLVector corner4 = GLVector (WIN_OUTPUT_X (window) + WIN_OUTPUT_W (window), WIN_OUTPUT_Y (window) + WIN_OUTPUT_H (window), 1.0f, 1.0f);
4851-
4852- mOutputRect = calculateWindowRect (corner1, corner2, corner3, corner4);
4853-}
4854-
4855-void
4856-FWWindow::calculateInputRect ()
4857-{
4858- GLVector corner1 = GLVector (WIN_REAL_X (window), WIN_REAL_Y (window), 1.0f, 1.0f);
4859- GLVector corner2 = GLVector (WIN_REAL_X (window) + WIN_REAL_W (window), WIN_REAL_Y (window), 1.0f, 1.0f);
4860- GLVector corner3 = GLVector (WIN_REAL_X (window), WIN_REAL_Y (window) + WIN_REAL_H (window), 1.0f, 1.0f);
4861- GLVector corner4 = GLVector (WIN_REAL_X (window) + WIN_REAL_W (window), WIN_REAL_Y (window) + WIN_REAL_H (window), 1.0f, 1.0f);
4862-
4863- mInputRect = calculateWindowRect (corner1, corner2, corner3, corner4);
4864-}
4865-
4866-void
4867-FWWindow::calculateInputOrigin (float x, float y)
4868-{
4869- mIMidX = x;
4870- mIMidY = y;
4871-}
4872-
4873-void
4874-FWWindow::calculateOutputOrigin (float x, float y)
4875-{
4876- float dx, dy;
4877-
4878- dx = x - WIN_OUTPUT_X (window);
4879- dy = y - WIN_OUTPUT_Y (window);
4880-
4881- mOMidX = WIN_OUTPUT_X (window) + dx * mTransform.scaleX;
4882- mOMidY = WIN_OUTPUT_Y (window) + dy * mTransform.scaleY;
4883-}
4884-
4885-/* Change angles more than 360 into angles out of 360 */
4886-/*static int FWMakeIntoOutOfThreeSixty (int value)
4887-{
4888- while (value > 0)
4889- {
4890- value -= 360;
4891- }
4892-
4893- if (value < 0)
4894- value += 360;
4895-
4896- return value;
4897-}*/
4898-
4899-/* Determine if we clicked in the z-axis region */
4900-void
4901-FWWindow::determineZAxisClick (int px,
4902- int py,
4903- bool motion)
4904-{
4905- bool directionChange = FALSE;
4906-
4907- if (!mCan2D && motion)
4908- {
4909-
4910- static int steps;
4911-
4912- /* Check if we are going in a particular 3D direction
4913- * because if we are going left/right and we suddenly
4914- * change to 2D mode this would not be expected behaviour.
4915- * It is only if we have a change in direction that we want
4916- * to change to 2D rotation.
4917- */
4918-
4919- Direction direction, oldDirection = LeftRight;
4920-
4921- static int ddx, ddy;
4922-
4923- unsigned int dx = pointerX - lastPointerX;
4924- unsigned int dy = pointerY - lastPointerY;
4925-
4926- ddx += dx;
4927- ddy += dy;
4928-
4929- if (steps >= 10)
4930- {
4931- if (ddx > ddy)
4932- direction = LeftRight;
4933- else
4934- direction = UpDown;
4935-
4936- if (direction != oldDirection)
4937- directionChange = TRUE;
4938-
4939- direction = oldDirection;
4940- }
4941-
4942- steps++;
4943-
4944- }
4945- else
4946- directionChange = TRUE;
4947-
4948- if (directionChange)
4949- {
4950- float clickRadiusFromCenter;
4951-
4952- int x = (WIN_REAL_X(window) + WIN_REAL_W(window)/2.0);
4953- int y = (WIN_REAL_Y(window) + WIN_REAL_H(window)/2.0);
4954-
4955- clickRadiusFromCenter = sqrt(pow((x - px), 2) + pow((y - py), 2));
4956-
4957- if (clickRadiusFromCenter > mRadius * (FWScreen::get (screen)->optionGetTdPercent () / 100))
4958- {
4959- mCan2D = TRUE;
4960- mCan3D = FALSE;
4961- }
4962- else
4963- {
4964- mCan2D = FALSE;
4965- mCan3D = TRUE;
4966- }
4967- }
4968-}
4969-
4970-/* Check to see if we can shape a window */
4971-bool
4972-FWWindow::canShape ()
4973-{
4974- FREEWINS_SCREEN (screen);
4975-
4976- if (!fws->optionGetDoShapeInput ())
4977- return FALSE;
4978-
4979- if (!screen->XShape ())
4980- return FALSE;
4981-
4982- if (!fws->optionGetShapeWindowTypes ().evaluate (window))
4983- return FALSE;
4984-
4985- return TRUE;
4986-}
4987-
4988-/* Checks if w is a ipw and returns the real window */
4989-CompWindow *
4990-FWScreen::getRealWindow (CompWindow *w)
4991-{
4992- FWWindowInputInfo *info;
4993-
4994- foreach (info, mTransformedWindows)
4995- {
4996- if (w->id () == info->ipw)
4997- return info->w;
4998- }
4999-
5000- return NULL;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches