X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fbutton.cc;h=313d8acfcf52751e0b56162444763cba6a84ec4b;hb=8269fc2b3965d12ba308caa554bfa7ee037fba13;hp=1e128784f91aa4811a2efb3b3956cbce03c58e87;hpb=f51f1c775f3f09cf184ead323d111985c888d52e;p=chaz%2Fopenbox diff --git a/otk/button.cc b/otk/button.cc index 1e128784..313d8acf 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "button.hh" @@ -12,7 +10,6 @@ Button::Button(Widget *parent) : Label(parent), _pressed(false) { - setHighlighted(false); setHorizontalJustify(RenderStyle::CenterJustify); setVerticalJustify(RenderStyle::CenterJustify); styleChanged(*RenderStyle::style(screen())); @@ -52,7 +49,11 @@ void Button::buttonPressHandler(const XButtonEvent &e) void Button::buttonReleaseHandler(const XButtonEvent &e) { Widget::buttonReleaseHandler(e); + bool p = _pressed; release(e.button); + if (p && !_pressed && e.x > 0 && e.y > 0 && + e.x < area().width() && e.y < area().height()) + clickHandler(_mouse_button); } void Button::styleChanged(const RenderStyle &style) @@ -70,7 +71,7 @@ void Button::styleChanged(const RenderStyle &style) _texture = style.buttonUnpressUnfocusBackground(); _forecolor = style.buttonUnfocusColor(); } - Widget::styleChanged(style); + refresh(); } }