summaryrefslogtreecommitdiffstats
path: root/dwl.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dwl.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/dwl.c b/dwl.c
index 9bb4702..2ed00f4 100644
--- a/dwl.c
+++ b/dwl.c
@@ -385,6 +385,7 @@ static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
static void togglegaps(const Arg *arg);
+static void togglepointerconstraints(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data);
@@ -454,6 +455,8 @@ static unsigned int cursor_mode;
static Client *grabc;
static int grabcx, grabcy; /* client-relative */
+static int enable_constraints = 1;
+
static struct wlr_output_layout *output_layout;
static struct wlr_box sgeom;
static struct wl_list mons;
@@ -2260,22 +2263,24 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
relative_pointer_mgr, seat, (uint64_t)time * 1000,
dx, dy, dx_unaccel, dy_unaccel);
- wl_list_for_each(constraint, &pointer_constraints->constraints, link)
- cursorconstrain(constraint);
-
- if (active_constraint && cursor_mode != CurResize && cursor_mode != CurMove) {
- toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);
- if (c && active_constraint->surface == seat->pointer_state.focused_surface) {
- sx = cursor->x - c->geom.x - c->bw;
- sy = cursor->y - c->geom.y - c->bw;
- if (wlr_region_confine(&active_constraint->region, sx, sy,
- sx + dx, sy + dy, &sx_confined, &sy_confined)) {
- dx = sx_confined - sx;
- dy = sy_confined - sy;
+ if (enable_constraints){
+ wl_list_for_each(constraint, &pointer_constraints->constraints, link)
+ cursorconstrain(constraint);
+
+ if (active_constraint && cursor_mode != CurResize && cursor_mode != CurMove) {
+ toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);
+ if (c && active_constraint->surface == seat->pointer_state.focused_surface) {
+ sx = cursor->x - c->geom.x - c->bw;
+ sy = cursor->y - c->geom.y - c->bw;
+ if (wlr_region_confine(&active_constraint->region, sx, sy,
+ sx + dx, sy + dy, &sx_confined, &sy_confined)) {
+ dx = sx_confined - sx;
+ dy = sy_confined - sy;
+ }
+
+ if (active_constraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED)
+ return;
}
-
- if (active_constraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED)
- return;
}
}
@@ -3180,6 +3185,12 @@ togglegaps(const Arg *arg)
}
void
+togglepointerconstraints(const Arg *arg)
+{
+ enable_constraints = !enable_constraints;
+}
+
+void
toggletag(const Arg *arg)
{
uint32_t newtags;