mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
sway/desktop: Use "!ptr" for comparison to NULL
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
This commit is contained in:
parent
4a533f73d8
commit
c01f7df5e2
5 changed files with 36 additions and 36 deletions
|
|
@ -293,7 +293,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
||||||
wl_container_of(listener, layer, surface_commit);
|
wl_container_of(listener, layer, surface_commit);
|
||||||
struct wlr_layer_surface_v1 *layer_surface = layer->layer_surface;
|
struct wlr_layer_surface_v1 *layer_surface = layer->layer_surface;
|
||||||
struct wlr_output *wlr_output = layer_surface->output;
|
struct wlr_output *wlr_output = layer_surface->output;
|
||||||
if (wlr_output == NULL) {
|
if (!wlr_output) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,11 +334,11 @@ static void unmap(struct sway_layer_surface *sway_layer) {
|
||||||
cursor_rebase_all();
|
cursor_rebase_all();
|
||||||
|
|
||||||
struct wlr_output *wlr_output = sway_layer->layer_surface->output;
|
struct wlr_output *wlr_output = sway_layer->layer_surface->output;
|
||||||
if (wlr_output == NULL) {
|
if (!wlr_output) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct sway_output *output = wlr_output->data;
|
struct sway_output *output = wlr_output->data;
|
||||||
if (output == NULL) {
|
if (!output) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y,
|
output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y,
|
||||||
|
|
@ -438,7 +438,7 @@ static struct sway_layer_subsurface *create_subsurface(
|
||||||
struct sway_layer_surface *layer_surface) {
|
struct sway_layer_surface *layer_surface) {
|
||||||
struct sway_layer_subsurface *subsurface =
|
struct sway_layer_subsurface *subsurface =
|
||||||
calloc(1, sizeof(struct sway_layer_subsurface));
|
calloc(1, sizeof(struct sway_layer_subsurface));
|
||||||
if (subsurface == NULL) {
|
if (!subsurface) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -550,7 +550,7 @@ static struct sway_layer_popup *create_popup(struct wlr_xdg_popup *wlr_popup,
|
||||||
enum layer_parent parent_type, void *parent) {
|
enum layer_parent parent_type, void *parent) {
|
||||||
struct sway_layer_popup *popup =
|
struct sway_layer_popup *popup =
|
||||||
calloc(1, sizeof(struct sway_layer_popup));
|
calloc(1, sizeof(struct sway_layer_popup));
|
||||||
if (popup == NULL) {
|
if (!popup) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -492,7 +492,7 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_surface *surface = view->surface;
|
struct wlr_surface *surface = view->surface;
|
||||||
if (surface == NULL) {
|
if (!surface) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
size_t n_surfaces = 0;
|
size_t n_surfaces = 0;
|
||||||
|
|
@ -502,7 +502,7 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->buffer == NULL) {
|
if (!surface->buffer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,14 +524,14 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
|
||||||
|
|
||||||
static int output_repaint_timer_handler(void *data) {
|
static int output_repaint_timer_handler(void *data) {
|
||||||
struct sway_output *output = data;
|
struct sway_output *output = data;
|
||||||
if (output->wlr_output == NULL) {
|
if (!output->wlr_output) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->wlr_output->frame_pending = false;
|
output->wlr_output->frame_pending = false;
|
||||||
|
|
||||||
struct sway_workspace *workspace = output->current.active_workspace;
|
struct sway_workspace *workspace = output->current.active_workspace;
|
||||||
if (workspace == NULL) {
|
if (!workspace) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1017,7 +1017,7 @@ void output_render(struct sway_output *output, struct timespec *when,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_workspace *workspace = output->current.active_workspace;
|
struct sway_workspace *workspace = output->current.active_workspace;
|
||||||
if (workspace == NULL) {
|
if (!workspace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ static struct sway_xdg_popup *popup_create(
|
||||||
|
|
||||||
struct sway_xdg_popup *popup =
|
struct sway_xdg_popup *popup =
|
||||||
calloc(1, sizeof(struct sway_xdg_popup));
|
calloc(1, sizeof(struct sway_xdg_popup));
|
||||||
if (popup == NULL) {
|
if (!popup) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
view_child_init(&popup->child, &popup_impl, view, xdg_surface->surface);
|
view_child_init(&popup->child, &popup_impl, view, xdg_surface->surface);
|
||||||
|
|
@ -131,7 +131,7 @@ static void get_constraints(struct sway_view *view, double *min_width,
|
||||||
|
|
||||||
static const char *get_string_prop(struct sway_view *view,
|
static const char *get_string_prop(struct sway_view *view,
|
||||||
enum sway_view_prop prop) {
|
enum sway_view_prop prop) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
|
|
@ -148,14 +148,14 @@ static uint32_t configure(struct sway_view *view, double lx, double ly,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
struct sway_xdg_shell_view *xdg_shell_view =
|
struct sway_xdg_shell_view *xdg_shell_view =
|
||||||
xdg_shell_view_from_view(view);
|
xdg_shell_view_from_view(view);
|
||||||
if (xdg_shell_view == NULL) {
|
if (!xdg_shell_view) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return wlr_xdg_toplevel_set_size(view->wlr_xdg_surface, width, height);
|
return wlr_xdg_toplevel_set_size(view->wlr_xdg_surface, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_activated(struct sway_view *view, bool activated) {
|
static void set_activated(struct sway_view *view, bool activated) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
||||||
|
|
@ -165,7 +165,7 @@ static void set_activated(struct sway_view *view, bool activated) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_tiled(struct sway_view *view, bool tiled) {
|
static void set_tiled(struct sway_view *view, bool tiled) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
||||||
|
|
@ -178,7 +178,7 @@ static void set_tiled(struct sway_view *view, bool tiled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_fullscreen(struct sway_view *view, bool fullscreen) {
|
static void set_fullscreen(struct sway_view *view, bool fullscreen) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
||||||
|
|
@ -186,7 +186,7 @@ static void set_fullscreen(struct sway_view *view, bool fullscreen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_resizing(struct sway_view *view, bool resizing) {
|
static void set_resizing(struct sway_view *view, bool resizing) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
||||||
|
|
@ -204,7 +204,7 @@ static bool wants_floating(struct sway_view *view) {
|
||||||
|
|
||||||
static void for_each_surface(struct sway_view *view,
|
static void for_each_surface(struct sway_view *view,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_xdg_surface_for_each_surface(view->wlr_xdg_surface, iterator,
|
wlr_xdg_surface_for_each_surface(view->wlr_xdg_surface, iterator,
|
||||||
|
|
@ -213,7 +213,7 @@ static void for_each_surface(struct sway_view *view,
|
||||||
|
|
||||||
static void for_each_popup_surface(struct sway_view *view,
|
static void for_each_popup_surface(struct sway_view *view,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_xdg_surface_for_each_popup_surface(view->wlr_xdg_surface, iterator,
|
wlr_xdg_surface_for_each_popup_surface(view->wlr_xdg_surface, iterator,
|
||||||
|
|
@ -222,7 +222,7 @@ static void for_each_popup_surface(struct sway_view *view,
|
||||||
|
|
||||||
static bool is_transient_for(struct sway_view *child,
|
static bool is_transient_for(struct sway_view *child,
|
||||||
struct sway_view *ancestor) {
|
struct sway_view *ancestor) {
|
||||||
if (xdg_shell_view_from_view(child) == NULL) {
|
if (!xdg_shell_view_from_view(child)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *surface = child->wlr_xdg_surface;
|
struct wlr_xdg_surface *surface = child->wlr_xdg_surface;
|
||||||
|
|
@ -236,7 +236,7 @@ static bool is_transient_for(struct sway_view *child,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _close(struct sway_view *view) {
|
static void _close(struct sway_view *view) {
|
||||||
if (xdg_shell_view_from_view(view) == NULL) {
|
if (!xdg_shell_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
struct wlr_xdg_surface *surface = view->wlr_xdg_surface;
|
||||||
|
|
@ -256,7 +256,7 @@ static void close_popups(struct sway_view *view) {
|
||||||
static void destroy(struct sway_view *view) {
|
static void destroy(struct sway_view *view) {
|
||||||
struct sway_xdg_shell_view *xdg_shell_view =
|
struct sway_xdg_shell_view *xdg_shell_view =
|
||||||
xdg_shell_view_from_view(view);
|
xdg_shell_view_from_view(view);
|
||||||
if (xdg_shell_view == NULL) {
|
if (!xdg_shell_view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free(xdg_shell_view);
|
free(xdg_shell_view);
|
||||||
|
|
@ -494,7 +494,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct sway_xdg_shell_view *xdg_shell_view =
|
struct sway_xdg_shell_view *xdg_shell_view =
|
||||||
wl_container_of(listener, xdg_shell_view, destroy);
|
wl_container_of(listener, xdg_shell_view, destroy);
|
||||||
struct sway_view *view = &xdg_shell_view->view;
|
struct sway_view *view = &xdg_shell_view->view;
|
||||||
if (!sway_assert(view->surface == NULL, "Tried to destroy a mapped view")) {
|
if (!sway_assert(!view->surface, "Tried to destroy a mapped view")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_list_remove(&xdg_shell_view->destroy.link);
|
wl_list_remove(&xdg_shell_view->destroy.link);
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
|
||||||
struct wlr_xwayland_surface *xsurface) {
|
struct wlr_xwayland_surface *xsurface) {
|
||||||
struct sway_xwayland_unmanaged *surface =
|
struct sway_xwayland_unmanaged *surface =
|
||||||
calloc(1, sizeof(struct sway_xwayland_unmanaged));
|
calloc(1, sizeof(struct sway_xwayland_unmanaged));
|
||||||
if (surface == NULL) {
|
if (!surface) {
|
||||||
sway_log(SWAY_ERROR, "Allocation failed");
|
sway_log(SWAY_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ static struct sway_xwayland_view *xwayland_view_from_view(
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *get_string_prop(struct sway_view *view, enum sway_view_prop prop) {
|
static const char *get_string_prop(struct sway_view *view, enum sway_view_prop prop) {
|
||||||
if (xwayland_view_from_view(view) == NULL) {
|
if (!xwayland_view_from_view(view)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
|
|
@ -208,7 +208,7 @@ static const char *get_string_prop(struct sway_view *view, enum sway_view_prop p
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t get_int_prop(struct sway_view *view, enum sway_view_prop prop) {
|
static uint32_t get_int_prop(struct sway_view *view, enum sway_view_prop prop) {
|
||||||
if (xwayland_view_from_view(view) == NULL) {
|
if (!xwayland_view_from_view(view)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
|
|
@ -232,7 +232,7 @@ static uint32_t get_int_prop(struct sway_view *view, enum sway_view_prop prop) {
|
||||||
static uint32_t configure(struct sway_view *view, double lx, double ly, int width,
|
static uint32_t configure(struct sway_view *view, double lx, double ly, int width,
|
||||||
int height) {
|
int height) {
|
||||||
struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||||
if (xwayland_view == NULL) {
|
if (!xwayland_view) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||||
|
|
@ -244,7 +244,7 @@ static uint32_t configure(struct sway_view *view, double lx, double ly, int widt
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_activated(struct sway_view *view, bool activated) {
|
static void set_activated(struct sway_view *view, bool activated) {
|
||||||
if (xwayland_view_from_view(view) == NULL) {
|
if (!xwayland_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
||||||
|
|
@ -257,7 +257,7 @@ static void set_activated(struct sway_view *view, bool activated) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_tiled(struct sway_view *view, bool tiled) {
|
static void set_tiled(struct sway_view *view, bool tiled) {
|
||||||
if (xwayland_view_from_view(view) == NULL) {
|
if (!xwayland_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
||||||
|
|
@ -265,7 +265,7 @@ static void set_tiled(struct sway_view *view, bool tiled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_fullscreen(struct sway_view *view, bool fullscreen) {
|
static void set_fullscreen(struct sway_view *view, bool fullscreen) {
|
||||||
if (xwayland_view_from_view(view) == NULL) {
|
if (!xwayland_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
||||||
|
|
@ -273,7 +273,7 @@ static void set_fullscreen(struct sway_view *view, bool fullscreen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wants_floating(struct sway_view *view) {
|
static bool wants_floating(struct sway_view *view) {
|
||||||
if (xwayland_view_from_view(view) == NULL) {
|
if (!xwayland_view_from_view(view)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
||||||
|
|
@ -316,7 +316,7 @@ static void handle_set_decorations(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
static bool is_transient_for(struct sway_view *child,
|
static bool is_transient_for(struct sway_view *child,
|
||||||
struct sway_view *ancestor) {
|
struct sway_view *ancestor) {
|
||||||
if (xwayland_view_from_view(child) == NULL) {
|
if (!xwayland_view_from_view(child)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct wlr_xwayland_surface *surface = child->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *surface = child->wlr_xwayland_surface;
|
||||||
|
|
@ -330,7 +330,7 @@ static bool is_transient_for(struct sway_view *child,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _close(struct sway_view *view) {
|
static void _close(struct sway_view *view) {
|
||||||
if (xwayland_view_from_view(view) == NULL) {
|
if (!xwayland_view_from_view(view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_xwayland_surface_close(view->wlr_xwayland_surface);
|
wlr_xwayland_surface_close(view->wlr_xwayland_surface);
|
||||||
|
|
@ -338,7 +338,7 @@ static void _close(struct sway_view *view) {
|
||||||
|
|
||||||
static void destroy(struct sway_view *view) {
|
static void destroy(struct sway_view *view) {
|
||||||
struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||||
if (xwayland_view == NULL) {
|
if (!xwayland_view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free(xwayland_view);
|
free(xwayland_view);
|
||||||
|
|
@ -349,7 +349,7 @@ static void get_constraints(struct sway_view *view, double *min_width,
|
||||||
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
||||||
struct wlr_xwayland_surface_size_hints *size_hints = surface->size_hints;
|
struct wlr_xwayland_surface_size_hints *size_hints = surface->size_hints;
|
||||||
|
|
||||||
if (size_hints == NULL) {
|
if (!size_hints) {
|
||||||
*min_width = DBL_MIN;
|
*min_width = DBL_MIN;
|
||||||
*max_width = DBL_MAX;
|
*max_width = DBL_MAX;
|
||||||
*min_height = DBL_MIN;
|
*min_height = DBL_MIN;
|
||||||
|
|
@ -787,7 +787,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) {
|
||||||
xcb_generic_error_t *error = NULL;
|
xcb_generic_error_t *error = NULL;
|
||||||
xcb_intern_atom_reply_t *reply =
|
xcb_intern_atom_reply_t *reply =
|
||||||
xcb_intern_atom_reply(xcb_conn, cookies[i], &error);
|
xcb_intern_atom_reply(xcb_conn, cookies[i], &error);
|
||||||
if (reply != NULL && error == NULL) {
|
if (reply != NULL && !error) {
|
||||||
xwayland->atoms[i] = reply->atom;
|
xwayland->atoms[i] = reply->atom;
|
||||||
}
|
}
|
||||||
free(reply);
|
free(reply);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue