diff --git a/parser/parser.c b/parser/parser.c index eabb31f..c6c7b23 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -721,7 +721,7 @@ config_autostart_run(const Config *cfg) continue; } 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", cmd, strerror(errno)); _exit(1); @@ -750,7 +750,7 @@ config_autostart_run(const Config *cfg) now.tv_nsec >= deadline.tv_nsec)) break; /* looks like a daemon, move on */ 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; /* 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)); if (len < 0) { if (errno != EAGAIN) @@ -807,13 +807,13 @@ config_watch_start(struct wl_event_loop *loop, const char *path, config_reload_cb cb, void *userdata) { WatchState *ws = calloc(1, sizeof(*ws)); - if (!ws) return NULL; + if (!ws) return nullptr; ws->inotify_fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); if (ws->inotify_fd < 0) { perror("peachwm config: inotify_init1"); free(ws); - return NULL; + return nullptr; } 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"); close(ws->inotify_fd); free(ws); - return NULL; + return nullptr; } 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"); close(ws->inotify_fd); free(ws); - return NULL; + return nullptr; } ws->event_src = src; diff --git a/parser/parser.h b/parser/parser.h index a0d96d9..c7f8a3c 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -2,7 +2,6 @@ #define PEACHWM_PARSER_H #include -#include #include /* Maximum lengths. Good for the soul, they say */ diff --git a/src/client.c b/src/client.c index 1bc5628..b65dfe6 100644 --- a/src/client.c +++ b/src/client.c @@ -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_surface *root_surface; struct wlr_layer_surface_v1 *layer_surface; - Client *c = NULL; - LayerSurface *l = NULL; + Client *c = nullptr; + LayerSurface *l = nullptr; int type = -1; #ifdef XWAYLAND 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); while (xdg_surface) { - tmp_xdg_surface = NULL; + tmp_xdg_surface = nullptr; switch (xdg_surface->role) { case WLR_XDG_SURFACE_ROLE_POPUP: if (!xdg_surface->popup || !xdg_surface->popup->parent) @@ -189,16 +189,16 @@ client_get_geometry(Client *c, struct wlr_box *geom) Client * client_get_parent(Client *c) { - Client *p = NULL; + Client *p = nullptr; #ifdef XWAYLAND if (client_is_x11(c)) { 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; } #endif 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; } @@ -283,7 +283,7 @@ client_is_stopped(Client *c) return 0; #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) { /* 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. */ @@ -316,7 +316,7 @@ client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb) wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes, kb->num_keycodes, &kb->modifiers); else - wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL); + wlr_seat_keyboard_notify_enter(seat, s, nullptr, 0, nullptr); } void diff --git a/src/ext_workspace.c b/src/ext_workspace.c index c5c54f5..15a51af 100644 --- a/src/ext_workspace.c +++ b/src/ext_workspace.c @@ -111,7 +111,7 @@ ext_workspace_cleanupmon(Monitor *m) wlr_ext_workspace_group_handle_v1_output_leave( m->ext_group, m->wlr_output); wlr_ext_workspace_group_handle_v1_destroy(m->ext_group); - m->ext_group = NULL; + m->ext_group = nullptr; } /* status */ @@ -143,7 +143,7 @@ handle_ext_commit(struct wl_listener *listener, void *data) struct wlr_ext_workspace_v1_request *req; wl_list_for_each(req, event->requests, link) { - struct ext_workspace *ws = NULL; + struct ext_workspace *ws = nullptr; struct ext_workspace *w; switch (req->type) { diff --git a/src/ipc.c b/src/ipc.c index fa2f8b2..a322dca 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -8,7 +8,7 @@ #include "util.h" /* IPC globals */ -struct wl_global *ipc_global = NULL; +struct wl_global *ipc_global = nullptr; struct wl_list ipc_managers; /* IpcManager.link */ /* helpers */ @@ -20,7 +20,7 @@ ipc_output_for_mon(IpcManager *mgr, Monitor *m) wl_list_for_each(o, &mgr->outputs, link) if (o->mon == m) return o; - return NULL; + return nullptr; } /* 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); 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)); out->mon = m; @@ -272,5 +272,5 @@ ipc_init(void) { wl_list_init(&ipc_managers); ipc_global = wl_global_create(dpy, &zpeachwm_ipc_manager_v2_interface, - 2, NULL, ipc_bind); + 2, nullptr, ipc_bind); } diff --git a/src/ipc_socket.c b/src/ipc_socket.c index 46ade7b..66dabc0 100644 --- a/src/ipc_socket.c +++ b/src/ipc_socket.c @@ -111,7 +111,7 @@ json_puts(struct json_writer *w, const char *s) json_raw(w, s, strlen(s)); } -__attribute__((__format__(__printf__, 2, 3))) +[[gnu::format(printf, 2, 3)]] static void json_printf(struct json_writer *w, const char *fmt, ...) { @@ -419,7 +419,7 @@ static void ipc_build_output(struct json_writer *w, Monitor *m) { struct wlr_output *o = m->wlr_output; - struct wlr_output_mode *mode = NULL; + struct wlr_output_mode *mode = nullptr; int ti; if (o->current_mode) @@ -737,7 +737,7 @@ ipc_handle_command(struct ipc_client *client, const char *payload, { struct json_writer w; int success = 0; - char *cmd = NULL; + char *cmd = nullptr; if (len > 0) { 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") || !strcmp(cmd, "floating enable") || !strcmp(cmd, "floating disable")) { - togglefloating(NULL); + togglefloating(nullptr); success = 1; } else if (!strcmp(cmd, "fullscreen toggle") || !strcmp(cmd, "fullscreen enable") || !strcmp(cmd, "fullscreen disable")) { - togglefullscreen(NULL); + togglefullscreen(nullptr); success = 1; } else if (!strcmp(cmd, "kill") || !strcmp(cmd, "close")) { - killclient(NULL); + killclient(nullptr); success = 1; } else if (!strncmp(cmd, "workspace", 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") || !strcmp(cmd, "quit")) { - quit(NULL); + quit(nullptr); success = 1; } else if (!strcmp(cmd, "reload")) { do_reload(); @@ -868,7 +868,7 @@ ipc_client_close(struct ipc_client *c) wl_list_remove(&c->link); if (c->src) { wl_event_source_remove(c->src); - c->src = NULL; + c->src = nullptr; } close(c->fd); free(c->payload); @@ -1025,7 +1025,7 @@ ipc_handle_accept(int fd, uint32_t mask, void *data) c->payload_size = 0; c->payload_len = 0; c->payload_alloc = 0; - c->payload = NULL; + c->payload = nullptr; c->subscribed = 0; 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_event_loop, fd, WL_EVENT_READABLE, - ipc_handle_accept, NULL); + ipc_handle_accept, nullptr); if (!ipc_listen_src) { wlr_log(WLR_ERROR, "ipc: wl_event_loop_add_fd failed"); @@ -1144,7 +1144,7 @@ ipc_socket_finish(void) if (ipc_listen_src) { wl_event_source_remove(ipc_listen_src); - ipc_listen_src = NULL; + ipc_listen_src = nullptr; } if (ipc_listen_fd >= 0) { close(ipc_listen_fd); diff --git a/src/layout.c b/src/layout.c index 0a73dc4..a658cd6 100644 --- a/src/layout.c +++ b/src/layout.c @@ -29,7 +29,7 @@ void client_set_suspended(Client *c, int suspended); * ================================================================ */ const Layout layouts[] = { - {"><>", NULL}, + {"><>", nullptr}, {"[T]", dwindle}, {"[M]", master}, {"[]", monocle}, @@ -93,9 +93,9 @@ DwindleNode * dwindle_find_leaf(DwindleNode *n, Client *c) { if (!n) - return NULL; + return nullptr; 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); return r ? r : dwindle_find_leaf(n->children[1], c); } @@ -104,7 +104,7 @@ static DwindleNode * dwindle_first_leaf(DwindleNode *n) { if (!n) - return NULL; + return nullptr; while (n->is_node) n = n->children[0]; return n; @@ -165,7 +165,7 @@ dwindle_insert(DwindleNode **root, Client *new_c, Client *focused) return; } - DwindleNode *opening_on = focused ? dwindle_find_leaf(*root, focused) : NULL; + DwindleNode *opening_on = focused ? dwindle_find_leaf(*root, focused) : nullptr; if (!opening_on) opening_on = dwindle_first_leaf(*root); @@ -203,7 +203,7 @@ dwindle_remove(DwindleNode **root, Client *c) DwindleNode *parent = leaf->parent; if (!parent) { free(leaf); - *root = NULL; + *root = nullptr; return; } @@ -329,7 +329,7 @@ dwindle(Monitor *m) static void master_arrange(Monitor *m, int ti) { - Client *c, *master_c = NULL; + Client *c, *master_c = nullptr; Client *stack[256]; int nstack = 0, n = 0; @@ -425,7 +425,7 @@ master_remove_client(Client *c) return; for (int i = 0; i < TAGCOUNT; i++) { if (m->master_master[i] == c) - m->master_master[i] = NULL; + m->master_master[i] = nullptr; } } diff --git a/src/peachwm.c b/src/peachwm.c index d76d513..c3569c9 100644 --- a/src/peachwm.c +++ b/src/peachwm.c @@ -496,8 +496,8 @@ void arrange(Monitor *m) { if (curlayout(m)->arrange) curlayout(m)->arrange(m); - motionnotify(0, NULL, 0, 0, 0, 0); - checkidleinhibitor(NULL); + motionnotify(0, nullptr, 0, 0, 0, 0); + checkidleinhibitor(nullptr); } 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) continue; /* Deactivate the focused client. */ - focusclient(NULL, 0); + focusclient(nullptr, 0); exclusive_focus = l; client_notify_enter(l->layer_surface->surface, wlr_seat_get_keyboard(seat)); @@ -607,7 +607,7 @@ static void buttonpress(struct wl_listener *listener, void *data) { break; /* 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))) focusclient(c, 1); @@ -627,21 +627,21 @@ static void buttonpress(struct wl_listener *listener, void *data) { wlr_cursor_set_xcursor(cursor, cursor_mgr, "default"); if (cursor_mode == CurTileDrag) { /* Find whatever tiled client is under the cursor and swap. */ - Client *target = NULL; - xytonode(cursor->x, cursor->y, NULL, &target, NULL, NULL, NULL); + Client *target = nullptr; + xytonode(cursor->x, cursor->y, nullptr, &target, nullptr, nullptr, nullptr); if (target && target != grabc && !target->isfloating && !target->isfullscreen && curlayout(target->mon)->arrange) swaptiled(grabc, target); cursor_mode = CurNormal; - grabc = NULL; + grabc = nullptr; return; } cursor_mode = CurNormal; /* Drop the window off on its new monitor */ selmon = xytomon(cursor->x, cursor->y); setmon(grabc, selmon, 0); - grabc = NULL; + grabc = nullptr; return; } cursor_mode = CurNormal; @@ -682,7 +682,7 @@ static void checkidleinhibitor(struct wlr_surface *exclude) { static void cleanup(void) { config_watch_stop(cfg_watch_src); - cfg_watch_src = NULL; + cfg_watch_src = nullptr; ipc_socket_finish(); cleanuplisteners(); @@ -692,7 +692,7 @@ static void cleanup(void) { if (xwayland && xwayland->server && xwayland->server->pid > 0) kill(xwayland->server->pid, SIGKILL); wlr_xwayland_destroy(xwayland); - xwayland = NULL; + xwayland = nullptr; #endif wl_display_destroy_clients(dpy); @@ -702,18 +702,18 @@ static void cleanup(void) { struct timespec ts = {.tv_sec = 0, .tv_nsec = 100000000}; int ret; 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) goto child_done; - nanosleep(&ts, NULL); + nanosleep(&ts, nullptr); } kill(-child_pid, SIGKILL); - waitpid(child_pid, NULL, 0); + waitpid(child_pid, nullptr, 0); } child_done: 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. * 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->request_state.link); if (m->lock_surface) - destroylocksurface(&m->destroy_lock_surface, NULL); - m->wlr_output->data = NULL; + destroylocksurface(&m->destroy_lock_surface, nullptr); + m->wlr_output->data = nullptr; wlr_output_layout_remove(output_layout, m->wlr_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(); for (int i = 0; i < TAGCOUNT; 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); free(m); @@ -798,14 +798,14 @@ static void closemon(Monitor *m) { Client *c; int i = 0, nmons = wl_list_length(&mons); if (!nmons) { - selmon = NULL; + selmon = nullptr; } else if (m == selmon) { do /* don't switch to disabled mons */ selmon = wl_container_of(mons.next, selmon, link); while (!selmon->wlr_output->enabled && i++ < nmons); if (!selmon->wlr_output->enabled) - selmon = NULL; + selmon = nullptr; } wl_list_for_each(c, &clients, link) { @@ -878,7 +878,7 @@ static void commitnotify(struct wl_listener *listener, void *data) { if (c->mon) { 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( 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) { struct wlr_surface *surface = data; struct wlr_xdg_popup *popup = wlr_xdg_popup_try_from_wlr_surface(surface); - LayerSurface *l = NULL; - Client *c = NULL; + LayerSurface *l = nullptr; + Client *c = nullptr; struct wlr_box box; int type = -1; @@ -939,7 +939,7 @@ static void createidleinhibitor(struct wl_listener *listener, void *data) { struct wlr_idle_inhibitor_v1 *idle_inhibitor = data; LISTEN_STATIC(&idle_inhibitor->events.destroy, destroyidleinhibitor); - checkidleinhibitor(NULL); + checkidleinhibitor(nullptr); } 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. */ context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); 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))) die("failed to compile keymap"); @@ -997,7 +997,7 @@ static void createlayersurface(struct wl_listener *listener, void *data) { layers[layermap[layer_surface->pending.layer]]; 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); 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 * window). */ struct wlr_xdg_toplevel *toplevel = data; - Client *c = NULL; + Client *c = nullptr; /* Allocate a Client for this surface */ 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) { if (!active_constraint) return; - Client *c = NULL; + Client *c = nullptr; 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); + toplevel_from_wlr_surface(active_constraint->surface, &c, nullptr); 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); 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) { /* Focus enter isn't sent during drag, so refocus the focused node. */ focusclient(focustop(selmon), 1); - motionnotify(0, NULL, 0, 0, 0, 0); + motionnotify(0, nullptr, 0, 0, 0, 0); wl_list_remove(&listener->link); free(listener); } @@ -1336,7 +1336,7 @@ static void destroylock(SessionLock *lock, int unlock) { wlr_scene_node_set_enabled(&locked_bg->node, 0); focusclient(focustop(selmon), 0); - motionnotify(0, NULL, 0, 0, 0, 0); + motionnotify(0, nullptr, 0, 0, 0, 0); destroy: wl_list_remove(&lock->new_surface.link); @@ -1344,7 +1344,7 @@ destroy: wl_list_remove(&lock->destroy.link); wlr_scene_node_destroy(&lock->scene->node); - cur_lock = NULL; + cur_lock = nullptr; 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); 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); 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) { cursorwarptohint(); - active_constraint = NULL; + active_constraint = nullptr; } wl_list_remove(&pointer_constraint->destroy.link); @@ -1439,8 +1439,8 @@ static bool warp_focus = true; void focusclient(Client *c, int lift) { struct wlr_surface *old = seat->keyboard_state.focused_surface; int unused_lx, unused_ly, old_client_type; - Client *old_c = NULL; - LayerSurface *old_l = NULL; + Client *old_c = nullptr; + LayerSurface *old_l = nullptr; if (locked) return; @@ -1505,7 +1505,7 @@ void focusclient(Client *c, int lift) { } /* 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 */ 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); 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); } @@ -1541,7 +1541,7 @@ static void client_center(Client *c, int *cx, int *cy) { * * In monocle layout, this cycles through clients instead. */ void focusdir(const Arg *arg) { - Client *c, *best = NULL; + Client *c, *best = nullptr; Client *sel = focustop(selmon); int sx, sy, cx, cy; double bestdist = 1e18, dist; @@ -1557,7 +1557,7 @@ void focusdir(const Arg *arg) { /* In monocle layout, cycle through clients in order */ if (curlayout(selmon)->arrange == monocle) { - Client *first = NULL, *next = NULL, *prev = NULL; + Client *first = nullptr, *next = nullptr, *prev = nullptr; int found = 0; wl_list_for_each(c, &clients, link) { @@ -1652,7 +1652,7 @@ Client *focustop(Monitor *m) { if (VISIBLEON(c, m)) return c; } - return NULL; + return nullptr; } 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) { if (signo == SIGCHLD) - while (waitpid(-1, NULL, WNOHANG) > 0) + while (waitpid(-1, nullptr, WNOHANG) > 0) ; else if (signo == SIGINT || signo == SIGTERM) - quit(NULL); + quit(nullptr); } 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, const char (*args)[CFG_MAX_STRLEN], int nargs) { Arg arg = {0}; - const char *a0 = nargs > 0 ? args[0] : NULL; + const char *a0 = nargs > 0 ? args[0] : nullptr; if (!strcmp(action, "spawn")) { /* Build a NULL-terminated argv on the stack. @@ -1736,29 +1736,29 @@ static void dispatch_action(const char *action, int i; for (i = 0; i < nargs && i < CFG_MAX_ARGS; i++) argv[i] = args[i]; - argv[i] = NULL; + argv[i] = nullptr; arg.v = argv; spawn(&arg); return; } if (!strcmp(action, "killclient")) { - killclient(NULL); + killclient(nullptr); return; } if (!strcmp(action, "togglefloating")) { - togglefloating(NULL); + togglefloating(nullptr); return; } if (!strcmp(action, "togglefullscreen")) { - togglefullscreen(NULL); + togglefullscreen(nullptr); return; } if (!strcmp(action, "togglegaps")) { - togglegaps(NULL); + togglegaps(nullptr); return; } if (!strcmp(action, "quit")) { - quit(NULL); + quit(nullptr); return; } @@ -1895,11 +1895,11 @@ static void dispatch_action(const char *action, return; } if (!strcmp(action, "togglescratchpad")) { - togglescratchpad(NULL); + togglescratchpad(nullptr); return; } if (!strcmp(action, "swapdirscratchpad")) { - swapdirscratchpad(NULL); + swapdirscratchpad(nullptr); return; } @@ -2045,7 +2045,7 @@ static void locksession(struct wl_listener *listener, void *data) { return; } lock = session_lock->data = ecalloc(1, sizeof(*lock)); - focusclient(NULL, 0); + focusclient(nullptr, 0); lock->scene = wlr_scene_tree_create(layers[LyrBlock]); 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) { /* 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); Monitor *m; 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, double dy, double dx_unaccel, double dy_unaccel) { double sx = 0, sy = 0, sx_confined, sy_confined; - Client *c = NULL, *w = NULL; - LayerSurface *l = NULL; - struct wlr_surface *surface = NULL; + Client *c = nullptr, *w = nullptr; + LayerSurface *l = nullptr; + struct wlr_surface *surface = nullptr; 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); + xytonode(cursor->x, cursor->y, &surface, &c, nullptr, &sx, &sy); if (cursor_mode == CurPressed && !seat->drag && 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 && cursor_mode != CurMove) { - toplevel_from_wlr_surface(active_constraint->surface, &c, NULL); + toplevel_from_wlr_surface(active_constraint->surface, &c, nullptr); if (c && active_constraint->surface == seat->pointer_state.focused_surface) { 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) { if (cursor_mode != CurNormal && cursor_mode != CurPressed) 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) return; @@ -2314,7 +2314,7 @@ static void moveresize(const Arg *arg) { case CurResize: /* Doesn't work for X11 output - the next absolute motion event * 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); wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize"); 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_destroy(config); - updatemons(NULL, NULL); + updatemons(nullptr, nullptr); } 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) { - Monitor *m = NULL; + Monitor *m = nullptr; Client *c; 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); m->asleep = !event->mode; - updatemons(NULL, NULL); + updatemons(nullptr, nullptr); } void quit(const Arg *arg) { wl_display_terminate(dpy); } @@ -2496,7 +2496,7 @@ static void rendermon(struct wl_listener *listener, void *data) { goto skip; } - wlr_scene_output_commit(m->scene_output, NULL); + wlr_scene_output_commit(m->scene_output, nullptr); skip: /* 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) { struct wlr_output_event_request_state *event = data; wlr_output_commit_state(event->output, event->state); - updatemons(NULL, NULL); + updatemons(nullptr, nullptr); } 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); close(piperw[0]); close(piperw[1]); - execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL); + execl("/bin/sh", "/bin/sh", "-c", startup_cmd, nullptr); die("startup: execl:"); } dup2(piperw[1], STDOUT_FILENO); @@ -2610,7 +2610,7 @@ static void run(char *startup_cmd) { * cursor position, and set default cursor image */ 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"); /* 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) selmon->master_master[ti] = sel; else - selmon->master_master[ti] = NULL; + selmon->master_master[ti] = nullptr; /* Convert to floating: float all tiled clients */ } else if (!curlayout(selmon)->arrange) { Client *c; @@ -2998,7 +2998,7 @@ static void setup(void) { sigemptyset(&sa.sa_mask); 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 */ { @@ -3020,7 +3020,7 @@ static void setup(void) { 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 * clients from the Unix socket, managing Wayland globals, and so on and so @@ -3041,7 +3041,7 @@ static void setup(void) { path = cfgpath; } 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 @@ -3187,7 +3187,7 @@ static void setup(void) { * Xcursor themes to source cursor images from and makes sure that cursor * images are available at all scale factors on the screen (necessary for * 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); /* @@ -3320,7 +3320,7 @@ static void togglegaps(const Arg *arg) { /* swapdir is essentially focusdir but swap */ static void swapdir(const Arg *arg) { - Client *c, *other = NULL; + Client *c, *other = nullptr; Client *sel = focustop(selmon); int sx, sy, cx, cy; double bestdist = 1e18, dist; @@ -3463,12 +3463,12 @@ static void unmaplayersurfacenotify(struct wl_listener *listener, void *data) { l->mapped = 0; wlr_scene_node_set_enabled(&l->scene->node, 0); if (l == exclusive_focus) - exclusive_focus = NULL; + exclusive_focus = nullptr; if (l->layer_surface->output && (l->mon = l->layer_surface->output->data)) arrangelayers(l->mon); if (l->layer_surface->surface == seat->keyboard_state.focused_surface) 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) { @@ -3476,12 +3476,12 @@ static void unmapnotify(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, unmap); if (c == grabc) { cursor_mode = CurNormal; - grabc = NULL; + grabc = nullptr; } if (client_is_unmanaged(c)) { if (c == exclusive_focus) { - exclusive_focus = NULL; + exclusive_focus = nullptr; focusclient(focustop(selmon), 1); } } else { @@ -3493,9 +3493,9 @@ static void unmapnotify(struct wl_listener *listener, void *data) { /* Clear any stale scratchpad references to this client */ if (oldmon) { if (oldmon->scratchpad_current == c) - oldmon->scratchpad_current = NULL; + oldmon->scratchpad_current = nullptr; if (oldmon->scratchpad_prev_focus == c) - oldmon->scratchpad_prev_focus = NULL; + oldmon->scratchpad_prev_focus = nullptr; } if (c->isscratchpad && oldmon && oldmon->scratchpad_visible) { /* Closing a scratchpad client: focus another scratchpad client */ @@ -3510,17 +3510,17 @@ static void unmapnotify(struct wl_listener *listener, void *data) { } if (!found) focusclient(focustop(selmon), 1); - c->mon = NULL; + c->mon = nullptr; arrange(oldmon); } else { - setmon(c, NULL, 0); + setmon(c, nullptr, 0); } } wlr_scene_node_destroy(&c->scene->node); printstatus(); 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) { @@ -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 */ - 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_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); } @@ -3631,8 +3631,8 @@ static void updatetitle(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; - Client *c = NULL; - toplevel_from_wlr_surface(event->surface, &c, NULL); + Client *c = nullptr; + toplevel_from_wlr_surface(event->surface, &c, nullptr); if (!c || c == focustop(selmon)) return; @@ -3678,15 +3678,15 @@ static void virtualpointer(struct wl_listener *listener, void *data) { Monitor *xytomon(double x, double 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, LayerSurface **pl, double *nx, double *ny) { struct wlr_scene_node *node, *pnode; - struct wlr_surface *surface = NULL; - Client *c = NULL; - LayerSurface *l = NULL; + struct wlr_surface *surface = nullptr; + Client *c = nullptr; + LayerSurface *l = nullptr; int 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) c = pnode->data; if (c && c->type == LayerShell) { - c = NULL; + c = nullptr; l = pnode->data; } } @@ -3816,7 +3816,7 @@ static void xwaylandready(struct wl_listener *listener, void *data) { // ── main() ────────────────────────────────────────────────── int main(int argc, char *argv[]) { - char *startup_cmd = NULL; + char *startup_cmd = nullptr; int c; while ((c = getopt(argc, argv, "c:s:hdv")) != -1) { diff --git a/src/scratchpad.c b/src/scratchpad.c index 401e254..74c2246 100644 --- a/src/scratchpad.c +++ b/src/scratchpad.c @@ -53,7 +53,7 @@ void scratchpad_arrange(Monitor *m) { void togglescratchpad(const Arg *arg) { Monitor *m = selmon; - Client *c, *focus = NULL; + Client *c, *focus = nullptr; if (!m) return; @@ -92,7 +92,7 @@ void togglescratchpad(const Arg *arg) { client_set_suspended(c, 1); } } - m->scratchpad_current = NULL; + m->scratchpad_current = nullptr; /* Restore focus to previous client */ if (m->scratchpad_prev_focus && VISIBLEON(m->scratchpad_prev_focus, m)) focusclient(m->scratchpad_prev_focus, 1); @@ -114,7 +114,7 @@ void swapdirscratchpad(const Arg *arg) { if (sel->isscratchpad) { /* Move FROM scratchpad to current workspace */ - Client *next = NULL; + Client *next = nullptr; sel->isscratchpad = 0; sel->isfloating = 0; sel->tags = selmon->tagset[selmon->seltags]; @@ -127,11 +127,11 @@ void swapdirscratchpad(const Arg *arg) { } } if (!next) - selmon->scratchpad_current = NULL; + selmon->scratchpad_current = nullptr; else selmon->scratchpad_current = next; } else { - selmon->scratchpad_current = NULL; + selmon->scratchpad_current = nullptr; } /* setfloating reparents + arranges; let it manage visibility */ setfloating(sel, 0); @@ -177,7 +177,7 @@ void swapdirscratchpad(const Arg *arg) { void scratchpad_focusdir_cycle(const Arg *arg) { Client *sel = focustop(selmon); - Client *c, *first = NULL, *next = NULL, *prev = NULL; + Client *c, *first = nullptr, *next = nullptr, *prev = nullptr; int found = 0; wl_list_for_each(c, &clients, link) { @@ -196,7 +196,7 @@ void scratchpad_focusdir_cycle(const Arg *arg) { prev = c; } - Client *target = NULL; + Client *target = nullptr; if (arg->i == WLR_DIRECTION_DOWN || arg->i == WLR_DIRECTION_RIGHT) { if (next) target = next; diff --git a/src/util.c b/src/util.c index db23223..0717dfc 100644 --- a/src/util.c +++ b/src/util.c @@ -7,7 +7,7 @@ #include "util.h" -_Noreturn void +[[noreturn]] void die(const char *fmt, ...) { va_list ap; @@ -17,7 +17,7 @@ die(const char *fmt, ...) { if (fmt[0] && fmt[strlen(fmt)-1] == ':') { fputc(' ', stderr); - perror(NULL); + perror(nullptr); } else { fputc('\n', stderr); } diff --git a/src/util.h b/src/util.h index e26866e..2d266d6 100644 --- a/src/util.h +++ b/src/util.h @@ -2,6 +2,6 @@ #include -_Noreturn void die(const char *fmt, ...); +[[noreturn]] void die(const char *fmt, ...); void *ecalloc(size_t nmemb, size_t size); int fd_set_nonblock(int fd); diff --git a/src/wlr_ext_workspace_v1.c b/src/wlr_ext_workspace_v1.c index dca93e9..73b9249 100644 --- a/src/wlr_ext_workspace_v1.c +++ b/src/wlr_ext_workspace_v1.c @@ -202,7 +202,7 @@ static void destroy_workspace_resource( struct wlr_ext_workspace_v1_resource *workspace_res) { wl_list_remove(&workspace_res->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); } @@ -220,7 +220,7 @@ static struct wlr_ext_workspace_v1_resource *create_workspace_resource( struct wlr_ext_workspace_v1_resource *workspace_res = calloc(1, sizeof(*workspace_res)); if (!workspace_res) { - return NULL; + return nullptr; } 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); if (!workspace_res->resource) { free(workspace_res); - return NULL; + return nullptr; } wl_resource_set_implementation(workspace_res->resource, &workspace_impl, workspace_res, workspace_resource_destroy); @@ -247,7 +247,7 @@ static void destroy_group_resource(struct wlr_ext_workspace_group_v1_resource *group_res) { wl_list_remove(&group_res->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); } @@ -265,16 +265,16 @@ static struct wlr_ext_workspace_group_v1_resource *create_group_resource( struct wlr_ext_workspace_group_v1_resource *group_res = calloc(1, sizeof(*group_res)); if (!group_res) { - return NULL; + return nullptr; } struct wl_client *client = wl_resource_get_client(manager_res->resource); uint32_t version = wl_resource_get_version(manager_res->resource); group_res->resource = wl_resource_create( client, &ext_workspace_group_handle_v1_interface, version, 0); - if (group_res->resource == NULL) { + if (group_res->resource == nullptr) { free(group_res); - return NULL; + return nullptr; } wl_resource_set_implementation(group_res->resource, &group_impl, group_res, group_handle_resource_destroy); @@ -309,30 +309,30 @@ clear_requests_by(struct wlr_ext_workspace_manager_v1_resource *manager_res, switch (req->type) { case WLR_EXT_WORKSPACE_V1_REQUEST_CREATE_WORKSPACE: if (group && req->create_workspace.group == group) { - req->create_workspace.group = NULL; + req->create_workspace.group = nullptr; } break; case WLR_EXT_WORKSPACE_V1_REQUEST_ACTIVATE: if (workspace && req->activate.workspace == workspace) { - req->activate.workspace = NULL; + req->activate.workspace = nullptr; } break; case WLR_EXT_WORKSPACE_V1_REQUEST_DEACTIVATE: if (workspace && req->deactivate.workspace == workspace) { - req->deactivate.workspace = NULL; + req->deactivate.workspace = nullptr; } break; case WLR_EXT_WORKSPACE_V1_REQUEST_ASSIGN: if (workspace && req->assign.workspace == workspace) { - req->assign.workspace = NULL; + req->assign.workspace = nullptr; } if (group && req->assign.group == group) { - req->assign.group = NULL; + req->assign.group = nullptr; } break; case WLR_EXT_WORKSPACE_V1_REQUEST_REMOVE: if (workspace && req->remove.workspace == workspace) { - req->remove.workspace = NULL; + req->remove.workspace = nullptr; } break; } @@ -361,7 +361,7 @@ static void handle_idle(void *data) { wl_list_for_each(manager_res, &manager->resources, link) { ext_workspace_manager_v1_send_done(manager_res->resource); } - manager->idle_source = NULL; + manager->idle_source = nullptr; } static void @@ -420,7 +420,7 @@ static void destroy_manager_resource( } 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); } @@ -527,7 +527,7 @@ static void manager_handle_display_destroy(struct wl_listener *listener, struct wlr_ext_workspace_manager_v1 *manager = 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.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)); if (!manager) { - return NULL; + return nullptr; } manager->global = @@ -570,7 +570,7 @@ wlr_ext_workspace_manager_v1_create(struct wl_display *display, manager, manager_bind); if (!manager->global) { free(manager); - return NULL; + return nullptr; } 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_group_handle_v1 *group = calloc(1, sizeof(*group)); if (!group) { - return NULL; + return nullptr; } group->manager = manager; @@ -685,7 +685,7 @@ void wlr_ext_workspace_group_handle_v1_destroy( 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)); @@ -693,7 +693,7 @@ void wlr_ext_workspace_group_handle_v1_destroy( wl_list_for_each(workspace, &group->manager->workspaces, link) { if (workspace->group == group) { 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; 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; @@ -753,7 +753,7 @@ get_group_output(struct wlr_ext_workspace_group_handle_v1 *group, return group_output; } } - return NULL; + return nullptr; } 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 = calloc(1, sizeof(*workspace)); if (!workspace) { - return NULL; + return nullptr; } workspace->manager = manager; @@ -808,7 +808,7 @@ wlr_ext_workspace_handle_v1_create(struct wlr_ext_workspace_manager_v1 *manager, workspace->id = strdup(id); if (!workspace->id) { free(workspace); - return NULL; + return nullptr; } } @@ -841,7 +841,7 @@ void wlr_ext_workspace_handle_v1_destroy( 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)); @@ -857,7 +857,7 @@ void wlr_ext_workspace_handle_v1_destroy( struct wlr_ext_workspace_manager_v1_resource *manager_res; 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); @@ -895,7 +895,7 @@ void wlr_ext_workspace_handle_v1_set_name( free(workspace->name); workspace->name = strdup(name); - if (workspace->name == NULL) { + if (workspace->name == nullptr) { return; }