fixed autohide bug on toolbar buttons

This commit is contained in:
fluxgen 2003-05-17 11:30:59 +00:00
parent 1d49072a76
commit 0e1eb74841
3 changed files with 35 additions and 12 deletions

View file

@ -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
*/

View file

@ -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

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.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<BScreen> ScreenCmd;
FbTk::RefCount<FbTk::Command> 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();
}