From: Dana Jansens Date: Wed, 5 Feb 2003 05:48:01 +0000 (+0000) Subject: various fixes to the otk widgets X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=a612136ba51c87014e4fba0167aad77bbfdaa753;p=chaz%2Fopenbox various fixes to the otk widgets --- diff --git a/otk/Makefile.am b/otk/Makefile.am index e1fb64de..992d7344 100644 --- a/otk/Makefile.am +++ b/otk/Makefile.am @@ -27,7 +27,8 @@ includeotk_HEADERS=application.hh appwidget.hh assassin.hh button.hh \ point.hh property.hh pseudorendercontrol.hh rect.hh \ rendercolor.hh rendercontrol.hh renderstyle.hh \ rendertexture.hh screeninfo.hh strut.hh surface.hh \ - timer.hh truerendercontrol.hh ustring.hh util.hh widget.hh + timer.hh truerendercontrol.hh ustring.hh util.hh widget.hh \ + ../config.h libotk_la_LDFLAGS = $(XFT_LIBS) $(PYTHON_LIBS) @LIBS@ MAINTAINERCLEANFILES= Makefile.in diff --git a/otk/appwidget.cc b/otk/appwidget.cc index c62a0d92..afb86c0b 100644 --- a/otk/appwidget.cc +++ b/otk/appwidget.cc @@ -26,12 +26,21 @@ AppWidget::AppWidget(Application *app, Direction direction, protocols[0] = Property::atoms.wm_protocols; protocols[1] = Property::atoms.wm_delete_window; XSetWMProtocols(**display, window(), protocols, 2); + + setStyle(_style); } AppWidget::~AppWidget() { } +void AppWidget::setStyle(RenderStyle *style) +{ + Widget::setStyle(style); + + setTexture(style->titlebarUnfocusBackground()); +} + void AppWidget::show(void) { Widget::show(true); diff --git a/otk/appwidget.hh b/otk/appwidget.hh index 69cca589..b305dbae 100644 --- a/otk/appwidget.hh +++ b/otk/appwidget.hh @@ -15,6 +15,8 @@ public: Cursor cursor = 0, int bevel_width = 1); virtual ~AppWidget(); + virtual void setStyle(RenderStyle *style); + virtual void show(void); virtual void hide(void); diff --git a/otk/button.cc b/otk/button.cc index 08dc0484..c70511fc 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -35,10 +35,10 @@ void Button::press(unsigned int mouse_button) { if (_pressed) return; - if (_pressed_focus_tx) - FocusWidget::setTexture(_pressed_focus_tx); if (_pressed_unfocus_tx) FocusWidget::setUnfocusTexture(_pressed_unfocus_tx); + if (_pressed_focus_tx) + FocusWidget::setTexture(_pressed_focus_tx); _pressed = true; _mouse_button = mouse_button; } @@ -47,8 +47,8 @@ void Button::release(unsigned int mouse_button) { if (_mouse_button != mouse_button) return; // wrong button - FocusWidget::setTexture(_unpr_focus_tx); FocusWidget::setUnfocusTexture(_unpr_unfocus_tx); + FocusWidget::setTexture(_unpr_focus_tx); _pressed = false; } diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc index 8ac328e7..bd74aa94 100644 --- a/otk/focuslabel.cc +++ b/otk/focuslabel.cc @@ -58,7 +58,7 @@ void FocusLabel::update() internalResize(w, h); else internalResize(w, _rect.height()); - } else + } else if (h > _rect.height()) internalResize(_rect.width(), h); } FocusWidget::update(); diff --git a/otk/focuswidget.cc b/otk/focuswidget.cc index e3973dc2..b8e18d78 100644 --- a/otk/focuswidget.cc +++ b/otk/focuswidget.cc @@ -53,6 +53,8 @@ void FocusWidget::setTexture(RenderTexture *texture) { Widget::setTexture(texture); _focus_texture = texture; + if (!_focused) + Widget::setTexture(_unfocus_texture); } void FocusWidget::setBorderColor(const RenderColor *color) diff --git a/otk/label.cc b/otk/label.cc index 8352fb7a..f0a4b665 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -54,7 +54,7 @@ void Label::update() internalResize(w, h); else internalResize(w, _rect.height()); - } else + } else if (h > _rect.height()) internalResize(_rect.width(), h); } Widget::update();