raise and focus when we click on titlebar and fixed workspace names in workspace menu

This commit is contained in:
fluxgen 2003-02-16 16:45:23 +00:00
parent c0e839b64d
commit 9a82a5b1dc

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Screen.cc,v 1.107 2003/02/16 15:12:08 rathnor Exp $ // $Id: Screen.cc,v 1.108 2003/02/16 16:45:23 fluxgen Exp $
#include "Screen.hh" #include "Screen.hh"
@ -287,6 +287,13 @@ void setupWorkspacemenu(BScreen &scr, FbTk::Menu &menu) {
RefCount<Command> remove_last(new RemoveLastWorkspaceCmd(scr)); RefCount<Command> remove_last(new RemoveLastWorkspaceCmd(scr));
menu.insert("New Workspace", new_workspace); menu.insert("New Workspace", new_workspace);
menu.insert("Remove Last", remove_last); menu.insert("Remove Last", remove_last);
// for each workspace add workspace name and it's menu to our workspace menu
for (size_t workspace = 0; workspace < scr.getCount(); ++workspace) {
Workspace *wkspc = scr.getWorkspace(workspace);
menu.insert(wkspc->name().c_str(), &wkspc->menu());
}
// update graphics
menu.update(); menu.update();
} }
@ -484,14 +491,14 @@ BScreen::BScreen(ResourceManager &rm,
Workspace *wkspc = (Workspace *) 0; Workspace *wkspc = (Workspace *) 0;
if (*resource.workspaces != 0) { if (*resource.workspaces != 0) {
for (int i = 0; i < *resource.workspaces; ++i) { for (int i = 0; i < *resource.workspaces; ++i) {
wkspc = new Workspace(this, m_layermanager, workspacesList.size()); wkspc = new Workspace(*this, m_layermanager, workspacesList.size());
workspacesList.push_back(wkspc); workspacesList.push_back(wkspc);
workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); // workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu());
} }
} else { } else {
wkspc = new Workspace(this, m_layermanager, workspacesList.size()); wkspc = new Workspace(*this, m_layermanager, workspacesList.size());
workspacesList.push_back(wkspc); workspacesList.push_back(wkspc);
workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); // workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu());
} }
current_workspace = workspacesList.front(); current_workspace = workspacesList.front();
@ -703,13 +710,10 @@ void BScreen::reconfigure() {
workspacemenu->reconfigure(); workspacemenu->reconfigure();
m_configmenu->reconfigure(); m_configmenu->reconfigure();
{
//int remember_sub = m_rootmenu->currentSubmenu();
initMenu(); initMenu();
raiseWindows(Workspace::Stack()); raiseWindows(Workspace::Stack());
m_rootmenu->reconfigure(); m_rootmenu->reconfigure();
//m_rootmenu->drawSubmenu(remember_sub);
}
// m_toolbar->setPlacement(*resource.toolbar_placement); // m_toolbar->setPlacement(*resource.toolbar_placement);
m_toolbar->reconfigure(); m_toolbar->reconfigure();
@ -816,7 +820,7 @@ void BScreen::setAntialias(bool value) {
} }
int BScreen::addWorkspace() { int BScreen::addWorkspace() {
Workspace *wkspc = new Workspace(this, m_layermanager, workspacesList.size()); Workspace *wkspc = new Workspace(*this, m_layermanager, workspacesList.size());
workspacesList.push_back(wkspc); workspacesList.push_back(wkspc);
addWorkspaceName(wkspc->name().c_str()); // update names addWorkspaceName(wkspc->name().c_str()); // update names
//add workspace to workspacemenu //add workspace to workspacemenu
@ -954,8 +958,8 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
win->setInputFocus(); win->setInputFocus();
} }
#ifdef DEBUG #ifdef DEBUG
cerr<<"Sending to id = "<<id<<endl; cerr<<__FILE__<<": Sending to id = "<<id<<endl;
cerr<<"win->workspaceId="<<win->getWorkspaceNumber()<<endl; cerr<<__FILE__<<": win->workspaceId="<<win->getWorkspaceNumber()<<endl;
#endif //DEBUG #endif //DEBUG
} }
@ -1123,7 +1127,8 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
CommandRef close_cmd(new WindowCmd(win, &FluxboxWindow::close)); CommandRef close_cmd(new WindowCmd(win, &FluxboxWindow::close));
CommandRef shade_cmd(new WindowCmd(win, &FluxboxWindow::shade)); CommandRef shade_cmd(new WindowCmd(win, &FluxboxWindow::shade));
CommandRef raise_cmd(new WindowCmd(win, &FluxboxWindow::raise)); CommandRef raise_cmd(new WindowCmd(win, &FluxboxWindow::raise));
CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::lower)); CommandRef raise_and_focus_cmd(new WindowCmd(win, &FluxboxWindow::raiseAndFocus));
CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::raise));
CommandRef stick_cmd(new WindowCmd(win, &FluxboxWindow::stick)); CommandRef stick_cmd(new WindowCmd(win, &FluxboxWindow::stick));
CommandRef show_menu_cmd(new WindowCmd(win, &FluxboxWindow::popupMenu)); CommandRef show_menu_cmd(new WindowCmd(win, &FluxboxWindow::popupMenu));
@ -1133,7 +1138,8 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
// get titlebar configuration // get titlebar configuration
const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft(); const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft();
for (char c=0; c<2; c++) { for (char c=0; c<2; c++) {
for (unsigned int i=0; i< dir->size(); ++i) {
for (size_t i=0; i< dir->size(); ++i) {
//create new buttons //create new buttons
FbTk::Button *newbutton = 0; FbTk::Button *newbutton = 0;
if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) { if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) {
@ -1155,7 +1161,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
newbutton->setOnClick(maximize_vert_cmd, 2); newbutton->setOnClick(maximize_vert_cmd, 2);
#ifdef DEBUG #ifdef DEBUG
cerr<<__FILE__<<":Creating maximize button"<<endl; cerr<<__FILE__<<": Creating maximize button"<<endl;
#endif // DEBUG #endif // DEBUG
} else if (win.isClosable() && (*dir)[i] == Fluxbox::CLOSE) { } else if (win.isClosable() && (*dir)[i] == Fluxbox::CLOSE) {
newbutton = new WinButton(WinButton::CLOSE, newbutton = new WinButton(WinButton::CLOSE,
@ -1188,7 +1194,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
} // end for c } // end for c
// setup titlebar // setup titlebar
frame.setOnClickTitlebar(raise_cmd, 1, false, true); // on press with button 1 frame.setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1
frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1
frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3
frame.setOnClickTitlebar(lower_cmd, 2, false, true); // on press with button 2 frame.setOnClickTitlebar(lower_cmd, 2, false, true); // on press with button 2