This commit is contained in:
Mahesh Asolkar 2025-06-08 19:53:31 -07:00
commit 59c087842b
Signed by: asolkar
GPG Key ID: 371CA8164433BDCC
3 changed files with 28 additions and 27 deletions

View File

@ -264,8 +264,8 @@ client_is_stopped(Client *c)
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL); wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
if (waitid(P_PID, pid, &in, WNOHANG|WCONTINUED|WSTOPPED|WNOWAIT) < 0) { if (waitid(P_PID, pid, &in, WNOHANG|WCONTINUED|WSTOPPED|WNOWAIT) < 0) {
/* This process is not our child process, while is very unluckely that /* This process is not our child process, while is very unlikely that
* it is stopped, in order to do not skip frames assume that it is. */ * it is stopped, in order to do not skip frames, assume that it is. */
if (errno == ECHILD) if (errno == ECHILD)
return 1; return 1;
} else if (in.si_pid) { } else if (in.si_pid) {

View File

@ -11,7 +11,7 @@ DATADIR = $(PREFIX)/share
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19` WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19` WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19`
# Allow using an alternative wlroots installations # Allow using an alternative wlroots installation
# This has to have all the includes required by wlroots, e.g: # This has to have all the includes required by wlroots, e.g:
# Assuming wlroots git repo is "${PWD}/wlroots" and you only ran "meson setup build && ninja -C build" # Assuming wlroots git repo is "${PWD}/wlroots" and you only ran "meson setup build && ninja -C build"
#WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \ #WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \

45
dwl.c
View File

@ -637,8 +637,8 @@ axisnotify(struct wl_listener *listener, void *data)
* for example when you move the scroll wheel. */ * for example when you move the scroll wheel. */
struct wlr_pointer_axis_event *event = data; struct wlr_pointer_axis_event *event = data;
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat); wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
/* TODO: allow usage of scroll whell for mousebindings, it can be implemented /* TODO: allow usage of scroll wheel for mousebindings, it can be implemented
* checking the event's orientation and the delta of the event */ * by checking the event's orientation and the delta of the event */
/* Notify the client with pointer focus of the axis event. */ /* Notify the client with pointer focus of the axis event. */
wlr_seat_pointer_notify_axis(seat, wlr_seat_pointer_notify_axis(seat,
event->time_msec, event->orientation, event->delta, event->time_msec, event->orientation, event->delta,
@ -740,8 +740,8 @@ cleanup(void)
destroykeyboardgroup(&kb_group->destroy, NULL); destroykeyboardgroup(&kb_group->destroy, NULL);
/* If it's not destroyed manually it will cause a use-after-free of wlr_seat. /* If it's not destroyed manually, it will cause a use-after-free of wlr_seat.
* Destroy it until it's fixed in the wlroots side */ * Destroy it until it's fixed on the wlroots side */
wlr_backend_destroy(backend); wlr_backend_destroy(backend);
wl_display_destroy(dpy); wl_display_destroy(dpy);
@ -889,7 +889,7 @@ commitnotify(struct wl_listener *listener, void *data)
/* /*
* Get the monitor this client will be rendered on * Get the monitor this client will be rendered on
* Note that if the user set a rule in which the client is placed on * Note that if the user set a rule in which the client is placed on
* a different monitor based on its title this will likely select * a different monitor based on its title, this will likely select
* a wrong monitor. * a wrong monitor.
*/ */
applyrules(c); applyrules(c);
@ -1260,7 +1260,7 @@ cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
void void
cursorframe(struct wl_listener *listener, void *data) cursorframe(struct wl_listener *listener, void *data)
{ {
/* This event is forwarded by the cursor when a pointer emits an frame /* This event is forwarded by the cursor when a pointer emits a frame
* event. Frame events are sent after regular pointer events to group * event. Frame events are sent after regular pointer events to group
* multiple events together. For instance, two axis events may happen at the * multiple events together. For instance, two axis events may happen at the
* same time, in which case a frame event won't be sent in between. */ * same time, in which case a frame event won't be sent in between. */
@ -1763,7 +1763,7 @@ focusstack(const Arg *arg)
focusclient(c, 1); focusclient(c, 1);
} }
/* We probably should change the name of this, it sounds like /* We probably should change the name of this: it sounds like it
* will focus the topmost client of this mon, when actually will * will focus the topmost client of this mon, when actually will
* only return that client */ * only return that client */
Client * Client *
@ -2036,8 +2036,8 @@ mapnotify(struct wl_listener *listener, void *data)
/* Set initial monitor, tags, floating status, and focus: /* Set initial monitor, tags, floating status, and focus:
* we always consider floating, clients that have parent and thus * we always consider floating, clients that have parent and thus
* we set the same tags and monitor than its parent, if not * we set the same tags and monitor as its parent.
* try to apply rules for them */ * If there is no parent, apply rules */
if ((p = client_get_parent(c))) { if ((p = client_get_parent(c))) {
c->isfloating = 1; c->isfloating = 1;
setmon(c, p->mon, p->tags); setmon(c, p->mon, p->tags);
@ -2097,8 +2097,7 @@ motionabsolute(struct wl_listener *listener, void *data)
* motion event, from 0..1 on each axis. This happens, for example, when * motion event, from 0..1 on each axis. This happens, for example, when
* wlroots is running under a Wayland window rather than KMS+DRM, and you * wlroots is running under a Wayland window rather than KMS+DRM, and you
* move the mouse over the window. You could enter the window from any edge, * move the mouse over the window. You could enter the window from any edge,
* so we have to warp the mouse there. There is also some hardware which * so we have to warp the mouse there. Also, some hardware emits these events. */
* emits these events. */
struct wlr_pointer_motion_absolute_event *event = data; struct wlr_pointer_motion_absolute_event *event = data;
double lx, ly, dx, dy; double lx, ly, dx, dy;
@ -2283,7 +2282,7 @@ apply_or_test:
ok &= test ? wlr_output_test_state(wlr_output, &state) ok &= test ? wlr_output_test_state(wlr_output, &state)
: wlr_output_commit_state(wlr_output, &state); : wlr_output_commit_state(wlr_output, &state);
/* Don't move monitors if position wouldn't change, this to avoid /* Don't move monitors if position wouldn't change. This avoids
* wlroots marking the output as manually configured. * wlroots marking the output as manually configured.
* wlr_output_layout_add does not like disabled outputs */ * wlr_output_layout_add does not like disabled outputs */
if (!test && wlr_output->enabled && (m->m.x != config_head->state.x || m->m.y != config_head->state.y)) if (!test && wlr_output->enabled && (m->m.x != config_head->state.x || m->m.y != config_head->state.y))
@ -2525,8 +2524,10 @@ run(char *startup_cmd)
close(piperw[0]); close(piperw[0]);
} }
/* Mark stdout as non-blocking to avoid people who does not close stdin /* Mark stdout as non-blocking to avoid the startup script
* nor consumes it in their startup script getting dwl frozen */ * causing dwl to freeze when a user neither closes stdin
* nor consumes standard input in his startup script */
if (fd_set_nonblock(STDOUT_FILENO) < 0) if (fd_set_nonblock(STDOUT_FILENO) < 0)
close(STDOUT_FILENO); close(STDOUT_FILENO);
@ -2537,7 +2538,7 @@ run(char *startup_cmd)
selmon = xytomon(cursor->x, cursor->y); selmon = xytomon(cursor->x, cursor->y);
/* TODO hack to get cursor to display in its initial location (100, 100) /* TODO hack to get cursor to display in its initial location (100, 100)
* instead of (0, 0) and then jumping. still may not be fully * instead of (0, 0) and then jumping. Still may not be fully
* initialized, as the image/coordinates are not transformed for the * initialized, as the image/coordinates are not transformed for the
* monitor when displayed here */ * monitor when displayed here */
wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y); wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y);
@ -2560,7 +2561,7 @@ setcursor(struct wl_listener *listener, void *data)
* event, which will result in the client requesting set the cursor surface */ * event, which will result in the client requesting set the cursor surface */
if (cursor_mode != CurNormal && cursor_mode != CurPressed) if (cursor_mode != CurNormal && cursor_mode != CurPressed)
return; return;
/* This can be sent by any client, so we check to make sure this one is /* This can be sent by any client, so we check to make sure this one
* actually has pointer focus first. If so, we can tell the cursor to * actually has pointer focus first. If so, we can tell the cursor to
* use the provided surface as the cursor image. It will set the * 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 * hardware cursor on the output that it's currently on and continue to
@ -2576,7 +2577,7 @@ setcursorshape(struct wl_listener *listener, void *data)
struct wlr_cursor_shape_manager_v1_request_set_shape_event *event = data; struct wlr_cursor_shape_manager_v1_request_set_shape_event *event = data;
if (cursor_mode != CurNormal && cursor_mode != CurPressed) if (cursor_mode != CurNormal && cursor_mode != CurPressed)
return; return;
/* This can be sent by any client, so we check to make sure this one is /* This can be sent by any client, so we check to make sure this one
* actually has pointer focus first. If so, we can tell the cursor to * actually has pointer focus first. If so, we can tell the cursor to
* use the provided cursor shape. */ * use the provided cursor shape. */
if (event->seat_client == seat->pointer_state.focused_client) if (event->seat_client == seat->pointer_state.focused_client)
@ -2679,7 +2680,7 @@ setpsel(struct wl_listener *listener, void *data)
{ {
/* This event is raised by the seat when a client wants to set the selection, /* This event is raised by the seat when a client wants to set the selection,
* usually when the user copies something. wlroots allows compositors to * usually when the user copies something. wlroots allows compositors to
* ignore such requests if they so choose, but in dwl we always honor * ignore such requests if they so choose, but in dwl we always honor them
*/ */
struct wlr_seat_request_set_primary_selection_event *event = data; struct wlr_seat_request_set_primary_selection_event *event = data;
wlr_seat_set_primary_selection(seat, event->source, event->serial); wlr_seat_set_primary_selection(seat, event->source, event->serial);
@ -2690,7 +2691,7 @@ setsel(struct wl_listener *listener, void *data)
{ {
/* This event is raised by the seat when a client wants to set the selection, /* This event is raised by the seat when a client wants to set the selection,
* usually when the user copies something. wlroots allows compositors to * usually when the user copies something. wlroots allows compositors to
* ignore such requests if they so choose, but in dwl we always honor * ignore such requests if they so choose, but in dwl we always honor them
*/ */
struct wlr_seat_request_set_selection_event *event = data; struct wlr_seat_request_set_selection_event *event = data;
wlr_seat_set_selection(seat, event->source, event->serial); wlr_seat_set_selection(seat, event->source, event->serial);
@ -2737,9 +2738,9 @@ setup(void)
wl_signal_add(&drw->events.lost, &gpu_reset); wl_signal_add(&drw->events.lost, &gpu_reset);
/* Create shm, drm and linux_dmabuf interfaces by ourselves. /* Create shm, drm and linux_dmabuf interfaces by ourselves.
* The simplest way is call: * The simplest way is to call:
* wlr_renderer_init_wl_display(drw); * wlr_renderer_init_wl_display(drw);
* but we need to create manually the linux_dmabuf interface to integrate it * but we need to create the linux_dmabuf interface manually to integrate it
* with wlr_scene. */ * with wlr_scene. */
wlr_renderer_init_wl_shm(drw, dpy); wlr_renderer_init_wl_shm(drw, dpy);
@ -2788,7 +2789,7 @@ setup(void)
power_mgr = wlr_output_power_manager_v1_create(dpy); power_mgr = wlr_output_power_manager_v1_create(dpy);
wl_signal_add(&power_mgr->events.set_mode, &output_power_mgr_set_mode); wl_signal_add(&power_mgr->events.set_mode, &output_power_mgr_set_mode);
/* Creates an output layout, which a wlroots utility for working with an /* Creates an output layout, which is a wlroots utility for working with an
* arrangement of screens in a physical layout. */ * arrangement of screens in a physical layout. */
output_layout = wlr_output_layout_create(dpy); output_layout = wlr_output_layout_create(dpy);
wl_signal_add(&output_layout->events.change, &layout_change); wl_signal_add(&output_layout->events.change, &layout_change);