all repos — fluxbox @ 97ef84da598aed61a6cb57a62796f302043181e8

custom fork of the fluxbox windowmanager

a few random fixes
rathnor rathnor
commit

97ef84da598aed61a6cb57a62796f302043181e8

parent

8a59b9b4541490badaf3e1a0503b4ca5f0105c8f

M ChangeLogChangeLog

@@ -1,5 +1,10 @@

(Format: Year/Month/Day) Changes for 0.9.10: +*04/08/29: + * More random render fixes (Simon) + (font alignment in menu, menu optimisation, toolbar font/render) + FbTk/Menu.cc FbTk/MenuItem.cc FbTk/XftFontImp.cc + TextTheme.cc Toolbar.cc ToolbarItem.hh <ToolbarTools>.hh/cc *04/08/28: * Some more menu rendering fixes (Simon) Thanks Florian Pigorsch for nice bug reports + debugging
M src/ButtonTool.ccsrc/ButtonTool.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: ButtonTool.cc,v 1.4 2004/08/26 15:09:33 rathnor Exp $ +// $Id: ButtonTool.cc,v 1.5 2004/08/29 08:33:12 rathnor Exp $ #include "ButtonTool.hh"

@@ -46,6 +46,11 @@

if (m_cache_pressed_pm) m_image_ctrl.removeImage(m_cache_pressed_pm); +} + +void ButtonTool::updateSizing() { + FbTk::Button &btn = static_cast<FbTk::Button &>(window()); + btn.setBorderWidth(theme().border().width()); } void ButtonTool::renderTheme() {
M src/ButtonTool.hhsrc/ButtonTool.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: ButtonTool.hh,v 1.1 2003/10/13 23:38:17 fluxgen Exp $ +// $Id: ButtonTool.hh,v 1.2 2004/08/29 08:33:12 rathnor Exp $ #ifndef BUTTONTOOL_HH #define BUTTONTOOL_HH

@@ -42,6 +42,7 @@ virtual ~ButtonTool();

protected: void renderTheme(); + void updateSizing(); Pixmap m_cache_pm, m_cache_pressed_pm; FbTk::ImageControl &m_image_ctrl; };
M src/ClockTool.ccsrc/ClockTool.cc

@@ -20,7 +20,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: ClockTool.cc,v 1.12 2004/08/25 17:16:40 rathnor Exp $ +// $Id: ClockTool.cc,v 1.13 2004/08/29 08:33:12 rathnor Exp $ #include "ClockTool.hh"

@@ -244,6 +244,11 @@ #endif // HAVE_STRFTIME

} m_button.clear(); +} + +// Just change things that affect the size +void ClockTool::updateSizing() { + m_button.setBorderWidth(m_theme.border().width()); } void ClockTool::renderTheme() {
M src/ClockTool.hhsrc/ClockTool.hh

@@ -20,7 +20,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: ClockTool.hh,v 1.4 2003/12/04 23:02:23 fluxgen Exp $ +// $Id: ClockTool.hh,v 1.5 2004/08/29 08:33:12 rathnor Exp $ #ifndef CLOCKTOOL_HH #define CLOCKTOOL_HH

@@ -66,6 +66,7 @@ private:

void updateTime(); void update(FbTk::Subject *subj); void renderTheme(); + void updateSizing(); FbTk::TextButton m_button;
M src/FbTk/Menu.ccsrc/FbTk/Menu.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: Menu.cc,v 1.74 2004/08/28 19:03:09 rathnor Exp $ +// $Id: Menu.cc,v 1.75 2004/08/29 08:33:13 rathnor Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -777,12 +777,14 @@ 0, 0,

0, 0, m_title_pm.width(), m_title_pm.height()); + // difference between height based on font, and style-set height + int height_offset = theme().titleHeight() - (font.height() + 2*theme().bevelWidth()); menu.title.updateTransparent(); font.drawText(m_real_title_pm.drawable(), // drawable screenNumber(), theme().titleTextGC().gc(), // graphic context - text, len, // text string with lenght - dx, theme().titleHeight()/2 + (font.ascent() - theme().bevelWidth())/2); // position + text, len, // text string with length + dx, font.ascent() + theme().bevelWidth() + height_offset/2); // position }

@@ -1196,6 +1198,9 @@ stopHide();

int sbl = (me.x / menu.item_w), i = (me.y / theme().itemHeight()), w = (sbl * menu.persub) + i; + + if (w == m_active_index) + return; if (validIndex(m_active_index) && w != m_active_index) {
M src/FbTk/MenuItem.ccsrc/FbTk/MenuItem.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: MenuItem.cc,v 1.5 2004/08/03 21:31:31 fluxgen Exp $ +// $Id: MenuItem.cc,v 1.6 2004/08/29 08:33:13 rathnor Exp $ #include "MenuItem.hh" #include "Command.hh"

@@ -91,7 +91,8 @@ int text_y = y, text_x = x;

int text_w = theme.frameFont().textWidth(label().c_str(), label().size()); - text_y = y - theme.bevelWidth()/2 + theme.frameFont().ascent()/2 + height/2; + int height_offset = theme.itemHeight() - (theme.frameFont().height() + 2*theme.bevelWidth()); + text_y = y + theme.bevelWidth() + theme.frameFont().ascent() + height_offset/2; ///2 + height/2; switch(theme.frameFontJustify()) { case FbTk::LEFT:
M src/FbTk/XftFontImp.ccsrc/FbTk/XftFontImp.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: XftFontImp.cc,v 1.3 2004/08/10 11:57:35 fluxgen Exp $ +//$Id: XftFontImp.cc,v 1.4 2004/08/29 08:33:13 rathnor Exp $ #include "XftFontImp.hh" #include "App.hh"

@@ -157,7 +157,10 @@

unsigned int XftFontImp::height() const { if (m_xftfont == 0) return 0; - return m_xftfont->height; + return m_xftfont->height; + //m_xftfont->ascent + m_xftfont->descent; + // curiously, fonts seem to have a smaller height, but the "height" + // is specified within the actual font, so it must be right, right? } }; // end namespace FbTk
M src/IconbarTool.ccsrc/IconbarTool.cc

@@ -20,7 +20,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: IconbarTool.cc,v 1.42 2004/08/25 17:16:40 rathnor Exp $ +// $Id: IconbarTool.cc,v 1.43 2004/08/29 08:33:12 rathnor Exp $ #include "IconbarTool.hh"

@@ -543,10 +543,9 @@ return;

renderButton(*button); } +void IconbarTool::updateSizing() { + m_icon_container.setBorderWidth(m_theme.border().width()); -void IconbarTool::renderTheme() { - - // update button sizes before we get max width per client! IconList::iterator icon_it = m_icon_list.begin(); const IconList::iterator icon_it_end = m_icon_list.end(); for (; icon_it != icon_it_end; ++icon_it) {

@@ -555,6 +554,13 @@ (*icon_it)->setBorderWidth(m_theme.focusedBorder().width());

else // unfocused (*icon_it)->setBorderWidth(m_theme.unfocusedBorder().width()); } + +} + +void IconbarTool::renderTheme() { + + // update button sizes before we get max width per client! + updateSizing(); Pixmap tmp = m_focused_pm; Pixmap err_tmp = m_focused_err_pm;

@@ -616,7 +622,8 @@ m_icon_container.setBorderColor(m_theme.border().color());

m_icon_container.setAlpha(m_theme.alpha()); // update buttons - icon_it = m_icon_list.begin(); + IconList::iterator icon_it = m_icon_list.begin(); + const IconList::iterator icon_it_end = m_icon_list.end(); for (; icon_it != icon_it_end; ++icon_it) { renderButton(*(*icon_it)); }
M src/IconbarTool.hhsrc/IconbarTool.hh

@@ -20,7 +20,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: IconbarTool.hh,v 1.14 2004/06/16 15:38:19 rathnor Exp $ +// $Id: IconbarTool.hh,v 1.15 2004/08/29 08:33:12 rathnor Exp $ #ifndef ICONBARTOOL_HH #define ICONBARTOOL_HH

@@ -78,6 +78,8 @@ Container::Alignment alignment() const { return m_icon_container.alignment(); }

private: /// @return button associated with window IconButton *findButton(FluxboxWindow &win); + + void updateSizing(); /// render single button that holds win void renderWindow(FluxboxWindow &win);
M src/SystemTray.hhsrc/SystemTray.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: SystemTray.hh,v 1.5 2004/08/25 17:16:40 rathnor Exp $ +// $Id: SystemTray.hh,v 1.6 2004/08/29 08:33:12 rathnor Exp $ #ifndef SYSTEMTRAY_HH #define SYSTEMTRAY_HH

@@ -66,6 +66,7 @@ int numClients() const { return m_clients.size(); }

const FbTk::FbWindow &window() const { return m_window; } inline void renderTheme() {} + inline void updateSizing() {} private: typedef std::list<FbTk::FbWindow *> ClientList;
M src/TextTheme.ccsrc/TextTheme.cc

@@ -20,7 +20,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: TextTheme.cc,v 1.6 2003/08/27 18:05:12 fluxgen Exp $ +// $Id: TextTheme.cc,v 1.7 2004/08/29 08:33:12 rathnor Exp $ #include "TextTheme.hh"

@@ -28,7 +28,7 @@ #include "FbTk/App.hh"

#include <X11/Xlib.h> -TextTheme::TextTheme(FbTk::Theme &theme, +TextTheme::TextTheme(FbTk::Theme &theme, const std::string &name, const std::string &altname): m_font(theme, name + ".font", altname + ".Font"), m_text_color(theme, name + ".textColor", altname + ".TextColor"),

@@ -49,6 +49,7 @@

void TextTheme::update() { m_text_gc.setForeground(*m_text_color); } + void TextTheme::setAntialias(bool value) { font().setAntialias(value);
M src/Toolbar.ccsrc/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.148 2004/08/25 17:16:40 rathnor Exp $ +// $Id: Toolbar.cc,v 1.149 2004/08/29 08:33:12 rathnor Exp $ #include "Toolbar.hh"

@@ -227,6 +227,7 @@ // we need to get notified when the theme is reloaded

m_theme.reconfigSig().attach(this); // listen to screen size changes screen().resizeSig().attach(this); + screen().reconfigureSig().attach(this); // get this on antialias change moveToLayer((*m_rc_layernum).getNum());

@@ -453,12 +454,16 @@ m_shape->update();

ItemList::iterator item_it = m_item_list.begin(); ItemList::iterator item_it_end = m_item_list.end(); + for (; item_it != item_it_end; ++item_it) { + (*item_it)->updateSizing(); + } + + rearrangeItems(); + for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) { (*item_it)->renderTheme(); } - rearrangeItems(); - menu().reconfigure(); // we're done with all resizing and stuff now we can request a new // area to be reserved on screen

@@ -568,11 +573,11 @@

// either screen reconfigured, theme was reloaded // or a tool resized itself - if (typeid(*subj) == typeid(ToolbarItem::ToolbarItemSubject)) { + if (typeid(*subj) == typeid(ToolbarItem::ToolbarItemSubject)) rearrangeItems(); - } else { + else reconfigure(); - } + } void Toolbar::setPlacement(Toolbar::Placement where) {
M src/ToolbarItem.hhsrc/ToolbarItem.hh

@@ -20,7 +20,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: ToolbarItem.hh,v 1.5 2004/08/25 17:16:40 rathnor Exp $ +// $Id: ToolbarItem.hh,v 1.6 2004/08/29 08:33:13 rathnor Exp $ #ifndef TOOLBARITEM_HH #define TOOLBARITEM_HH

@@ -56,6 +56,9 @@

// Tools should NOT listen to theme changes - they'll get notified by // the toolbar instead. Otherwise there are ordering problems. virtual void renderTheme() = 0; + + // just update theme items that affect the size + virtual void updateSizing() = 0; FbTk::Subject &resizeSig() { return m_resize_sig; }
M src/WorkspaceNameTool.ccsrc/WorkspaceNameTool.cc

@@ -20,7 +20,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: WorkspaceNameTool.cc,v 1.9 2004/08/25 17:16:40 rathnor Exp $ +// $Id: WorkspaceNameTool.cc,v 1.10 2004/08/29 08:33:13 rathnor Exp $ #include "WorkspaceNameTool.hh"

@@ -107,6 +107,10 @@ }

void WorkspaceNameTool::hide() { m_button.hide(); +} + +void WorkspaceNameTool::updateSizing() { + m_button.setBorderWidth(m_theme.border().width()); } void WorkspaceNameTool::renderTheme() {
M src/WorkspaceNameTool.hhsrc/WorkspaceNameTool.hh

@@ -20,7 +20,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: WorkspaceNameTool.hh,v 1.4 2003/08/23 15:45:38 fluxgen Exp $ +// $Id: WorkspaceNameTool.hh,v 1.5 2004/08/29 08:33:13 rathnor Exp $ #ifndef WORKSPACENAMETOOL_HH #define WORKSPACENAMETOOL_HH

@@ -54,6 +54,7 @@ FbTk::Button &button() { return m_button; }

const FbTk::Button &button() const { return m_button; } private: void renderTheme(); + void updateSizing(); FbTk::TextButton m_button; const ToolTheme &m_theme; BScreen &m_screen;