~kubuntu-netbook/kdelibs/ubuntu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
Index: kde4libs-4.3.0/plasma/CMakeLists.txt
===================================================================
--- kde4libs-4.3.0.orig/plasma/CMakeLists.txt	2009-08-05 18:40:46.000000000 +0200
+++ kde4libs-4.3.0/plasma/CMakeLists.txt	2009-08-05 18:40:49.000000000 +0200
@@ -103,6 +103,7 @@
     version.cpp
     view.cpp
     wallpaper.cpp
+    windoweffects.cpp
     widgets/checkbox.cpp
     widgets/combobox.cpp
     widgets/flashinglabel.cpp
@@ -211,6 +212,7 @@
     extendergroup.h
     extenderitem.h
     paintutils.h
+    windoweffects.h
     framesvg.h
     plasma.h
     plasma_export.h
Index: kde4libs-4.3.0/includes/CMakeLists.txt
===================================================================
--- kde4libs-4.3.0.orig/includes/CMakeLists.txt	2009-08-05 18:41:12.000000000 +0200
+++ kde4libs-4.3.0/includes/CMakeLists.txt	2009-08-05 18:41:35.000000000 +0200
@@ -1007,6 +1007,7 @@
   Plasma/Version
   Plasma/Wallpaper
   Plasma/WebView
+  Plasma/WindowEffects
   Plasma/VideoWidget
 DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma COMPONENT Devel)
 
Index: kde4libs-4.3.0/includes/Plasma/WindowEffects
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ kde4libs-4.3.0/includes/Plasma/WindowEffects	2009-08-05 18:41:59.000000000 +0200
@@ -0,0 +1 @@
+#include "../../plasma/windoweffects.h"
--- /dev/null	2009-07-22 05:21:08.000000000 +0100
+++ kde4libs-4.3.0/plasma/windoweffects.cpp	2009-08-06 12:06:07.000000000 +0100
@@ -0,0 +1,109 @@
+/*
+ *   Copyright 2009 Marco Martin <notmart@gmail.com>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as
+ *   published by the Free Software Foundation; either version 2, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "windoweffects.h"
+
+#include <QVarLengthArray>
+
+#include <kwindowsystem.h>
+
+#ifdef Q_WS_X11
+#include <X11/Xlib.h>
+#include <QX11Info>
+#endif
+
+namespace Plasma
+{
+
+namespace WindowEffects
+{
+
+void slideWindow(WId id, Plasma::Location location, int offset)
+{
+#ifdef Q_WS_X11
+    Display *dpy = QX11Info::display();
+    Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
+    QVarLengthArray<long, 1024> data(2);
+
+    data[0] = offset;
+
+    switch (location) {
+    case LeftEdge:
+        data[1] = 0;
+        break;
+    case TopEdge:
+        data[1] = 1;
+        break;
+    case RightEdge:
+        data[1] = 2;
+        break;
+    case BottomEdge:
+        data[1] = 3;
+    default:
+        break;
+    }
+
+    if (location == Desktop || location == Floating) {
+        XDeleteProperty(dpy, id, atom);
+    } else {
+        XChangeProperty(dpy, id, atom, atom, 32, PropModeReplace,
+                        reinterpret_cast<unsigned char *>(data.data()), data.size());
+    }
+#endif
+}
+
+void slideWindow(QWidget *widget, Plasma::Location location)
+{
+#ifdef Q_WS_X11
+    Display *dpy = QX11Info::display();
+    Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
+    QVarLengthArray<long, 1024> data(2);
+
+    switch (location) {
+    case LeftEdge:
+        data[0] = widget->geometry().left();
+        data[1] = 0;
+        break;
+    case TopEdge:
+        data[0] = widget->geometry().top();
+        data[1] = 1;
+        break;
+    case RightEdge:
+        data[0] = widget->geometry().right();
+        data[1] = 2;
+        break;
+    case BottomEdge:
+        data[0] = widget->geometry().bottom();
+        data[1] = 3;
+    default:
+        break;
+    }
+
+    if (location == Desktop || location == Floating) {
+        XDeleteProperty(dpy, widget->effectiveWinId(), atom);
+    } else {
+        XChangeProperty(dpy, widget->effectiveWinId(), atom, atom, 32, PropModeReplace,
+                        reinterpret_cast<unsigned char *>(data.data()), data.size());
+    }
+#endif
+}
+
+}
+
+}
--- /dev/null	2009-07-22 05:21:08.000000000 +0100
+++ kde4libs-4.3.0/plasma/windoweffects.h	2009-08-06 12:06:13.000000000 +0100
@@ -0,0 +1,64 @@
+/*
+ *   Copyright 2009 Marco Martin <notmart@gmail.com>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as
+ *   published by the Free Software Foundation; either version 2, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef PLASMA_WINDOWEFFECTS_H
+#define PLASMA_WINDOWEFFECTS_H
+
+#include <QtGui/QWidget>
+
+#include <plasma/plasma.h>
+
+/** @headerfile plasma/windoweffect.h <Plasma/PaintUtils> */
+
+namespace Plasma
+{
+
+/**
+ * Namespace for all window effects for Plasma/KWin interaction
+ * @since 4.4
+ */
+namespace WindowEffects
+{
+    /**
+     * Mark a window as sliding from screen edge
+     *
+     * @arg id of the window on which we want to apply the effect
+     * @arg location edge of the screen from which we want the slifing effect.
+     *               Desktop and FLoating won't have effect.
+     * @arg offset distance in pixels from the screen edge defined by location
+     * @since 4.4
+     */
+    PLASMA_EXPORT void slideWindow(WId id, Plasma::Location location, int offset);
+
+    /**
+     * Mark a window as sliding from screen edge
+     * This is an overloaded member function provided for convenience
+     *
+     * @arg widget QWidget corresponding to the top level window we want to animate
+     * @arg location edge of the screen from which we want the slifing effect.
+     *               Desktop and FLoating won't have effect.
+     * @since 4.4
+     */
+    PLASMA_EXPORT void slideWindow(QWidget *widget, Plasma::Location location);
+}
+
+} // namespace Plasma
+
+#endif
+