* added new command:
sethead <int> which sets the current window to head<int> * added remembering of the head to apps-file: [Head] {<int>}
This commit is contained in:
parent
f3dfb80c40
commit
6dffafc39e
6 changed files with 119 additions and 57 deletions
|
@ -42,6 +42,10 @@ void KillWindowCmd::real_execute() {
|
|||
winclient().sendClose(true);
|
||||
}
|
||||
|
||||
void SetHeadCmd::real_execute() {
|
||||
fbwindow().screen().setOnHead(fbwindow(), m_head);
|
||||
}
|
||||
|
||||
void SendToWorkspaceCmd::real_execute() {
|
||||
if (m_workspace_num >= 0 && m_workspace_num < fbwindow().screen().getNumberOfWorkspaces())
|
||||
fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow());
|
||||
|
|
|
@ -60,6 +60,15 @@ protected:
|
|||
void real_execute();
|
||||
};
|
||||
|
||||
class SetHeadCmd : public WindowHelperCmd {
|
||||
public:
|
||||
explicit SetHeadCmd(int head) : m_head(head) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_head;
|
||||
};
|
||||
|
||||
class SendToWorkspaceCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit SendToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { }
|
||||
|
|
|
@ -118,6 +118,7 @@ FbCommandFactory::FbCommandFactory() {
|
|||
"rootmenu",
|
||||
"saverc",
|
||||
"setenv",
|
||||
"sethead",
|
||||
"sendtoworkspace",
|
||||
"sendtonextworkspace",
|
||||
"sendtoprevworkspace",
|
||||
|
@ -279,6 +280,8 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
return new CurrentWindowCmd(&FluxboxWindow::stick);
|
||||
else if (command == "toggledecor")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::toggleDecoration);
|
||||
else if (command == "sethead")
|
||||
return new SetHeadCmd(atoi(arguments.c_str()));
|
||||
else if (command == "sendtoworkspace")
|
||||
return new SendToWorkspaceCmd(atoi(arguments.c_str()) - 1); // make 1-indexed to user
|
||||
else if (command == "sendtonextworkspace")
|
||||
|
|
|
@ -132,7 +132,9 @@ FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win, bool enab
|
|||
remember, win, Remember::REM_WORKSPACE));
|
||||
menu->insert(new RememberMenuItem(_FBTEXT(Remember, JumpToWorkspace, "Jump to workspace", "Change active workspace to remembered one on open"),
|
||||
remember, win, Remember::REM_JUMPWORKSPACE));
|
||||
menu->insert(new RememberMenuItem(_FBTEXT(Remember, Dimensions, "Dimensions", "Remember Dimensions - windth width and height"),
|
||||
menu->insert(new RememberMenuItem(_FBTEXT(Remember, Head, "Head", "Remember Head"),
|
||||
remember, win, Remember::REM_HEAD));
|
||||
menu->insert(new RememberMenuItem(_FBTEXT(Remember, Dimensions, "Dimensions", "Remember Dimensions - with width and height"),
|
||||
remember, win, Remember::REM_DIMENSIONS));
|
||||
menu->insert(new RememberMenuItem(_FBTEXT(Remember, Position, "Position", "Remember position - window co-ordinates"),
|
||||
remember, win, Remember::REM_POSITION));
|
||||
|
@ -223,6 +225,7 @@ Application::Application(bool grouped)
|
|||
stuckstate_remember =
|
||||
tabstate_remember =
|
||||
workspace_remember =
|
||||
head_remember =
|
||||
save_on_close_remember = false;
|
||||
}
|
||||
|
||||
|
@ -333,6 +336,9 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
|
|||
FB_istringstream iss(str_label.c_str());
|
||||
iss >> w;
|
||||
app.rememberWorkspace(w);
|
||||
} else if (str_key == "Head") {
|
||||
int h = atoi(str_label.c_str());
|
||||
app.rememberHead(h);
|
||||
} else if (str_key == "Layer") {
|
||||
unsigned int l;
|
||||
if (str_label == "DESKTOP") {
|
||||
|
@ -566,6 +572,9 @@ void Remember::save() {
|
|||
if (a.workspace_remember) {
|
||||
apps_file << " [Workspace]\t{" << a.workspace << "}" << endl;
|
||||
}
|
||||
if (a.head_remember) {
|
||||
apps_file << " [Head]\t{" << a.head << "}" << endl;
|
||||
}
|
||||
if (a.dimensions_remember) {
|
||||
apps_file << " [Dimensions]\t{" << a.w << " " << a.h << "}" << endl;
|
||||
}
|
||||
|
@ -639,6 +648,9 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
|
|||
case REM_WORKSPACE:
|
||||
return app->workspace_remember;
|
||||
break;
|
||||
case REM_HEAD:
|
||||
return app->head_remember;
|
||||
break;
|
||||
case REM_DIMENSIONS:
|
||||
return app->dimensions_remember;
|
||||
break;
|
||||
|
@ -690,6 +702,9 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) {
|
|||
case REM_WORKSPACE:
|
||||
app->rememberWorkspace(win->workspaceNumber());
|
||||
break;
|
||||
case REM_HEAD:
|
||||
app->rememberHead(win->screen().getHead(win->fbWindow()));
|
||||
break;
|
||||
case REM_DIMENSIONS:
|
||||
app->rememberDimensions(win->width(), win->height());
|
||||
break;
|
||||
|
@ -741,6 +756,9 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) {
|
|||
case REM_WORKSPACE:
|
||||
app->forgetWorkspace();
|
||||
break;
|
||||
case REM_HEAD:
|
||||
app->forgetHead();
|
||||
break;
|
||||
case REM_DIMENSIONS:
|
||||
app->forgetDimensions();
|
||||
break;
|
||||
|
@ -809,6 +827,10 @@ void Remember::setupFrame(FluxboxWindow &win) {
|
|||
screen.changeWorkspaceID(app->workspace);
|
||||
}
|
||||
|
||||
if (app->head_remember) {
|
||||
win.screen().setOnHead<FluxboxWindow>(win, app->head);
|
||||
}
|
||||
|
||||
if (app->decostate_remember)
|
||||
win.setDecorationMask(app->decostate);
|
||||
|
||||
|
@ -816,29 +838,35 @@ void Remember::setupFrame(FluxboxWindow &win) {
|
|||
if (app->dimensions_remember)
|
||||
win.resize(app->w, app->h);
|
||||
|
||||
int head = screen.getHead(win.fbWindow());
|
||||
|
||||
if (app->position_remember) {
|
||||
|
||||
switch (app->refc) {
|
||||
default:
|
||||
case POS_UPPERLEFT: // upperleft corner
|
||||
win.move(app->x, app->y);
|
||||
win.move(screen.getHeadX(head) + app->x,
|
||||
screen.getHeadY(head) + app->y);
|
||||
break;
|
||||
case POS_UPPERRIGHT: // upperright corner
|
||||
win.move(screen.width() - win.width() - app->x, app->y);
|
||||
win.move(screen.getHeadX(head) + screen.getHeadWidth(head) - win.width() - app->x,
|
||||
screen.getHeadY(head) + app->y);
|
||||
break;
|
||||
case POS_LOWERLEFT: // lowerleft corner
|
||||
win.move(app->x, screen.height() - win.height() - app->y);
|
||||
win.move(screen.getHeadX(head) + app->x,
|
||||
screen.getHeadHeight(head) - win.height() - app->y);
|
||||
break;
|
||||
case POS_LOWERRIGHT: // lowerright corner
|
||||
win.move(screen.width() - win.width() - app->x,
|
||||
screen.height() - win.height() - app->y);
|
||||
win.move(screen.getHeadWidth(head) - win.width() - app->x,
|
||||
screen.getHeadHeight(head) - win.height() - app->y);
|
||||
break;
|
||||
case POS_CENTER: // center of the screen, windows topleft corner is on the center
|
||||
win.move((screen.width() / 2) + app->x,
|
||||
(screen.height() / 2) + app->y);
|
||||
win.move((screen.getHeadWidth(head) / 2) + app->x,
|
||||
(screen.getHeadHeight(head) / 2) + app->y);
|
||||
break;
|
||||
case POS_WINCENTER: // the window is centered REALLY upon the center
|
||||
win.move((screen.width() / 2) - ( win.width() / 2 ) + app->x,
|
||||
(screen.height() / 2) - ( win.height() / 2 ) + app->y);
|
||||
win.move((screen.getHeadWidth(head) / 2) - ( win.width() / 2 ) + app->x,
|
||||
(screen.getHeadHeight(head) / 2) - ( win.height() / 2 ) + app->y);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ class Application {
|
|||
public:
|
||||
Application(bool grouped);
|
||||
inline void forgetWorkspace() { workspace_remember = false; }
|
||||
inline void forgetHead() { head_remember = false; }
|
||||
inline void forgetDimensions() { dimensions_remember = false; }
|
||||
inline void forgetPosition() { position_remember = false; }
|
||||
inline void forgetShadedstate() { shadedstate_remember = false; }
|
||||
|
@ -59,6 +60,8 @@ public:
|
|||
|
||||
inline void rememberWorkspace(int ws)
|
||||
{ workspace = ws; workspace_remember = true; }
|
||||
inline void rememberHead(int h)
|
||||
{ head = h; head_remember = true; }
|
||||
inline void rememberDimensions(int width, int height)
|
||||
{ w = width; h = height; dimensions_remember = true; }
|
||||
inline void rememberFocusHiddenstate(bool state)
|
||||
|
@ -86,6 +89,9 @@ public:
|
|||
bool workspace_remember;
|
||||
unsigned int workspace;
|
||||
|
||||
bool head_remember;
|
||||
int head;
|
||||
|
||||
bool dimensions_remember;
|
||||
int w,h; // width, height
|
||||
|
||||
|
@ -153,6 +159,7 @@ public:
|
|||
REM_STUCKSTATE,
|
||||
//REM_TABSTATE, ... external tabs disabled atm
|
||||
REM_WORKSPACE,
|
||||
REM_HEAD,
|
||||
REM_LASTATTRIB // not actually used
|
||||
};
|
||||
|
||||
|
|
|
@ -2372,7 +2372,7 @@ pair<int,int> BScreen::clampToHead(int head, int x, int y, int w, int h) const {
|
|||
// this can be gone and a consistent interface for the two used
|
||||
// on the actual objects
|
||||
|
||||
|
||||
/* FIXME: dead code?
|
||||
#ifdef SLIT
|
||||
template <>
|
||||
int BScreen::getOnHead<Slit>(Slit &slit) {
|
||||
|
@ -2385,3 +2385,14 @@ void BScreen::setOnHead<Slit>(Slit &slit, int head) {
|
|||
slit.reconfigure();
|
||||
}
|
||||
#endif // SLIT
|
||||
*/
|
||||
|
||||
template<>
|
||||
void BScreen::setOnHead<FluxboxWindow>(FluxboxWindow& win, int head) {
|
||||
if (head > 0 && head <= numHeads()) {
|
||||
int current_head = getHead(win.fbWindow());
|
||||
win.move(getHeadX(head) + win.frame().x() - getHeadX(current_head),
|
||||
getHeadY(head) + win.frame().y() - getHeadY(current_head));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue