make fully max'd windows properly snap
This commit is contained in:
parent
b2e9af8886
commit
578a5cc980
2 changed files with 18 additions and 14 deletions
|
@ -2891,17 +2891,17 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
dbottom = std::abs(wbottom - srect.bottom());
|
dbottom = std::abs(wbottom - srect.bottom());
|
||||||
|
|
||||||
// snap left?
|
// snap left?
|
||||||
if (dleft < snap_distance && dleft < dright)
|
if (dleft < snap_distance && dleft <= dright)
|
||||||
dx = srect.left();
|
dx = srect.left();
|
||||||
// snap right?
|
// snap right?
|
||||||
else if (dright < snap_distance && dright < dleft)
|
else if (dright < snap_distance)
|
||||||
dx = srect.right() - frame.rect.width() + 1;
|
dx = srect.right() - frame.rect.width() + 1;
|
||||||
|
|
||||||
// snap top?
|
// snap top?
|
||||||
if (dtop < snap_distance && dtop < dbottom)
|
if (dtop < snap_distance && dtop <= dbottom)
|
||||||
dy = srect.top();
|
dy = srect.top();
|
||||||
// snap bottom?
|
// snap bottom?
|
||||||
else if (dbottom < snap_distance && dbottom < dtop)
|
else if (dbottom < snap_distance)
|
||||||
dy = srect.bottom() - frame.rect.height() + 1;
|
dy = srect.bottom() - frame.rect.height() + 1;
|
||||||
|
|
||||||
srect = screen->getRect(); // now get the full screen
|
srect = screen->getRect(); // now get the full screen
|
||||||
|
@ -2912,17 +2912,17 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
dbottom = std::abs(wbottom - srect.bottom());
|
dbottom = std::abs(wbottom - srect.bottom());
|
||||||
|
|
||||||
// snap left?
|
// snap left?
|
||||||
if (dleft < snap_distance && dleft < dright)
|
if (dleft < snap_distance && dleft <= dright)
|
||||||
dx = srect.left();
|
dx = srect.left();
|
||||||
// snap right?
|
// snap right?
|
||||||
else if (dright < snap_distance && dright < dleft)
|
else if (dright < snap_distance)
|
||||||
dx = srect.right() - frame.rect.width() + 1;
|
dx = srect.right() - frame.rect.width() + 1;
|
||||||
|
|
||||||
// snap top?
|
// snap top?
|
||||||
if (dtop < snap_distance && dtop < dbottom)
|
if (dtop < snap_distance && dtop <= dbottom)
|
||||||
dy = srect.top();
|
dy = srect.top();
|
||||||
// snap bottom?
|
// snap bottom?
|
||||||
else if (dbottom < snap_distance && dbottom < dtop)
|
else if (dbottom < snap_distance)
|
||||||
dy = srect.bottom() - frame.rect.height() + 1;
|
dy = srect.bottom() - frame.rect.height() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/XAtom.cc
16
src/XAtom.cc
|
@ -357,12 +357,14 @@ bool XAtom::getValue(Window win, Atom atom, Atom type,
|
||||||
Atom ret_type;
|
Atom ret_type;
|
||||||
int ret_size;
|
int ret_size;
|
||||||
unsigned long ret_bytes;
|
unsigned long ret_bytes;
|
||||||
|
int result;
|
||||||
const unsigned long maxread = nelements;
|
const unsigned long maxread = nelements;
|
||||||
// try get the first element
|
// try get the first element
|
||||||
XGetWindowProperty(_display, win, atom, 0l, 1l, False, AnyPropertyType,
|
result = XGetWindowProperty(_display, win, atom, 0l, 1l, False,
|
||||||
&ret_type, &ret_size, &nelements, &ret_bytes, &c_val);
|
AnyPropertyType, &ret_type, &ret_size,
|
||||||
if (ret_type == None || nelements < 1)
|
&nelements, &ret_bytes, &c_val);
|
||||||
// the property does not exist on the window or is empty
|
if (result != Success || ret_type == None || nelements < 1)
|
||||||
|
// an error occured, the property does not exist on the window, or is empty
|
||||||
return false;
|
return false;
|
||||||
if (ret_type != type || ret_size != size) {
|
if (ret_type != type || ret_size != size) {
|
||||||
// wrong data in property
|
// wrong data in property
|
||||||
|
@ -384,8 +386,10 @@ bool XAtom::getValue(Window win, Atom atom, Atom type,
|
||||||
int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
|
int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
|
||||||
if (remain > size/8 * (signed)maxread) // dont get more than the max
|
if (remain > size/8 * (signed)maxread) // dont get more than the max
|
||||||
remain = size/8 * (signed)maxread;
|
remain = size/8 * (signed)maxread;
|
||||||
XGetWindowProperty(_display, win, atom, 0l, remain, False, type, &ret_type,
|
result = XGetWindowProperty(_display, win, atom, 0l, remain, False, type,
|
||||||
&ret_size, &nelements, &ret_bytes, &c_val);
|
&ret_type, &ret_size, &nelements, &ret_bytes,
|
||||||
|
&c_val);
|
||||||
|
assert(result == Success);
|
||||||
assert(ret_bytes == 0);
|
assert(ret_bytes == 0);
|
||||||
*value = new unsigned char[nelements * size/8 + 1];
|
*value = new unsigned char[nelements * size/8 + 1];
|
||||||
memcpy(*value, c_val, nelements * size/8 + 1);
|
memcpy(*value, c_val, nelements * size/8 + 1);
|
||||||
|
|
Loading…
Reference in a new issue