fixed autohide bug on toolbar buttons
fluxgen fluxgen
3 files changed,
35 insertions(+),
12 deletions(-)
M
src/ArrowButton.cc
→
src/ArrowButton.cc
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ FbTk::FbWindow &parent,
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 @@ int screen_num,
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() {@@ -58,6 +65,16 @@
void ArrowButton::buttonReleaseEvent(XButtonEvent &event) { FbTk::Button::buttonReleaseEvent(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); } /**
M
src/ArrowButton.hh
→
src/ArrowButton.hh
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ void clear();
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
M
src/Toolbar.cc
→
src/Toolbar.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ evm.add(evh, workspace_label);
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 @@ delay.tv_usec = 0;
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);@@ -299,9 +305,6 @@ frame.base = frame.label = frame.wlabel = frame.clk = frame.button =
frame.pbutton = None; 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<BScreen> ScreenCmd;@@ -318,9 +321,8 @@ frame.nsbutton.setOnClick(nextworkspace);
frame.pwbutton.setOnClick(prevwindow); frame.nwbutton.setOnClick(nextwindow); - - reconfigure(); - + frame.window.showSubwindows(); + frame.window.show(); }