aboutsummaryrefslogtreecommitdiff
path: root/util/fbrun/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'util/fbrun/main.cc')
-rw-r--r--util/fbrun/main.cc24
1 files changed, 13 insertions, 11 deletions
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();