dont limit how big a window can be resized.

dont let the user resize a window smaller than 0, which makes it wrap to a huge number
This commit is contained in:
Dana Jansens 2002-08-26 12:09:28 +00:00
parent 38b124e1b8
commit f763814b33

View file

@ -1218,10 +1218,12 @@ void BlackboxWindow::getWMNormalHints(void) {
client.max_aspect_x = client.max_aspect_y = 1; client.max_aspect_x = client.max_aspect_y = 1;
#endif #endif
// set no limit to how big a window can be by default // don't limit the size of a window, the default max width is the biggest
// possible
client.max_width = (unsigned) -1; client.max_width = (unsigned) -1;
client.max_height = (unsigned) -1; client.max_height = (unsigned) -1;
if (! XGetWMNormalHints(blackbox->getXDisplay(), client.window, if (! XGetWMNormalHints(blackbox->getXDisplay(), client.window,
&sizehint, &icccm_mask)) &sizehint, &icccm_mask))
return; return;
@ -3619,27 +3621,28 @@ void BlackboxWindow::doResize(int x_root, int y_root) {
unsigned int gw, gh; unsigned int gw, gh;
Corner anchor; Corner anchor;
int dx, dy; // the amount of change in the size of the window
switch (resize_dir) { switch (resize_dir) {
case BottomLeft: case BottomLeft:
anchor = TopRight; anchor = TopRight;
frame.changing.setSize(frame.rect.width() - (x_root - frame.grab_x), dx = - (x_root - frame.grab_x);
frame.rect.height() + (y_root - frame.grab_y)); dy = + (y_root - frame.grab_y);
break; break;
case BottomRight: case BottomRight:
anchor = TopLeft; anchor = TopLeft;
frame.changing.setSize(frame.rect.width() + (x_root - frame.grab_x), dx = + (x_root - frame.grab_x);
frame.rect.height() + (y_root - frame.grab_y)); dy = + (y_root - frame.grab_y);
break; break;
case TopLeft: case TopLeft:
anchor = BottomRight; anchor = BottomRight;
frame.changing.setSize(frame.rect.width() - (x_root - frame.grab_x), dx = - (x_root - frame.grab_x);
frame.rect.height() - (y_root - frame.grab_y)); dy = - (y_root - frame.grab_y);
break; break;
case TopRight: case TopRight:
anchor = BottomLeft; anchor = BottomLeft;
frame.changing.setSize(frame.rect.width() + (x_root - frame.grab_x), dx = + (x_root - frame.grab_x);
frame.rect.height() - (y_root - frame.grab_y)); dy = - (y_root - frame.grab_y);
break; break;
default: default:
@ -3647,6 +3650,13 @@ void BlackboxWindow::doResize(int x_root, int y_root) {
return; // unreachable, for the compiler return; // unreachable, for the compiler
} }
// make sure the user cant resize the window smaller than 0, which makes it
// wrap around and become huge
if (dx < -(signed)client.rect.width()) dx = -(signed)client.rect.width();
if (dy < -(signed)client.rect.height()) dy = -(signed)client.rect.height();
frame.changing.setSize(frame.rect.width() + dx, frame.rect.height() + dy);
constrain(anchor, &gw, &gh); constrain(anchor, &gw, &gh);
XDrawRectangle(blackbox->getXDisplay(), screen->getRootWindow(), XDrawRectangle(blackbox->getXDisplay(), screen->getRootWindow(),