Cleanup unneeded headers (thanks Slava Semushin)
This commit is contained in:
parent
e2bc57bc0f
commit
a15d9af3c7
7 changed files with 34 additions and 53 deletions
|
@ -1,6 +1,9 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 0.9.16:
|
Changes for 0.9.16:
|
||||||
*06/04/25:
|
*06/04/25:
|
||||||
|
* Cleanup unneeded headers (thanks Slava Semushin)
|
||||||
|
FbAtoms.cc Slit.cc Keys.cc FocusControl.cc FbTk/App.cc
|
||||||
|
util/fbrun/FbRun.cc
|
||||||
* Fix occasional highlighting of menu nops+separators, sf.net patch
|
* Fix occasional highlighting of menu nops+separators, sf.net patch
|
||||||
#1475268 (thanks Scott Kuhl; skuhl AT cs utah edu)
|
#1475268 (thanks Scott Kuhl; skuhl AT cs utah edu)
|
||||||
FbTk/MenuSeparator.hh/cc FbTk/Menu.cc MenuCreator.cc
|
FbTk/MenuSeparator.hh/cc FbTk/Menu.cc MenuCreator.cc
|
||||||
|
|
|
@ -25,11 +25,6 @@
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef HAVE_CASSERT
|
|
||||||
#include <cassert>
|
|
||||||
#else
|
|
||||||
#include <assert.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,6 @@
|
||||||
|
|
||||||
#include "EventManager.hh"
|
#include "EventManager.hh"
|
||||||
|
|
||||||
#ifdef HAVE_CASSERT
|
|
||||||
#include <cassert>
|
|
||||||
#else
|
|
||||||
#include <assert.h>
|
|
||||||
#endif
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
#include "FbWinFrameTheme.hh"
|
#include "FbWinFrameTheme.hh"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
|
@ -87,11 +87,6 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#ifdef HAVE_CASSERT
|
|
||||||
#include <cassert>
|
|
||||||
#else
|
|
||||||
#include <assert.h>
|
|
||||||
#endif
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -67,11 +67,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#ifdef HAVE_CASSERT
|
|
||||||
#include <cassert>
|
|
||||||
#else
|
|
||||||
#include <assert.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
#ifdef HAVE_SYS_STAT_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
|
@ -48,13 +48,9 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#ifdef HAVE_CASSERT
|
|
||||||
#include <cassert>
|
|
||||||
#else
|
|
||||||
#include <assert.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
FbRun::FbRun(int x, int y, size_t width):
|
FbRun::FbRun(int x, int y, size_t width):
|
||||||
FbTk::TextBox(DefaultScreen(FbTk::App::instance()->display()),
|
FbTk::TextBox(DefaultScreen(FbTk::App::instance()->display()),
|
||||||
m_font, ""),
|
m_font, ""),
|
||||||
|
@ -67,7 +63,7 @@ FbRun::FbRun(int x, int y, size_t width):
|
||||||
m_last_completion_prefix(""),
|
m_last_completion_prefix(""),
|
||||||
m_current_apps_item(0),
|
m_current_apps_item(0),
|
||||||
m_cursor(XCreateFontCursor(FbTk::App::instance()->display(), XC_xterm)) {
|
m_cursor(XCreateFontCursor(FbTk::App::instance()->display(), XC_xterm)) {
|
||||||
|
|
||||||
setGC(m_gc.gc());
|
setGC(m_gc.gc());
|
||||||
setCursor(m_cursor);
|
setCursor(m_cursor);
|
||||||
// setting nomaximize in local resize
|
// setting nomaximize in local resize
|
||||||
|
@ -78,9 +74,9 @@ FbRun::FbRun(int x, int y, size_t width):
|
||||||
if (class_hint == 0)
|
if (class_hint == 0)
|
||||||
throw string("Out of memory");
|
throw string("Out of memory");
|
||||||
class_hint->res_name = "fbrun";
|
class_hint->res_name = "fbrun";
|
||||||
class_hint->res_class = "FbRun";
|
class_hint->res_class = "FbRun";
|
||||||
XSetClassHint(m_display, window(), class_hint);
|
XSetClassHint(m_display, window(), class_hint);
|
||||||
|
|
||||||
XFree(class_hint);
|
XFree(class_hint);
|
||||||
#ifdef HAVE_XPM
|
#ifdef HAVE_XPM
|
||||||
Pixmap mask = 0;
|
Pixmap mask = 0;
|
||||||
|
@ -123,7 +119,7 @@ void FbRun::run(const std::string &command) {
|
||||||
}
|
}
|
||||||
|
|
||||||
hide(); // hide gui
|
hide(); // hide gui
|
||||||
|
|
||||||
// save command history to file
|
// save command history to file
|
||||||
if (text().size() != 0) { // no need to save empty command
|
if (text().size() != 0) { // no need to save empty command
|
||||||
|
|
||||||
|
@ -134,7 +130,7 @@ void FbRun::run(const std::string &command) {
|
||||||
// m_current_history_item is the duplicate
|
// m_current_history_item is the duplicate
|
||||||
} else {
|
} else {
|
||||||
m_current_history_item = 0;
|
m_current_history_item = 0;
|
||||||
for (; m_current_history_item < m_history.size();
|
for (; m_current_history_item < m_history.size();
|
||||||
++m_current_history_item) {
|
++m_current_history_item) {
|
||||||
if (m_history[m_current_history_item] == text())
|
if (m_history[m_current_history_item] == text())
|
||||||
break;
|
break;
|
||||||
|
@ -154,7 +150,7 @@ void FbRun::run(const std::string &command) {
|
||||||
// write the history items that come after current
|
// write the history items that come after current
|
||||||
for (i++; i < m_history.size(); i++)
|
for (i++; i < m_history.size(); i++)
|
||||||
inoutfile<<m_history[i]<<endl;
|
inoutfile<<m_history[i]<<endl;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// set put-pointer at end of file
|
// set put-pointer at end of file
|
||||||
inoutfile.seekp(0, ios::end);
|
inoutfile.seekp(0, ios::end);
|
||||||
|
@ -215,7 +211,7 @@ void FbRun::setTitle(const string &title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbRun::resize(unsigned int width, unsigned int height) {
|
void FbRun::resize(unsigned int width, unsigned int height) {
|
||||||
FbTk::TextBox::resize(width, height);
|
FbTk::TextBox::resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbRun::redrawLabel() {
|
void FbRun::redrawLabel() {
|
||||||
|
@ -233,7 +229,7 @@ void FbRun::keyPressEvent(XKeyEvent &ke) {
|
||||||
char keychar[1];
|
char keychar[1];
|
||||||
XLookupString(&ke, keychar, 1, &ks, 0);
|
XLookupString(&ke, keychar, 1, &ks, 0);
|
||||||
// a modifier key by itself doesn't do anything
|
// a modifier key by itself doesn't do anything
|
||||||
if (IsModifierKey(ks))
|
if (IsModifierKey(ks))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (FbTk::KeyUtil::instance().isolateModifierMask(ke.state)) { // a modifier key is down
|
if (FbTk::KeyUtil::instance().isolateModifierMask(ke.state)) { // a modifier key is down
|
||||||
|
@ -374,7 +370,7 @@ void FbRun::tabCompleteHistory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbRun::tabCompleteApps() {
|
void FbRun::tabCompleteApps() {
|
||||||
|
|
||||||
static bool first_run= true;
|
static bool first_run= true;
|
||||||
if (m_last_completion_prefix.empty())
|
if (m_last_completion_prefix.empty())
|
||||||
m_last_completion_prefix = text().substr(0, textStartPos() + cursorPosition());
|
m_last_completion_prefix = text().substr(0, textStartPos() + cursorPosition());
|
||||||
|
@ -387,19 +383,21 @@ void FbRun::tabCompleteApps() {
|
||||||
// (re)build m_apps-container
|
// (re)build m_apps-container
|
||||||
if (first_run || m_last_completion_prefix != prefix) {
|
if (first_run || m_last_completion_prefix != prefix) {
|
||||||
first_run= false;
|
first_run= false;
|
||||||
|
|
||||||
string path;
|
string path;
|
||||||
|
|
||||||
if(!prefix.empty() &&
|
if(!prefix.empty() &&
|
||||||
string("/.~").find_first_of(prefix[0]) != string::npos) {
|
string("/.~").find_first_of(prefix[0]) != string::npos) {
|
||||||
size_t rseparator= prefix.find_last_of("/");
|
size_t rseparator= prefix.find_last_of("/");
|
||||||
path= prefix.substr(0, rseparator + 1) + ":";
|
path= prefix.substr(0, rseparator + 1) + ":";
|
||||||
add_dirs= true;
|
add_dirs= true;
|
||||||
} else
|
} else {
|
||||||
path= getenv("PATH");
|
char* tmp_path = getenv("PATH");
|
||||||
|
if (tmp_path)
|
||||||
|
path = tmp_path;
|
||||||
|
}
|
||||||
m_apps.clear();
|
m_apps.clear();
|
||||||
|
|
||||||
unsigned int l;
|
unsigned int l;
|
||||||
unsigned int r;
|
unsigned int r;
|
||||||
|
|
||||||
|
@ -412,27 +410,27 @@ void FbRun::tabCompleteApps() {
|
||||||
if (n >= 0) {
|
if (n >= 0) {
|
||||||
while(n--) {
|
while(n--) {
|
||||||
filename= dir.readFilename();
|
filename= dir.readFilename();
|
||||||
fncomplete= dir.name() +
|
fncomplete= dir.name() +
|
||||||
(*dir.name().rbegin() != '/' ? "/" : "") +
|
(*dir.name().rbegin() != '/' ? "/" : "") +
|
||||||
filename;
|
filename;
|
||||||
|
|
||||||
// directories in dirmode ?
|
// directories in dirmode ?
|
||||||
if (add_dirs && FbTk::FileUtil::isDirectory(fncomplete.c_str()) &&
|
if (add_dirs && FbTk::FileUtil::isDirectory(fncomplete.c_str()) &&
|
||||||
filename != ".." && filename != ".") {
|
filename != ".." && filename != ".") {
|
||||||
m_apps.push_back(fncomplete);
|
m_apps.push_back(fncomplete);
|
||||||
// executables in dirmode ?
|
// executables in dirmode ?
|
||||||
} else if (add_dirs && FbTk::FileUtil::isRegularFile(fncomplete.c_str()) &&
|
} else if (add_dirs && FbTk::FileUtil::isRegularFile(fncomplete.c_str()) &&
|
||||||
FbTk::FileUtil::isExecutable(fncomplete.c_str()) &&
|
FbTk::FileUtil::isExecutable(fncomplete.c_str()) &&
|
||||||
(prefix == "" ||
|
(prefix == "" ||
|
||||||
fncomplete.substr(0, prefix.size()) == prefix)) {
|
fncomplete.substr(0, prefix.size()) == prefix)) {
|
||||||
m_apps.push_back(fncomplete);
|
m_apps.push_back(fncomplete);
|
||||||
// executables in $PATH ?
|
// executables in $PATH ?
|
||||||
} else if (FbTk::FileUtil::isRegularFile(fncomplete.c_str()) &&
|
} else if (FbTk::FileUtil::isRegularFile(fncomplete.c_str()) &&
|
||||||
FbTk::FileUtil::isExecutable(fncomplete.c_str()) &&
|
FbTk::FileUtil::isExecutable(fncomplete.c_str()) &&
|
||||||
(prefix == "" ||
|
(prefix == "" ||
|
||||||
filename.substr(0, prefix.size()) == prefix)) {
|
filename.substr(0, prefix.size()) == prefix)) {
|
||||||
m_apps.push_back(filename);
|
m_apps.push_back(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l= r + 1;
|
l= r + 1;
|
||||||
|
@ -473,7 +471,7 @@ void FbRun::tabCompleteApps() {
|
||||||
}
|
}
|
||||||
apps_item++;
|
apps_item++;
|
||||||
}
|
}
|
||||||
if (!changed_prefix && apps_item == m_current_apps_item)
|
if (!changed_prefix && apps_item == m_current_apps_item)
|
||||||
XBell(m_display, 0);
|
XBell(m_display, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue