diff options
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 652c7ac..86a3cee 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.42 2002/04/04 11:28:19 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.43 2002/04/04 14:28:54 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -98,7 +98,7 @@ | |||
98 | 98 | ||
99 | using namespace std; | 99 | using namespace std; |
100 | 100 | ||
101 | static Bool running = True; | 101 | static bool running = true; |
102 | 102 | ||
103 | static int anotherWMRunning(Display *display, XErrorEvent *) { | 103 | static int anotherWMRunning(Display *display, XErrorEvent *) { |
104 | fprintf(stderr, | 104 | fprintf(stderr, |
@@ -109,7 +109,7 @@ static int anotherWMRunning(Display *display, XErrorEvent *) { | |||
109 | " another window manager already running on display %s.\n"), | 109 | " another window manager already running on display %s.\n"), |
110 | DisplayString(display)); | 110 | DisplayString(display)); |
111 | 111 | ||
112 | running = False; | 112 | running = false; |
113 | 113 | ||
114 | return(-1); | 114 | return(-1); |
115 | } | 115 | } |
@@ -274,10 +274,10 @@ resource(rm, screenname, altscreenname) | |||
274 | fluxbox->getSessionCursor()); | 274 | fluxbox->getSessionCursor()); |
275 | 275 | ||
276 | image_control = | 276 | image_control = |
277 | new BImageControl(fluxbox, this, True, fluxbox->getColorsPerChannel(), | 277 | new BImageControl(fluxbox, this, true, fluxbox->getColorsPerChannel(), |
278 | fluxbox->getCacheLife(), fluxbox->getCacheMax()); | 278 | fluxbox->getCacheLife(), fluxbox->getCacheMax()); |
279 | image_control->installRootColormap(); | 279 | image_control->installRootColormap(); |
280 | root_colormap_installed = True; | 280 | root_colormap_installed = true; |
281 | 281 | ||
282 | fluxbox->load_rc(this); | 282 | fluxbox->load_rc(this); |
283 | 283 | ||
@@ -328,13 +328,13 @@ resource(rm, screenname, altscreenname) | |||
328 | unsigned long mask = CWBorderPixel | CWColormap | CWSaveUnder; | 328 | unsigned long mask = CWBorderPixel | CWColormap | CWSaveUnder; |
329 | attrib.border_pixel = getBorderColor()->getPixel(); | 329 | attrib.border_pixel = getBorderColor()->getPixel(); |
330 | attrib.colormap = getColormap(); | 330 | attrib.colormap = getColormap(); |
331 | attrib.save_under = True; | 331 | attrib.save_under = true; |
332 | 332 | ||
333 | geom_window = | 333 | geom_window = |
334 | XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(), | 334 | XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(), |
335 | 0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(), | 335 | 0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(), |
336 | InputOutput, getVisual(), mask, &attrib); | 336 | InputOutput, getVisual(), mask, &attrib); |
337 | geom_visible = False; | 337 | geom_visible = false; |
338 | 338 | ||
339 | if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) { | 339 | if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) { |
340 | if (theme->getWindowStyle().t_focus.getTexture() == | 340 | if (theme->getWindowStyle().t_focus.getTexture() == |
@@ -387,7 +387,7 @@ resource(rm, screenname, altscreenname) | |||
387 | workspacemenu->update(); | 387 | workspacemenu->update(); |
388 | 388 | ||
389 | current_workspace = workspacesList.front(); | 389 | current_workspace = workspacesList.front(); |
390 | workspacemenu->setItemSelected(2, True); | 390 | workspacemenu->setItemSelected(2, true); |
391 | 391 | ||
392 | toolbar = new Toolbar(this); | 392 | toolbar = new Toolbar(this); |
393 | 393 | ||
@@ -469,10 +469,10 @@ resource(rm, screenname, altscreenname) | |||
469 | } | 469 | } |
470 | 470 | ||
471 | namespace { | 471 | namespace { |
472 | template<typename T> | 472 | template<typename T> |
473 | void delete_obj(T * obj) { | 473 | void delete_obj(T * obj) { |
474 | delete obj; | 474 | delete obj; |
475 | } | 475 | } |
476 | } | 476 | } |
477 | 477 | ||
478 | BScreen::~BScreen(void) { | 478 | BScreen::~BScreen(void) { |
@@ -489,22 +489,22 @@ BScreen::~BScreen(void) { | |||
489 | 489 | ||
490 | removeWorkspaceNames(); | 490 | removeWorkspaceNames(); |
491 | 491 | ||
492 | std::for_each( | 492 | std::for_each( |
493 | workspacesList.begin(), | 493 | workspacesList.begin(), |
494 | workspacesList.end(), | 494 | workspacesList.end(), |
495 | delete_obj<Workspace>); | 495 | delete_obj<Workspace>); |
496 | 496 | ||
497 | // don't delete items in the rootmenuList? | 497 | // don't delete items in the rootmenuList? |
498 | 498 | ||
499 | std::for_each( | 499 | std::for_each( |
500 | iconList.begin(), | 500 | iconList.begin(), |
501 | iconList.end(), | 501 | iconList.end(), |
502 | delete_obj<FluxboxWindow>); | 502 | delete_obj<FluxboxWindow>); |
503 | 503 | ||
504 | std::for_each( | 504 | std::for_each( |
505 | netizenList.begin(), | 505 | netizenList.begin(), |
506 | netizenList.end(), | 506 | netizenList.end(), |
507 | delete_obj<Netizen>); | 507 | delete_obj<Netizen>); |
508 | 508 | ||
509 | #ifdef HAVE_STRFTIME | 509 | #ifdef HAVE_STRFTIME |
510 | if (resource.strftime_format) | 510 | if (resource.strftime_format) |
@@ -686,7 +686,7 @@ void BScreen::removeIcon(FluxboxWindow *w) { | |||
686 | if (! w) return; | 686 | if (! w) return; |
687 | 687 | ||
688 | { | 688 | { |
689 | Icons::iterator it = iconList.begin(); | 689 | Icons::iterator it = iconList.begin(); |
690 | Icons::iterator it_end = iconList.end(); | 690 | Icons::iterator it_end = iconList.end(); |
691 | for (; it != it_end; ++it) { | 691 | for (; it != it_end; ++it) { |
692 | if (*it == w) { | 692 | if (*it == w) { |
@@ -700,7 +700,7 @@ void BScreen::removeIcon(FluxboxWindow *w) { | |||
700 | iconmenu->update(); | 700 | iconmenu->update(); |
701 | toolbar->delIcon(w); | 701 | toolbar->delIcon(w); |
702 | 702 | ||
703 | Icons::iterator it = iconList.begin(); | 703 | Icons::iterator it = iconList.begin(); |
704 | Icons::iterator it_end = iconList.end(); | 704 | Icons::iterator it_end = iconList.end(); |
705 | for (int i = 0; it != it_end; ++it, ++i) { | 705 | for (int i = 0; it != it_end; ++it, ++i) { |
706 | (*it)->setWindowNumber(i); | 706 | (*it)->setWindowNumber(i); |
@@ -767,12 +767,11 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
767 | return; | 767 | return; |
768 | 768 | ||
769 | if (id != current_workspace->getWorkspaceID()) { | 769 | if (id != current_workspace->getWorkspaceID()) { |
770 | XSync(fluxbox->getXDisplay(), True); | 770 | XSync(fluxbox->getXDisplay(), true); |
771 | 771 | ||
772 | current_workspace->hideAll(); | 772 | current_workspace->hideAll(); |
773 | 773 | ||
774 | workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, | 774 | workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, false); |
775 | False); | ||
776 | 775 | ||
777 | if (fluxbox->getFocusedWindow() && | 776 | if (fluxbox->getFocusedWindow() && |
778 | fluxbox->getFocusedWindow()->getScreen() == this && | 777 | fluxbox->getFocusedWindow()->getScreen() == this && |
@@ -785,9 +784,8 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
785 | 784 | ||
786 | current_workspace = getWorkspace(id); | 785 | current_workspace = getWorkspace(id); |
787 | 786 | ||
788 | workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, | 787 | workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, true); |
789 | True); | 788 | toolbar->redrawWorkspaceLabel(true); |
790 | toolbar->redrawWorkspaceLabel(True); | ||
791 | 789 | ||
792 | current_workspace->showAll(); | 790 | current_workspace->showAll(); |
793 | 791 | ||
@@ -820,7 +818,7 @@ void BScreen::sendToWorkspace(unsigned int id, bool changeWS) { | |||
820 | } | 818 | } |
821 | 819 | ||
822 | win->withdraw(); | 820 | win->withdraw(); |
823 | BScreen::reassociateWindow(win, id, True); | 821 | BScreen::reassociateWindow(win, id, true); |
824 | if (changeWS) { | 822 | if (changeWS) { |
825 | BScreen::changeWorkspaceID(id); | 823 | BScreen::changeWorkspaceID(id); |
826 | win->setInputFocus(); | 824 | win->setInputFocus(); |
@@ -922,7 +920,7 @@ void BScreen::updateNetizenWindowFocus(void) { | |||
922 | 920 | ||
923 | Netizens::iterator it = netizenList.begin(); | 921 | Netizens::iterator it = netizenList.begin(); |
924 | Netizens::iterator it_end = netizenList.end(); | 922 | Netizens::iterator it_end = netizenList.end(); |
925 | Window f = ((fluxbox->getFocusedWindow()) ? | 923 | Window f = ((fluxbox->getFocusedWindow()) ? |
926 | fluxbox->getFocusedWindow()->getClientWindow() : None); | 924 | fluxbox->getFocusedWindow()->getClientWindow() : None); |
927 | for (; it != it_end; ++it) { | 925 | for (; it != it_end; ++it) { |
928 | (*it)->sendWindowFocus(f); | 926 | (*it)->sendWindowFocus(f); |
@@ -1199,7 +1197,7 @@ void BScreen::initMenu(void) { | |||
1199 | } else | 1197 | } else |
1200 | rootmenu = new Rootmenu(this); | 1198 | rootmenu = new Rootmenu(this); |
1201 | 1199 | ||
1202 | Bool defaultMenu = True; | 1200 | Bool defaultMenu = true; |
1203 | 1201 | ||
1204 | if (fluxbox->getMenuFilename()) { | 1202 | if (fluxbox->getMenuFilename()) { |
1205 | ifstream menu_file(fluxbox->getMenuFilename()); | 1203 | ifstream menu_file(fluxbox->getMenuFilename()); |
@@ -1292,7 +1290,7 @@ Bool BScreen::parseMenuFile(ifstream &file, Rootmenu *menu, int &row) { | |||
1292 | 1290 | ||
1293 | I18n *i18n = I18n::instance(); | 1291 | I18n *i18n = I18n::instance(); |
1294 | if (str_key == "end") { | 1292 | if (str_key == "end") { |
1295 | return ((menu->getCount() == 0) ? True : False); | 1293 | return ((menu->getCount() == 0) ? true : false); |
1296 | } else if (str_key == "nop") { | 1294 | } else if (str_key == "nop") { |
1297 | menu->insert(str_label.c_str()); | 1295 | menu->insert(str_label.c_str()); |
1298 | } else if (str_key == "exec") { // exec | 1296 | } else if (str_key == "exec") { // exec |
@@ -1594,7 +1592,7 @@ void BScreen::showPosition(int x, int y) { | |||
1594 | XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); | 1592 | XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); |
1595 | XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); | 1593 | XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); |
1596 | 1594 | ||
1597 | geom_visible = True; | 1595 | geom_visible = true; |
1598 | } | 1596 | } |
1599 | const int label_size = 1024; | 1597 | const int label_size = 1024; |
1600 | char label[label_size]; | 1598 | char label[label_size]; |
@@ -1638,7 +1636,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { | |||
1638 | XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); | 1636 | XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); |
1639 | XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); | 1637 | XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); |
1640 | 1638 | ||
1641 | geom_visible = True; | 1639 | geom_visible = true; |
1642 | } | 1640 | } |
1643 | 1641 | ||
1644 | char label[1024]; | 1642 | char label[1024]; |
@@ -1668,7 +1666,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { | |||
1668 | void BScreen::hideGeometry(void) { | 1666 | void BScreen::hideGeometry(void) { |
1669 | if (geom_visible) { | 1667 | if (geom_visible) { |
1670 | XUnmapWindow(getBaseDisplay()->getXDisplay(), geom_window); | 1668 | XUnmapWindow(getBaseDisplay()->getXDisplay(), geom_window); |
1671 | geom_visible = False; | 1669 | geom_visible = false; |
1672 | } | 1670 | } |
1673 | } | 1671 | } |
1674 | 1672 | ||
@@ -1676,14 +1674,14 @@ void BScreen::hideGeometry(void) { | |||
1676 | // Goes to the workspace "right" of the current | 1674 | // Goes to the workspace "right" of the current |
1677 | //-------------------------------------------- | 1675 | //-------------------------------------------- |
1678 | void BScreen::nextWorkspace(const int delta) { | 1676 | void BScreen::nextWorkspace(const int delta) { |
1679 | changeWorkspaceID( (getCurrentWorkspaceID()+delta) % getCount()); | 1677 | changeWorkspaceID( (getCurrentWorkspaceID()+delta) % getCount()); |
1680 | } | 1678 | } |
1681 | 1679 | ||
1682 | //------------- prevWorkspace ---------------- | 1680 | //------------- prevWorkspace ---------------- |
1683 | // Goes to the workspace "left" of the current | 1681 | // Goes to the workspace "left" of the current |
1684 | //-------------------------------------------- | 1682 | //-------------------------------------------- |
1685 | void BScreen::prevWorkspace(const int delta) { | 1683 | void BScreen::prevWorkspace(const int delta) { |
1686 | changeWorkspaceID( (getCurrentWorkspaceID()-delta+getCount()) % getCount()); | 1684 | changeWorkspaceID( (getCurrentWorkspaceID()-delta+getCount()) % getCount()); |
1687 | } | 1685 | } |
1688 | 1686 | ||
1689 | //-------------- rightWorkspace --------------- | 1687 | //-------------- rightWorkspace --------------- |