aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-15 11:17:29 (GMT)
committerfluxgen <fluxgen>2003-05-15 11:17:29 (GMT)
commitcbce8634dde14fd7000fde92e86f4bd4bf3525c2 (patch)
treeb3be6c129906ecb67114616d761184cf3375c891 /src/Screen.cc
parent93220b5f1abee3057b292abb958a437ebbc707b4 (diff)
downloadfluxbox-cbce8634dde14fd7000fde92e86f4bd4bf3525c2.zip
fluxbox-cbce8634dde14fd7000fde92e86f4bd4bf3525c2.tar.bz2
cleaning in FluxboxWindow interface
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc57
1 files changed, 29 insertions, 28 deletions
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 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.165 2003/05/14 12:08:19 fluxgen Exp $ 25// $Id: Screen.cc,v 1.166 2003/05/15 11:17:27 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -52,6 +52,7 @@
52#include "LayerMenu.hh" 52#include "LayerMenu.hh"
53#include "WinClient.hh" 53#include "WinClient.hh"
54#include "Subject.hh" 54#include "Subject.hh"
55#include "FbWinFrame.hh"
55 56
56//use GNU extensions 57//use GNU extensions
57#ifndef _GNU_SOURCE 58#ifndef _GNU_SOURCE
@@ -1005,7 +1006,7 @@ void BScreen::removeWindow(FluxboxWindow *win) {
1005 if (win->isIconic()) 1006 if (win->isIconic())
1006 removeIcon(win); 1007 removeIcon(win);
1007 else 1008 else
1008 getWorkspace(win->getWorkspaceNumber())->removeWindow(win); 1009 getWorkspace(win->workspaceNumber())->removeWindow(win);
1009} 1010}
1010 1011
1011 1012
@@ -1173,7 +1174,7 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
1173 } 1174 }
1174#ifdef DEBUG 1175#ifdef DEBUG
1175 cerr<<__FILE__<<": Sending to id = "<<id<<endl; 1176 cerr<<__FILE__<<": Sending to id = "<<id<<endl;
1176 cerr<<__FILE__<<": win->workspaceId="<<win->getWorkspaceNumber()<<endl; 1177 cerr<<__FILE__<<": win->workspaceId="<<win->workspaceNumber()<<endl;
1177#endif //DEBUG 1178#endif //DEBUG
1178 1179
1179 } 1180 }
@@ -1196,13 +1197,13 @@ void BScreen::addNetizen(Window win) {
1196 Workspace::Windows::iterator win_it = (*it)->windowList().begin(); 1197 Workspace::Windows::iterator win_it = (*it)->windowList().begin();
1197 Workspace::Windows::iterator win_it_end = (*it)->windowList().end(); 1198 Workspace::Windows::iterator win_it_end = (*it)->windowList().end();
1198 for (; win_it != win_it_end; ++win_it) { 1199 for (; win_it != win_it_end; ++win_it) {
1199 net->sendWindowAdd((*win_it)->getClientWindow(), 1200 net->sendWindowAdd((*win_it)->clientWindow(),
1200 (*it)->workspaceID()); 1201 (*it)->workspaceID());
1201 } 1202 }
1202 } 1203 }
1203 1204
1204 Window f = ((Fluxbox::instance()->getFocusedWindow()) ? 1205 Window f = ((Fluxbox::instance()->getFocusedWindow()) ?
1205 Fluxbox::instance()->getFocusedWindow()->getClientWindow() : None); 1206 Fluxbox::instance()->getFocusedWindow()->clientWindow() : None);
1206 net->sendWindowFocus(f); 1207 net->sendWindowFocus(f);
1207} 1208}
1208 1209
@@ -1242,7 +1243,7 @@ void BScreen::updateNetizenWindowFocus() {
1242 Netizens::iterator it = netizenList.begin(); 1243 Netizens::iterator it = netizenList.begin();
1243 Netizens::iterator it_end = netizenList.end(); 1244 Netizens::iterator it_end = netizenList.end();
1244 Window f = ((Fluxbox::instance()->getFocusedWindow()) ? 1245 Window f = ((Fluxbox::instance()->getFocusedWindow()) ?
1245 Fluxbox::instance()->getFocusedWindow()->getClientWindow() : None); 1246 Fluxbox::instance()->getFocusedWindow()->clientWindow() : None);
1246 for (; it != it_end; ++it) { 1247 for (; it != it_end; ++it) {
1247 (*it)->sendWindowFocus(f); 1248 (*it)->sendWindowFocus(f);
1248 } 1249 }
@@ -1305,7 +1306,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
1305 1306
1306#ifdef SLIT 1307#ifdef SLIT
1307 if (win->initialState() == WithdrawnState) 1308 if (win->initialState() == WithdrawnState)
1308 getSlit()->addClient(win->getClientWindow()); 1309 getSlit()->addClient(win->clientWindow());
1309#endif // SLIT 1310#endif // SLIT
1310 1311
1311 if (!win->isManaged()) { 1312 if (!win->isManaged()) {
@@ -1324,7 +1325,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
1324 setupWindowActions(*win); 1325 setupWindowActions(*win);
1325 Fluxbox::instance()->attachSignals(*win); 1326 Fluxbox::instance()->attachSignals(*win);
1326 } 1327 }
1327 if (win->getWorkspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { 1328 if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) {
1328 win->show(); 1329 win->show();
1329 } 1330 }
1330 XSync(FbTk::App::instance()->display(), False); 1331 XSync(FbTk::App::instance()->display(), False);
@@ -1337,7 +1338,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
1337 *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); 1338 *layerManager().getLayer(Fluxbox::instance()->getNormalLayer()));
1338#ifdef SLIT 1339#ifdef SLIT
1339 if (win->initialState() == WithdrawnState) 1340 if (win->initialState() == WithdrawnState)
1340 getSlit()->addClient(win->getClientWindow()); 1341 getSlit()->addClient(win->clientWindow());
1341#endif // SLIT 1342#endif // SLIT
1342 if (!win->isManaged()) { 1343 if (!win->isManaged()) {
1343 delete win; 1344 delete win;
@@ -1349,7 +1350,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
1349 Fluxbox::instance()->saveWindowSearch(client.window(), win); 1350 Fluxbox::instance()->saveWindowSearch(client.window(), win);
1350 setupWindowActions(*win); 1351 setupWindowActions(*win);
1351 Fluxbox::instance()->attachSignals(*win); 1352 Fluxbox::instance()->attachSignals(*win);
1352 if (win->getWorkspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) { 1353 if (win->workspaceNumber() == getCurrentWorkspaceID() || win->isStuck()) {
1353 win->show(); 1354 win->show();
1354 } 1355 }
1355 return win; 1356 return win;
@@ -1450,7 +1451,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1450 frame.setOnClickTitlebar(lower_cmd, 2); // on release with button 2 1451 frame.setOnClickTitlebar(lower_cmd, 2); // on release with button 2
1451 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); 1452 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
1452 // setup menu 1453 // setup menu
1453 FbTk::Menu &menu = win.getWindowmenu(); 1454 FbTk::Menu &menu = win.menu();
1454 menu.removeAll(); // clear old items 1455 menu.removeAll(); // clear old items
1455 menu.disableTitle(); // not titlebar 1456 menu.disableTitle(); // not titlebar
1456 1457
@@ -1463,7 +1464,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1463 menu.insert("Iconify", iconify_cmd); 1464 menu.insert("Iconify", iconify_cmd);
1464 menu.insert("Raise", raise_cmd); 1465 menu.insert("Raise", raise_cmd);
1465 menu.insert("Lower", lower_cmd); 1466 menu.insert("Lower", lower_cmd);
1466 menu.insert("Layer...", &win.getLayermenu()); 1467 menu.insert("Layer...", &win.layermenu());
1467 CommandRef next_client_cmd(new WindowCmd(win, &FluxboxWindow::nextClient)); 1468 CommandRef next_client_cmd(new WindowCmd(win, &FluxboxWindow::nextClient));
1468 CommandRef prev_client_cmd(new WindowCmd(win, &FluxboxWindow::prevClient)); 1469 CommandRef prev_client_cmd(new WindowCmd(win, &FluxboxWindow::prevClient));
1469 menu.insert("Next Client", next_client_cmd); 1470 menu.insert("Next Client", next_client_cmd);
@@ -1508,7 +1509,7 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
1508#endif // DEBUG 1509#endif // DEBUG
1509 } 1510 }
1510 1511
1511 if (!w->isIconic() && w->getWorkspaceNumber() == wkspc_id) 1512 if (!w->isIconic() && w->workspaceNumber() == wkspc_id)
1512 return; 1513 return;
1513 1514
1514 1515
@@ -1516,7 +1517,7 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
1516 removeIcon(w); 1517 removeIcon(w);
1517 getWorkspace(wkspc_id)->addWindow(*w); 1518 getWorkspace(wkspc_id)->addWindow(*w);
1518 } else if (ignore_sticky || ! w->isStuck()) { 1519 } else if (ignore_sticky || ! w->isStuck()) {
1519 getWorkspace(w->getWorkspaceNumber())->removeWindow(w); 1520 getWorkspace(w->workspaceNumber())->removeWindow(w);
1520 getWorkspace(wkspc_id)->addWindow(*w); 1521 getWorkspace(wkspc_id)->addWindow(*w);
1521 } 1522 }
1522} 1523}
@@ -1532,7 +1533,7 @@ void BScreen::nextFocus(int opts) {
1532 if (focused->screen().getScreenNumber() == 1533 if (focused->screen().getScreenNumber() ==
1533 getScreenNumber()) { 1534 getScreenNumber()) {
1534 have_focused = true; 1535 have_focused = true;
1535 focused_window_number = focused->getWindowNumber(); 1536 focused_window_number = focused->windowNumber();
1536 } 1537 }
1537 } 1538 }
1538 1539
@@ -1564,7 +1565,7 @@ void BScreen::nextFocus(int opts) {
1564 FluxboxWindow *fbwin = (*it)->m_win; 1565 FluxboxWindow *fbwin = (*it)->m_win;
1565 if (fbwin && !fbwin->isIconic() && 1566 if (fbwin && !fbwin->isIconic() &&
1566 (fbwin->isStuck() 1567 (fbwin->isStuck()
1567 || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { 1568 || fbwin->workspaceNumber() == getCurrentWorkspaceID())) {
1568 // either on this workspace, or stuck 1569 // either on this workspace, or stuck
1569 1570
1570 // keep track of the originally selected window in a set 1571 // keep track of the originally selected window in a set
@@ -1622,7 +1623,7 @@ void BScreen::prevFocus(int opts) {
1622 if (focused->screen().getScreenNumber() == 1623 if (focused->screen().getScreenNumber() ==
1623 getScreenNumber()) { 1624 getScreenNumber()) {
1624 have_focused = true; 1625 have_focused = true;
1625 focused_window_number = focused->getWindowNumber(); 1626 focused_window_number = focused->windowNumber();
1626 } 1627 }
1627 } 1628 }
1628 1629
@@ -1655,7 +1656,7 @@ void BScreen::prevFocus(int opts) {
1655 FluxboxWindow *fbwin = (*it)->m_win; 1656 FluxboxWindow *fbwin = (*it)->m_win;
1656 if (fbwin && !fbwin->isIconic() && 1657 if (fbwin && !fbwin->isIconic() &&
1657 (fbwin->isStuck() 1658 (fbwin->isStuck()
1658 || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { 1659 || fbwin->workspaceNumber() == getCurrentWorkspaceID())) {
1659 // either on this workspace, or stuck 1660 // either on this workspace, or stuck
1660 1661
1661 // keep track of the originally selected window in a set 1662 // keep track of the originally selected window in a set
@@ -1714,7 +1715,7 @@ void BScreen::raiseFocus() {
1714 if (fb->getFocusedWindow()->screen().getScreenNumber() == 1715 if (fb->getFocusedWindow()->screen().getScreenNumber() ==
1715 getScreenNumber()) { 1716 getScreenNumber()) {
1716 have_focused = true; 1717 have_focused = true;
1717 focused_window_number = fb->getFocusedWindow()->getWindowNumber(); 1718 focused_window_number = fb->getFocusedWindow()->windowNumber();
1718 } 1719 }
1719 1720
1720 if ((getCurrentWorkspace()->numberOfWindows() > 1) && have_focused) 1721 if ((getCurrentWorkspace()->numberOfWindows() > 1) && have_focused)
@@ -1739,10 +1740,10 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) {
1739 FluxboxWindow *foundwin = 0; 1740 FluxboxWindow *foundwin = 0;
1740 int weight = 999999, exposure = 0; // extreme values 1741 int weight = 999999, exposure = 0; // extreme values
1741 int borderW = m_root_theme->borderWidth(), 1742 int borderW = m_root_theme->borderWidth(),
1742 top = win.getYFrame(), 1743 top = win.y(),
1743 bottom = win.getYFrame() + win.height() + 2*borderW, 1744 bottom = win.y() + win.height() + 2*borderW,
1744 left = win.getXFrame(), 1745 left = win.x(),
1745 right = win.getXFrame() + win.width() + 2*borderW; 1746 right = win.x() + win.width() + 2*borderW;
1746 1747
1747 Workspace::Windows &wins = getCurrentWorkspace()->windowList(); 1748 Workspace::Windows &wins = getCurrentWorkspace()->windowList();
1748 Workspace::Windows::iterator it = wins.begin(); 1749 Workspace::Windows::iterator it = wins.begin();
@@ -1752,10 +1753,10 @@ void BScreen::dirFocus(FluxboxWindow &win, FocusDir dir) {
1752 // we check things against an edge, and within the bounds (draw a picture) 1753 // we check things against an edge, and within the bounds (draw a picture)
1753 int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0; 1754 int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0;
1754 1755
1755 int otop = (*it)->getYFrame(), 1756 int otop = (*it)->y(),
1756 obottom = (*it)->getYFrame() + (*it)->height() + 2*borderW, 1757 obottom = (*it)->y() + (*it)->height() + 2*borderW,
1757 oleft = (*it)->getXFrame(), 1758 oleft = (*it)->x(),
1758 oright = (*it)->getXFrame() + (*it)->width() + 2*borderW; 1759 oright = (*it)->x() + (*it)->width() + 2*borderW;
1759 // check if they intersect 1760 // check if they intersect
1760 switch (dir) { 1761 switch (dir) {
1761 case FOCUSUP: 1762 case FOCUSUP:
@@ -2494,7 +2495,7 @@ WinClient *BScreen::getLastFocusedWindow(int workspace) {
2494 FocusedWindows::iterator it_end = focused_list.end(); 2495 FocusedWindows::iterator it_end = focused_list.end();
2495 for (; it != it_end; ++it) 2496 for (; it != it_end; ++it)
2496 if ((*it)->fbwindow() && 2497 if ((*it)->fbwindow() &&
2497 (((int)(*it)->fbwindow()->getWorkspaceNumber()) == workspace 2498 (((int)(*it)->fbwindow()->workspaceNumber()) == workspace
2498 && !(*it)->fbwindow()->isIconic() 2499 && !(*it)->fbwindow()->isIconic()
2499 && (!(*it)->fbwindow()->isStuck() || (*it)->fbwindow()->isFocused()))) 2500 && (!(*it)->fbwindow()->isStuck() || (*it)->fbwindow()->isFocused())))
2500 // only give focus to a stuck window if it is currently focused 2501 // only give focus to a stuck window if it is currently focused