funnel isfloating changes through setfloating()

main
Devin J. Pohly 2020-04-26 21:55:49 -05:00
parent ce5d116efd
commit 499a43db74
1 changed files with 12 additions and 5 deletions

17
dwl.c
View File

@ -162,6 +162,7 @@ static void run(char *startup_cmd);
static void scalebox(struct wlr_box *box, float scale); static void scalebox(struct wlr_box *box, float scale);
static Client *selclient(void); static Client *selclient(void);
static void setcursor(struct wl_listener *listener, void *data); static void setcursor(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m); static void setmon(Client *c, Monitor *m);
@ -736,8 +737,7 @@ movemouse(const Arg *arg)
return; return;
/* Float the window and tell motionnotify to grab it */ /* Float the window and tell motionnotify to grab it */
if (!grabc->isfloating && selmon->lt[selmon->sellt]->arrange) setfloating(grabc, 1);
grabc->isfloating = 1;
cursor_mode = CurMove; cursor_mode = CurMove;
wlr_xcursor_manager_set_cursor_image(cursor_mgr, "fleur", cursor); wlr_xcursor_manager_set_cursor_image(cursor_mgr, "fleur", cursor);
} }
@ -957,8 +957,7 @@ resizemouse(const Arg *arg)
grabc->x + grabc->w, grabc->y + grabc->h); grabc->x + grabc->w, grabc->y + grabc->h);
/* Float the window and tell motionnotify to resize it */ /* Float the window and tell motionnotify to resize it */
if (!grabc->isfloating && selmon->lt[selmon->sellt]->arrange) setfloating(grabc, 1);
grabc->isfloating = 1;
cursor_mode = CurResize; cursor_mode = CurResize;
wlr_xcursor_manager_set_cursor_image(cursor_mgr, wlr_xcursor_manager_set_cursor_image(cursor_mgr,
"bottom_right_corner", cursor); "bottom_right_corner", cursor);
@ -1063,6 +1062,14 @@ setcursor(struct wl_listener *listener, void *data)
event->hotspot_x, event->hotspot_y); event->hotspot_x, event->hotspot_y);
} }
void
setfloating(Client *c, int floating)
{
if (c->isfloating == floating)
return;
c->isfloating = floating;
}
void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
@ -1282,7 +1289,7 @@ togglefloating(const Arg *arg)
if (!sel) if (!sel)
return; return;
/* return if fullscreen */ /* return if fullscreen */
sel->isfloating = !sel->isfloating /* || sel->isfixed */; setfloating(sel, !sel->isfloating /* || sel->isfixed */);
} }
void void