From 44e3582d5e08556c7b1136cfd9a49546cf5fcae0 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 14 Apr 2002 18:48:32 +0000 Subject: [PATCH] BScreen (ScreenInfo) now contains a size() instead of a getWidth/getHeight --- src/BaseDisplay.cc | 13 +++++++------ src/BaseDisplay.h | 8 +++++--- src/Basemenu.cc | 16 ++++++++-------- src/Geometry.cc | 14 +++++++------- src/Geometry.h | 22 +++++++++++----------- src/Screen.cc | 14 +++++++------- src/Slit.cc | 44 ++++++++++++++++++++++---------------------- src/Toolbar.cc | 30 +++++++++++++++--------------- src/Window.cc | 40 ++++++++++++++++++++-------------------- src/Workspace.cc | 26 +++++++++++++------------- src/openbox.cc | 16 ++++++++-------- 11 files changed, 123 insertions(+), 120 deletions(-) diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc index 5b906495..41097628 100644 --- a/src/BaseDisplay.cc +++ b/src/BaseDisplay.cc @@ -574,16 +574,17 @@ void BaseDisplay::ungrabButton(unsigned int button, unsigned int modifiers, } -ScreenInfo::ScreenInfo(BaseDisplay &d, int num) : basedisplay(d) { - screen_number = num; +ScreenInfo::ScreenInfo(BaseDisplay &d, int num) : basedisplay(d), + screen_number(num) +{ root_window = RootWindow(basedisplay.getXDisplay(), screen_number); depth = DefaultDepth(basedisplay.getXDisplay(), screen_number); - width = - WidthOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(), screen_number)); - height = - HeightOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(), screen_number)); + m_size = Size(WidthOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(), + screen_number)), + HeightOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(), + screen_number))); // search for a TrueColor Visual... if we can't find one... we will use the // default visual for the screen diff --git a/src/BaseDisplay.h b/src/BaseDisplay.h index 8504261e..1a44dddc 100644 --- a/src/BaseDisplay.h +++ b/src/BaseDisplay.h @@ -32,6 +32,7 @@ class ScreenInfo; #include "LinkedList.h" #include "Timer.h" +#include "Geometry.h" #define AttribShaded (1l << 0) #define AttribMaxHoriz (1l << 1) @@ -334,7 +335,7 @@ private: Colormap colormap; int depth, screen_number; - unsigned int width, height; + Size m_size; public: @@ -349,8 +350,9 @@ public: inline const int &getDepth(void) const { return depth; } inline const int &getScreenNumber(void) const { return screen_number; } - inline const unsigned int &getWidth(void) const { return width; } - inline const unsigned int &getHeight(void) const { return height; } +// inline const unsigned int &getWidth(void) const { return width; } +// inline const unsigned int &getHeight(void) const { return height; } + inline const Size &size() const { return m_size; } }; diff --git a/src/Basemenu.cc b/src/Basemenu.cc index ef6cf4d5..b53dc854 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc @@ -316,7 +316,7 @@ void Basemenu::update(void) { while (((menu.item_h * (menuitems->count() + 1) / menu.sublevels) + menu.title_h + screen.getBorderWidth()) > - screen.getHeight()) + screen.size().h()) menu.sublevels++; if (menu.sublevels < menu.minsub) menu.sublevels = menu.minsub; @@ -549,15 +549,15 @@ void Basemenu::drawSubmenu(int index) { y = (((shifted) ? menu.y_shift : menu.y) + menu.height - item->submenu()->menu.height); - if ((x + item->submenu()->getWidth()) > screen.getWidth()) { + if ((x + item->submenu()->getWidth()) > screen.size().w()) { x = ((shifted) ? menu.x_shift : menu.x) - item->submenu()->getWidth() - screen.getBorderWidth(); } if (x < 0) x = 0; - if ((y + item->submenu()->getHeight()) > screen.getHeight()) - y = screen.getHeight() - item->submenu()->getHeight() - + if ((y + item->submenu()->getHeight()) > screen.size().h()) + y = screen.size().h() - item->submenu()->getHeight() - (screen.getBorderWidth() * 2); if (y < 0) y = 0; @@ -963,8 +963,8 @@ void Basemenu::exposeEvent(XExposeEvent *ee) { void Basemenu::enterNotifyEvent(XCrossingEvent *ce) { if (ce->window == menu.frame) { menu.x_shift = menu.x, menu.y_shift = menu.y; - if (menu.x + menu.width > screen.getWidth()) { - menu.x_shift = screen.getWidth() - menu.width - + if (menu.x + menu.width > screen.size().w()) { + menu.x_shift = screen.size().w() - menu.width - screen.getBorderWidth(); shifted = True; } else if (menu.x < 0) { @@ -972,8 +972,8 @@ void Basemenu::enterNotifyEvent(XCrossingEvent *ce) { shifted = True; } - if (menu.y + menu.height > screen.getHeight()) { - menu.y_shift = screen.getHeight() - menu.height - + if (menu.y + menu.height > screen.size().h()) { + menu.y_shift = screen.size().h() - menu.height - screen.getBorderWidth(); shifted = True; } else if (menu.y + (signed) menu.title_h < 0) { diff --git a/src/Geometry.cc b/src/Geometry.cc index e09058d5..df8fc31d 100644 --- a/src/Geometry.cc +++ b/src/Geometry.cc @@ -44,14 +44,14 @@ Size::Size() : m_w(0), m_h(0) { Size::Size(const Size &size) : m_w(size.m_w), m_h(size.m_h) { } -Size::Size(const int w, const int h) : m_w(w), m_h(h) { +Size::Size(const unsigned int w, const unsigned int h) : m_w(w), m_h(h) { } -void Size::setW(const int w) { +void Size::setW(const unsigned int w) { m_w = w; } -void Size::setH(const int h) { +void Size::setH(const unsigned int h) { m_h = h; } @@ -62,8 +62,8 @@ Rect::Rect(const Point &origin, const Size &size) : m_origin(origin), m_size(size) { } -Rect::Rect(const int x, const int y, const int w, const int h) : m_origin(x, y), - m_size(w, h) { +Rect::Rect(const int x, const int y, const unsigned int w, const unsigned int h) + : m_origin(x, y), m_size(w, h) { } void Rect::setSize(const Size &size) { @@ -82,11 +82,11 @@ void Rect::setY(const int y) { m_origin.setY(y); } -void Rect::setW(int w) { +void Rect::setW(unsigned int w) { m_size.setW(w); } -void Rect::setH(int h) { +void Rect::setH(unsigned int h) { m_size.setH(h); } diff --git a/src/Geometry.h b/src/Geometry.h index ab5b8410..db9a411f 100644 --- a/src/Geometry.h +++ b/src/Geometry.h @@ -41,19 +41,19 @@ public: }; class Size{ - int m_w, m_h; + unsigned int m_w, m_h; public: Size(); Size(const Size &size); - Size(const int w, const int h); + Size(const unsigned int w, const unsigned int h); - void setW(const int w); - inline int w() const { + void setW(const unsigned int w); + inline unsigned int w() const { return m_w; } - void setH(const int h); - inline int h() const { + void setH(const unsigned int h); + inline unsigned int h() const { return m_h; } }; @@ -64,7 +64,7 @@ class Rect{ public: Rect(); Rect(const Point &origin, const Size &size); - Rect(const int x, const int y, const int w, const int h); + Rect(const int x, const int y, const unsigned int w, const unsigned int h); void setSize(const Size &size); inline const Size &size() const { @@ -86,13 +86,13 @@ public: return m_origin.y(); } - void setW(const int w); - inline int w() const { + void setW(const unsigned int w); + inline unsigned int w() const { return m_size.w(); } - void setH(const int h); - inline int h() const { + void setH(const unsigned int h); + inline unsigned int h() const { return m_size.h(); } diff --git a/src/Screen.cc b/src/Screen.cc index 368a6e8f..7438a9d8 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1252,7 +1252,7 @@ void BScreen::LoadStyle(void) { // load bevel, border and handle widths if (conf.getValue("handleWidth", "HandleWidth", l)) { - if (l <= getWidth() / 2 && l != 0) + if (l <= size().w() / 2 && l != 0) resource.handle_width = l; else resource.handle_width = 6; @@ -1265,7 +1265,7 @@ void BScreen::LoadStyle(void) { resource.border_width = 1; if (conf.getValue("bevelWidth", "BevelWidth", l)) { - if (l <= getWidth() / 2 && l != 0) + if (l <= size().w() / 2 && l != 0) resource.bevel_width = l; else resource.bevel_width = 3; @@ -1273,7 +1273,7 @@ void BScreen::LoadStyle(void) { resource.bevel_width = 3; if (conf.getValue("frameWidth", "FrameWidth", l)) { - if (l <= getWidth() / 2) + if (l <= size().w() / 2) resource.frame_width = l; else resource.frame_width = resource.bevel_width; @@ -2187,8 +2187,8 @@ void BScreen::shutdown(void) { void BScreen::showPosition(int x, int y) { if (! geom_visible) { XMoveResizeWindow(getBaseDisplay().getXDisplay(), geom_window, - (getWidth() - geom_w) / 2, - (getHeight() - geom_h) / 2, geom_w, geom_h); + (size().w() - geom_w) / 2, + (size().h() - geom_h) / 2, geom_w, geom_h); XMapWindow(getBaseDisplay().getXDisplay(), geom_window); XRaiseWindow(getBaseDisplay().getXDisplay(), geom_window); @@ -2221,8 +2221,8 @@ void BScreen::showPosition(int x, int y) { void BScreen::showGeometry(unsigned int gx, unsigned int gy) { if (! geom_visible) { XMoveResizeWindow(getBaseDisplay().getXDisplay(), geom_window, - (getWidth() - geom_w) / 2, - (getHeight() - geom_h) / 2, geom_w, geom_h); + (size().w() - geom_w) / 2, + (size().h() - geom_h) / 2, geom_w, geom_h); XMapWindow(getBaseDisplay().getXDisplay(), geom_window); XRaiseWindow(getBaseDisplay().getXDisplay(), geom_window); diff --git a/src/Slit.cc b/src/Slit.cc index e07de151..97d881c7 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -113,8 +113,8 @@ void Slit::addClient(Window w) { if (wmhints) { if ((wmhints->flags & IconWindowHint) && (wmhints->icon_window != None)) { - XMoveWindow(display, client->client_window, screen.getWidth() + 10, - screen.getHeight() + 10); + XMoveWindow(display, client->client_window, screen.size().w() + 10, + screen.size().h() + 10); XMapWindow(display, client->client_window); client->icon_window = wmhints->icon_window; @@ -382,7 +382,7 @@ void Slit::reposition(void) { case CenterLeft: frame.x = 0; - frame.y = (screen.getHeight() - frame.height) / 2; + frame.y = (screen.size().h() - frame.height) / 2; frame.x_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.width; frame.y_hidden = frame.y; @@ -390,7 +390,7 @@ void Slit::reposition(void) { case BottomLeft: frame.x = 0; - frame.y = screen.getHeight() - frame.height + frame.y = screen.size().h() - frame.height - (screen.getBorderWidth() * 2); if (screen.getSlitDirection() == Vertical) { frame.x_hidden = screen.getBevelWidth() - screen.getBorderWidth() @@ -398,13 +398,13 @@ void Slit::reposition(void) { frame.y_hidden = frame.y; } else { frame.x_hidden = 0; - frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + frame.y_hidden = screen.size().h() - screen.getBevelWidth() - screen.getBorderWidth(); } break; case TopCenter: - frame.x = (screen.getWidth() - frame.width) / 2; + frame.x = (screen.size().w() - frame.width) / 2; frame.y = 0; frame.x_hidden = frame.x; frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() @@ -412,20 +412,20 @@ void Slit::reposition(void) { break; case BottomCenter: - frame.x = (screen.getWidth() - frame.width) / 2; - frame.y = screen.getHeight() - frame.height + frame.x = (screen.size().h() - frame.width) / 2; + frame.y = screen.size().h() - frame.height - (screen.getBorderWidth() * 2); frame.x_hidden = frame.x; - frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + frame.y_hidden = screen.size().h() - screen.getBevelWidth() - screen.getBorderWidth(); break; case TopRight: - frame.x = screen.getWidth() - frame.width + frame.x = screen.size().w() - frame.width - (screen.getBorderWidth() * 2); frame.y = 0; if (screen.getSlitDirection() == Vertical) { - frame.x_hidden = screen.getWidth() - screen.getBevelWidth() + frame.x_hidden = screen.size().w() - screen.getBevelWidth() - screen.getBorderWidth(); frame.y_hidden = 0; } else { @@ -437,26 +437,26 @@ void Slit::reposition(void) { case CenterRight: default: - frame.x = screen.getWidth() - frame.width + frame.x = screen.size().w() - frame.width - (screen.getBorderWidth() * 2); - frame.y = (screen.getHeight() - frame.height) / 2; - frame.x_hidden = screen.getWidth() - screen.getBevelWidth() + frame.y = (screen.size().h() - frame.height) / 2; + frame.x_hidden = screen.size().w() - screen.getBevelWidth() - screen.getBorderWidth(); frame.y_hidden = frame.y; break; case BottomRight: - frame.x = screen.getWidth() - frame.width + frame.x = screen.size().w() - frame.width - (screen.getBorderWidth() * 2); - frame.y = screen.getHeight() - frame.height + frame.y = screen.size().h() - frame.height - (screen.getBorderWidth() * 2); if (screen.getSlitDirection() == Vertical) { - frame.x_hidden = screen.getWidth() - screen.getBevelWidth() + frame.x_hidden = screen.size().w() - screen.getBevelWidth() - screen.getBorderWidth(); frame.y_hidden = frame.y; } else { frame.x_hidden = frame.x; - frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + frame.y_hidden = screen.size().h() - screen.getBevelWidth() - screen.getBorderWidth(); } break; @@ -517,13 +517,13 @@ void Slit::buttonPressEvent(XButtonEvent *e) { if (x < 0) x = 0; - else if (x + slitmenu->getWidth() > screen.getWidth()) - x = screen.getWidth() - slitmenu->getWidth(); + else if (x + slitmenu->getWidth() > screen.size().w()) + x = screen.size().w() - slitmenu->getWidth(); if (y < 0) y = 0; - else if (y + slitmenu->getHeight() > screen.getHeight()) - y = screen.getHeight() - slitmenu->getHeight(); + else if (y + slitmenu->getHeight() > screen.size().h()) + y = screen.size().h() - slitmenu->getHeight(); slitmenu->move(x, y); slitmenu->show(); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 01e210fc..10a31d70 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -188,7 +188,7 @@ Toolbar::~Toolbar(void) { void Toolbar::reconfigure(void) { frame.bevel_w = screen.getBevelWidth(); - frame.width = screen.getWidth() * screen.getToolbarWidthPercent() / 100; + frame.width = screen.size().w() * screen.getToolbarWidthPercent() / 100; if (i18n->multibyte()) frame.height = @@ -212,15 +212,15 @@ void Toolbar::reconfigure(void) { case BottomLeft: frame.x = 0; - frame.y = screen.getHeight() - frame.height + frame.y = screen.size().h() - frame.height - (screen.getBorderWidth() * 2); frame.x_hidden = 0; - frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + frame.y_hidden = screen.size().h() - screen.getBevelWidth() - screen.getBorderWidth(); break; case TopCenter: - frame.x = (screen.getWidth() - frame.width) / 2; + frame.x = (screen.size().w() - frame.width) / 2; frame.y = 0; frame.x_hidden = frame.x; frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() @@ -229,16 +229,16 @@ void Toolbar::reconfigure(void) { case BottomCenter: default: - frame.x = (screen.getWidth() - frame.width) / 2; - frame.y = screen.getHeight() - frame.height + frame.x = (screen.size().w() - frame.width) / 2; + frame.y = screen.size().h() - frame.height - (screen.getBorderWidth() * 2); frame.x_hidden = frame.x; - frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + frame.y_hidden = screen.size().h() - screen.getBevelWidth() - screen.getBorderWidth(); break; case TopRight: - frame.x = screen.getWidth() - frame.width + frame.x = screen.size().w() - frame.width - (screen.getBorderWidth() * 2); frame.y = 0; frame.x_hidden = frame.x; @@ -247,12 +247,12 @@ void Toolbar::reconfigure(void) { break; case BottomRight: - frame.x = screen.getWidth() - frame.width + frame.x = screen.size().w() - frame.width - (screen.getBorderWidth() * 2); - frame.y = screen.getHeight() - frame.height + frame.y = screen.size().h() - frame.height - (screen.getBorderWidth() * 2); frame.x_hidden = frame.x; - frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + frame.y_hidden = screen.size().h() - screen.getBevelWidth() - screen.getBorderWidth(); break; } @@ -897,13 +897,13 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) { if (x < 0) x = 0; - else if (x + toolbarmenu->getWidth() > screen.getWidth()) - x = screen.getWidth() - toolbarmenu->getWidth(); + else if (x + toolbarmenu->getWidth() > screen.size().w()) + x = screen.size().w() - toolbarmenu->getWidth(); if (y < 0) y = 0; - else if (y + toolbarmenu->getHeight() > screen.getHeight()) - y = screen.getHeight() - toolbarmenu->getHeight(); + else if (y + toolbarmenu->getHeight() > screen.size().h()) + y = screen.size().h() - toolbarmenu->getHeight(); toolbarmenu->move(x, y); toolbarmenu->show(); diff --git a/src/Window.cc b/src/Window.cc index 5adde163..031b396e 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -224,8 +224,8 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) { if ((openbox.isStartup()) || (frame.x >= 0 && (signed) (frame.y + frame.y_border) >= 0 && - frame.x <= (signed) screen->getWidth() && - frame.y <= (signed) screen->getHeight())) + frame.x <= (signed) screen->size().w() && + frame.y <= (signed) screen->size().h())) place_window = False; } @@ -1071,8 +1071,8 @@ void OpenboxWindow::getWMNormalHints(void) { client.min_width = client.min_height = client.base_width = client.base_height = client.width_inc = client.height_inc = 1; - client.max_width = screen->getWidth(); - client.max_height = screen->getHeight(); + client.max_width = screen->size().w(); + client.max_height = screen->size().h(); client.min_aspect_x = client.min_aspect_y = client.max_aspect_x = client.max_aspect_y = 1; client.win_gravity = NorthWestGravity; @@ -1357,21 +1357,21 @@ Bool OpenboxWindow::setInputFocus(void) { if (((signed) (frame.x + frame.width)) < 0) { if (((signed) (frame.y + frame.y_border)) < 0) configure(frame.border_w, frame.border_w, frame.width, frame.height); - else if (frame.y > (signed) screen->getHeight()) - configure(frame.border_w, screen->getHeight() - frame.height, + else if (frame.y > (signed) screen->size().h()) + configure(frame.border_w, screen->size().h() - frame.height, frame.width, frame.height); else configure(frame.border_w, frame.y + frame.border_w, frame.width, frame.height); - } else if (frame.x > (signed) screen->getWidth()) { + } else if (frame.x > (signed) screen->size().w()) { if (((signed) (frame.y + frame.y_border)) < 0) - configure(screen->getWidth() - frame.width, frame.border_w, + configure(screen->size().w() - frame.width, frame.border_w, frame.width, frame.height); - else if (frame.y > (signed) screen->getHeight()) - configure(screen->getWidth() - frame.width, - screen->getHeight() - frame.height, frame.width, frame.height); + else if (frame.y > (signed) screen->size().h()) + configure(screen->size().w() - frame.width, + screen->size().h() - frame.height, frame.width, frame.height); else - configure(screen->getWidth() - frame.width, + configure(screen->size().w() - frame.width, frame.y + frame.border_w, frame.width, frame.height); } @@ -1541,12 +1541,12 @@ void OpenboxWindow::maximize(unsigned int button) { openbox_attrib.premax_w = frame.width; openbox_attrib.premax_h = frame.height; - dw = screen->getWidth(); + dw = screen->size().w(); dw -= frame.border_w * 2; dw -= frame.mwm_border_w * 2; dw -= client.base_width; - dh = screen->getHeight(); + dh = screen->size().h(); dh -= frame.border_w * 2; dh -= frame.mwm_border_w * 2; dh -= ((frame.handle_h + frame.border_w) * decorations.handle); @@ -1571,12 +1571,12 @@ void OpenboxWindow::maximize(unsigned int button) { dh += ((frame.handle_h + frame.border_w) * decorations.handle); dh += frame.mwm_border_w * 2; - dx += ((screen->getWidth() - dw) / 2) - frame.border_w; + dx += ((screen->size().w() - dw) / 2) - frame.border_w; if (screen->doFullMax()) { - dy += ((screen->getHeight() - dh) / 2) - frame.border_w; + dy += ((screen->size().h() - dh) / 2) - frame.border_w; } else { - dy += (((screen->getHeight() - screen->getToolbar()->getExposedHeight()) + dy += (((screen->size().h() - screen->getToolbar()->getExposedHeight()) - dh) / 2) - frame.border_w; switch (screen->getToolbarPlacement()) { @@ -2807,14 +2807,14 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) { unsigned int snap_w = frame.width + (frame.border_w * 2); unsigned int snap_h = size().h() + (frame.border_w * 2); if (snap_distance) { - int drx = screen->getWidth() - (dx + snap_w); + int drx = screen->size().w() - (dx + snap_w); if (dx < drx && (dx > 0 && dx < snap_distance) || (dx < 0 && dx > -snap_distance) ) dx = 0; else if ( (drx > 0 && drx < snap_distance) || (drx < 0 && drx > -snap_distance) ) - dx = screen->getWidth() - snap_w; + dx = screen->size().w() - snap_w; int dtty, dbby, dty, dby; switch (screen->getToolbarPlacement()) { @@ -2823,7 +2823,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) { case Toolbar::TopRight: dtty = screen->getToolbar()->getExposedHeight() + frame.border_w; - dbby = screen->getHeight(); + dbby = screen->size().h(); break; default: diff --git a/src/Workspace.cc b/src/Workspace.cc index 4e36296d..0d996632 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -412,7 +412,7 @@ inline Point *Workspace::rowSmartPlacement(const Size &win_size, LinkedListIterator it(windowList); test_y = (screen.getColPlacementDirection() == BScreen::TopBottom) ? - start_pos : screen.getHeight() - win_size.h() - start_pos; + start_pos : screen.size().h() - win_size.h() - start_pos; while(!placed && ((screen.getColPlacementDirection() == BScreen::BottomTop) ? @@ -488,8 +488,8 @@ void Workspace::placeWindow(OpenboxWindow *win) { LinkedListIterator it(windowList); Rect space(0, 0, - screen.getWidth(), - screen.getHeight() + screen.size().w(), + screen.size().h() ); Size window_size(win_w, win_h); @@ -517,17 +517,17 @@ void Workspace::placeWindow(OpenboxWindow *win) { case BScreen::ColSmartPlacement: { test_x = (screen.getRowPlacementDirection() == BScreen::LeftRight) ? - start_pos : screen.getWidth() - win_w - start_pos; + start_pos : screen.size().w() - win_w - start_pos; while (!placed && ((screen.getRowPlacementDirection() == BScreen::RightLeft) ? - test_x > 0 : test_x + win_w < (signed) screen.getWidth())) { + test_x > 0 : test_x + win_w < (signed) screen.size().w())) { test_y = (screen.getColPlacementDirection() == BScreen::TopBottom) ? - start_pos : screen.getHeight() - win_h - start_pos; + start_pos : screen.size().h() - win_h - start_pos; while (!placed && ((screen.getColPlacementDirection() == BScreen::BottomTop) ? - test_y > 0 : test_y + win_h < (signed) screen.getHeight())) { + test_y > 0 : test_y + win_h < (signed) screen.size().h())) { placed = True; it.reset(); @@ -581,8 +581,8 @@ void Workspace::placeWindow(OpenboxWindow *win) { } // switch if (! placed) { - if (((unsigned) cascade_x > (screen.getWidth() / 2)) || - ((unsigned) cascade_y > (screen.getHeight() / 2))) + if (((unsigned) cascade_x > (screen.size().w() / 2)) || + ((unsigned) cascade_y > (screen.size().h() / 2))) cascade_x = cascade_y = 32; place_x = cascade_x; @@ -592,10 +592,10 @@ void Workspace::placeWindow(OpenboxWindow *win) { cascade_y += win->getTitleHeight(); } - if (place_x + win_w > (signed) screen.getWidth()) - place_x = (((signed) screen.getWidth()) - win_w) / 2; - if (place_y + win_h > (signed) screen.getHeight()) - place_y = (((signed) screen.getHeight()) - win_h) / 2; + if (place_x + win_w > (signed) screen.size().w()) + place_x = (((signed) screen.size().w()) - win_w) / 2; + if (place_y + win_h > (signed) screen.size().h()) + place_y = (((signed) screen.size().h()) - win_h) / 2; win->configure(place_x, place_y, win->size().w(), win->size().h()); } diff --git a/src/openbox.cc b/src/openbox.cc index e657fbd3..8e01a466 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -338,14 +338,14 @@ void Openbox::process_event(XEvent *e) { if (my < 0) my = 0; if (mx + screen->getWorkspacemenu()->getWidth() > - screen->getWidth()) - mx = screen->getWidth() - + screen->size().w()) + mx = screen->size().w() - screen->getWorkspacemenu()->getWidth() - screen->getBorderWidth(); if (my + screen->getWorkspacemenu()->getHeight() > - screen->getHeight()) - my = screen->getHeight() - + screen->size().h()) + my = screen->size().h() - screen->getWorkspacemenu()->getHeight() - screen->getBorderWidth(); @@ -364,13 +364,13 @@ void Openbox::process_event(XEvent *e) { if (mx < 0) mx = 0; if (my < 0) my = 0; - if (mx + screen->getRootmenu()->getWidth() > screen->getWidth()) - mx = screen->getWidth() - + if (mx + screen->getRootmenu()->getWidth() > screen->size().w()) + mx = screen->size().w() - screen->getRootmenu()->getWidth() - screen->getBorderWidth(); - if (my + screen->getRootmenu()->getHeight() > screen->getHeight()) - my = screen->getHeight() - + if (my + screen->getRootmenu()->getHeight() > screen->size().h()) + my = screen->size().h() - screen->getRootmenu()->getHeight() - screen->getBorderWidth(); -- 2.45.2