minor cleaning in BScreen interface

This commit is contained in:
fluxgen 2003-05-15 12:00:46 +00:00
parent cbce8634dd
commit 988392b1eb
13 changed files with 252 additions and 277 deletions

View file

@ -19,7 +19,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: Ewmh.cc,v 1.24 2003/05/15 11:17:26 fluxgen Exp $ // $Id: Ewmh.cc,v 1.25 2003/05/15 12:00:42 fluxgen Exp $
#include "Ewmh.hh" #include "Ewmh.hh"
@ -223,7 +223,7 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
} }
void Ewmh::updateCurrentWorkspace(BScreen &screen) { void Ewmh::updateCurrentWorkspace(BScreen &screen) {
size_t workspace = screen.getCurrentWorkspaceID(); size_t workspace = screen.currentWorkspaceID();
XChangeProperty(FbTk::App::instance()->display(), XChangeProperty(FbTk::App::instance()->display(),
screen.rootWindow().window(), screen.rootWindow().window(),
m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace, m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace,

View file

@ -19,7 +19,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: Gnome.cc,v 1.23 2003/05/15 11:17:27 fluxgen Exp $ // $Id: Gnome.cc,v 1.24 2003/05/15 12:00:42 fluxgen Exp $
#include "Gnome.hh" #include "Gnome.hh"
@ -205,7 +205,7 @@ void Gnome::updateWorkspaceNames(BScreen &screen) {
} }
void Gnome::updateCurrentWorkspace(BScreen &screen) { void Gnome::updateCurrentWorkspace(BScreen &screen) {
int workspace = screen.getCurrentWorkspaceID(); int workspace = screen.currentWorkspaceID();
XChangeProperty(FbTk::App::instance()->display(), XChangeProperty(FbTk::App::instance()->display(),
screen.rootWindow().window(), screen.rootWindow().window(),
m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace, m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace,

View file

@ -19,7 +19,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: IconBar.cc,v 1.34 2003/05/15 11:17:27 fluxgen Exp $ // $Id: IconBar.cc,v 1.35 2003/05/15 12:00:43 fluxgen Exp $
#include "IconBar.hh" #include "IconBar.hh"
@ -191,7 +191,7 @@ void IconBar::decorate(Window win) {
//!! TODO iconbar border width style //!! TODO iconbar border width style
XSetWindowBorderWidth(m_display, win, 1); XSetWindowBorderWidth(m_display, win, 1);
XSetWindowBorder(m_display, win, BlackPixel(FbTk::App::instance()->display(), XSetWindowBorder(m_display, win, BlackPixel(FbTk::App::instance()->display(),
screen().getScreenNumber())); screen().screenNumber()));
if (m_focus_pm) if (m_focus_pm)
XSetWindowBackgroundPixmap(m_display, win, m_focus_pm); XSetWindowBackgroundPixmap(m_display, win, m_focus_pm);
else else
@ -294,7 +294,7 @@ Window IconBar::createIconWindow(FluxboxWindow *fluxboxwin, Window parent) {
attrib.background_pixmap = None; attrib.background_pixmap = None;
attrib.background_pixel = attrib.border_pixel = attrib.background_pixel = attrib.border_pixel =
BlackPixel(m_display, BlackPixel(m_display,
screen().getScreenNumber()); screen().screenNumber());
// fluxboxwin->screen().getWindowStyle()->tab.border_color.pixel(); // fluxboxwin->screen().getWindowStyle()->tab.border_color.pixel();
attrib.colormap = fluxboxwin->screen().rootWindow().colormap(); attrib.colormap = fluxboxwin->screen().rootWindow().colormap();
attrib.override_redirect = True; attrib.override_redirect = True;
@ -347,7 +347,7 @@ void IconBar::draw(const IconBarObj * const obj, int width) const {
m_font.drawText( m_font.drawText(
iconwin, iconwin,
screen().getScreenNumber(), screen().screenNumber(),
screen().winFrameTheme().labelTextFocusGC(), screen().winFrameTheme().labelTextFocusGC(),
fluxboxwin->iconTitle().c_str(), newlen, fluxboxwin->iconTitle().c_str(), newlen,
dx, dy, m_vertical); dx, dy, m_vertical);

View file

@ -57,7 +57,7 @@ void Netizen::sendWorkspaceCount() {
void Netizen::sendCurrentWorkspace() { void Netizen::sendCurrentWorkspace() {
event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyCurrentWorkspaceAtom(); event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyCurrentWorkspaceAtom();
event.xclient.data.l[1] = m_screen.getCurrentWorkspaceID(); event.xclient.data.l[1] = m_screen.currentWorkspaceID();
XSendEvent(m_display, window(), False, NoEventMask, &event); XSendEvent(m_display, window(), False, NoEventMask, &event);
} }

View file

@ -21,7 +21,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: Remember.cc,v 1.14 2003/05/15 11:17:27 fluxgen Exp $ // $Id: Remember.cc,v 1.15 2003/05/15 12:00:43 fluxgen Exp $
#include "Remember.hh" #include "Remember.hh"
#include "StringUtil.hh" #include "StringUtil.hh"
@ -99,7 +99,7 @@ FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win) {
// so we also create a remember menu just for it... // so we also create a remember menu just for it...
BScreen &screen = win.screen(); BScreen &screen = win.screen();
FbTk::Menu *menu = new FbMenu(*screen.menuTheme(), FbTk::Menu *menu = new FbMenu(*screen.menuTheme(),
screen.getScreenNumber(), screen.screenNumber(),
*screen.getImageControl(), *screen.getImageControl(),
*screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()));
menu->disableTitle(); menu->disableTitle();

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.166 2003/05/15 11:17:27 fluxgen Exp $ // $Id: Screen.cc,v 1.167 2003/05/15 12:00:44 fluxgen Exp $
#include "Screen.hh" #include "Screen.hh"
@ -140,9 +140,9 @@ int anotherWMRunning(Display *display, XErrorEvent *) {
FbTk::Menu *createMenuFromScreen(BScreen &screen) { FbTk::Menu *createMenuFromScreen(BScreen &screen) {
FbTk::Menu *menu = new FbMenu(*screen.menuTheme(), FbTk::Menu *menu = new FbMenu(*screen.menuTheme(),
screen.getScreenNumber(), screen.screenNumber(),
*screen.getImageControl(), *screen.getImageControl(),
*screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()));
return menu; return menu;
} }
@ -541,7 +541,7 @@ BScreen::BScreen(ResourceManager &rm,
FBNLS::ScreenSet, FBNLS::ScreenManagingScreen, FBNLS::ScreenSet, FBNLS::ScreenManagingScreen,
"BScreen::BScreen: managing screen %d " "BScreen::BScreen: managing screen %d "
"using visual 0x%lx, depth %d\n"), "using visual 0x%lx, depth %d\n"),
getScreenNumber(), XVisualIDFromVisual(rootWindow().visual()), screenNumber(), XVisualIDFromVisual(rootWindow().visual()),
rootWindow().depth()); rootWindow().depth());
Fluxbox * const fluxbox = Fluxbox::instance(); Fluxbox * const fluxbox = Fluxbox::instance();
@ -653,10 +653,10 @@ BScreen::BScreen(ResourceManager &rm,
workspacemenu->setItemSelected(2, true); workspacemenu->setItemSelected(2, true);
if (getToolbar()) { if (toolbar()) {
getToolbar()->setPlacement(*resource.toolbar_placement); toolbar()->setPlacement(*resource.toolbar_placement);
getToolbar()->theme().font().setAntialias(*resource.antialias); toolbar()->theme().font().setAntialias(*resource.antialias);
getToolbar()->reconfigure(); toolbar()->reconfigure();
} }
initMenu(); // create and initiate rootmenu initMenu(); // create and initiate rootmenu
@ -723,8 +723,8 @@ BScreen::BScreen(ResourceManager &rm,
} }
} }
if (! isSloppyFocus() && getToolbar() != 0) { if (! isSloppyFocus() && toolbar() != 0) {
XSetInputFocus(disp, getToolbar()->window().window(), XSetInputFocus(disp, toolbar()->window().window(),
RevertToParent, CurrentTime); RevertToParent, CurrentTime);
} }
@ -777,7 +777,7 @@ FbTk::Menu &BScreen::getToolbarModemenu() {
return m_toolbarhandler->getModeMenu(); return m_toolbarhandler->getModeMenu();
} }
unsigned int BScreen::getCurrentWorkspaceID() const { unsigned int BScreen::currentWorkspaceID() const {
return current_workspace->workspaceID(); return current_workspace->workspaceID();
} }
@ -805,22 +805,22 @@ Pixmap BScreen::rootPixmap() const {
} }
/// TODO /// TODO
unsigned int BScreen::getMaxLeft() const { unsigned int BScreen::maxLeft() const {
return 0; return 0;
} }
///!! TODO ///!! TODO
unsigned int BScreen::getMaxRight() const { unsigned int BScreen::maxRight() const {
return getWidth(); return width();
} }
///!! TODO ///!! TODO
unsigned int BScreen::getMaxTop() const { unsigned int BScreen::maxTop() const {
return 0; return 0;
} }
///!! TODO ///!! TODO
unsigned int BScreen::getMaxBottom() const { unsigned int BScreen::maxBottom() const {
return getHeight(); return height();
} }
void BScreen::reconfigure() { void BScreen::reconfigure() {
@ -834,8 +834,8 @@ void BScreen::reconfigure() {
winFrameTheme().font().setAntialias(*resource.antialias); winFrameTheme().font().setAntialias(*resource.antialias);
m_menutheme->titleFont().setAntialias(*resource.antialias); m_menutheme->titleFont().setAntialias(*resource.antialias);
m_menutheme->frameFont().setAntialias(*resource.antialias); m_menutheme->frameFont().setAntialias(*resource.antialias);
if (getToolbar() && getToolbar()->theme().font().isAntialias() != *resource.antialias) if (toolbar() && toolbar()->theme().font().isAntialias() != *resource.antialias)
getToolbar()->theme().font().setAntialias(*resource.antialias); toolbar()->theme().font().setAntialias(*resource.antialias);
// load theme // load theme
std::string theme_filename(Fluxbox::instance()->getStyleFilename()); std::string theme_filename(Fluxbox::instance()->getStyleFilename());
@ -930,9 +930,9 @@ void BScreen::reconfigure() {
} }
} }
if (getToolbar()) { if (toolbar()) {
getToolbar()->setPlacement(*resource.toolbar_placement); toolbar()->setPlacement(*resource.toolbar_placement);
getToolbar()->reconfigure(); toolbar()->reconfigure();
} }
#ifdef SLIT #ifdef SLIT
@ -1054,8 +1054,8 @@ int BScreen::addWorkspace() {
workspacemenu->update(); workspacemenu->update();
saveWorkspaces(workspacesList.size()); saveWorkspaces(workspacesList.size());
if (getToolbar() != 0) if (toolbar() != 0)
getToolbar()->reconfigure(); toolbar()->reconfigure();
updateNetizenWorkspaceCount(); updateNetizenWorkspaceCount();
@ -1083,8 +1083,8 @@ int BScreen::removeLastWorkspace() {
workspacesList.pop_back(); workspacesList.pop_back();
delete wkspc; delete wkspc;
if (getToolbar() != 0) if (toolbar() != 0)
getToolbar()->reconfigure(); toolbar()->reconfigure();
updateNetizenWorkspaceCount(); updateNetizenWorkspaceCount();
saveWorkspaces(workspacesList.size()); saveWorkspaces(workspacesList.size());
@ -1112,7 +1112,7 @@ void BScreen::changeWorkspaceID(unsigned int id) {
} }
// reassociate all windows that are stuck to the new workspace // reassociate all windows that are stuck to the new workspace
Workspace *wksp = getCurrentWorkspace(); Workspace *wksp = currentWorkspace();
Workspace::Windows wins = wksp->windowList(); Workspace::Windows wins = wksp->windowList();
Workspace::Windows::iterator it = wins.begin(); Workspace::Windows::iterator it = wins.begin();
for (; it != wins.end(); ++it) { for (; it != wins.end(); ++it) {
@ -1129,8 +1129,8 @@ void BScreen::changeWorkspaceID(unsigned int id) {
current_workspace = getWorkspace(id); current_workspace = getWorkspace(id);
workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, true); workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, true);
if (getToolbar() != 0) if (toolbar() != 0)
getToolbar()->redrawWorkspaceLabel(true); toolbar()->redrawWorkspaceLabel(true);
current_workspace->showAll(); current_workspace->showAll();
@ -1306,7 +1306,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
#ifdef SLIT #ifdef SLIT
if (win->initialState() == WithdrawnState) if (win->initialState() == WithdrawnState)
getSlit()->addClient(win->clientWindow()); slit()->addClient(win->clientWindow());
#endif // SLIT #endif // SLIT
if (!win->isManaged()) { if (!win->isManaged()) {
@ -1325,7 +1325,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
setupWindowActions(*win); setupWindowActions(*win);
Fluxbox::instance()->attachSignals(*win); Fluxbox::instance()->attachSignals(*win);
} }
if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) {
win->show(); win->show();
} }
XSync(FbTk::App::instance()->display(), False); XSync(FbTk::App::instance()->display(), False);
@ -1338,7 +1338,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
*layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); *layerManager().getLayer(Fluxbox::instance()->getNormalLayer()));
#ifdef SLIT #ifdef SLIT
if (win->initialState() == WithdrawnState) if (win->initialState() == WithdrawnState)
getSlit()->addClient(win->clientWindow()); slit()->addClient(win->clientWindow());
#endif // SLIT #endif // SLIT
if (!win->isManaged()) { if (!win->isManaged()) {
delete win; delete win;
@ -1350,7 +1350,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
Fluxbox::instance()->saveWindowSearch(client.window(), win); Fluxbox::instance()->saveWindowSearch(client.window(), win);
setupWindowActions(*win); setupWindowActions(*win);
Fluxbox::instance()->attachSignals(*win); Fluxbox::instance()->attachSignals(*win);
if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) {
win->show(); win->show();
} }
return win; return win;
@ -1527,11 +1527,10 @@ void BScreen::nextFocus(int opts) {
bool have_focused = false; bool have_focused = false;
int focused_window_number = -1; int focused_window_number = -1;
FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow(); FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow();
const int num_windows = getCurrentWorkspace()->numberOfWindows(); const int num_windows = currentWorkspace()->numberOfWindows();
if (focused != 0) { if (focused != 0) {
if (focused->screen().getScreenNumber() == if (focused->screen().screenNumber() == screenNumber()) {
getScreenNumber()) {
have_focused = true; have_focused = true;
focused_window_number = focused->windowNumber(); focused_window_number = focused->windowNumber();
} }
@ -1565,7 +1564,7 @@ void BScreen::nextFocus(int opts) {
FluxboxWindow *fbwin = (*it)->m_win; FluxboxWindow *fbwin = (*it)->m_win;
if (fbwin && !fbwin->isIconic() && if (fbwin && !fbwin->isIconic() &&
(fbwin->isStuck() (fbwin->isStuck()
|| fbwin->workspaceNumber() == getCurrentWorkspaceID())) { || fbwin->workspaceNumber() == currentWorkspaceID())) {
// either on this workspace, or stuck // either on this workspace, or stuck
// keep track of the originally selected window in a set // keep track of the originally selected window in a set
@ -1586,7 +1585,7 @@ void BScreen::nextFocus(int opts) {
} }
cycling_window = it; cycling_window = it;
} else { // not stacked cycling } else { // not stacked cycling
Workspace *wksp = getCurrentWorkspace(); Workspace *wksp = currentWorkspace();
Workspace::Windows &wins = wksp->windowList(); Workspace::Windows &wins = wksp->windowList();
Workspace::Windows::iterator it = wins.begin(); Workspace::Windows::iterator it = wins.begin();
@ -1617,11 +1616,10 @@ void BScreen::prevFocus(int opts) {
bool have_focused = false; bool have_focused = false;
int focused_window_number = -1; int focused_window_number = -1;
FluxboxWindow *focused; FluxboxWindow *focused;
int num_windows = getCurrentWorkspace()->numberOfWindows(); int num_windows = currentWorkspace()->numberOfWindows();
if ((focused = Fluxbox::instance()->getFocusedWindow())) { if ((focused = Fluxbox::instance()->getFocusedWindow())) {
if (focused->screen().getScreenNumber() == if (focused->screen().screenNumber() == screenNumber()) {
getScreenNumber()) {
have_focused = true; have_focused = true;
focused_window_number = focused->windowNumber(); focused_window_number = focused->windowNumber();
} }
@ -1656,7 +1654,7 @@ void BScreen::prevFocus(int opts) {
FluxboxWindow *fbwin = (*it)->m_win; FluxboxWindow *fbwin = (*it)->m_win;
if (fbwin && !fbwin->isIconic() && if (fbwin && !fbwin->isIconic() &&
(fbwin->isStuck() (fbwin->isStuck()
|| fbwin->workspaceNumber() == getCurrentWorkspaceID())) { || fbwin->workspaceNumber() == currentWorkspaceID())) {
// either on this workspace, or stuck // either on this workspace, or stuck
// keep track of the originally selected window in a set // keep track of the originally selected window in a set
@ -1679,7 +1677,7 @@ void BScreen::prevFocus(int opts) {
cycling_window = it; cycling_window = it;
} else { // not stacked cycling } else { // not stacked cycling
Workspace *wksp = getCurrentWorkspace(); Workspace *wksp = currentWorkspace();
Workspace::Windows &wins = wksp->windowList(); Workspace::Windows &wins = wksp->windowList();
Workspace::Windows::iterator it = wins.begin(); Workspace::Windows::iterator it = wins.begin();
@ -1712,13 +1710,12 @@ void BScreen::raiseFocus() {
Fluxbox * const fb = Fluxbox::instance(); Fluxbox * const fb = Fluxbox::instance();
if (fb->getFocusedWindow()) if (fb->getFocusedWindow())
if (fb->getFocusedWindow()->screen().getScreenNumber() == if (fb->getFocusedWindow()->screen().screenNumber() == screenNumber()) {
getScreenNumber()) {
have_focused = true; have_focused = true;
focused_window_number = fb->getFocusedWindow()->windowNumber(); focused_window_number = fb->getFocusedWindow()->windowNumber();
} }
if ((getCurrentWorkspace()->numberOfWindows() > 1) && have_focused) if ((currentWorkspace()->numberOfWindows() > 1) && have_focused)
fb->getFocusedWindow()->raise(); fb->getFocusedWindow()->raise();
} }
@ -1745,7 +1742,7 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) {
left = win.x(), left = win.x(),
right = win.x() + win.width() + 2*borderW; right = win.x() + win.width() + 2*borderW;
Workspace::Windows &wins = getCurrentWorkspace()->windowList(); Workspace::Windows &wins = currentWorkspace()->windowList();
Workspace::Windows::iterator it = wins.begin(); Workspace::Windows::iterator it = wins.begin();
for (; it != wins.end(); ++it) { for (; it != wins.end(); ++it) {
if ((*it) == &win) continue; // skip self if ((*it) == &win) continue; // skip self
@ -1883,7 +1880,7 @@ void BScreen::initMenu() {
if (defaultMenu) { if (defaultMenu) {
FbTk::RefCount<FbTk::Command> restart_fb(new FbCommands::RestartFluxboxCmd()); FbTk::RefCount<FbTk::Command> restart_fb(new FbCommands::RestartFluxboxCmd());
FbTk::RefCount<FbTk::Command> exit_fb(new FbCommands::ExitFluxboxCmd()); FbTk::RefCount<FbTk::Command> exit_fb(new FbCommands::ExitFluxboxCmd());
FbTk::RefCount<FbTk::Command> execute_xterm(new FbCommands::ExecuteCmd("xterm", getScreenNumber())); FbTk::RefCount<FbTk::Command> execute_xterm(new FbCommands::ExecuteCmd("xterm", screenNumber()));
m_rootmenu->setInternalMenu(); m_rootmenu->setInternalMenu();
m_rootmenu->insert(i18n->getMessage( m_rootmenu->insert(i18n->getMessage(
FBNLS::ScreenSet, FBNLS::Screenxterm, FBNLS::ScreenSet, FBNLS::Screenxterm,
@ -1955,7 +1952,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
"no menu label and/or command defined\n")); "no menu label and/or command defined\n"));
cerr<<"Row: "<<row<<endl; cerr<<"Row: "<<row<<endl;
} else { } else {
FbTk::RefCount<FbTk::Command> exec_cmd(new FbCommands::ExecuteCmd(str_cmd, getScreenNumber())); FbTk::RefCount<FbTk::Command> exec_cmd(new FbCommands::ExecuteCmd(str_cmd, screenNumber()));
FbTk::MacroCommand *exec_and_hide = new FbTk::MacroCommand(); FbTk::MacroCommand *exec_and_hide = new FbTk::MacroCommand();
exec_and_hide->add(hide_menu); exec_and_hide->add(hide_menu);
exec_and_hide->add(exec_cmd); exec_and_hide->add(exec_cmd);
@ -2192,9 +2189,9 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
"Focus Model"), "Focus Model"),
focus_menu); focus_menu);
#ifdef SLIT #ifdef SLIT
if (getSlit() != 0) { if (slit() != 0) {
getSlit()->menu().setInternalMenu(); slit()->menu().setInternalMenu();
menu.insert("Slit", &getSlit()->menu()); menu.insert("Slit", &slit()->menu());
} }
#endif // SLIT #endif // SLIT
menu.insert(i18n->getMessage( menu.insert(i18n->getMessage(
@ -2346,8 +2343,8 @@ void BScreen::showPosition(int x, int y) {
getHeadY(head) + (getHeadHeight(head) - geom_h) / 2, getHeadY(head) + (getHeadHeight(head) - geom_h) / 2,
geom_w, geom_h); geom_w, geom_h);
#else // !XINERMA #else // !XINERMA
geom_window.moveResize((getWidth() - geom_w) / 2, geom_window.moveResize((width() - geom_w) / 2,
(getHeight() - geom_h) / 2, geom_w, geom_h); (height() - geom_h) / 2, geom_w, geom_h);
#endif // XINERAMA #endif // XINERAMA
geom_window.show(); geom_window.show();
@ -2358,20 +2355,18 @@ void BScreen::showPosition(int x, int y) {
char label[256]; char label[256];
sprintf(label, sprintf(label,
I18n::instance()->getMessage( I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenPositionFormat,
FBNLS::ScreenSet, FBNLS::ScreenPositionFormat,
"X: %4d x Y: %4d"), x, y); "X: %4d x Y: %4d"), x, y);
geom_window.clear(); geom_window.clear();
winFrameTheme().font().drawText( winFrameTheme().font().drawText(geom_window.window(),
geom_window.window(), screenNumber(),
getScreenNumber(), winFrameTheme().labelTextFocusGC(),
winFrameTheme().labelTextFocusGC(), label, strlen(label),
label, strlen(label), m_root_theme->bevelWidth(),
m_root_theme->bevelWidth(), m_root_theme->bevelWidth() +
m_root_theme->bevelWidth() + winFrameTheme().font().ascent());
winFrameTheme().font().ascent());
} }
@ -2385,8 +2380,8 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
getHeadY(head) + (getHeadHeight(head) - geom_h) / 2, getHeadY(head) + (getHeadHeight(head) - geom_h) / 2,
geom_w, geom_h); geom_w, geom_h);
#else // !XINERMA #else // !XINERMA
geom_window.moveResize((getWidth() - geom_w) / 2, geom_window.moveResize((width() - geom_w) / 2,
(getHeight() - geom_h) / 2, geom_w, geom_h); (height() - geom_h) / 2, geom_w, geom_h);
#endif // XINERAMA #endif // XINERAMA
geom_window.show(); geom_window.show();
geom_window.raise(); geom_window.raise();
@ -2405,12 +2400,12 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
//TODO: geom window again?! repeated //TODO: geom window again?! repeated
winFrameTheme().font().drawText(geom_window.window(), winFrameTheme().font().drawText(geom_window.window(),
getScreenNumber(), screenNumber(),
winFrameTheme().labelTextFocusGC(), winFrameTheme().labelTextFocusGC(),
label, strlen(label), label, strlen(label),
m_root_theme->bevelWidth(), m_root_theme->bevelWidth(),
m_root_theme->bevelWidth() + m_root_theme->bevelWidth() +
winFrameTheme().font().ascent()); winFrameTheme().font().ascent());
} }
@ -2430,30 +2425,30 @@ void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) {
Goes to the workspace "right" of the current Goes to the workspace "right" of the current
*/ */
void BScreen::nextWorkspace(const int delta) { void BScreen::nextWorkspace(const int delta) {
changeWorkspaceID( (getCurrentWorkspaceID() + delta) % getCount()); changeWorkspaceID( (currentWorkspaceID() + delta) % getCount());
} }
/** /**
Goes to the workspace "left" of the current Goes to the workspace "left" of the current
*/ */
void BScreen::prevWorkspace(const int delta) { void BScreen::prevWorkspace(const int delta) {
changeWorkspaceID( (getCurrentWorkspaceID() - delta + getCount()) % getCount()); changeWorkspaceID( (currentWorkspaceID() - delta + getCount()) % getCount());
} }
/** /**
Goes to the workspace "right" of the current Goes to the workspace "right" of the current
*/ */
void BScreen::rightWorkspace(const int delta) { void BScreen::rightWorkspace(const int delta) {
if (getCurrentWorkspaceID()+delta < getCount()) if (currentWorkspaceID()+delta < getCount())
changeWorkspaceID(getCurrentWorkspaceID()+delta); changeWorkspaceID(currentWorkspaceID()+delta);
} }
/** /**
Goes to the workspace "left" of the current Goes to the workspace "left" of the current
*/ */
void BScreen::leftWorkspace(const int delta) { void BScreen::leftWorkspace(const int delta) {
if (getCurrentWorkspaceID() >= static_cast<unsigned int>(delta)) if (currentWorkspaceID() >= static_cast<unsigned int>(delta))
changeWorkspaceID(getCurrentWorkspaceID()-delta); changeWorkspaceID(currentWorkspaceID()-delta);
} }
/** /**
@ -2521,11 +2516,11 @@ void BScreen::updateSize() {
// reset background // reset background
m_root_theme->reconfigTheme(); m_root_theme->reconfigTheme();
if (getToolbar()) if (toolbar())
getToolbar()->reconfigure(); toolbar()->reconfigure();
if (getSlit()) if (slit())
getSlit()->reconfigure(); slit()->reconfigure();
//!! TODO: should we re-maximize the maximized windows? //!! TODO: should we re-maximize the maximized windows?

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.hh,v 1.96 2003/05/13 21:12:17 fluxgen Exp $ // $Id: Screen.hh,v 1.97 2003/05/15 12:00:44 fluxgen Exp $
#ifndef SCREEN_HH #ifndef SCREEN_HH
#define SCREEN_HH #define SCREEN_HH
@ -106,8 +106,8 @@ public:
inline bool &doSlitAutoHide() { return *resource.slit_auto_hide; } inline bool &doSlitAutoHide() { return *resource.slit_auto_hide; }
inline const bool &doSlitAutoHide() const { return *resource.slit_auto_hide; } inline const bool &doSlitAutoHide() const { return *resource.slit_auto_hide; }
inline Slit *getSlit() { return m_slit.get(); } inline Slit *slit() { return m_slit.get(); }
inline const Slit *getSlit() const { return m_slit.get(); } inline const Slit *slit() const { return m_slit.get(); }
inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; } inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; }
inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; } inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; }
@ -119,31 +119,31 @@ public:
inline unsigned int getSlitOnHead() const { return resource.slit_on_head; } inline unsigned int getSlitOnHead() const { return resource.slit_on_head; }
inline void saveSlitOnHead(unsigned int h) { resource.slit_on_head = h; } inline void saveSlitOnHead(unsigned int h) { resource.slit_on_head = h; }
inline const Toolbar *getToolbar() const { return m_toolbarhandler->getToolbar(); } inline const Toolbar *toolbar() const { return m_toolbarhandler->getToolbar(); }
inline Toolbar *getToolbar() { return m_toolbarhandler->getToolbar(); } inline Toolbar *toolbar() { return m_toolbarhandler->getToolbar(); }
inline const ToolbarHandler &getToolbarHandler() const { return *m_toolbarhandler; } inline const ToolbarHandler &toolbarHandler() const { return *m_toolbarhandler; }
inline ToolbarHandler &getToolbarHandler() { return *m_toolbarhandler; } inline ToolbarHandler &toolbarHandler() { return *m_toolbarhandler; }
inline Workspace *getWorkspace(unsigned int w) { return ( w < workspacesList.size() ? workspacesList[w] : 0); } inline Workspace *getWorkspace(unsigned int w) { return ( w < workspacesList.size() ? workspacesList[w] : 0); }
inline Workspace *getCurrentWorkspace() { return current_workspace; } inline Workspace *currentWorkspace() { return current_workspace; }
const FbTk::Menu *getWorkspacemenu() const { return workspacemenu.get(); } const FbTk::Menu *getWorkspacemenu() const { return workspacemenu.get(); }
FbTk::Menu *getWorkspacemenu() { return workspacemenu.get(); } FbTk::Menu *getWorkspacemenu() { return workspacemenu.get(); }
unsigned int getCurrentWorkspaceID() const; unsigned int currentWorkspaceID() const;
Pixmap rootPixmap() const; Pixmap rootPixmap() const;
/* /*
maximum screen surface maximum screen surface
*/ */
unsigned int getMaxLeft() const; unsigned int maxLeft() const;
unsigned int getMaxRight() const; unsigned int maxRight() const;
unsigned int getMaxTop() const; unsigned int maxTop() const;
unsigned int getMaxBottom() const; unsigned int maxBottom() const;
inline unsigned int getWidth() const { return rootWindow().width(); } inline unsigned int width() const { return rootWindow().width(); }
inline unsigned int getHeight() const { return rootWindow().height(); } inline unsigned int height() const { return rootWindow().height(); }
inline unsigned int getScreenNumber() const { return rootWindow().screenNumber(); } inline unsigned int screenNumber() const { return rootWindow().screenNumber(); }
typedef std::vector<FluxboxWindow *> Icons; typedef std::vector<FluxboxWindow *> Icons;
typedef std::list<WinClient *> FocusedWindows; typedef std::list<WinClient *> FocusedWindows;

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: Slit.cc,v 1.52 2003/05/13 21:09:43 fluxgen Exp $ // $Id: Slit.cc,v 1.53 2003/05/15 12:00:45 fluxgen Exp $
#include "Slit.hh" #include "Slit.hh"
@ -245,7 +245,7 @@ private:
class SlitTheme:public FbTk::Theme { class SlitTheme:public FbTk::Theme {
public: public:
explicit SlitTheme(Slit &slit):FbTk::Theme(slit.screen().getScreenNumber()), explicit SlitTheme(Slit &slit):FbTk::Theme(slit.screen().screenNumber()),
m_slit(slit), m_slit(slit),
m_texture(*this, "slit", "Slit") { m_texture(*this, "slit", "Slit") {
// default texture type // default texture type
@ -263,19 +263,19 @@ private:
Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
: m_screen(scr), m_timer(this), : m_screen(scr), m_timer(this),
m_slitmenu(*scr.menuTheme(), m_slitmenu(*scr.menuTheme(),
scr.getScreenNumber(), scr.screenNumber(),
*scr.getImageControl(), *scr.getImageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
m_placement_menu(*scr.menuTheme(), m_placement_menu(*scr.menuTheme(),
scr.getScreenNumber(), scr.screenNumber(),
*scr.getImageControl(), *scr.getImageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
m_clientlist_menu(*scr.menuTheme(), m_clientlist_menu(*scr.menuTheme(),
scr.getScreenNumber(), scr.screenNumber(),
*scr.getImageControl(), *scr.getImageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
m_layermenu(new LayerMenu<Slit>(*scr.menuTheme(), m_layermenu(new LayerMenu<Slit>(*scr.menuTheme(),
scr.getScreenNumber(), scr.screenNumber(),
*scr.getImageControl(), *scr.getImageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
this, this,
@ -322,7 +322,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
FbTk::EventManager::instance()->add(*this, frame.window); FbTk::EventManager::instance()->add(*this, frame.window);
m_transp.reset(new FbTk::Transparent(screen().rootPixmap(), frame.window.drawable(), m_transp.reset(new FbTk::Transparent(screen().rootPixmap(), frame.window.drawable(),
*screen().slitAlphaResource(), *screen().slitAlphaResource(),
screen().getScreenNumber())); screen().screenNumber()));
m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer));
@ -387,8 +387,8 @@ void Slit::addClient(Window w) {
if (wmhints != 0) { if (wmhints != 0) {
if ((wmhints->flags & IconWindowHint) && if ((wmhints->flags & IconWindowHint) &&
(wmhints->icon_window != None)) { (wmhints->icon_window != None)) {
XMoveWindow(disp, client->client_window, screen().getWidth() + 10, XMoveWindow(disp, client->client_window, screen().width() + 10,
screen().getHeight() + 10); screen().height() + 10);
XMapWindow(disp, client->client_window); XMapWindow(disp, client->client_window);
client->icon_window = wmhints->icon_window; client->icon_window = wmhints->icon_window;
client->window = client->icon_window; client->window = client->icon_window;
@ -790,8 +790,8 @@ void Slit::reposition() {
head_w, head_w,
head_h; head_h;
head_w = screen().getWidth(); head_w = screen().width();
head_h = screen().getHeight(); head_h = screen().height();
int border_width = screen().rootTheme().borderWidth(); int border_width = screen().rootTheme().borderWidth();
int bevel_width = screen().rootTheme().bevelWidth(); int bevel_width = screen().rootTheme().bevelWidth();
@ -985,13 +985,13 @@ void Slit::buttonPressEvent(XButtonEvent &e) {
if (x < 0) if (x < 0)
x = 0; x = 0;
else if (x + m_slitmenu.width() > screen().getWidth()) else if (x + m_slitmenu.width() > screen().width())
x = screen().getWidth() - m_slitmenu.width(); x = screen().width() - m_slitmenu.width();
if (y < 0) if (y < 0)
y = 0; y = 0;
else if (y + m_slitmenu.height() > screen().getHeight()) else if (y + m_slitmenu.height() > screen().height())
y = screen().getHeight() - m_slitmenu.height(); y = screen().height() - m_slitmenu.height();
m_slitmenu.move(x, y); m_slitmenu.move(x, y);
m_slitmenu.show(); m_slitmenu.show();
@ -1077,7 +1077,7 @@ void Slit::clearWindow() {
frame.window.clear(); frame.window.clear();
if (frame.pixmap != 0) { if (frame.pixmap != 0) {
if (screen().rootPixmap() != m_transp->source()) if (screen().rootPixmap() != m_transp->source())
m_transp->setSource(screen().rootPixmap(), screen().getScreenNumber()); m_transp->setSource(screen().rootPixmap(), screen().screenNumber());
m_transp->render(frame.window.x(), frame.window.y(), m_transp->render(frame.window.x(), frame.window.y(),
0, 0, 0, 0,

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: Toolbar.cc,v 1.81 2003/05/15 11:17:27 fluxgen Exp $ // $Id: Toolbar.cc,v 1.82 2003/05/15 12:00:45 fluxgen Exp $
#include "Toolbar.hh" #include "Toolbar.hh"
@ -250,20 +250,20 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi
editing(false), editing(false),
hidden(scrn.doToolbarAutoHide()), hidden(scrn.doToolbarAutoHide()),
do_auto_hide(scrn.doToolbarAutoHide()), do_auto_hide(scrn.doToolbarAutoHide()),
frame(*this, scrn.getScreenNumber()), frame(*this, scrn.screenNumber()),
m_screen(scrn), m_screen(scrn),
m_clock_timer(this), // get the clock updating every minute m_clock_timer(this), // get the clock updating every minute
m_hide_timer(&hide_handler), m_hide_timer(&hide_handler),
m_toolbarmenu(menu), m_toolbarmenu(menu),
m_placementmenu(*scrn.menuTheme(), m_placementmenu(*scrn.menuTheme(),
scrn.getScreenNumber(), *scrn.getImageControl()), scrn.screenNumber(), *scrn.getImageControl()),
m_layermenu(*scrn.menuTheme(), m_layermenu(*scrn.menuTheme(),
scrn.getScreenNumber(), scrn.screenNumber(),
*scrn.getImageControl(), *scrn.getImageControl(),
*scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
this, this,
true), true),
m_theme(scrn.getScreenNumber()), m_theme(scrn.screenNumber()),
m_place(BOTTOMCENTER), m_place(BOTTOMCENTER),
m_themelistener(*this), m_themelistener(*this),
m_layeritem(frame.window, layer) { m_layeritem(frame.window, layer) {
@ -778,7 +778,7 @@ void Toolbar::checkClock(bool redraw, bool date) {
frame.clock.clear(); frame.clock.clear();
m_theme.font().drawText( m_theme.font().drawText(
frame.clock.window(), frame.clock.window(),
screen().getScreenNumber(), screen().screenNumber(),
m_theme.clockTextGC(), m_theme.clockTextGC(),
t, newlen, t, newlen,
dx, dy); dx, dy);
@ -813,7 +813,7 @@ void Toolbar::redrawWindowLabel(bool redraw) {
m_theme.font().drawText( m_theme.font().drawText(
frame.window_label.window(), frame.window_label.window(),
screen().getScreenNumber(), screen().screenNumber(),
m_theme.windowTextGC(), m_theme.windowTextGC(),
foc->title().c_str(), newlen, foc->title().c_str(), newlen,
dx, dy); dx, dy);
@ -823,14 +823,14 @@ void Toolbar::redrawWindowLabel(bool redraw) {
void Toolbar::redrawWorkspaceLabel(bool redraw) { void Toolbar::redrawWorkspaceLabel(bool redraw) {
if (screen().getCurrentWorkspace()->name().size()==0) if (screen().currentWorkspace()->name().size()==0)
return; return;
if (redraw) if (redraw)
frame.workspace_label.clear(); frame.workspace_label.clear();
const char *text = screen().getCurrentWorkspace()->name().c_str(); const char *text = screen().currentWorkspace()->name().c_str();
size_t textlen = screen().getCurrentWorkspace()->name().size(); size_t textlen = screen().currentWorkspace()->name().size();
unsigned int newlen = textlen; unsigned int newlen = textlen;
int dx = FbTk::doAlignment(frame.workspace_label_w, frame.bevel_w, int dx = FbTk::doAlignment(frame.workspace_label_w, frame.bevel_w,
m_theme.justify(), m_theme.justify(),
@ -844,7 +844,7 @@ void Toolbar::redrawWorkspaceLabel(bool redraw) {
} }
m_theme.font().drawText( m_theme.font().drawText(
frame.workspace_label.window(), frame.workspace_label.window(),
screen().getScreenNumber(), screen().screenNumber(),
m_theme.labelTextGC(), m_theme.labelTextGC(),
text, newlen, text, newlen,
dx, dy); dx, dy);
@ -906,8 +906,8 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) {
} }
if (menu_x < 0) { if (menu_x < 0) {
menu_x = 0; menu_x = 0;
} else if (menu_x + wm.width() > screen().getWidth()) { } else if (menu_x + wm.width() > screen().width()) {
menu_x = screen().getWidth() - wm.width(); menu_x = screen().width() - wm.width();
} }
fluxboxwin->showMenu(menu_x, menu_y); fluxboxwin->showMenu(menu_x, menu_y);
@ -919,13 +919,13 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) {
if (x < 0) if (x < 0)
x = 0; x = 0;
else if (x + m_toolbarmenu.width() > screen().getWidth()) else if (x + m_toolbarmenu.width() > screen().width())
x = screen().getWidth() - m_toolbarmenu.width(); x = screen().width() - m_toolbarmenu.width();
if (y < 0) if (y < 0)
y = 0; y = 0;
else if (y + m_toolbarmenu.height() > screen().getHeight()) else if (y + m_toolbarmenu.height() > screen().height())
y = screen().getHeight() - m_toolbarmenu.height(); y = screen().height() - m_toolbarmenu.height();
m_toolbarmenu.move(x, y); m_toolbarmenu.move(x, y);
m_toolbarmenu.show(); m_toolbarmenu.show();
@ -949,13 +949,13 @@ void Toolbar::buttonReleaseEvent(XButtonEvent &re) {
int newy = menu->y(); // new y position of menu int newy = menu->y(); // new y position of menu
if (menu->x() < 0) if (menu->x() < 0)
newx = 0; newx = 0;
else if (menu->x() + menu->width() > screen().getWidth()) else if (menu->x() + menu->width() > screen().width())
newx = screen().getWidth() - menu->width(); newx = screen().width() - menu->width();
if (menu->y() < 0) if (menu->y() < 0)
newy = 0; newy = 0;
else if (menu->y() + menu->height() > screen().getHeight()) else if (menu->y() + menu->height() > screen().height())
newy = screen().getHeight() - menu->height(); newy = screen().height() - menu->height();
// move and show menu // move and show menu
menu->move(newx, newy); menu->move(newx, newy);
menu->show(); menu->show();
@ -1029,7 +1029,7 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) {
XSetInputFocus(display, PointerRoot, None, CurrentTime); XSetInputFocus(display, PointerRoot, None, CurrentTime);
if (ks == XK_Return) //change workspace name if keypress = Return if (ks == XK_Return) //change workspace name if keypress = Return
screen().getCurrentWorkspace()->setName(new_workspace_name.c_str()); screen().currentWorkspace()->setName(new_workspace_name.c_str());
new_workspace_name.erase(); //erase temporary workspace name new_workspace_name.erase(); //erase temporary workspace name
reconfigure(); reconfigure();
@ -1060,7 +1060,7 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) {
} }
m_theme.font().drawText(frame.workspace_label.window(), m_theme.font().drawText(frame.workspace_label.window(),
screen().getScreenNumber(), screen().screenNumber(),
screen().winFrameTheme().labelTextFocusGC(), screen().winFrameTheme().labelTextFocusGC(),
new_workspace_name.c_str(), l, new_workspace_name.c_str(), l,
x, dy); x, dy);
@ -1091,8 +1091,8 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
m_place = where; m_place = where;
head_w = screen().getWidth(); head_w = screen().width();
head_h = screen().getHeight(); head_h = screen().height();
frame.width = head_w * screen().getToolbarWidthPercent() / 100; frame.width = head_w * screen().getToolbarWidthPercent() / 100;
frame.height = m_theme.font().height(); frame.height = m_theme.font().height();

View file

@ -20,7 +20,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: ToolbarHandler.cc,v 1.11 2003/05/15 11:17:27 fluxgen Exp $ // $Id: ToolbarHandler.cc,v 1.12 2003/05/15 12:00:45 fluxgen Exp $
/** /**
* The ToolbarHandler class acts as a rough interface to the toolbar. * The ToolbarHandler class acts as a rough interface to the toolbar.
@ -91,9 +91,9 @@ void setupModeMenu(FbTk::Menu &menu, ToolbarHandler &handler) {
ToolbarHandler::ToolbarHandler(BScreen &screen, ToolbarMode mode) ToolbarHandler::ToolbarHandler(BScreen &screen, ToolbarMode mode)
: m_screen(screen), m_mode(mode), m_toolbar(0), m_current_workspace(0), : m_screen(screen), m_mode(mode), m_toolbar(0), m_current_workspace(0),
m_modemenu(*screen.menuTheme(), m_modemenu(*screen.menuTheme(),
screen.getScreenNumber(), *screen.getImageControl()), screen.screenNumber(), *screen.getImageControl()),
m_toolbarmenu(*screen.menuTheme(), m_toolbarmenu(*screen.menuTheme(),
screen.getScreenNumber(), *screen.getImageControl()) screen.screenNumber(), *screen.getImageControl())
{ {
m_modemenu.setInternalMenu(); m_modemenu.setInternalMenu();
setupModeMenu(m_modemenu, *this); setupModeMenu(m_modemenu, *this);
@ -147,8 +147,7 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
break; break;
case NONE: case NONE:
break; break;
case ALLWINDOWS: case ALLWINDOWS: {
{
BScreen::Workspaces::const_iterator workspace_it = m_screen.getWorkspacesList().begin(); BScreen::Workspaces::const_iterator workspace_it = m_screen.getWorkspacesList().begin();
BScreen::Workspaces::const_iterator workspace_it_end = m_screen.getWorkspacesList().end(); BScreen::Workspaces::const_iterator workspace_it_end = m_screen.getWorkspacesList().end();
for (; workspace_it != workspace_it_end; ++workspace_it) { for (; workspace_it != workspace_it_end; ++workspace_it) {
@ -168,8 +167,7 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
} }
// fall through and add icons // fall through and add icons
case LASTMODE: case LASTMODE:
case ICONS: case ICONS: {
{
BScreen::Icons &iconlist = m_screen.getIconList(); BScreen::Icons &iconlist = m_screen.getIconList();
BScreen::Icons::iterator iconit = iconlist.begin(); BScreen::Icons::iterator iconit = iconlist.begin();
BScreen::Icons::iterator iconit_end = iconlist.end(); BScreen::Icons::iterator iconit_end = iconlist.end();
@ -178,9 +176,8 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
} }
} }
break; break;
case WORKSPACE: case WORKSPACE: {
{ Workspace::Windows &wins = m_screen.currentWorkspace()->windowList();
Workspace::Windows &wins = m_screen.getCurrentWorkspace()->windowList();
Workspace::Windows::iterator wit = wins.begin(); Workspace::Windows::iterator wit = wins.begin();
Workspace::Windows::iterator wit_end = wins.end(); Workspace::Windows::iterator wit_end = wins.end();
for (; wit != wit_end; ++wit) { for (; wit != wit_end; ++wit) {
@ -188,9 +185,8 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
} }
} }
// fall through and add icons for this workspace // fall through and add icons for this workspace
case WORKSPACEICONS: case WORKSPACEICONS: {
{ m_current_workspace = m_screen.currentWorkspaceID();
m_current_workspace = m_screen.getCurrentWorkspaceID();
BScreen::Icons &wiconlist = m_screen.getIconList(); BScreen::Icons &wiconlist = m_screen.getIconList();
BScreen::Icons::iterator iconit = wiconlist.begin(); BScreen::Icons::iterator iconit = wiconlist.begin();
@ -273,7 +269,8 @@ void ToolbarHandler::updateState(FluxboxWindow &win) {
case ALLWINDOWS: case ALLWINDOWS:
break; break;
case WORKSPACEICONS: case WORKSPACEICONS:
if (win.workspaceNumber() != m_current_workspace) break; if (win.workspaceNumber() != m_current_workspace)
break;
// else fall through and do the same as icons (knowing it is the right ws) // else fall through and do the same as icons (knowing it is the right ws)
case LASTMODE: case LASTMODE:
case ICONS: case ICONS:
@ -313,10 +310,12 @@ void ToolbarHandler::updateWorkspace(FluxboxWindow &win) {
} }
void ToolbarHandler::updateCurrentWorkspace(BScreen &screen) { void ToolbarHandler::updateCurrentWorkspace(BScreen &screen) {
if (&screen != &m_screen) return; if (&screen != &m_screen)
return;
// if only displaying current workspace, update list // if only displaying current workspace, update list
// otherwise ignore it // otherwise ignore it
if (m_mode != WORKSPACE && m_mode != WORKSPACEICONS) return; if (m_mode != WORKSPACE && m_mode != WORKSPACEICONS)
return;
m_toolbar->delAllIcons(); m_toolbar->delAllIcons();
initForScreen(m_screen); initForScreen(m_screen);
} }

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: Window.cc,v 1.176 2003/05/15 11:17:27 fluxgen Exp $ // $Id: Window.cc,v 1.177 2003/05/15 12:00:46 fluxgen Exp $
#include "Window.hh" #include "Window.hh"
@ -236,16 +236,16 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
m_screen(scr), m_screen(scr),
m_timer(this), m_timer(this),
display(0), display(0),
m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), m_windowmenu(menutheme, scr.screenNumber(), *scr.getImageControl()),
m_layermenu(new LayerMenu<FluxboxWindow>(menutheme, m_layermenu(new LayerMenu<FluxboxWindow>(menutheme,
scr.getScreenNumber(), scr.screenNumber(),
*scr.getImageControl(), *scr.getImageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
this, this,
false)), false)),
m_old_decoration(DECOR_NORMAL), m_old_decoration(DECOR_NORMAL),
m_client(&client), m_client(&client),
m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.screenNumber(), 0, 0, 100, 100)),
m_layeritem(m_frame->window(), layer), m_layeritem(m_frame->window(), layer),
m_layernum(layer.getLayerNum()), m_layernum(layer.getLayerNum()),
m_parent(scr.rootWindow()) { m_parent(scr.rootWindow()) {
@ -269,16 +269,16 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
m_screen(scr), m_screen(scr),
m_timer(this), m_timer(this),
display(0), display(0),
m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), m_windowmenu(menutheme, scr.screenNumber(), *scr.getImageControl()),
m_layermenu(new LayerMenu<FluxboxWindow>(menutheme, m_layermenu(new LayerMenu<FluxboxWindow>(menutheme,
scr.getScreenNumber(), scr.screenNumber(),
*scr.getImageControl(), *scr.getImageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
this, this,
false)), false)),
m_old_decoration(DECOR_NORMAL), m_old_decoration(DECOR_NORMAL),
m_client(new WinClient(w, *this)), m_client(new WinClient(w, *this)),
m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.screenNumber(), 0, 0, 100, 100)),
m_layeritem(m_frame->window(), layer), m_layeritem(m_frame->window(), layer),
m_layernum(layer.getLayerNum()), m_layernum(layer.getLayerNum()),
m_parent(scr.rootWindow()) { m_parent(scr.rootWindow()) {
@ -484,8 +484,8 @@ void FluxboxWindow::init() {
if (real_x >= 0 && if (real_x >= 0 &&
real_y + frame().y() >= 0 && real_y + frame().y() >= 0 &&
real_x <= (signed) screen().getWidth() && real_x <= (signed) screen().width() &&
real_y <= (signed) screen().getHeight()) real_y <= (signed) screen().height())
place_window = false; place_window = false;
} else } else
@ -500,7 +500,7 @@ void FluxboxWindow::init() {
positionWindows(); positionWindows();
if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) if (m_workspace_number < 0 || m_workspace_number >= screen().getCount())
m_workspace_number = screen().getCurrentWorkspaceID(); m_workspace_number = screen().currentWorkspaceID();
restoreAttributes(); restoreAttributes();
@ -1180,23 +1180,23 @@ bool FluxboxWindow::setInputFocus() {
if (((signed) (frame().y() + frame().height())) < 0) { if (((signed) (frame().y() + frame().height())) < 0) {
moveResize(screen().rootTheme().borderWidth(), screen().rootTheme().borderWidth(), moveResize(screen().rootTheme().borderWidth(), screen().rootTheme().borderWidth(),
frame().width(), frame().height()); frame().width(), frame().height());
} else if (frame().y() > (signed) screen().getHeight()) { } else if (frame().y() > (signed) screen().height()) {
moveResize(screen().rootTheme().borderWidth(), screen().getHeight() - frame().height(), moveResize(screen().rootTheme().borderWidth(), screen().height() - frame().height(),
frame().width(), frame().height()); frame().width(), frame().height());
} else { } else {
moveResize(screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(), moveResize(screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(),
frame().width(), frame().height()); frame().width(), frame().height());
} }
} else if (frame().x() > (signed) screen().getWidth()) { } else if (frame().x() > (signed) screen().width()) {
if (((signed) (frame().y() + frame().height())) < 0) { if (((signed) (frame().y() + frame().height())) < 0) {
moveResize(screen().getWidth() - frame().width(), screen().rootTheme().borderWidth(), moveResize(screen().width() - frame().width(), screen().rootTheme().borderWidth(),
frame().width(), frame().height()); frame().width(), frame().height());
} else if (frame().y() > (signed) screen().getHeight()) { } else if (frame().y() > (signed) screen().height()) {
moveResize(screen().getWidth() - frame().width(), moveResize(screen().width() - frame().width(),
screen().getHeight() - frame().height(), screen().height() - frame().height(),
frame().width(), frame().height()); frame().width(), frame().height());
} else { } else {
moveResize(screen().getWidth() - frame().width(), moveResize(screen().width() - frame().width(),
frame().y() + screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(),
frame().width(), frame().height()); frame().width(), frame().height());
} }
@ -1299,8 +1299,8 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
oplock = true; oplock = true;
if (iconic || reassoc) { if (iconic || reassoc) {
screen().reassociateWindow(this, screen().getCurrentWorkspace()->workspaceID(), false); screen().reassociateWindow(this, screen().currentWorkspace()->workspaceID(), false);
} else if (moving || m_workspace_number != screen().getCurrentWorkspace()->workspaceID()) { } else if (moving || m_workspace_number != screen().currentWorkspace()->workspaceID()) {
oplock = false; oplock = false;
return; return;
} }
@ -1384,12 +1384,12 @@ void FluxboxWindow::maximize() {
m_old_height = frame().height(); m_old_height = frame().height();
m_old_pos_x = frame().x(); m_old_pos_x = frame().x();
m_old_pos_y = frame().y(); m_old_pos_y = frame().y();
unsigned int left_x = screen().getMaxLeft(); unsigned int left_x = screen().maxLeft();
unsigned int max_width = screen().getMaxRight(); unsigned int max_width = screen().maxRight();
unsigned int max_top = screen().getMaxTop(); unsigned int max_top = screen().maxTop();
moveResize(left_x, max_top, moveResize(left_x, max_top,
max_width - left_x, max_width - left_x,
screen().getMaxBottom() - max_top - frame().window().borderWidth()); screen().maxBottom() - max_top - frame().window().borderWidth());
} else { // demaximize, restore to old values } else { // demaximize, restore to old values
moveResize(m_old_pos_x, m_old_pos_y, moveResize(m_old_pos_x, m_old_pos_y,
m_old_width, m_old_height); m_old_width, m_old_height);
@ -1399,8 +1399,8 @@ void FluxboxWindow::maximize() {
} }
void FluxboxWindow::maximizeHorizontal() { void FluxboxWindow::maximizeHorizontal() {
unsigned int left_x = screen().getMaxLeft(); unsigned int left_x = screen().maxLeft();
unsigned int max_width = screen().getMaxRight(); unsigned int max_width = screen().maxRight();
moveResize(left_x, frame().y(), moveResize(left_x, frame().y(),
max_width - left_x, frame().height() - frame().window().borderWidth()); max_width - left_x, frame().height() - frame().window().borderWidth());
@ -1410,10 +1410,10 @@ void FluxboxWindow::maximizeHorizontal() {
Maximize window horizontal Maximize window horizontal
*/ */
void FluxboxWindow::maximizeVertical() { void FluxboxWindow::maximizeVertical() {
unsigned int max_top = screen().getMaxTop(); unsigned int max_top = screen().maxTop();
moveResize(frame().x(), max_top, moveResize(frame().x(), max_top,
frame().width() - frame().window().borderWidth(), frame().width() - frame().window().borderWidth(),
screen().getMaxBottom() - max_top); screen().maxBottom() - max_top);
} }
@ -1862,7 +1862,7 @@ void FluxboxWindow::restoreAttributes() {
m_current_state = save_state; m_current_state = save_state;
} }
if (( m_blackbox_attrib.workspace != screen().getCurrentWorkspaceID()) && if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) &&
( m_blackbox_attrib.workspace < screen().getCount())) { ( m_blackbox_attrib.workspace < screen().getCount())) {
m_workspace_number = m_blackbox_attrib.workspace; m_workspace_number = m_blackbox_attrib.workspace;
@ -2434,12 +2434,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
m_last_resize_y = me.y_root; m_last_resize_y = me.y_root;
if (moved_x && screen().isWorkspaceWarping()) { if (moved_x && screen().isWorkspaceWarping()) {
unsigned int cur_id = screen().getCurrentWorkspaceID(); unsigned int cur_id = screen().currentWorkspaceID();
unsigned int new_id = cur_id; unsigned int new_id = cur_id;
const int warpPad = screen().getEdgeSnapThreshold(); const int warpPad = screen().getEdgeSnapThreshold();
// 1) if we're inside the border threshold // 1) if we're inside the border threshold
// 2) if we moved in the right direction // 2) if we moved in the right direction
if (me.x_root >= int(screen().getWidth()) - warpPad - 1 && if (me.x_root >= int(screen().width()) - warpPad - 1 &&
moved_x > 0) { moved_x > 0) {
//warp right //warp right
new_id = (cur_id + 1) % screen().getCount(); new_id = (cur_id + 1) % screen().getCount();
@ -2448,7 +2448,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
moved_x < 0) { moved_x < 0) {
//warp left //warp left
new_id = (cur_id + screen().getCount() - 1) % screen().getCount(); new_id = (cur_id + screen().getCount() - 1) % screen().getCount();
dx = screen().getWidth() - me.x_root-1; // move mouse to screen width - 1 dx = screen().width() - me.x_root-1; // move mouse to screen width - 1
} }
if (new_id != cur_id) { if (new_id != cur_id) {
XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0);
@ -2559,12 +2559,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
dy -= screen().rootTheme().borderWidth(); dy -= screen().rootTheme().borderWidth();
if (screen().getEdgeSnapThreshold()) { if (screen().getEdgeSnapThreshold()) {
int drx = screen().getWidth() - (dx + 1); int drx = screen().width() - (dx + 1);
if (dx > 0 && dx < drx && dx < screen().getEdgeSnapThreshold()) if (dx > 0 && dx < drx && dx < screen().getEdgeSnapThreshold())
dx = 0; dx = 0;
else if (drx > 0 && drx < screen().getEdgeSnapThreshold()) else if (drx > 0 && drx < screen().getEdgeSnapThreshold())
dx = screen().getWidth() - 1; dx = screen().width() - 1;
int dty, dby; int dty, dby;
@ -2821,8 +2821,8 @@ void FluxboxWindow::stopMoving() {
frame().width() + 2*frame().window().borderWidth()-1, frame().width() + 2*frame().window().borderWidth()-1,
frame().height() + 2*frame().window().borderWidth()-1); frame().height() + 2*frame().window().borderWidth()-1);
moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height()); moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height());
if (m_workspace_number != screen().getCurrentWorkspaceID()) { if (m_workspace_number != screen().currentWorkspaceID()) {
screen().reassociateWindow(this, screen().getCurrentWorkspaceID(), true); screen().reassociateWindow(this, screen().currentWorkspaceID(), true);
frame().show(); frame().show();
} }
fluxbox->ungrab(); fluxbox->ungrab();
@ -2853,7 +2853,7 @@ void FluxboxWindow::resumeMoving() {
return; return;
} }
if (m_workspace_number == screen().getCurrentWorkspaceID()) { if (m_workspace_number == screen().currentWorkspaceID()) {
frame().show(); frame().show();
} }
XSync(display,false); XSync(display,false);
@ -2930,13 +2930,13 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
///////////////////////////////////// /////////////////////////////////////
// begin by checking the screen edges // begin by checking the screen edges
snapToWindow(dx, dy, left, right, top, bottom, 0, screen().getWidth(), 0, screen().getHeight()); snapToWindow(dx, dy, left, right, top, bottom, 0, screen().width(), 0, screen().height());
///////////////////////////////////// /////////////////////////////////////
// now check window edges // now check window edges
Workspace::Windows &wins = Workspace::Windows &wins =
screen().getCurrentWorkspace()->windowList(); screen().currentWorkspace()->windowList();
Workspace::Windows::iterator it = wins.begin(); Workspace::Windows::iterator it = wins.begin();
Workspace::Windows::iterator it_end = wins.end(); Workspace::Windows::iterator it_end = wins.end();
@ -2951,26 +2951,6 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
(*it)->y() + (*it)->height() + 2*borderW); (*it)->y() + (*it)->height() + 2*borderW);
} }
/////////////////////////////////////
// now the toolbar
Toolbar *tbar = screen().getToolbar();
if (tbar)
snapToWindow(dx, dy, left, right, top, bottom,
tbar->x(), tbar->x() + tbar->width() + 2*borderW,
tbar->y(), tbar->y() + tbar->height() + 2*borderW);
/////////////////////////////////////
// and the slit
#ifdef SLIT
Slit *slit = screen().getSlit();
if (slit)
snapToWindow(dx, dy, left, right, top, bottom,
slit->x(), slit->x() + slit->width() + 2*borderW,
slit->y(), slit->y() + slit->height() + 2*borderW);
#endif // SLIT
// commit // commit
if (dx <= screen().getEdgeSnapThreshold()) if (dx <= screen().getEdgeSnapThreshold())
orig_left += dx; orig_left += dx;
@ -3066,10 +3046,11 @@ void FluxboxWindow::attachTo(int x, int y) {
//finds and redraw the icon label //finds and redraw the icon label
void FluxboxWindow::updateIcon() { void FluxboxWindow::updateIcon() {
if (screen().getToolbar()) { //!! TODO we shouldn't know about the toolbar in fluxboxwindow!
if (screen().toolbar()) {
const IconBar *iconbar = 0; const IconBar *iconbar = 0;
const IconBarObj *icon = 0; const IconBarObj *icon = 0;
if ((iconbar = screen().getToolbar()->iconBar()) != 0) { if ((iconbar = screen().toolbar()->iconBar()) != 0) {
if ((icon = iconbar->findIcon(this)) != 0) if ((icon = iconbar->findIcon(this)) != 0)
iconbar->draw(icon, icon->width()); iconbar->draw(icon, icon->width());
} }
@ -3216,7 +3197,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) {
screen().reassociateWindow(this, net.workspace, true); screen().reassociateWindow(this, net.workspace, true);
if (screen().getCurrentWorkspaceID() != net.workspace) if (screen().currentWorkspaceID() != net.workspace)
withdraw(); withdraw();
else else
deiconify(); deiconify();

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: Workspace.cc,v 1.64 2003/05/15 11:17:27 fluxgen Exp $ // $Id: Workspace.cc,v 1.65 2003/05/15 12:00:46 fluxgen Exp $
#include "Workspace.hh" #include "Workspace.hh"
@ -115,7 +115,7 @@ Workspace::GroupList Workspace::m_groups;
Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int i): Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int i):
m_screen(scrn), m_screen(scrn),
m_lastfocus(0), m_lastfocus(0),
m_clientmenu(*scrn.menuTheme(), scrn.getScreenNumber(), *scrn.getImageControl()), m_clientmenu(*scrn.menuTheme(), scrn.screenNumber(), *scrn.getImageControl()),
m_layermanager(layermanager), m_layermanager(layermanager),
m_name(""), m_name(""),
m_id(i), m_id(i),
@ -401,7 +401,7 @@ void Workspace::update() {
bool Workspace::isCurrent() const{ bool Workspace::isCurrent() const{
return (m_id == screen().getCurrentWorkspaceID()); return (m_id == screen().currentWorkspaceID());
} }
@ -440,7 +440,7 @@ void Workspace::setName(const std::string &name) {
*/ */
void Workspace::shutdown() { void Workspace::shutdown() {
#ifdef DEBUG #ifdef DEBUG
cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<<screen().getScreenNumber()<<", ws "<< cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<<screen().screenNumber()<<", ws "<<
m_id<<", windowlist:"<<endl; m_id<<", windowlist:"<<endl;
copy(m_windowlist.begin(), m_windowlist.end(), copy(m_windowlist.begin(), m_windowlist.end(),
ostream_iterator<FluxboxWindow *>(cerr, " \n")); ostream_iterator<FluxboxWindow *>(cerr, " \n"));
@ -507,10 +507,10 @@ void Workspace::placeWindow(FluxboxWindow &win) {
test_x = root_x - (win_w / 2); test_x = root_x - (win_w / 2);
test_y = root_y - (win_h / 2); test_y = root_y - (win_h / 2);
min_x = (int) screen().getMaxLeft(); min_x = (int) screen().maxLeft();
min_y = (int) screen().getMaxTop(); min_y = (int) screen().maxTop();
max_x = (int) screen().getMaxRight() - win_w; max_x = (int) screen().maxRight() - win_w;
max_y = (int) screen().getMaxBottom() - win_h; max_y = (int) screen().maxBottom() - win_h;
// keep the window inside the screen // keep the window inside the screen
@ -539,21 +539,21 @@ void Workspace::placeWindow(FluxboxWindow &win) {
test_y = 0; test_y = 0;
if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP) if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
test_y = screen().getHeight() - win_h - test_y; test_y = screen().height() - win_h - test_y;
while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ? while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ?
test_y > 0 : test_y + win_h < (signed) screen().getHeight()) && test_y > 0 : test_y + win_h < (signed) screen().height()) &&
! placed) { ! placed) {
test_x = 0; test_x = 0;
if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT)
test_x = screen().getWidth() - win_w - test_x; test_x = screen().width() - win_w - test_x;
while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ? while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
test_x > 0 : test_x + win_w < (signed) screen().getWidth()) && ! placed) { test_x > 0 : test_x + win_w < (signed) screen().width()) && ! placed) {
placed = true; placed = true;
@ -599,19 +599,19 @@ void Workspace::placeWindow(FluxboxWindow &win) {
if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT)
test_x = screen().getWidth() - win_w - test_x; test_x = screen().width() - win_w - test_x;
while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ? while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
test_x > 0 : test_x + win_w < (signed) screen().getWidth()) && test_x > 0 : test_x + win_w < (signed) screen().width()) &&
!placed) { !placed) {
test_y = 0; test_y = 0;
if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP) if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
test_y = screen().getHeight() - win_h - test_y; test_y = screen().height() - win_h - test_y;
while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ? while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ?
test_y > 0 : test_y + win_h < (signed) screen().getHeight()) && test_y > 0 : test_y + win_h < (signed) screen().height()) &&
!placed) { !placed) {
placed = True; placed = True;
@ -656,8 +656,8 @@ void Workspace::placeWindow(FluxboxWindow &win) {
// cascade placement or smart placement failed // cascade placement or smart placement failed
if (! placed) { if (! placed) {
if (((unsigned) m_cascade_x > (screen().getWidth() / 2)) || if (((unsigned) m_cascade_x > (screen().width() / 2)) ||
((unsigned) m_cascade_y > (screen().getHeight() / 2))) ((unsigned) m_cascade_y > (screen().height() / 2)))
m_cascade_x = m_cascade_y = 32; m_cascade_x = m_cascade_y = 32;
place_x = m_cascade_x; place_x = m_cascade_x;
@ -667,10 +667,10 @@ void Workspace::placeWindow(FluxboxWindow &win) {
m_cascade_y += win.titleHeight(); m_cascade_y += win.titleHeight();
} }
if (place_x + win_w > (signed) screen().getWidth()) if (place_x + win_w > (signed) screen().width())
place_x = (((signed) screen().getWidth()) - win_w) / 2; place_x = (((signed) screen().width()) - win_w) / 2;
if (place_y + win_h > (signed) screen().getHeight()) if (place_y + win_h > (signed) screen().height())
place_y = (((signed) screen().getHeight()) - win_h) / 2; place_y = (((signed) screen().height()) - win_h) / 2;
win.moveResize(place_x, place_y, win.width(), win.height()); win.moveResize(place_x, place_y, win.width(), win.height());

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: fluxbox.cc,v 1.148 2003/05/15 11:17:27 fluxgen Exp $ // $Id: fluxbox.cc,v 1.149 2003/05/15 12:00:46 fluxgen Exp $
#include "fluxbox.hh" #include "fluxbox.hh"
@ -523,7 +523,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
#endif // HAVE_RANDR #endif // HAVE_RANDR
m_screen_list.push_back(screen); m_screen_list.push_back(screen);
m_atomhandler.push_back(&screen->getToolbarHandler()); m_atomhandler.push_back(&screen->toolbarHandler());
// attach screen signals to this // attach screen signals to this
screen->currentWorkspaceSig().attach(this); screen->currentWorkspaceSig().attach(this);
@ -919,15 +919,15 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
if (my < 0) my = 0; if (my < 0) my = 0;
if (mx + screen->getWorkspacemenu()->width() > if (mx + screen->getWorkspacemenu()->width() >
screen->getWidth()) { screen->width()) {
mx = screen->getWidth() - mx = screen->width() -
screen->getWorkspacemenu()->width() - screen->getWorkspacemenu()->width() -
screen->getWorkspacemenu()->fbwindow().borderWidth(); screen->getWorkspacemenu()->fbwindow().borderWidth();
} }
if (my + screen->getWorkspacemenu()->height() > if (my + screen->getWorkspacemenu()->height() >
screen->getHeight()) { screen->height()) {
my = screen->getHeight() - my = screen->height() -
screen->getWorkspacemenu()->height() - screen->getWorkspacemenu()->height() -
screen->getWorkspacemenu()->fbwindow().borderWidth(); screen->getWorkspacemenu()->fbwindow().borderWidth();
} }
@ -948,15 +948,15 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
if (mx < 0) mx = 0; if (mx < 0) mx = 0;
if (my < 0) my = 0; if (my < 0) my = 0;
if (mx + screen->getRootmenu()->width() > screen->getWidth()) { if (mx + screen->getRootmenu()->width() > screen->width()) {
mx = screen->getWidth() - mx = screen->width() -
screen->getRootmenu()->width() - screen->getRootmenu()->width() -
screen->getRootmenu()->fbwindow().borderWidth(); screen->getRootmenu()->fbwindow().borderWidth();
} }
if (my + screen->getRootmenu()->height() > if (my + screen->getRootmenu()->height() >
screen->getHeight()) { screen->height()) {
my = screen->getHeight() - my = screen->height() -
screen->getRootmenu()->height() - screen->getRootmenu()->height() -
screen->getRootmenu()->fbwindow().borderWidth(); screen->getRootmenu()->fbwindow().borderWidth();
} }
@ -1274,7 +1274,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
case Keys::ATTACHLAST: case Keys::ATTACHLAST:
//!! just attach last window to focused window //!! just attach last window to focused window
if (m_focused_window) { if (m_focused_window) {
Workspace *space = keyscreen->getCurrentWorkspace(); Workspace *space = keyscreen->currentWorkspace();
Workspace::Windows &wins = space->windowList(); Workspace::Windows &wins = space->windowList();
if (wins.size() == 1) if (wins.size() == 1)
break; break;
@ -1283,7 +1283,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
for (; it != fwins.end(); ++it) { for (; it != fwins.end(); ++it) {
if ((*it)->fbwindow() != m_focused_window && if ((*it)->fbwindow() != m_focused_window &&
(*it)->fbwindow()->workspaceNumber() == (*it)->fbwindow()->workspaceNumber() ==
keyscreen->getCurrentWorkspaceID()) { keyscreen->currentWorkspaceID()) {
m_focused_window->attachClient(**it); m_focused_window->attachClient(**it);
break; break;
} }
@ -1296,7 +1296,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
} }
break; break;
case Keys::EXECUTE: { //execute command on keypress case Keys::EXECUTE: { //execute command on keypress
FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->getScreenNumber()); FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->screenNumber());
cmd.execute(); cmd.execute();
} break; } break;
case Keys::QUIT: case Keys::QUIT:
@ -1314,15 +1314,15 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
if (mx < 0) mx = 0; if (mx < 0) mx = 0;
if (my < 0) my = 0; if (my < 0) my = 0;
if (mx + mousescreen->getRootmenu()->width() > mousescreen->getWidth()) { if (mx + mousescreen->getRootmenu()->width() > mousescreen->width()) {
mx = mousescreen->getWidth() - mx = mousescreen->width() -
mousescreen->getRootmenu()->width() - mousescreen->getRootmenu()->width() -
mousescreen->getRootmenu()->fbwindow().borderWidth(); mousescreen->getRootmenu()->fbwindow().borderWidth();
} }
if (my + mousescreen->getRootmenu()->height() > if (my + mousescreen->getRootmenu()->height() >
mousescreen->getHeight()) { mousescreen->height()) {
my = mousescreen->getHeight() - my = mousescreen->height() -
mousescreen->getRootmenu()->height() - mousescreen->getRootmenu()->height() -
mousescreen->getRootmenu()->fbwindow().borderWidth(); mousescreen->getRootmenu()->fbwindow().borderWidth();
} }
@ -1571,9 +1571,9 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
// if we're sticky then reassociate window // if we're sticky then reassociate window
// to all workspaces // to all workspaces
BScreen &scr = win.screen(); BScreen &scr = win.screen();
if (scr.getCurrentWorkspaceID() != win.workspaceNumber()) { if (scr.currentWorkspaceID() != win.workspaceNumber()) {
scr.reassociateWindow(&win, scr.reassociateWindow(&win,
scr.getCurrentWorkspaceID(), scr.currentWorkspaceID(),
true); true);
} }
} }
@ -1785,7 +1785,7 @@ void Fluxbox::save_rc() {
for (; it != it_end; ++it) { for (; it != it_end; ++it) {
BScreen *screen = *it; BScreen *screen = *it;
int screen_number = screen->getScreenNumber(); int screen_number = screen->screenNumber();
/* /*
#ifdef SLIT #ifdef SLIT
@ -2003,7 +2003,7 @@ void Fluxbox::load_rc(BScreen &screen) {
XrmValue value; XrmValue value;
char *value_type, name_lookup[1024], class_lookup[1024]; char *value_type, name_lookup[1024], class_lookup[1024];
int screen_number = screen.getScreenNumber(); int screen_number = screen.screenNumber();
sprintf(name_lookup, "session.screen%d.rowPlacementDirection", screen_number); sprintf(name_lookup, "session.screen%d.rowPlacementDirection", screen_number);
sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection", screen_number); sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection", screen_number);
@ -2185,8 +2185,8 @@ void Fluxbox::loadRootCommand(BScreen &screen) {
XrmValue value; XrmValue value;
char *value_type, name_lookup[1024], class_lookup[1024]; char *value_type, name_lookup[1024], class_lookup[1024];
sprintf(name_lookup, "session.screen%d.rootCommand", screen.getScreenNumber()); sprintf(name_lookup, "session.screen%d.rootCommand", screen.screenNumber());
sprintf(class_lookup, "Session.Screen%d.RootCommand", screen.getScreenNumber()); sprintf(class_lookup, "Session.Screen%d.RootCommand", screen.screenNumber());
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
&value)) { &value)) {
screen.saveRootCommand(value.addr==0 ? "": value.addr); screen.saveRootCommand(value.addr==0 ? "": value.addr);
@ -2368,7 +2368,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
old_win = m_focused_window; old_win = m_focused_window;
old_screen = &old_win->screen(); old_screen = &old_win->screen();
old_tbar = old_screen->getToolbar(); old_tbar = old_screen->toolbar();
old_wkspc = old_screen->getWorkspace(old_win->workspaceNumber()); old_wkspc = old_screen->getWorkspace(old_win->workspaceNumber());
old_win->setFocusFlag(false); old_win->setFocusFlag(false);
@ -2385,7 +2385,7 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
m_focused_window = 0; // the window pointer wasn't valid, mark no window focused m_focused_window = 0; // the window pointer wasn't valid, mark no window focused
} else { } else {
screen = *winscreen; screen = *winscreen;
tbar = screen->getToolbar(); tbar = screen->toolbar();
wkspc = screen->getWorkspace(win->workspaceNumber()); wkspc = screen->getWorkspace(win->workspaceNumber());
m_focused_window = win; // update focused window m_focused_window = win; // update focused window
win->setFocusFlag(true); // set focus flag win->setFocusFlag(true); // set focus flag
@ -2419,7 +2419,7 @@ void Fluxbox::revertFocus(BScreen &screen) {
// Relevant resources: // Relevant resources:
// resource.focus_last = whether we focus last focused when changing workspace // resource.focus_last = whether we focus last focused when changing workspace
// Fluxbox::FocusModel = sloppy, click, whatever // Fluxbox::FocusModel = sloppy, click, whatever
WinClient *next_focus = screen.getLastFocusedWindow(screen.getCurrentWorkspaceID()); WinClient *next_focus = screen.getLastFocusedWindow(screen.currentWorkspaceID());
// if setting focus fails, or isn't possible, fallback correctly // if setting focus fails, or isn't possible, fallback correctly
if (!(next_focus && next_focus->fbwindow() && if (!(next_focus && next_focus->fbwindow() &&