From cbce8634dde14fd7000fde92e86f4bd4bf3525c2 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 15 May 2003 11:17:29 +0000 Subject: cleaning in FluxboxWindow interface --- src/Ewmh.cc | 10 +- src/FbWinFrame.cc | 5 +- src/Gnome.cc | 20 +- src/IconBar.cc | 11 +- src/LayerMenu.hh | 12 +- src/Remember.cc | 26 +-- src/Screen.cc | 57 +++--- src/Slit.hh | 4 +- src/Toolbar.cc | 15 +- src/Toolbar.hh | 4 +- src/ToolbarHandler.cc | 16 +- src/Window.cc | 539 ++++++++++++++++++++++++++------------------------ src/Window.hh | 75 +++---- src/Workspace.cc | 32 +-- src/fluxbox.cc | 44 ++--- src/tests/Makefile | 10 +- 16 files changed, 452 insertions(+), 428 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 654a27e..8ec768b 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.cc,v 1.23 2003/05/11 17:06:02 fluxgen Exp $ +// $Id: Ewmh.cc,v 1.24 2003/05/15 11:17:26 fluxgen Exp $ #include "Ewmh.hh" @@ -103,7 +103,7 @@ void Ewmh::setupWindow(FluxboxWindow &win) { unsigned long nitems, bytes_after; long *data = 0; /* - if (XGetWindowProperty(disp, win.getClientWindow(), + if (XGetWindowProperty(disp, win.clientWindow(), m_net_wm_state, 0, 1, False, XA_CARDINAL, &ret_type, &fmt, &nitems, &bytes_after, (unsigned char **) &data) == Success && data) { @@ -112,7 +112,7 @@ void Ewmh::setupWindow(FluxboxWindow &win) { XFree(data); } */ - if (XGetWindowProperty(disp, win.getClientWindow(), + if (XGetWindowProperty(disp, win.clientWindow(), m_net_wm_desktop, 0, 1, False, XA_CARDINAL, &ret_type, &fmt, &nitems, &bytes_after, (unsigned char **) &data) == Success && data) { @@ -168,7 +168,7 @@ void Ewmh::updateClientList(BScreen &screen) { (*workspace_it)->windowList().end(); for (; it != it_end; ++it) { if ((*it)->numClients() == 1) - wl[win++] = (*it)->getClientWindow(); + wl[win++] = (*it)->clientWindow(); else { // add every client in fluxboxwindow to list window list std::list::iterator client_it = @@ -251,7 +251,7 @@ void Ewmh::updateHints(FluxboxWindow &win) { } void Ewmh::updateWorkspace(FluxboxWindow &win) { - int workspace = win.getWorkspaceNumber(); + int workspace = win.workspaceNumber(); if (win.isStuck()) workspace = 0xFFFFFFFF; // appear on all desktops/workspaces diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 8d33a3e..1ec9232 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.23 2003/05/01 13:19:36 rathnor Exp $ +// $Id: FbWinFrame.cc,v 1.24 2003/05/15 11:17:26 fluxgen Exp $ #include "FbWinFrame.hh" #include "ImageControl.hh" @@ -284,7 +284,6 @@ void FbWinFrame::setClientWindow(Window win) { XSetWindowBorderWidth(display, win, 0); XChangeSaveSet(display, win, SetModeInsert); - XSelectInput(display, m_clientarea.window(), NoEventMask); // we need to mask this so we don't get unmap event @@ -292,7 +291,7 @@ void FbWinFrame::setClientWindow(Window win) { XReparentWindow(display, win, m_clientarea.window(), 0, 0); // remask window so we get events XSelectInput(display, win, PropertyChangeMask | StructureNotifyMask | - FocusChangeMask ); + FocusChangeMask); XSelectInput(display, m_clientarea.window(), SubstructureRedirectMask); XFlush(display); diff --git a/src/Gnome.cc b/src/Gnome.cc index 72e8ddd..004e95a 100644 --- a/src/Gnome.cc +++ b/src/Gnome.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Gnome.cc,v 1.22 2003/05/11 17:11:58 fluxgen Exp $ +// $Id: Gnome.cc,v 1.23 2003/05/15 11:17:27 fluxgen Exp $ #include "Gnome.hh" @@ -92,7 +92,7 @@ void Gnome::setupWindow(FluxboxWindow &win) { unsigned long nitems, bytes_after; long flags, *data = 0; - if (XGetWindowProperty(disp, win.getClientWindow(), + if (XGetWindowProperty(disp, win.clientWindow(), m_gnome_wm_win_state, 0, 1, False, XA_CARDINAL, &ret_type, &fmt, &nitems, &bytes_after, (unsigned char **) &data) == Success && data) { @@ -102,7 +102,7 @@ void Gnome::setupWindow(FluxboxWindow &win) { } // load gnome layer atom - if (XGetWindowProperty(disp, win.getClientWindow(), + if (XGetWindowProperty(disp, win.clientWindow(), m_gnome_wm_win_layer, 0, 1, False, XA_CARDINAL, &ret_type, &fmt, &nitems, &bytes_after, (unsigned char **) &data) == Success && data) { @@ -112,12 +112,12 @@ void Gnome::setupWindow(FluxboxWindow &win) { } // load gnome workspace atom - if (XGetWindowProperty(disp, win.getClientWindow(), + if (XGetWindowProperty(disp, win.clientWindow(), m_gnome_wm_win_workspace, 0, 1, False, XA_CARDINAL, &ret_type, &fmt, &nitems, &bytes_after, (unsigned char **) &data) == Success && data) { unsigned int workspace_num = *data; - if (win.getWorkspaceNumber() != workspace_num) + if (win.workspaceNumber() != workspace_num) win.screen().reassociateWindow(&win, workspace_num, false); XFree (data); } @@ -222,12 +222,12 @@ void Gnome::updateWorkspaceCount(BScreen &screen) { } void Gnome::updateWorkspace(FluxboxWindow &win) { - int val = win.getWorkspaceNumber(); + int val = win.workspaceNumber(); #ifdef DEBUG cerr<<__FILE__<<"("<<__LINE__<<"): setting workspace("<display(), win.getClientWindow(), + XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); } @@ -242,7 +242,7 @@ void Gnome::updateState(FluxboxWindow &win) { if (win.isShaded()) state |= WIN_STATE_SHADED; - XChangeProperty(FbTk::App::instance()->display(), win.getClientWindow(), + XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), m_gnome_wm_win_state, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&state, 1); } @@ -250,8 +250,8 @@ void Gnome::updateState(FluxboxWindow &win) { void Gnome::updateLayer(FluxboxWindow &win) { //TODO - map from flux layers to gnome ones // our layers are in the opposite direction to GNOME - int layernum = Fluxbox::instance()->getDesktopLayer() - win.getLayerNum(); - XChangeProperty(FbTk::App::instance()->display(), win.getClientWindow(), + int layernum = Fluxbox::instance()->getDesktopLayer() - win.layerNum(); + XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), m_gnome_wm_win_layer, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&layernum, 1); diff --git a/src/IconBar.cc b/src/IconBar.cc index d6e6d88..03c8e85 100644 --- a/src/IconBar.cc +++ b/src/IconBar.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconBar.cc,v 1.33 2003/05/10 22:55:10 fluxgen Exp $ +// $Id: IconBar.cc,v 1.34 2003/05/15 11:17:27 fluxgen Exp $ #include "IconBar.hh" @@ -29,6 +29,7 @@ #include "ImageControl.hh" #include "Text.hh" #include "RootTheme.hh" +#include "FbWinFrameTheme.hh" #include @@ -321,7 +322,7 @@ void IconBar::draw(const IconBarObj * const obj, int width) const { unsigned int title_text_w; title_text_w = m_font.textWidth( - fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size()); + fluxboxwin->iconTitle().c_str(), fluxboxwin->iconTitle().size()); unsigned int bevel_w = screen().rootTheme().bevelWidth(); int dx=bevel_w*2; @@ -330,8 +331,8 @@ void IconBar::draw(const IconBarObj * const obj, int width) const { unsigned int newlen = 0; dx = FbTk::doAlignment(m_vertical ? obj->height() : obj->width(), bevel_w*2, FbTk::CENTER, m_font, - fluxboxwin->getIconTitle().c_str(), - fluxboxwin->getIconTitle().size(), + fluxboxwin->iconTitle().c_str(), + fluxboxwin->iconTitle().size(), newlen); //Draw title to m_iconwin @@ -348,7 +349,7 @@ void IconBar::draw(const IconBarObj * const obj, int width) const { iconwin, screen().getScreenNumber(), screen().winFrameTheme().labelTextFocusGC(), - fluxboxwin->getIconTitle().c_str(), newlen, + fluxboxwin->iconTitle().c_str(), newlen, dx, dy, m_vertical); } diff --git a/src/LayerMenu.hh b/src/LayerMenu.hh index 86d34ba..6b13179 100644 --- a/src/LayerMenu.hh +++ b/src/LayerMenu.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: LayerMenu.hh,v 1.3 2003/05/07 11:30:28 fluxgen Exp $ +// $Id: LayerMenu.hh,v 1.4 2003/05/15 11:17:27 fluxgen Exp $ #ifndef LAYERMENU_HH #define LAYERMENU_HH @@ -45,7 +45,7 @@ public: LayerMenuItem(const char *label, ItemType *object, int layernum): FbTk::MenuItem(label), m_object(object), m_layernum(layernum) {} - bool isEnabled() const { return m_object->getLayerItem().getLayerNum() != m_layernum; } ; + bool isEnabled() const { return m_object->layerItem().getLayerNum() != m_layernum; } ; void click(int button, int time) { m_object->moveToLayer(m_layernum); FbTk::MenuItem::click(button, time); @@ -101,12 +101,12 @@ LayerMenu::LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageC // TODO: fetch nls string if (save_rc) { insert(new LayerMenuItem( - layer_menuitems[i].default_str, - m_object, layer_menuitems[i].layernum, saverc_cmd)); + layer_menuitems[i].default_str, + m_object, layer_menuitems[i].layernum, saverc_cmd)); } else { insert(new LayerMenuItem( - layer_menuitems[i].default_str, - m_object, layer_menuitems[i].layernum)); + layer_menuitems[i].default_str, + m_object, layer_menuitems[i].layernum)); } } update(); diff --git a/src/Remember.cc b/src/Remember.cc index e82c1aa..8a20e8e 100644 --- a/src/Remember.cc +++ b/src/Remember.cc @@ -21,7 +21,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Remember.cc,v 1.13 2003/05/11 13:36:10 fluxgen Exp $ +// $Id: Remember.cc,v 1.14 2003/05/15 11:17:27 fluxgen Exp $ #include "Remember.hh" #include "StringUtil.hh" @@ -462,19 +462,19 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) { } switch (attrib) { case REM_WORKSPACE: - app->rememberWorkspace(win->getWorkspaceNumber()); + app->rememberWorkspace(win->workspaceNumber()); break; case REM_DIMENSIONS: app->rememberDimensions(win->width(), win->height()); break; case REM_POSITION: - app->rememberPosition(win->getXFrame(), win->getYFrame()); + app->rememberPosition(win->x(), win->y()); break; case REM_STUCKSTATE: app->rememberShadedstate(win->isShaded()); break; case REM_DECOSTATE: - app->rememberDecostate(win->getDecorationMask()); + app->rememberDecostate(win->decorationMask()); break; case REM_SHADEDSTATE: app->rememberStuckstate(win->isStuck()); @@ -485,7 +485,7 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) { app->rememberJumpworkspace(true); break; case REM_LAYER: - app->rememberLayer(win->getLayerNum()); + app->rememberLayer(win->layerNum()); break; case REM_SAVEONCLOSE: app->rememberSaveOnClose(true); @@ -547,7 +547,7 @@ void Remember::setupWindow(FluxboxWindow &win) { // we don't touch the window if it is a transient // of something else - int menupos = win.getWindowmenu().numberOfItems()-2; + int menupos = win.menu().numberOfItems()-2; if (menupos < -1) menupos = -1; @@ -556,18 +556,18 @@ void Remember::setupWindow(FluxboxWindow &win) { // so, we add a disabled item... FbTk::MenuItem *item = new FbTk::MenuItem("Remember..."); item->setEnabled(false); - win.getWindowmenu().insert(item, menupos); - win.getWindowmenu().update(); + win.menu().insert(item, menupos); + win.menu().update(); return; } // add the menu, this -2 is somewhat dodgy... :-/ // All windows get the remember menu. // TODO: nls - win.getWindowmenu().insert("Remember...", + win.menu().insert("Remember...", createRememberMenu(*this, win), menupos); - win.getWindowmenu().reconfigure(); + win.menu().reconfigure(); Application *app = find(winclient); if (app == 0) @@ -629,17 +629,17 @@ void Remember::updateWindowClose(FluxboxWindow &win) { } /* if (app->workspace_remember) - app->rememberWorkspace(win.getWorkspaceNumber()); + app->rememberWorkspace(win.workspaceNumber()); if (app->dimensions_remember) app->rememberDimensions(win.width(), win.height()); if (app->position_remember) - app->rememberPosition(win.getXFrame(), win.getYFrame()); + app->rememberPosition(win.x(), win.y()); if (app->shadedstate_remember) app->rememberShadedstate(win.isShaded()); // external tabs off atm //if (app->tabstate_remember) ... if (app->decostate_remember) - app->rememberDecostate(win.getDecorationMask()); + app->rememberDecostate(win.decorationMask()); if (app->stuckstate_remember) app->rememberStuckstate(win.isStuck()); if (app->jumpworkspace_remember) diff --git a/src/Screen.cc b/src/Screen.cc index 1f4753c..e661ff4 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.165 2003/05/14 12:08:19 fluxgen Exp $ +// $Id: Screen.cc,v 1.166 2003/05/15 11:17:27 fluxgen Exp $ #include "Screen.hh" @@ -52,6 +52,7 @@ #include "LayerMenu.hh" #include "WinClient.hh" #include "Subject.hh" +#include "FbWinFrame.hh" //use GNU extensions #ifndef _GNU_SOURCE @@ -1005,7 +1006,7 @@ void BScreen::removeWindow(FluxboxWindow *win) { if (win->isIconic()) removeIcon(win); else - getWorkspace(win->getWorkspaceNumber())->removeWindow(win); + getWorkspace(win->workspaceNumber())->removeWindow(win); } @@ -1173,7 +1174,7 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS } #ifdef DEBUG cerr<<__FILE__<<": Sending to id = "<workspaceId="<getWorkspaceNumber()<workspaceId="<workspaceNumber()<windowList().begin(); Workspace::Windows::iterator win_it_end = (*it)->windowList().end(); for (; win_it != win_it_end; ++win_it) { - net->sendWindowAdd((*win_it)->getClientWindow(), + net->sendWindowAdd((*win_it)->clientWindow(), (*it)->workspaceID()); } } Window f = ((Fluxbox::instance()->getFocusedWindow()) ? - Fluxbox::instance()->getFocusedWindow()->getClientWindow() : None); + Fluxbox::instance()->getFocusedWindow()->clientWindow() : None); net->sendWindowFocus(f); } @@ -1242,7 +1243,7 @@ void BScreen::updateNetizenWindowFocus() { Netizens::iterator it = netizenList.begin(); Netizens::iterator it_end = netizenList.end(); Window f = ((Fluxbox::instance()->getFocusedWindow()) ? - Fluxbox::instance()->getFocusedWindow()->getClientWindow() : None); + Fluxbox::instance()->getFocusedWindow()->clientWindow() : None); for (; it != it_end; ++it) { (*it)->sendWindowFocus(f); } @@ -1305,7 +1306,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { #ifdef SLIT if (win->initialState() == WithdrawnState) - getSlit()->addClient(win->getClientWindow()); + getSlit()->addClient(win->clientWindow()); #endif // SLIT if (!win->isManaged()) { @@ -1324,7 +1325,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { setupWindowActions(*win); Fluxbox::instance()->attachSignals(*win); } - if (win->getWorkspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { + if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { win->show(); } XSync(FbTk::App::instance()->display(), False); @@ -1337,7 +1338,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) { *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); #ifdef SLIT if (win->initialState() == WithdrawnState) - getSlit()->addClient(win->getClientWindow()); + getSlit()->addClient(win->clientWindow()); #endif // SLIT if (!win->isManaged()) { delete win; @@ -1349,7 +1350,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) { Fluxbox::instance()->saveWindowSearch(client.window(), win); setupWindowActions(*win); Fluxbox::instance()->attachSignals(*win); - if (win->getWorkspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { + if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { win->show(); } return win; @@ -1450,7 +1451,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) { frame.setOnClickTitlebar(lower_cmd, 2); // on release with button 2 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); // setup menu - FbTk::Menu &menu = win.getWindowmenu(); + FbTk::Menu &menu = win.menu(); menu.removeAll(); // clear old items menu.disableTitle(); // not titlebar @@ -1463,7 +1464,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) { menu.insert("Iconify", iconify_cmd); menu.insert("Raise", raise_cmd); menu.insert("Lower", lower_cmd); - menu.insert("Layer...", &win.getLayermenu()); + menu.insert("Layer...", &win.layermenu()); CommandRef next_client_cmd(new WindowCmd(win, &FluxboxWindow::nextClient)); CommandRef prev_client_cmd(new WindowCmd(win, &FluxboxWindow::prevClient)); menu.insert("Next Client", next_client_cmd); @@ -1508,7 +1509,7 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, #endif // DEBUG } - if (!w->isIconic() && w->getWorkspaceNumber() == wkspc_id) + if (!w->isIconic() && w->workspaceNumber() == wkspc_id) return; @@ -1516,7 +1517,7 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, removeIcon(w); getWorkspace(wkspc_id)->addWindow(*w); } else if (ignore_sticky || ! w->isStuck()) { - getWorkspace(w->getWorkspaceNumber())->removeWindow(w); + getWorkspace(w->workspaceNumber())->removeWindow(w); getWorkspace(wkspc_id)->addWindow(*w); } } @@ -1532,7 +1533,7 @@ void BScreen::nextFocus(int opts) { if (focused->screen().getScreenNumber() == getScreenNumber()) { have_focused = true; - focused_window_number = focused->getWindowNumber(); + focused_window_number = focused->windowNumber(); } } @@ -1564,7 +1565,7 @@ void BScreen::nextFocus(int opts) { FluxboxWindow *fbwin = (*it)->m_win; if (fbwin && !fbwin->isIconic() && (fbwin->isStuck() - || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { + || fbwin->workspaceNumber() == getCurrentWorkspaceID())) { // either on this workspace, or stuck // keep track of the originally selected window in a set @@ -1622,7 +1623,7 @@ void BScreen::prevFocus(int opts) { if (focused->screen().getScreenNumber() == getScreenNumber()) { have_focused = true; - focused_window_number = focused->getWindowNumber(); + focused_window_number = focused->windowNumber(); } } @@ -1655,7 +1656,7 @@ void BScreen::prevFocus(int opts) { FluxboxWindow *fbwin = (*it)->m_win; if (fbwin && !fbwin->isIconic() && (fbwin->isStuck() - || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { + || fbwin->workspaceNumber() == getCurrentWorkspaceID())) { // either on this workspace, or stuck // keep track of the originally selected window in a set @@ -1714,7 +1715,7 @@ void BScreen::raiseFocus() { if (fb->getFocusedWindow()->screen().getScreenNumber() == getScreenNumber()) { have_focused = true; - focused_window_number = fb->getFocusedWindow()->getWindowNumber(); + focused_window_number = fb->getFocusedWindow()->windowNumber(); } if ((getCurrentWorkspace()->numberOfWindows() > 1) && have_focused) @@ -1739,10 +1740,10 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) { FluxboxWindow *foundwin = 0; int weight = 999999, exposure = 0; // extreme values int borderW = m_root_theme->borderWidth(), - top = win.getYFrame(), - bottom = win.getYFrame() + win.height() + 2*borderW, - left = win.getXFrame(), - right = win.getXFrame() + win.width() + 2*borderW; + top = win.y(), + bottom = win.y() + win.height() + 2*borderW, + left = win.x(), + right = win.x() + win.width() + 2*borderW; Workspace::Windows &wins = getCurrentWorkspace()->windowList(); Workspace::Windows::iterator it = wins.begin(); @@ -1752,10 +1753,10 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) { // we check things against an edge, and within the bounds (draw a picture) int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0; - int otop = (*it)->getYFrame(), - obottom = (*it)->getYFrame() + (*it)->height() + 2*borderW, - oleft = (*it)->getXFrame(), - oright = (*it)->getXFrame() + (*it)->width() + 2*borderW; + int otop = (*it)->y(), + obottom = (*it)->y() + (*it)->height() + 2*borderW, + oleft = (*it)->x(), + oright = (*it)->x() + (*it)->width() + 2*borderW; // check if they intersect switch (dir) { case FOCUSUP: @@ -2494,7 +2495,7 @@ WinClient *BScreen::getLastFocusedWindow(int workspace) { FocusedWindows::iterator it_end = focused_list.end(); for (; it != it_end; ++it) if ((*it)->fbwindow() && - (((int)(*it)->fbwindow()->getWorkspaceNumber()) == workspace + (((int)(*it)->fbwindow()->workspaceNumber()) == workspace && !(*it)->fbwindow()->isIconic() && (!(*it)->fbwindow()->isStuck() || (*it)->fbwindow()->isFocused()))) // only give focus to a stuck window if it is currently focused diff --git a/src/Slit.hh b/src/Slit.hh index 4eeed28..b94b5e7 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -/// $Id: Slit.hh,v 1.28 2003/05/13 21:09:43 fluxgen Exp $ +/// $Id: Slit.hh,v 1.29 2003/05/15 11:17:27 fluxgen Exp $ #ifndef SLIT_HH #define SLIT_HH @@ -105,7 +105,7 @@ public: //@} void moveToLayer(int layernum); - FbTk::XLayerItem &getLayerItem() { return *m_layeritem; } + FbTk::XLayerItem &layerItem() { return *m_layeritem; } virtual void timeout(); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index aa39622..7bf8291 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.80 2003/05/12 23:05:19 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.81 2003/05/15 11:17:27 fluxgen Exp $ #include "Toolbar.hh" @@ -41,6 +41,7 @@ #include "MacroCommand.hh" #include "RootTheme.hh" #include "BoolMenuItem.hh" +#include "FbWinFrameTheme.hh" // use GNU extensions #ifndef _GNU_SOURCE @@ -792,15 +793,15 @@ void Toolbar::redrawWindowLabel(bool redraw) { FluxboxWindow *foc = Fluxbox::instance()->getFocusedWindow(); // don't draw focused window if it's not on the same screen - if (&foc->screen() != &screen() || foc->getTitle().size() == 0) + if (&foc->screen() != &screen() || foc->title().size() == 0) return; - unsigned int newlen = foc->getTitle().size(); + unsigned int newlen = foc->title().size(); int dx = FbTk::doAlignment(frame.window_label_w, frame.bevel_w*2, m_theme.justify(), m_theme.font(), - foc->getTitle().c_str(), - foc->getTitle().size(), newlen); + foc->title().c_str(), + foc->title().size(), newlen); int dy = 1 + m_theme.font().ascent(); if (m_theme.font().isRotated()) { @@ -814,7 +815,7 @@ void Toolbar::redrawWindowLabel(bool redraw) { frame.window_label.window(), screen().getScreenNumber(), m_theme.windowTextGC(), - foc->getTitle().c_str(), newlen, + foc->title().c_str(), newlen, dx, dy); } else frame.window_label.clear(); @@ -895,7 +896,7 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) { FluxboxWindow *fluxboxwin = 0; // if we clicked on a icon then show window menu if ( m_iconbar.get() != 0 && (fluxboxwin = m_iconbar->findWindow(be.window)) ) { - const FbTk::Menu &wm = fluxboxwin->getWindowmenu(); + const FbTk::Menu &wm = fluxboxwin->menu(); int menu_y = be.y_root - wm.height(); int menu_x = be.x_root; diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 0fc7b88..4349ea7 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.hh,v 1.30 2003/05/10 13:55:57 fluxgen Exp $ +// $Id: Toolbar.hh,v 1.31 2003/05/15 11:17:27 fluxgen Exp $ #ifndef TOOLBAR_HH #define TOOLBAR_HH @@ -87,7 +87,7 @@ public: void moveToLayer(int layernum); - FbTk::XLayerItem &getLayerItem() { return m_layeritem; } + FbTk::XLayerItem &layerItem() { return m_layeritem; } /// are we in workspacename editing? inline bool isEditing() const { return editing; } diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc index f723818..1bc13c1 100644 --- a/src/ToolbarHandler.cc +++ b/src/ToolbarHandler.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolbarHandler.cc,v 1.10 2003/05/11 17:11:58 fluxgen Exp $ +// $Id: ToolbarHandler.cc,v 1.11 2003/05/15 11:17:27 fluxgen Exp $ /** * The ToolbarHandler class acts as a rough interface to the toolbar. @@ -196,7 +196,7 @@ void ToolbarHandler::initForScreen(BScreen &screen) { BScreen::Icons::iterator iconit = wiconlist.begin(); BScreen::Icons::iterator iconit_end = wiconlist.end(); for(; iconit != iconit_end; ++iconit) { - if ((*iconit)->getWorkspaceNumber() == m_current_workspace) + if ((*iconit)->workspaceNumber() == m_current_workspace) m_toolbar->addIcon(*iconit); } } @@ -213,11 +213,11 @@ void ToolbarHandler::setupWindow(FluxboxWindow &win) { case NONE: break; case WORKSPACE: - if (win.getWorkspaceNumber() == m_current_workspace) + if (win.workspaceNumber() == m_current_workspace) m_toolbar->addIcon(&win); break; case WORKSPACEICONS: - if (win.getWorkspaceNumber() != m_current_workspace) + if (win.workspaceNumber() != m_current_workspace) break; // else fall through and add the icon case LASTMODE: @@ -242,7 +242,7 @@ void ToolbarHandler::updateWindowClose(FluxboxWindow &win) { case NONE: break; case WORKSPACEICONS: - if (win.getWorkspaceNumber() != m_current_workspace) + if (win.workspaceNumber() != m_current_workspace) break; // else fall through and remove the icon case LASTMODE: @@ -252,7 +252,7 @@ void ToolbarHandler::updateWindowClose(FluxboxWindow &win) { } break; case WORKSPACE: - if (win.getWorkspaceNumber() == m_current_workspace) + if (win.workspaceNumber() == m_current_workspace) m_toolbar->delIcon(&win); break; case ALLWINDOWS: @@ -273,7 +273,7 @@ void ToolbarHandler::updateState(FluxboxWindow &win) { case ALLWINDOWS: break; case WORKSPACEICONS: - if (win.getWorkspaceNumber() != 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) case LASTMODE: case ICONS: @@ -298,7 +298,7 @@ void ToolbarHandler::updateWorkspace(FluxboxWindow &win) { // don't care about current workspace except if in workspace mode if (!(m_mode == WORKSPACE || (m_mode == WORKSPACEICONS && win.isIconic()))) return; - if (win.getWorkspaceNumber() == m_current_workspace) { + if (win.workspaceNumber() == m_current_workspace) { //!! TODO // this shouldn't be needed, but is until Workspaces get fixed so that // you only move between them, you don't 'add' and 'remove' diff --git a/src/Window.cc b/src/Window.cc index a9aa97d..1216d63 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.175 2003/05/14 14:42:30 fluxgen Exp $ +// $Id: Window.cc,v 1.176 2003/05/15 11:17:27 fluxgen Exp $ #include "Window.hh" @@ -39,10 +39,15 @@ #include "FbAtoms.hh" #include "RootTheme.hh" #include "Workspace.hh" +#include "LayerMenu.hh" +#include "FbWinFrame.hh" #ifdef HAVE_CONFIG_H #include "config.h" #endif // HAVE_CONFIG_H +#ifdef SHAPE +#include +#endif // SHAPE //use GNU extensions #ifndef _GNU_SOURCE @@ -137,8 +142,8 @@ void raiseFluxboxWindow(FluxboxWindow &win) { win.oplock = true; if (!win.isIconic()) { - win.screen().updateNetizenWindowRaise(win.getClientWindow()); - win.getLayerItem().raise(); + win.screen().updateNetizenWindowRaise(win.clientWindow()); + win.layerItem().raise(); } // for each transient do raise @@ -158,8 +163,8 @@ void lowerFluxboxWindow(FluxboxWindow &win) { win.oplock = true; if (!win.isIconic()) { - win.screen().updateNetizenWindowLower(win.getClientWindow()); - win.getLayerItem().lower(); + win.screen().updateNetizenWindowLower(win.clientWindow()); + win.layerItem().lower(); } WinClient::TransientList::const_iterator it = win.winClient().transientList().begin(); @@ -179,7 +184,7 @@ void tempRaiseFluxboxWindow(FluxboxWindow &win) { if (!win.isIconic()) { // don't update netizen, as it is only temporary - win.getLayerItem().tempRaise(); + win.layerItem().tempRaise(); } // for each transient do raise @@ -232,16 +237,16 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t m_timer(this), display(0), m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), - m_layermenu(menutheme, - scr.getScreenNumber(), - *scr.getImageControl(), - *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), - this, - false), + m_layermenu(new LayerMenu(menutheme, + scr.getScreenNumber(), + *scr.getImageControl(), + *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), + this, + false)), m_old_decoration(DECOR_NORMAL), m_client(&client), - m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), - m_layeritem(m_frame.window(), layer), + m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), + m_layeritem(m_frame->window(), layer), m_layernum(layer.getLayerNum()), m_parent(scr.rootWindow()) { @@ -265,16 +270,16 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm, m_timer(this), display(0), m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), - m_layermenu(menutheme, - scr.getScreenNumber(), - *scr.getImageControl(), - *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), - this, - false), + m_layermenu(new LayerMenu(menutheme, + scr.getScreenNumber(), + *scr.getImageControl(), + *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), + this, + false)), m_old_decoration(DECOR_NORMAL), m_client(new WinClient(w, *this)), - m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), - m_layeritem(m_frame.window(), layer), + m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), + m_layeritem(m_frame->window(), layer), m_layernum(layer.getLayerNum()), m_parent(scr.rootWindow()) { assert(w != 0); @@ -296,7 +301,7 @@ FluxboxWindow::~FluxboxWindow() { Client2ButtonMap::iterator it = m_labelbuttons.begin(); Client2ButtonMap::iterator it_end = m_labelbuttons.end(); for (; it != it_end; ++it) { - m_frame.removeLabelButton(*(*it).second); + frame().removeLabelButton(*(*it).second); delete (*it).second; } m_labelbuttons.clear(); @@ -316,7 +321,7 @@ FluxboxWindow::~FluxboxWindow() { detachClient(*m_clientlist.back()); } } - Fluxbox::instance()->removeWindowSearch(m_frame.window().window()); + Fluxbox::instance()->removeWindowSearch(frame().window().window()); #ifdef DEBUG cerr<<__FILE__<<"("<<__LINE__<<"): ~FluxboxWindow("<window()<<", frame = "<width(), m_client->height()); - TextButton *btn = new TextButton(m_frame.label(), - m_frame.theme().font(), + frame().resize(m_client->width(), m_client->height()); + TextButton *btn = new TextButton(frame().label(), + frame().theme().font(), m_client->title()); - btn->setJustify(m_frame.theme().justify()); + btn->setJustify(frame().theme().justify()); m_labelbuttons[m_client] = btn; - m_frame.addLabelButton(*btn); - m_frame.setLabelButtonFocus(*btn); + frame().addLabelButton(*btn); + frame().setLabelButtonFocus(*btn); btn->show(); FbTk::EventManager &evm = *FbTk::EventManager::instance(); // we need motion notify so we mask it @@ -377,11 +382,11 @@ void FluxboxWindow::init() { evm.add(*this, btn->window()); // we take care of button events for this evm.add(*this, m_client->window()); - // m_frame.reconfigure(); + // frame().reconfigure(); // redirect events from frame to us - m_frame.setEventHandler(*this); + frame().setEventHandler(*this); m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0; @@ -436,7 +441,7 @@ void FluxboxWindow::init() { Fluxbox *fluxbox = Fluxbox::instance(); - fluxbox->saveWindowSearch(m_frame.window().window(), this); + fluxbox->saveWindowSearch(frame().window().window(), this); m_timer.setTimeout(fluxbox->getAutoRaiseDelay()); m_timer.fireOnce(true); @@ -474,11 +479,11 @@ void FluxboxWindow::init() { if (! fluxbox->isStartup()) { - int real_x = m_frame.x(); - int real_y = m_frame.y(); + int real_x = frame().x(); + int real_y = frame().y(); if (real_x >= 0 && - real_y + m_frame.y() >= 0 && + real_y + frame().y() >= 0 && real_x <= (signed) screen().getWidth() && real_y <= (signed) screen().getHeight()) place_window = false; @@ -499,19 +504,19 @@ void FluxboxWindow::init() { restoreAttributes(); - m_frame.move(wattrib.x, wattrib.y); - m_frame.resizeForClient(wattrib.width, wattrib.height); + frame().move(wattrib.x, wattrib.y); + frame().resizeForClient(wattrib.width, wattrib.height); // if we're a transient then we should be on the same layer as our parent if (m_client->isTransient() && m_client->transientFor()->fbwindow() && m_client->transientFor()->fbwindow() != this) - getLayerItem().setLayer(m_client->transientFor()->fbwindow()->getLayerItem().getLayer()); + layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer()); else // if no parent then set default layer moveToLayer(m_layernum); if (!place_window) - moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); + moveResize(frame().x(), frame().y(), frame().width(), frame().height()); screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); @@ -532,7 +537,7 @@ void FluxboxWindow::init() { } setState(m_current_state); - m_frame.reconfigure(); + frame().reconfigure(); sendConfigureNotify(); // no focus default setFocusFlag(false); @@ -547,8 +552,8 @@ void FluxboxWindow::shape() { if (m_shaped) { Display *disp = FbTk::App::instance()->display(); XShapeCombineShape(disp, - m_frame.window().window(), ShapeBounding, - 0, m_frame.clientArea().y(), // xOff, yOff + frame().window().window(), ShapeBounding, + 0, frame().clientArea().y(), // xOff, yOff m_client->window(), ShapeBounding, ShapeSet); XFlush(disp); @@ -565,7 +570,7 @@ void FluxboxWindow::attachClient(WinClient &client) { return; // reparent client win to this frame - m_frame.setClientWindow(client); + frame().setClientWindow(client); FbTk::EventManager &evm = *FbTk::EventManager::instance(); if (client.fbwindow() != 0) { @@ -580,20 +585,20 @@ void FluxboxWindow::attachClient(WinClient &client) { evm.add(*this, (*client_it)->window()); // reparent window to this - m_frame.setClientWindow(**client_it); + frame().setClientWindow(**client_it); resizeClient(**client_it, - m_frame.clientArea().width(), - m_frame.clientArea().height()); + frame().clientArea().width(), + frame().clientArea().height()); (*client_it)->m_win = this; // create a labelbutton for this client and // associate it with the pointer - TextButton *btn = new TextButton(m_frame.label(), - m_frame.theme().font(), + TextButton *btn = new TextButton(frame().label(), + frame().theme().font(), (*client_it)->title()); - btn->setJustify(m_frame.theme().justify()); + btn->setJustify(frame().theme().justify()); m_labelbuttons[(*client_it)] = btn; - m_frame.addLabelButton(*btn); + frame().addLabelButton(*btn); btn->show(); // we need motion notify so we mask it btn->window().setEventMask(ExposureMask | ButtonPressMask | @@ -615,13 +620,13 @@ void FluxboxWindow::attachClient(WinClient &client) { old_win->m_client = 0; delete old_win; - } else { + } else { // client.fbwindow() == 0 // create a labelbutton for this client and associate it with the pointer - TextButton *btn = new TextButton(m_frame.label(), - m_frame.theme().font(), + TextButton *btn = new TextButton(frame().label(), + frame().theme().font(), client.title()); m_labelbuttons[&client] = btn; - m_frame.addLabelButton(*btn); + frame().addLabelButton(*btn); btn->show(); FbTk::EventManager &evm = *FbTk::EventManager::instance(); // we need motion notify so we mask it @@ -639,7 +644,7 @@ void FluxboxWindow::attachClient(WinClient &client) { Fluxbox::instance()->saveWindowSearch(client.window(), this); } - m_frame.reconfigure(); + frame().reconfigure(); // keep the current window on top m_client->raise(); @@ -704,7 +709,7 @@ bool FluxboxWindow::removeClient(WinClient &client) { FbTk::Button *label_btn = m_labelbuttons[&client]; if (label_btn != 0) { - m_frame.removeLabelButton(*label_btn); + frame().removeLabelButton(*label_btn); evm.remove(label_btn->window()); delete label_btn; label_btn = 0; @@ -748,7 +753,7 @@ void FluxboxWindow::nextClient() { else m_client = *it; m_client->raise(); - m_frame.setLabelButtonFocus(*m_labelbuttons[m_client]); + frame().setLabelButtonFocus(*m_labelbuttons[m_client]); setInputFocus(); } @@ -767,7 +772,7 @@ void FluxboxWindow::prevClient() { m_client = *(--it); m_client->raise(); - m_frame.setLabelButtonFocus(*m_labelbuttons[m_client]); + frame().setLabelButtonFocus(*m_labelbuttons[m_client]); setInputFocus(); } @@ -778,7 +783,7 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { m_client = &client; m_client->raise(); - m_frame.setLabelButtonFocus(*m_labelbuttons[m_client]); + frame().setLabelButtonFocus(*m_labelbuttons[m_client]); return setinput && setInputFocus(); } @@ -793,10 +798,10 @@ void FluxboxWindow::associateClientWindow() { updateTitleFromClient(); updateIconNameFromClient(); - m_frame.setClientWindow(*m_client); - m_frame.resizeForClient(m_client->width(), m_client->height()); + frame().setClientWindow(*m_client); + frame().resizeForClient(m_client->width(), m_client->height()); // make sure the frame reconfigures - m_frame.reconfigure(); + frame().reconfigure(); } @@ -804,27 +809,27 @@ void FluxboxWindow::grabButtons() { Fluxbox *fluxbox = Fluxbox::instance(); XGrabButton(display, Button1, AnyModifier, - m_frame.clientArea().window(), True, ButtonPressMask, + frame().clientArea().window(), True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None); - XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, m_frame.clientArea().window()); + XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().clientArea().window()); - XGrabButton(display, Button1, Mod1Mask, m_frame.window().window(), True, + XGrabButton(display, Button1, Mod1Mask, frame().window().window(), True, ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, GrabModeAsync, None, fluxbox->getMoveCursor()); //----grab with "all" modifiers - grabButton(display, Button1, m_frame.window().window(), fluxbox->getMoveCursor()); + grabButton(display, Button1, frame().window().window(), fluxbox->getMoveCursor()); - XGrabButton(display, Button2, Mod1Mask, m_frame.window().window(), True, + XGrabButton(display, Button2, Mod1Mask, frame().window().window(), True, ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); - XGrabButton(display, Button3, Mod1Mask, m_frame.window().window(), True, + XGrabButton(display, Button3, Mod1Mask, frame().window().window(), True, ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, GrabModeAsync, None, fluxbox->getLowerRightAngleCursor()); //---grab with "all" modifiers - grabButton(display, Button3, m_frame.window().window(), fluxbox->getLowerRightAngleCursor()); + grabButton(display, Button3, frame().window().window(), fluxbox->getLowerRightAngleCursor()); } @@ -836,11 +841,11 @@ void FluxboxWindow::reconfigure() { setFocusFlag(focused); - moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); + moveResize(frame().x(), frame().y(), frame().width(), frame().height()); grabButtons(); - m_frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); + frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); m_windowmenu.reconfigure(); @@ -849,26 +854,26 @@ void FluxboxWindow::reconfigure() { void FluxboxWindow::positionWindows() { - m_frame.window().setBorderWidth(screen().rootTheme().borderWidth()); - m_frame.clientArea().setBorderWidth(0); // client area bordered by other things + frame().window().setBorderWidth(screen().rootTheme().borderWidth()); + frame().clientArea().setBorderWidth(0); // client area bordered by other things - m_frame.titlebar().setBorderWidth(screen().rootTheme().borderWidth()); + frame().titlebar().setBorderWidth(screen().rootTheme().borderWidth()); if (decorations.titlebar) { - m_frame.showTitlebar(); + frame().showTitlebar(); } else { - m_frame.hideTitlebar(); + frame().hideTitlebar(); } - m_frame.handle().setBorderWidth(screen().rootTheme().borderWidth()); - m_frame.gripLeft().setBorderWidth(screen().rootTheme().borderWidth()); - m_frame.gripRight().setBorderWidth(screen().rootTheme().borderWidth()); + frame().handle().setBorderWidth(screen().rootTheme().borderWidth()); + frame().gripLeft().setBorderWidth(screen().rootTheme().borderWidth()); + frame().gripRight().setBorderWidth(screen().rootTheme().borderWidth()); if (decorations.handle) - m_frame.showHandle(); + frame().showHandle(); else - m_frame.hideHandle(); + frame().hideHandle(); - m_frame.reconfigure(); + frame().reconfigure(); } @@ -1025,7 +1030,7 @@ void FluxboxWindow::getMWMHints() { m_client->mwm_hint) { return; } - if (num != PropMwmHintsElements) + if (num != static_cast(PropMwmHintsElements)) return; if (m_client->mwm_hint->flags & MwmHintsDecorations) { @@ -1130,33 +1135,33 @@ void FluxboxWindow::getBlackboxHints() { } void FluxboxWindow::move(int x, int y) { - moveResize(x, y, m_frame.width(), m_frame.height()); + moveResize(x, y, frame().width(), frame().height()); } void FluxboxWindow::resize(unsigned int width, unsigned int height) { - moveResize(m_frame.x(), m_frame.y(), width, height); + moveResize(frame().x(), frame().y(), width, height); } void FluxboxWindow::moveResize(int new_x, int new_y, unsigned int new_width, unsigned int new_height) { - bool send_event = (m_frame.x() != new_x || m_frame.y() != new_y); + bool send_event = (frame().x() != new_x || frame().y() != new_y); - if (new_width != m_frame.width() || new_height != m_frame.height()) { - if ((((signed) m_frame.width()) + new_x) < 0) + if (new_width != frame().width() || new_height != frame().height()) { + if ((((signed) frame().width()) + new_x) < 0) new_x = 0; - if ((((signed) m_frame.height()) + new_y) < 0) + if ((((signed) frame().height()) + new_y) < 0) new_y = 0; downsize(); - m_frame.moveResize(new_x, new_y, new_width, new_height); + frame().moveResize(new_x, new_y, new_width, new_height); setFocusFlag(focused); shaded = false; send_event = true; } else { - m_frame.move(new_x, new_y); + frame().move(new_x, new_y); send_event = true; } @@ -1171,29 +1176,29 @@ void FluxboxWindow::moveResize(int new_x, int new_y, bool FluxboxWindow::setInputFocus() { //TODO hint skip focus - if (((signed) (m_frame.x() + m_frame.width())) < 0) { - if (((signed) (m_frame.y() + m_frame.height())) < 0) { + if (((signed) (frame().x() + frame().width())) < 0) { + if (((signed) (frame().y() + frame().height())) < 0) { moveResize(screen().rootTheme().borderWidth(), screen().rootTheme().borderWidth(), - m_frame.width(), m_frame.height()); - } else if (m_frame.y() > (signed) screen().getHeight()) { - moveResize(screen().rootTheme().borderWidth(), screen().getHeight() - m_frame.height(), - m_frame.width(), m_frame.height()); + frame().width(), frame().height()); + } else if (frame().y() > (signed) screen().getHeight()) { + moveResize(screen().rootTheme().borderWidth(), screen().getHeight() - frame().height(), + frame().width(), frame().height()); } else { - moveResize(screen().rootTheme().borderWidth(), m_frame.y() + screen().rootTheme().borderWidth(), - m_frame.width(), m_frame.height()); + moveResize(screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(), + frame().width(), frame().height()); } - } else if (m_frame.x() > (signed) screen().getWidth()) { - if (((signed) (m_frame.y() + m_frame.height())) < 0) { - moveResize(screen().getWidth() - m_frame.width(), screen().rootTheme().borderWidth(), - m_frame.width(), m_frame.height()); - } else if (m_frame.y() > (signed) screen().getHeight()) { - moveResize(screen().getWidth() - m_frame.width(), - screen().getHeight() - m_frame.height(), - m_frame.width(), m_frame.height()); + } else if (frame().x() > (signed) screen().getWidth()) { + if (((signed) (frame().y() + frame().height())) < 0) { + moveResize(screen().getWidth() - frame().width(), screen().rootTheme().borderWidth(), + frame().width(), frame().height()); + } else if (frame().y() > (signed) screen().getHeight()) { + moveResize(screen().getWidth() - frame().width(), + screen().getHeight() - frame().height(), + frame().width(), frame().height()); } else { - moveResize(screen().getWidth() - m_frame.width(), - m_frame.y() + screen().rootTheme().borderWidth(), - m_frame.width(), m_frame.height()); + moveResize(screen().getWidth() - frame().width(), + frame().y() + screen().rootTheme().borderWidth(), + frame().width(), frame().height()); } } @@ -1221,7 +1226,7 @@ bool FluxboxWindow::setInputFocus() { Fluxbox::instance()->setFocusedWindow(this); - m_frame.setFocus(true); + frame().setFocus(true); if (send_focus_message) m_client->sendFocus(); @@ -1241,11 +1246,11 @@ void FluxboxWindow::hide() { cerr<<__FILE__<<"("<<__FUNCTION__<<")["<setEventMask(PropertyChangeMask | StructureNotifyMask | FocusChangeMask); } - m_frame.show(); + frame().show(); if (was_iconic && screen().doFocusNew()) setInputFocus(); - if (focused != m_frame.focused()) - m_frame.setFocus(focused); + if (focused != frame().focused()) + frame().setFocus(focused); if (reassoc && !m_client->transients.empty()) { @@ -1361,7 +1366,7 @@ void FluxboxWindow::withdraw() { if (isResizing()) stopResizing(); - m_frame.hide(); + frame().hide(); m_windowmenu.hide(); } @@ -1384,7 +1389,7 @@ void FluxboxWindow::maximize() { unsigned int max_top = screen().getMaxTop(); moveResize(left_x, max_top, max_width - left_x, - screen().getMaxBottom() - max_top - m_frame.window().borderWidth()); + screen().getMaxBottom() - max_top - frame().window().borderWidth()); } else { // demaximize, restore to old values moveResize(m_old_pos_x, m_old_pos_y, m_old_width, m_old_height); @@ -1396,8 +1401,8 @@ void FluxboxWindow::maximize() { void FluxboxWindow::maximizeHorizontal() { unsigned int left_x = screen().getMaxLeft(); unsigned int max_width = screen().getMaxRight(); - moveResize(left_x, m_frame.y(), - max_width - left_x, m_frame.height() - m_frame.window().borderWidth()); + moveResize(left_x, frame().y(), + max_width - left_x, frame().height() - frame().window().borderWidth()); } @@ -1406,8 +1411,8 @@ void FluxboxWindow::maximizeHorizontal() { */ void FluxboxWindow::maximizeVertical() { unsigned int max_top = screen().getMaxTop(); - moveResize(m_frame.x(), max_top, - m_frame.width() - m_frame.window().borderWidth(), + moveResize(frame().x(), max_top, + frame().width() - frame().window().borderWidth(), screen().getMaxBottom() - max_top); } @@ -1445,7 +1450,7 @@ void FluxboxWindow::shade() { if (!decorations.titlebar) return; - m_frame.shade(); + frame().shade(); if (shaded) { shaded = false; @@ -1533,7 +1538,7 @@ void FluxboxWindow::tempRaise() { void FluxboxWindow::raiseLayer() { // don't let it up to menu layer - if (getLayerNum() == (Fluxbox::instance()->getMenuLayer()+1)) + if (layerNum() == (Fluxbox::instance()->getMenuLayer()+1)) return; // get root window @@ -1549,10 +1554,10 @@ void FluxboxWindow::raiseLayer() { if (!win->isIconic()) screen().updateNetizenWindowRaise(client->window()); - win->getLayerItem().raiseLayer(); + win->layerItem().raiseLayer(); // remember number just in case a transient happens to revisit this window - int layer_num = win->getLayerItem().getLayerNum(); + int layer_num = win->layerItem().getLayerNum(); win->setLayerNum(layer_num); WinClient::TransientList::const_iterator it = client->transientList().begin(); @@ -1561,7 +1566,7 @@ void FluxboxWindow::raiseLayer() { win = (*it)->fbwindow(); if (win && !win->isIconic()) { screen().updateNetizenWindowRaise((*it)->window()); - win->getLayerItem().moveToLayer(layer_num); + win->layerItem().moveToLayer(layer_num); win->setLayerNum(layer_num); } } @@ -1581,9 +1586,9 @@ void FluxboxWindow::lowerLayer() { if (!win->isIconic()) { screen().updateNetizenWindowLower(client->window()); } - win->getLayerItem().lowerLayer(); + win->layerItem().lowerLayer(); // remember number just in case a transient happens to revisit this window - int layer_num = win->getLayerItem().getLayerNum(); + int layer_num = win->layerItem().getLayerNum(); win->setLayerNum(layer_num); WinClient::TransientList::const_iterator it = client->transientList().begin(); @@ -1592,7 +1597,7 @@ void FluxboxWindow::lowerLayer() { win = (*it)->fbwindow(); if (win && !win->isIconic()) { screen().updateNetizenWindowLower((*it)->window()); - win->getLayerItem().moveToLayer(layer_num); + win->layerItem().moveToLayer(layer_num); win->setLayerNum(layer_num); } } @@ -1620,9 +1625,9 @@ void FluxboxWindow::moveToLayer(int layernum) { if (!win->isIconic()) { screen().updateNetizenWindowRaise(client->window()); } - win->getLayerItem().moveToLayer(layernum); + win->layerItem().moveToLayer(layernum); // remember number just in case a transient happens to revisit this window - layernum = win->getLayerItem().getLayerNum(); + layernum = win->layerItem().getLayerNum(); win->setLayerNum(layernum); WinClient::TransientList::const_iterator it = client->transientList().begin(); @@ -1631,7 +1636,7 @@ void FluxboxWindow::moveToLayer(int layernum) { win = (*it)->fbwindow(); if (win && !win->isIconic()) { screen().updateNetizenWindowRaise((*it)->window()); - win->getLayerItem().moveToLayer(layernum); + win->layerItem().moveToLayer(layernum); win->setLayerNum(layernum); } } @@ -1646,7 +1651,7 @@ void FluxboxWindow::setFocusFlag(bool focus) { if (focused) gettimeofday(&m_last_focus_time, 0); - m_frame.setFocus(focus); + frame().setFocus(focus); if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus()) && screen().doAutoRaise()) @@ -1746,8 +1751,8 @@ bool FluxboxWindow::getState() { //!! TODO: this functions looks odd void FluxboxWindow::setGravityOffsets() { - int newx = m_frame.x(); - int newy = m_frame.y(); + int newx = frame().x(); + int newy = frame().y(); // translate x coordinate switch (m_client->win_gravity) { // handle Westward gravity @@ -1759,7 +1764,7 @@ void FluxboxWindow::setGravityOffsets() { cerr<<__FILE__<<": Default gravity: SouthWest, NorthWest, West"<x = m_frame.x(); + m_client->x = frame().x(); break; // handle Eastward gravity case NorthEastGravity: case EastGravity: case SouthEastGravity: - m_client->x = (m_frame.x() + m_frame.width()) - m_client->width(); + m_client->x = (frame().x() + frame().width()) - m_client->width(); break; } @@ -1953,14 +1958,14 @@ void FluxboxWindow::restoreGravity() { case NorthGravity: case NorthEastGravity: default: - m_client->y = m_frame.y(); + m_client->y = frame().y(); break; // handle Southbound gravity case SouthWestGravity: case SouthGravity: case SouthEastGravity: - m_client->y = (m_frame.y() + m_frame.height()) - m_client->height(); + m_client->y = (frame().y() + frame().height()) - m_client->height(); break; } } @@ -2013,7 +2018,7 @@ void FluxboxWindow::handleEvent(XEvent &event) { // set no shape Display *disp = FbTk::App::instance()->display(); XShapeCombineMask(disp, - m_frame.window().window(), ShapeBounding, + frame().window().window(), ShapeBounding, 0, 0, None, ShapeSet); } @@ -2064,7 +2069,7 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) { XClassHint ch; - if (XGetClassHint(display, getClientWindow(), &ch) == 0) { + if (XGetClassHint(display, client->window(), &ch) == 0) { cerr<<"Failed to read class hint!"<title(); } -const std::string &FluxboxWindow::getIconTitle() const { +const std::string &FluxboxWindow::iconTitle() const { static string empty_string(""); if (m_client == 0) return empty_string; return m_client->iconTitle(); } -int FluxboxWindow::getXClient() const { return m_client->x; } -int FluxboxWindow::getYClient() const { return m_client->y; } -unsigned int FluxboxWindow::getClientHeight() const { return m_client->height(); } -unsigned int FluxboxWindow::getClientWidth() const { return m_client->width(); } int FluxboxWindow::initialState() const { return m_client->initial_state; } void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) { @@ -3205,13 +3236,13 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) { } void FluxboxWindow::upsize() { - m_frame.setBevel(screen().rootTheme().bevelWidth()); - m_frame.handle().resize(m_frame.handle().width(), + frame().setBevel(screen().rootTheme().bevelWidth()); + frame().handle().resize(frame().handle().width(), screen().rootTheme().handleWidth()); - m_frame.gripLeft().resize(m_frame.buttonHeight(), + frame().gripLeft().resize(frame().buttonHeight(), screen().rootTheme().handleWidth()); - m_frame.gripRight().resize(m_frame.gripLeft().width(), - m_frame.gripLeft().height()); + frame().gripRight().resize(frame().gripLeft().width(), + frame().gripLeft().height()); } @@ -3273,7 +3304,7 @@ void FluxboxWindow::left_fixsize(int *gx, int *gy) { int decoration_height = titlebar_height + handle_height; // dx is new width = current width + difference between new and old x values - int dx = m_frame.width() + m_frame.x() - m_last_resize_x; + int dx = frame().width() + frame().x() - m_last_resize_x; // dy = new height (w/o decorations), similarly int dy = m_last_resize_h - m_client->base_height - decoration_height; @@ -3313,17 +3344,17 @@ void FluxboxWindow::left_fixsize(int *gx, int *gy) { // update last resize m_last_resize_w = dx; m_last_resize_h = dy; - m_last_resize_x = m_frame.x() + m_frame.width() - m_last_resize_w; + m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; } void FluxboxWindow::resizeClient(WinClient &client, unsigned int height, unsigned int width) { - client.resize(m_frame.clientArea().width(), - m_frame.clientArea().height()); - client.updateRect(m_frame.x() + m_frame.clientArea().x(), - m_frame.y() + m_frame.clientArea().y(), - m_frame.clientArea().width(), - m_frame.clientArea().height()); + client.resize(frame().clientArea().width(), + frame().clientArea().height()); + client.updateRect(frame().x() + frame().clientArea().x(), + frame().y() + frame().clientArea().y(), + frame().clientArea().width(), + frame().clientArea().height()); } void FluxboxWindow::sendConfigureNotify() { @@ -3336,11 +3367,11 @@ void FluxboxWindow::sendConfigureNotify() { of the client window is. (ie frame pos + client pos inside the frame = send pos) */ //!! - client.x = m_frame.x(); - client.y = m_frame.y(); + client.x = frame().x(); + client.y = frame().y(); resizeClient(client, - m_frame.clientArea().width(), - m_frame.clientArea().height()); + frame().clientArea().width(), + frame().clientArea().height()); XEvent event; @@ -3349,12 +3380,12 @@ void FluxboxWindow::sendConfigureNotify() { event.xconfigure.display = display; event.xconfigure.event = client.window(); event.xconfigure.window = client.window(); - event.xconfigure.x = m_frame.x() + m_frame.clientArea().x(); - event.xconfigure.y = m_frame.y() + m_frame.clientArea().y(); + event.xconfigure.x = frame().x() + frame().clientArea().x(); + event.xconfigure.y = frame().y() + frame().clientArea().y(); event.xconfigure.width = client.width(); event.xconfigure.height = client.height(); event.xconfigure.border_width = client.old_bw; - event.xconfigure.above = m_frame.window().window(); + event.xconfigure.above = frame().window().window(); event.xconfigure.override_redirect = false; screen().updateNetizenConfigNotify(&event); diff --git a/src/Window.hh b/src/Window.hh index 7285acf..9b99f0f 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -1,5 +1,5 @@ // Window.hh for Fluxbox Window Manager -// Copyright (c) 2001-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) +// Copyright (c) 2001 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) // // Window.hh for Blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net) @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.72 2003/05/14 14:43:06 fluxgen Exp $ +// $Id: Window.hh,v 1.73 2003/05/15 11:17:27 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -30,29 +30,22 @@ #include "Timer.hh" #include "Menu.hh" #include "Subject.hh" -#include "FbWinFrame.hh" #include "EventHandler.hh" #include "XLayerItem.hh" -#include "LayerMenu.hh" #include #include -#ifdef SHAPE -#include -#endif // SHAPE - #include #include #include #include -#define PropMwmHintsElements 3 - class WinClient; class FbWinFrameTheme; class BScreen; class TextButton; +class FbWinFrame; namespace FbTk { class MenuTheme; @@ -60,7 +53,6 @@ class ImageControl; class XLayer; }; - /// Creates the window frame and handles any window event for it class FluxboxWindow : public FbTk::TimeoutHandler, public FbTk::EventHandler { public: @@ -112,6 +104,7 @@ public: static const int PropBlackboxHintsElements = 5; static const int PropBlackboxAttributesElements = 8; + static const int PropMwmHintsElements = 3; typedef struct _blackbox_hints { unsigned long flags, attrib, workspace, stack; @@ -249,13 +242,9 @@ public: DECORM_LAST = (1<<11) // useful for getting "All" }; - unsigned int getDecorationMask() const; + unsigned int decorationMask() const; void setDecorationMask(unsigned int mask); -#ifdef SHAPE - void shapeEvent(XShapeEvent *event); -#endif // SHAPE - virtual void timeout(); /** @@ -264,7 +253,7 @@ public: //@{ inline bool isManaged() const { return m_managed; } inline bool isFocused() const { return focused; } - inline bool isVisible() const { return m_frame.isVisible(); } + bool isVisible() const; inline bool isIconic() const { return iconic; } inline bool isShaded() const { return shaded; } inline bool isMaximized() const { return maximized; } @@ -286,46 +275,42 @@ public: inline const BScreen &screen() const { return m_screen; } inline BScreen &screen() { return m_screen; } - inline const FbTk::XLayerItem &getLayerItem() const { return m_layeritem; } - inline FbTk::XLayerItem &getLayerItem() { return m_layeritem; } + inline const FbTk::XLayerItem &layerItem() const { return m_layeritem; } + inline FbTk::XLayerItem &layerItem() { return m_layeritem; } - Window getClientWindow() const; + Window clientWindow() const; - FbTk::FbWindow &getFbWindow() { return m_frame.window(); } - const FbTk::FbWindow &getFbWindow() const { return m_frame.window(); } + FbTk::FbWindow &fbWindow(); + const FbTk::FbWindow &fbWindow() const; - FbTk::Menu &getWindowmenu() { return m_windowmenu; } - const FbTk::Menu &getWindowmenu() const { return m_windowmenu; } + FbTk::Menu &menu() { return m_windowmenu; } + const FbTk::Menu &menu() const { return m_windowmenu; } - FbTk::Menu &getLayermenu() { return m_layermenu; } - const FbTk::Menu &getLayermenu() const { return m_layermenu; } + FbTk::Menu &layermenu() { return *m_layermenu.get(); } + const FbTk::Menu &layermenu() const { return *m_layermenu.get(); } const FbTk::FbWindow &parent() const { return m_parent; } FbTk::FbWindow &parent() { return m_parent; } - const std::string &getTitle() const; - const std::string &getIconTitle() const; - int getXFrame() const { return m_frame.x(); } - int getYFrame() const { return m_frame.y(); } - int getXClient() const; - int getYClient() const; - unsigned int getWorkspaceNumber() const { return m_workspace_number; } - int getWindowNumber() const { return m_window_number; } - int getLayerNum() const { return m_layernum; } + const std::string &title() const; + const std::string &iconTitle() const; + int x() const; + int y() const; + unsigned int workspaceNumber() const { return m_workspace_number; } + int windowNumber() const { return m_window_number; } + int layerNum() const { return m_layernum; } void setLayerNum(int layernum); - unsigned int width() const { return m_frame.width(); } - unsigned int height() const { return m_frame.height(); } - unsigned int getClientHeight() const; - unsigned int getClientWidth() const; - unsigned int getTitleHeight() const { return m_frame.titleHeight(); } + unsigned int width() const; + unsigned int height() const; + unsigned int titleHeight() const; const std::string &className() const { return m_class_name; } const std::string &instanceName() const { return m_instance_name; } bool isLowerTab() const; int initialState() const; - FbWinFrame &frame() { return m_frame; } - const FbWinFrame &frame() const { return m_frame; } + FbWinFrame &frame() { return *m_frame.get(); } + const FbWinFrame &frame() const { return *m_frame.get(); } /** @name signals @@ -343,7 +328,7 @@ public: const FbTk::Subject &dieSig() const { return m_diesig; } /** @} */ // end group signals - const timeval &getLastFocusTime() const { return m_last_focus_time;} + const timeval &lastFocusTime() const { return m_last_focus_time;} //@} @@ -420,7 +405,7 @@ private: BlackboxAttributes m_blackbox_attrib; FbTk::Menu m_windowmenu; - LayerMenu m_layermenu; + std::auto_ptr m_layermenu; timeval m_last_focus_time; @@ -458,7 +443,7 @@ private: unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state int m_last_button_x, ///< last known x position of the mouse button m_last_button_y; ///< last known y position of the mouse button - FbWinFrame m_frame; + std::auto_ptr m_frame; FbTk::XLayerItem m_layeritem; int m_layernum; diff --git a/src/Workspace.cc b/src/Workspace.cc index c5e6d73..0f89986 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.63 2003/05/11 17:14:41 fluxgen Exp $ +// $Id: Workspace.cc,v 1.64 2003/05/15 11:17:27 fluxgen Exp $ #include "Workspace.hh" @@ -203,7 +203,7 @@ int Workspace::addWindow(FluxboxWindow &w, bool place) { screen().updateNetizenWindowAdd((*client_it)->window(), m_id); } - return w.getWindowNumber(); + return w.windowNumber(); } @@ -485,8 +485,8 @@ void Workspace::placeWindow(FluxboxWindow &win) { if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) change_x = -1; - int win_w = win.width() + win.getFbWindow().borderWidth()*2, - win_h = win.height() + win.getFbWindow().borderWidth()*2; + int win_w = win.width() + win.fbWindow().borderWidth()*2, + win_h = win.height() + win.fbWindow().borderWidth()*2; int test_x, test_y, curr_x, curr_y, curr_w, curr_h; @@ -563,11 +563,11 @@ void Workspace::placeWindow(FluxboxWindow &win) { for (; win_it != win_it_end && placed; ++win_it) { FluxboxWindow &window = **win_it; - curr_x = window.getXFrame(); - curr_y = window.getYFrame(); - curr_w = window.width() + window.getFbWindow().borderWidth()*2; - curr_h = window.isShaded() ? window.getTitleHeight() : - window.height() + window.getFbWindow().borderWidth()*2; + curr_x = window.x(); + curr_y = window.y(); + curr_w = window.width() + window.fbWindow().borderWidth()*2; + curr_h = window.isShaded() ? window.titleHeight() : + window.height() + window.fbWindow().borderWidth()*2; if (curr_x < test_x + win_w && curr_x + curr_w > test_x && @@ -618,14 +618,14 @@ void Workspace::placeWindow(FluxboxWindow &win) { Windows::iterator it = m_windowlist.begin(); Windows::iterator it_end = m_windowlist.end(); for (; it != it_end && placed; ++it) { - curr_x = (*it)->getXFrame(); - curr_y = (*it)->getYFrame(); - curr_w = (*it)->width() + (*it)->getFbWindow().borderWidth()*2; + curr_x = (*it)->x(); + curr_y = (*it)->y(); + curr_w = (*it)->width() + (*it)->fbWindow().borderWidth()*2; curr_h = (((*it)->isShaded()) - ? (*it)->getTitleHeight() + ? (*it)->titleHeight() : (*it)->height()) + - (*it)->getFbWindow().borderWidth()*2; + (*it)->fbWindow().borderWidth()*2; if (curr_x < test_x + win_w && @@ -663,8 +663,8 @@ void Workspace::placeWindow(FluxboxWindow &win) { place_x = m_cascade_x; place_y = m_cascade_y; - m_cascade_x += win.getTitleHeight(); - m_cascade_y += win.getTitleHeight(); + m_cascade_x += win.titleHeight(); + m_cascade_y += win.titleHeight(); } if (place_x + win_w > (signed) screen().getWidth()) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index ecec988..c67daf5 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.147 2003/05/14 14:37:06 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.148 2003/05/15 11:17:27 fluxgen Exp $ #include "fluxbox.hh" @@ -718,7 +718,7 @@ void Fluxbox::handleEvent(XEvent * const e) { m_masked_window->motionNotifyEvent(e->xmotion); return; } else if (e->type == ButtonRelease) { - e->xbutton.window = m_masked_window->getFbWindow().window(); + e->xbutton.window = m_masked_window->fbWindow().window(); } } @@ -1199,7 +1199,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { case Keys::KILLWINDOW: //kill the current window if (m_focused_window) { XKillClient(FbTk::App::instance()->display(), - m_focused_window->getClientWindow()); + m_focused_window->clientWindow()); } break; case Keys::NEXTWINDOW: { //activate next window @@ -1282,7 +1282,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { BScreen::FocusedWindows::iterator it = fwins.begin(); for (; it != fwins.end(); ++it) { if ((*it)->fbwindow() != m_focused_window && - (*it)->fbwindow()->getWorkspaceNumber() == + (*it)->fbwindow()->workspaceNumber() == keyscreen->getCurrentWorkspaceID()) { m_focused_window->attachClient(**it); break; @@ -1417,64 +1417,64 @@ void Fluxbox::doWindowAction(int action, const int param) { break; case Keys::NUDGERIGHT: m_focused_window->moveResize( - m_focused_window->getXFrame()+param, m_focused_window->getYFrame(), + m_focused_window->x() + param, m_focused_window->y(), m_focused_window->width(), m_focused_window->height()); break; case Keys::NUDGELEFT: m_focused_window->moveResize( - m_focused_window->getXFrame()-param, m_focused_window->getYFrame(), + m_focused_window->x() - param, m_focused_window->y(), m_focused_window->width(), m_focused_window->height()); break; case Keys::NUDGEUP: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame()-param, + m_focused_window->x(), m_focused_window->y() - param, m_focused_window->width(), m_focused_window->height()); break; case Keys::NUDGEDOWN: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame()+param, + m_focused_window->x(), m_focused_window->y() + param, m_focused_window->width(), m_focused_window->height()); break; // NOTE !!! BIGNUDGExxxx is not needed, just use 10 as a parameter case Keys::BIGNUDGERIGHT: m_focused_window->moveResize( - m_focused_window->getXFrame()+10, m_focused_window->getYFrame(), + m_focused_window->x() + 10, m_focused_window->y(), m_focused_window->width(), m_focused_window->height()); break; case Keys::BIGNUDGELEFT: m_focused_window->moveResize( - m_focused_window->getXFrame()-10, m_focused_window->getYFrame(), + m_focused_window->x() - 10, m_focused_window->y(), m_focused_window->width(), m_focused_window->height()); break; case Keys::BIGNUDGEUP: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame()-10, + m_focused_window->x(), m_focused_window->y()-10, m_focused_window->width(), m_focused_window->height()); break; case Keys::BIGNUDGEDOWN: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame()+10, + m_focused_window->x(), m_focused_window->y()+10, m_focused_window->width(), m_focused_window->height()); break; case Keys::HORIZINC: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame(), + m_focused_window->x(), m_focused_window->y(), m_focused_window->width() + 10, m_focused_window->height()); break; case Keys::VERTINC: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame(), + m_focused_window->x(), m_focused_window->y(), m_focused_window->width(), m_focused_window->height()+10); break; case Keys::HORIZDEC: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame(), + m_focused_window->x(), m_focused_window->y(), m_focused_window->width() - 10, m_focused_window->height()); break; case Keys::VERTDEC: m_focused_window->moveResize( - m_focused_window->getXFrame(), m_focused_window->getYFrame(), + m_focused_window->x(), m_focused_window->y(), m_focused_window->width(), m_focused_window->height()-10); break; @@ -1561,7 +1561,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) { // if window changed to iconic state // add to icon list if (win.isIconic()) { - Workspace *space = win.screen().getWorkspace(win.getWorkspaceNumber()); + Workspace *space = win.screen().getWorkspace(win.workspaceNumber()); if (space != 0) space->removeWindow(&win); win.screen().addIcon(&win); @@ -1571,7 +1571,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) { // if we're sticky then reassociate window // to all workspaces BScreen &scr = win.screen(); - if (scr.getCurrentWorkspaceID() != win.getWorkspaceNumber()) { + if (scr.getCurrentWorkspaceID() != win.workspaceNumber()) { scr.reassociateWindow(&win, scr.getCurrentWorkspaceID(), true); @@ -2369,10 +2369,10 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) { old_screen = &old_win->screen(); old_tbar = old_screen->getToolbar(); - old_wkspc = old_screen->getWorkspace(old_win->getWorkspaceNumber()); + old_wkspc = old_screen->getWorkspace(old_win->workspaceNumber()); old_win->setFocusFlag(false); - old_wkspc->menu().setItemSelected(old_win->getWindowNumber(), false); + old_wkspc->menu().setItemSelected(old_win->windowNumber(), false); } } @@ -2386,12 +2386,12 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) { } else { screen = *winscreen; tbar = screen->getToolbar(); - wkspc = screen->getWorkspace(win->getWorkspaceNumber()); + wkspc = screen->getWorkspace(win->workspaceNumber()); m_focused_window = win; // update focused window win->setFocusFlag(true); // set focus flag // select this window in workspace menu if (wkspc != 0) - wkspc->menu().setItemSelected(win->getWindowNumber(), true); + wkspc->menu().setItemSelected(win->windowNumber(), true); } } else m_focused_window = 0; diff --git a/src/tests/Makefile b/src/tests/Makefile index a6cc02f..2df6ebe 100644 --- a/src/tests/Makefile +++ b/src/tests/Makefile @@ -1,6 +1,6 @@ CXX=g++ -CXXFLAGS= -I.. -I../FbTk -DDEBUG -DUSE_XFT -Wall -g -O2 -LIBS= +CXXFLAGS= -I.. -I../FbTk -DDEBUG -DUSE_XFT -Wall -g -O2 ../FbTk/libFbTk.a +LIBS= XFLAGS= -I/usr/X11R6/include XLIBS= -L/usr/X11R6/lib -lX11 -lXft COMPILEFILE=$(CXX) -c $(CXXFLAGS) @@ -50,6 +50,12 @@ testFont: testFont.cc ${FONT_OBJ} testLayers: testLayers.cc ${CXX} ${CXXFLAGS} ${XLIBS} testLayers.cc ../FbTk/libFbTk.a -o testLayers +testTransp: transpTest.cc + ${CXX} ${CXXFLAGS} ${XLIBS} transpTest.cc ../FbTk/libFbTk.a -o testTransp + +testScale: scaleTest.cc + ${CXX} ${CXXFLAGS} ${XLIBS} scaleTest.cc ../FbTk/libFbTk.a -lXpm -o testScale + run: testLayers testResource testKeys testStringUtil testFont ./testLayers ./testKeys -- cgit v0.11.2