aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-04 15:12:51 (GMT)
committerfluxgen <fluxgen>2002-08-04 15:12:51 (GMT)
commitbfbd0a60955daa921791b73fd43155d6c1b30a95 (patch)
tree9d11c7ca375832d3b98640d28a41a6b2de87c6b5 /src
parent9789f8cb6b81e6dfd7cab05d0760790fb8c0aa5a (diff)
downloadfluxbox_paul-bfbd0a60955daa921791b73fd43155d6c1b30a95.zip
fluxbox_paul-bfbd0a60955daa921791b73fd43155d6c1b30a95.tar.bz2
(void) to () and Bool to bool
Diffstat (limited to 'src')
-rw-r--r--src/Toolbar.cc110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 7eba613..d9932fa 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,7 +22,9 @@
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: Toolbar.cc,v 1.25 2002/07/23 17:11:59 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.26 2002/08/04 15:12:51 fluxgen Exp $
26
27#include "Toolbar.hh"
26 28
27// stupid macros needed to access some functions in version 2 of the GNU C 29// stupid macros needed to access some functions in version 2 of the GNU C
28// library 30// library
@@ -40,7 +42,6 @@
40#include "Icon.hh" 42#include "Icon.hh"
41#include "Rootmenu.hh" 43#include "Rootmenu.hh"
42#include "Screen.hh" 44#include "Screen.hh"
43#include "Toolbar.hh"
44#include "Window.hh" 45#include "Window.hh"
45#include "Workspace.hh" 46#include "Workspace.hh"
46#include "Workspacemenu.hh" 47#include "Workspacemenu.hh"
@@ -72,14 +73,18 @@
72using namespace std; 73using namespace std;
73 74
74Toolbar::Toolbar(BScreen *scrn): 75Toolbar::Toolbar(BScreen *scrn):
76on_top(scrn->isToolbarOnTop()),
77editing(false),
78hidden(scrn->doToolbarAutoHide()),
79do_auto_hide(scrn->doToolbarAutoHide()),
75screen(scrn), 80screen(scrn),
76image_ctrl(screen->getImageControl()), 81image_ctrl(scrn->getImageControl()),
77clock_timer(this), // get the clock updating every minute 82clock_timer(this), // get the clock updating every minute
78iconbar(0) 83iconbar(0) {
79{
80
81 fluxbox = Fluxbox::instance();
82 84
85
86
87 fluxbox = Fluxbox::instance();
83 88
84 timeval now; 89 timeval now;
85 gettimeofday(&now, 0); 90 gettimeofday(&now, 0);
@@ -89,12 +94,7 @@ iconbar(0)
89 hide_handler.toolbar = this; 94 hide_handler.toolbar = this;
90 hide_timer = new BTimer(&hide_handler); 95 hide_timer = new BTimer(&hide_handler);
91 hide_timer->setTimeout(fluxbox->getAutoRaiseDelay()); 96 hide_timer->setTimeout(fluxbox->getAutoRaiseDelay());
92 hide_timer->fireOnce(True); 97 hide_timer->fireOnce(true);
93
94
95 editing = False;
96 on_top = screen->isToolbarOnTop();
97 hidden = do_auto_hide = screen->doToolbarAutoHide();
98 98
99 frame.grab_x = frame.grab_y = 0; 99 frame.grab_x = frame.grab_y = 0;
100 100
@@ -109,7 +109,7 @@ iconbar(0)
109 attrib.background_pixel = attrib.border_pixel = 109 attrib.background_pixel = attrib.border_pixel =
110 screen->getBorderColor()->pixel(); 110 screen->getBorderColor()->pixel();
111 attrib.colormap = screen->colormap(); 111 attrib.colormap = screen->colormap();
112 attrib.override_redirect = True; 112 attrib.override_redirect = true;
113 attrib.event_mask = ButtonPressMask | ButtonReleaseMask | 113 attrib.event_mask = ButtonPressMask | ButtonReleaseMask |
114 EnterWindowMask | LeaveWindowMask; 114 EnterWindowMask | LeaveWindowMask;
115 115
@@ -174,7 +174,7 @@ iconbar(0)
174} 174}
175 175
176 176
177Toolbar::~Toolbar(void) { 177Toolbar::~Toolbar() {
178 XUnmapWindow(display, frame.window); 178 XUnmapWindow(display, frame.window);
179 179
180 if (frame.base) image_ctrl->removeImage(frame.base); 180 if (frame.base) image_ctrl->removeImage(frame.base);
@@ -217,7 +217,7 @@ void Toolbar::delIcon(FluxboxWindow *w) {
217 Fluxbox::instance()->removeToolbarSearch(iconbar->delIcon(w)); 217 Fluxbox::instance()->removeToolbarSearch(iconbar->delIcon(w));
218} 218}
219 219
220void Toolbar::reconfigure(void) { 220void Toolbar::reconfigure() {
221 int head_x = 0, 221 int head_x = 0,
222 head_y = 0, 222 head_y = 0,
223 head_w, 223 head_w,
@@ -531,7 +531,7 @@ void Toolbar::reconfigure(void) {
531 redrawNextWorkspaceButton(); 531 redrawNextWorkspaceButton();
532 redrawPrevWindowButton(); 532 redrawPrevWindowButton();
533 redrawNextWindowButton(); 533 redrawNextWindowButton();
534 checkClock(True); 534 checkClock(true);
535 535
536 toolbarmenu->reconfigure(); 536 toolbarmenu->reconfigure();
537 537
@@ -566,9 +566,9 @@ void Toolbar::reconfigure(void) {
566 566
567 567
568#ifdef HAVE_STRFTIME 568#ifdef HAVE_STRFTIME
569void Toolbar::checkClock(Bool redraw) { 569void Toolbar::checkClock(bool redraw) {
570#else // !HAVE_STRFTIME 570#else // !HAVE_STRFTIME
571void Toolbar::checkClock(Bool redraw, Bool date) { 571void Toolbar::checkClock(bool redraw, bool date) {
572#endif // HAVE_STRFTIME 572#endif // HAVE_STRFTIME
573 time_t tmp = 0; 573 time_t tmp = 0;
574 struct tm *tt = 0; 574 struct tm *tt = 0;
@@ -582,7 +582,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
582 frame.hour = tt->tm_hour; 582 frame.hour = tt->tm_hour;
583 frame.minute = tt->tm_min; 583 frame.minute = tt->tm_min;
584 XClearWindow(display, frame.clock); 584 XClearWindow(display, frame.clock);
585 redraw = True; 585 redraw = true;
586 } 586 }
587 } else 587 } else
588 cerr<<__FILE__<<"("<<__LINE__<<"): time(null)<0"<<endl; 588 cerr<<__FILE__<<"("<<__LINE__<<"): time(null)<0"<<endl;
@@ -692,14 +692,13 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
692 } 692 }
693 693
694 switch (screen->getToolbarStyle()->font.justify) { 694 switch (screen->getToolbarStyle()->font.justify) {
695 case DrawUtil::Font::RIGHT: 695 case DrawUtil::Font::RIGHT:
696 dx += frame.clock_w - l; 696 dx += frame.clock_w - l;
697 break; 697 break;
698 698 case DrawUtil::Font::CENTER:
699 case DrawUtil::Font::CENTER: 699 dx += (frame.clock_w - l) / 2;
700 dx += (frame.clock_w - l) / 2;
701 break; 700 break;
702 default: //LEFT 701 default: //LEFT, no justification
703 break; 702 break;
704 } 703 }
705 704
@@ -718,7 +717,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
718} 717}
719 718
720 719
721void Toolbar::redrawWindowLabel(Bool redraw) { 720void Toolbar::redrawWindowLabel(bool redraw) {
722 if (Fluxbox::instance()->getFocusedWindow()) { 721 if (Fluxbox::instance()->getFocusedWindow()) {
723 if (redraw) 722 if (redraw)
724 XClearWindow(display, frame.window_label); 723 XClearWindow(display, frame.window_label);
@@ -785,7 +784,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) {
785} 784}
786 785
787 786
788void Toolbar::redrawWorkspaceLabel(Bool redraw) { 787void Toolbar::redrawWorkspaceLabel(bool redraw) {
789 if (screen->getCurrentWorkspace()->name().size()>0) { 788 if (screen->getCurrentWorkspace()->name().size()>0) {
790 789
791 if (redraw) 790 if (redraw)
@@ -863,7 +862,7 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
863} 862}
864 863
865 864
866void Toolbar::redrawPrevWorkspaceButton(Bool pressed, Bool redraw) { 865void Toolbar::redrawPrevWorkspaceButton(bool pressed, bool redraw) {
867 if (redraw) { 866 if (redraw) {
868 if (pressed) { 867 if (pressed) {
869 if (frame.pbutton) 868 if (frame.pbutton)
@@ -891,7 +890,7 @@ void Toolbar::redrawPrevWorkspaceButton(Bool pressed, Bool redraw) {
891} 890}
892 891
893 892
894void Toolbar::redrawNextWorkspaceButton(Bool pressed, Bool redraw) { 893void Toolbar::redrawNextWorkspaceButton(bool pressed, bool redraw) {
895 if (redraw) { 894 if (redraw) {
896 if (pressed) { 895 if (pressed) {
897 if (frame.pbutton) 896 if (frame.pbutton)
@@ -919,7 +918,7 @@ void Toolbar::redrawNextWorkspaceButton(Bool pressed, Bool redraw) {
919} 918}
920 919
921 920
922void Toolbar::redrawPrevWindowButton(Bool pressed, Bool redraw) { 921void Toolbar::redrawPrevWindowButton(bool pressed, bool redraw) {
923 if (redraw) { 922 if (redraw) {
924 if (pressed) { 923 if (pressed) {
925 if (frame.pbutton) 924 if (frame.pbutton)
@@ -947,7 +946,7 @@ void Toolbar::redrawPrevWindowButton(Bool pressed, Bool redraw) {
947} 946}
948 947
949 948
950void Toolbar::redrawNextWindowButton(Bool pressed, Bool redraw) { 949void Toolbar::redrawNextWindowButton(bool pressed, bool redraw) {
951 if (redraw) { 950 if (redraw) {
952 if (pressed) { 951 if (pressed) {
953 if (frame.pbutton) 952 if (frame.pbutton)
@@ -975,11 +974,11 @@ void Toolbar::redrawNextWindowButton(Bool pressed, Bool redraw) {
975} 974}
976 975
977 976
978void Toolbar::edit(void) { 977void Toolbar::edit() {
979 Window window; 978 Window window;
980 int foo; 979 int foo;
981 980
982 editing = True; //mark for editing 981 editing = true; //mark for editing
983 982
984 //workspace labe already got intput focus ? 983 //workspace labe already got intput focus ?
985 if (XGetInputFocus(display, &window, &foo) && 984 if (XGetInputFocus(display, &window, &foo) &&
@@ -993,9 +992,9 @@ void Toolbar::edit(void) {
993 992
994 XClearWindow(display, frame.workspace_label); //clear workspace text 993 XClearWindow(display, frame.workspace_label); //clear workspace text
995 994
996 fluxbox->setNoFocus(True); 995 fluxbox->setNoFocus(true);
997 if (fluxbox->getFocusedWindow()) //disable focus on current focused window 996 if (fluxbox->getFocusedWindow()) //disable focus on current focused window
998 fluxbox->getFocusedWindow()->setFocusFlag(False); 997 fluxbox->getFocusedWindow()->setFocusFlag(false);
999 998
1000 XDrawRectangle(display, frame.workspace_label, 999 XDrawRectangle(display, frame.workspace_label,
1001 screen->getWindowStyle()->l_text_focus_gc, 1000 screen->getWindowStyle()->l_text_focus_gc,
@@ -1008,13 +1007,13 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) {
1008 FluxboxWindow *fluxboxwin=0; 1007 FluxboxWindow *fluxboxwin=0;
1009 if (be->button == 1) { 1008 if (be->button == 1) {
1010 if (be->window == frame.psbutton) 1009 if (be->window == frame.psbutton)
1011 redrawPrevWorkspaceButton(True, True); 1010 redrawPrevWorkspaceButton(true, true);
1012 else if (be->window == frame.nsbutton) 1011 else if (be->window == frame.nsbutton)
1013 redrawNextWorkspaceButton(True, True); 1012 redrawNextWorkspaceButton(true, true);
1014 else if (be->window == frame.pwbutton) 1013 else if (be->window == frame.pwbutton)
1015 redrawPrevWindowButton(True, True); 1014 redrawPrevWindowButton(true, true);
1016 else if (be->window == frame.nwbutton) 1015 else if (be->window == frame.nwbutton)
1017 redrawNextWindowButton(True, True); 1016 redrawNextWindowButton(true, true);
1018 else if ( iconbar ) { 1017 else if ( iconbar ) {
1019 if ( (fluxboxwin = iconbar->findWindow(be->window)) ) 1018 if ( (fluxboxwin = iconbar->findWindow(be->window)) )
1020 fluxboxwin->deiconify(); 1019 fluxboxwin->deiconify();
@@ -1022,7 +1021,7 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) {
1022#ifndef HAVE_STRFTIME 1021#ifndef HAVE_STRFTIME
1023 else if (be->window == frame.clock) { 1022 else if (be->window == frame.clock) {
1024 XClearWindow(display, frame.clock); 1023 XClearWindow(display, frame.clock);
1025 checkClock(True, True); 1024 checkClock(true, true);
1026 } 1025 }
1027#endif // HAVE_STRFTIME 1026#endif // HAVE_STRFTIME
1028 else if (! on_top) { 1027 else if (! on_top) {
@@ -1061,25 +1060,25 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) {
1061void Toolbar::buttonReleaseEvent(XButtonEvent *re) { 1060void Toolbar::buttonReleaseEvent(XButtonEvent *re) {
1062 if (re->button == 1) { 1061 if (re->button == 1) {
1063 if (re->window == frame.psbutton) { 1062 if (re->window == frame.psbutton) {
1064 redrawPrevWorkspaceButton(False, True); 1063 redrawPrevWorkspaceButton(false, true);
1065 1064
1066 if (re->x >= 0 && re->x < (signed) frame.button_w && 1065 if (re->x >= 0 && re->x < (signed) frame.button_w &&
1067 re->y >= 0 && re->y < (signed) frame.button_w) 1066 re->y >= 0 && re->y < (signed) frame.button_w)
1068 screen->prevWorkspace(1); 1067 screen->prevWorkspace(1);
1069 } else if (re->window == frame.nsbutton) { 1068 } else if (re->window == frame.nsbutton) {
1070 redrawNextWorkspaceButton(False, True); 1069 redrawNextWorkspaceButton(false, true);
1071 1070
1072 if (re->x >= 0 && re->x < (signed) frame.button_w && 1071 if (re->x >= 0 && re->x < (signed) frame.button_w &&
1073 re->y >= 0 && re->y < (signed) frame.button_w) 1072 re->y >= 0 && re->y < (signed) frame.button_w)
1074 screen->nextWorkspace(1); 1073 screen->nextWorkspace(1);
1075 } else if (re->window == frame.pwbutton) { 1074 } else if (re->window == frame.pwbutton) {
1076 redrawPrevWindowButton(False, True); 1075 redrawPrevWindowButton(false, true);
1077 1076
1078 if (re->x >= 0 && re->x < (signed) frame.button_w && 1077 if (re->x >= 0 && re->x < (signed) frame.button_w &&
1079 re->y >= 0 && re->y < (signed) frame.button_w) 1078 re->y >= 0 && re->y < (signed) frame.button_w)
1080 screen->prevFocus(); 1079 screen->prevFocus();
1081 } else if (re->window == frame.nwbutton) { 1080 } else if (re->window == frame.nwbutton) {
1082 redrawNextWindowButton(False, True); 1081 redrawNextWindowButton(false, true);
1083 1082
1084 if (re->x >= 0 && re->x < (signed) frame.button_w && 1083 if (re->x >= 0 && re->x < (signed) frame.button_w &&
1085 re->y >= 0 && re->y < (signed) frame.button_w) 1084 re->y >= 0 && re->y < (signed) frame.button_w)
@@ -1089,7 +1088,7 @@ void Toolbar::buttonReleaseEvent(XButtonEvent *re) {
1089#ifndef HAVE_STRFTIME 1088#ifndef HAVE_STRFTIME
1090 else if (re->window == frame.clock) { 1089 else if (re->window == frame.clock) {
1091 XClearWindow(display, frame.clock); 1090 XClearWindow(display, frame.clock);
1092 checkClock(True); 1091 checkClock(true);
1093 } 1092 }
1094#endif // HAVE_STRFTIME 1093#endif // HAVE_STRFTIME
1095 } else if (re->button == 4) //mousewheel scroll up 1094 } else if (re->button == 4) //mousewheel scroll up
@@ -1123,7 +1122,8 @@ void Toolbar::leaveNotifyEvent(XCrossingEvent *) {
1123 1122
1124 1123
1125void Toolbar::exposeEvent(XExposeEvent *ee) { 1124void Toolbar::exposeEvent(XExposeEvent *ee) {
1126 if (ee->window == frame.clock) checkClock(True); 1125 if (ee->window == frame.clock)
1126 checkClock(true);
1127 else if (ee->window == frame.workspace_label && (! editing)) 1127 else if (ee->window == frame.workspace_label && (! editing))
1128 redrawWorkspaceLabel(); 1128 redrawWorkspaceLabel();
1129 else if (ee->window == frame.window_label) redrawWindowLabel(); 1129 else if (ee->window == frame.window_label) redrawWindowLabel();
@@ -1148,10 +1148,10 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
1148 1148
1149 editing = false; 1149 editing = false;
1150 1150
1151 fluxbox->setNoFocus(False); 1151 fluxbox->setNoFocus(false);
1152 if (fluxbox->getFocusedWindow()) { 1152 if (fluxbox->getFocusedWindow()) {
1153 fluxbox->getFocusedWindow()->setInputFocus(); 1153 fluxbox->getFocusedWindow()->setInputFocus();
1154 fluxbox->getFocusedWindow()->setFocusFlag(True); 1154 fluxbox->getFocusedWindow()->setFocusFlag(true);
1155 } else 1155 } else
1156 XSetInputFocus(display, PointerRoot, None, CurrentTime); 1156 XSetInputFocus(display, PointerRoot, None, CurrentTime);
1157 1157
@@ -1225,8 +1225,8 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
1225} 1225}
1226 1226
1227 1227
1228void Toolbar::timeout(void) { 1228void Toolbar::timeout() {
1229 checkClock(True); 1229 checkClock(true);
1230 1230
1231 timeval now; 1231 timeval now;
1232 gettimeofday(&now, 0); 1232 gettimeofday(&now, 0);
@@ -1234,7 +1234,7 @@ void Toolbar::timeout(void) {
1234} 1234}
1235 1235
1236 1236
1237void Toolbar::HideHandler::timeout(void) { 1237void Toolbar::HideHandler::timeout() {
1238 toolbar->hidden = ! toolbar->hidden; 1238 toolbar->hidden = ! toolbar->hidden;
1239 if (toolbar->hidden) 1239 if (toolbar->hidden)
1240 XMoveWindow(toolbar->display, toolbar->frame.window, 1240 XMoveWindow(toolbar->display, toolbar->frame.window,
@@ -1294,7 +1294,7 @@ Toolbarmenu::Toolbarmenu(Toolbar *tb) : Basemenu(tb->screen) {
1294} 1294}
1295 1295
1296 1296
1297Toolbarmenu::~Toolbarmenu(void) { 1297Toolbarmenu::~Toolbarmenu() {
1298 delete placementmenu; 1298 delete placementmenu;
1299#ifdef XINERAMA 1299#ifdef XINERAMA
1300 if (toolbar->screen->hasXinerama()) { 1300 if (toolbar->screen->hasXinerama()) {
@@ -1347,14 +1347,14 @@ void Toolbarmenu::itemSelected(int button, unsigned int index) {
1347} 1347}
1348 1348
1349 1349
1350void Toolbarmenu::internal_hide(void) { 1350void Toolbarmenu::internal_hide() {
1351 Basemenu::internal_hide(); 1351 Basemenu::internal_hide();
1352 if (toolbar->doAutoHide() && ! toolbar->isEditing()) 1352 if (toolbar->doAutoHide() && ! toolbar->isEditing())
1353 toolbar->hide_handler.timeout(); 1353 toolbar->hide_handler.timeout();
1354} 1354}
1355 1355
1356 1356
1357void Toolbarmenu::reconfigure(void) { 1357void Toolbarmenu::reconfigure() {
1358 placementmenu->reconfigure(); 1358 placementmenu->reconfigure();
1359#ifdef XINERAMA 1359#ifdef XINERAMA
1360 if (toolbar->screen->hasXinerama()) { 1360 if (toolbar->screen->hasXinerama()) {