Merge branch 'main' of /home/mahesh/git/furnish/dwl_20240217

This commit is contained in:
Mahesh Asolkar 2024-06-15 10:37:43 -07:00
commit 630efefd3a
3 changed files with 25 additions and 27 deletions

View File

@ -15,8 +15,8 @@ LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS)
all: dwl all: dwl
dwl: dwl.o util.o dwl-ipc-unstable-v2-protocol.o dwl: dwl.o util.o dwl-ipc-unstable-v2-protocol.o
$(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) dwl-ipc-unstable-v2-protocol.o -o $@ $(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) dwl-ipc-unstable-v2-protocol.o -o $@
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 dwl-ipc-unstable-v2-protocol.h dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h dwl-ipc-unstable-v2-protocol.h
util.o: util.c util.h util.o: util.c util.h
dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.h dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.h
@ -73,4 +73,4 @@ uninstall:
.SUFFIXES: .c .o .SUFFIXES: .c .o
.c.o: .c.o:
$(CC) $(CPPFLAGS) $(DWLCFLAGS) -c $< $(CC) $(CPPFLAGS) $(DWLCFLAGS) -o $@ -c $<

26
dwl.c
View File

@ -422,7 +422,6 @@ static struct wl_listener lock_listener = {.notify = locksession};
static struct wlr_seat *seat; static struct wlr_seat *seat;
static KeyboardGroup *kb_group; static KeyboardGroup *kb_group;
static struct wlr_surface *held_grab;
static unsigned int cursor_mode; static unsigned int cursor_mode;
static Client *grabc; static Client *grabc;
static int grabcx, grabcy; /* client-relative */ static int grabcx, grabcy; /* client-relative */
@ -628,7 +627,6 @@ buttonpress(struct wl_listener *listener, void *data)
switch (event->state) { switch (event->state) {
case WLR_BUTTON_PRESSED: case WLR_BUTTON_PRESSED:
cursor_mode = CurPressed; cursor_mode = CurPressed;
held_grab = seat->pointer_state.focused_surface;
if (locked) if (locked)
break; break;
@ -648,7 +646,6 @@ buttonpress(struct wl_listener *listener, void *data)
} }
break; break;
case WLR_BUTTON_RELEASED: case WLR_BUTTON_RELEASED:
held_grab = NULL;
/* If you released any buttons, we exit interactive move/resize mode. */ /* If you released any buttons, we exit interactive move/resize mode. */
/* TODO should reset to the pointer focus's current setcursor */ /* TODO should reset to the pointer focus's current setcursor */
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) { if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
@ -2010,6 +2007,18 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
struct wlr_surface *surface = NULL; struct wlr_surface *surface = NULL;
struct wlr_pointer_constraint_v1 *constraint; struct wlr_pointer_constraint_v1 *constraint;
/* Find the client under the pointer and send the event along. */
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
if (cursor_mode == CurPressed && !seat->drag
&& surface != seat->pointer_state.focused_surface
&& toplevel_from_wlr_surface(seat->pointer_state.focused_surface, &w, &l) >= 0) {
c = w;
surface = seat->pointer_state.focused_surface;
sx = cursor->x - (l ? l->geom.x : w->geom.x);
sy = cursor->y - (l ? l->geom.y : w->geom.y);
}
/* 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( wlr_relative_pointer_manager_v1_send_relative_motion(
@ -2058,17 +2067,6 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
return; return;
} }
/* Find the client under the pointer and send the event along. */
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
if (cursor_mode == CurPressed && !seat->drag && surface != held_grab
&& toplevel_from_wlr_surface(held_grab, &w, &l) >= 0) {
c = w;
surface = held_grab;
sx = cursor->x - (l ? l->geom.x : w->geom.x);
sy = cursor->y - (l ? l->geom.y : w->geom.y);
}
/* If there's no client surface under the cursor, set the cursor image to a /* 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 * default. This is what makes the cursor image appear when you move it
* off of a client or over its border. */ * off of a client or over its border. */