better support for relative resizing
This commit is contained in:
parent
d8967bd534
commit
90ee16fc86
3 changed files with 10 additions and 25 deletions
|
@ -274,11 +274,11 @@ void screen::handleKeypress(const XEvent &e) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Action::resizeWindowWidth:
|
case Action::resizeWindowWidth:
|
||||||
window->resize(it->number(), 0);
|
window->resizeRel(it->number(), 0);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Action::resizeWindowHeight:
|
case Action::resizeWindowHeight:
|
||||||
window->resize(0, it->number());
|
window->resizeRel(0, it->number());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Action::toggleshade:
|
case Action::toggleshade:
|
||||||
|
|
|
@ -336,34 +336,18 @@ void XWindow::move(int x, int y) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XWindow::resize(int dwidth, int dheight) const {
|
void XWindow::resizeRel(int dwidth, int dheight) const {
|
||||||
// resize in increments if requested by the window
|
// resize in increments if requested by the window
|
||||||
|
unsigned int width = _rect.width(), height = _rect.height();
|
||||||
unsigned int wdest = _rect.width() + (dwidth * _inc_x) /
|
|
||||||
_inc_x * _inc_x + _base_x;
|
|
||||||
unsigned int hdest = _rect.height() + (dheight * _inc_y) /
|
|
||||||
_inc_y * _inc_y + _base_y;
|
|
||||||
|
|
||||||
if (width > wdest) {
|
|
||||||
while (width > wdest)
|
|
||||||
wdest += _inc_x;
|
|
||||||
} else {
|
|
||||||
while (width < wdest)
|
|
||||||
wdest -= _inc_x;
|
|
||||||
}
|
|
||||||
if (height > hdest) {
|
|
||||||
while (height > hdest)
|
|
||||||
hdest += _inc_y;
|
|
||||||
} else {
|
|
||||||
while (height < hdest)
|
|
||||||
hdest -= _inc_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
unsigned int wdest = width + (dwidth * _inc_x) / _inc_x * _inc_x + _base_x;
|
||||||
|
unsigned int hdest = height + (dheight * _inc_y) / _inc_y * _inc_y + _base_y;
|
||||||
|
|
||||||
XResizeWindow(_epist->getXDisplay(), _window, wdest, hdest);
|
XResizeWindow(_epist->getXDisplay(), _window, wdest, hdest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XWindow::resize(unsigned int width, unsigned int height) const {
|
void XWindow::resizeAbs(unsigned int width, unsigned int height) const {
|
||||||
// resize in increments if requested by the window
|
// resize in increments if requested by the window
|
||||||
|
|
||||||
unsigned int wdest = width / _inc_x * _inc_x + _base_x;
|
unsigned int wdest = width / _inc_x * _inc_x + _base_x;
|
||||||
|
|
|
@ -111,7 +111,8 @@ public:
|
||||||
void focus() const;
|
void focus() const;
|
||||||
void sendTo(unsigned int dest) const;
|
void sendTo(unsigned int dest) const;
|
||||||
void move(int x, int y) const;
|
void move(int x, int y) const;
|
||||||
void resize(unsigned int width, unsigned int height) const;
|
void resizeRel(int dwidth, int dheight) const;
|
||||||
|
void resizeAbs(unsigned int width, unsigned int height) const;
|
||||||
void toggleMaximize(Max max) const; // i hate toggle functions
|
void toggleMaximize(Max max) const; // i hate toggle functions
|
||||||
void maximize(Max max) const;
|
void maximize(Max max) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue