summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--util/fbrun/main.cc30
2 files changed, 31 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fc5470b..ed92e75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.11 2Changes for 0.9.11
3*04/09/03:
4 * Added -nearmouse to FbRun (Mathias)
5 main.cc
3*04/09/02: 6*04/09/02:
4 * Fix crash when in windowmenu->submenu and closing the app (Mathias) 7 * Fix crash when in windowmenu->submenu and closing the app (Mathias)
5 Remember.cc 8 Remember.cc
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc
index b68ea83..68cf6f6 100644
--- a/util/fbrun/main.cc
+++ b/util/fbrun/main.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: main.cc,v 1.11 2003/12/01 18:58:53 fluxgen Exp $ 22// $Id: main.cc,v 1.12 2004/09/03 14:18:48 akir Exp $
23 23
24#include "FbRun.hh" 24#include "FbRun.hh"
25#include "App.hh" 25#include "App.hh"
@@ -43,6 +43,7 @@ void showUsage(const char *progname) {
43 " -h [height] Window height in pixels"<<endl<< 43 " -h [height] Window height in pixels"<<endl<<
44 " -display [display string] Display name"<<endl<< 44 " -display [display string] Display name"<<endl<<
45 " -pos [x] [y] Window position in pixels"<<endl<< 45 " -pos [x] [y] Window position in pixels"<<endl<<
46 " -pos nearmouse Window position near mouse"<<endl<<
46 " -fg [color name] Foreground text color"<<endl<< 47 " -fg [color name] Foreground text color"<<endl<<
47 " -bg [color name] Background color"<<endl<< 48 " -bg [color name] Background color"<<endl<<
48 " -na Disable antialias"<<endl<< 49 " -na Disable antialias"<<endl<<
@@ -56,6 +57,7 @@ int main(int argc, char **argv) {
56 size_t width = 200, height = 32; // default size of window 57 size_t width = 200, height = 32; // default size of window
57 bool set_height = false, set_width=false; // use height/width of font by default 58 bool set_height = false, set_width=false; // use height/width of font by default
58 bool set_pos = false; // set position 59 bool set_pos = false; // set position
60 bool near_mouse = false; // popup near mouse
59 bool antialias = true; // antialias text 61 bool antialias = true; // antialias text
60 string fontname; // font name 62 string fontname; // font name
61 string title("Run program"); // default title 63 string title("Run program"); // default title
@@ -84,6 +86,10 @@ int main(int argc, char **argv) {
84 x = atoi(argv[++i]); 86 x = atoi(argv[++i]);
85 y = atoi(argv[++i]); 87 y = atoi(argv[++i]);
86 set_pos = true; 88 set_pos = true;
89 } else if (strcmp(argv[i], "-nearmouse") == 0) {
90 set_pos = true;
91 near_mouse = true;
92 i++;
87 } else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) { 93 } else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) {
88 foreground = argv[++i]; 94 foreground = argv[++i];
89 } else if (strcmp(argv[i], "-bg") == 0 && i+1 < argc) { 95 } else if (strcmp(argv[i], "-bg") == 0 && i+1 < argc) {
@@ -139,7 +145,27 @@ int main(int argc, char **argv) {
139 fbrun.setTitle(title); 145 fbrun.setTitle(title);
140 fbrun.setText(text); 146 fbrun.setText(text);
141 fbrun.show(); 147 fbrun.show();
142 148
149 if (near_mouse) {
150
151 int wx, wy;
152 unsigned int mask;
153 Window ret_win;
154 Window child_win;
155
156 Display* dpy = FbTk::App::instance()->display();
157
158 if (XQueryPointer(dpy, DefaultRootWindow(dpy),
159 &ret_win, &child_win,
160 &x, &y, &wx, &wy, &mask)) {
161
162 if ( x - (fbrun.width()/2) > 0 )
163 x-= fbrun.width()/2;
164 if ( y - (fbrun.height()/2) > 0 )
165 y-= fbrun.height()/2;
166 }
167 }
168
143 if (set_pos) 169 if (set_pos)
144 fbrun.move(x, y); 170 fbrun.move(x, y);
145 171