File: fix-background-blend-for-tile-and-stretch.patch

package info (click to toggle)
slim 1.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,768 kB
  • sloc: cpp: 4,383; sh: 202; makefile: 23
file content (42 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download
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
Description: backgound.png with alpha: blend with bg-colour in 'tile' and 'stretch'
             (temporary, intended for upstream slim-1.4.0)
Author: T.Fischer

--- a/panel.cpp
+++ b/panel.cpp
@@ -129,22 +129,22 @@
 		}
 	}
 
-	if (bgstyle == "stretch")
+	string hexvalue = cfg->getOption("background_color");
+	hexvalue = hexvalue.substr(1,6);
+	// Center() before Resize() and Tile(): blend bgImg to bg_color
+	if (bgstyle == "stretch") {
+		bgImg->Center(bgImg->Width(), bgImg->Height(), hexvalue.c_str());
 		bgImg->Resize(viewport.width, viewport.height);
-	else if (bgstyle == "tile")
+	}
+	else if (bgstyle == "tile") {
+		bgImg->Center(bgImg->Width(), bgImg->Height(), hexvalue.c_str());
 		bgImg->Tile(viewport.width, viewport.height);
+	}
 	else if (bgstyle == "center") {
-		string hexvalue = cfg->getOption("background_color");
-		hexvalue = hexvalue.substr(1,6);
-		bgImg->Center(viewport.width,
-			viewport.height,
-			hexvalue.c_str());
-	} else { // plain color or error
-		string hexvalue = cfg->getOption("background_color");
-		hexvalue = hexvalue.substr(1,6);
-		bgImg->Center(viewport.width,
-			viewport.height,
-			hexvalue.c_str());
+		bgImg->Center(viewport.width, viewport.height, hexvalue.c_str());
+	}
+	else { // plain color or error
+		bgImg->Center(viewport.width, viewport.height, hexvalue.c_str());
 	}
 
 	string cfgX = cfg->getOption("input_panel_x");