applied some patches
- accessnthmon - ipc - warpcursor
This commit is contained in:
parent
6cd26568d5
commit
566286a9d4
8 changed files with 1059 additions and 5 deletions
73
dwl.c
73
dwl.c
|
|
@ -12,6 +12,7 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wayland-util.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
|
|
@ -282,8 +283,10 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
|
|||
static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||
static Monitor *dirtomon(enum wlr_direction dir);
|
||||
static Monitor *numtomon(int num);
|
||||
static void focusclient(Client *c, int lift);
|
||||
static void focusmon(const Arg *arg);
|
||||
static void focusnthmon(const Arg *arg);
|
||||
static void focusstack(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
|
|
@ -333,6 +336,7 @@ static void spawn(const Arg *arg);
|
|||
static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tagnthmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
|
|
@ -347,6 +351,7 @@ static void urgent(struct wl_listener *listener, void *data);
|
|||
static void view(const Arg *arg);
|
||||
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||
static void virtualpointer(struct wl_listener *listener, void *data);
|
||||
static void warpcursor(const Client *c);
|
||||
static Monitor *xytomon(double x, double y);
|
||||
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
||||
|
|
@ -541,6 +546,7 @@ arrange(Monitor *m)
|
|||
m->lt[m->sellt]->arrange(m);
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
checkidleinhibitor(NULL);
|
||||
warpcursor(focustop(selmon));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1399,6 +1405,25 @@ dirtomon(enum wlr_direction dir)
|
|||
return selmon;
|
||||
}
|
||||
|
||||
Monitor *
|
||||
numtomon(int num)
|
||||
{
|
||||
Monitor *m = NULL;
|
||||
int found = 0;
|
||||
int i = 0;
|
||||
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (!m->wlr_output->enabled)
|
||||
i--;
|
||||
else if (i == num) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return found ? m : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
focusclient(Client *c, int lift)
|
||||
{
|
||||
|
|
@ -1410,6 +1435,10 @@ focusclient(Client *c, int lift)
|
|||
if (locked)
|
||||
return;
|
||||
|
||||
/* Warp cursor to center of client if it is outside */
|
||||
if (lift)
|
||||
warpcursor(c);
|
||||
|
||||
/* Raise client in stacking order if requested */
|
||||
if (c && lift)
|
||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
|
|
@ -1485,6 +1514,16 @@ focusmon(const Arg *arg)
|
|||
focusclient(focustop(selmon), 1);
|
||||
}
|
||||
|
||||
void
|
||||
focusnthmon(const Arg *arg)
|
||||
{
|
||||
Monitor *m = numtomon(arg->i);
|
||||
if (!m || m == selmon)
|
||||
return;
|
||||
selmon = m;
|
||||
focusclient(focustop(selmon), 1);
|
||||
}
|
||||
|
||||
void
|
||||
focusstack(const Arg *arg)
|
||||
{
|
||||
|
|
@ -2708,6 +2747,19 @@ tagmon(const Arg *arg)
|
|||
setmon(sel, dirtomon(arg->i), 0);
|
||||
}
|
||||
|
||||
void
|
||||
tagnthmon(const Arg *arg)
|
||||
{
|
||||
Client *sel = focustop(selmon);
|
||||
Monitor *m = numtomon(arg->i);
|
||||
if (!m || !sel)
|
||||
return;
|
||||
setmon(sel, m, 0);
|
||||
|
||||
arrange(selmon);
|
||||
arrange(m);
|
||||
}
|
||||
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
|
|
@ -3003,6 +3055,27 @@ virtualpointer(struct wl_listener *listener, void *data)
|
|||
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||
}
|
||||
|
||||
void
|
||||
warpcursor(const Client *c) {
|
||||
if (cursor_mode != CurNormal) {
|
||||
return;
|
||||
}
|
||||
if (!c && selmon) {
|
||||
wlr_cursor_warp_closest(cursor,
|
||||
NULL,
|
||||
selmon->w.x + selmon->w.width / 2.0 ,
|
||||
selmon->w.y + selmon->w.height / 2.0);
|
||||
}
|
||||
else if ( c && (cursor->x < c->geom.x ||
|
||||
cursor->x > c->geom.x + c->geom.width ||
|
||||
cursor->y < c->geom.y ||
|
||||
cursor->y > c->geom.y + c->geom.height))
|
||||
wlr_cursor_warp_closest(cursor,
|
||||
NULL,
|
||||
c->geom.x + c->geom.width / 2.0,
|
||||
c->geom.y + c->geom.height / 2.0);
|
||||
}
|
||||
|
||||
Monitor *
|
||||
xytomon(double x, double y)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue