aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-01-05 22:26:56 (GMT)
committerfluxgen <fluxgen>2003-01-05 22:26:56 (GMT)
commita7ca5002293726ce3280c626a741fc9f0dd30940 (patch)
tree46dfa7ea673002638b14bfc6cf0faaffab4c5dfa /src
parent017f79e9fdb3d6563d0ac818e456365ebebf18d3 (diff)
downloadfluxbox_paul-a7ca5002293726ce3280c626a741fc9f0dd30940.zip
fluxbox_paul-a7ca5002293726ce3280c626a741fc9f0dd30940.tar.bz2
added max functions so we can determine maximum workspace area. Creation of a new FluxboxWindow object is now handled in BScreen::createWindow
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc142
1 files changed, 126 insertions, 16 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index d85021a..efc5afd 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.92 2002/12/13 20:19:05 fluxgen Exp $ 25// $Id: Screen.cc,v 1.93 2003/01/05 22:26:56 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -40,6 +40,8 @@
40#include "StringUtil.hh" 40#include "StringUtil.hh"
41#include "Netizen.hh" 41#include "Netizen.hh"
42#include "DirHelper.hh" 42#include "DirHelper.hh"
43#include "WinButton.hh"
44#include "SimpleCommand.hh"
43 45
44//use GNU extensions 46//use GNU extensions
45#ifndef _GNU_SOURCE 47#ifndef _GNU_SOURCE
@@ -270,7 +272,7 @@ BScreen::BScreen(ResourceManager &rm,
270 m_workspacecount_sig(*this), // workspace count signal 272 m_workspacecount_sig(*this), // workspace count signal
271 m_workspacenames_sig(*this), // workspace names signal 273 m_workspacenames_sig(*this), // workspace names signal
272 m_currentworkspace_sig(*this), // current workspace signal 274 m_currentworkspace_sig(*this), // current workspace signal
273 theme(0), 275 theme(0), m_windowtheme(scrn),
274 resource(rm, screenname, altscreenname) 276 resource(rm, screenname, altscreenname)
275{ 277{
276 Display *disp = BaseDisplay::getXDisplay(); 278 Display *disp = BaseDisplay::getXDisplay();
@@ -425,10 +427,10 @@ BScreen::BScreen(ResourceManager &rm,
425 427
426 //update menus 428 //update menus
427 m_rootmenu->update(); 429 m_rootmenu->update();
428 430#ifdef SLIT
429 if (m_slit.get()) 431 if (m_slit.get())
430 m_slit->reconfigure(); 432 m_slit->reconfigure();
431 433#endif // SLIT
432 434
433 // start with workspace 0 435 // start with workspace 0
434 changeWorkspaceID(0); 436 changeWorkspaceID(0);
@@ -472,20 +474,13 @@ BScreen::BScreen(ResourceManager &rm,
472 continue; 474 continue;
473 475
474 if (attrib.map_state != IsUnmapped) { 476 if (attrib.map_state != IsUnmapped) {
475 477 FluxboxWindow *win = createWindow(children[i]);
476 FluxboxWindow *win = new FluxboxWindow(children[i], this); 478
477 if (!win->isManaged()) {
478 delete win;
479 win = 0;
480 } else {
481 Fluxbox::instance()->attachSignals(*win);
482 }
483
484 if (win) { 479 if (win) {
485 XMapRequestEvent mre; 480 XMapRequestEvent mre;
486 mre.window = children[i]; 481 mre.window = children[i];
487 win->restoreAttributes(); 482 win->restoreAttributes();
488 win->mapRequestEvent(&mre); 483 win->mapRequestEvent(mre);
489 } 484 }
490 } 485 }
491 } 486 }
@@ -543,6 +538,25 @@ BScreen::~BScreen() {
543 538
544} 539}
545 540
541/// TODO
542unsigned int BScreen::getMaxLeft() const {
543 return 0;
544}
545
546/// TODO
547unsigned int BScreen::getMaxRight() const {
548 return getWidth();
549}
550
551/// TODO
552unsigned int BScreen::getMaxTop() const {
553 return 0;
554}
555/// TODO
556unsigned int BScreen::getMaxBottom() const {
557 return getHeight();
558}
559
546void BScreen::iconUpdate() { 560void BScreen::iconUpdate() {
547 m_iconmenu->update(); 561 m_iconmenu->update();
548} 562}
@@ -633,10 +647,11 @@ void BScreen::reconfigure() {
633 if (m_toolbar->theme().font().isAntialias() != *resource.antialias) 647 if (m_toolbar->theme().font().isAntialias() != *resource.antialias)
634 m_toolbar->theme().font().setAntialias(*resource.antialias); 648 m_toolbar->theme().font().setAntialias(*resource.antialias);
635 649
636 650#ifdef SLIT
637 if (m_slit.get()) 651 if (m_slit.get())
638 m_slit->reconfigure(); 652 m_slit->reconfigure();
639 653#endif // SLIT
654
640 //reconfigure workspaces 655 //reconfigure workspaces
641 Workspaces::iterator wit = workspacesList.begin(); 656 Workspaces::iterator wit = workspacesList.begin();
642 Workspaces::iterator wit_end = workspacesList.end(); 657 Workspaces::iterator wit_end = workspacesList.end();
@@ -1004,7 +1019,100 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) {
1004 } 1019 }
1005} 1020}
1006 1021
1022FluxboxWindow *BScreen::createWindow(Window client) {
1023 FluxboxWindow *win = new FluxboxWindow(client, this, getScreenNumber(), *getImageControl(), winFrameTheme());
1024
1025#ifdef SLIT
1026 if (win->initialState() == WithdrawnState)
1027 getSlit()->addClient(win->getClientWindow());
1028#endif // SLIT
1029
1030 if (!win->isManaged()) {
1031 delete win;
1032 return 0;
1033 } else {
1034 Fluxbox::instance()->saveWindowSearch(client, win);
1035 Fluxbox::instance()->attachSignals(*win);
1036 setupWindowActions(*win);
1037 }
1038 return win;
1039}
1040
1041void BScreen::setupWindowActions(FluxboxWindow &win) {
1042
1043 FbWinFrame &frame = win.frame();
1044
1045 // clear old buttons from frame
1046 frame.removeAllButtons();
1047
1048 typedef FbTk::RefCount<FbTk::Command> CommandRef;
1049
1050 using namespace FbTk;
1051
1052 //create new buttons
1053 if (win.isIconifiable()) {
1054 FbTk::Button *iconifybtn = new WinButton(WinButton::MINIMIZE, frame.titlebar(), 0, 0, 10, 10);
1055 CommandRef iconifycmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::iconify));
1056 iconifybtn->setOnClick(iconifycmd);
1057 iconifybtn->show();
1058 frame.addRightButton(iconifybtn);
1059#ifdef DEBUG
1060 cerr<<"Creating iconify button"<<endl;
1061#endif //DEBUG
1062 }
1063
1064 if (win.isMaximizable()) {
1065 FbTk::Button *maximizebtn = new WinButton(WinButton::MAXIMIZE, frame.titlebar(), 0, 0, 10, 10);
1066 CommandRef maximizecmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::maximize));
1067 CommandRef maximize_horiz_cmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::maximizeHorizontal));
1068 CommandRef maximize_vert_cmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::maximizeVertical));
1069
1070 maximizebtn->setOnClick(maximizecmd, 1);
1071 maximizebtn->setOnClick(maximize_horiz_cmd, 3);
1072 maximizebtn->setOnClick(maximize_vert_cmd, 2);
1073 maximizebtn->show();
1074 frame.addRightButton(maximizebtn);
1075#ifdef DEBUG
1076 cerr<<"Creating maximize button"<<endl;
1077#endif // DEBUG
1078 }
1007 1079
1080 if (win.isClosable()) {
1081 Button *closebtn = new WinButton(WinButton::CLOSE, frame.titlebar(), 0, 0, 10, 10);
1082 CommandRef closecmd(new SimpleCommand<FluxboxWindow>(win, &FluxboxWindow::close));
1083 closebtn->setOnClick(closecmd);
1084 closebtn->show();
1085 frame.addRightButton(closebtn);
1086#ifdef DEBUG
1087 cerr<<"Creating close button"<<endl;
1088#endif // DEBUG
1089 }
1090 /*
1091 if (decorations.sticky) {
1092 FbTk::Button *stickbtn = new WinButton(WinButton::STICK, m_frame.titlebar(),
1093 0, 0, 10, 10);
1094 FbTk::RefCount<FbTk::Command> stickcmd(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::stick));
1095 stickbtn->setOnClick(stickcmd);
1096 stickbtn->show();
1097 m_frame.addLeftButton(stickbtn);
1098#ifdef DEBUG
1099 cerr<<"Creating sticky button"<<endl;
1100#endif // DEBUG
1101 }
1102 */
1103 /* if (decorations.shade) {
1104 FbTk::Button *shadebtn = new WinButton(WinButton::SHADE, m_frame.titlebar(),
1105 0, 0, 10, 10);
1106 FbTk::RefCount<FbTk::Command> shadecmd(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::shade));
1107 shadebtn->setOnClick(shadecmd);
1108 shadebtn->show();
1109 m_frame.addRightButton(shadebtn);
1110#ifdef DEBUG
1111 cerr<<"Creating shade button"<<endl;
1112#endif // DEBUG
1113 }
1114 */
1115}
1008void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) { 1116void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
1009 1117
1010 Window session_stack[(workspace_stack.size() + workspacesList.size() + rootmenuList.size() + 30)]; 1118 Window session_stack[(workspace_stack.size() + workspacesList.size() + rootmenuList.size() + 30)];
@@ -1606,8 +1714,10 @@ void BScreen::shutdown() {
1606 } 1714 }
1607 } 1715 }
1608 1716
1717#ifdef SLIT
1609 if (m_slit.get()) 1718 if (m_slit.get())
1610 m_slit->shutdown(); 1719 m_slit->shutdown();
1720#endif // SLIT
1611 1721
1612} 1722}
1613 1723