From 9dcbff31b492ca4277471accc95696e0f9a0dd20 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Fri, 24 Jul 2009 00:56:04 -0700 Subject: make autohide only show the border or 1 pixel if borderless --- src/Slit.cc | 29 +++++++++++++---------------- src/Toolbar.cc | 33 +++++++++++++++------------------ 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/Slit.cc b/src/Slit.cc index 5bb96c4..10fec24 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -766,30 +766,27 @@ void Slit::reposition() { } int border_width = theme()->borderWidth(); - int bevel_width = theme()->bevelWidth(); - // make sure at leaste one pixel is visible - if (border_width >= bevel_width) - bevel_width = border_width + 1; + int pixel = (border_width == 0 ? 1 : 0); // place the slit in the appropriate place switch (placement()) { case TOPLEFT: frame.x = head_x; frame.y = head_y; frame.x_hidden = head_x; - frame.y_hidden = bevel_width - border_width - frame.height; + frame.y_hidden = head_y + pixel - border_width - frame.height; break; case LEFTTOP: frame.x = head_x; frame.y = head_y; - frame.x_hidden = bevel_width - border_width - frame.width; + frame.x_hidden = head_x + pixel - border_width - frame.width; frame.y_hidden = head_y; break; case LEFTCENTER: frame.x = head_x; frame.y = head_y + (head_h - frame.height) / 2; - frame.x_hidden = head_x + bevel_width - border_width - frame.width; + frame.x_hidden = head_x + pixel - border_width - frame.width; frame.y_hidden = frame.y; break; @@ -797,13 +794,13 @@ void Slit::reposition() { frame.x = head_x; frame.y = head_y + head_h - frame.height - border_width*2; frame.x_hidden = head_x; - frame.y_hidden = head_y + head_h - bevel_width - border_width; + frame.y_hidden = head_y + head_h - pixel - border_width; break; case LEFTBOTTOM: frame.x = head_x; frame.y = head_y + head_h - frame.height - border_width*2; - frame.x_hidden = head_x + bevel_width - border_width - frame.width; + frame.x_hidden = head_x + pixel - border_width - frame.width; frame.y_hidden = frame.y; break; @@ -811,34 +808,34 @@ void Slit::reposition() { frame.x = head_x + ((head_w - frame.width) / 2); frame.y = head_y; frame.x_hidden = frame.x; - frame.y_hidden = head_y + bevel_width - border_width - frame.height; + frame.y_hidden = head_y + pixel - border_width - frame.height; break; case BOTTOMCENTER: frame.x = head_x + ((head_w - frame.width) / 2); frame.y = head_y + head_h - frame.height - border_width*2; frame.x_hidden = frame.x; - frame.y_hidden = head_y + head_h - bevel_width - border_width; + frame.y_hidden = head_y + head_h - pixel - border_width; break; case TOPRIGHT: frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y; frame.x_hidden = frame.x; - frame.y_hidden = head_y + bevel_width - border_width - frame.height; + frame.y_hidden = head_y + pixel - border_width - frame.height; break; case RIGHTTOP: frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y; - frame.x_hidden = head_x + head_w - bevel_width - border_width; + frame.x_hidden = head_x + head_w - pixel - border_width; frame.y_hidden = head_y; break; case RIGHTCENTER: frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y + ((head_h - frame.height) / 2); - frame.x_hidden = head_x + head_w - bevel_width - border_width; + frame.x_hidden = head_x + head_w - pixel - border_width; frame.y_hidden = frame.y; break; @@ -846,14 +843,14 @@ void Slit::reposition() { frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2; frame.x_hidden = frame.x; - frame.y_hidden = head_y + head_h - bevel_width - border_width; + frame.y_hidden = head_y + head_h - pixel - border_width; break; case RIGHTBOTTOM: default: frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2; - frame.x_hidden = head_x + head_w - bevel_width - border_width; + frame.x_hidden = head_x + head_w - pixel - border_width; frame.y_hidden = frame.y; break; } diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 2552de9..dbe5e5c 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -391,6 +391,8 @@ void Toolbar::reconfigure() { updateVisibleState(); + if (doAutoHide() && !isHidden() && !m_hide_timer.isTiming()) + m_hide_timer.start(); if (!doAutoHide() && isHidden()) toggleHidden(); @@ -457,9 +459,6 @@ void Toolbar::reconfigure() { menu().reconfigure(); } - if (doAutoHide()) - m_hide_timer.start(); - frame.bevel_w = theme()->bevelWidth(); // destroy shape if the theme wasn't specified with one, // or create one @@ -655,7 +654,6 @@ void Toolbar::setPlacement(Toolbar::Placement where) { head_h = screen().getHeadHeight(head); } - int bevel_width = theme()->bevelWidth(); int border_width = theme()->border().width(); frame.width = (head_w - 2*border_width) * (*m_rc_width_percent) / 100; @@ -682,8 +680,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { // So we get at least one pixel visible in hidden mode - if (bevel_width <= border_width) - bevel_width = border_width + 1; + int pixel = (border_width == 0 ? 1 : 0); FbTk::Orientation orient = FbTk::ROT0; @@ -692,7 +689,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { frame.x = head_x; frame.y = head_y; frame.x_hidden = head_x; - frame.y_hidden = head_y + bevel_width - border_width - frame.height; + frame.y_hidden = head_y - border_width - frame.height + pixel; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); break; @@ -701,7 +698,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { frame.x = head_x; frame.y = head_y + head_h - frame.height - border_width*2; frame.x_hidden = head_x; - frame.y_hidden = head_y + head_h - bevel_width - border_width; + frame.y_hidden = head_y + head_h - border_width - pixel; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); break; @@ -710,7 +707,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { frame.x = head_x + (head_w - frame.width) / 2 - border_width; frame.y = head_y; frame.x_hidden = frame.x; - frame.y_hidden = head_y + bevel_width - border_width - frame.height; + frame.y_hidden = head_y - border_width - frame.height + pixel; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); break; @@ -718,7 +715,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y; frame.x_hidden = frame.x; - frame.y_hidden = head_y + bevel_width - border_width - frame.height; + frame.y_hidden = head_y - border_width - frame.height + pixel; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); break; @@ -727,7 +724,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2; frame.x_hidden = frame.x; - frame.y_hidden = head_y + head_h - bevel_width - border_width; + frame.y_hidden = head_y + head_h - border_width - pixel; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); break; @@ -736,7 +733,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { frame.x = head_x + (head_w - frame.width) / 2 - border_width; frame.y = head_y + head_h - frame.height - border_width*2; frame.x_hidden = frame.x; - frame.y_hidden = head_y + head_h - bevel_width - border_width; + frame.y_hidden = head_y + head_h - border_width - pixel; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); break; @@ -744,7 +741,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { orient = FbTk::ROT270; frame.x = head_x; frame.y = head_y + (head_h - frame.height)/2 - border_width; - frame.x_hidden = frame.x - frame.width + bevel_width + border_width; + frame.x_hidden = frame.x - frame.width - border_width + pixel; frame.y_hidden = frame.y; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); @@ -753,7 +750,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { orient = FbTk::ROT270; frame.x = head_x; frame.y = head_y; - frame.x_hidden = frame.x - frame.width + bevel_width + border_width; + frame.x_hidden = frame.x - frame.width - border_width + pixel; frame.y_hidden = frame.y; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); @@ -762,7 +759,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { orient = FbTk::ROT270; frame.x = head_x; frame.y = head_y + head_h - frame.height - border_width*2; - frame.x_hidden = frame.x - frame.width + bevel_width + border_width; + frame.x_hidden = frame.x - frame.width - border_width + pixel; frame.y_hidden = frame.y; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); @@ -771,7 +768,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { orient = FbTk::ROT90; frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y + (head_h - frame.height)/2 - border_width; - frame.x_hidden = frame.x + frame.width - bevel_width - border_width; + frame.x_hidden = frame.x + frame.width + border_width - pixel; frame.y_hidden = frame.y; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); @@ -780,7 +777,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { orient = FbTk::ROT90; frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y; - frame.x_hidden = frame.x + frame.width - bevel_width - border_width; + frame.x_hidden = frame.x + frame.width + border_width - pixel; frame.y_hidden = frame.y; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); @@ -789,7 +786,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { orient = FbTk::ROT90; frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2; - frame.x_hidden = frame.x + frame.width - bevel_width - border_width; + frame.x_hidden = frame.x + frame.width + border_width - pixel; frame.y_hidden = frame.y; if (m_shape.get()) m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); -- cgit v0.11.2