aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-11 00:00:32 (GMT)
committerfluxgen <fluxgen>2003-05-11 00:00:32 (GMT)
commit93b610edf4f4135b4251b58f8c7e588b07b04f1c (patch)
tree1b8492b8957b9b3ce4e86b2a6b5f2ab1162ca847
parent5c181abb77c5ac86468e177078ce57f98f0737ab (diff)
downloadfluxbox_paul-93b610edf4f4135b4251b58f8c7e588b07b04f1c.zip
fluxbox_paul-93b610edf4f4135b4251b58f8c7e588b07b04f1c.tar.bz2
update for FbRootWindow
-rw-r--r--util/bsetroot.cc77
1 files changed, 40 insertions, 37 deletions
diff --git a/util/bsetroot.cc b/util/bsetroot.cc
index 2e26531..2b87282 100644
--- a/util/bsetroot.cc
+++ b/util/bsetroot.cc
@@ -18,13 +18,13 @@
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 20
21// $Id: bsetroot.cc,v 1.16 2003/05/10 15:44:15 fluxgen Exp $ 21// $Id: bsetroot.cc,v 1.17 2003/05/11 00:00:32 fluxgen Exp $
22 22
23#include "bsetroot.hh" 23#include "bsetroot.hh"
24 24
25#include "../src/i18n.hh" 25#include "../src/i18n.hh"
26#include "../src/FbTk/ImageControl.hh" 26#include "../src/FbTk/ImageControl.hh"
27#include "../src/ScreenInfo.hh" 27#include "../src/FbRootWindow.hh"
28 28
29#ifdef HAVE_CONFIG_H 29#ifdef HAVE_CONFIG_H
30#include "config.h" 30#include "config.h"
@@ -161,15 +161,17 @@ void bsetroot::setRootAtoms(Pixmap pixmap, int screen) {
161 161
162 atom_root = XInternAtom(display(), "_XROOTMAP_ID", true); 162 atom_root = XInternAtom(display(), "_XROOTMAP_ID", true);
163 atom_eroot = XInternAtom(display(), "ESETROOT_PMAP_ID", true); 163 atom_eroot = XInternAtom(display(), "ESETROOT_PMAP_ID", true);
164 ScreenInfo screen_info(screen); 164 FbRootWindow root(screen);
165
165 // doing this to clean up after old background 166 // doing this to clean up after old background
166 if (atom_root != None && atom_eroot != None) { 167 if (atom_root != None && atom_eroot != None) {
167 XGetWindowProperty(display(), screen_info.getRootWindow(), 168
169 XGetWindowProperty(display(), root.window(),
168 atom_root, 0L, 1L, false, AnyPropertyType, 170 atom_root, 0L, 1L, false, AnyPropertyType,
169 &type, &format, &length, &after, &data_root); 171 &type, &format, &length, &after, &data_root);
170 172
171 if (type == XA_PIXMAP) { 173 if (type == XA_PIXMAP) {
172 XGetWindowProperty(display(), screen_info.getRootWindow(), 174 XGetWindowProperty(display(), root.window(),
173 atom_eroot, 0L, 1L, False, AnyPropertyType, 175 atom_eroot, 0L, 1L, False, AnyPropertyType,
174 &type, &format, &length, &after, &data_eroot); 176 &type, &format, &length, &after, &data_eroot);
175 177
@@ -190,9 +192,9 @@ void bsetroot::setRootAtoms(Pixmap pixmap, int screen) {
190 } 192 }
191 193
192 // setting new background atoms 194 // setting new background atoms
193 XChangeProperty(display(), screen_info.getRootWindow(), 195 XChangeProperty(display(), root.window(),
194 atom_root, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap, 1); 196 atom_root, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap, 1);
195 XChangeProperty(display(), screen_info.getRootWindow(), 197 XChangeProperty(display(), root.window(),
196 atom_eroot, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap, 1); 198 atom_eroot, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap, 1);
197 199
198} 200}
@@ -206,7 +208,7 @@ void bsetroot::solid() {
206 pixmaps = new Pixmap[ScreenCount(display())]; 208 pixmaps = new Pixmap[ScreenCount(display())];
207 209
208 for (; screen < ScreenCount(display()); screen++) { 210 for (; screen < ScreenCount(display()); screen++) {
209 ScreenInfo screen_info(screen); 211 FbRootWindow root(screen);
210 212
211 FbTk::Color c; 213 FbTk::Color c;
212 GC gc; 214 GC gc;
@@ -218,23 +220,23 @@ void bsetroot::solid() {
218 c.setPixel(BlackPixel(display(), screen)); 220 c.setPixel(BlackPixel(display(), screen));
219 221
220 gcv.foreground = c.pixel(); 222 gcv.foreground = c.pixel();
221 gc = XCreateGC(display(), screen_info.getRootWindow(), 223 gc = XCreateGC(display(), root.window(),
222 GCForeground , &gcv); 224 GCForeground , &gcv);
223 225
224 pixmaps[screen] = XCreatePixmap(display(), 226 pixmaps[screen] = XCreatePixmap(display(),
225 screen_info.getRootWindow(), 227 root.window(),
226 screen_info.getWidth(), screen_info.getHeight(), 228 root.width(), root.height(),
227 screen_info.getDepth()); 229 root.depth());
228 230
229 XFillRectangle(display(), pixmaps[screen], gc, 0, 0, 231 XFillRectangle(display(), pixmaps[screen], gc, 0, 0,
230 screen_info.getWidth(), screen_info.getHeight()); 232 root.width(), root.height());
231 233
232 setRootAtoms(pixmaps[screen], screen); 234 setRootAtoms(pixmaps[screen], screen);
233 235
234 XSetWindowBackgroundPixmap(display(), 236 XSetWindowBackgroundPixmap(display(),
235 screen_info.getRootWindow(), pixmaps[screen]); 237 root.window(), pixmaps[screen]);
236 238
237 XClearWindow(display(), screen_info.getRootWindow()); 239 XClearWindow(display(), root.window());
238 240
239 XFreeGC(display(), gc); 241 XFreeGC(display(), gc);
240 } 242 }
@@ -253,7 +255,7 @@ void bsetroot::modula(int x, int y) {
253 pixmaps = new Pixmap[ScreenCount(display())]; 255 pixmaps = new Pixmap[ScreenCount(display())];
254 256
255 for (pattern = 0, screen = 0; screen < ScreenCount(display()); screen++) { 257 for (pattern = 0, screen = 0; screen < ScreenCount(display()); screen++) {
256 ScreenInfo screen_info(screen); 258 FbRootWindow root(screen);
257 259
258 for (i = 0; i < 16; i++) { 260 for (i = 0; i < 16; i++) {
259 pattern <<= 1; 261 pattern <<= 1;
@@ -277,12 +279,12 @@ void bsetroot::modula(int x, int y) {
277 XGCValues gcv; 279 XGCValues gcv;
278 280
279 bitmap = XCreateBitmapFromData(display(), 281 bitmap = XCreateBitmapFromData(display(),
280 screen_info.getRootWindow(), data, 16, 16); 282 root.window(), data, 16, 16);
281 283
282 // bitmap used as tile, needs to have the same depth as background pixmap 284 // bitmap used as tile, needs to have the same depth as background pixmap
283 r_bitmap = XCreatePixmap(display(), 285 r_bitmap = XCreatePixmap(display(),
284 screen_info.getRootWindow(), 16, 16, 286 root.window(), 16, 16,
285 screen_info.getDepth()); 287 root.depth());
286 288
287 f.setFromString(fore, screen); 289 f.setFromString(fore, screen);
288 b.setFromString(back, screen); 290 b.setFromString(back, screen);
@@ -295,7 +297,7 @@ void bsetroot::modula(int x, int y) {
295 gcv.foreground = f.pixel(); 297 gcv.foreground = f.pixel();
296 gcv.background = b.pixel(); 298 gcv.background = b.pixel();
297 299
298 gc = XCreateGC(display(), screen_info.getRootWindow(), 300 gc = XCreateGC(display(), root.window(),
299 GCForeground | GCBackground, &gcv); 301 GCForeground | GCBackground, &gcv);
300 302
301 // copying bitmap to the one going to be used as tile 303 // copying bitmap to the one going to be used as tile
@@ -306,19 +308,19 @@ void bsetroot::modula(int x, int y) {
306 XSetFillStyle(display(), gc, FillTiled); 308 XSetFillStyle(display(), gc, FillTiled);
307 309
308 pixmaps[screen] = XCreatePixmap(display(), 310 pixmaps[screen] = XCreatePixmap(display(),
309 screen_info.getRootWindow(), 311 root.window(),
310 screen_info.getWidth(), screen_info.getHeight(), 312 root.width(), root.height(),
311 screen_info.getDepth()); 313 root.depth());
312 314
313 XFillRectangle(display(), pixmaps[screen], gc, 0, 0, 315 XFillRectangle(display(), pixmaps[screen], gc, 0, 0,
314 screen_info.getWidth(), screen_info.getHeight()); 316 root.width(), root.height());
315 317
316 setRootAtoms(pixmaps[screen], screen); 318 setRootAtoms(pixmaps[screen], screen);
317 319
318 XSetWindowBackgroundPixmap(display(), 320 XSetWindowBackgroundPixmap(display(),
319 screen_info.getRootWindow(), pixmaps[screen]); 321 root.window(), pixmaps[screen]);
320 322
321 XClearWindow(display(), screen_info.getRootWindow()); 323 XClearWindow(display(), root.window());
322 324
323 XFreeGC(display(), gc); 325 XFreeGC(display(), gc);
324 XFreePixmap(display(), bitmap); 326 XFreePixmap(display(), bitmap);
@@ -337,7 +339,8 @@ void bsetroot::gradient(void) {
337 pixmaps = new Pixmap[ScreenCount(display())]; 339 pixmaps = new Pixmap[ScreenCount(display())];
338 340
339 for (int screen = 0; screen < ScreenCount(display()); screen++) { 341 for (int screen = 0; screen < ScreenCount(display()); screen++) {
340 ScreenInfo screen_info(screen); 342 FbRootWindow root(screen);
343
341 FbTk::Texture texture; 344 FbTk::Texture texture;
342 GC gc; 345 GC gc;
343 XGCValues gcv; 346 XGCValues gcv;
@@ -351,29 +354,29 @@ void bsetroot::gradient(void) {
351 if (! texture.colorTo().isAllocated()) 354 if (! texture.colorTo().isAllocated())
352 texture.colorTo().setPixel(BlackPixel(display(), screen)); 355 texture.colorTo().setPixel(BlackPixel(display(), screen));
353 356
354 tmp = img_ctrl[screen]->renderImage(screen_info.getWidth(), 357 tmp = img_ctrl[screen]->renderImage(root.width(),
355 screen_info.getHeight(), texture); 358 root.height(), texture);
356 359
357 pixmaps[screen] = XCreatePixmap(display(), 360 pixmaps[screen] = XCreatePixmap(display(),
358 screen_info.getRootWindow(), 361 root.window(),
359 screen_info.getWidth(), screen_info.getHeight(), 362 root.width(), root.height(),
360 screen_info.getDepth()); 363 root.depth());
361 364
362 gc = XCreateGC(display(), screen_info.getRootWindow(), 365 gc = XCreateGC(display(), root.window(),
363 GCForeground , &gcv); 366 GCForeground , &gcv);
364 367
365 XCopyArea(display(), tmp, pixmaps[screen], gc, 0, 0, 368 XCopyArea(display(), tmp, pixmaps[screen], gc, 0, 0,
366 screen_info.getWidth(), screen_info.getHeight(), 369 root.width(), root.height(),
367 0, 0); 370 0, 0);
368 371
369 setRootAtoms(pixmaps[screen], screen); 372 setRootAtoms(pixmaps[screen], screen);
370 373
371 XSetWindowBackgroundPixmap(display(), 374 XSetWindowBackgroundPixmap(display(),
372 screen_info.getRootWindow(), pixmaps[screen]); 375 root.window(), pixmaps[screen]);
373 376
374 XClearWindow(display(), screen_info.getRootWindow()); 377 XClearWindow(display(), root.window());
375 378
376 if (! (screen_info.getVisual()->c_class & 1)) { 379 if (! (root.visual()->c_class & 1)) {
377 img_ctrl[screen]->removeImage(tmp); 380 img_ctrl[screen]->removeImage(tmp);
378 img_ctrl[screen]->timeout(); 381 img_ctrl[screen]->timeout();
379 } 382 }