aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/fbrun/FbRun.cc8
-rw-r--r--util/fbrun/main.cc24
-rw-r--r--util/fbsetroot.cc25
3 files changed, 34 insertions, 23 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc
index c175e67..7797f76 100644
--- a/util/fbrun/FbRun.cc
+++ b/util/fbrun/FbRun.cc
@@ -49,7 +49,13 @@
49#include <fstream> 49#include <fstream>
50#include <algorithm> 50#include <algorithm>
51 51
52using namespace std; 52using std::cerr;
53using std::endl;
54using std::string;
55using std::fstream;
56using std::ifstream;
57using std::ofstream;
58using std::ios;
53 59
54FbRun::FbRun(int x, int y, size_t width): 60FbRun::FbRun(int x, int y, size_t width):
55 FbTk::TextBox(DefaultScreen(FbTk::App::instance()->display()), 61 FbTk::TextBox(DefaultScreen(FbTk::App::instance()->display()),
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc
index 878b5eb..e5d3e2f 100644
--- a/util/fbrun/main.cc
+++ b/util/fbrun/main.cc
@@ -35,7 +35,9 @@ extern "C" {
35#include <string> 35#include <string>
36#include <iostream> 36#include <iostream>
37 37
38using namespace std; 38using std::cerr;
39using std::endl;
40using std::string;
39 41
40void showUsage(const char *progname) { 42void showUsage(const char *progname) {
41 cerr<<"fbrun 1.5 : (c) 2002-2004 Henrik Kinnunen"<<endl; 43 cerr<<"fbrun 1.5 : (c) 2002-2004 Henrik Kinnunen"<<endl;
@@ -81,7 +83,7 @@ int main(int argc, char **argv) {
81 } else if (strcmp(argv[i], "-text") == 0 && i+1 < argc) { 83 } else if (strcmp(argv[i], "-text") == 0 && i+1 < argc) {
82 text = argv[++i]; 84 text = argv[++i];
83 } else if (strcmp(argv[i], "-w") == 0 && i+1 < argc) { 85 } else if (strcmp(argv[i], "-w") == 0 && i+1 < argc) {
84 width = atoi(argv[++i]); 86 width = atoi(argv[++i]);
85 set_width = true; 87 set_width = true;
86 } else if (strcmp(argv[i], "-h") == 0 && i+1 < argc) { 88 } else if (strcmp(argv[i], "-h") == 0 && i+1 < argc) {
87 height = atoi(argv[++i]); 89 height = atoi(argv[++i]);
@@ -115,7 +117,7 @@ int main(int argc, char **argv) {
115 } 117 }
116 118
117 try { 119 try {
118 120
119 FbTk::App application(display_name.c_str()); 121 FbTk::App application(display_name.c_str());
120 FbRun fbrun; 122 FbRun fbrun;
121 123
@@ -131,7 +133,7 @@ int main(int argc, char **argv) {
131 // get color 133 // get color
132 FbTk::Color fg_color(foreground.c_str(), 0); 134 FbTk::Color fg_color(foreground.c_str(), 0);
133 FbTk::Color bg_color(background.c_str(), 0); 135 FbTk::Color bg_color(background.c_str(), 0);
134 136
135 fbrun.setForegroundColor(fg_color); 137 fbrun.setForegroundColor(fg_color);
136 fbrun.setBackgroundColor(bg_color); 138 fbrun.setBackgroundColor(bg_color);
137 139
@@ -148,17 +150,17 @@ int main(int argc, char **argv) {
148 150
149 fbrun.setTitle(title); 151 fbrun.setTitle(title);
150 fbrun.setText(text); 152 fbrun.setText(text);
151 153
152 if (near_mouse) { 154 if (near_mouse) {
153 155
154 int wx, wy; 156 int wx, wy;
155 unsigned int mask; 157 unsigned int mask;
156 Window ret_win; 158 Window ret_win;
157 Window child_win; 159 Window child_win;
158 160
159 Display* dpy = FbTk::App::instance()->display(); 161 Display* dpy = FbTk::App::instance()->display();
160 162
161 if (XQueryPointer(dpy, DefaultRootWindow(dpy), 163 if (XQueryPointer(dpy, DefaultRootWindow(dpy),
162 &ret_win, &child_win, 164 &ret_win, &child_win,
163 &x, &y, &wx, &wy, &mask)) { 165 &x, &y, &wx, &wy, &mask)) {
164 166
@@ -202,12 +204,12 @@ int main(int argc, char **argv) {
202 y = root_y + root_h - fbrun.height(); 204 y = root_y + root_h - fbrun.height();
203 } 205 }
204 } 206 }
205 207
206 if (set_pos) 208 if (set_pos)
207 fbrun.move(x, y); 209 fbrun.move(x, y);
208 210
209 fbrun.lockPosition(set_pos); 211 fbrun.lockPosition(set_pos);
210 212
211 fbrun.show(); 213 fbrun.show();
212 214
213 application.eventLoop(); 215 application.eventLoop();
diff --git a/util/fbsetroot.cc b/util/fbsetroot.cc
index 54f5adb..9d2cf73 100644
--- a/util/fbsetroot.cc
+++ b/util/fbsetroot.cc
@@ -50,7 +50,10 @@
50#endif 50#endif
51#include <iostream> 51#include <iostream>
52 52
53using namespace std; 53using std::cout;
54using std::cerr;
55using std::endl;
56using std::string;
54 57
55fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name) 58fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name)
56 : FbTk::App(dpy_name), m_app_name(argv[0]) { 59 : FbTk::App(dpy_name), m_app_name(argv[0]) {
@@ -118,7 +121,7 @@ fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name)
118 121
119 if ((mod + sol + grd) != true) { 122 if ((mod + sol + grd) != true) {
120 _FB_USES_NLS; 123 _FB_USES_NLS;
121 cerr << _FB_CONSOLETEXT(fbsetroot, MustSpecify, 124 cerr << _FB_CONSOLETEXT(fbsetroot, MustSpecify,
122 "Error: must specify one of: -solid, -mod, -gradient\n", 125 "Error: must specify one of: -solid, -mod, -gradient\n",
123 "user didn't give one of the required options") << endl; 126 "user didn't give one of the required options") << endl;
124 127
@@ -172,10 +175,10 @@ void fbsetroot::setRootAtoms(Pixmap pixmap, int screen) {
172 if (type == XA_PIXMAP) { 175 if (type == XA_PIXMAP) {
173 root.property(atom_eroot, 0L, 1L, False, AnyPropertyType, 176 root.property(atom_eroot, 0L, 1L, False, AnyPropertyType,
174 &type, &format, &length, &after, &data_eroot); 177 &type, &format, &length, &after, &data_eroot);
175 178
176 if (data_root && data_eroot && type == XA_PIXMAP && 179 if (data_root && data_eroot && type == XA_PIXMAP &&
177 *((Pixmap *) data_root) == *((Pixmap *) data_eroot)) { 180 *((Pixmap *) data_root) == *((Pixmap *) data_eroot)) {
178 181
179 XKillClient(display(), *((Pixmap *) data_root)); 182 XKillClient(display(), *((Pixmap *) data_root));
180 } 183 }
181 } 184 }
@@ -197,7 +200,7 @@ void fbsetroot::setRootAtoms(Pixmap pixmap, int screen) {
197} 200}
198 201
199/** 202/**
200 Draws pixmaps with a single color 203 Draws pixmaps with a single color
201*/ 204*/
202void fbsetroot::solid() { 205void fbsetroot::solid() {
203 FbTk::Color c(fore, screen); 206 FbTk::Color c(fore, screen);
@@ -209,7 +212,7 @@ void fbsetroot::solid() {
209 FbTk::GContext gc(root); 212 FbTk::GContext gc(root);
210 gc.setForeground(c); 213 gc.setForeground(c);
211 214
212 pixmap = new Pixmap(XCreatePixmap(display(), 215 pixmap = new Pixmap(XCreatePixmap(display(),
213 root.window(), 216 root.window(),
214 root.width(), root.height(), 217 root.width(), root.height(),
215 root.depth())); 218 root.depth()));
@@ -282,7 +285,7 @@ void fbsetroot::modula(int x, int y) {
282 gc.setTile(r_bitmap); 285 gc.setTile(r_bitmap);
283 gc.setFillStyle(FillTiled); 286 gc.setFillStyle(FillTiled);
284 287
285 pixmap = new Pixmap(XCreatePixmap(display(), 288 pixmap = new Pixmap(XCreatePixmap(display(),
286 root.window(), 289 root.window(),
287 root.width(), root.height(), 290 root.width(), root.height(),
288 root.depth())); 291 root.depth()));
@@ -328,7 +331,7 @@ void fbsetroot::gradient() {
328 331
329 tmp = img_ctrl->renderImage(root.width(), root.height(), texture); 332 tmp = img_ctrl->renderImage(root.width(), root.height(), texture);
330 333
331 pixmap = new Pixmap(XCreatePixmap(display(), 334 pixmap = new Pixmap(XCreatePixmap(display(),
332 root.window(), 335 root.window(),
333 root.width(), root.height(), 336 root.width(), root.height(),
334 root.depth())); 337 root.depth()));
@@ -376,9 +379,9 @@ void fbsetroot::usage(int exit_code) {
376int main(int argc, char **argv) { 379int main(int argc, char **argv) {
377 char *display_name = (char *) 0; 380 char *display_name = (char *) 0;
378 int i = 1; 381 int i = 1;
379 382
380 FbTk::NLSInit("fluxbox.cat"); 383 FbTk::NLSInit("fluxbox.cat");
381 384
382 for (; i < argc; i++) { 385 for (; i < argc; i++) {
383 if (! strcmp(argv[i], "-display")) { 386 if (! strcmp(argv[i], "-display")) {
384 // check for -display option 387 // check for -display option
@@ -398,7 +401,7 @@ int main(int argc, char **argv) {
398 401
399 try { 402 try {
400 fbsetroot app(argc, argv, display_name); 403 fbsetroot app(argc, argv, display_name);
401 } catch (std::string error_str) { 404 } catch (string error_str) {
402 _FB_USES_NLS; 405 _FB_USES_NLS;
403 cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl; 406 cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl;
404 } 407 }