From 0e1eb7484118cfec7d065022d1391651ca70d7be Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 17 May 2003 11:30:59 +0000 Subject: fixed autohide bug on toolbar buttons --- src/ArrowButton.cc | 23 ++++++++++++++++++++--- src/ArrowButton.hh | 8 ++++++-- src/Toolbar.cc | 16 +++++++++------- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/ArrowButton.cc b/src/ArrowButton.cc index bc44393..1d3d9fe 100644 --- a/src/ArrowButton.cc +++ b/src/ArrowButton.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ArrowButton.cc,v 1.2 2003/04/27 01:54:18 fluxgen Exp $ +// $Id: ArrowButton.cc,v 1.3 2003/05/17 11:30:59 fluxgen Exp $ #include "ArrowButton.hh" @@ -28,7 +28,11 @@ ArrowButton::ArrowButton(ArrowButton::Type arrow_type, int x, int y, unsigned int width, unsigned int height): FbTk::Button(parent, x, y, width, height), - m_arrow_type(arrow_type) { + m_arrow_type(arrow_type), + m_mouse_handler(0) { + + window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask); } ArrowButton::ArrowButton(ArrowButton::Type arrow_type, @@ -36,8 +40,11 @@ ArrowButton::ArrowButton(ArrowButton::Type arrow_type, int x, int y, unsigned int width, unsigned int height): FbTk::Button(screen_num, x, y, width, height), - m_arrow_type(arrow_type) { + m_arrow_type(arrow_type), + m_mouse_handler(0) { + window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask); } void ArrowButton::clear() { @@ -60,6 +67,16 @@ void ArrowButton::buttonReleaseEvent(XButtonEvent &event) { drawArrow(); } +void ArrowButton::enterNotifyEvent(XCrossingEvent &ce) { + if (m_mouse_handler) + m_mouse_handler->enterNotifyEvent(ce); +} + +void ArrowButton::leaveNotifyEvent(XCrossingEvent &ce) { + if (m_mouse_handler) + m_mouse_handler->leaveNotifyEvent(ce); +} + /** redraws the arrow button */ diff --git a/src/ArrowButton.hh b/src/ArrowButton.hh index bcad0f2..d166935 100644 --- a/src/ArrowButton.hh +++ b/src/ArrowButton.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ArrowButton.hh,v 1.2 2003/04/27 01:54:18 fluxgen Exp $ +// $Id: ArrowButton.hh,v 1.3 2003/05/17 11:30:59 fluxgen Exp $ #ifndef ARROWBUTTON_HH #define ARROWBUTTON_HH @@ -41,10 +41,14 @@ public: void buttonReleaseEvent(XButtonEvent &event); void buttonPressEvent(XButtonEvent &event); void exposeEvent(XExposeEvent &event); + void enterNotifyEvent(XCrossingEvent &ce); + void leaveNotifyEvent(XCrossingEvent &ce); + void setMouseMotionHandler(FbTk::EventHandler *eh) { m_mouse_handler = eh; } private: void drawArrow(); - Type m_arrow_type; + Type m_arrow_type; + FbTk::EventHandler *m_mouse_handler; }; #endif // ARROWBUTTON_HH diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 52c707a..2508ec9 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -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.83 2003/05/15 23:30:03 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.84 2003/05/17 11:30:59 fluxgen Exp $ #include "Toolbar.hh" @@ -235,6 +235,10 @@ Toolbar::Frame::Frame(FbTk::EventHandler &evh, int screen_num): evm.add(evh, window_label); evm.add(evh, clock); + psbutton.setMouseMotionHandler(&evh); + nsbutton.setMouseMotionHandler(&evh); + pwbutton.setMouseMotionHandler(&evh); + nwbutton.setMouseMotionHandler(&evh); } Toolbar::Frame::~Frame() { @@ -287,6 +291,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi m_clock_timer.setTimeout(delay); m_clock_timer.start(); + m_theme.font().setAntialias(screen().antialias()); + hide_handler.toolbar = this; m_hide_timer.setTimeout(Fluxbox::instance()->getAutoRaiseDelay()); m_hide_timer.fireOnce(true); @@ -300,9 +306,6 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi m_iconbar.reset(new IconBar(screen(), frame.window_label.window(), m_theme.font())); - XMapSubwindows(display, frame.window.window()); - frame.window.show(); - // finaly: setup Commands for the buttons in the frame typedef FbTk::SimpleCommand ScreenCmd; FbTk::RefCount nextworkspace(new ScreenCmd(screen(), @@ -318,9 +321,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi frame.pwbutton.setOnClick(prevwindow); frame.nwbutton.setOnClick(nextwindow); - - reconfigure(); - + frame.window.showSubwindows(); + frame.window.show(); } -- cgit v0.11.2