]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/: fix coding style
authorJohan Malm <jgm323@gmail.com>
Tue, 21 Sep 2021 21:05:56 +0000 (22:05 +0100)
committerJohan Malm <jgm323@gmail.com>
Tue, 21 Sep 2021 21:05:56 +0000 (22:05 +0100)
src/cursor.c
src/layers.c
src/output.c
src/subsurface.c
src/theme.c
src/xdg.c
src/xwayland.c

index d757eeff9b52977d448cae12a9831e12c8358853..244cdba2e626c8f0d6935ec09f502ccbca09d9fe 100644 (file)
@@ -20,13 +20,17 @@ request_cursor_notify(struct wl_listener *listener, void *data)
        struct wlr_seat_client *focused_client =
                seat->seat->pointer_state.focused_client;
 
-       /* This can be sent by any client, so we check to make sure this one is
-        * actually has pointer focus first. */
+       /*
+        * This can be sent by any client, so we check to make sure this one is
+        * actually has pointer focus first.
+        */
        if (focused_client == event->seat_client) {
-               /* Once we've vetted the client, we can tell the cursor to use
+               /*
+                * Once we've vetted the client, we can tell the cursor to use
                 * the provided surface as the cursor image. It will set the
                 * hardware cursor on the output that it's currently on and
-                * continue to do so as the cursor moves between outputs. */
+                * continue to do so as the cursor moves between outputs.
+                */
                wlr_cursor_set_surface(seat->cursor, event->surface,
                                       event->hotspot_x, event->hotspot_y);
        }
@@ -140,15 +144,16 @@ process_cursor_motion(struct server *server, uint32_t time)
        struct wlr_surface *surface = NULL;
        int view_area = LAB_SSD_NONE;
        struct view *view =
-               desktop_view_at(server, server->seat.cursor->x, server->seat.cursor->y,
-                               &surface, &sx, &sy, &view_area);
+               desktop_view_at(server, server->seat.cursor->x,
+                       server->seat.cursor->y, &surface, &sx, &sy, &view_area);
        if (!view) {
                set_cursor(server, XCURSOR_DEFAULT);
        } else {
                uint32_t resize_edges = ssd_resize_edges(view_area);
                if (resize_edges) {
                        cursor_name_set_by_server = true;
-                       set_cursor(server, wlr_xcursor_get_resize_name(resize_edges));
+                       set_cursor(server,
+                               wlr_xcursor_get_resize_name(resize_edges));
                } else if (view_area != LAB_SSD_NONE) {
                        /* title and buttons */
                        set_cursor(server, XCURSOR_DEFAULT);
@@ -192,8 +197,10 @@ process_cursor_motion(struct server *server, uint32_t time)
                        wlr_seat_pointer_notify_motion(wlr_seat, time, sx, sy);
                }
        } else {
-               /* Clear pointer focus so future button events and such are not
-                * sent to the last client to have the cursor over it. */
+               /*
+                * Clear pointer focus so future button events and such are not
+                * sent to the last client to have the cursor over it.
+                */
                wlr_seat_pointer_clear_focus(wlr_seat);
        }
 }
index 88c879b1c196bb18c4d2a4f3a83be85e393509fd..c89b205f53098ab7612d9ce087ed6bd6dedd8499 100644 (file)
@@ -70,10 +70,12 @@ apply_exclusive(struct wlr_box *usable_area, uint32_t anchor, int32_t exclusive,
        for (size_t i = 0; i < sizeof(edges) / sizeof(edges[0]); ++i) {
                if ((anchor & edges[i].anchors) == edges[i].anchors) {
                        if (edges[i].positive_axis) {
-                               *edges[i].positive_axis += exclusive + edges[i].margin;
+                               *edges[i].positive_axis +=
+                                       exclusive + edges[i].margin;
                        }
                        if (edges[i].negative_axis) {
-                               *edges[i].negative_axis -= exclusive + edges[i].margin;
+                               *edges[i].negative_axis -=
+                                       exclusive + edges[i].margin;
                        }
                }
        }
index 2410c170ed4237b6806a971ed6f1040622479b58..cd1c5c6f4579afe2b922dda0c31ffe38829a24df 100644 (file)
@@ -248,9 +248,9 @@ void output_layer_for_each_surface(struct output *output,
        wl_list_for_each(layer_surface, layer_surfaces, link) {
                struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
                        layer_surface->layer_surface;
-               output_surface_for_each_surface(output, wlr_layer_surface_v1->surface,
-                       layer_surface->geo.x, layer_surface->geo.y, iterator,
-                       user_data);
+               output_surface_for_each_surface(output,
+                       wlr_layer_surface_v1->surface, layer_surface->geo.x,
+                       layer_surface->geo.y, iterator, user_data);
                /* TODO: handle popups */
        }
 }
@@ -275,8 +275,8 @@ output_for_each_surface(struct output *output, surface_iterator_func_t iterator,
        }
 
 #if HAVE_XWAYLAND
-       output_unmanaged_for_each_surface(output, &output->server->unmanaged_surfaces,
-               iterator, user_data);
+       output_unmanaged_for_each_surface(output,
+               &output->server->unmanaged_surfaces, iterator, user_data);
 #endif
 
        output_layer_for_each_surface(output,
@@ -638,7 +638,8 @@ render_view_popups(struct view *view, struct output *output,
        struct render_data data = {
                .damage = damage,
        };
-       output_view_for_each_popup_surface(output, view, render_surface_iterator, &data);
+       output_view_for_each_popup_surface(output, view,
+               render_surface_iterator, &data);
 }
 
 void
@@ -949,7 +950,8 @@ output_config_apply(struct server *server,
                                int32_t width = head->state.custom_mode.width;
                                int32_t height = head->state.custom_mode.height;
                                int32_t refresh = head->state.custom_mode.refresh;
-                               wlr_output_set_custom_mode(o, width, height, refresh);
+                               wlr_output_set_custom_mode(o, width,
+                                       height, refresh);
                        }
                        wlr_output_layout_move(server->output_layout, o,
                                head->state.x, head->state.y);
@@ -972,7 +974,8 @@ verify_output_config_v1(const struct wlr_output_configuration_v1 *config)
 static void
 handle_output_manager_apply(struct wl_listener *listener, void *data)
 {
-       struct server *server = wl_container_of(listener, server, output_manager_apply);
+       struct server *server =
+               wl_container_of(listener, server, output_manager_apply);
        struct wlr_output_configuration_v1 *config = data;
 
        bool config_is_good = verify_output_config_v1(config);
@@ -994,7 +997,8 @@ handle_output_manager_apply(struct wl_listener *listener, void *data)
 static struct
 wlr_output_configuration_v1 *create_output_config(struct server *server)
 {
-       struct wlr_output_configuration_v1 *config = wlr_output_configuration_v1_create();
+       struct wlr_output_configuration_v1 *config =
+               wlr_output_configuration_v1_create();
        if (!config) {
                wlr_log(WLR_ERROR, "wlr_output_configuration_v1_create()");
                return NULL;
@@ -1006,12 +1010,14 @@ wlr_output_configuration_v1 *create_output_config(struct server *server)
                        wlr_output_configuration_head_v1_create(config,
                                output->wlr_output);
                if (!head) {
-                       wlr_log(WLR_ERROR, "wlr_output_configuration_head_v1_create()");
+                       wlr_log(WLR_ERROR,
+                               "wlr_output_configuration_head_v1_create()");
                        wlr_output_configuration_v1_destroy(config);
                        return NULL;
                }
-               struct wlr_box *box = wlr_output_layout_get_box(server->output_layout,
-                                                               output->wlr_output);
+               struct wlr_box *box =
+                       wlr_output_layout_get_box(server->output_layout,
+                               output->wlr_output);
                if (box) {
                        head->state.x = box->x;
                        head->state.y = box->y;
@@ -1025,15 +1031,19 @@ wlr_output_configuration_v1 *create_output_config(struct server *server)
 static void
 handle_output_layout_change(struct wl_listener *listener, void *data)
 {
-       struct server *server = wl_container_of(listener, server, output_layout_change);
+       struct server *server =
+               wl_container_of(listener, server, output_layout_change);
 
        bool done_changing = server->pending_output_config == NULL;
        if (done_changing) {
-               struct wlr_output_configuration_v1 *config = create_output_config(server);
+               struct wlr_output_configuration_v1 *config =
+                       create_output_config(server);
                if (config) {
-                       wlr_output_manager_v1_set_configuration(server->output_manager, config);
+                       wlr_output_manager_v1_set_configuration(
+                               server->output_manager, config);
                } else {
-                       wlr_log(WLR_ERROR, "wlr_output_manager_v1_set_configuration()");
+                       wlr_log(WLR_ERROR,
+                               "wlr_output_manager_v1_set_configuration()");
                }
        }
 }
index 2e49e71df6422a4ff4152b6f1ddfea9fc1cbd083..be00b845009a769ce0261eabd43075b3dd7b7348 100644 (file)
@@ -22,7 +22,8 @@ subsurface_handle_destroy(struct wl_listener *listener, void *data)
 void
 subsurface_create(struct view *view, struct wlr_subsurface *wlr_subsurface)
 {
-       struct view_subsurface *subsurface = calloc(1, sizeof(struct view_subsurface));
+       struct view_subsurface *subsurface =
+               calloc(1, sizeof(struct view_subsurface));
        if (!subsurface) {
                return;
        }
index e5419c7f660931081deda871ac7ef112602841d4..f9d1802b6594b61add0f8b6ae82c8903d334892b 100644 (file)
@@ -84,12 +84,18 @@ theme_builtin(struct theme *theme)
        parse_hexstr("#dddad6", theme->window_active_title_bg_color);
        parse_hexstr("#f6f5f4", theme->window_inactive_title_bg_color);
 
-       parse_hexstr("#000000", theme->window_active_button_iconify_unpressed_image_color);
-       parse_hexstr("#000000", theme->window_active_button_max_unpressed_image_color);
-       parse_hexstr("#000000", theme->window_active_button_close_unpressed_image_color);
-       parse_hexstr("#000000", theme->window_inactive_button_iconify_unpressed_image_color);
-       parse_hexstr("#000000", theme->window_inactive_button_max_unpressed_image_color);
-       parse_hexstr("#000000", theme->window_inactive_button_close_unpressed_image_color);
+       parse_hexstr("#000000",
+               theme->window_active_button_iconify_unpressed_image_color);
+       parse_hexstr("#000000",
+               theme->window_active_button_max_unpressed_image_color);
+       parse_hexstr("#000000",
+               theme->window_active_button_close_unpressed_image_color);
+       parse_hexstr("#000000",
+               theme->window_inactive_button_iconify_unpressed_image_color);
+       parse_hexstr("#000000",
+               theme->window_inactive_button_max_unpressed_image_color);
+       parse_hexstr("#000000",
+               theme->window_inactive_button_close_unpressed_image_color);
 
        parse_hexstr("#fcfbfa", theme->menu_items_bg_color);
        parse_hexstr("#000000", theme->menu_items_text_color);
@@ -137,34 +143,46 @@ entry(struct theme *theme, const char *key, const char *value)
 
        /* universal button */
        if (match(key, "window.active.button.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_active_button_iconify_unpressed_image_color);
-               parse_hexstr(value, theme->window_active_button_max_unpressed_image_color);
-               parse_hexstr(value, theme->window_active_button_close_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_active_button_iconify_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_active_button_max_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_active_button_close_unpressed_image_color);
        }
        if (match(key, "window.inactive.button.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_inactive_button_iconify_unpressed_image_color);
-               parse_hexstr(value, theme->window_inactive_button_max_unpressed_image_color);
-               parse_hexstr(value, theme->window_inactive_button_close_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_inactive_button_iconify_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_inactive_button_max_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_inactive_button_close_unpressed_image_color);
        }
 
        /* individual buttons */
        if (match(key, "window.active.button.iconify.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_active_button_iconify_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_active_button_iconify_unpressed_image_color);
        }
        if (match(key, "window.active.button.max.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_active_button_max_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_active_button_max_unpressed_image_color);
        }
        if (match(key, "window.active.button.close.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_active_button_close_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_active_button_close_unpressed_image_color);
        }
        if (match(key, "window.inactive.button.iconify.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_inactive_button_iconify_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_inactive_button_iconify_unpressed_image_color);
        }
        if (match(key, "window.inactive.button.max.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_inactive_button_max_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_inactive_button_max_unpressed_image_color);
        }
        if (match(key, "window.inactive.button.close.unpressed.image.color")) {
-               parse_hexstr(value, theme->window_inactive_button_close_unpressed_image_color);
+               parse_hexstr(value,
+                       theme->window_inactive_button_close_unpressed_image_color);
        }
 
        if (match(key, "menu.items.bg.color")) {
index 3128bdb8ee641e3d245ce51c3e3fe4d837256bef..aa74f813e3560aa4a9d700c0f334f3fad81cad3f 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -102,13 +102,15 @@ handle_destroy(struct wl_listener *listener, void *data)
 static void
 handle_request_move(struct wl_listener *listener, void *data)
 {
-       /* This event is raised when a client would like to begin an interactive
+       /*
+        * This event is raised when a client would like to begin an interactive
         * move, typically because the user clicked on their client-side
         * decorations. Note that a more sophisticated compositor should check
         * the provied serial against a list of button press serials sent to
         * this
         * client, to prevent the client from requesting this whenever they
-        * want. */
+        * want.
+        */
        struct view *view = wl_container_of(listener, view, request_move);
        interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
 }
@@ -116,13 +118,15 @@ handle_request_move(struct wl_listener *listener, void *data)
 static void
 handle_request_resize(struct wl_listener *listener, void *data)
 {
-       /* This event is raised when a client would like to begin an interactive
+       /*
+        * This event is raised when a client would like to begin an interactive
         * resize, typically because the user clicked on their client-side
         * decorations. Note that a more sophisticated compositor should check
         * the provied serial against a list of button press serials sent to
         * this
         * client, to prevent the client from requesting this whenever they
-        * want. */
+        * want.
+        */
        struct wlr_xdg_toplevel_resize_event *event = data;
        struct view *view = wl_container_of(listener, view, request_resize);
        interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
@@ -194,7 +198,7 @@ xdg_toplevel_view_close(struct view *view)
 
 static void
 xdg_toplevel_view_for_each_popup_surface(struct view *view,
-               wlr_surface_iterator_func_t iterator, void *data)
+                wlr_surface_iterator_func_t iterator, void *data)
 {
        wlr_xdg_surface_for_each_popup_surface(view->xdg_surface, iterator, data);
 }
@@ -249,7 +253,8 @@ static void
 position_xdg_toplevel_view(struct view *view)
 {
        if (istopmost(view)) {
-               struct wlr_box box = output_usable_area_from_cursor_coords(view->server);
+               struct wlr_box box =
+                       output_usable_area_from_cursor_coords(view->server);
                view->x = box.x;
                view->y = box.y;
                view->w = view->xdg_surface->geometry.width;
index 436cafd1f48cb7834a0c92267b967ea2fd0ea6b8..bc021356da44b96d9097862f399b356cf1029aa1 100644 (file)
@@ -192,7 +192,8 @@ map(struct view *view)
 
                foreign_toplevel_handle_create(view);
 
-               struct wlr_box box = output_usable_area_from_cursor_coords(view->server);
+               struct wlr_box box =
+                       output_usable_area_from_cursor_coords(view->server);
                view->x = box.x;
                view->y = box.y;
                view_center(view);