minor cleaning

This commit is contained in:
fluxgen 2003-05-10 13:57:07 +00:00
parent 94deb10b01
commit 4a396013c6
2 changed files with 35 additions and 35 deletions

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Toolbar.cc,v 1.77 2003/04/28 16:48:23 rathnor Exp $
// $Id: Toolbar.cc,v 1.78 2003/05/10 13:57:07 fluxgen Exp $
#include "Toolbar.hh"
@ -246,9 +246,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi
do_auto_hide(scrn.doToolbarAutoHide()),
frame(*this, scrn.getScreenNumber()),
m_screen(scrn),
image_ctrl(*scrn.getImageControl()),
clock_timer(this), // get the clock updating every minute
hide_timer(&hide_handler),
m_clock_timer(this), // get the clock updating every minute
m_hide_timer(&hide_handler),
m_toolbarmenu(menu),
m_placementmenu(*scrn.menuTheme(),
scrn.getScreenNumber(), *scrn.getImageControl()),
@ -279,12 +278,12 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi
timeval delay;
delay.tv_sec = 1;
delay.tv_usec = 0;
clock_timer.setTimeout(delay);
clock_timer.start();
m_clock_timer.setTimeout(delay);
m_clock_timer.start();
hide_handler.toolbar = this;
hide_timer.setTimeout(Fluxbox::instance()->getAutoRaiseDelay());
hide_timer.fireOnce(true);
m_hide_timer.setTimeout(Fluxbox::instance()->getAutoRaiseDelay());
m_hide_timer.fireOnce(true);
frame.grab_x = frame.grab_y = 0;
@ -320,7 +319,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi
Toolbar::~Toolbar() {
FbTk::ImageControl &image_ctrl = *screen().getImageControl();
if (frame.base) image_ctrl.removeImage(frame.base);
if (frame.label) image_ctrl.removeImage(frame.label);
if (frame.wlabel) image_ctrl.removeImage(frame.wlabel);
@ -388,7 +387,7 @@ void Toolbar::reconfigure() {
if (do_auto_hide == false &&
do_auto_hide != screen().doToolbarAutoHide()) {
hide_timer.start();
m_hide_timer.start();
}
do_auto_hide = screen().doToolbarAutoHide();
@ -563,6 +562,8 @@ void Toolbar::reconfigure() {
frame.clock.moveResize(next_x + text_x, next_y + text_y,
clock_w, clock_h);
FbTk::ImageControl &image_ctrl = *screen().getImageControl();
Pixmap tmp = frame.base;
const FbTk::Texture *texture = &(m_theme.toolbar());
if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
@ -972,11 +973,11 @@ void Toolbar::enterNotifyEvent(XCrossingEvent &not_used) {
return;
if (hidden) {
if (! hide_timer.isTiming())
hide_timer.start();
if (! m_hide_timer.isTiming())
m_hide_timer.start();
} else {
if (hide_timer.isTiming())
hide_timer.stop();
if (m_hide_timer.isTiming())
m_hide_timer.stop();
}
}
@ -985,10 +986,10 @@ void Toolbar::leaveNotifyEvent(XCrossingEvent &not_used) {
return;
if (hidden) {
if (hide_timer.isTiming())
hide_timer.stop();
} else if (! m_toolbarmenu.isVisible() && ! hide_timer.isTiming())
hide_timer.start();
if (m_hide_timer.isTiming())
m_hide_timer.stop();
} else if (! m_toolbarmenu.isVisible() && ! m_hide_timer.isTiming())
m_hide_timer.start();
}
@ -1072,7 +1073,7 @@ void Toolbar::timeout() {
timeval delay;
delay.tv_sec = 1;
delay.tv_usec = 0;
clock_timer.setTimeout(delay);
m_clock_timer.setTimeout(delay);
}
@ -1209,12 +1210,12 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
void Toolbar::HideHandler::timeout() {
if (toolbar->isEditing()) { // don't hide if we're editing workspace label
toolbar->hide_timer.fireOnce(false);
toolbar->hide_timer.start(); // restart timer and try next timeout
toolbar->m_hide_timer.fireOnce(false);
toolbar->m_hide_timer.start(); // restart timer and try next timeout
return;
}
toolbar->hide_timer.fireOnce(true);
toolbar->m_hide_timer.fireOnce(true);
toolbar->hidden = ! toolbar->hidden;
if (toolbar->hidden) {

View file

@ -1,5 +1,5 @@
// Toolbar.hh for Fluxbox
// Copyright (c) 2002 Henrik Kinnunen (fluxgen at users.sourceforge.net)
// Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
//
// Toolbar.hh for Blackbox - an X11 Window manager
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Toolbar.hh,v 1.29 2003/04/25 11:39:31 fluxgen Exp $
// $Id: Toolbar.hh,v 1.30 2003/05/10 13:55:57 fluxgen Exp $
#ifndef TOOLBAR_HH
#define TOOLBAR_HH
@ -47,13 +47,11 @@ class ImageControl;
};
/// The toolbar.
/**
Handles iconbar, workspace name view and clock view
*/
/// Handles iconbar, workspace name view and clock view
class Toolbar : public FbTk::TimeoutHandler, public FbTk::EventHandler {
public:
///Toolbar placement on the screen
/// Toolbar placement on the screen
enum Placement{
// top and bottom placement
TOPLEFT = 1, BOTTOMLEFT, TOPCENTER,
@ -63,9 +61,9 @@ public:
RIGHTCENTER, RIGHTBOTTOM, RIGHTTOP
};
/// create a toolbar on the screen with specific width
explicit Toolbar(BScreen &screen, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width = 200);
/// destructor
/// Create a toolbar on the screen with specific width
Toolbar(BScreen &screen, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width = 200);
virtual ~Toolbar();
/// add icon to iconbar
@ -161,12 +159,13 @@ private:
virtual void timeout();
} hide_handler;
friend class HideHandler;
BScreen &m_screen;
FbTk::ImageControl &image_ctrl;
FbTk::Timer clock_timer; ///< timer to update clock
FbTk::Timer hide_timer; ///< timer to for auto hide toolbar
BScreen &m_screen; ///< screen connection
FbTk::Timer m_clock_timer; ///< timer to update clock
FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar
FbTk::Menu &m_toolbarmenu;
FbTk::Menu m_placementmenu;
LayerMenu<Toolbar> m_layermenu;