]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Fix trivial coding style breaches
authorJohan Malm <jgm323@gmail.com>
Mon, 4 Apr 2022 19:53:36 +0000 (20:53 +0100)
committerJohan Malm <jgm323@gmail.com>
Mon, 4 Apr 2022 19:53:36 +0000 (20:53 +0100)
22 files changed:
include/common/nodename.h
include/config/rcxml.h
include/labwc.h
src/action.c
src/common/buf.c
src/common/dir.c
src/config/keybind.c
src/config/rcxml.c
src/cursor.c
src/interactive.c
src/keyboard.c
src/menu/menu.c
src/osd.c
src/output.c
src/resistance.c
src/seat.c
src/server.c
src/ssd/ssd_border.c
src/ssd/ssd_extents.c
src/ssd/ssd_titlebar.c
src/view.c
src/xdg.c

index 15948eaf8b709aec6be8cc5a0db229172942a98f..106fcf0c99a49b35ce3d6f72b3150a27ff2d1d49 100644 (file)
@@ -15,6 +15,6 @@
  * For example, the xml structure <a><b><c></c></b></a> would return the
  * name c.b.a
  */
-char *nodename(xmlNode *node, char *buf, int len);
+char *nodename(xmlNode * node, char *buf, int len);
 
 #endif /* __LABWC_NODENAME_H */
index 0c57e16784414f442a7efabe1f77252a2f5321ce..25910549eed7f8705cac73903487e245ab83598f 100644 (file)
@@ -11,7 +11,6 @@
 #include "theme.h"
 
 struct rcxml {
-
        /* core */
        bool xdg_shell_server_side_deco;
        int gap;
index 74c2167e58e579db0466f526a079f955f28d95fe..2670a8ce00447350407eff8163c6afc2d267de2f 100644 (file)
@@ -214,6 +214,7 @@ struct server {
 };
 
 #define LAB_NR_LAYERS (4)
+
 struct output {
        struct wl_list link; /* server::outputs */
        struct server *server;
@@ -229,6 +230,7 @@ struct output {
        struct wl_listener destroy;
        struct wl_listener frame;
 };
+
 #undef LAB_NR_LAYERS
 
 enum view_type {
index 4a283ccaf6eeb90d3a4e2d46553541f8ee9ce21f..314c0fe6780c69e70d6a379f8fda2766e84bcdaa 100644 (file)
@@ -54,11 +54,10 @@ const char *action_names[] = {
        NULL
 };
 
-
 static enum action_type
 action_type_from_str(const char *action_name)
 {
-       for (size_t i = 1; action_names[i] != NULL; i++) {
+       for (size_t i = 1; action_names[i]; i++) {
                if (!strcasecmp(action_name, action_names[i])) {
                        return i;
                }
@@ -144,7 +143,10 @@ actions_run(struct view *activator, struct server *server,
                wlr_log(WLR_DEBUG, "Handling action %s (%u) with arg %s",
                         action_names[action->type], action->type, action->arg);
 
-               /* Refetch view because it may have been changed due to the previous action */
+               /*
+                * Refetch view because it may have been changed due to the
+                * previous action
+                */
                view = activator_or_focused_view(activator, server);
 
                switch (action->type) {
@@ -176,13 +178,13 @@ actions_run(struct view *activator, struct server *server,
                        view_snap_to_edge(view, action->arg);
                        break;
                case ACTION_TYPE_NEXT_WINDOW:
-                       server->cycle_view =
-                               desktop_cycle_view(server, server->cycle_view, LAB_CYCLE_DIR_FORWARD);
+                       server->cycle_view = desktop_cycle_view(server,
+                               server->cycle_view, LAB_CYCLE_DIR_FORWARD);
                        osd_update(server);
                        break;
                case ACTION_TYPE_PREVIOUS_WINDOW:
-                       server->cycle_view =
-                               desktop_cycle_view(server, server->cycle_view, LAB_CYCLE_DIR_BACKWARD);
+                       server->cycle_view = desktop_cycle_view(server,
+                               server->cycle_view, LAB_CYCLE_DIR_BACKWARD);
                        osd_update(server);
                        break;
                case ACTION_TYPE_RECONFIGURE:
@@ -232,11 +234,14 @@ actions_run(struct view *activator, struct server *server,
                case ACTION_TYPE_RESIZE:
                        view = desktop_view_at_cursor(server);
                        if (view) {
-                               interactive_begin(view, LAB_INPUT_STATE_RESIZE, resize_edges);
+                               interactive_begin(view, LAB_INPUT_STATE_RESIZE,
+                                       resize_edges);
                        }
                        break;
                case ACTION_TYPE_NONE:
-                       wlr_log(WLR_ERROR, "Not executing unknown action with arg %s", action->arg);
+                       wlr_log(WLR_ERROR,
+                               "Not executing unknown action with arg %s",
+                               action->arg);
                        break;
                default:
                        /*
@@ -244,8 +249,10 @@ actions_run(struct view *activator, struct server *server,
                         * action_names and action_type being out of sync or by
                         * adding a new action without installing a handler here.
                         */
-                       wlr_log(WLR_ERROR, "Not executing invalid action (%u) with arg %s"
-                               " This is a BUG. Please report.", action->type, action->arg);
+                       wlr_log(WLR_ERROR,
+                               "Not executing invalid action (%u) with arg %s"
+                               " This is a BUG. Please report.",
+                               action->type, action->arg);
                }
        }
 }
index 5e908f9a67971b8f31b2e6ab265f200dac277dec..e988860d69a65f7a7ec298fed226952dfff913da 100644 (file)
@@ -2,7 +2,6 @@
 #include <ctype.h>
 #include "common/buf.h"
 
-
 static void
 strip_curly_braces(char *s)
 {
@@ -45,7 +44,7 @@ buf_expand_shell_variables(struct buf *s)
                } else {
                        /* just add one character at a time */
                        if (new.alloc <= new.len + 1) {
-                               new.alloc = new.alloc * 3/2 + 16;
+                               new.alloc = new.alloc * 3 / 2 + 16;
                                new.buf = realloc(new.buf, new.alloc);
                        }
                        new.buf[new.len++] = s->buf[i];
index 395c013f210b31e376b5033155a9ba5df1b7714f..eb1f8215ca2928a78426b9a8067a9d0153727e03 100644 (file)
@@ -95,9 +95,9 @@ find_dir(struct ctx *ctx)
                        if (!prefix) {
                                continue;
                        }
-                       gchar **prefixes;
+                       gchar * *prefixes;
                        prefixes = g_strsplit(prefix, ":", -1);
-                       for (gchar **p = prefixes; *p; p++) {
+                       for (gchar * *p = prefixes; *p; p++) {
                                ctx->build_path_fn(ctx, *p, d.path);
                                if (debug) {
                                        fprintf(stderr, "%s\n", ctx->buf);
index 88883b8f82fc2e54d8cfd662ac589a598dfd97c0..ee00d17f8398419c77c077ca1a7a2881552fc37f 100644 (file)
@@ -37,7 +37,8 @@ keybind_create(const char *keybind)
                        k->modifiers |= modifier;
                } else {
                        xkb_keysym_t sym = xkb_keysym_to_lower(
-                               xkb_keysym_from_name(symname, XKB_KEYSYM_CASE_INSENSITIVE));
+                               xkb_keysym_from_name(symname,
+                                       XKB_KEYSYM_CASE_INSENSITIVE));
                        if (sym == XKB_KEY_NoSymbol) {
                                wlr_log(WLR_ERROR, "unknown keybind (%s)", symname);
                                free(k);
index 5496dc984bb47bf502735e2fd99dc29957f4c2a7..b5d2921cefa1f1f77cc2e56e72a461bf8243e302 100644 (file)
@@ -173,7 +173,6 @@ get_accel_profile(const char *s)
 static void
 fill_libinput_category(char *nodename, char *content)
 {
-
        if (!strcmp(nodename, "category.device.libinput")) {
                current_libinput_category = libinput_category_create();
        }
@@ -214,14 +213,17 @@ fill_libinput_category(char *nodename, char *content)
                        LIBINPUT_CONFIG_TAP_DISABLED;
        } else if (!strcasecmp(nodename, "tapButtonMap")) {
                if (!strcmp(content, "lrm")) {
-                       current_libinput_category->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
+                       current_libinput_category->tap_button_map =
+                               LIBINPUT_CONFIG_TAP_MAP_LRM;
                } else if (!strcmp(content, "lmr")) {
-                       current_libinput_category->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
+                       current_libinput_category->tap_button_map =
+                               LIBINPUT_CONFIG_TAP_MAP_LMR;
                } else {
                        wlr_log(WLR_ERROR, "invalid tapButtonMap");
                }
        } else if (!strcasecmp(nodename, "accelProfile")) {
-               current_libinput_category->accel_profile = get_accel_profile(content);
+               current_libinput_category->accel_profile =
+                       get_accel_profile(content);
        } else if (!strcasecmp(nodename, "middleEmulation")) {
                current_libinput_category->middle_emu = get_bool(content) ?
                        LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
@@ -690,7 +692,6 @@ no_config:
 void
 rcxml_finish(void)
 {
-
        zfree(rc.font_name_activewindow);
        zfree(rc.font_name_menuitem);
        zfree(rc.font_name_osd);
index 87fc28eb035c05bd8137af926a9306e366814192..7d3669f3ad6cabb5a77f9b0dd3d0b99f11d38ef1 100644 (file)
@@ -189,8 +189,8 @@ input_inhibit_blocks_surface(struct seat *seat, struct wl_resource *resource)
 {
        struct wl_client *inhibiting_client =
                seat->active_client_while_inhibited;
-       return (inhibiting_client != NULL) &&
-               inhibiting_client != wl_resource_get_client(resource);
+       return inhibiting_client
+               && inhibiting_client != wl_resource_get_client(resource);
 }
 
 static void
@@ -387,7 +387,7 @@ destroy_constraint(struct wl_listener *listener, void *data)
 
        wl_list_remove(&constraint->destroy.link);
        if (seat->current_constraint == wlr_constraint) {
-               if (seat->constraint_commit.link.next != NULL) {
+               if (seat->constraint_commit.link.next) {
                        wl_list_remove(&seat->constraint_commit.link);
                }
                wl_list_init(&seat->constraint_commit.link);
@@ -433,7 +433,7 @@ constrain_cursor(struct server *server, struct wlr_pointer_constraint_v1
 
        seat->current_constraint = constraint;
 
-       if (constraint == NULL) {
+       if (!constraint) {
                wl_list_init(&seat->constraint_commit.link);
                return;
        }
@@ -554,9 +554,13 @@ handle_release_mousebinding(struct view *view, struct server *server,
                                continue;
                        case MOUSE_ACTION_DRAG:
                                if (mousebind->pressed_in_context) {
-                                       /* Swallow the release event as well as the press one */
+                                       /*
+                                        * Swallow the release event as well as
+                                        * the press one
+                                        */
                                        activated_any = true;
-                                       activated_any_frame |= mousebind->context == LAB_SSD_FRAME;
+                                       activated_any_frame |=
+                                               mousebind->context == LAB_SSD_FRAME;
                                }
                                continue;
                        default:
@@ -620,7 +624,7 @@ handle_press_mousebinding(struct view *view, struct server *server,
                                && mousebind->button == button
                                && modifiers == mousebind->modifiers) {
                        switch (mousebind->mouse_event) {
-                       case MOUSE_ACTION_DRAG: /* FALLTHROUGH */
+                       case MOUSE_ACTION_DRAG: /* fallthrough */
                        case MOUSE_ACTION_CLICK:
                                /*
                                 * DRAG and CLICK actions will be processed on
@@ -628,9 +632,13 @@ handle_press_mousebinding(struct view *view, struct server *server,
                                 * counted as a DOUBLECLICK.
                                 */
                                if (!double_click) {
-                                       /* Swallow the press event as well as the release one */
+                                       /*
+                                        * Swallow the press event as well as
+                                        * the release one
+                                        */
                                        activated_any = true;
-                                       activated_any_frame |= mousebind->context == LAB_SSD_FRAME;
+                                       activated_any_frame |=
+                                               mousebind->context == LAB_SSD_FRAME;
                                        mousebind->pressed_in_context = true;
                                }
                                continue;
@@ -719,7 +727,10 @@ cursor_button(struct wl_listener *listener, void *data)
                                server->grabbed_view = NULL;
                        }
 
-                       /* Focus surface under cursor and force updating the cursor icon */
+                       /*
+                        * Focus surface under cursor and force updating the
+                        * cursor icon
+                        */
                        cursor_rebase(&server->seat, event->time_msec, true);
                        return;
                }
@@ -733,10 +744,16 @@ cursor_button(struct wl_listener *listener, void *data)
 
        if (server->input_mode == LAB_INPUT_STATE_MENU) {
                if (view_area != LAB_SSD_MENU) {
-                       /* We close the menu on release so we don't leak a stray release */
+                       /*
+                        * We close the menu on release so we don't leak a stray
+                        * release
+                        */
                        close_menu = true;
                } else if (menu_call_actions(node)) {
-                       /* Action was successfull, may fail if item just opens a submenu */
+                       /*
+                        * Action was successfull, may fail if item just opens a
+                        * submenu
+                        */
                        close_menu = true;
                }
                return;
index be5e54d1c792711f26c9bacdccc7a6f7bb54b72f..8ade121ada3f4c3a83cb8cb6dfbea051c34262aa 100644 (file)
@@ -97,9 +97,14 @@ interactive_end(struct view *view)
                        } else if (cursor_y <= area->y + snap_range) {
                                if (rc.snap_top_maximize) {
                                        view_maximize(view, true);
-                                       /* When unmaximizing later on restore original position */
-                                       view->unmaximized_geometry.x = view->server->grab_box.x;
-                                       view->unmaximized_geometry.y = view->server->grab_box.y;
+                                       /*
+                                        * When unmaximizing later on restore
+                                        * original position
+                                        */
+                                       view->unmaximized_geometry.x =
+                                               view->server->grab_box.x;
+                                       view->unmaximized_geometry.y =
+                                               view->server->grab_box.y;
                                } else {
                                        view_snap_to_edge(view, "up");
                                }
index 643dac27c82eb4cde96e635583c89147d9921b90..7843739dbcae46d8ec79e2175cc2423523ebbc25 100644 (file)
@@ -32,7 +32,6 @@ any_modifiers_pressed(struct wlr_keyboard *keyboard)
        return false;
 }
 
-
 static void
 keyboard_modifiers_notify(struct wl_listener *listener, void *data)
 {
@@ -42,7 +41,7 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
        if (server->cycle_view) {
                struct wlr_keyboard_key_event *event = data;
                struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
-               if ((event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
+               if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED
                                && !any_modifiers_pressed(keyboard))  {
                        /* end cycle */
                        desktop_focus_and_activate_view(&server->seat,
@@ -130,7 +129,10 @@ handle_compositor_keybindings(struct wl_listener *listener,
                        unsigned int vt = syms[i] - XKB_KEY_XF86Switch_VT_1 + 1;
                        if (vt >= 1 && vt <= 12) {
                                change_vt(server, vt);
-                               /* don't send any key events to clients when changing tty */
+                               /*
+                                * Don't send any key events to clients when
+                                * changing tty
+                                */
                                return true;
                        }
                }
@@ -155,9 +157,11 @@ handle_compositor_keybindings(struct wl_listener *listener,
                        }
 
                        if (!ignore) {
-                               server->cycle_view =
-                                       desktop_cycle_view(server, server->cycle_view,
-                                               backwards ? LAB_CYCLE_DIR_BACKWARD : LAB_CYCLE_DIR_FORWARD);
+                               enum lab_cycle_dir dir = backwards
+                                       ? LAB_CYCLE_DIR_BACKWARD
+                                       : LAB_CYCLE_DIR_FORWARD;
+                               server->cycle_view = desktop_cycle_view(server,
+                                       server->cycle_view, dir);
                                osd_update(server);
                        }
                }
index 983e8ef29d198e8129905d49a8745efa943b05c9..67bdeb449987fcbd8b6ea1dc8491df14f6b593e6 100644 (file)
@@ -507,7 +507,8 @@ close_all_submenus(struct menu *menu)
        struct menuitem *item;
        wl_list_for_each (item, &menu->menuitems, link) {
                if (item->submenu) {
-                       wlr_scene_node_set_enabled(&item->submenu->scene_tree->node, false);
+                       wlr_scene_node_set_enabled(
+                               &item->submenu->scene_tree->node, false);
                        close_all_submenus(item->submenu);
                }
        }
@@ -555,7 +556,6 @@ menu_process_cursor_motion(struct wlr_scene_node *node)
        item->parent->selection.menu = item->submenu;
 }
 
-
 bool
 menu_call_actions(struct wlr_scene_node *node)
 {
index 3c66d4771237428ea54ea724f4495ebf0dc71521..98bc888114c31507f76065997471217b358ddb24 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -45,7 +45,7 @@ static const char *
 get_formatted_app_id(struct view *view)
 {
        char *s = (char *)view_get_string_prop(view, "app_id");
-       if (s == NULL) {
+       if (!s) {
                return NULL;
        }
        /* remove the first two nodes of 'org.' strings */
index dac30a6dab61e0ad29bf8e1caf2248967f0a83d7..512295211b1588976e6a6b362c92dab8f5dce1a7 100644 (file)
@@ -66,8 +66,8 @@ new_output_notify(struct wl_listener *listener, void *data)
        if (wlr_output->non_desktop) {
                wlr_log(WLR_DEBUG, "Not configuring non-desktop output");
                if (server->drm_lease_manager) {
-                       wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager,
-                                       wlr_output);
+                       wlr_drm_lease_v1_manager_offer_output(
+                               server->drm_lease_manager, wlr_output);
                }
                return;
        }
@@ -344,7 +344,7 @@ handle_output_layout_change(struct wl_listener *listener, void *data)
        struct server *server =
                wl_container_of(listener, server, output_layout_change);
 
-       bool done_changing = server->pending_output_config == NULL;
+       bool done_changing = !server->pending_output_config;
        if (done_changing) {
                struct wlr_output_configuration_v1 *config =
                        create_output_config(server);
index 11cdfaddef0b682c0d8066dd4490828e77910c2e..e4c8bb88e5ae6db71d2a723a9ee4f5b809aba537 100644 (file)
@@ -90,7 +90,10 @@ resistance_move_apply(struct view *view, double *x, double *y)
                }
 
                /* reset the flags */
-               flags.left = flags.top = flags.right = flags.bottom = 0;
+               flags.left = 0;
+               flags.top = 0;
+               flags.right = 0;
+               flags.bottom = 0;
        }
 }
 
@@ -126,7 +129,6 @@ resistance_resize_apply(struct view *view, struct wlr_box *new_view_geo)
                return;
        }
        wl_list_for_each(output, &server->outputs, link) {
-
                mgeom = output_usable_area_in_layout_coords(output);
 
                if (!wlr_box_intersection(&intersection, &vgeom, &mgeom)
@@ -171,6 +173,9 @@ resistance_resize_apply(struct view *view, struct wlr_box *new_view_geo)
                }
 
                /* reset the flags */
-               flags.left = flags.top = flags.right = flags.bottom = 0;
+               flags.left = 0;
+               flags.top = 0;
+               flags.right = 0;
+               flags.bottom = 0;
        }
 }
index e1714c811f239d2d0de534110d7f5ef604ec97eb..8381f7b8950fb2d5b08623e8d62da00d6fae901c 100644 (file)
@@ -72,7 +72,8 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
        } else {
                wlr_log(WLR_INFO, "tap configured");
                libinput_device_config_tap_set_enabled(libinput_dev, dc->tap);
-               libinput_device_config_tap_set_button_map(libinput_dev, dc->tap_button_map);
+               libinput_device_config_tap_set_button_map(libinput_dev,
+                       dc->tap_button_map);
        }
 
        if (libinput_device_config_scroll_has_natural_scroll(libinput_dev) <= 0
@@ -128,7 +129,7 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
 static struct wlr_output *
 output_by_name(struct server *server, const char *name)
 {
-       assert(name != NULL);
+       assert(name);
        struct output *output;
        wl_list_for_each(output, &server->outputs, link) {
                if (!strcasecmp(output->wlr_output->name, name)) {
@@ -152,7 +153,7 @@ new_pointer(struct seat *seat, struct input *input)
                wlr_log(WLR_INFO, "map pointer to output %s\n",
                        dev->pointer->output_name);
                struct wlr_output *output = NULL;
-               if (dev->pointer->output_name != NULL) {
+               if (dev->pointer->output_name) {
                        output = output_by_name(seat->server, dev->pointer->output_name);
                }
                wlr_cursor_map_input_to_output(seat->cursor, dev, output);
@@ -183,7 +184,7 @@ new_touch(struct seat *seat, struct input *input)
                wlr_log(WLR_INFO, "map touch to output %s\n",
                        dev->pointer->output_name);
                struct wlr_output *output = NULL;
-               if (dev->pointer->output_name != NULL) {
+               if (dev->pointer->output_name) {
                        output = output_by_name(seat->server, dev->pointer->output_name);
                }
                wlr_cursor_map_input_to_output(seat->cursor, dev, output);
index bc6fc20bb763347b6b62779316bcc38375c3f589..4865c417c9579713957fb249f3b9375882ac619e 100644 (file)
@@ -103,8 +103,7 @@ seat_inhibit_input(struct seat *seat,  struct wl_client *active_client)
 
        struct wlr_seat_client *previous_ptr_client =
                seat->seat->pointer_state.focused_client;
-       if (previous_ptr_client &&
-           (previous_ptr_client->client != active_client)) {
+       if (previous_ptr_client && previous_ptr_client->client != active_client) {
                wlr_seat_pointer_clear_focus(seat->seat);
        }
 }
@@ -124,8 +123,6 @@ seat_disinhibit_input(struct seat *seat)
        }
 }
 
-
-
 static void
 handle_input_inhibit(struct wl_listener *listener, void *data)
 {
@@ -147,9 +144,12 @@ handle_input_disinhibit(struct wl_listener *listener, void *data)
 }
 
 static void
-handle_drm_lease_request(struct wl_listener *listener, void *data) {
-       /* We only offer non-desktop outputs, but in the future we might want to do
-        * more logic here. */
+handle_drm_lease_request(struct wl_listener *listener, void *data)
+{
+       /*
+        * We only offer non-desktop outputs, but in the future we might want to do
+        * more logic here.
+        */
 
        struct wlr_drm_lease_request_v1 *req = data;
        struct wlr_drm_lease_v1 *lease = wlr_drm_lease_request_v1_grant(req);
@@ -352,8 +352,8 @@ server_init(struct server *server)
        server->foreign_toplevel_manager =
                wlr_foreign_toplevel_manager_v1_create(server->wl_display);
 
-       server->drm_lease_manager=
-               wlr_drm_lease_v1_manager_create(server->wl_display, server->backend);
+       server->drm_lease_manager = wlr_drm_lease_v1_manager_create(
+               server->wl_display, server->backend);
        if (server->drm_lease_manager) {
                server->drm_lease_request.notify = handle_drm_lease_request;
                wl_signal_add(&server->drm_lease_manager->events.request,
@@ -447,7 +447,6 @@ server_start(struct server *server)
 void
 server_finish(struct server *server)
 {
-
 /* TODO: clean up various scene_tree nodes */
 #if HAVE_XWAYLAND
        wlr_xwayland_destroy(server->xwayland);
index b87c477096ca63ac756e8171647596e6c9f9e8eb..01c1869fbc53609908e35cba11573c093edf9693 100644 (file)
@@ -63,20 +63,25 @@ ssd_border_update(struct view *view)
                        rect = lab_wlr_scene_get_rect(part->node);
                        switch (part->type) {
                        case LAB_SSD_PART_LEFT:
-                               wlr_scene_rect_set_size(rect, theme->border_width, height);
+                               wlr_scene_rect_set_size(rect,
+                                       theme->border_width, height);
                                continue;
                        case LAB_SSD_PART_RIGHT:
-                               wlr_scene_rect_set_size(rect, theme->border_width, height);
-                               wlr_scene_node_set_position(
-                                       part->node, theme->border_width + width, 0);
+                               wlr_scene_rect_set_size(rect,
+                                       theme->border_width, height);
+                               wlr_scene_node_set_position(part->node,
+                                       theme->border_width + width, 0);
                                continue;
                        case LAB_SSD_PART_BOTTOM:
-                               wlr_scene_rect_set_size(rect, full_width, theme->border_width);
-                               wlr_scene_node_set_position(part->node, 0, height);
+                               wlr_scene_rect_set_size(rect,
+                                       full_width, theme->border_width);
+                               wlr_scene_node_set_position(part->node,
+                                       0, height);
                                continue;
                        case LAB_SSD_PART_TOP:
                                wlr_scene_rect_set_size(rect,
-                                       width - 2 * BUTTON_WIDTH, theme->border_width);
+                                       width - 2 * BUTTON_WIDTH,
+                                       theme->border_width);
                                continue;
                        default:
                                continue;
index 65e4d130cc8b5b4f0c6fa47a766428cdceeaeab9..a0783eaed3d69418c76fbd85e7e6f029b5802f59 100644 (file)
@@ -183,7 +183,8 @@ ssd_extents_update(struct view *view)
                if (part_box.width != result_box.width
                                || part_box.height != result_box.height) {
                        /* Partly visible */
-                       wlr_scene_rect_set_size(rect, result_box.width, result_box.height);
+                       wlr_scene_rect_set_size(rect, result_box.width,
+                               result_box.height);
                        wlr_scene_node_set_position(part->node,
                                target->x + (result_box.x - part_box.x),
                                target->y + (result_box.y - part_box.y));
index 996b8a4e4b5cfc9f8ebdb6c4e1bd0b5f77d92564..768936a0769c11ae917f887c5fe2b2f1c6c46514 100644 (file)
@@ -83,7 +83,8 @@ ssd_titlebar_update(struct view *view)
                wl_list_for_each(part, &subtree->parts, link) {
                        switch (part->type) {
                        case LAB_SSD_PART_TITLEBAR:
-                               wlr_scene_rect_set_size(lab_wlr_scene_get_rect(part->node),
+                               wlr_scene_rect_set_size(
+                                       lab_wlr_scene_get_rect(part->node),
                                        width - BUTTON_WIDTH * BUTTON_COUNT,
                                        theme->title_height);
                                continue;
@@ -102,7 +103,8 @@ ssd_titlebar_update(struct view *view)
                        case LAB_SSD_BUTTON_CLOSE:
                                if (is_direct_child(part->node, subtree)) {
                                        wlr_scene_node_set_position(part->node,
-                                               width - BUTTON_WIDTH * 1, -theme->border_width);
+                                               width - BUTTON_WIDTH * 1,
+                                               -theme->border_width);
                                }
                                continue;
                        default:
index cfe9549b108e71f0fb476371c3802df0bcfd4e6d..c14731e6c69a1c307cae5ffc9f17149986b0ce9f 100644 (file)
@@ -194,10 +194,12 @@ view_apply_maximized_geometry(struct view *view)
                return;
        }
        struct wlr_box box = output_usable_area_in_layout_coords(output);
-       if (box.height == output->wlr_output->height && output->wlr_output->scale != 1) {
+       if (box.height == output->wlr_output->height
+                       && output->wlr_output->scale != 1) {
                box.height /= output->wlr_output->scale;
        }
-       if (box.width == output->wlr_output->width && output->wlr_output->scale != 1) {
+       if (box.width == output->wlr_output->width
+                       && output->wlr_output->scale != 1) {
                box.width /= output->wlr_output->scale;
        }
 
@@ -215,7 +217,8 @@ static void
 view_apply_unmaximized_geometry(struct view *view)
 {
        struct wlr_output_layout *layout = view->server->output_layout;
-       if (wlr_output_layout_intersects(layout, NULL, &view->unmaximized_geometry)) {
+       if (wlr_output_layout_intersects(layout, NULL,
+                       &view->unmaximized_geometry)) {
                /* restore to original geometry */
                view_move_resize(view, view->unmaximized_geometry);
        } else {
@@ -300,7 +303,7 @@ void
 view_set_fullscreen(struct view *view, bool fullscreen,
                struct wlr_output *wlr_output)
 {
-       if (fullscreen == (view->fullscreen != NULL)) {
+       if (fullscreen != !view->fullscreen) {
                return;
        }
        if (view->impl->set_fullscreen) {
@@ -426,10 +429,12 @@ view_move_to_edge(struct view *view, const char *direction)
        }
        struct border border = view_border(view);
        struct wlr_box usable = output_usable_area_in_layout_coords(output);
-       if (usable.height == output->wlr_output->height && output->wlr_output->scale != 1) {
+       if (usable.height == output->wlr_output->height
+                       && output->wlr_output->scale != 1) {
                usable.height /= output->wlr_output->scale;
        }
-       if (usable.width == output->wlr_output->width && output->wlr_output->scale != 1) {
+       if (usable.width == output->wlr_output->width
+                       && output->wlr_output->scale != 1) {
                usable.width /= output->wlr_output->scale;
        }
 
@@ -503,10 +508,12 @@ view_get_edge_snap_box(struct view *view, struct output *output,
 {
        struct border border = view_border(view);
        struct wlr_box usable = output_usable_area_in_layout_coords(output);
-       if (usable.height == output->wlr_output->height && output->wlr_output->scale != 1) {
+       if (usable.height == output->wlr_output->height
+                       && output->wlr_output->scale != 1) {
                usable.height /= output->wlr_output->scale;
        }
-       if (usable.width == output->wlr_output->width && output->wlr_output->scale != 1) {
+       if (usable.width == output->wlr_output->width
+                       && output->wlr_output->scale != 1) {
                usable.width /= output->wlr_output->scale;
        }
 
index 0294bcad042c85cb0c8eb3078632cf42e593b3b4..b8c0b4a5c47e82490e19c30fb9ffb73ed2afa900 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -24,7 +24,8 @@ has_ssd(struct view *view)
         * geometry.{x,y} seems to be greater than zero. We filter on that
         * on the assumption that this will remain true.
         */
-       if (view->xdg_surface->current.geometry.x || view->xdg_surface->current.geometry.y) {
+       struct wlr_xdg_surface_state *current = &view->xdg_surface->current;
+       if (current->geometry.x || current->geometry.y) {
                return false;
        }
        return true;
@@ -42,8 +43,10 @@ handle_commit(struct wl_listener *listener, void *data)
        view->h = size.height;
 
        /* padding changes with maximize/unmaximize */
-       view->padding.top = view->padding.bottom = size.y;
-       view->padding.left = view->padding.right = size.x;
+       view->padding.top = size.y;
+       view->padding.bottom = size.y;
+       view->padding.left = size.x;
+       view->padding.right = size.x;
 
        uint32_t serial = view->pending_move_resize.configure_serial;
        if (serial > 0 && serial >= view->xdg_surface->current.configure_serial) {
@@ -213,8 +216,10 @@ update_padding(struct view *view)
 {
        struct wlr_box padding;
        wlr_xdg_surface_get_geometry(view->xdg_surface, &padding);
-       view->padding.top = view->padding.bottom = padding.y;
-       view->padding.left = view->padding.right = padding.x;
+       view->padding.top = padding.y;
+       view->padding.bottom = padding.y;
+       view->padding.left = padding.x;
+       view->padding.right = padding.x;
 }
 
 static void
@@ -241,7 +246,7 @@ xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
 static bool
 istopmost(struct view *view)
 {
-       return view->xdg_surface->toplevel->parent == NULL;
+       return !view->xdg_surface->toplevel->parent;
 }
 
 static struct view *