diff options
author | fluxgen <fluxgen> | 2003-08-15 13:51:43 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-15 13:51:43 (GMT) |
commit | 859fafeecf6ca526d166a8bfb72f5a599ebb2d4b (patch) | |
tree | d5c1833b1584aecdce3cdb49d1499fb5089c1a55 /src/Toolbar.cc | |
parent | 4eb59bdb8d8897b286f33bc92bd56ad9835b5a7b (diff) | |
download | fluxbox-859fafeecf6ca526d166a8bfb72f5a599ebb2d4b.zip fluxbox-859fafeecf6ca526d166a8bfb72f5a599ebb2d4b.tar.bz2 |
added SystemTray and fixed ConfigureNotify so we can rearrange the items
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r-- | src/Toolbar.cc | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index a01cc7a..5e5a74d 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.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: Toolbar.cc,v 1.108 2003/08/13 15:28:24 fluxgen Exp $ | 25 | // $Id: Toolbar.cc,v 1.109 2003/08/15 13:51:43 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -36,6 +36,7 @@ | |||
36 | #include "IconbarTool.hh" | 36 | #include "IconbarTool.hh" |
37 | #include "WorkspaceNameTool.hh" | 37 | #include "WorkspaceNameTool.hh" |
38 | #include "ClockTool.hh" | 38 | #include "ClockTool.hh" |
39 | #include "SystemTray.hh" | ||
39 | 40 | ||
40 | #include "I18n.hh" | 41 | #include "I18n.hh" |
41 | #include "fluxbox.hh" | 42 | #include "fluxbox.hh" |
@@ -189,7 +190,8 @@ Toolbar::Frame::Frame(FbTk::EventHandler &evh, int screen_num): | |||
189 | 10, 10, // size | 190 | 10, 10, // size |
190 | // event mask | 191 | // event mask |
191 | ButtonPressMask | ButtonReleaseMask | | 192 | ButtonPressMask | ButtonReleaseMask | |
192 | EnterWindowMask | LeaveWindowMask, | 193 | EnterWindowMask | LeaveWindowMask | SubstructureNotifyMask, |
194 | |||
193 | true) // override redirect | 195 | true) // override redirect |
194 | { | 196 | { |
195 | 197 | ||
@@ -235,10 +237,12 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi | |||
235 | scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"), | 237 | scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"), |
236 | m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER, | 238 | m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER, |
237 | scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"), | 239 | scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"), |
240 | m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"), | ||
238 | m_shape(new Shape(frame.window, 0)), | 241 | m_shape(new Shape(frame.window, 0)), |
239 | m_clock_theme(scrn.screenNumber(), "toolbar.clock", "Toolbar.Clock"), | 242 | m_clock_theme(scrn.screenNumber(), "toolbar.clock", "Toolbar.Clock"), |
240 | m_workspace_theme(scrn.screenNumber(), "toolbar.workspace", "Toolbar.Workspace"), | 243 | m_workspace_theme(scrn.screenNumber(), "toolbar.workspace", "Toolbar.Workspace"), |
241 | m_iconbar_theme(scrn.screenNumber(), "toolbar.iconbar", "Toolbar.Iconbar") { | 244 | m_iconbar_theme(scrn.screenNumber(), "toolbar.iconbar", "Toolbar.Iconbar"), |
245 | m_resize_lock(false) { | ||
242 | 246 | ||
243 | // we need to get notified when the theme is reloaded | 247 | // we need to get notified when the theme is reloaded |
244 | m_theme.reconfigSig().attach(this); | 248 | m_theme.reconfigSig().attach(this); |
@@ -264,6 +268,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi | |||
264 | // add toolbar items | 268 | // add toolbar items |
265 | m_item_list.push_back(new WorkspaceNameTool(frame.window, m_workspace_theme, screen())); | 269 | m_item_list.push_back(new WorkspaceNameTool(frame.window, m_workspace_theme, screen())); |
266 | m_item_list.push_back(new IconbarTool(frame.window, m_iconbar_theme, screen())); | 270 | m_item_list.push_back(new IconbarTool(frame.window, m_iconbar_theme, screen())); |
271 | m_item_list.push_back(new SystemTray(frame.window)); | ||
267 | m_item_list.push_back(new ClockTool(frame.window, m_clock_theme, screen())); | 272 | m_item_list.push_back(new ClockTool(frame.window, m_clock_theme, screen())); |
268 | 273 | ||
269 | m_clock_theme.setAntialias(screen().antialias()); | 274 | m_clock_theme.setAntialias(screen().antialias()); |
@@ -305,6 +310,7 @@ void Toolbar::clearStrut() { | |||
305 | } | 310 | } |
306 | 311 | ||
307 | void Toolbar::updateStrut() { | 312 | void Toolbar::updateStrut() { |
313 | |||
308 | bool had_strut = m_strut ? true : false; | 314 | bool had_strut = m_strut ? true : false; |
309 | clearStrut(); | 315 | clearStrut(); |
310 | // we should request space if we're in autohide mode or | 316 | // we should request space if we're in autohide mode or |
@@ -362,7 +368,6 @@ void Toolbar::lower() { | |||
362 | } | 368 | } |
363 | 369 | ||
364 | void Toolbar::reconfigure() { | 370 | void Toolbar::reconfigure() { |
365 | |||
366 | m_clock_theme.setAntialias(screen().antialias()); | 371 | m_clock_theme.setAntialias(screen().antialias()); |
367 | m_iconbar_theme.setAntialias(screen().antialias()); | 372 | m_iconbar_theme.setAntialias(screen().antialias()); |
368 | m_workspace_theme.setAntialias(screen().antialias()); | 373 | m_workspace_theme.setAntialias(screen().antialias()); |
@@ -484,6 +489,12 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) { | |||
484 | 489 | ||
485 | } | 490 | } |
486 | 491 | ||
492 | void Toolbar::handleEvent(XEvent &event) { | ||
493 | if (event.type == ConfigureNotify && | ||
494 | event.xconfigure.window != window().window()) { | ||
495 | rearrangeItems(); | ||
496 | } | ||
497 | } | ||
487 | 498 | ||
488 | void Toolbar::update(FbTk::Subject *subj) { | 499 | void Toolbar::update(FbTk::Subject *subj) { |
489 | 500 | ||
@@ -499,7 +510,6 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
499 | head_w = screen().width(), | 510 | head_w = screen().width(), |
500 | head_h = screen().height(); | 511 | head_h = screen().height(); |
501 | 512 | ||
502 | #ifdef XINERAMA | ||
503 | if (screen().hasXinerama()) { | 513 | if (screen().hasXinerama()) { |
504 | int head = *m_rc_on_head; | 514 | int head = *m_rc_on_head; |
505 | head_x = screen().getHeadX(head); | 515 | head_x = screen().getHeadX(head); |
@@ -507,7 +517,6 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
507 | head_w = screen().getHeadWidth(head); | 517 | head_w = screen().getHeadWidth(head); |
508 | head_h = screen().getHeadHeight(head); | 518 | head_h = screen().getHeadHeight(head); |
509 | } | 519 | } |
510 | #endif // XINERAMA | ||
511 | 520 | ||
512 | frame.width = head_w * (*m_rc_width_percent) / 100; | 521 | frame.width = head_w * (*m_rc_width_percent) / 100; |
513 | //!! TODO: change this | 522 | //!! TODO: change this |
@@ -525,6 +534,9 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
525 | if (max_height < m_iconbar_theme.unfocusedText().font().height()) | 534 | if (max_height < m_iconbar_theme.unfocusedText().font().height()) |
526 | max_height = m_iconbar_theme.unfocusedText().font().height(); | 535 | max_height = m_iconbar_theme.unfocusedText().font().height(); |
527 | 536 | ||
537 | if (*m_rc_height != 0) | ||
538 | max_height = *m_rc_height; | ||
539 | |||
528 | frame.height = max_height; | 540 | frame.height = max_height; |
529 | 541 | ||
530 | frame.height += 2; | 542 | frame.height += 2; |
@@ -736,9 +748,11 @@ void Toolbar::setupMenus() { | |||
736 | Toolbar::Placement placement; | 748 | Toolbar::Placement placement; |
737 | } place_menu[] = { | 749 | } place_menu[] = { |
738 | {0, 0, "Top Left", Toolbar::TOPLEFT}, | 750 | {0, 0, "Top Left", Toolbar::TOPLEFT}, |
751 | /* | ||
739 | {0, 0, "Left Top", Toolbar::LEFTTOP}, | 752 | {0, 0, "Left Top", Toolbar::LEFTTOP}, |
740 | {0, 0, "Left Center", Toolbar::LEFTCENTER}, | 753 | {0, 0, "Left Center", Toolbar::LEFTCENTER}, |
741 | {0, 0, "Left Bottom", Toolbar::LEFTBOTTOM}, | 754 | {0, 0, "Left Bottom", Toolbar::LEFTBOTTOM}, |
755 | */ | ||
742 | {0, 0, "Bottom Left", Toolbar::BOTTOMLEFT}, | 756 | {0, 0, "Bottom Left", Toolbar::BOTTOMLEFT}, |
743 | {0, 0, "Top Center", Toolbar::TOPCENTER}, | 757 | {0, 0, "Top Center", Toolbar::TOPCENTER}, |
744 | {0, 0, 0, Toolbar::TOPCENTER}, | 758 | {0, 0, 0, Toolbar::TOPCENTER}, |
@@ -746,9 +760,11 @@ void Toolbar::setupMenus() { | |||
746 | {0, 0, 0, Toolbar::BOTTOMCENTER}, | 760 | {0, 0, 0, Toolbar::BOTTOMCENTER}, |
747 | {0, 0, "Bottom Center", Toolbar::BOTTOMCENTER}, | 761 | {0, 0, "Bottom Center", Toolbar::BOTTOMCENTER}, |
748 | {0, 0, "Top Right", Toolbar::TOPRIGHT}, | 762 | {0, 0, "Top Right", Toolbar::TOPRIGHT}, |
763 | /* | ||
749 | {0, 0, "Right Top", Toolbar::RIGHTTOP}, | 764 | {0, 0, "Right Top", Toolbar::RIGHTTOP}, |
750 | {0, 0, "Right Center", Toolbar::RIGHTCENTER}, | 765 | {0, 0, "Right Center", Toolbar::RIGHTCENTER}, |
751 | {0, 0, "Right Bottom", Toolbar::RIGHTBOTTOM}, | 766 | {0, 0, "Right Bottom", Toolbar::RIGHTBOTTOM}, |
767 | */ | ||
752 | {0, 0, "Bottom Right", Toolbar::BOTTOMRIGHT} | 768 | {0, 0, "Bottom Right", Toolbar::BOTTOMRIGHT} |
753 | }; | 769 | }; |
754 | tbar.placementMenu().setMinimumSublevels(3); | 770 | tbar.placementMenu().setMinimumSublevels(3); |
@@ -776,7 +792,10 @@ void Toolbar::saveOnHead(int head) { | |||
776 | } | 792 | } |
777 | 793 | ||
778 | void Toolbar::rearrangeItems() { | 794 | void Toolbar::rearrangeItems() { |
779 | 795 | if (m_resize_lock || screen().isShuttingdown()) | |
796 | return; | ||
797 | // lock this | ||
798 | m_resize_lock = true; | ||
780 | // calculate size for fixed items | 799 | // calculate size for fixed items |
781 | ItemList::iterator item_it = m_item_list.begin(); | 800 | ItemList::iterator item_it = m_item_list.begin(); |
782 | ItemList::iterator item_it_end = m_item_list.end(); | 801 | ItemList::iterator item_it_end = m_item_list.end(); |
@@ -811,5 +830,6 @@ void Toolbar::rearrangeItems() { | |||
811 | } | 830 | } |
812 | next_x += (*item_it)->width() + (*item_it)->borderWidth()*2; | 831 | next_x += (*item_it)->width() + (*item_it)->borderWidth()*2; |
813 | } | 832 | } |
814 | 833 | // unlock | |
834 | m_resize_lock = false; | ||
815 | } | 835 | } |