refactor: replace C11 keywords with C23 equivalents, NULL→nullptr, remove stdbool.h

This commit is contained in:
2026-07-02 02:02:09 -04:00
parent 1e09b182ee
commit 969a6c4ecb
12 changed files with 171 additions and 172 deletions
+7 -7
View File
@@ -721,7 +721,7 @@ config_autostart_run(const Config *cfg)
continue; continue;
} }
if (cpid == 0) { if (cpid == 0) {
execl("/bin/sh", "sh", "-c", cmd, NULL); execl("/bin/sh", "sh", "-c", cmd, nullptr);
fprintf(stderr, "peachwm autostart: exec '%s': %s\n", fprintf(stderr, "peachwm autostart: exec '%s': %s\n",
cmd, strerror(errno)); cmd, strerror(errno));
_exit(1); _exit(1);
@@ -750,7 +750,7 @@ config_autostart_run(const Config *cfg)
now.tv_nsec >= deadline.tv_nsec)) now.tv_nsec >= deadline.tv_nsec))
break; /* looks like a daemon, move on */ break; /* looks like a daemon, move on */
struct timespec sl = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000 }; struct timespec sl = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000 };
nanosleep(&sl, NULL); nanosleep(&sl, nullptr);
} }
} }
} }
@@ -766,7 +766,7 @@ watch_dispatch(int fd, uint32_t mask, void *data)
WatchState *ws = data; WatchState *ws = data;
/* Drain the inotify events */ /* Drain the inotify events */
_Alignas(struct inotify_event) char buf[4096]; alignas(struct inotify_event) char buf[4096];
ssize_t len = read(fd, buf, sizeof(buf)); ssize_t len = read(fd, buf, sizeof(buf));
if (len < 0) { if (len < 0) {
if (errno != EAGAIN) if (errno != EAGAIN)
@@ -807,13 +807,13 @@ config_watch_start(struct wl_event_loop *loop, const char *path,
config_reload_cb cb, void *userdata) config_reload_cb cb, void *userdata)
{ {
WatchState *ws = calloc(1, sizeof(*ws)); WatchState *ws = calloc(1, sizeof(*ws));
if (!ws) return NULL; if (!ws) return nullptr;
ws->inotify_fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); ws->inotify_fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
if (ws->inotify_fd < 0) { if (ws->inotify_fd < 0) {
perror("peachwm config: inotify_init1"); perror("peachwm config: inotify_init1");
free(ws); free(ws);
return NULL; return nullptr;
} }
ws->watch_fd = inotify_add_watch(ws->inotify_fd, path, ws->watch_fd = inotify_add_watch(ws->inotify_fd, path,
@@ -822,7 +822,7 @@ config_watch_start(struct wl_event_loop *loop, const char *path,
perror("peachwm config: inotify_add_watch"); perror("peachwm config: inotify_add_watch");
close(ws->inotify_fd); close(ws->inotify_fd);
free(ws); free(ws);
return NULL; return nullptr;
} }
strncpy(ws->path, path, sizeof(ws->path) - 1); strncpy(ws->path, path, sizeof(ws->path) - 1);
@@ -840,7 +840,7 @@ config_watch_start(struct wl_event_loop *loop, const char *path,
"Classic.\n"); "Classic.\n");
close(ws->inotify_fd); close(ws->inotify_fd);
free(ws); free(ws);
return NULL; return nullptr;
} }
ws->event_src = src; ws->event_src = src;
-1
View File
@@ -2,7 +2,6 @@
#define PEACHWM_PARSER_H #define PEACHWM_PARSER_H
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
/* Maximum lengths. Good for the soul, they say */ /* Maximum lengths. Good for the soul, they say */
+8 -8
View File
@@ -52,8 +52,8 @@ toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc, LayerSurface **pl)
struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface; struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface;
struct wlr_surface *root_surface; struct wlr_surface *root_surface;
struct wlr_layer_surface_v1 *layer_surface; struct wlr_layer_surface_v1 *layer_surface;
Client *c = NULL; Client *c = nullptr;
LayerSurface *l = NULL; LayerSurface *l = nullptr;
int type = -1; int type = -1;
#ifdef XWAYLAND #ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface; struct wlr_xwayland_surface *xsurface;
@@ -79,7 +79,7 @@ toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc, LayerSurface **pl)
xdg_surface = wlr_xdg_surface_try_from_wlr_surface(root_surface); xdg_surface = wlr_xdg_surface_try_from_wlr_surface(root_surface);
while (xdg_surface) { while (xdg_surface) {
tmp_xdg_surface = NULL; tmp_xdg_surface = nullptr;
switch (xdg_surface->role) { switch (xdg_surface->role) {
case WLR_XDG_SURFACE_ROLE_POPUP: case WLR_XDG_SURFACE_ROLE_POPUP:
if (!xdg_surface->popup || !xdg_surface->popup->parent) if (!xdg_surface->popup || !xdg_surface->popup->parent)
@@ -189,16 +189,16 @@ client_get_geometry(Client *c, struct wlr_box *geom)
Client * Client *
client_get_parent(Client *c) client_get_parent(Client *c)
{ {
Client *p = NULL; Client *p = nullptr;
#ifdef XWAYLAND #ifdef XWAYLAND
if (client_is_x11(c)) { if (client_is_x11(c)) {
if (c->surface.xwayland->parent) if (c->surface.xwayland->parent)
toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p, NULL); toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p, nullptr);
return p; return p;
} }
#endif #endif
if (c->surface.xdg->toplevel->parent) if (c->surface.xdg->toplevel->parent)
toplevel_from_wlr_surface(c->surface.xdg->toplevel->parent->base->surface, &p, NULL); toplevel_from_wlr_surface(c->surface.xdg->toplevel->parent->base->surface, &p, nullptr);
return p; return p;
} }
@@ -283,7 +283,7 @@ client_is_stopped(Client *c)
return 0; return 0;
#endif #endif
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL); wl_client_get_credentials(c->surface.xdg->client->client, &pid, nullptr, nullptr);
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 unlikely 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. */
@@ -316,7 +316,7 @@ client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes, wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes,
kb->num_keycodes, &kb->modifiers); kb->num_keycodes, &kb->modifiers);
else else
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL); wlr_seat_keyboard_notify_enter(seat, s, nullptr, 0, nullptr);
} }
void void
+2 -2
View File
@@ -111,7 +111,7 @@ ext_workspace_cleanupmon(Monitor *m)
wlr_ext_workspace_group_handle_v1_output_leave( wlr_ext_workspace_group_handle_v1_output_leave(
m->ext_group, m->wlr_output); m->ext_group, m->wlr_output);
wlr_ext_workspace_group_handle_v1_destroy(m->ext_group); wlr_ext_workspace_group_handle_v1_destroy(m->ext_group);
m->ext_group = NULL; m->ext_group = nullptr;
} }
/* status */ /* status */
@@ -143,7 +143,7 @@ handle_ext_commit(struct wl_listener *listener, void *data)
struct wlr_ext_workspace_v1_request *req; struct wlr_ext_workspace_v1_request *req;
wl_list_for_each(req, event->requests, link) { wl_list_for_each(req, event->requests, link) {
struct ext_workspace *ws = NULL; struct ext_workspace *ws = nullptr;
struct ext_workspace *w; struct ext_workspace *w;
switch (req->type) { switch (req->type) {
+4 -4
View File
@@ -8,7 +8,7 @@
#include "util.h" #include "util.h"
/* IPC globals */ /* IPC globals */
struct wl_global *ipc_global = NULL; struct wl_global *ipc_global = nullptr;
struct wl_list ipc_managers; /* IpcManager.link */ struct wl_list ipc_managers; /* IpcManager.link */
/* helpers */ /* helpers */
@@ -20,7 +20,7 @@ ipc_output_for_mon(IpcManager *mgr, Monitor *m)
wl_list_for_each(o, &mgr->outputs, link) wl_list_for_each(o, &mgr->outputs, link)
if (o->mon == m) if (o->mon == m)
return o; return o;
return NULL; return nullptr;
} }
/* Send the full state of monitor m to one IpcOutput resource */ /* Send the full state of monitor m to one IpcOutput resource */
@@ -208,7 +208,7 @@ ipc_manager_handle_get_output(struct wl_client *client, struct wl_resource *reso
{ {
IpcManager *mgr = wl_resource_get_user_data(resource); IpcManager *mgr = wl_resource_get_user_data(resource);
struct wlr_output *wlr_out = wlr_output_from_resource(output_resource); struct wlr_output *wlr_out = wlr_output_from_resource(output_resource);
Monitor *m = (wlr_out && wlr_out->data) ? wlr_out->data : NULL; Monitor *m = (wlr_out && wlr_out->data) ? wlr_out->data : nullptr;
IpcOutput *out = ecalloc(1, sizeof(*out)); IpcOutput *out = ecalloc(1, sizeof(*out));
out->mon = m; out->mon = m;
@@ -272,5 +272,5 @@ ipc_init(void)
{ {
wl_list_init(&ipc_managers); wl_list_init(&ipc_managers);
ipc_global = wl_global_create(dpy, &zpeachwm_ipc_manager_v2_interface, ipc_global = wl_global_create(dpy, &zpeachwm_ipc_manager_v2_interface,
2, NULL, ipc_bind); 2, nullptr, ipc_bind);
} }
+11 -11
View File
@@ -111,7 +111,7 @@ json_puts(struct json_writer *w, const char *s)
json_raw(w, s, strlen(s)); json_raw(w, s, strlen(s));
} }
__attribute__((__format__(__printf__, 2, 3))) [[gnu::format(printf, 2, 3)]]
static void static void
json_printf(struct json_writer *w, const char *fmt, ...) json_printf(struct json_writer *w, const char *fmt, ...)
{ {
@@ -419,7 +419,7 @@ static void
ipc_build_output(struct json_writer *w, Monitor *m) ipc_build_output(struct json_writer *w, Monitor *m)
{ {
struct wlr_output *o = m->wlr_output; struct wlr_output *o = m->wlr_output;
struct wlr_output_mode *mode = NULL; struct wlr_output_mode *mode = nullptr;
int ti; int ti;
if (o->current_mode) if (o->current_mode)
@@ -737,7 +737,7 @@ ipc_handle_command(struct ipc_client *client, const char *payload,
{ {
struct json_writer w; struct json_writer w;
int success = 0; int success = 0;
char *cmd = NULL; char *cmd = nullptr;
if (len > 0) { if (len > 0) {
cmd = ecalloc(1, len + 1); cmd = ecalloc(1, len + 1);
@@ -783,16 +783,16 @@ ipc_handle_command(struct ipc_client *client, const char *payload,
} else if (!strcmp(cmd, "floating toggle") || } else if (!strcmp(cmd, "floating toggle") ||
!strcmp(cmd, "floating enable") || !strcmp(cmd, "floating enable") ||
!strcmp(cmd, "floating disable")) { !strcmp(cmd, "floating disable")) {
togglefloating(NULL); togglefloating(nullptr);
success = 1; success = 1;
} else if (!strcmp(cmd, "fullscreen toggle") || } else if (!strcmp(cmd, "fullscreen toggle") ||
!strcmp(cmd, "fullscreen enable") || !strcmp(cmd, "fullscreen enable") ||
!strcmp(cmd, "fullscreen disable")) { !strcmp(cmd, "fullscreen disable")) {
togglefullscreen(NULL); togglefullscreen(nullptr);
success = 1; success = 1;
} else if (!strcmp(cmd, "kill") || } else if (!strcmp(cmd, "kill") ||
!strcmp(cmd, "close")) { !strcmp(cmd, "close")) {
killclient(NULL); killclient(nullptr);
success = 1; success = 1;
} else if (!strncmp(cmd, "workspace", 9)) { } else if (!strncmp(cmd, "workspace", 9)) {
const char *ws = cmd + 9; const char *ws = cmd + 9;
@@ -807,7 +807,7 @@ ipc_handle_command(struct ipc_client *client, const char *payload,
} }
} else if (!strcmp(cmd, "exit") || } else if (!strcmp(cmd, "exit") ||
!strcmp(cmd, "quit")) { !strcmp(cmd, "quit")) {
quit(NULL); quit(nullptr);
success = 1; success = 1;
} else if (!strcmp(cmd, "reload")) { } else if (!strcmp(cmd, "reload")) {
do_reload(); do_reload();
@@ -868,7 +868,7 @@ ipc_client_close(struct ipc_client *c)
wl_list_remove(&c->link); wl_list_remove(&c->link);
if (c->src) { if (c->src) {
wl_event_source_remove(c->src); wl_event_source_remove(c->src);
c->src = NULL; c->src = nullptr;
} }
close(c->fd); close(c->fd);
free(c->payload); free(c->payload);
@@ -1025,7 +1025,7 @@ ipc_handle_accept(int fd, uint32_t mask, void *data)
c->payload_size = 0; c->payload_size = 0;
c->payload_len = 0; c->payload_len = 0;
c->payload_alloc = 0; c->payload_alloc = 0;
c->payload = NULL; c->payload = nullptr;
c->subscribed = 0; c->subscribed = 0;
src = wl_event_loop_add_fd(ipc_event_loop, cfd, src = wl_event_loop_add_fd(ipc_event_loop, cfd,
@@ -1120,7 +1120,7 @@ ipc_socket_init(void)
ipc_listen_src = wl_event_loop_add_fd( ipc_listen_src = wl_event_loop_add_fd(
ipc_event_loop, fd, WL_EVENT_READABLE, ipc_event_loop, fd, WL_EVENT_READABLE,
ipc_handle_accept, NULL); ipc_handle_accept, nullptr);
if (!ipc_listen_src) { if (!ipc_listen_src) {
wlr_log(WLR_ERROR, wlr_log(WLR_ERROR,
"ipc: wl_event_loop_add_fd failed"); "ipc: wl_event_loop_add_fd failed");
@@ -1144,7 +1144,7 @@ ipc_socket_finish(void)
if (ipc_listen_src) { if (ipc_listen_src) {
wl_event_source_remove(ipc_listen_src); wl_event_source_remove(ipc_listen_src);
ipc_listen_src = NULL; ipc_listen_src = nullptr;
} }
if (ipc_listen_fd >= 0) { if (ipc_listen_fd >= 0) {
close(ipc_listen_fd); close(ipc_listen_fd);
+8 -8
View File
@@ -29,7 +29,7 @@ void client_set_suspended(Client *c, int suspended);
* ================================================================ */ * ================================================================ */
const Layout layouts[] = { const Layout layouts[] = {
{"><>", NULL}, {"><>", nullptr},
{"[T]", dwindle}, {"[T]", dwindle},
{"[M]", master}, {"[M]", master},
{"[]", monocle}, {"[]", monocle},
@@ -93,9 +93,9 @@ DwindleNode *
dwindle_find_leaf(DwindleNode *n, Client *c) dwindle_find_leaf(DwindleNode *n, Client *c)
{ {
if (!n) if (!n)
return NULL; return nullptr;
if (!n->is_node) if (!n->is_node)
return n->client == c ? n : NULL; return n->client == c ? n : nullptr;
DwindleNode *r = dwindle_find_leaf(n->children[0], c); DwindleNode *r = dwindle_find_leaf(n->children[0], c);
return r ? r : dwindle_find_leaf(n->children[1], c); return r ? r : dwindle_find_leaf(n->children[1], c);
} }
@@ -104,7 +104,7 @@ static DwindleNode *
dwindle_first_leaf(DwindleNode *n) dwindle_first_leaf(DwindleNode *n)
{ {
if (!n) if (!n)
return NULL; return nullptr;
while (n->is_node) while (n->is_node)
n = n->children[0]; n = n->children[0];
return n; return n;
@@ -165,7 +165,7 @@ dwindle_insert(DwindleNode **root, Client *new_c, Client *focused)
return; return;
} }
DwindleNode *opening_on = focused ? dwindle_find_leaf(*root, focused) : NULL; DwindleNode *opening_on = focused ? dwindle_find_leaf(*root, focused) : nullptr;
if (!opening_on) if (!opening_on)
opening_on = dwindle_first_leaf(*root); opening_on = dwindle_first_leaf(*root);
@@ -203,7 +203,7 @@ dwindle_remove(DwindleNode **root, Client *c)
DwindleNode *parent = leaf->parent; DwindleNode *parent = leaf->parent;
if (!parent) { if (!parent) {
free(leaf); free(leaf);
*root = NULL; *root = nullptr;
return; return;
} }
@@ -329,7 +329,7 @@ dwindle(Monitor *m)
static void static void
master_arrange(Monitor *m, int ti) master_arrange(Monitor *m, int ti)
{ {
Client *c, *master_c = NULL; Client *c, *master_c = nullptr;
Client *stack[256]; Client *stack[256];
int nstack = 0, n = 0; int nstack = 0, n = 0;
@@ -425,7 +425,7 @@ master_remove_client(Client *c)
return; return;
for (int i = 0; i < TAGCOUNT; i++) { for (int i = 0; i < TAGCOUNT; i++) {
if (m->master_master[i] == c) if (m->master_master[i] == c)
m->master_master[i] = NULL; m->master_master[i] = nullptr;
} }
} }
+93 -93
View File
@@ -496,8 +496,8 @@ void arrange(Monitor *m) {
if (curlayout(m)->arrange) if (curlayout(m)->arrange)
curlayout(m)->arrange(m); curlayout(m)->arrange(m);
motionnotify(0, NULL, 0, 0, 0, 0); motionnotify(0, nullptr, 0, 0, 0, 0);
checkidleinhibitor(NULL); checkidleinhibitor(nullptr);
} }
static void arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, static void arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area,
@@ -552,7 +552,7 @@ static void arrangelayers(Monitor *m) {
!l->mapped) !l->mapped)
continue; continue;
/* Deactivate the focused client. */ /* Deactivate the focused client. */
focusclient(NULL, 0); focusclient(nullptr, 0);
exclusive_focus = l; exclusive_focus = l;
client_notify_enter(l->layer_surface->surface, client_notify_enter(l->layer_surface->surface,
wlr_seat_get_keyboard(seat)); wlr_seat_get_keyboard(seat));
@@ -607,7 +607,7 @@ static void buttonpress(struct wl_listener *listener, void *data) {
break; break;
/* Change focus if the button was _pressed_ over a client */ /* Change focus if the button was _pressed_ over a client */
xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); xytonode(cursor->x, cursor->y, nullptr, &c, nullptr, nullptr, nullptr);
if (c && (!client_is_unmanaged(c) || client_wants_focus(c))) if (c && (!client_is_unmanaged(c) || client_wants_focus(c)))
focusclient(c, 1); focusclient(c, 1);
@@ -627,21 +627,21 @@ static void buttonpress(struct wl_listener *listener, void *data) {
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default"); wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
if (cursor_mode == CurTileDrag) { if (cursor_mode == CurTileDrag) {
/* Find whatever tiled client is under the cursor and swap. */ /* Find whatever tiled client is under the cursor and swap. */
Client *target = NULL; Client *target = nullptr;
xytonode(cursor->x, cursor->y, NULL, &target, NULL, NULL, NULL); xytonode(cursor->x, cursor->y, nullptr, &target, nullptr, nullptr, nullptr);
if (target && target != grabc && !target->isfloating && if (target && target != grabc && !target->isfloating &&
!target->isfullscreen && !target->isfullscreen &&
curlayout(target->mon)->arrange) curlayout(target->mon)->arrange)
swaptiled(grabc, target); swaptiled(grabc, target);
cursor_mode = CurNormal; cursor_mode = CurNormal;
grabc = NULL; grabc = nullptr;
return; return;
} }
cursor_mode = CurNormal; cursor_mode = CurNormal;
/* Drop the window off on its new monitor */ /* Drop the window off on its new monitor */
selmon = xytomon(cursor->x, cursor->y); selmon = xytomon(cursor->x, cursor->y);
setmon(grabc, selmon, 0); setmon(grabc, selmon, 0);
grabc = NULL; grabc = nullptr;
return; return;
} }
cursor_mode = CurNormal; cursor_mode = CurNormal;
@@ -682,7 +682,7 @@ static void checkidleinhibitor(struct wlr_surface *exclude) {
static void cleanup(void) { static void cleanup(void) {
config_watch_stop(cfg_watch_src); config_watch_stop(cfg_watch_src);
cfg_watch_src = NULL; cfg_watch_src = nullptr;
ipc_socket_finish(); ipc_socket_finish();
cleanuplisteners(); cleanuplisteners();
@@ -692,7 +692,7 @@ static void cleanup(void) {
if (xwayland && xwayland->server && xwayland->server->pid > 0) if (xwayland && xwayland->server && xwayland->server->pid > 0)
kill(xwayland->server->pid, SIGKILL); kill(xwayland->server->pid, SIGKILL);
wlr_xwayland_destroy(xwayland); wlr_xwayland_destroy(xwayland);
xwayland = NULL; xwayland = nullptr;
#endif #endif
wl_display_destroy_clients(dpy); wl_display_destroy_clients(dpy);
@@ -702,18 +702,18 @@ static void cleanup(void) {
struct timespec ts = {.tv_sec = 0, .tv_nsec = 100000000}; struct timespec ts = {.tv_sec = 0, .tv_nsec = 100000000};
int ret; int ret;
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
ret = waitpid(child_pid, NULL, WNOHANG); ret = waitpid(child_pid, nullptr, WNOHANG);
if (ret == child_pid || ret == -1) if (ret == child_pid || ret == -1)
goto child_done; goto child_done;
nanosleep(&ts, NULL); nanosleep(&ts, nullptr);
} }
kill(-child_pid, SIGKILL); kill(-child_pid, SIGKILL);
waitpid(child_pid, NULL, 0); waitpid(child_pid, nullptr, 0);
} }
child_done: child_done:
wlr_xcursor_manager_destroy(cursor_mgr); wlr_xcursor_manager_destroy(cursor_mgr);
destroykeyboardgroup(&kb_group->destroy, NULL); destroykeyboardgroup(&kb_group->destroy, nullptr);
/* 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 on the wlroots side */ * Destroy it until it's fixed on the wlroots side */
@@ -741,8 +741,8 @@ static void cleanupmon(struct wl_listener *listener, void *data) {
wl_list_remove(&m->link); wl_list_remove(&m->link);
wl_list_remove(&m->request_state.link); wl_list_remove(&m->request_state.link);
if (m->lock_surface) if (m->lock_surface)
destroylocksurface(&m->destroy_lock_surface, NULL); destroylocksurface(&m->destroy_lock_surface, nullptr);
m->wlr_output->data = NULL; m->wlr_output->data = nullptr;
wlr_output_layout_remove(output_layout, m->wlr_output); wlr_output_layout_remove(output_layout, m->wlr_output);
wlr_scene_output_destroy(m->scene_output); wlr_scene_output_destroy(m->scene_output);
@@ -751,7 +751,7 @@ static void cleanupmon(struct wl_listener *listener, void *data) {
ipc_socket_send_output_event(); ipc_socket_send_output_event();
for (int i = 0; i < TAGCOUNT; i++) { for (int i = 0; i < TAGCOUNT; i++) {
dwindle_free_tree(m->dwindle_root[i]); dwindle_free_tree(m->dwindle_root[i]);
m->dwindle_root[i] = NULL; m->dwindle_root[i] = nullptr;
} }
wlr_scene_node_destroy(&m->fullscreen_bg->node); wlr_scene_node_destroy(&m->fullscreen_bg->node);
free(m); free(m);
@@ -798,14 +798,14 @@ static void closemon(Monitor *m) {
Client *c; Client *c;
int i = 0, nmons = wl_list_length(&mons); int i = 0, nmons = wl_list_length(&mons);
if (!nmons) { if (!nmons) {
selmon = NULL; selmon = nullptr;
} else if (m == selmon) { } else if (m == selmon) {
do /* don't switch to disabled mons */ do /* don't switch to disabled mons */
selmon = wl_container_of(mons.next, selmon, link); selmon = wl_container_of(mons.next, selmon, link);
while (!selmon->wlr_output->enabled && i++ < nmons); while (!selmon->wlr_output->enabled && i++ < nmons);
if (!selmon->wlr_output->enabled) if (!selmon->wlr_output->enabled)
selmon = NULL; selmon = nullptr;
} }
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
@@ -878,7 +878,7 @@ static void commitnotify(struct wl_listener *listener, void *data) {
if (c->mon) { if (c->mon) {
client_set_scale(client_surface(c), c->mon->wlr_output->scale); client_set_scale(client_surface(c), c->mon->wlr_output->scale);
} }
setmon(c, NULL, 0); /* Make sure to reapply rules in mapnotify() */ setmon(c, nullptr, 0); /* Make sure to reapply rules in mapnotify() */
wlr_xdg_toplevel_set_wm_capabilities( wlr_xdg_toplevel_set_wm_capabilities(
c->surface.xdg->toplevel, WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); c->surface.xdg->toplevel, WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
@@ -898,8 +898,8 @@ static void commitnotify(struct wl_listener *listener, void *data) {
static void commitpopup(struct wl_listener *listener, void *data) { static void commitpopup(struct wl_listener *listener, void *data) {
struct wlr_surface *surface = data; struct wlr_surface *surface = data;
struct wlr_xdg_popup *popup = wlr_xdg_popup_try_from_wlr_surface(surface); struct wlr_xdg_popup *popup = wlr_xdg_popup_try_from_wlr_surface(surface);
LayerSurface *l = NULL; LayerSurface *l = nullptr;
Client *c = NULL; Client *c = nullptr;
struct wlr_box box; struct wlr_box box;
int type = -1; int type = -1;
@@ -939,7 +939,7 @@ static void createidleinhibitor(struct wl_listener *listener, void *data) {
struct wlr_idle_inhibitor_v1 *idle_inhibitor = data; struct wlr_idle_inhibitor_v1 *idle_inhibitor = data;
LISTEN_STATIC(&idle_inhibitor->events.destroy, destroyidleinhibitor); LISTEN_STATIC(&idle_inhibitor->events.destroy, destroyidleinhibitor);
checkidleinhibitor(NULL); checkidleinhibitor(nullptr);
} }
static void createkeyboard(struct wlr_keyboard *keyboard) { static void createkeyboard(struct wlr_keyboard *keyboard) {
@@ -961,7 +961,7 @@ static KeyboardGroup *createkeyboardgroup(void) {
/* Prepare an XKB keymap and assign it to the keyboard group. */ /* Prepare an XKB keymap and assign it to the keyboard group. */
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (!(keymap = xkb_keymap_new_from_names( if (!(keymap = xkb_keymap_new_from_names(
context, &(struct xkb_rule_names){.options = NULL}, context, &(struct xkb_rule_names){.options = nullptr},
XKB_KEYMAP_COMPILE_NO_FLAGS))) XKB_KEYMAP_COMPILE_NO_FLAGS)))
die("failed to compile keymap"); die("failed to compile keymap");
@@ -997,7 +997,7 @@ static void createlayersurface(struct wl_listener *listener, void *data) {
layers[layermap[layer_surface->pending.layer]]; layers[layermap[layer_surface->pending.layer]];
if (!layer_surface->output && if (!layer_surface->output &&
!(layer_surface->output = selmon ? selmon->wlr_output : NULL)) { !(layer_surface->output = selmon ? selmon->wlr_output : nullptr)) {
wlr_layer_surface_v1_destroy(layer_surface); wlr_layer_surface_v1_destroy(layer_surface);
return; return;
} }
@@ -1162,7 +1162,7 @@ static void createnotify(struct wl_listener *listener, void *data) {
/* This event is raised when a client creates a new toplevel (application /* This event is raised when a client creates a new toplevel (application
* window). */ * window). */
struct wlr_xdg_toplevel *toplevel = data; struct wlr_xdg_toplevel *toplevel = data;
Client *c = NULL; Client *c = nullptr;
/* Allocate a Client for this surface */ /* Allocate a Client for this surface */
c = toplevel->base->data = ecalloc(1, sizeof(*c)); c = toplevel->base->data = ecalloc(1, sizeof(*c));
@@ -1281,13 +1281,13 @@ static void cursorframe(struct wl_listener *listener, void *data) {
static void cursorwarptohint(void) { static void cursorwarptohint(void) {
if (!active_constraint) if (!active_constraint)
return; return;
Client *c = NULL; Client *c = nullptr;
double sx = active_constraint->current.cursor_hint.x; double sx = active_constraint->current.cursor_hint.x;
double sy = active_constraint->current.cursor_hint.y; double sy = active_constraint->current.cursor_hint.y;
toplevel_from_wlr_surface(active_constraint->surface, &c, NULL); toplevel_from_wlr_surface(active_constraint->surface, &c, nullptr);
if (c && active_constraint->current.cursor_hint.enabled) { if (c && active_constraint->current.cursor_hint.enabled) {
wlr_cursor_warp(cursor, NULL, sx + c->geom.x + c->bw, wlr_cursor_warp(cursor, nullptr, sx + c->geom.x + c->bw,
sy + c->geom.y + c->bw); sy + c->geom.y + c->bw);
wlr_seat_pointer_warp(active_constraint->seat, sx, sy); wlr_seat_pointer_warp(active_constraint->seat, sx, sy);
} }
@@ -1303,7 +1303,7 @@ 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) {
/* 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, NULL, 0, 0, 0, 0); motionnotify(0, nullptr, 0, 0, 0, 0);
wl_list_remove(&listener->link); wl_list_remove(&listener->link);
free(listener); free(listener);
} }
@@ -1336,7 +1336,7 @@ static void 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, NULL, 0, 0, 0, 0); motionnotify(0, nullptr, 0, 0, 0, 0);
destroy: destroy:
wl_list_remove(&lock->new_surface.link); wl_list_remove(&lock->new_surface.link);
@@ -1344,7 +1344,7 @@ destroy:
wl_list_remove(&lock->destroy.link); wl_list_remove(&lock->destroy.link);
wlr_scene_node_destroy(&lock->scene->node); wlr_scene_node_destroy(&lock->scene->node);
cur_lock = NULL; cur_lock = nullptr;
free(lock); free(lock);
} }
@@ -1352,7 +1352,7 @@ static void destroylocksurface(struct wl_listener *listener, void *data) {
Monitor *m = wl_container_of(listener, m, destroy_lock_surface); Monitor *m = wl_container_of(listener, m, destroy_lock_surface);
struct wlr_session_lock_surface_v1 *surface, *lock_surface = m->lock_surface; struct wlr_session_lock_surface_v1 *surface, *lock_surface = m->lock_surface;
m->lock_surface = NULL; m->lock_surface = nullptr;
wl_list_remove(&m->destroy_lock_surface.link); wl_list_remove(&m->destroy_lock_surface.link);
if (lock_surface->surface != seat->keyboard_state.focused_surface) if (lock_surface->surface != seat->keyboard_state.focused_surface)
@@ -1398,7 +1398,7 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data) {
if (active_constraint == pointer_constraint->constraint) { if (active_constraint == pointer_constraint->constraint) {
cursorwarptohint(); cursorwarptohint();
active_constraint = NULL; active_constraint = nullptr;
} }
wl_list_remove(&pointer_constraint->destroy.link); wl_list_remove(&pointer_constraint->destroy.link);
@@ -1439,8 +1439,8 @@ static bool warp_focus = true;
void focusclient(Client *c, int lift) { void focusclient(Client *c, int lift) {
struct wlr_surface *old = seat->keyboard_state.focused_surface; struct wlr_surface *old = seat->keyboard_state.focused_surface;
int unused_lx, unused_ly, old_client_type; int unused_lx, unused_ly, old_client_type;
Client *old_c = NULL; Client *old_c = nullptr;
LayerSurface *old_l = NULL; LayerSurface *old_l = nullptr;
if (locked) if (locked)
return; return;
@@ -1505,7 +1505,7 @@ void focusclient(Client *c, int lift) {
} }
/* Change cursor surface */ /* Change cursor surface */
motionnotify(0, NULL, 0, 0, 0, 0); motionnotify(0, nullptr, 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));
@@ -1514,7 +1514,7 @@ void focusclient(Client *c, int lift) {
client_activate_surface(client_surface(c), 1); client_activate_surface(client_surface(c), 1);
if (cfg.sloppyfocus && warp_focus) if (cfg.sloppyfocus && warp_focus)
wlr_cursor_warp(cursor, NULL, c->geom.x + c->geom.width / 2, wlr_cursor_warp(cursor, nullptr, c->geom.x + c->geom.width / 2,
c->geom.y + c->geom.height / 2); c->geom.y + c->geom.height / 2);
} }
@@ -1541,7 +1541,7 @@ static void client_center(Client *c, int *cx, int *cy) {
* *
* In monocle layout, this cycles through clients instead. */ * In monocle layout, this cycles through clients instead. */
void focusdir(const Arg *arg) { void focusdir(const Arg *arg) {
Client *c, *best = NULL; Client *c, *best = nullptr;
Client *sel = focustop(selmon); Client *sel = focustop(selmon);
int sx, sy, cx, cy; int sx, sy, cx, cy;
double bestdist = 1e18, dist; double bestdist = 1e18, dist;
@@ -1557,7 +1557,7 @@ void focusdir(const Arg *arg) {
/* In monocle layout, cycle through clients in order */ /* In monocle layout, cycle through clients in order */
if (curlayout(selmon)->arrange == monocle) { if (curlayout(selmon)->arrange == monocle) {
Client *first = NULL, *next = NULL, *prev = NULL; Client *first = nullptr, *next = nullptr, *prev = nullptr;
int found = 0; int found = 0;
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
@@ -1652,7 +1652,7 @@ Client *focustop(Monitor *m) {
if (VISIBLEON(c, m)) if (VISIBLEON(c, m))
return c; return c;
} }
return NULL; return nullptr;
} }
static void fullscreennotify(struct wl_listener *listener, void *data) { static void fullscreennotify(struct wl_listener *listener, void *data) {
@@ -1685,10 +1685,10 @@ static void gpureset(struct wl_listener *listener, void *data) {
static void handlesig(int signo) { static void handlesig(int signo) {
if (signo == SIGCHLD) if (signo == SIGCHLD)
while (waitpid(-1, NULL, WNOHANG) > 0) while (waitpid(-1, nullptr, WNOHANG) > 0)
; ;
else if (signo == SIGINT || signo == SIGTERM) else if (signo == SIGINT || signo == SIGTERM)
quit(NULL); quit(nullptr);
} }
static void inputdevice(struct wl_listener *listener, void *data) { static void inputdevice(struct wl_listener *listener, void *data) {
@@ -1727,7 +1727,7 @@ static void inputdevice(struct wl_listener *listener, void *data) {
static void dispatch_action(const char *action, static void dispatch_action(const char *action,
const char (*args)[CFG_MAX_STRLEN], int nargs) { const char (*args)[CFG_MAX_STRLEN], int nargs) {
Arg arg = {0}; Arg arg = {0};
const char *a0 = nargs > 0 ? args[0] : NULL; const char *a0 = nargs > 0 ? args[0] : nullptr;
if (!strcmp(action, "spawn")) { if (!strcmp(action, "spawn")) {
/* Build a NULL-terminated argv on the stack. /* Build a NULL-terminated argv on the stack.
@@ -1736,29 +1736,29 @@ static void dispatch_action(const char *action,
int i; int i;
for (i = 0; i < nargs && i < CFG_MAX_ARGS; i++) for (i = 0; i < nargs && i < CFG_MAX_ARGS; i++)
argv[i] = args[i]; argv[i] = args[i];
argv[i] = NULL; argv[i] = nullptr;
arg.v = argv; arg.v = argv;
spawn(&arg); spawn(&arg);
return; return;
} }
if (!strcmp(action, "killclient")) { if (!strcmp(action, "killclient")) {
killclient(NULL); killclient(nullptr);
return; return;
} }
if (!strcmp(action, "togglefloating")) { if (!strcmp(action, "togglefloating")) {
togglefloating(NULL); togglefloating(nullptr);
return; return;
} }
if (!strcmp(action, "togglefullscreen")) { if (!strcmp(action, "togglefullscreen")) {
togglefullscreen(NULL); togglefullscreen(nullptr);
return; return;
} }
if (!strcmp(action, "togglegaps")) { if (!strcmp(action, "togglegaps")) {
togglegaps(NULL); togglegaps(nullptr);
return; return;
} }
if (!strcmp(action, "quit")) { if (!strcmp(action, "quit")) {
quit(NULL); quit(nullptr);
return; return;
} }
@@ -1895,11 +1895,11 @@ static void dispatch_action(const char *action,
return; return;
} }
if (!strcmp(action, "togglescratchpad")) { if (!strcmp(action, "togglescratchpad")) {
togglescratchpad(NULL); togglescratchpad(nullptr);
return; return;
} }
if (!strcmp(action, "swapdirscratchpad")) { if (!strcmp(action, "swapdirscratchpad")) {
swapdirscratchpad(NULL); swapdirscratchpad(nullptr);
return; return;
} }
@@ -2045,7 +2045,7 @@ static void locksession(struct wl_listener *listener, void *data) {
return; return;
} }
lock = session_lock->data = ecalloc(1, sizeof(*lock)); lock = session_lock->data = ecalloc(1, sizeof(*lock));
focusclient(NULL, 0); focusclient(nullptr, 0);
lock->scene = wlr_scene_tree_create(layers[LyrBlock]); lock->scene = wlr_scene_tree_create(layers[LyrBlock]);
cur_lock = lock->lock = session_lock; cur_lock = lock->lock = session_lock;
@@ -2061,7 +2061,7 @@ static void locksession(struct wl_listener *listener, void *data) {
static void mapnotify(struct wl_listener *listener, void *data) { static void mapnotify(struct wl_listener *listener, void *data) {
/* Called when the surface is mapped, or ready to display on-screen. */ /* Called when the surface is mapped, or ready to display on-screen. */
Client *p = NULL; Client *p = nullptr;
Client *w, *c = wl_container_of(listener, c, map); Client *w, *c = wl_container_of(listener, c, map);
Monitor *m; Monitor *m;
int i; int i;
@@ -2188,13 +2188,13 @@ static void motionabsolute(struct wl_listener *listener, void *data) {
static void motionnotify(uint32_t time, struct wlr_input_device *device, double dx, static void motionnotify(uint32_t time, struct wlr_input_device *device, double dx,
double dy, double dx_unaccel, double dy_unaccel) { double dy, double dx_unaccel, double dy_unaccel) {
double sx = 0, sy = 0, sx_confined, sy_confined; double sx = 0, sy = 0, sx_confined, sy_confined;
Client *c = NULL, *w = NULL; Client *c = nullptr, *w = nullptr;
LayerSurface *l = NULL; LayerSurface *l = nullptr;
struct wlr_surface *surface = NULL; struct wlr_surface *surface = nullptr;
struct wlr_pointer_constraint_v1 *constraint; struct wlr_pointer_constraint_v1 *constraint;
/* Find the client under the pointer and send the event along. */ /* Find the client under the pointer and send the event along. */
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy); xytonode(cursor->x, cursor->y, &surface, &c, nullptr, &sx, &sy);
if (cursor_mode == CurPressed && !seat->drag && if (cursor_mode == CurPressed && !seat->drag &&
surface != seat->pointer_state.focused_surface && surface != seat->pointer_state.focused_surface &&
@@ -2217,7 +2217,7 @@ static void motionnotify(uint32_t time, struct wlr_input_device *device, double
if (active_constraint && cursor_mode != CurResize && if (active_constraint && cursor_mode != CurResize &&
cursor_mode != CurMove) { cursor_mode != CurMove) {
toplevel_from_wlr_surface(active_constraint->surface, &c, NULL); toplevel_from_wlr_surface(active_constraint->surface, &c, nullptr);
if (c && if (c &&
active_constraint->surface == seat->pointer_state.focused_surface) { active_constraint->surface == seat->pointer_state.focused_surface) {
sx = cursor->x - c->geom.x - c->bw; sx = cursor->x - c->geom.x - c->bw;
@@ -2290,7 +2290,7 @@ static void motionrelative(struct wl_listener *listener, void *data) {
static void moveresize(const Arg *arg) { static void moveresize(const Arg *arg) {
if (cursor_mode != CurNormal && cursor_mode != CurPressed) if (cursor_mode != CurNormal && cursor_mode != CurPressed)
return; return;
xytonode(cursor->x, cursor->y, NULL, &grabc, NULL, NULL, NULL); xytonode(cursor->x, cursor->y, nullptr, &grabc, nullptr, nullptr, nullptr);
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen) if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen)
return; return;
@@ -2314,7 +2314,7 @@ static void moveresize(const Arg *arg) {
case CurResize: case CurResize:
/* Doesn't work for X11 output - the next absolute motion event /* Doesn't work for X11 output - the next absolute motion event
* returns the cursor to where it started */ * returns the cursor to where it started */
wlr_cursor_warp_closest(cursor, NULL, grabc->geom.x + grabc->geom.width, wlr_cursor_warp_closest(cursor, nullptr, grabc->geom.x + grabc->geom.width,
grabc->geom.y + grabc->geom.height); grabc->geom.y + grabc->geom.height);
wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize"); wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
break; break;
@@ -2385,7 +2385,7 @@ static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config,
wlr_output_configuration_v1_send_failed(config); wlr_output_configuration_v1_send_failed(config);
wlr_output_configuration_v1_destroy(config); wlr_output_configuration_v1_destroy(config);
updatemons(NULL, NULL); updatemons(nullptr, nullptr);
} }
static void outputmgrtest(struct wl_listener *listener, void *data) { static void outputmgrtest(struct wl_listener *listener, void *data) {
@@ -2423,7 +2423,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface, double sx, doub
} }
void printstatus(void) { void printstatus(void) {
Monitor *m = NULL; Monitor *m = nullptr;
Client *c; Client *c;
uint32_t occ, urg, sel; uint32_t occ, urg, sel;
@@ -2475,7 +2475,7 @@ static void powermgrsetmode(struct wl_listener *listener, void *data) {
wlr_output_commit_state(m->wlr_output, &state); wlr_output_commit_state(m->wlr_output, &state);
m->asleep = !event->mode; m->asleep = !event->mode;
updatemons(NULL, NULL); updatemons(nullptr, nullptr);
} }
void quit(const Arg *arg) { wl_display_terminate(dpy); } void quit(const Arg *arg) { wl_display_terminate(dpy); }
@@ -2496,7 +2496,7 @@ static void rendermon(struct wl_listener *listener, void *data) {
goto skip; goto skip;
} }
wlr_scene_output_commit(m->scene_output, NULL); wlr_scene_output_commit(m->scene_output, nullptr);
skip: skip:
/* Let clients know a frame has been rendered */ /* Let clients know a frame has been rendered */
@@ -2524,7 +2524,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data) {
static void requestmonstate(struct wl_listener *listener, void *data) { static void requestmonstate(struct wl_listener *listener, void *data) {
struct wlr_output_event_request_state *event = data; struct wlr_output_event_request_state *event = data;
wlr_output_commit_state(event->output, event->state); wlr_output_commit_state(event->output, event->state);
updatemons(NULL, NULL); updatemons(nullptr, nullptr);
} }
void resize(Client *c, struct wlr_box geo, int interact) { void resize(Client *c, struct wlr_box geo, int interact) {
@@ -2584,7 +2584,7 @@ static void run(char *startup_cmd) {
dup2(piperw[0], STDIN_FILENO); dup2(piperw[0], STDIN_FILENO);
close(piperw[0]); close(piperw[0]);
close(piperw[1]); close(piperw[1]);
execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL); execl("/bin/sh", "/bin/sh", "-c", startup_cmd, nullptr);
die("startup: execl:"); die("startup: execl:");
} }
dup2(piperw[1], STDOUT_FILENO); dup2(piperw[1], STDOUT_FILENO);
@@ -2610,7 +2610,7 @@ static void run(char *startup_cmd) {
* cursor position, and set default cursor image */ * cursor position, and set default cursor image */
selmon = xytomon(cursor->x, cursor->y); selmon = xytomon(cursor->x, cursor->y);
wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y); wlr_cursor_warp_closest(cursor, nullptr, cursor->x, cursor->y);
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default"); wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
/* Run the Wayland event loop. This does not return until you exit the /* Run the Wayland event loop. This does not return until you exit the
@@ -2717,7 +2717,7 @@ static void setlayout(const Arg *arg) {
if (sel && VISIBLEON(sel, selmon) && !sel->isfloating && !sel->isfullscreen) if (sel && VISIBLEON(sel, selmon) && !sel->isfloating && !sel->isfullscreen)
selmon->master_master[ti] = sel; selmon->master_master[ti] = sel;
else else
selmon->master_master[ti] = NULL; selmon->master_master[ti] = nullptr;
/* Convert to floating: float all tiled clients */ /* Convert to floating: float all tiled clients */
} else if (!curlayout(selmon)->arrange) { } else if (!curlayout(selmon)->arrange) {
Client *c; Client *c;
@@ -2998,7 +2998,7 @@ static void setup(void) {
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
for (i = 0; i < (int)LENGTH(sig); i++) for (i = 0; i < (int)LENGTH(sig); i++)
sigaction(sig[i], &sa, NULL); sigaction(sig[i], &sa, nullptr);
/* Load config before anything else so all settings are ready */ /* Load config before anything else so all settings are ready */
{ {
@@ -3020,7 +3020,7 @@ static void setup(void) {
config_path[sizeof(config_path) - 1] = '\0'; config_path[sizeof(config_path) - 1] = '\0';
} }
wlr_log_init(cfg.log_level, NULL); wlr_log_init(cfg.log_level, nullptr);
/* The Wayland display is managed by libwayland. It handles accepting /* The Wayland display is managed by libwayland. It handles accepting
* clients from the Unix socket, managing Wayland globals, and so on and so * clients from the Unix socket, managing Wayland globals, and so on and so
@@ -3041,7 +3041,7 @@ static void setup(void) {
path = cfgpath; path = cfgpath;
} }
cfg_watch_src = cfg_watch_src =
config_watch_start(event_loop, path, on_config_reload, NULL); config_watch_start(event_loop, path, on_config_reload, nullptr);
} }
/* The backend is a wlroots feature which abstracts the underlying input and /* The backend is a wlroots feature which abstracts the underlying input and
@@ -3187,7 +3187,7 @@ static void setup(void) {
* Xcursor themes to source cursor images from and makes sure that cursor * Xcursor themes to source cursor images from and makes sure that cursor
* images are available at all scale factors on the screen (necessary for * images are available at all scale factors on the screen (necessary for
* HiDPI support). Scaled cursors will be loaded with each output. */ * HiDPI support). Scaled cursors will be loaded with each output. */
cursor_mgr = wlr_xcursor_manager_create(NULL, 24); cursor_mgr = wlr_xcursor_manager_create(nullptr, 24);
setenv("XCURSOR_SIZE", "24", 1); setenv("XCURSOR_SIZE", "24", 1);
/* /*
@@ -3320,7 +3320,7 @@ static void togglegaps(const Arg *arg) {
/* swapdir is essentially focusdir but swap */ /* swapdir is essentially focusdir but swap */
static void swapdir(const Arg *arg) { static void swapdir(const Arg *arg) {
Client *c, *other = NULL; Client *c, *other = nullptr;
Client *sel = focustop(selmon); Client *sel = focustop(selmon);
int sx, sy, cx, cy; int sx, sy, cx, cy;
double bestdist = 1e18, dist; double bestdist = 1e18, dist;
@@ -3463,12 +3463,12 @@ static void unmaplayersurfacenotify(struct wl_listener *listener, void *data) {
l->mapped = 0; l->mapped = 0;
wlr_scene_node_set_enabled(&l->scene->node, 0); wlr_scene_node_set_enabled(&l->scene->node, 0);
if (l == exclusive_focus) if (l == exclusive_focus)
exclusive_focus = NULL; exclusive_focus = nullptr;
if (l->layer_surface->output && (l->mon = l->layer_surface->output->data)) if (l->layer_surface->output && (l->mon = l->layer_surface->output->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, NULL, 0, 0, 0, 0); motionnotify(0, nullptr, 0, 0, 0, 0);
} }
static void unmapnotify(struct wl_listener *listener, void *data) { static void unmapnotify(struct wl_listener *listener, void *data) {
@@ -3476,12 +3476,12 @@ static void unmapnotify(struct wl_listener *listener, void *data) {
Client *c = wl_container_of(listener, c, unmap); Client *c = wl_container_of(listener, c, unmap);
if (c == grabc) { if (c == grabc) {
cursor_mode = CurNormal; cursor_mode = CurNormal;
grabc = NULL; grabc = nullptr;
} }
if (client_is_unmanaged(c)) { if (client_is_unmanaged(c)) {
if (c == exclusive_focus) { if (c == exclusive_focus) {
exclusive_focus = NULL; exclusive_focus = nullptr;
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
} }
} else { } else {
@@ -3493,9 +3493,9 @@ static void unmapnotify(struct wl_listener *listener, void *data) {
/* Clear any stale scratchpad references to this client */ /* Clear any stale scratchpad references to this client */
if (oldmon) { if (oldmon) {
if (oldmon->scratchpad_current == c) if (oldmon->scratchpad_current == c)
oldmon->scratchpad_current = NULL; oldmon->scratchpad_current = nullptr;
if (oldmon->scratchpad_prev_focus == c) if (oldmon->scratchpad_prev_focus == c)
oldmon->scratchpad_prev_focus = NULL; oldmon->scratchpad_prev_focus = nullptr;
} }
if (c->isscratchpad && oldmon && oldmon->scratchpad_visible) { if (c->isscratchpad && oldmon && oldmon->scratchpad_visible) {
/* Closing a scratchpad client: focus another scratchpad client */ /* Closing a scratchpad client: focus another scratchpad client */
@@ -3510,17 +3510,17 @@ static void unmapnotify(struct wl_listener *listener, void *data) {
} }
if (!found) if (!found)
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
c->mon = NULL; c->mon = nullptr;
arrange(oldmon); arrange(oldmon);
} else { } else {
setmon(c, NULL, 0); setmon(c, nullptr, 0);
} }
} }
wlr_scene_node_destroy(&c->scene->node); wlr_scene_node_destroy(&c->scene->node);
printstatus(); printstatus();
ipc_socket_send_window_event("close"); ipc_socket_send_window_event("close");
motionnotify(0, NULL, 0, 0, 0, 0); motionnotify(0, nullptr, 0, 0, 0, 0);
} }
static void updatemons(struct wl_listener *listener, void *data) { static void updatemons(struct wl_listener *listener, void *data) {
@@ -3557,7 +3557,7 @@ static void updatemons(struct wl_listener *listener, void *data) {
} }
/* Now that we update the output layout we can get its box */ /* Now that we update the output layout we can get its box */
wlr_output_layout_get_box(output_layout, NULL, &sgeom); wlr_output_layout_get_box(output_layout, nullptr, &sgeom);
wlr_scene_node_set_position(&root_bg->node, sgeom.x, sgeom.y); wlr_scene_node_set_position(&root_bg->node, sgeom.x, sgeom.y);
wlr_scene_rect_set_size(root_bg, sgeom.width, sgeom.height); wlr_scene_rect_set_size(root_bg, sgeom.width, sgeom.height);
@@ -3616,7 +3616,7 @@ static void updatemons(struct wl_listener *listener, void *data) {
} }
} }
wlr_cursor_move(cursor, NULL, 0, 0); wlr_cursor_move(cursor, nullptr, 0, 0);
wlr_output_manager_v1_set_configuration(output_mgr, config); wlr_output_manager_v1_set_configuration(output_mgr, config);
} }
@@ -3631,8 +3631,8 @@ static void updatetitle(struct wl_listener *listener, void *data) {
static void urgent(struct wl_listener *listener, void *data) { static void urgent(struct wl_listener *listener, void *data) {
struct wlr_xdg_activation_v1_request_activate_event *event = data; struct wlr_xdg_activation_v1_request_activate_event *event = data;
Client *c = NULL; Client *c = nullptr;
toplevel_from_wlr_surface(event->surface, &c, NULL); toplevel_from_wlr_surface(event->surface, &c, nullptr);
if (!c || c == focustop(selmon)) if (!c || c == focustop(selmon))
return; return;
@@ -3678,15 +3678,15 @@ static void virtualpointer(struct wl_listener *listener, void *data) {
Monitor *xytomon(double x, double y) { Monitor *xytomon(double x, double y) {
struct wlr_output *o = wlr_output_layout_output_at(output_layout, x, y); struct wlr_output *o = wlr_output_layout_output_at(output_layout, x, y);
return o ? o->data : NULL; return o ? o->data : nullptr;
} }
static void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, static void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
LayerSurface **pl, double *nx, double *ny) { LayerSurface **pl, double *nx, double *ny) {
struct wlr_scene_node *node, *pnode; struct wlr_scene_node *node, *pnode;
struct wlr_surface *surface = NULL; struct wlr_surface *surface = nullptr;
Client *c = NULL; Client *c = nullptr;
LayerSurface *l = NULL; LayerSurface *l = nullptr;
int layer; int layer;
for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) { for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) {
@@ -3701,7 +3701,7 @@ static void xytonode(double x, double y, struct wlr_surface **psurface, Client *
for (pnode = node; pnode && !c; pnode = &pnode->parent->node) for (pnode = node; pnode && !c; pnode = &pnode->parent->node)
c = pnode->data; c = pnode->data;
if (c && c->type == LayerShell) { if (c && c->type == LayerShell) {
c = NULL; c = nullptr;
l = pnode->data; l = pnode->data;
} }
} }
@@ -3816,7 +3816,7 @@ static void xwaylandready(struct wl_listener *listener, void *data) {
// ── main() ────────────────────────────────────────────────── // ── main() ──────────────────────────────────────────────────
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
char *startup_cmd = NULL; char *startup_cmd = nullptr;
int c; int c;
while ((c = getopt(argc, argv, "c:s:hdv")) != -1) { while ((c = getopt(argc, argv, "c:s:hdv")) != -1) {
+7 -7
View File
@@ -53,7 +53,7 @@ void scratchpad_arrange(Monitor *m) {
void togglescratchpad(const Arg *arg) { void togglescratchpad(const Arg *arg) {
Monitor *m = selmon; Monitor *m = selmon;
Client *c, *focus = NULL; Client *c, *focus = nullptr;
if (!m) if (!m)
return; return;
@@ -92,7 +92,7 @@ void togglescratchpad(const Arg *arg) {
client_set_suspended(c, 1); client_set_suspended(c, 1);
} }
} }
m->scratchpad_current = NULL; m->scratchpad_current = nullptr;
/* Restore focus to previous client */ /* Restore focus to previous client */
if (m->scratchpad_prev_focus && VISIBLEON(m->scratchpad_prev_focus, m)) if (m->scratchpad_prev_focus && VISIBLEON(m->scratchpad_prev_focus, m))
focusclient(m->scratchpad_prev_focus, 1); focusclient(m->scratchpad_prev_focus, 1);
@@ -114,7 +114,7 @@ void swapdirscratchpad(const Arg *arg) {
if (sel->isscratchpad) { if (sel->isscratchpad) {
/* Move FROM scratchpad to current workspace */ /* Move FROM scratchpad to current workspace */
Client *next = NULL; Client *next = nullptr;
sel->isscratchpad = 0; sel->isscratchpad = 0;
sel->isfloating = 0; sel->isfloating = 0;
sel->tags = selmon->tagset[selmon->seltags]; sel->tags = selmon->tagset[selmon->seltags];
@@ -127,11 +127,11 @@ void swapdirscratchpad(const Arg *arg) {
} }
} }
if (!next) if (!next)
selmon->scratchpad_current = NULL; selmon->scratchpad_current = nullptr;
else else
selmon->scratchpad_current = next; selmon->scratchpad_current = next;
} else { } else {
selmon->scratchpad_current = NULL; selmon->scratchpad_current = nullptr;
} }
/* setfloating reparents + arranges; let it manage visibility */ /* setfloating reparents + arranges; let it manage visibility */
setfloating(sel, 0); setfloating(sel, 0);
@@ -177,7 +177,7 @@ void swapdirscratchpad(const Arg *arg) {
void scratchpad_focusdir_cycle(const Arg *arg) { void scratchpad_focusdir_cycle(const Arg *arg) {
Client *sel = focustop(selmon); Client *sel = focustop(selmon);
Client *c, *first = NULL, *next = NULL, *prev = NULL; Client *c, *first = nullptr, *next = nullptr, *prev = nullptr;
int found = 0; int found = 0;
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
@@ -196,7 +196,7 @@ void scratchpad_focusdir_cycle(const Arg *arg) {
prev = c; prev = c;
} }
Client *target = NULL; Client *target = nullptr;
if (arg->i == WLR_DIRECTION_DOWN || arg->i == WLR_DIRECTION_RIGHT) { if (arg->i == WLR_DIRECTION_DOWN || arg->i == WLR_DIRECTION_RIGHT) {
if (next) if (next)
target = next; target = next;
+2 -2
View File
@@ -7,7 +7,7 @@
#include "util.h" #include "util.h"
_Noreturn void [[noreturn]] void
die(const char *fmt, ...) { die(const char *fmt, ...) {
va_list ap; va_list ap;
@@ -17,7 +17,7 @@ die(const char *fmt, ...) {
if (fmt[0] && fmt[strlen(fmt)-1] == ':') { if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
fputc(' ', stderr); fputc(' ', stderr);
perror(NULL); perror(nullptr);
} else { } else {
fputc('\n', stderr); fputc('\n', stderr);
} }
+1 -1
View File
@@ -2,6 +2,6 @@
#include <stddef.h> #include <stddef.h>
_Noreturn void die(const char *fmt, ...); [[noreturn]] void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size); void *ecalloc(size_t nmemb, size_t size);
int fd_set_nonblock(int fd); int fd_set_nonblock(int fd);
+28 -28
View File
@@ -202,7 +202,7 @@ static void destroy_workspace_resource(
struct wlr_ext_workspace_v1_resource *workspace_res) { struct wlr_ext_workspace_v1_resource *workspace_res) {
wl_list_remove(&workspace_res->link); wl_list_remove(&workspace_res->link);
wl_list_remove(&workspace_res->manager_resource_link); wl_list_remove(&workspace_res->manager_resource_link);
wl_resource_set_user_data(workspace_res->resource, NULL); wl_resource_set_user_data(workspace_res->resource, nullptr);
free(workspace_res); free(workspace_res);
} }
@@ -220,7 +220,7 @@ static struct wlr_ext_workspace_v1_resource *create_workspace_resource(
struct wlr_ext_workspace_v1_resource *workspace_res = struct wlr_ext_workspace_v1_resource *workspace_res =
calloc(1, sizeof(*workspace_res)); calloc(1, sizeof(*workspace_res));
if (!workspace_res) { if (!workspace_res) {
return NULL; return nullptr;
} }
struct wl_client *client = wl_resource_get_client(manager_res->resource); struct wl_client *client = wl_resource_get_client(manager_res->resource);
@@ -229,7 +229,7 @@ static struct wlr_ext_workspace_v1_resource *create_workspace_resource(
wl_resource_get_version(manager_res->resource), 0); wl_resource_get_version(manager_res->resource), 0);
if (!workspace_res->resource) { if (!workspace_res->resource) {
free(workspace_res); free(workspace_res);
return NULL; return nullptr;
} }
wl_resource_set_implementation(workspace_res->resource, &workspace_impl, wl_resource_set_implementation(workspace_res->resource, &workspace_impl,
workspace_res, workspace_resource_destroy); workspace_res, workspace_resource_destroy);
@@ -247,7 +247,7 @@ static void
destroy_group_resource(struct wlr_ext_workspace_group_v1_resource *group_res) { destroy_group_resource(struct wlr_ext_workspace_group_v1_resource *group_res) {
wl_list_remove(&group_res->link); wl_list_remove(&group_res->link);
wl_list_remove(&group_res->manager_resource_link); wl_list_remove(&group_res->manager_resource_link);
wl_resource_set_user_data(group_res->resource, NULL); wl_resource_set_user_data(group_res->resource, nullptr);
free(group_res); free(group_res);
} }
@@ -265,16 +265,16 @@ static struct wlr_ext_workspace_group_v1_resource *create_group_resource(
struct wlr_ext_workspace_group_v1_resource *group_res = struct wlr_ext_workspace_group_v1_resource *group_res =
calloc(1, sizeof(*group_res)); calloc(1, sizeof(*group_res));
if (!group_res) { if (!group_res) {
return NULL; return nullptr;
} }
struct wl_client *client = wl_resource_get_client(manager_res->resource); struct wl_client *client = wl_resource_get_client(manager_res->resource);
uint32_t version = wl_resource_get_version(manager_res->resource); uint32_t version = wl_resource_get_version(manager_res->resource);
group_res->resource = wl_resource_create( group_res->resource = wl_resource_create(
client, &ext_workspace_group_handle_v1_interface, version, 0); client, &ext_workspace_group_handle_v1_interface, version, 0);
if (group_res->resource == NULL) { if (group_res->resource == nullptr) {
free(group_res); free(group_res);
return NULL; return nullptr;
} }
wl_resource_set_implementation(group_res->resource, &group_impl, group_res, wl_resource_set_implementation(group_res->resource, &group_impl, group_res,
group_handle_resource_destroy); group_handle_resource_destroy);
@@ -309,30 +309,30 @@ clear_requests_by(struct wlr_ext_workspace_manager_v1_resource *manager_res,
switch (req->type) { switch (req->type) {
case WLR_EXT_WORKSPACE_V1_REQUEST_CREATE_WORKSPACE: case WLR_EXT_WORKSPACE_V1_REQUEST_CREATE_WORKSPACE:
if (group && req->create_workspace.group == group) { if (group && req->create_workspace.group == group) {
req->create_workspace.group = NULL; req->create_workspace.group = nullptr;
} }
break; break;
case WLR_EXT_WORKSPACE_V1_REQUEST_ACTIVATE: case WLR_EXT_WORKSPACE_V1_REQUEST_ACTIVATE:
if (workspace && req->activate.workspace == workspace) { if (workspace && req->activate.workspace == workspace) {
req->activate.workspace = NULL; req->activate.workspace = nullptr;
} }
break; break;
case WLR_EXT_WORKSPACE_V1_REQUEST_DEACTIVATE: case WLR_EXT_WORKSPACE_V1_REQUEST_DEACTIVATE:
if (workspace && req->deactivate.workspace == workspace) { if (workspace && req->deactivate.workspace == workspace) {
req->deactivate.workspace = NULL; req->deactivate.workspace = nullptr;
} }
break; break;
case WLR_EXT_WORKSPACE_V1_REQUEST_ASSIGN: case WLR_EXT_WORKSPACE_V1_REQUEST_ASSIGN:
if (workspace && req->assign.workspace == workspace) { if (workspace && req->assign.workspace == workspace) {
req->assign.workspace = NULL; req->assign.workspace = nullptr;
} }
if (group && req->assign.group == group) { if (group && req->assign.group == group) {
req->assign.group = NULL; req->assign.group = nullptr;
} }
break; break;
case WLR_EXT_WORKSPACE_V1_REQUEST_REMOVE: case WLR_EXT_WORKSPACE_V1_REQUEST_REMOVE:
if (workspace && req->remove.workspace == workspace) { if (workspace && req->remove.workspace == workspace) {
req->remove.workspace = NULL; req->remove.workspace = nullptr;
} }
break; break;
} }
@@ -361,7 +361,7 @@ static void handle_idle(void *data) {
wl_list_for_each(manager_res, &manager->resources, link) { wl_list_for_each(manager_res, &manager->resources, link) {
ext_workspace_manager_v1_send_done(manager_res->resource); ext_workspace_manager_v1_send_done(manager_res->resource);
} }
manager->idle_source = NULL; manager->idle_source = nullptr;
} }
static void static void
@@ -420,7 +420,7 @@ static void destroy_manager_resource(
} }
wl_list_remove(&manager_res->link); wl_list_remove(&manager_res->link);
wl_resource_set_user_data(manager_res->resource, NULL); wl_resource_set_user_data(manager_res->resource, nullptr);
free(manager_res); free(manager_res);
} }
@@ -527,7 +527,7 @@ static void manager_handle_display_destroy(struct wl_listener *listener,
struct wlr_ext_workspace_manager_v1 *manager = struct wlr_ext_workspace_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wl_signal_emit_mutable(&manager->events.destroy, NULL); wl_signal_emit_mutable(&manager->events.destroy, nullptr);
assert(wl_list_empty(&manager->events.commit.listener_list)); assert(wl_list_empty(&manager->events.commit.listener_list));
assert(wl_list_empty(&manager->events.destroy.listener_list)); assert(wl_list_empty(&manager->events.destroy.listener_list));
@@ -562,7 +562,7 @@ wlr_ext_workspace_manager_v1_create(struct wl_display *display,
struct wlr_ext_workspace_manager_v1 *manager = calloc(1, sizeof(*manager)); struct wlr_ext_workspace_manager_v1 *manager = calloc(1, sizeof(*manager));
if (!manager) { if (!manager) {
return NULL; return nullptr;
} }
manager->global = manager->global =
@@ -570,7 +570,7 @@ wlr_ext_workspace_manager_v1_create(struct wl_display *display,
manager, manager_bind); manager, manager_bind);
if (!manager->global) { if (!manager->global) {
free(manager); free(manager);
return NULL; return nullptr;
} }
manager->event_loop = wl_display_get_event_loop(display); manager->event_loop = wl_display_get_event_loop(display);
@@ -592,7 +592,7 @@ wlr_ext_workspace_group_handle_v1_create(
struct wlr_ext_workspace_manager_v1 *manager, uint32_t caps) { struct wlr_ext_workspace_manager_v1 *manager, uint32_t caps) {
struct wlr_ext_workspace_group_handle_v1 *group = calloc(1, sizeof(*group)); struct wlr_ext_workspace_group_handle_v1 *group = calloc(1, sizeof(*group));
if (!group) { if (!group) {
return NULL; return nullptr;
} }
group->manager = manager; group->manager = manager;
@@ -685,7 +685,7 @@ void wlr_ext_workspace_group_handle_v1_destroy(
return; return;
} }
wl_signal_emit_mutable(&group->events.destroy, NULL); wl_signal_emit_mutable(&group->events.destroy, nullptr);
assert(wl_list_empty(&group->events.destroy.listener_list)); assert(wl_list_empty(&group->events.destroy.listener_list));
@@ -693,7 +693,7 @@ void wlr_ext_workspace_group_handle_v1_destroy(
wl_list_for_each(workspace, &group->manager->workspaces, link) { wl_list_for_each(workspace, &group->manager->workspaces, link) {
if (workspace->group == group) { if (workspace->group == group) {
workspace_send_group(workspace, group, false); workspace_send_group(workspace, group, false);
workspace->group = NULL; workspace->group = nullptr;
} }
} }
@@ -705,7 +705,7 @@ void wlr_ext_workspace_group_handle_v1_destroy(
struct wlr_ext_workspace_manager_v1_resource *manager_res; struct wlr_ext_workspace_manager_v1_resource *manager_res;
wl_list_for_each(manager_res, &group->manager->resources, link) { wl_list_for_each(manager_res, &group->manager->resources, link) {
clear_requests_by(manager_res, group, NULL); clear_requests_by(manager_res, group, nullptr);
} }
struct wlr_ext_workspace_v1_group_output *group_output, *tmp3; struct wlr_ext_workspace_v1_group_output *group_output, *tmp3;
@@ -753,7 +753,7 @@ get_group_output(struct wlr_ext_workspace_group_handle_v1 *group,
return group_output; return group_output;
} }
} }
return NULL; return nullptr;
} }
void wlr_ext_workspace_group_handle_v1_output_enter( void wlr_ext_workspace_group_handle_v1_output_enter(
@@ -798,7 +798,7 @@ wlr_ext_workspace_handle_v1_create(struct wlr_ext_workspace_manager_v1 *manager,
struct wlr_ext_workspace_handle_v1 *workspace = struct wlr_ext_workspace_handle_v1 *workspace =
calloc(1, sizeof(*workspace)); calloc(1, sizeof(*workspace));
if (!workspace) { if (!workspace) {
return NULL; return nullptr;
} }
workspace->manager = manager; workspace->manager = manager;
@@ -808,7 +808,7 @@ wlr_ext_workspace_handle_v1_create(struct wlr_ext_workspace_manager_v1 *manager,
workspace->id = strdup(id); workspace->id = strdup(id);
if (!workspace->id) { if (!workspace->id) {
free(workspace); free(workspace);
return NULL; return nullptr;
} }
} }
@@ -841,7 +841,7 @@ void wlr_ext_workspace_handle_v1_destroy(
return; return;
} }
wl_signal_emit_mutable(&workspace->events.destroy, NULL); wl_signal_emit_mutable(&workspace->events.destroy, nullptr);
assert(wl_list_empty(&workspace->events.destroy.listener_list)); assert(wl_list_empty(&workspace->events.destroy.listener_list));
@@ -857,7 +857,7 @@ void wlr_ext_workspace_handle_v1_destroy(
struct wlr_ext_workspace_manager_v1_resource *manager_res; struct wlr_ext_workspace_manager_v1_resource *manager_res;
wl_list_for_each(manager_res, &workspace->manager->resources, link) { wl_list_for_each(manager_res, &workspace->manager->resources, link) {
clear_requests_by(manager_res, NULL, workspace); clear_requests_by(manager_res, nullptr, workspace);
} }
manager_schedule_done(workspace->manager); manager_schedule_done(workspace->manager);
@@ -895,7 +895,7 @@ void wlr_ext_workspace_handle_v1_set_name(
free(workspace->name); free(workspace->name);
workspace->name = strdup(name); workspace->name = strdup(name);
if (workspace->name == NULL) { if (workspace->name == nullptr) {
return; return;
} }