mirror of
https://github.com/tiyn/dwl.git
synced 2026-01-11 17:39:45 +01:00
Compare commits
1 Commits
unclutter
...
smartborde
| Author | SHA1 | Date | |
|---|---|---|---|
| d3ed88f487 |
@@ -6,6 +6,7 @@
|
||||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
static const int smartborders = 1;
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const float rootcolor[] = COLOR(0x222222ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
@@ -106,8 +107,6 @@ LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
||||
*/
|
||||
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
||||
|
||||
static const int cursor_timeout = 5;
|
||||
|
||||
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
|
||||
#define MODKEY WLR_MODIFIER_ALT
|
||||
|
||||
|
||||
116
dwl.c
116
dwl.c
@@ -288,8 +288,6 @@ static void focusstack(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void gpureset(struct wl_listener *listener, void *data);
|
||||
static void handlecursoractivity(void);
|
||||
static int hidecursor(void *data);
|
||||
static void handlesig(int signo);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
@@ -319,7 +317,7 @@ static void rendermon(struct wl_listener *listener, void *data);
|
||||
static void requestdecorationmode(struct wl_listener *listener, void *data);
|
||||
static void requeststartdrag(struct wl_listener *listener, void *data);
|
||||
static void requestmonstate(struct wl_listener *listener, void *data);
|
||||
static void resize(Client *c, struct wlr_box geo, int interact);
|
||||
static void resize(Client *c, struct wlr_box geo, int interact, int draw_borders);
|
||||
static void run(char *startup_cmd);
|
||||
static void setcursor(struct wl_listener *listener, void *data);
|
||||
static void setcursorshape(struct wl_listener *listener, void *data);
|
||||
@@ -391,14 +389,6 @@ static struct wlr_pointer_constraint_v1 *active_constraint;
|
||||
|
||||
static struct wlr_cursor *cursor;
|
||||
static struct wlr_xcursor_manager *cursor_mgr;
|
||||
static struct wl_event_source *hide_source;
|
||||
static bool cursor_hidden = false;
|
||||
static struct {
|
||||
enum wp_cursor_shape_device_v1_shape shape;
|
||||
struct wlr_surface *surface;
|
||||
int hotspot_x;
|
||||
int hotspot_y;
|
||||
} last_cursor;
|
||||
|
||||
static struct wlr_scene_rect *root_bg;
|
||||
static struct wlr_session_lock_manager_v1 *session_lock_mgr;
|
||||
@@ -619,7 +609,6 @@ axisnotify(struct wl_listener *listener, void *data)
|
||||
* for example when you move the scroll wheel. */
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
handlecursoractivity();
|
||||
/* TODO: allow usage of scroll whell for mousebindings, it can be implemented
|
||||
* checking the event's orientation and the delta of the event */
|
||||
/* Notify the client with pointer focus of the axis event. */
|
||||
@@ -638,7 +627,6 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
const Button *b;
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
handlecursoractivity();
|
||||
|
||||
switch (event->state) {
|
||||
case WL_POINTER_BUTTON_STATE_PRESSED:
|
||||
@@ -818,7 +806,7 @@ closemon(Monitor *m)
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->isfloating && c->geom.x > m->m.width)
|
||||
resize(c, (struct wlr_box){.x = c->geom.x - m->w.width, .y = c->geom.y,
|
||||
.width = c->geom.width, .height = c->geom.height}, 0);
|
||||
.width = c->geom.width, .height = c->geom.height}, 0, 1);
|
||||
if (c->mon == m)
|
||||
setmon(c, selmon, c->tags);
|
||||
}
|
||||
@@ -887,7 +875,11 @@ commitnotify(struct wl_listener *listener, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
resize(c, c->geom, (c->isfloating && !c->isfullscreen));
|
||||
if (client_surface(c)->mapped && c->mon && c->mon->lt[c->mon->sellt]->arrange
|
||||
&& !c->isfullscreen && !c->isfloating)
|
||||
c->mon->lt[c->mon->sellt]->arrange(c->mon);
|
||||
else
|
||||
resize(c, c->geom, (c->isfloating && !c->isfullscreen), (c->isfloating && !c->isfullscreen));
|
||||
|
||||
/* mark a pending resize as completed */
|
||||
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
|
||||
@@ -1575,32 +1567,6 @@ handlesig(int signo)
|
||||
quit(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
handlecursoractivity(void)
|
||||
{
|
||||
wl_event_source_timer_update(hide_source, cursor_timeout * 1000);
|
||||
|
||||
if (!cursor_hidden)
|
||||
return;
|
||||
|
||||
cursor_hidden = false;
|
||||
|
||||
if (last_cursor.shape)
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
wlr_cursor_shape_v1_name(last_cursor.shape));
|
||||
else
|
||||
wlr_cursor_set_surface(cursor, last_cursor.surface,
|
||||
last_cursor.hotspot_x, last_cursor.hotspot_y);
|
||||
}
|
||||
|
||||
int
|
||||
hidecursor(void *data)
|
||||
{
|
||||
wlr_cursor_unset_image(cursor);
|
||||
cursor_hidden = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
||||
@@ -1863,7 +1829,7 @@ monocle(Monitor *m)
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
resize(c, m->w, 0);
|
||||
resize(c, m->w, 0, !smartborders);
|
||||
n++;
|
||||
}
|
||||
if (n)
|
||||
@@ -1942,7 +1908,6 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
|
||||
wlr_cursor_move(cursor, device, dx, dy);
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
handlecursoractivity();
|
||||
|
||||
/* Update selmon (even while dragging a window) */
|
||||
if (sloppyfocus)
|
||||
@@ -1956,18 +1921,18 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
if (cursor_mode == CurMove) {
|
||||
/* Move the grabbed client to the new position. */
|
||||
resize(grabc, (struct wlr_box){.x = (int)round(cursor->x) - grabcx, .y = (int)round(cursor->y) - grabcy,
|
||||
.width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||
.width = grabc->geom.width, .height = grabc->geom.height}, 1, 1);
|
||||
return;
|
||||
} else if (cursor_mode == CurResize) {
|
||||
resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||
.width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||
.width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If there's no client surface under the cursor, set the cursor image to a
|
||||
* default. This is what makes the cursor image appear when you move it
|
||||
* off of a client or over its border. */
|
||||
if (!surface && !seat->drag && !cursor_hidden)
|
||||
if (!surface && !seat->drag)
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
|
||||
pointerfocus(c, surface, sx, sy, time);
|
||||
@@ -2239,7 +2204,7 @@ requestmonstate(struct wl_listener *listener, void *data)
|
||||
}
|
||||
|
||||
void
|
||||
resize(Client *c, struct wlr_box geo, int interact)
|
||||
resize(Client *c, struct wlr_box geo, int interact, int draw_borders)
|
||||
{
|
||||
struct wlr_box *bbox;
|
||||
struct wlr_box clip;
|
||||
@@ -2251,6 +2216,7 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||
|
||||
client_set_bounds(c, geo.width, geo.height);
|
||||
c->geom = geo;
|
||||
c->bw = draw_borders ? borderpx : 0;
|
||||
applybounds(c, bbox);
|
||||
|
||||
/* Update scene-graph, including borders */
|
||||
@@ -2322,7 +2288,6 @@ run(char *startup_cmd)
|
||||
* monitor when displayed here */
|
||||
wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y);
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
handlecursoractivity();
|
||||
|
||||
/* Run the Wayland event loop. This does not return until you exit the
|
||||
* compositor. Starting the backend rigged up all of the necessary event
|
||||
@@ -2346,16 +2311,9 @@ setcursor(struct wl_listener *listener, void *data)
|
||||
* use the provided surface as the cursor image. It will set the
|
||||
* hardware cursor on the output that it's currently on and continue to
|
||||
* do so as the cursor moves between outputs. */
|
||||
if (event->seat_client == seat->pointer_state.focused_client) {
|
||||
last_cursor.shape = 0;
|
||||
last_cursor.surface = event->surface;
|
||||
last_cursor.hotspot_x = event->hotspot_x;
|
||||
last_cursor.hotspot_y = event->hotspot_y;
|
||||
|
||||
if (!cursor_hidden)
|
||||
wlr_cursor_set_surface(cursor, event->surface,
|
||||
event->hotspot_x, event->hotspot_y);
|
||||
}
|
||||
if (event->seat_client == seat->pointer_state.focused_client)
|
||||
wlr_cursor_set_surface(cursor, event->surface,
|
||||
event->hotspot_x, event->hotspot_y);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2367,14 +2325,9 @@ setcursorshape(struct wl_listener *listener, void *data)
|
||||
/* This can be sent by any client, so we check to make sure this one is
|
||||
* actually has pointer focus first. If so, we can tell the cursor to
|
||||
* use the provided cursor shape. */
|
||||
if (event->seat_client == seat->pointer_state.focused_client) {
|
||||
last_cursor.shape = event->shape;
|
||||
last_cursor.surface = NULL;
|
||||
|
||||
if (!cursor_hidden)
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
wlr_cursor_shape_v1_name(event->shape));
|
||||
}
|
||||
if (event->seat_client == seat->pointer_state.focused_client)
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
wlr_cursor_shape_v1_name(event->shape));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2388,6 +2341,8 @@ setfloating(Client *c, int floating)
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ||
|
||||
(p && p->isfullscreen) ? LyrFS
|
||||
: c->isfloating ? LyrFloat : LyrTile]);
|
||||
if (c->isfloating && !c->bw)
|
||||
resize(c, c->mon->m, 0, 1);
|
||||
arrange(c->mon);
|
||||
printstatus();
|
||||
}
|
||||
@@ -2405,11 +2360,11 @@ setfullscreen(Client *c, int fullscreen)
|
||||
|
||||
if (fullscreen) {
|
||||
c->prev = c->geom;
|
||||
resize(c, c->mon->m, 0);
|
||||
resize(c, c->mon->m, 0, 0);
|
||||
} else {
|
||||
/* restore previous size instead of arrange for floating windows since
|
||||
* client positions are set by the user and cannot be recalculated */
|
||||
resize(c, c->prev, 0);
|
||||
resize(c, c->prev, 0, 1);
|
||||
}
|
||||
arrange(c->mon);
|
||||
printstatus();
|
||||
@@ -2425,6 +2380,12 @@ setlayout(const Arg *arg)
|
||||
if (arg && arg->v)
|
||||
selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
|
||||
if (!selmon->lt[selmon->sellt]->arrange) {
|
||||
/* floating layout, draw borders around all clients */
|
||||
Client *c;
|
||||
wl_list_for_each(c, &clients, link)
|
||||
resize(c, c->mon->m, 0, 1);
|
||||
}
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
}
|
||||
@@ -2459,7 +2420,7 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
|
||||
arrange(oldmon);
|
||||
if (m) {
|
||||
/* Make sure window actually overlaps with the monitor */
|
||||
resize(c, c->geom, 0);
|
||||
resize(c, c->geom, 0, 1);
|
||||
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
|
||||
setfloating(c, c->isfloating);
|
||||
@@ -2665,9 +2626,6 @@ setup(void)
|
||||
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
|
||||
wl_signal_add(&cursor_shape_mgr->events.request_set_shape, &request_set_cursor_shape);
|
||||
|
||||
hide_source = wl_event_loop_add_timer(wl_display_get_event_loop(dpy),
|
||||
hidecursor, cursor);
|
||||
|
||||
/*
|
||||
* Configures a seat, which is a single "seat" at which a user sits and
|
||||
* operates the computer. This conceptually includes up to one keyboard,
|
||||
@@ -2762,7 +2720,7 @@ tagmon(const Arg *arg)
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int mw, my, ty;
|
||||
unsigned int mw, my, ty, draw_borders = 1;
|
||||
int i, n = 0;
|
||||
Client *c;
|
||||
|
||||
@@ -2772,6 +2730,9 @@ tile(Monitor *m)
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
if (n == smartborders)
|
||||
draw_borders = 0;
|
||||
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
|
||||
else
|
||||
@@ -2782,11 +2743,11 @@ tile(Monitor *m)
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
||||
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
||||
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0, draw_borders);
|
||||
my += c->geom.height;
|
||||
} else {
|
||||
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
|
||||
.width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
|
||||
.width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0, draw_borders);
|
||||
ty += c->geom.height;
|
||||
}
|
||||
i++;
|
||||
@@ -2955,7 +2916,7 @@ updatemons(struct wl_listener *listener, void *data)
|
||||
arrange(m);
|
||||
/* make sure fullscreen clients have the right size */
|
||||
if ((c = focustop(m)) && c->isfullscreen)
|
||||
resize(c, m->m, 0);
|
||||
resize(c, m->m, 0, 0);
|
||||
|
||||
/* Try to re-set the gamma LUT when updating monitors,
|
||||
* it's only really needed when enabling a disabled output, but meh. */
|
||||
@@ -3052,7 +3013,6 @@ virtualpointer(struct wl_listener *listener, void *data)
|
||||
wlr_cursor_attach_input_device(cursor, device);
|
||||
if (event->suggested_output)
|
||||
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||
handlecursoractivity();
|
||||
}
|
||||
|
||||
Monitor *
|
||||
@@ -3165,7 +3125,7 @@ configurex11(struct wl_listener *listener, void *data)
|
||||
if ((c->isfloating && c != grabc) || !c->mon->lt[c->mon->sellt]->arrange) {
|
||||
resize(c, (struct wlr_box){.x = event->x - c->bw,
|
||||
.y = event->y - c->bw, .width = event->width + c->bw * 2,
|
||||
.height = event->height + c->bw * 2}, 0);
|
||||
.height = event->height + c->bw * 2}, 0, 1);
|
||||
} else {
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
188
unclutter.patch
188
unclutter.patch
@@ -1,188 +0,0 @@
|
||||
From 52d5a05a6b4ca9555c072e103c2db454d2b35021 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Thu, 25 Jul 2024 17:59:05 +0200
|
||||
Subject: [PATCH] =?UTF-8?q?hide=20the=20mouse=20cursor=20if=20it=20isn?=
|
||||
=?UTF-8?q?=E2=80=99t=20being=20used?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
2 files changed, 65 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..790c73d 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -106,6 +106,8 @@ LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
||||
*/
|
||||
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
||||
|
||||
+static const int cursor_timeout = 5;
|
||||
+
|
||||
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
|
||||
#define MODKEY WLR_MODIFIER_ALT
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 72892d9..4090d73 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -292,6 +292,8 @@ static void focusstack(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void gpureset(struct wl_listener *listener, void *data);
|
||||
+static void handlecursoractivity(void);
|
||||
+static int hidecursor(void *data);
|
||||
static void handlesig(int signo);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
@@ -396,6 +398,14 @@ static struct wlr_pointer_constraint_v1 *active_constraint;
|
||||
|
||||
static struct wlr_cursor *cursor;
|
||||
static struct wlr_xcursor_manager *cursor_mgr;
|
||||
+static struct wl_event_source *hide_source;
|
||||
+static bool cursor_hidden = false;
|
||||
+static struct {
|
||||
+ enum wp_cursor_shape_device_v1_shape shape;
|
||||
+ struct wlr_surface *surface;
|
||||
+ int hotspot_x;
|
||||
+ int hotspot_y;
|
||||
+} last_cursor;
|
||||
|
||||
static struct wlr_scene_rect *root_bg;
|
||||
static struct wlr_session_lock_manager_v1 *session_lock_mgr;
|
||||
@@ -588,6 +598,7 @@ axisnotify(struct wl_listener *listener, void *data)
|
||||
* for example when you move the scroll wheel. */
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
+ handlecursoractivity();
|
||||
/* TODO: allow usage of scroll whell for mousebindings, it can be implemented
|
||||
* checking the event's orientation and the delta of the event */
|
||||
/* Notify the client with pointer focus of the axis event. */
|
||||
@@ -606,6 +617,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
const Button *b;
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
+ handlecursoractivity();
|
||||
|
||||
switch (event->state) {
|
||||
case WL_POINTER_BUTTON_STATE_PRESSED:
|
||||
@@ -1517,6 +1529,32 @@ handlesig(int signo)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+handlecursoractivity(void)
|
||||
+{
|
||||
+ wl_event_source_timer_update(hide_source, cursor_timeout * 1000);
|
||||
+
|
||||
+ if (!cursor_hidden)
|
||||
+ return;
|
||||
+
|
||||
+ cursor_hidden = false;
|
||||
+
|
||||
+ if (last_cursor.shape)
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
+ wlr_cursor_shape_v1_name(last_cursor.shape));
|
||||
+ else
|
||||
+ wlr_cursor_set_surface(cursor, last_cursor.surface,
|
||||
+ last_cursor.hotspot_x, last_cursor.hotspot_y);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+hidecursor(void *data)
|
||||
+{
|
||||
+ wlr_cursor_unset_image(cursor);
|
||||
+ cursor_hidden = true;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
||||
@@ -1856,6 +1894,7 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
|
||||
wlr_cursor_move(cursor, device, dx, dy);
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
+ handlecursoractivity();
|
||||
|
||||
/* Update selmon (even while dragging a window) */
|
||||
if (sloppyfocus)
|
||||
@@ -1880,7 +1919,7 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
/* If there's no client surface under the cursor, set the cursor image to a
|
||||
* default. This is what makes the cursor image appear when you move it
|
||||
* off of a client or over its border. */
|
||||
- if (!surface && !seat->drag)
|
||||
+ if (!surface && !seat->drag && !cursor_hidden)
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
|
||||
pointerfocus(c, surface, sx, sy, time);
|
||||
@@ -2263,6 +2302,7 @@ run(char *startup_cmd)
|
||||
* monitor when displayed here */
|
||||
wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y);
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
+ handlecursoractivity();
|
||||
|
||||
/* Run the Wayland event loop. This does not return until you exit the
|
||||
* compositor. Starting the backend rigged up all of the necessary event
|
||||
@@ -2286,9 +2326,16 @@ setcursor(struct wl_listener *listener, void *data)
|
||||
* use the provided surface as the cursor image. It will set the
|
||||
* hardware cursor on the output that it's currently on and continue to
|
||||
* do so as the cursor moves between outputs. */
|
||||
- if (event->seat_client == seat->pointer_state.focused_client)
|
||||
- wlr_cursor_set_surface(cursor, event->surface,
|
||||
- event->hotspot_x, event->hotspot_y);
|
||||
+ if (event->seat_client == seat->pointer_state.focused_client) {
|
||||
+ last_cursor.shape = 0;
|
||||
+ last_cursor.surface = event->surface;
|
||||
+ last_cursor.hotspot_x = event->hotspot_x;
|
||||
+ last_cursor.hotspot_y = event->hotspot_y;
|
||||
+
|
||||
+ if (!cursor_hidden)
|
||||
+ wlr_cursor_set_surface(cursor, event->surface,
|
||||
+ event->hotspot_x, event->hotspot_y);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2300,9 +2347,14 @@ setcursorshape(struct wl_listener *listener, void *data)
|
||||
/* This can be sent by any client, so we check to make sure this one is
|
||||
* actually has pointer focus first. If so, we can tell the cursor to
|
||||
* use the provided cursor shape. */
|
||||
- if (event->seat_client == seat->pointer_state.focused_client)
|
||||
- wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
- wlr_cursor_shape_v1_name(event->shape));
|
||||
+ if (event->seat_client == seat->pointer_state.focused_client) {
|
||||
+ last_cursor.shape = event->shape;
|
||||
+ last_cursor.surface = NULL;
|
||||
+
|
||||
+ if (!cursor_hidden)
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
+ wlr_cursor_shape_v1_name(event->shape));
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2604,6 +2656,9 @@ setup(void)
|
||||
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
|
||||
LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape);
|
||||
|
||||
+ hide_source = wl_event_loop_add_timer(wl_display_get_event_loop(dpy),
|
||||
+ hidecursor, cursor);
|
||||
+
|
||||
/*
|
||||
* Configures a seat, which is a single "seat" at which a user sits and
|
||||
* operates the computer. This conceptually includes up to one keyboard,
|
||||
@@ -2986,6 +3041,7 @@ virtualpointer(struct wl_listener *listener, void *data)
|
||||
wlr_cursor_attach_input_device(cursor, device);
|
||||
if (event->suggested_output)
|
||||
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||
+ handlecursoractivity();
|
||||
}
|
||||
|
||||
Monitor *
|
||||
--
|
||||
2.45.2
|
||||
|
||||
Reference in New Issue
Block a user