toolbar size + alignment fixes

This commit is contained in:
rathnor 2003-04-28 16:48:23 +00:00
parent 1ce64cab59
commit 41c0ea543c
3 changed files with 48 additions and 18 deletions

View file

@ -1,6 +1,9 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.2: Changes for 0.9.2:
*03/04/28: *03/04/28:
* Fix a bunch of alignment + size issues with toolbar (particularly
when vertical) (Simon)
Toolbar.cc Iconbar.cc
* Fix remembering (and general init) of decorations (Simon) * Fix remembering (and general init) of decorations (Simon)
Window.hh/cc Window.hh/cc
* Fix handleEvent issues, plus detachClient crash (Simon) * Fix handleEvent issues, plus detachClient crash (Simon)

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: IconBar.cc,v 1.31 2003/04/25 10:40:31 fluxgen Exp $ // $Id: IconBar.cc,v 1.32 2003/04/28 16:48:22 rathnor Exp $
#include "IconBar.hh" #include "IconBar.hh"
@ -339,8 +339,9 @@ void IconBar::draw(const IconBarObj * const obj, int width) const {
if (m_vertical) { if (m_vertical) {
int tmp = dy; int tmp = dy;
dy = obj->height() - dx; dy = obj->height() - dx;
dx = tmp; dx = tmp + bevel_w;
} } else
dy += bevel_w;
m_font.drawText( m_font.drawText(
iconwin, iconwin,

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Toolbar.cc,v 1.76 2003/04/27 04:28:03 rathnor Exp $ // $Id: Toolbar.cc,v 1.77 2003/04/28 16:48:23 rathnor Exp $
#include "Toolbar.hh" #include "Toolbar.hh"
@ -462,9 +462,26 @@ void Toolbar::reconfigure() {
else if (frame.workspace_label_w > frame.clock_w) else if (frame.workspace_label_w > frame.clock_w)
frame.clock_w = frame.workspace_label_w; frame.clock_w = frame.workspace_label_w;
frame.window_label_w = // Right, let's break this one down....
(frame.width - (frame.clock_w + (frame.button_w * 4) + // full width, minus clock, workspace label and the 4 arrow buttons.
frame.workspace_label_w + (frame.bevel_w * 8) + 6)); // each of the (6) aforementioned items are separated by a bevel width,
// plus outside (+1), plus the window label (+1).
i = frame.clock_w + (frame.button_w * 4) +
frame.workspace_label_w + (frame.bevel_w * 8) + 6;
// of course if your toolbar is set too small, this could go negative.
// which is bad mmmkay. Since we are unsigned, we check that *first*.
if (vertical)
w = frame.height;
else
w = frame.width;
if (i > w)
frame.window_label_w = 0;
else
frame.window_label_w = w - i;
if (hidden) if (hidden)
frame.window.moveResize(frame.x_hidden, frame.y_hidden, frame.window.moveResize(frame.x_hidden, frame.y_hidden,
@ -477,6 +494,12 @@ void Toolbar::reconfigure() {
unsigned int next_x = frame.workspace_label_w; unsigned int next_x = frame.workspace_label_w;
unsigned int next_y = frame.window.height(); unsigned int next_y = frame.window.height();
unsigned int text_x=0, text_y=0;
if (vertical)
text_x = frame.bevel_w;
else
text_y = frame.bevel_w;
if (vertical) { if (vertical) {
next_x = frame.window.width(); next_x = frame.window.width();
@ -507,12 +530,11 @@ void Toolbar::reconfigure() {
if (vertical) { if (vertical) {
next_y += frame.nsbutton.height() + 1; next_y += frame.nsbutton.height() + 1;
label_w = frame.width; label_w = frame.width;
label_h = frame.window_label_w - frame.width + frame.height; label_h = frame.window_label_w/* - frame.width + frame.height*/;
} else } else
next_x += frame.nsbutton.width() + 1; next_x += frame.nsbutton.width() + 1;
frame.window_label.moveResize(next_x, next_y, frame.window_label.moveResize(next_x, next_y,
label_w, label_h); label_w, label_h);
if (vertical) if (vertical)
@ -538,7 +560,7 @@ void Toolbar::reconfigure() {
} else } else
next_x += frame.nwbutton.width() + 1; next_x += frame.nwbutton.width() + 1;
frame.clock.moveResize(next_x, next_y, frame.clock.moveResize(next_x + text_x, next_y + text_y,
clock_w, clock_h); clock_w, clock_h);
Pixmap tmp = frame.base; Pixmap tmp = frame.base;
@ -650,6 +672,9 @@ void Toolbar::reconfigure() {
frame.nwbutton.clear(); frame.nwbutton.clear();
redrawWindowLabel(); redrawWindowLabel();
if (m_iconbar.get())
m_iconbar->reconfigure();
redrawWorkspaceLabel(); redrawWorkspaceLabel();
checkClock(true); checkClock(true);
@ -775,8 +800,9 @@ void Toolbar::redrawWindowLabel(bool redraw) {
if (m_theme.font().isRotated()) { if (m_theme.font().isRotated()) {
int tmp = dy; int tmp = dy;
dy = frame.window_label.height() - dx; dy = frame.window_label.height() - dx;
dx = tmp; dx = tmp + frame.bevel_w;
} } else
dy += frame.bevel_w;
m_theme.font().drawText( m_theme.font().drawText(
frame.window_label.window(), frame.window_label.window(),
@ -1151,28 +1177,28 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
break; break;
case LEFTBOTTOM: case LEFTBOTTOM:
frame.x = head_x; frame.x = head_x;
frame.y = head_y + head_h - frame.height; frame.y = head_y + head_h - frame.height - screen().rootTheme().borderWidth()*2;
frame.x_hidden = frame.x - frame.width + frame.x_hidden = frame.x - frame.width +
screen().rootTheme().bevelWidth() + screen().rootTheme().borderWidth(); screen().rootTheme().bevelWidth() + screen().rootTheme().borderWidth();
frame.y_hidden = frame.y; frame.y_hidden = frame.y;
break; break;
case RIGHTCENTER: case RIGHTCENTER:
frame.x = head_x + head_w - frame.width; frame.x = head_x + head_w - frame.width - screen().rootTheme().borderWidth()*2;
frame.y = head_y + (head_h - frame.height)/2; frame.y = head_y + (head_h - frame.height)/2;
frame.x_hidden = frame.x + frame.width - frame.x_hidden = frame.x + frame.width -
screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth(); screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth();
frame.y_hidden = frame.y; frame.y_hidden = frame.y;
break; break;
case RIGHTTOP: case RIGHTTOP:
frame.x = head_x + head_w - frame.width; frame.x = head_x + head_w - frame.width - screen().rootTheme().borderWidth()*2;
frame.y = head_y; frame.y = head_y;
frame.x_hidden = frame.x + frame.width - frame.x_hidden = frame.x + frame.width -
screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth(); screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth();
frame.y_hidden = frame.y; frame.y_hidden = frame.y;
break; break;
case RIGHTBOTTOM: case RIGHTBOTTOM:
frame.x = head_x + head_w - frame.width; frame.x = head_x + head_w - frame.width - screen().rootTheme().borderWidth()*2;
frame.y = head_y + head_h - frame.height; frame.y = head_y + head_h - frame.height - screen().rootTheme().borderWidth()*2;
frame.x_hidden = frame.x + frame.width - frame.x_hidden = frame.x + frame.width -
screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth(); screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth();
frame.y_hidden = frame.y; frame.y_hidden = frame.y;