~ubuntu-branches/ubuntu/trusty/fluxbox/trusty-proposed

« back to all changes in this revision

Viewing changes to util/fbrun/main.cc

  • Committer: Package Import Robot
  • Author(s): Paul Tagliamonte
  • Date: 2010-08-12 21:16:02 UTC
  • mfrom: (0.1.1) (1.1.10)
  • Revision ID: package-import@ubuntu.com-20100812211602-3tsmzl9in5nmwz7z
Tags: 1.1.1+git20100807.0cc08f9-1
* debian/ dir has been cleaned out, complete repackage
  of most files.
* pulled new archive from git.fluxbox.org HEAD, saved as
  tar.gz.
* Added in fluxbox.* files from the old dfsg tree.
* Added in system.fluxbox-menu file from the old dfsg tree
* Added the source/format file to bump package source
  version from 1.0 to 3.0 (quilt). 
* Changed rules file to match the old dfsg setup so that
  fluxbox behaves nicely.
* Removed entries from copyright that no longer apply.
* Added theme based on Denis Brand ( naran )'s old theme.
* Added a background I whipped up.
* Changed compile flags to point to debian theme by default
* Adding a patch to have fluxbox use x-terminal-emulator
  over xterm. Closes: #591694 (LP: #580485)
* Adding a patch to allow titlebar-window dragging.
* Changed the flags in rules to pull from a script. This script
  lets us un-hardcode what theme is default. Be sure there
  is a theme pack!
* Added comments to my patches.
* Removing debian/docs, empty file.
* Fixing fluxbox.desktop to remove all the warnings from
  desktop-file-validate
* Fixing libtool issue by running an update before
  configure in the rules script.
* Added a compile flag script to auto-detect what platform
  we are running on, and apply the correct theme. This
  should solve Ubuntnu issues later on.
* adding in a get-orig-source rule
* fixing the upstream version number to pinpoint
  the commit ( thanks, lfaraone ).
* adding a rule for get-orig-source. ( thanks again,
  lfaraone ).
* Updated rules to actually allow us to do a build from it
* Removed Denis from the uploaders ( as per an email
  conversation )
* Removing madduck from the uploaders ( thanks for asking,
  lfaraone. ). Thanks for your hard work, madduck.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
// DEALINGS IN THE SOFTWARE.
21
21
 
22
22
#include "FbRun.hh"
23
 
#include "App.hh"
24
 
#include "StringUtil.hh"
25
 
#include "Color.hh"
 
23
#include "FbTk/App.hh"
 
24
#include "FbTk/StringUtil.hh"
 
25
#include "FbTk/Color.hh"
26
26
 
27
27
#ifdef XINERAMA
28
28
extern  "C" {
55
55
        "   -font [font name]           Text font"<<endl<<
56
56
        "   -title [title name]         Set title"<<endl<<
57
57
        "   -text [text]                Text input"<<endl<<
 
58
        "   -print                      Print result to stdout"<<endl<<
58
59
        "   -w [width]                  Window width in pixels"<<endl<<
59
60
        "   -h [height]                 Window height in pixels"<<endl<<
60
61
        "   -display [display string]   Display name"<<endl<<
61
62
        "   -pos [x] [y]                Window position in pixels"<<endl<<
62
63
        "   -nearmouse                  Window position near mouse"<<endl<<
63
 
        "   -centered                   Window position centered on screen"<<endl<<
64
64
        "   -fg [color name]            Foreground text color"<<endl<<
65
65
        "   -bg [color name]            Background color"<<endl<<
66
66
        "   -na                         Disable antialias"<<endl<<
75
75
    bool set_height = false, set_width=false; // use height/width of font by default
76
76
    bool set_pos = false; // set position
77
77
    bool near_mouse = false; // popup near mouse
78
 
    bool centered = false; // popup centered on screen
79
78
    bool antialias = true; // antialias text
 
79
    bool print = false;
80
80
    string fontname; // font name
81
81
    string title("Run program"); // default title
82
82
    string text;         // default input text
86
86
    string history_file("~/.fluxbox/fbrun_history"); // command history file
87
87
    // parse arguments
88
88
    for (int i=1; i<argc; i++) {
89
 
        if (strcmp(argv[i], "-font") == 0 && i+1 < argc) {
 
89
        string arg = argv[i];
 
90
        if ((arg == "-font" || arg == "--font") && i+1 < argc) {
90
91
            fontname = argv[++i];
91
 
        } else if (strcmp(argv[i], "-title") == 0 && i+1 < argc) {
 
92
        } else if (arg == "-print" || arg == "--print") {
 
93
            print = true;
 
94
        } else if ((arg == "-title" || arg == "--title") && i+1 < argc) {
92
95
            title = argv[++i];
93
 
        } else if (strcmp(argv[i], "-text") == 0 && i+1 < argc) {
 
96
        } else if ((arg == "-text" || arg == "--text") && i+1 < argc) {
94
97
            text = argv[++i];
95
 
        } else if (strcmp(argv[i], "-w") == 0 && i+1 < argc) {
 
98
        } else if (arg == "-w" && i+1 < argc) {
96
99
            width = atoi(argv[++i]);
97
100
            set_width = true;
98
 
        } else if (strcmp(argv[i], "-h") == 0 && i+1 < argc) {
 
101
        } else if (arg == "-h" && i+1 < argc) {
99
102
            height = atoi(argv[++i]);
100
103
            set_height = true; // mark true else the height of font will be used
101
 
        } else if (strcmp(argv[i], "-display") == 0 && i+1 < argc) {
 
104
        } else if ((arg == "-display" || arg == "--display") && i+1 < argc) {
102
105
            display_name = argv[++i];
103
 
        } else if (strcmp(argv[i], "-pos") == 0 && i+2 < argc) {
 
106
        } else if ((arg == "-pos" || arg == "--pos") && i+2 < argc) {
104
107
            x = atoi(argv[++i]);
105
108
            y = atoi(argv[++i]);
106
109
            set_pos = true;
107
 
        } else if (strcmp(argv[i], "-nearmouse") == 0) {
 
110
        } else if (arg == "-nearmouse" || arg == "--nearmouse") {
108
111
            set_pos = true;
109
112
            near_mouse = true;
110
 
        } else if (strcmp(argv[i], "-centered") == 0) {
111
 
            set_pos = true;
112
 
            centered = true;
113
113
        } else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) {
114
114
            foreground = argv[++i];
115
115
        } else if (strcmp(argv[i], "-bg") == 0 && i+1 < argc) {
118
118
            antialias = false;
119
119
        } else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) {
120
120
            history_file = argv[++i];
121
 
        } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) {
 
121
        } else if (arg == "-h" || arg == "-help" || arg == "--help") {
122
122
            showUsage(argv[0]);
123
123
            exit(0);
124
124
        } else {
134
134
        FbTk::App application(display_name.c_str());
135
135
        FbRun fbrun;
136
136
 
137
 
        //fbrun.setAntialias(antialias);
 
137
        fbrun.setPrint(print);
138
138
 
139
139
        if (fontname.size() != 0) {
140
140
            if (!fbrun.loadFont(fontname.c_str())) {
218
218
            }
219
219
        }
220
220
 
221
 
        if (centered) {
222
 
            Display* dpy = FbTk::App::instance()->display();
223
 
            unsigned int root_w = WidthOfScreen(DefaultScreenOfDisplay(dpy));
224
 
            unsigned int root_h = HeightOfScreen(DefaultScreenOfDisplay(dpy));
225
 
            x = (root_w-fbrun.width())/2;
226
 
            y = (root_h-fbrun.height())/2;
227
 
            /* TODO: this will center the popup on the root window, but in
228
 
            the case of Xinerama it should rather center it on one screen.
229
 
            Question remains on which of them ... maybe use the one the
230
 
            pointer is in, like the code for 'nearmouse' does? Alternatively,
231
 
            allow defining a 'main' screen, that should then be applied to
232
 
            the 'nearmouse' handling, too. */
233
 
        }
234
 
 
235
221
        if (set_pos)
236
222
            fbrun.move(x, y);
237
223