summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2014-10-27 23:33:12 +0100
committerMikael Magnusson <mikachu@gmail.com>2014-10-28 04:14:23 +0100
commitbf5357f9fb8b2af98da5a8eeaa36cbcffe5ab19a (patch)
tree28663e8a9bcc076b64df87a6a0d8bc8d8be81873
parentfe6453b40b0dcfb77c8ef8ef3f4ba7e02cbfa207 (diff)
Clip client rect to monitor bounds while picking a corner for resizing
This way you can actually do everything to it when it's offscreen, not just resize the one edge that's poking out
-rw-r--r--openbox/actions/resize.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/openbox/actions/resize.c b/openbox/actions/resize.c
index f6858d2d..fc85c0b7 100644
--- a/openbox/actions/resize.c
+++ b/openbox/actions/resize.c
@@ -2,6 +2,7 @@
#include "openbox/moveresize.h"
#include "openbox/client.h"
#include "openbox/frame.h"
+#include "openbox/screen.h"
#include "obt/prop.h"
typedef struct {
@@ -95,6 +96,12 @@ static gboolean run_func(ObActionsData *data, gpointer options)
static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch,
gboolean shaded)
{
+ const Rect *full = screen_physical_area_all_monitors();
+ if (cx < full->x) { cw = cw + cx - full->x; cx = full->x; }
+ if (cy < full->y) { ch = ch + cy - full->y; cy = full->y; }
+ if (cx + cw > full->x + full->width) cw = full->x + full->width - cx;
+ if (cy + ch > full->y + full->height) ch = full->y + full->height - cy;
+
/* let's make x and y client relative instead of screen relative */
x = x - cx;
y = ch - (y - cy); /* y is inverted, 0 is at the bottom of the window */