all repos — fluxbox @ 248b15c25f924c56da457ed144050e65013335b0

custom fork of the fluxbox windowmanager

fbrun, add horizontal padding option
Pete Beardmore pete.beardmore@msn.com
commit

248b15c25f924c56da457ed144050e65013335b0

parent

ed7ea14167e531dc3d7cc3db931f299fcc8c7ba4

3 files changed, 14 insertions(+), 0 deletions(-)

jump to
M util/fbrun/FbRun.ccutil/fbrun/FbRun.cc

@@ -62,6 +62,7 @@ m_print(false),

m_font("fixed"), m_display(FbTk::App::instance()->display()), m_bevel(4), + m_padding(0), m_gc(*this), m_end(false), m_current_history_item(0),

@@ -249,6 +250,11 @@ }

void FbRun::resize(unsigned int width, unsigned int height) { FbTk::TextBox::resize(width, height); +} + +void FbRun::setPadding(int padding) { + m_padding = padding; + FbTk::TextBox::setPadding(padding); } void FbRun::redrawLabel() {
M util/fbrun/FbRun.hhutil/fbrun/FbRun.hh

@@ -43,6 +43,7 @@ void setTitle(const std::string &title);

void resize(unsigned int width, unsigned int height); void setPrint(bool print) { m_print = print; } void setAutocomplete(bool complete) { m_autocomplete = complete; } + void setPadding(int padding); /// load and reconfigure for new font bool loadFont(const std::string &fontname);

@@ -89,6 +90,7 @@ bool m_print; ///< the input should be printed to stdout rather than run

FbTk::Font m_font; ///< font used to draw command text Display *m_display; ///< display connection int m_bevel; + int m_padding; FbTk::GContext m_gc; ///< graphic context bool m_end; ///< marks when this object is done
M util/fbrun/main.ccutil/fbrun/main.cc

@@ -58,6 +58,7 @@ " -text [text] Text input"<<endl<<

" -print Print result to stdout"<<endl<< " -w [width] Window width in pixels"<<endl<< " -h [height] Window height in pixels"<<endl<< + " -pad [size] Padding size in pixels"<<endl<< " -display [display string] Display name"<<endl<< " -pos [x] [y] Window position in pixels"<<endl<< " -nearmouse Window position near mouse"<<endl<<

@@ -76,6 +77,7 @@ int main(int argc, char **argv) {

int x = 0, y = 0; // default pos of window size_t width = 200, height = 32; // default size of window bool set_height = false, set_width=false; // use height/width of font by default + int padding = 0; // default horizontal padding for text bool set_pos = false; // set position bool near_mouse = false; // popup near mouse bool center = false;

@@ -107,6 +109,8 @@ set_width = true;

} else if (arg == "-h" && i+1 < argc) { height = atoi(argv[++i]); set_height = true; // mark true else the height of font will be used + } else if (arg == "-pad" && i+1 < argc) { + padding = atoi(argv[++i]); } else if ((arg == "-display" || arg == "--display") && i+1 < argc) { display_name = argv[++i]; } else if ((arg == "-pos" || arg == "--pos") && i+2 < argc) {

@@ -180,8 +184,10 @@ if (!fbrun.loadCompletion(expanded_filename.c_str()))

cerr<<"FbRun Warning: Failed to load completion file: "<<expanded_filename<<endl; } + fbrun.setPadding(padding); fbrun.setTitle(title); fbrun.setText(text); + if (preselect) fbrun.selectAll();