1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: background.C - former xpm.C |
2 | * File: background.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2005-2008 Marc Lehmann <schmorp@schmorp.de> |
6 | * Copyright (c) 2005-2008 Marc Lehmann <schmorp@schmorp.de> |
7 | * Copyright (c) 2007 Sasha Vasko <sasha@aftercode.net> |
7 | * Copyright (c) 2007 Sasha Vasko <sasha@aftercode.net> |
… | |
… | |
345 | v_align = defaultAlign; |
345 | v_align = defaultAlign; |
346 | |
346 | |
347 | img = 0; |
347 | img = 0; |
348 | } |
348 | } |
349 | |
349 | |
350 | bool |
350 | void |
351 | rxvt_image::set_file_geometry (rxvt_screen *s, const char *file) |
351 | rxvt_image::set_file_geometry (rxvt_screen *s, const char *file) |
352 | { |
352 | { |
353 | if (!file || !*file) |
353 | if (!file || !*file) |
354 | return false; |
354 | return; |
355 | |
355 | |
356 | const char *p = strchr (file, ';'); |
356 | const char *p = strchr (file, ';'); |
357 | |
357 | |
358 | if (p) |
358 | if (p) |
359 | { |
359 | { |
… | |
… | |
362 | memcpy (f, file, len); |
362 | memcpy (f, file, len); |
363 | f[len] = '\0'; |
363 | f[len] = '\0'; |
364 | file = f; |
364 | file = f; |
365 | } |
365 | } |
366 | |
366 | |
367 | bool ret = set_file (s, file); |
367 | set_file (s, file); |
368 | alpha = 0x8000; |
368 | alpha = 0x8000; |
369 | if (ret) |
|
|
370 | set_geometry (p ? p + 1 : ""); |
369 | set_geometry (p ? p + 1 : ""); |
371 | return ret; |
|
|
372 | } |
370 | } |
373 | |
371 | |
374 | bool |
372 | void |
375 | rxvt_image::set_file (rxvt_screen *s, const char *file) |
373 | rxvt_image::set_file (rxvt_screen *s, const char *file) |
376 | { |
374 | { |
|
|
375 | rxvt_img *img2 = rxvt_img::new_from_file (s, file); |
377 | delete img; |
376 | delete img; |
378 | img = rxvt_img::new_from_file (s, file); |
377 | img = img2; |
379 | return img != 0; |
|
|
380 | } |
378 | } |
381 | |
379 | |
382 | # endif /* BG_IMAGE_FROM_FILE */ |
380 | # endif /* BG_IMAGE_FROM_FILE */ |
383 | |
381 | |
384 | bool |
382 | bool |
… | |
… | |
539 | } |
537 | } |
540 | |
538 | |
541 | void |
539 | void |
542 | rxvt_term::bg_init () |
540 | rxvt_term::bg_init () |
543 | { |
541 | { |
|
|
542 | #if ENABLE_TRANSPARENCY |
|
|
543 | if (option (Opt_transparent)) |
|
|
544 | { |
|
|
545 | bg_set_transparent (); |
|
|
546 | |
|
|
547 | if (rs [Rs_blurradius]) |
|
|
548 | root_effects.set_blur (rs [Rs_blurradius]); |
|
|
549 | |
|
|
550 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
551 | root_effects.set_tint (pix_colors_focused [Color_tint]); |
|
|
552 | |
|
|
553 | if (rs [Rs_shade]) |
|
|
554 | root_effects.set_shade (rs [Rs_shade]); |
|
|
555 | |
|
|
556 | bg_set_root_pixmap (); |
|
|
557 | XSelectInput (dpy, display->root, PropertyChangeMask); |
|
|
558 | rootwin_ev.start (display, display->root); |
|
|
559 | } |
|
|
560 | #endif |
|
|
561 | |
544 | #if BG_IMAGE_FROM_FILE |
562 | #if BG_IMAGE_FROM_FILE |
545 | if (rs[Rs_backgroundPixmap]) |
563 | if (rs[Rs_backgroundPixmap]) |
546 | { |
564 | { |
547 | if (fimage.set_file_geometry (this, rs[Rs_backgroundPixmap]) |
565 | fimage.set_file_geometry (this, rs[Rs_backgroundPixmap]); |
548 | && !bg_window_position_sensitive ()) |
566 | if (!bg_window_position_sensitive ()) |
549 | update_background (); |
567 | update_background (); |
550 | } |
568 | } |
551 | #endif |
569 | #endif |
552 | } |
570 | } |
553 | |
571 | |