mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-26 11:16:30 +00:00
Merge remote-tracking branch 'upstream/main' into wlroots-next
This commit is contained in:
commit
72e2ce8b00
4 changed files with 139 additions and 33 deletions
17
Makefile
17
Makefile
|
@ -16,7 +16,7 @@ LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS)
|
||||||
all: dwl
|
all: dwl
|
||||||
dwl: dwl.o util.o
|
dwl: dwl.o util.o
|
||||||
$(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
|
$(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
|
||||||
dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
|
dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h
|
||||||
util.o: util.c util.h
|
util.o: util.c util.h
|
||||||
|
|
||||||
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
||||||
|
@ -25,15 +25,18 @@ util.o: util.c util.h
|
||||||
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
||||||
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
||||||
|
|
||||||
xdg-shell-protocol.h:
|
|
||||||
$(WAYLAND_SCANNER) server-header \
|
|
||||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
|
||||||
wlr-layer-shell-unstable-v1-protocol.h:
|
|
||||||
$(WAYLAND_SCANNER) server-header \
|
|
||||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
|
||||||
cursor-shape-v1-protocol.h:
|
cursor-shape-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) server-header \
|
||||||
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
||||||
|
pointer-constraints-unstable-v1-protocol.h:
|
||||||
|
$(WAYLAND_SCANNER) server-header \
|
||||||
|
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
||||||
|
wlr-layer-shell-unstable-v1-protocol.h:
|
||||||
|
$(WAYLAND_SCANNER) server-header \
|
||||||
|
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||||
|
xdg-shell-protocol.h:
|
||||||
|
$(WAYLAND_SCANNER) server-header \
|
||||||
|
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||||
|
|
||||||
config.h:
|
config.h:
|
||||||
cp config.def.h $@
|
cp config.def.h $@
|
||||||
|
|
4
client.h
4
client.h
|
@ -379,10 +379,8 @@ static inline void
|
||||||
client_set_suspended(Client *c, int suspended)
|
client_set_suspended(Client *c, int suspended)
|
||||||
{
|
{
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c))
|
||||||
wlr_xwayland_surface_set_withdrawn(c->surface.xwayland, suspended);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
|
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
|
||||||
|
|
12
config.def.h
12
config.def.h
|
@ -11,7 +11,7 @@ static const float rootcolor[] = COLOR(0x222222ff);
|
||||||
static const float bordercolor[] = COLOR(0x444444ff);
|
static const float bordercolor[] = COLOR(0x444444ff);
|
||||||
static const float focuscolor[] = COLOR(0x005577ff);
|
static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
|
||||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
|
@ -21,11 +21,10 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||||
static int log_level = WLR_ERROR;
|
static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* app_id title tags mask isfloating monitor */
|
/* app_id title tags mask isfloating monitor */
|
||||||
/* examples:
|
/* examples: */
|
||||||
{ "Gimp", NULL, 0, 1, -1 },
|
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
*/
|
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||||
{ "firefox", NULL, 1 << 8, 0, -1 },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
|
@ -95,6 +94,7 @@ LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
||||||
*/
|
*/
|
||||||
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
||||||
static const double accel_speed = 0.0;
|
static const double accel_speed = 0.0;
|
||||||
|
|
||||||
/* You can choose between:
|
/* You can choose between:
|
||||||
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
|
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
|
||||||
LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
||||||
|
|
139
dwl.c
139
dwl.c
|
@ -35,9 +35,11 @@
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/types/wlr_output_management_v1.h>
|
#include <wlr/types/wlr_output_management_v1.h>
|
||||||
#include <wlr/types/wlr_pointer.h>
|
#include <wlr/types/wlr_pointer.h>
|
||||||
|
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
||||||
#include <wlr/types/wlr_presentation_time.h>
|
#include <wlr/types/wlr_presentation_time.h>
|
||||||
#include <wlr/types/wlr_primary_selection.h>
|
#include <wlr/types/wlr_primary_selection.h>
|
||||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||||
|
#include <wlr/types/wlr_relative_pointer_v1.h>
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include <wlr/types/wlr_screencopy_v1.h>
|
#include <wlr/types/wlr_screencopy_v1.h>
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include <wlr/types/wlr_seat.h>
|
||||||
|
@ -54,6 +56,7 @@
|
||||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
#include <wlr/util/region.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
|
@ -214,6 +217,11 @@ typedef struct {
|
||||||
int x, y;
|
int x, y;
|
||||||
} MonitorRule;
|
} MonitorRule;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
struct wlr_pointer_constraint_v1 *constraint;
|
||||||
|
struct wl_listener destroy;
|
||||||
|
} PointerConstraint;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *id;
|
const char *id;
|
||||||
const char *title;
|
const char *title;
|
||||||
|
@ -256,8 +264,11 @@ static void createlocksurface(struct wl_listener *listener, void *data);
|
||||||
static void createmon(struct wl_listener *listener, void *data);
|
static void createmon(struct wl_listener *listener, void *data);
|
||||||
static void createnotify(struct wl_listener *listener, void *data);
|
static void createnotify(struct wl_listener *listener, void *data);
|
||||||
static void createpointer(struct wlr_pointer *pointer);
|
static void createpointer(struct wlr_pointer *pointer);
|
||||||
|
static void createpointerconstraint(struct wl_listener *listener, void *data);
|
||||||
static void createpopup(struct wl_listener *listener, void *data);
|
static void createpopup(struct wl_listener *listener, void *data);
|
||||||
|
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
||||||
static void cursorframe(struct wl_listener *listener, void *data);
|
static void cursorframe(struct wl_listener *listener, void *data);
|
||||||
|
static void cursorwarptohint(void);
|
||||||
static void destroydecoration(struct wl_listener *listener, void *data);
|
static void destroydecoration(struct wl_listener *listener, void *data);
|
||||||
static void destroydragicon(struct wl_listener *listener, void *data);
|
static void destroydragicon(struct wl_listener *listener, void *data);
|
||||||
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
||||||
|
@ -265,6 +276,7 @@ static void destroylayersurfacenotify(struct wl_listener *listener, void *data);
|
||||||
static void destroylock(SessionLock *lock, int unlocked);
|
static void destroylock(SessionLock *lock, int unlocked);
|
||||||
static void destroylocksurface(struct wl_listener *listener, void *data);
|
static void destroylocksurface(struct wl_listener *listener, void *data);
|
||||||
static void destroynotify(struct wl_listener *listener, void *data);
|
static void destroynotify(struct wl_listener *listener, void *data);
|
||||||
|
static void destroypointerconstraint(struct wl_listener *listener, void *data);
|
||||||
static void destroysessionlock(struct wl_listener *listener, void *data);
|
static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||||
static void destroysessionmgr(struct wl_listener *listener, void *data);
|
static void destroysessionmgr(struct wl_listener *listener, void *data);
|
||||||
static Monitor *dirtomon(enum wlr_direction dir);
|
static Monitor *dirtomon(enum wlr_direction dir);
|
||||||
|
@ -287,7 +299,8 @@ static void mapnotify(struct wl_listener *listener, void *data);
|
||||||
static void maximizenotify(struct wl_listener *listener, void *data);
|
static void maximizenotify(struct wl_listener *listener, void *data);
|
||||||
static void monocle(Monitor *m);
|
static void monocle(Monitor *m);
|
||||||
static void motionabsolute(struct wl_listener *listener, void *data);
|
static void motionabsolute(struct wl_listener *listener, void *data);
|
||||||
static void motionnotify(uint32_t time);
|
static void motionnotify(uint32_t time, struct wlr_input_device *device, double sx,
|
||||||
|
double sy, double sx_unaccel, double sy_unaccel);
|
||||||
static void motionrelative(struct wl_listener *listener, void *data);
|
static void motionrelative(struct wl_listener *listener, void *data);
|
||||||
static void moveresize(const Arg *arg);
|
static void moveresize(const Arg *arg);
|
||||||
static void outputmgrapply(struct wl_listener *listener, void *data);
|
static void outputmgrapply(struct wl_listener *listener, void *data);
|
||||||
|
@ -369,6 +382,10 @@ static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
|
||||||
static struct wlr_virtual_pointer_manager_v1 *virtual_pointer_mgr;
|
static struct wlr_virtual_pointer_manager_v1 *virtual_pointer_mgr;
|
||||||
static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr;
|
static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr;
|
||||||
|
|
||||||
|
static struct wlr_pointer_constraints_v1 *pointer_constraints;
|
||||||
|
static struct wlr_relative_pointer_manager_v1 *relative_pointer_mgr;
|
||||||
|
static struct wlr_pointer_constraint_v1 *active_constraint;
|
||||||
|
|
||||||
static struct wlr_cursor *cursor;
|
static struct wlr_cursor *cursor;
|
||||||
static struct wlr_xcursor_manager *cursor_mgr;
|
static struct wlr_xcursor_manager *cursor_mgr;
|
||||||
|
|
||||||
|
@ -481,7 +498,7 @@ arrange(Monitor *m)
|
||||||
|
|
||||||
if (m->lt[m->sellt]->arrange)
|
if (m->lt[m->sellt]->arrange)
|
||||||
m->lt[m->sellt]->arrange(m);
|
m->lt[m->sellt]->arrange(m);
|
||||||
motionnotify(0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
checkidleinhibitor(NULL);
|
checkidleinhibitor(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,6 +1047,15 @@ createpointer(struct wlr_pointer *pointer)
|
||||||
wlr_cursor_attach_input_device(cursor, &pointer->base);
|
wlr_cursor_attach_input_device(cursor, &pointer->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
createpointerconstraint(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
PointerConstraint *pointer_constraint = ecalloc(1, sizeof(*pointer_constraint));
|
||||||
|
pointer_constraint->constraint = data;
|
||||||
|
LISTEN(&pointer_constraint->constraint->events.destroy,
|
||||||
|
&pointer_constraint->destroy, destroypointerconstraint);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
createpopup(struct wl_listener *listener, void *data)
|
createpopup(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1039,6 +1065,19 @@ createpopup(struct wl_listener *listener, void *data)
|
||||||
LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup);
|
LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
|
||||||
|
{
|
||||||
|
if (active_constraint == constraint)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (active_constraint)
|
||||||
|
wlr_pointer_constraint_v1_send_deactivated(active_constraint);
|
||||||
|
|
||||||
|
active_constraint = constraint;
|
||||||
|
wlr_pointer_constraint_v1_send_activated(constraint);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cursorframe(struct wl_listener *listener, void *data)
|
cursorframe(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1050,6 +1089,20 @@ cursorframe(struct wl_listener *listener, void *data)
|
||||||
wlr_seat_pointer_notify_frame(seat);
|
wlr_seat_pointer_notify_frame(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cursorwarptohint(void)
|
||||||
|
{
|
||||||
|
Client *c = NULL;
|
||||||
|
double sx = active_constraint->current.cursor_hint.x;
|
||||||
|
double sy = active_constraint->current.cursor_hint.y;
|
||||||
|
|
||||||
|
toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);
|
||||||
|
if (c && active_constraint->current.cursor_hint.enabled) {
|
||||||
|
wlr_cursor_warp(cursor, NULL, sx + c->geom.x + c->bw, sy + c->geom.y + c->bw);
|
||||||
|
wlr_seat_pointer_warp(active_constraint->seat, sx, sy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
destroydecoration(struct wl_listener *listener, void *data)
|
destroydecoration(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1065,7 +1118,7 @@ destroydragicon(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
/* Focus enter isn't sent during drag, so refocus the focused node. */
|
/* Focus enter isn't sent during drag, so refocus the focused node. */
|
||||||
focusclient(focustop(selmon), 1);
|
focusclient(focustop(selmon), 1);
|
||||||
motionnotify(0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1101,7 +1154,7 @@ destroylock(SessionLock *lock, int unlock)
|
||||||
wlr_scene_node_set_enabled(&locked_bg->node, 0);
|
wlr_scene_node_set_enabled(&locked_bg->node, 0);
|
||||||
|
|
||||||
focusclient(focustop(selmon), 0);
|
focusclient(focustop(selmon), 0);
|
||||||
motionnotify(0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
|
|
||||||
destroy:
|
destroy:
|
||||||
wl_list_remove(&lock->new_surface.link);
|
wl_list_remove(&lock->new_surface.link);
|
||||||
|
@ -1160,6 +1213,20 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||||
free(c);
|
free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
destroypointerconstraint(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
PointerConstraint *pointer_constraint = wl_container_of(listener, pointer_constraint, destroy);
|
||||||
|
|
||||||
|
if (active_constraint == pointer_constraint->constraint) {
|
||||||
|
cursorwarptohint();
|
||||||
|
active_constraint = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wl_list_remove(&pointer_constraint->destroy.link);
|
||||||
|
free(pointer_constraint);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
destroysessionlock(struct wl_listener *listener, void *data)
|
destroysessionlock(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1256,7 +1323,7 @@ focusclient(Client *c, int lift)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change cursor surface */
|
/* Change cursor surface */
|
||||||
motionnotify(0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
|
|
||||||
/* Have a client, so focus its top-level wlr_surface */
|
/* Have a client, so focus its top-level wlr_surface */
|
||||||
client_notify_enter(client_surface(c), wlr_seat_get_keyboard(seat));
|
client_notify_enter(client_surface(c), wlr_seat_get_keyboard(seat));
|
||||||
|
@ -1515,7 +1582,7 @@ locksession(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
maplayersurfacenotify(struct wl_listener *listener, void *data)
|
maplayersurfacenotify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
motionnotify(0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1631,20 +1698,53 @@ motionabsolute(struct wl_listener *listener, void *data)
|
||||||
* so we have to warp the mouse there. There is also some hardware which
|
* so we have to warp the mouse there. There is also some hardware which
|
||||||
* emits these events. */
|
* emits these events. */
|
||||||
struct wlr_pointer_motion_absolute_event *event = data;
|
struct wlr_pointer_motion_absolute_event *event = data;
|
||||||
wlr_cursor_warp_absolute(cursor, &event->pointer->base, event->x, event->y);
|
double lx, ly, dx, dy;
|
||||||
motionnotify(event->time_msec);
|
|
||||||
|
if (!event->time_msec) /* this is 0 with virtual pointers */
|
||||||
|
wlr_cursor_warp_absolute(cursor, &event->pointer->base, event->x, event->y);
|
||||||
|
|
||||||
|
wlr_cursor_absolute_to_layout_coords(cursor, &event->pointer->base, event->x, event->y, &lx, &ly);
|
||||||
|
dx = lx - cursor->x;
|
||||||
|
dy = ly - cursor->y;
|
||||||
|
motionnotify(event->time_msec, &event->pointer->base, dx, dy, dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
motionnotify(uint32_t time)
|
motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double dy,
|
||||||
|
double dx_unaccel, double dy_unaccel)
|
||||||
{
|
{
|
||||||
double sx = 0, sy = 0;
|
double sx = 0, sy = 0, sx_confined, sy_confined;
|
||||||
Client *c = NULL, *w = NULL;
|
Client *c = NULL, *w = NULL;
|
||||||
LayerSurface *l = NULL;
|
LayerSurface *l = NULL;
|
||||||
struct wlr_surface *surface = NULL;
|
struct wlr_surface *surface = NULL;
|
||||||
|
struct wlr_pointer_constraint_v1 *constraint;
|
||||||
|
|
||||||
/* time is 0 in internal calls meant to restore pointer focus. */
|
/* time is 0 in internal calls meant to restore pointer focus. */
|
||||||
if (time) {
|
if (time) {
|
||||||
|
wlr_relative_pointer_manager_v1_send_relative_motion(
|
||||||
|
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 (active_constraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_cursor_move(cursor, device, dx, dy);
|
||||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
|
||||||
/* Update selmon (even while dragging a window) */
|
/* Update selmon (even while dragging a window) */
|
||||||
|
@ -1698,8 +1798,8 @@ motionrelative(struct wl_listener *listener, void *data)
|
||||||
* special configuration applied for the specific input device which
|
* special configuration applied for the specific input device which
|
||||||
* generated the event. You can pass NULL for the device if you want to move
|
* generated the event. You can pass NULL for the device if you want to move
|
||||||
* the cursor around without any input. */
|
* the cursor around without any input. */
|
||||||
wlr_cursor_move(cursor, &event->pointer->base, event->delta_x, event->delta_y);
|
motionnotify(event->time_msec, &event->pointer->base, event->delta_x, event->delta_y,
|
||||||
motionnotify(event->time_msec);
|
event->unaccel_dx, event->unaccel_dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1807,7 +1907,8 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
|
||||||
{
|
{
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
|
|
||||||
if (sloppyfocus && time && c && !client_is_unmanaged(c))
|
if ((!active_constraint || active_constraint->surface != surface) &&
|
||||||
|
sloppyfocus && time && c && !client_is_unmanaged(c))
|
||||||
focusclient(c, 0);
|
focusclient(c, 0);
|
||||||
|
|
||||||
/* If surface is NULL, clear pointer focus */
|
/* If surface is NULL, clear pointer focus */
|
||||||
|
@ -1826,7 +1927,6 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
|
||||||
* wlroots makes this a no-op if surface is already focused */
|
* wlroots makes this a no-op if surface is already focused */
|
||||||
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
|
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
|
||||||
wlr_seat_pointer_notify_motion(seat, time, sx, sy);
|
wlr_seat_pointer_notify_motion(seat, time, sx, sy);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2325,6 +2425,11 @@ setup(void)
|
||||||
xdg_decoration_mgr = wlr_xdg_decoration_manager_v1_create(dpy);
|
xdg_decoration_mgr = wlr_xdg_decoration_manager_v1_create(dpy);
|
||||||
LISTEN_STATIC(&xdg_decoration_mgr->events.new_toplevel_decoration, createdecoration);
|
LISTEN_STATIC(&xdg_decoration_mgr->events.new_toplevel_decoration, createdecoration);
|
||||||
|
|
||||||
|
pointer_constraints = wlr_pointer_constraints_v1_create(dpy);
|
||||||
|
LISTEN_STATIC(&pointer_constraints->events.new_constraint, createpointerconstraint);
|
||||||
|
|
||||||
|
relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creates a cursor, which is a wlroots utility for tracking the cursor
|
* Creates a cursor, which is a wlroots utility for tracking the cursor
|
||||||
* image shown on screen.
|
* image shown on screen.
|
||||||
|
@ -2587,7 +2692,7 @@ unmaplayersurfacenotify(struct wl_listener *listener, void *data)
|
||||||
arrangelayers(l->mon);
|
arrangelayers(l->mon);
|
||||||
if (l->layer_surface->surface == seat->keyboard_state.focused_surface)
|
if (l->layer_surface->surface == seat->keyboard_state.focused_surface)
|
||||||
focusclient(focustop(selmon), 1);
|
focusclient(focustop(selmon), 1);
|
||||||
motionnotify(0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2613,7 +2718,7 @@ unmapnotify(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
wlr_scene_node_destroy(&c->scene->node);
|
wlr_scene_node_destroy(&c->scene->node);
|
||||||
printstatus();
|
printstatus();
|
||||||
motionnotify(0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2882,7 +2987,7 @@ configurex11(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
if (c->isfloating || client_is_unmanaged(c))
|
if (c->isfloating || client_is_unmanaged(c))
|
||||||
resize(c, (struct wlr_box){.x = event->x, .y = event->y,
|
resize(c, (struct wlr_box){.x = event->x, .y = event->y,
|
||||||
.width = event->width, .height = event->height}, 0);
|
.width = event->width + c->bw * 2, .height = event->height + c->bw * 2}, 0);
|
||||||
else
|
else
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue