diff options
Diffstat (limited to 'src/RootTheme.cc')
-rw-r--r-- | src/RootTheme.cc | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/src/RootTheme.cc b/src/RootTheme.cc index c171c85..96f13d5 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc | |||
@@ -157,60 +157,15 @@ void RootTheme::reconfigTheme() { | |||
157 | FbRootWindow rootwin(screenNum()); | 157 | FbRootWindow rootwin(screenNum()); |
158 | 158 | ||
159 | // if the background theme item was not loaded | 159 | // if the background theme item was not loaded |
160 | // then generate an image with a text that | ||
161 | // notifies the user about it | ||
162 | 160 | ||
163 | if (!m_background_loaded) { | 161 | if (!m_background_loaded) { |
164 | 162 | const char *warning_msg = | |
165 | // get the pixmap, force update of pixmap (needed if this is the first time) | ||
166 | FbTk::FbPixmap root(FbTk::FbPixmap::getRootPixmap(screenNum(), true)); | ||
167 | |||
168 | // render text | ||
169 | static const char *warning_msg = | ||
170 | _FBTEXT(Common, BackgroundWarning, | 163 | _FBTEXT(Common, BackgroundWarning, |
171 | "There is no background option specified in this style." | 164 | "There is no background option specified in this style." |
172 | " Please consult the manual or read the FAQ.", | 165 | " Please consult the manual or read the FAQ.", |
173 | "Background missing warning"); | 166 | "Background missing warning"); |
174 | 167 | ||
175 | // if there is no root background pixmap...do nothing | ||
176 | if (root.drawable() == None) { | ||
177 | FbCommands::ExecuteCmd cmd("fbsetroot -solid darkgreen", screenNum()); | ||
178 | // wait for command to finish | ||
179 | waitpid(cmd.run(), NULL, 0); | ||
180 | // pixmap setting done. Force update of pixmaps | ||
181 | root = FbTk::FbPixmap::getRootPixmap(screenNum(), true); | ||
182 | |||
183 | // The command could fail and not set the background... | ||
184 | // so if the drawable is still none then just dont do anything more | ||
185 | // but we still output warning msg to the console/log | ||
186 | if (root.drawable() == None) { | ||
187 | cerr<<"Fluxbox: "<<warning_msg<<endl; | ||
188 | return; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | |||
193 | FbTk::GContext gc(root); | ||
194 | // fill rectangle | ||
195 | gc.setForeground(FbTk::Color("black", screenNum())); | ||
196 | FbTk::Font font; | ||
197 | root.fillRectangle(gc.gc(), 0, 0, | ||
198 | font.textWidth(warning_msg, strlen(warning_msg)) + 4, | ||
199 | font.height() + 4); | ||
200 | // text color | ||
201 | gc.setForeground(FbTk::Color("white", screenNum())); | ||
202 | |||
203 | font.drawText(root, screenNum(), gc.gc(), | ||
204 | warning_msg, strlen(warning_msg), | ||
205 | 2, font.height() + 2); // added some extra pixels for better visibility | ||
206 | // output same msg to the log | ||
207 | cerr<<"Fluxbox: "<<warning_msg<<endl; | 168 | cerr<<"Fluxbox: "<<warning_msg<<endl; |
208 | |||
209 | // reset background mark | ||
210 | m_background_loaded = true; | ||
211 | root.release(); // we dont want to destroy this pixmap | ||
212 | |||
213 | rootwin.clear(); | ||
214 | 169 | ||
215 | } else { | 170 | } else { |
216 | // handle background option in style | 171 | // handle background option in style |