aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-15 12:22:52 (GMT)
committerfluxgen <fluxgen>2003-04-15 12:22:52 (GMT)
commit89fddca1d7a2809278f9307367e7f6b600456dc1 (patch)
treeb7a6b6e2cf2265fb37aaac24827e03d6d4f51739
parent77beb5472b35477ba1235cc7258071e4d4094e54 (diff)
downloadfluxbox_pavel-89fddca1d7a2809278f9307367e7f6b600456dc1.zip
fluxbox_pavel-89fddca1d7a2809278f9307367e7f6b600456dc1.tar.bz2
cleaning
-rw-r--r--src/Gnome.cc7
-rw-r--r--src/Screen.cc21
-rw-r--r--src/Window.cc108
-rw-r--r--src/Workspace.cc11
-rw-r--r--src/fluxbox.cc116
-rw-r--r--src/fluxbox.hh47
6 files changed, 160 insertions, 150 deletions
diff --git a/src/Gnome.cc b/src/Gnome.cc
index 717cc60..d4822c5 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Gnome.cc,v 1.16 2003/04/15 00:17:59 fluxgen Exp $ 22// $Id: Gnome.cc,v 1.17 2003/04/15 12:22:52 fluxgen Exp $
23 23
24#include "Gnome.hh" 24#include "Gnome.hh"
25 25
@@ -126,6 +126,7 @@ void Gnome::setupWindow(FluxboxWindow &win) {
126void Gnome::updateClientList(BScreen &screen) { 126void Gnome::updateClientList(BScreen &screen) {
127 size_t num=0; 127 size_t num=0;
128 128
129 // count window clients in each workspace
129 BScreen::Workspaces::const_iterator workspace_it = 130 BScreen::Workspaces::const_iterator workspace_it =
130 screen.getWorkspacesList().begin(); 131 screen.getWorkspacesList().begin();
131 BScreen::Workspaces::const_iterator workspace_it_end = 132 BScreen::Workspaces::const_iterator workspace_it_end =
@@ -138,14 +139,14 @@ void Gnome::updateClientList(BScreen &screen) {
138 for (; win_it != win_it_end; ++win_it) 139 for (; win_it != win_it_end; ++win_it)
139 num += (*win_it)->numClients(); 140 num += (*win_it)->numClients();
140 } 141 }
141 //int num = getCurrentWorkspace()->getWindowList().size();
142 142
143 Window *wl = new (nothrow) Window[num]; 143 Window *wl = new (nothrow) Window[num];
144 if (wl == 0) { 144 if (wl == 0) {
145 cerr<<"Fatal: Out of memory, can't allocate for gnome client list"<<endl; 145 cerr<<"Fatal: Out of memory, can't allocate for gnome client list"<<endl;
146 return; 146 return;
147 } 147 }
148 //start the iterator from begining 148
149 //add client windows to buffer
149 workspace_it = screen.getWorkspacesList().begin(); 150 workspace_it = screen.getWorkspacesList().begin();
150 int win=0; 151 int win=0;
151 for (; workspace_it != workspace_it_end; ++workspace_it) { 152 for (; workspace_it != workspace_it_end; ++workspace_it) {
diff --git a/src/Screen.cc b/src/Screen.cc
index 0d374ef..37efadd 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.120 2003/04/15 00:50:24 rathnor Exp $ 25// $Id: Screen.cc,v 1.121 2003/04/15 12:14:53 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -377,7 +377,8 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
377 opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"), 377 opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"),
378 full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"), 378 full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"),
379 max_over_slit(rm, true, scrname+".maxOverSlit",altscrname+".MaxOverSlit"), 379 max_over_slit(rm, true, scrname+".maxOverSlit",altscrname+".MaxOverSlit"),
380 sloppy_window_grouping(rm, true, scrname+".sloppywindowgrouping", altscrname+".SloppyWindowGrouping"), 380 sloppy_window_grouping(rm, true,
381 scrname+".sloppywindowgrouping", altscrname+".SloppyWindowGrouping"),
381 workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"), 382 workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"),
382 desktop_wheeling(rm, true, scrname+".desktopwheeling", altscrname+".DesktopWheeling"), 383 desktop_wheeling(rm, true, scrname+".desktopwheeling", altscrname+".DesktopWheeling"),
383 show_window_pos(rm, true, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), 384 show_window_pos(rm, true, scrname+".showwindowposition", altscrname+".ShowWindowPosition"),
@@ -388,13 +389,17 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
388 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), 389 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"),
389 focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"), 390 focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"),
390 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), 391 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"),
391 toolbar_width_percent(rm, 65, scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"), 392 toolbar_width_percent(rm, 65,
393 scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"),
392 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), 394 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"),
393 slit_layernum(rm, Fluxbox::instance()->getDockLayer(), scrname+".slit.layer", altscrname+".Slit.Layer"), 395 slit_layernum(rm, Fluxbox::Layer(Fluxbox::instance()->getDockLayer()),
394 toolbar_layernum(rm, Fluxbox::instance()->getDesktopLayer(), scrname+".toolbar.layer", altscrname+".Toolbar.Layer"), 396 scrname+".slit.layer", altscrname+".Slit.Layer"),
397 toolbar_layernum(rm, Fluxbox::Layer(Fluxbox::instance()->getDesktopLayer()),
398 scrname+".toolbar.layer", altscrname+".Toolbar.Layer"),
395 toolbar_mode(rm, ToolbarHandler::ICONS, scrname+".toolbar.mode", altscrname+".Toolbar.Mode"), 399 toolbar_mode(rm, ToolbarHandler::ICONS, scrname+".toolbar.mode", altscrname+".Toolbar.Mode"),
396 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"), 400 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"),
397 toolbar_placement(rm, Toolbar::BOTTOMCENTER, scrname+".toolbar.placement", altscrname+".Toolbar.Placement") 401 toolbar_placement(rm, Toolbar::BOTTOMCENTER,
402 scrname+".toolbar.placement", altscrname+".Toolbar.Placement")
398{ 403{
399 404
400}; 405};
@@ -460,7 +465,7 @@ BScreen::BScreen(ResourceManager &rm,
460 image_control->installRootColormap(); 465 image_control->installRootColormap();
461 root_colormap_installed = true; 466 root_colormap_installed = true;
462 467
463 fluxbox->load_rc(this); 468 fluxbox->load_rc(*this);
464 469
465 image_control->setDither(*resource.image_dither); 470 image_control->setDither(*resource.image_dither);
466 theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(), 471 theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(),
@@ -698,7 +703,7 @@ void BScreen::reconfigure() {
698#ifdef DEBUG 703#ifdef DEBUG
699 cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<<endl; 704 cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<<endl;
700#endif // DEBUG 705#endif // DEBUG
701 Fluxbox::instance()->loadRootCommand(this); 706 Fluxbox::instance()->loadRootCommand(*this);
702 theme->setRootCommand(getRootCommand()); 707 theme->setRootCommand(getRootCommand());
703 const string &filename = Fluxbox::instance()->getStyleFilename(); 708 const string &filename = Fluxbox::instance()->getStyleFilename();
704 theme->load(filename.c_str()); // old theme engine 709 theme->load(filename.c_str()); // old theme engine
diff --git a/src/Window.cc b/src/Window.cc
index 4047f1b..9305fb6 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.132 2003/04/15 00:50:25 rathnor Exp $ 25// $Id: Window.cc,v 1.133 2003/04/15 12:18:37 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -34,9 +34,9 @@
34#include "Netizen.hh" 34#include "Netizen.hh"
35#include "FbWinFrameTheme.hh" 35#include "FbWinFrameTheme.hh"
36#include "MenuTheme.hh" 36#include "MenuTheme.hh"
37
38#include "TextButton.hh" 37#include "TextButton.hh"
39#include "EventManager.hh" 38#include "EventManager.hh"
39#include "FbAtoms.hh"
40 40
41#ifdef HAVE_CONFIG_H 41#ifdef HAVE_CONFIG_H
42#include "config.h" 42#include "config.h"
@@ -279,11 +279,12 @@ void FluxboxWindow::init() {
279 // we don't want to duplicate code here and in attachClient 279 // we don't want to duplicate code here and in attachClient
280 m_clientlist.push_back(m_client); 280 m_clientlist.push_back(m_client);
281#ifdef DEBUG 281#ifdef DEBUG
282 cerr<<"FluxboxWindow::init(this="<<this<<")"<<endl; 282 cerr<<__FILE__<<": FluxboxWindow::init(this="<<this<<", client="<<hex<<m_client->window()<<dec<<")"<<endl;
283#endif // DEBUG 283#endif // DEBUG
284 TextButton *btn = new TextButton(m_frame.label(), 284 TextButton *btn = new TextButton(m_frame.label(),
285 m_frame.theme().font(), 285 m_frame.theme().font(),
286 m_client->title()); 286 m_client->title());
287 btn->setJustify(m_frame.theme().justify());
287 m_labelbuttons[m_client] = btn; 288 m_labelbuttons[m_client] = btn;
288 m_frame.addLabelButton(*btn); 289 m_frame.addLabelButton(*btn);
289 btn->show(); 290 btn->show();
@@ -464,10 +465,6 @@ void FluxboxWindow::attachClient(WinClient &client) {
464 if (client.m_win == this) 465 if (client.m_win == this)
465 return; 466 return;
466 467
467#ifdef DEBUG
468 cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"]"<<endl;
469 cerr<<"attach client window = "<<hex<<client.window()<<dec<<endl;
470#endif // DEBUG
471 // reparent client win to this frame 468 // reparent client win to this frame
472 m_frame.setClientWindow(client); 469 m_frame.setClientWindow(client);
473 470
@@ -483,26 +480,31 @@ void FluxboxWindow::attachClient(WinClient &client) {
483 // reparent window to this 480 // reparent window to this
484 m_frame.setClientWindow(*(*client_it)); 481 m_frame.setClientWindow(*(*client_it));
485 (*client_it)->m_win = this; 482 (*client_it)->m_win = this;
486 // create a labelbutton for this client and associate it with the pointer 483 // create a labelbutton for this client and
484 // associate it with the pointer
487 TextButton *btn = new TextButton(m_frame.label(), 485 TextButton *btn = new TextButton(m_frame.label(),
488 m_frame.theme().font(), 486 m_frame.theme().font(),
489 (*client_it)->title()); 487 (*client_it)->title());
488 btn->setJustify(m_frame.theme().justify());
490 m_labelbuttons[(*client_it)] = btn; 489 m_labelbuttons[(*client_it)] = btn;
491 m_frame.addLabelButton(*btn); 490 m_frame.addLabelButton(*btn);
492 btn->show(); 491 btn->show();
493 FbTk::EventManager &evm = *FbTk::EventManager::instance(); 492 FbTk::EventManager &evm = *FbTk::EventManager::instance();
494 // we need motion notify so we mask it 493 // we need motion notify so we mask it
495 btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | 494 btn->window().setEventMask(ExposureMask | ButtonPressMask |
496 ButtonMotionMask); 495 ButtonReleaseMask | ButtonMotionMask);
497 496
498 497
499 FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(*(*client_it))); 498 FbTk::RefCount<FbTk::Command>
499 set_client_cmd(new SetClientCmd(*(*client_it)));
500 btn->setOnClick(set_client_cmd); 500 btn->setOnClick(set_client_cmd);
501 evm.add(*this, btn->window()); // we take care of button events for this 501 evm.add(*this, btn->window()); // we take care of button events for this
502 502
503 // update transients in client to have this as transient_for 503 // update transients in client to have this as transient_for
504 WinClient::TransientList::iterator trans_it = (*client_it)->transientList().begin(); 504 WinClient::TransientList::iterator trans_it =
505 WinClient::TransientList::iterator trans_it_end = (*client_it)->transientList().end(); 505 (*client_it)->transientList().begin();
506 WinClient::TransientList::iterator trans_it_end =
507 (*client_it)->transientList().end();
506 for (; trans_it != trans_it_end; ++trans_it) { 508 for (; trans_it != trans_it_end; ++trans_it) {
507 (*trans_it)->m_client->transient_for = this; 509 (*trans_it)->m_client->transient_for = this;
508 } 510 }
@@ -525,8 +527,8 @@ void FluxboxWindow::attachClient(WinClient &client) {
525 btn->show(); 527 btn->show();
526 FbTk::EventManager &evm = *FbTk::EventManager::instance(); 528 FbTk::EventManager &evm = *FbTk::EventManager::instance();
527 // we need motion notify so we mask it 529 // we need motion notify so we mask it
528 btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | 530 btn->window().setEventMask(ExposureMask | ButtonPressMask |
529 ButtonMotionMask); 531 ButtonReleaseMask | ButtonMotionMask);
530 532
531 533
532 FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(client)); 534 FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(client));
@@ -535,8 +537,10 @@ void FluxboxWindow::attachClient(WinClient &client) {
535 537
536 client.m_win = this; 538 client.m_win = this;
537 // update transients in client to have this as transient_for 539 // update transients in client to have this as transient_for
538 WinClient::TransientList::iterator trans_it = client.transientList().begin(); 540 WinClient::TransientList::iterator trans_it =
539 WinClient::TransientList::iterator trans_it_end = client.transientList().end(); 541 client.transientList().begin();
542 WinClient::TransientList::iterator trans_it_end =
543 client.transientList().end();
540 for (; trans_it != trans_it_end; ++trans_it) { 544 for (; trans_it != trans_it_end; ++trans_it) {
541 (*trans_it)->m_client->transient_for = this; 545 (*trans_it)->m_client->transient_for = this;
542 } 546 }
@@ -545,19 +549,11 @@ void FluxboxWindow::attachClient(WinClient &client) {
545 } 549 }
546 550
547 m_frame.reconfigure(); 551 m_frame.reconfigure();
548#ifdef DEBUG
549 XSync(display, False); // so we see error/warnings in time
550 cerr<<"destroyed old window "<<client.window()<<endl;
551#endif // DEBUG
552 552
553 // keep the current window on top 553 // keep the current window on top
554 m_client->raise(); 554 m_client->raise();
555 555
556#ifdef DEBUG 556
557 XSync(display, False); // so we see error/warnings in time
558 cerr<<__FILE__<<"("<<__FUNCTION__<<") clientlist size: "<<m_clientlist.size()<<endl;
559 cerr<<endl<<endl<<endl;
560#endif // DEBUG
561 557
562} 558}
563 559
@@ -567,12 +563,6 @@ bool FluxboxWindow::detachClient(WinClient &client) {
567 if (client.m_win != this || numClients() <= 1) 563 if (client.m_win != this || numClients() <= 1)
568 return false; 564 return false;
569 565
570#ifdef DEBUG
571 cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"] client to detach: "<<
572 hex<<client.window()<<dec<<endl;
573 cerr<<__FILE__<<"("<<__FUNCTION__<<"): number of clients = "<<numClients()<<endl;
574#endif // DEBUG
575
576 removeClient(client); 566 removeClient(client);
577 567
578 client.m_win = screen.createWindow(client); 568 client.m_win = screen.createWindow(client);
@@ -634,11 +624,15 @@ WinClient *FluxboxWindow::findClient(Window win) {
634 624
635/// raise and focus next client 625/// raise and focus next client
636void FluxboxWindow::nextClient() { 626void FluxboxWindow::nextClient() {
637 if (numClients() == 1) 627 if (numClients() <= 1)
638 return; 628 return;
639 629
640 ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client); 630 ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client);
641 assert(it != m_clientlist.end()); 631 if (it == m_clientlist.end()) {
632 m_client = m_clientlist.front();
633 return;
634 }
635
642 it++; 636 it++;
643 if (it == m_clientlist.end()) 637 if (it == m_clientlist.end())
644 m_client = m_clientlist.front(); 638 m_client = m_clientlist.front();
@@ -649,12 +643,14 @@ void FluxboxWindow::nextClient() {
649} 643}
650 644
651void FluxboxWindow::prevClient() { 645void FluxboxWindow::prevClient() {
652 if (numClients() == 1) 646 if (numClients() <= 1)
653 return; 647 return;
654 648
655 ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client); 649 ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client);
656 assert(it != m_clientlist.end()); 650 if (it == m_clientlist.end()) {
657 651 m_client = m_clientlist.front();
652 return;
653 }
658 if (it == m_clientlist.begin()) 654 if (it == m_clientlist.begin())
659 m_client = m_clientlist.back(); 655 m_client = m_clientlist.back();
660 else 656 else
@@ -909,11 +905,11 @@ void FluxboxWindow::getMWMHints() {
909 int format; 905 int format;
910 Atom atom_return; 906 Atom atom_return;
911 unsigned long num, len; 907 unsigned long num, len;
912 Fluxbox *fluxbox = Fluxbox::instance(); 908 Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
913 if (!XGetWindowProperty(display, m_client->window(), 909 if (!XGetWindowProperty(display, m_client->window(),
914 fluxbox->getMotifWMHintsAtom(), 0, 910 motif_wm_hints, 0,
915 PropMwmHintsElements, false, 911 PropMwmHintsElements, false,
916 fluxbox->getMotifWMHintsAtom(), &atom_return, 912 motif_wm_hints, &atom_return,
917 &format, &num, &len, 913 &format, &num, &len,
918 (unsigned char **) &m_client->mwm_hint) == Success && 914 (unsigned char **) &m_client->mwm_hint) == Success &&
919 m_client->mwm_hint) { 915 m_client->mwm_hint) {
@@ -1550,7 +1546,7 @@ void FluxboxWindow::installColormap(bool install) {
1550 Colormap *cmaps = XListInstalledColormaps(display, m_client->window(), &ncmap); 1546 Colormap *cmaps = XListInstalledColormaps(display, m_client->window(), &ncmap);
1551 XWindowAttributes wattrib; 1547 XWindowAttributes wattrib;
1552 if (cmaps) { //!! 1548 if (cmaps) { //!!
1553 if (m_client->getAttrib(wattrib)) { //XGetWindowAttributes(display, m_client->window, &wattrib)) { 1549 if (m_client->getAttrib(wattrib)) {
1554 if (install) { 1550 if (install) {
1555 // install the window's colormap 1551 // install the window's colormap
1556 for (i = 0; i < ncmap; i++) { 1552 for (i = 0; i < ncmap; i++) {
@@ -1613,9 +1609,8 @@ bool FluxboxWindow::getState() {
1613 bool ret = false; 1609 bool ret = false;
1614 int foo; 1610 int foo;
1615 unsigned long *state, ulfoo, nitems; 1611 unsigned long *state, ulfoo, nitems;
1616 Fluxbox *fluxbox = Fluxbox::instance(); 1612 if ((XGetWindowProperty(display, m_client->window(), FbAtoms::instance()->getWMStateAtom(),
1617 if ((XGetWindowProperty(display, m_client->window(), fluxbox->getWMStateAtom(), 1613 0l, 2l, false, FbAtoms::instance()->getWMStateAtom(),
1618 0l, 2l, false, fluxbox->getWMStateAtom(),
1619 &atom_return, &foo, &nitems, &ulfoo, 1614 &atom_return, &foo, &nitems, &ulfoo,
1620 (unsigned char **) &state) != Success) || 1615 (unsigned char **) &state) != Success) ||
1621 (! state)) { 1616 (! state)) {
@@ -1713,13 +1708,13 @@ void FluxboxWindow::restoreAttributes() {
1713 Atom atom_return; 1708 Atom atom_return;
1714 int foo; 1709 int foo;
1715 unsigned long ulfoo, nitems; 1710 unsigned long ulfoo, nitems;
1716 Fluxbox *fluxbox = Fluxbox::instance(); 1711 FbAtoms *fbatoms = FbAtoms::instance();
1717 1712
1718 BaseDisplay::BlackboxAttributes *net; 1713 BaseDisplay::BlackboxAttributes *net;
1719 if (XGetWindowProperty(display, m_client->window(), 1714 if (XGetWindowProperty(display, m_client->window(),
1720 fluxbox->getFluxboxAttributesAtom(), 0l, 1715 fbatoms->getFluxboxAttributesAtom(), 0l,
1721 PropBlackboxAttributesElements, false, 1716 PropBlackboxAttributesElements, false,
1722 fluxbox->getFluxboxAttributesAtom(), &atom_return, &foo, 1717 fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo,
1723 &nitems, &ulfoo, (unsigned char **) &net) == 1718 &nitems, &ulfoo, (unsigned char **) &net) ==
1724 Success && net && nitems == PropBlackboxAttributesElements) { 1719 Success && net && nitems == PropBlackboxAttributesElements) {
1725 blackbox_attrib.flags = net->flags; 1720 blackbox_attrib.flags = net->flags;
@@ -1949,7 +1944,11 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
1949 1944
1950 1945
1951void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { 1946void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
1952 if (ne.window == m_client->window() && !ne.override_redirect && visible) { 1947 WinClient *client = findClient(ne.window);
1948 if (client == 0)
1949 return;
1950
1951 if (!ne.override_redirect && visible) {
1953 Fluxbox *fluxbox = Fluxbox::instance(); 1952 Fluxbox *fluxbox = Fluxbox::instance();
1954 fluxbox->grab(); 1953 fluxbox->grab();
1955 if (! validateClient()) 1954 if (! validateClient())
@@ -1990,6 +1989,7 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent &ue) {
1990 1989
1991#ifdef DEBUG 1990#ifdef DEBUG
1992 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<client->window()<<dec<<endl; 1991 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<client->window()<<dec<<endl;
1992 cerr<<__FILE__<<"("<<__FUNCTION__<<"): title="<<client->title()<<endl;
1993#endif // DEBUG 1993#endif // DEBUG
1994 1994
1995 restore(client, false); 1995 restore(client, false);
@@ -2107,7 +2107,8 @@ void FluxboxWindow::exposeEvent(XExposeEvent &ee) {
2107 2107
2108 2108
2109void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { 2109void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
2110 if (cr.window != m_client->window()) 2110 WinClient *client = findClient(cr.window);
2111 if (client == 0)
2111 return; 2112 return;
2112 2113
2113 int cx = m_frame.x(), cy = m_frame.y(); 2114 int cx = m_frame.x(), cy = m_frame.y();
@@ -2116,7 +2117,7 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
2116 m_frame.titlebar().height() + frame().titlebar().borderWidth() 2117 m_frame.titlebar().height() + frame().titlebar().borderWidth()
2117 : 0); 2118 : 0);
2118 if (cr.value_mask & CWBorderWidth) 2119 if (cr.value_mask & CWBorderWidth)
2119 m_client->old_bw = cr.border_width; 2120 client->old_bw = cr.border_width;
2120 2121
2121 if (cr.value_mask & CWX) 2122 if (cr.value_mask & CWX)
2122 cx = cr.x; 2123 cx = cr.x;
@@ -2638,8 +2639,13 @@ void FluxboxWindow::restore(WinClient *client, bool remap) {
2638 2639
2639 delete client; 2640 delete client;
2640 2641
2641 if (numClients() == 0) 2642#ifdef DEBUG
2643 cerr<<__FILE__<<"("<<__FUNCTION__<<"): numClients() = "<<numClients()<<endl;
2644#endif // DEBUG
2645 if (numClients() == 0) {
2646
2642 m_frame.hide(); 2647 m_frame.hide();
2648 }
2643 2649
2644} 2650}
2645 2651
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 2d95c77..2bc0d78 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.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: Workspace.cc,v 1.51 2003/04/14 14:59:15 fluxgen Exp $ 25// $Id: Workspace.cc,v 1.52 2003/04/15 12:20:27 fluxgen Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -496,15 +496,10 @@ void Workspace::updateClientmenu() {
496 (*win_it)->clientList().begin(); 496 (*win_it)->clientList().begin();
497 FluxboxWindow::ClientList::iterator client_it_end = 497 FluxboxWindow::ClientList::iterator client_it_end =
498 (*win_it)->clientList().end(); 498 (*win_it)->clientList().end();
499 for (; client_it != client_it_end; ++client_it) { 499 for (; client_it != client_it_end; ++client_it)
500 /* FbTk::RefCount<FbTk::Command>
501 raise_and_focus(new RaiseFocusAndSetWorkspace(*this,
502 *(*client_it)));
503 */
504 m_clientmenu.insert(new ClientMenuItem(*(*client_it), *this)); 500 m_clientmenu.insert(new ClientMenuItem(*(*client_it), *this));
505 }
506 } 501 }
507 502
508 m_clientmenu.update(); 503 m_clientmenu.update();
509} 504}
510 505
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 11dc5a5..9939c90 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.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: fluxbox.cc,v 1.108 2003/04/15 08:54:40 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.109 2003/04/15 12:11:54 fluxgen Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -39,6 +39,8 @@
39#include "EventManager.hh" 39#include "EventManager.hh"
40#include "FbCommands.hh" 40#include "FbCommands.hh"
41#include "WinClient.hh" 41#include "WinClient.hh"
42#include "Keys.hh"
43#include "FbAtoms.hh"
42 44
43//Use GNU extensions 45//Use GNU extensions
44#ifndef _GNU_SOURCE 46#ifndef _GNU_SOURCE
@@ -356,7 +358,8 @@ Fluxbox::Titlebar Fluxbox::m_titlebar_left[] = {STICK};
356Fluxbox::Titlebar Fluxbox::m_titlebar_right[] = {MINIMIZE, MAXIMIZE, CLOSE}; 358Fluxbox::Titlebar Fluxbox::m_titlebar_right[] = {MINIMIZE, MAXIMIZE, CLOSE};
357 359
358Fluxbox::Fluxbox(int m_argc, char **m_argv, const char *dpy_name, const char *rc) 360Fluxbox::Fluxbox(int m_argc, char **m_argv, const char *dpy_name, const char *rc)
359 : BaseDisplay(m_argv[0], dpy_name), FbAtoms(getXDisplay()), 361 : BaseDisplay(m_argv[0], dpy_name),
362 m_fbatoms(new FbAtoms()),
360 m_resourcemanager(), m_screen_rm(), 363 m_resourcemanager(), m_screen_rm(),
361 m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"), 364 m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"),
362 m_rc_iconbar(m_resourcemanager, true, "session.iconbar", "Session.Iconbar"), 365 m_rc_iconbar(m_resourcemanager, true, "session.iconbar", "Session.Iconbar"),
@@ -970,7 +973,7 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
970 if (ce.format != 32) 973 if (ce.format != 32)
971 return; 974 return;
972 975
973 if (ce.message_type == getWMChangeStateAtom()) { 976 if (ce.message_type == m_fbatoms->getWMChangeStateAtom()) {
974 FluxboxWindow *win = searchWindow(ce.window); 977 FluxboxWindow *win = searchWindow(ce.window);
975 if (! win || ! win->validateClient()) 978 if (! win || ! win->validateClient())
976 return; 979 return;
@@ -979,18 +982,18 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
979 win->iconify(); 982 win->iconify();
980 if (ce.data.l[0] == NormalState) 983 if (ce.data.l[0] == NormalState)
981 win->deiconify(); 984 win->deiconify();
982 } else if (ce.message_type == getFluxboxChangeWorkspaceAtom()) { 985 } else if (ce.message_type == m_fbatoms->getFluxboxChangeWorkspaceAtom()) {
983 BScreen *screen = searchScreen(ce.window); 986 BScreen *screen = searchScreen(ce.window);
984 987
985 if (screen && ce.data.l[0] >= 0 && 988 if (screen && ce.data.l[0] >= 0 &&
986 ce.data.l[0] < (signed)screen->getCount()) 989 ce.data.l[0] < (signed)screen->getCount())
987 screen->changeWorkspaceID(ce.data.l[0]); 990 screen->changeWorkspaceID(ce.data.l[0]);
988 991
989 } else if (ce.message_type == getFluxboxChangeWindowFocusAtom()) { 992 } else if (ce.message_type == m_fbatoms->getFluxboxChangeWindowFocusAtom()) {
990 FluxboxWindow *win = searchWindow(ce.window); 993 FluxboxWindow *win = searchWindow(ce.window);
991 if (win && win->isVisible() && win->setInputFocus()) 994 if (win && win->isVisible() && win->setInputFocus())
992 win->installColormap(True); 995 win->installColormap(True);
993 } else if (ce.message_type == getFluxboxCycleWindowFocusAtom()) { 996 } else if (ce.message_type == m_fbatoms->getFluxboxCycleWindowFocusAtom()) {
994 BScreen *screen = searchScreen(ce.window); 997 BScreen *screen = searchScreen(ce.window);
995 998
996 if (screen) { 999 if (screen) {
@@ -999,7 +1002,7 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
999 else 1002 else
1000 screen->nextFocus(); 1003 screen->nextFocus();
1001 } 1004 }
1002 } else if (ce.message_type == getFluxboxChangeAttributesAtom()) { 1005 } else if (ce.message_type == m_fbatoms->getFluxboxChangeAttributesAtom()) {
1003 1006
1004 FluxboxWindow *win = searchWindow(ce.window); 1007 FluxboxWindow *win = searchWindow(ce.window);
1005 1008
@@ -1290,7 +1293,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1290 1293
1291 1294
1292} 1295}
1293void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) { 1296void Fluxbox::doWindowAction(int action, const int param) {
1294 if (!focused_window) 1297 if (!focused_window)
1295 return; 1298 return;
1296 1299
@@ -1913,7 +1916,7 @@ void Fluxbox::load_rc() {
1913 } 1916 }
1914} 1917}
1915 1918
1916void Fluxbox::load_rc(BScreen *screen) { 1919void Fluxbox::load_rc(BScreen &screen) {
1917 //get resource filename 1920 //get resource filename
1918 string dbfile(getRcFilename()); 1921 string dbfile(getRcFilename());
1919 if (dbfile.size() != 0) { 1922 if (dbfile.size() != 0) {
@@ -1936,50 +1939,51 @@ void Fluxbox::load_rc(BScreen *screen) {
1936 1939
1937 XrmValue value; 1940 XrmValue value;
1938 char *value_type, name_lookup[1024], class_lookup[1024]; 1941 char *value_type, name_lookup[1024], class_lookup[1024];
1939 int screen_number = screen->getScreenNumber(); 1942 int screen_number = screen.getScreenNumber();
1940 1943
1941 sprintf(name_lookup, "session.screen%d.rowPlacementDirection", screen_number); 1944 sprintf(name_lookup, "session.screen%d.rowPlacementDirection", screen_number);
1942 sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection", screen_number); 1945 sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection", screen_number);
1943 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 1946 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
1944 &value)) { 1947 &value)) {
1945 if (! strncasecmp(value.addr, "righttoleft", value.size)) 1948 if (! strncasecmp(value.addr, "righttoleft", value.size))
1946 screen->saveRowPlacementDirection(BScreen::RIGHTLEFT); 1949 screen.saveRowPlacementDirection(BScreen::RIGHTLEFT);
1947 else 1950 else
1948 screen->saveRowPlacementDirection(BScreen::LEFTRIGHT); 1951 screen.saveRowPlacementDirection(BScreen::LEFTRIGHT);
1949 } else 1952 } else
1950 screen->saveRowPlacementDirection(BScreen::LEFTRIGHT); 1953 screen.saveRowPlacementDirection(BScreen::LEFTRIGHT);
1951 1954
1952 sprintf(name_lookup, "session.screen%d.colPlacementDirection", screen_number); 1955 sprintf(name_lookup, "session.screen%d.colPlacementDirection", screen_number);
1953 sprintf(class_lookup, "Session.Screen%d.ColPlacementDirection", screen_number); 1956 sprintf(class_lookup, "Session.Screen%d.ColPlacementDirection", screen_number);
1954 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 1957 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
1955 &value)) { 1958 &value)) {
1956 if (! strncasecmp(value.addr, "bottomtotop", value.size)) 1959 if (! strncasecmp(value.addr, "bottomtotop", value.size))
1957 screen->saveColPlacementDirection(BScreen::BOTTOMTOP); 1960 screen.saveColPlacementDirection(BScreen::BOTTOMTOP);
1958 else 1961 else
1959 screen->saveColPlacementDirection(BScreen::TOPBOTTOM); 1962 screen.saveColPlacementDirection(BScreen::TOPBOTTOM);
1960 } else 1963 } else
1961 screen->saveColPlacementDirection(BScreen::TOPBOTTOM); 1964 screen.saveColPlacementDirection(BScreen::TOPBOTTOM);
1962 1965
1963 screen->removeWorkspaceNames(); 1966 screen.removeWorkspaceNames();
1964 1967
1965 sprintf(name_lookup, "session.screen%d.workspaceNames", screen_number); 1968 sprintf(name_lookup, "session.screen%d.workspaceNames", screen_number);
1966 sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number); 1969 sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number);
1967 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 1970 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
1968 &value)) { 1971 &value)) {
1969#ifdef DEBUG 1972#ifdef DEBUG
1970 cerr<<__FILE__<<"("<<__LINE__<<"): Workspaces="<<screen->getNumberOfWorkspaces()<<endl; 1973 cerr<<__FILE__<<"("<<__FUNCTION__<<"): Workspaces="<<
1974 screen.getNumberOfWorkspaces()<<endl;
1971#endif // DEBUG 1975#endif // DEBUG
1972 char *search = StringUtil::strdup(value.addr); 1976 char *search = StringUtil::strdup(value.addr);
1973 1977
1974 int i; 1978 int i;
1975 for (i = 0; i < screen->getNumberOfWorkspaces(); i++) { 1979 for (i = 0; i < screen.getNumberOfWorkspaces(); i++) {
1976 char *nn; 1980 char *nn;
1977 1981
1978 if (! i) nn = strtok(search, ","); 1982 if (! i) nn = strtok(search, ",");
1979 else nn = strtok(0, ","); 1983 else nn = strtok(0, ",");
1980 1984
1981 if (nn) 1985 if (nn)
1982 screen->addWorkspaceName(nn); 1986 screen.addWorkspaceName(nn);
1983 else break; 1987 else break;
1984 1988
1985 } 1989 }
@@ -1992,13 +1996,13 @@ void Fluxbox::load_rc(BScreen *screen) {
1992 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 1996 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
1993 &value)) { 1997 &value)) {
1994 if (! strncasecmp(value.addr, "RowSmartPlacement", value.size)) 1998 if (! strncasecmp(value.addr, "RowSmartPlacement", value.size))
1995 screen->savePlacementPolicy(BScreen::ROWSMARTPLACEMENT); 1999 screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
1996 else if (! strncasecmp(value.addr, "ColSmartPlacement", value.size)) 2000 else if (! strncasecmp(value.addr, "ColSmartPlacement", value.size))
1997 screen->savePlacementPolicy(BScreen::COLSMARTPLACEMENT); 2001 screen.savePlacementPolicy(BScreen::COLSMARTPLACEMENT);
1998 else 2002 else
1999 screen->savePlacementPolicy(BScreen::CASCADEPLACEMENT); 2003 screen.savePlacementPolicy(BScreen::CASCADEPLACEMENT);
2000 } else 2004 } else
2001 screen->savePlacementPolicy(BScreen::ROWSMARTPLACEMENT); 2005 screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
2002 2006
2003#ifdef SLIT 2007#ifdef SLIT
2004 sprintf(name_lookup, "session.screen%d.slit.placement", screen_number); 2008 sprintf(name_lookup, "session.screen%d.slit.placement", screen_number);
@@ -2006,34 +2010,34 @@ void Fluxbox::load_rc(BScreen *screen) {
2006 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 2010 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
2007 &value)) { 2011 &value)) {
2008 if (! strncasecmp(value.addr, "TopLeft", value.size)) 2012 if (! strncasecmp(value.addr, "TopLeft", value.size))
2009 screen->saveSlitPlacement(Slit::TOPLEFT); 2013 screen.saveSlitPlacement(Slit::TOPLEFT);
2010 else if (! strncasecmp(value.addr, "CenterLeft", value.size)) 2014 else if (! strncasecmp(value.addr, "CenterLeft", value.size))
2011 screen->saveSlitPlacement(Slit::CENTERLEFT); 2015 screen.saveSlitPlacement(Slit::CENTERLEFT);
2012 else if (! strncasecmp(value.addr, "BottomLeft", value.size)) 2016 else if (! strncasecmp(value.addr, "BottomLeft", value.size))
2013 screen->saveSlitPlacement(Slit::BOTTOMLEFT); 2017 screen.saveSlitPlacement(Slit::BOTTOMLEFT);
2014 else if (! strncasecmp(value.addr, "TopCenter", value.size)) 2018 else if (! strncasecmp(value.addr, "TopCenter", value.size))
2015 screen->saveSlitPlacement(Slit::TOPCENTER); 2019 screen.saveSlitPlacement(Slit::TOPCENTER);
2016 else if (! strncasecmp(value.addr, "BottomCenter", value.size)) 2020 else if (! strncasecmp(value.addr, "BottomCenter", value.size))
2017 screen->saveSlitPlacement(Slit::BOTTOMCENTER); 2021 screen.saveSlitPlacement(Slit::BOTTOMCENTER);
2018 else if (! strncasecmp(value.addr, "TopRight", value.size)) 2022 else if (! strncasecmp(value.addr, "TopRight", value.size))
2019 screen->saveSlitPlacement(Slit::TOPRIGHT); 2023 screen.saveSlitPlacement(Slit::TOPRIGHT);
2020 else if (! strncasecmp(value.addr, "BottomRight", value.size)) 2024 else if (! strncasecmp(value.addr, "BottomRight", value.size))
2021 screen->saveSlitPlacement(Slit::BOTTOMRIGHT); 2025 screen.saveSlitPlacement(Slit::BOTTOMRIGHT);
2022 else 2026 else
2023 screen->saveSlitPlacement(Slit::CENTERRIGHT); 2027 screen.saveSlitPlacement(Slit::CENTERRIGHT);
2024 } else 2028 } else
2025 screen->saveSlitPlacement(Slit::CENTERRIGHT); 2029 screen.saveSlitPlacement(Slit::CENTERRIGHT);
2026 2030
2027 sprintf(name_lookup, "session.screen%d.slit.direction", screen_number); 2031 sprintf(name_lookup, "session.screen%d.slit.direction", screen_number);
2028 sprintf(class_lookup, "Session.Screen%d.Slit.Direction", screen_number); 2032 sprintf(class_lookup, "Session.Screen%d.Slit.Direction", screen_number);
2029 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 2033 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
2030 &value)) { 2034 &value)) {
2031 if (! strncasecmp(value.addr, "Horizontal", value.size)) 2035 if (! strncasecmp(value.addr, "Horizontal", value.size))
2032 screen->saveSlitDirection(Slit::HORIZONTAL); 2036 screen.saveSlitDirection(Slit::HORIZONTAL);
2033 else 2037 else
2034 screen->saveSlitDirection(Slit::VERTICAL); 2038 screen.saveSlitDirection(Slit::VERTICAL);
2035 } else 2039 } else
2036 screen->saveSlitDirection(Slit::VERTICAL); 2040 screen.saveSlitDirection(Slit::VERTICAL);
2037 2041
2038 2042
2039 sprintf(name_lookup, "session.screen%d.slit.autoHide", screen_number); 2043 sprintf(name_lookup, "session.screen%d.slit.autoHide", screen_number);
@@ -2041,11 +2045,11 @@ void Fluxbox::load_rc(BScreen *screen) {
2041 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 2045 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
2042 &value)) { 2046 &value)) {
2043 if (! strncasecmp(value.addr, "True", value.size)) 2047 if (! strncasecmp(value.addr, "True", value.size))
2044 screen->saveSlitAutoHide(True); 2048 screen.saveSlitAutoHide(true);
2045 else 2049 else
2046 screen->saveSlitAutoHide(False); 2050 screen.saveSlitAutoHide(false);
2047 } else 2051 } else
2048 screen->saveSlitAutoHide(False); 2052 screen.saveSlitAutoHide(false);
2049 /* 2053 /*
2050 #ifdef XINERAMA 2054 #ifdef XINERAMA
2051 int tmp_head; 2055 int tmp_head;
@@ -2067,9 +2071,9 @@ void Fluxbox::load_rc(BScreen *screen) {
2067 sprintf(class_lookup, "Session.Screen%d.StrftimeFormat", screen_number); 2071 sprintf(class_lookup, "Session.Screen%d.StrftimeFormat", screen_number);
2068 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 2072 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
2069 &value)) 2073 &value))
2070 screen->saveStrftimeFormat(value.addr); 2074 screen.saveStrftimeFormat(value.addr);
2071 else 2075 else
2072 screen->saveStrftimeFormat("%I:%M %p"); 2076 screen.saveStrftimeFormat("%I:%M %p");
2073#else // HAVE_STRFTIME 2077#else // HAVE_STRFTIME
2074 2078
2075 sprintf(name_lookup, "session.screen%d.dateFormat", screen_number); 2079 sprintf(name_lookup, "session.screen%d.dateFormat", screen_number);
@@ -2077,11 +2081,11 @@ void Fluxbox::load_rc(BScreen *screen) {
2077 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 2081 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
2078 &value)) { 2082 &value)) {
2079 if (strncasecmp(value.addr, "european", value.size)) 2083 if (strncasecmp(value.addr, "european", value.size))
2080 screen->saveDateFormat(B_AMERICANDATE); 2084 screen.saveDateFormat(B_AMERICANDATE);
2081 else 2085 else
2082 screen->saveDateFormat(B_EUROPEANDATE); 2086 screen.saveDateFormat(B_EUROPEANDATE);
2083 } else 2087 } else
2084 screen->saveDateFormat(B_AMERICANDATE); 2088 screen.saveDateFormat(B_AMERICANDATE);
2085 2089
2086 sprintf(name_lookup, "session.screen%d.clockFormat", screen_number); 2090 sprintf(name_lookup, "session.screen%d.clockFormat", screen_number);
2087 sprintf(class_lookup, "Session.Screen%d.ClockFormat", screen_number); 2091 sprintf(class_lookup, "Session.Screen%d.ClockFormat", screen_number);
@@ -2089,23 +2093,23 @@ void Fluxbox::load_rc(BScreen *screen) {
2089 &value)) { 2093 &value)) {
2090 int clock; 2094 int clock;
2091 if (sscanf(value.addr, "%d", &clock) != 1) 2095 if (sscanf(value.addr, "%d", &clock) != 1)
2092 screen->saveClock24Hour(False); 2096 screen.saveClock24Hour(False);
2093 else if (clock == 24) 2097 else if (clock == 24)
2094 screen->saveClock24Hour(True); 2098 screen.saveClock24Hour(True);
2095 else 2099 else
2096 screen->saveClock24Hour(False); 2100 screen.saveClock24Hour(False);
2097 } else 2101 } else
2098 screen->saveClock24Hour(False); 2102 screen.saveClock24Hour(False);
2099#endif // HAVE_STRFTIME 2103#endif // HAVE_STRFTIME
2100 2104
2101 //check size on toolbarwidth percent 2105 //check size on toolbarwidth percent
2102 if (screen->getToolbarWidthPercent() <= 0 || 2106 if (screen.getToolbarWidthPercent() <= 0 ||
2103 screen->getToolbarWidthPercent() > 100) 2107 screen.getToolbarWidthPercent() > 100)
2104 screen->saveToolbarWidthPercent(66); 2108 screen.saveToolbarWidthPercent(66);
2105 2109
2106} 2110}
2107 2111
2108void Fluxbox::loadRootCommand(BScreen *screen) { 2112void Fluxbox::loadRootCommand(BScreen &screen) {
2109 2113
2110 string dbfile(getRcFilename()); 2114 string dbfile(getRcFilename());
2111 2115
@@ -2115,13 +2119,13 @@ void Fluxbox::loadRootCommand(BScreen *screen) {
2115 2119
2116 XrmValue value; 2120 XrmValue value;
2117 char *value_type, name_lookup[1024], class_lookup[1024]; 2121 char *value_type, name_lookup[1024], class_lookup[1024];
2118 sprintf(name_lookup, "session.screen%d.rootCommand", screen->getScreenNumber()); 2122 sprintf(name_lookup, "session.screen%d.rootCommand", screen.getScreenNumber());
2119 sprintf(class_lookup, "Session.Screen%d.RootCommand", screen->getScreenNumber()); 2123 sprintf(class_lookup, "Session.Screen%d.RootCommand", screen.getScreenNumber());
2120 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 2124 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
2121 &value)) { 2125 &value)) {
2122 screen->saveRootCommand(value.addr==0 ? "": value.addr); 2126 screen.saveRootCommand(value.addr==0 ? "": value.addr);
2123 } else 2127 } else
2124 screen->saveRootCommand(""); 2128 screen.saveRootCommand("");
2125 2129
2126} 2130}
2127 2131
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index c5db866..f7d2191 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -22,16 +22,14 @@
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: fluxbox.hh,v 1.48 2003/04/15 00:50:25 rathnor Exp $ 25// $Id: fluxbox.hh,v 1.49 2003/04/15 12:11:10 fluxgen Exp $
26 26
27#ifndef FLUXBOX_HH 27#ifndef FLUXBOX_HH
28#define FLUXBOX_HH 28#define FLUXBOX_HH
29 29
30#include "Resource.hh" 30#include "Resource.hh"
31#include "Keys.hh"
32#include "BaseDisplay.hh" 31#include "BaseDisplay.hh"
33#include "Timer.hh" 32#include "Timer.hh"
34#include "Toolbar.hh"
35#include "Observer.hh" 33#include "Observer.hh"
36 34
37#ifdef HAVE_CONFIG_H 35#ifdef HAVE_CONFIG_H
@@ -39,7 +37,6 @@
39#endif // HAVE_CONFIG_H 37#endif // HAVE_CONFIG_H
40 38
41#include "SignalHandler.hh" 39#include "SignalHandler.hh"
42#include "FbAtoms.hh"
43 40
44#include <X11/Xlib.h> 41#include <X11/Xlib.h>
45#include <X11/Xresource.h> 42#include <X11/Xresource.h>
@@ -65,6 +62,9 @@
65 62
66class AtomHandler; 63class AtomHandler;
67class FluxboxWindow; 64class FluxboxWindow;
65class Keys;
66class BScreen;
67class FbAtoms;
68 68
69/** 69/**
70 main class for the window manager. 70 main class for the window manager.
@@ -72,7 +72,6 @@ class FluxboxWindow;
72*/ 72*/
73class Fluxbox : public BaseDisplay, public FbTk::TimeoutHandler, 73class Fluxbox : public BaseDisplay, public FbTk::TimeoutHandler,
74 public FbTk::SignalEventHandler, 74 public FbTk::SignalEventHandler,
75 public FbAtoms,
76 public FbTk::Observer { 75 public FbTk::Observer {
77public: 76public:
78 Fluxbox(int argc, char **argv, const char * dpy_name= 0, const char *rc = 0); 77 Fluxbox(int argc, char **argv, const char * dpy_name= 0, const char *rc = 0);
@@ -80,11 +79,10 @@ public:
80 79
81 static Fluxbox *instance() { return singleton; } 80 static Fluxbox *instance() { return singleton; }
82 81
83 inline bool useIconBar() { return *m_rc_iconbar; } 82 inline bool useIconBar() const { return *m_rc_iconbar; }
84 inline void saveIconBar(bool value) { m_rc_iconbar = value; } 83 inline void saveIconBar(bool value) { m_rc_iconbar = value; }
85#ifdef HAVE_GETPID 84
86 inline Atom getFluxboxPidAtom() const { return fluxbox_pid; } 85 inline Atom getFluxboxPidAtom() const { return fluxbox_pid; }
87#endif // HAVE_GETPID
88 86
89 FluxboxWindow *searchGroup(Window, FluxboxWindow *); 87 FluxboxWindow *searchGroup(Window, FluxboxWindow *);
90 FluxboxWindow *searchWindow(Window); 88 FluxboxWindow *searchWindow(Window);
@@ -101,8 +99,8 @@ public:
101 99
102 enum FocusModel { SLOPPYFOCUS=0, SEMISLOPPYFOCUS, CLICKTOFOCUS }; 100 enum FocusModel { SLOPPYFOCUS=0, SEMISLOPPYFOCUS, CLICKTOFOCUS };
103 101
104 inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() { return *m_rc_titlebar_right; } 102 inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() const { return *m_rc_titlebar_right; }
105 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return *m_rc_titlebar_left; } 103 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; }
106 inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } 104 inline const std::string &getStyleFilename() const { return *m_rc_stylefile; }
107 105
108 inline const char *getMenuFilename() const { return m_rc_menufile->c_str(); } 106 inline const char *getMenuFilename() const { return m_rc_menufile->c_str(); }
@@ -113,8 +111,8 @@ public:
113 // class to store layer numbers (special Resource type) 111 // class to store layer numbers (special Resource type)
114 class Layer { 112 class Layer {
115 public: 113 public:
116 Layer(int i) : m_num(i) {}; 114 explicit Layer(int i) : m_num(i) {};
117 const int getNum() const { return m_num; } 115 inline int getNum() const { return m_num; }
118 116
119 Layer &operator=(int num) { m_num = num; return *this; } 117 Layer &operator=(int num) { m_num = num; return *this; }
120 118
@@ -139,25 +137,25 @@ public:
139 137
140 inline void maskWindowEvents(Window w, FluxboxWindow *bw) 138 inline void maskWindowEvents(Window w, FluxboxWindow *bw)
141 { masked = w; masked_window = bw; } 139 { masked = w; masked_window = bw; }
142 inline void setNoFocus(Bool f) { no_focus = f; } 140 inline void setNoFocus(bool f) { no_focus = f; }
143 141
144 void watchKeyRelease(BScreen *screen, unsigned int mods); 142 void watchKeyRelease(BScreen *screen, unsigned int mods);
145 143
146 void setFocusedWindow(FluxboxWindow *w); 144 void setFocusedWindow(FluxboxWindow *w);
147 void shutdown(); 145 void shutdown();
148 void load_rc(BScreen *); 146 void load_rc(BScreen &scr);
149 void loadRootCommand(BScreen *); 147 void loadRootCommand(BScreen &scr);
150 void loadTitlebar(); 148 void loadTitlebar();
151 void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); } 149 void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
152 void saveMenuFilename(const char *); 150 void saveMenuFilename(const char *);
153 void saveTitlebarFilename(const char *); 151 void saveTitlebarFilename(const char *);
154 void saveSlitlistFilename(const char *val) { m_rc_slitlistfile = (val == 0 ? "" : val); } 152 void saveSlitlistFilename(const char *val) { m_rc_slitlistfile = (val == 0 ? "" : val); }
155 void saveWindowSearch(Window, FluxboxWindow *); 153 void saveWindowSearch(Window win, FluxboxWindow *fbwin);
156 void saveGroupSearch(Window, FluxboxWindow *); 154 void saveGroupSearch(Window win, FluxboxWindow *fbwin);
157 void save_rc(); 155 void save_rc();
158 void removeWindowSearch(Window); 156 void removeWindowSearch(Window win);
159 void removeGroupSearch(Window); 157 void removeGroupSearch(Window win);
160 void restart(const char * = 0); 158 void restart(const char *command = 0);
161 void reconfigure(); 159 void reconfigure();
162 void rereadMenu(); 160 void rereadMenu();
163 void checkMenu(); 161 void checkMenu();
@@ -211,8 +209,11 @@ private:
211 void handleUnmapNotify(XUnmapEvent &ue); 209 void handleUnmapNotify(XUnmapEvent &ue);
212 void handleClientMessage(XClientMessageEvent &ce); 210 void handleClientMessage(XClientMessageEvent &ce);
213 void handleKeyEvent(XKeyEvent &ke); 211 void handleKeyEvent(XKeyEvent &ke);
214 void doWindowAction(Keys::KeyAction action, const int param); 212 void doWindowAction(int action, const int param);
213 void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
215 214
215 std::auto_ptr<FbAtoms> m_fbatoms;
216
216 ResourceManager m_resourcemanager, m_screen_rm; 217 ResourceManager m_resourcemanager, m_screen_rm;
217 218
218 //--- Resources 219 //--- Resources
@@ -226,7 +227,6 @@ private:
226 Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; 227 Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right;
227 Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; 228 Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
228 229
229 void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
230 230
231 std::map<Window, FluxboxWindow *> windowSearch; 231 std::map<Window, FluxboxWindow *> windowSearch;
232 std::map<Window, FluxboxWindow *> groupSearch; 232 std::map<Window, FluxboxWindow *> groupSearch;
@@ -241,9 +241,7 @@ private:
241 BScreen *watching_screen; 241 BScreen *watching_screen;
242 unsigned int watch_keyrelease; 242 unsigned int watch_keyrelease;
243 243
244#ifdef HAVE_GETPID
245 Atom fluxbox_pid; 244 Atom fluxbox_pid;
246#endif // HAVE_GETPID
247 245
248 bool no_focus, reconfigure_wait, reread_menu_wait; 246 bool no_focus, reconfigure_wait, reread_menu_wait;
249 Time last_time; 247 Time last_time;
@@ -258,6 +256,7 @@ private:
258 256
259 static Fluxbox *singleton; 257 static Fluxbox *singleton;
260 std::vector<AtomHandler *> m_atomhandler; 258 std::vector<AtomHandler *> m_atomhandler;
259
261}; 260};
262 261
263 262