mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-23 05:54:19 +02:00
Apply clang-format
This commit is contained in:
parent
a435911aa9
commit
54e187932e
7 changed files with 56 additions and 45 deletions
|
|
@ -369,7 +369,7 @@ main(int argc, char *argv[]) {
|
|||
wl_event_loop_add_signal(event_loop, SIGPIPE, handle_signal, &server);
|
||||
server.event_loop = event_loop;
|
||||
|
||||
backend = wlr_backend_autocreate(server.wl_display,&server.session);
|
||||
backend = wlr_backend_autocreate(server.wl_display, &server.session);
|
||||
server.headless_backend = wlr_headless_backend_create(server.wl_display);
|
||||
if(!backend) {
|
||||
wlr_log(WLR_ERROR, "Unable to create the wlroots backend");
|
||||
|
|
@ -430,9 +430,10 @@ main(int argc, char *argv[]) {
|
|||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
server.scene_output_layout=wlr_scene_attach_output_layout(server.scene, server.output_layout);
|
||||
server.scene_output_layout =
|
||||
wlr_scene_attach_output_layout(server.scene, server.output_layout);
|
||||
|
||||
compositor = wlr_compositor_create(server.wl_display,6,server.renderer);
|
||||
compositor = wlr_compositor_create(server.wl_display, 6, server.renderer);
|
||||
if(!compositor) {
|
||||
wlr_log(WLR_ERROR, "Unable to create the wlroots compositor");
|
||||
ret = 1;
|
||||
|
|
|
|||
|
|
@ -270,9 +270,10 @@ LLVMFuzzerInitialize(int *argc, char ***argv) {
|
|||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
server.scene_output_layout=wlr_scene_attach_output_layout(server.scene, server.output_layout);
|
||||
server.scene_output_layout =
|
||||
wlr_scene_attach_output_layout(server.scene, server.output_layout);
|
||||
|
||||
compositor = wlr_compositor_create(server.wl_display, 6,server.renderer);
|
||||
compositor = wlr_compositor_create(server.wl_display, 6, server.renderer);
|
||||
if(!compositor) {
|
||||
wlr_log(WLR_ERROR, "Unable to create the wlroots compositor");
|
||||
ret = 1;
|
||||
|
|
|
|||
10
keybinding.c
10
keybinding.c
|
|
@ -1028,8 +1028,7 @@ print_output(struct cg_output *outp) {
|
|||
(float)outp->wlr_output->refresh / 1000.0);
|
||||
print_str(&outp_str, "\"permanent\": %d,\n",
|
||||
outp->role == OUTPUT_ROLE_PERMANENT);
|
||||
print_str(&outp_str, "\"active\": %d,\n",
|
||||
!outp->destroyed);
|
||||
print_str(&outp_str, "\"active\": %d,\n", !outp->destroyed);
|
||||
print_str(&outp_str, "\"curr_workspace\": %d,\n", outp->curr_workspace + 1);
|
||||
char *workspaces_str = print_workspaces(outp);
|
||||
if(workspaces_str != NULL) {
|
||||
|
|
@ -1623,7 +1622,8 @@ void
|
|||
set_cursor(bool enabled, struct cg_seat *seat) {
|
||||
if(enabled == true) {
|
||||
seat->enable_cursor = true;
|
||||
wlr_cursor_set_xcursor(seat->cursor,seat->xcursor_manager, DEFAULT_XCURSOR);
|
||||
wlr_cursor_set_xcursor(seat->cursor, seat->xcursor_manager,
|
||||
DEFAULT_XCURSOR);
|
||||
} else {
|
||||
seat->enable_cursor = false;
|
||||
wlr_cursor_unset_image(seat->cursor);
|
||||
|
|
@ -1687,7 +1687,9 @@ run_action(enum keybinding_action action, struct cg_server *server,
|
|||
if(data.u != server->seat->default_mode) {
|
||||
wlr_seat_pointer_notify_clear_focus(server->seat->seat);
|
||||
if(server->seat->enable_cursor == true) {
|
||||
wlr_cursor_set_xcursor(server->seat->cursor,server->seat->xcursor_manager, "dot_box_mask");
|
||||
wlr_cursor_set_xcursor(server->seat->cursor,
|
||||
server->seat->xcursor_manager,
|
||||
"dot_box_mask");
|
||||
}
|
||||
}
|
||||
server->seat->mode = data.u;
|
||||
|
|
|
|||
53
output.c
53
output.c
|
|
@ -25,7 +25,6 @@
|
|||
#include <wlr/util/box.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/util/region.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#if CG_HAS_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
#endif
|
||||
|
|
@ -139,7 +138,7 @@ output_destroy(struct cg_output *output) {
|
|||
wl_list_remove(&output->commit.link);
|
||||
wl_list_remove(&output->frame.link);
|
||||
wlr_scene_output_destroy(output->scene_output);
|
||||
output->scene_output=NULL;
|
||||
output->scene_output = NULL;
|
||||
}
|
||||
output->destroyed = true;
|
||||
enum output_role role = output->role;
|
||||
|
|
@ -147,10 +146,13 @@ output_destroy(struct cg_output *output) {
|
|||
output->wlr_output = wlr_headless_add_output(server->headless_backend,
|
||||
output->layout_box.width,
|
||||
output->layout_box.height);
|
||||
output->scene_output=wlr_scene_output_create(server->scene,output->wlr_output);
|
||||
struct wlr_output_layout_output *lo=wlr_output_layout_add(server->output_layout, output->wlr_output,
|
||||
output->layout_box.x, output->layout_box.y);
|
||||
wlr_scene_output_layout_add_output(server->scene_output_layout,lo,output->scene_output);
|
||||
output->scene_output =
|
||||
wlr_scene_output_create(server->scene, output->wlr_output);
|
||||
struct wlr_output_layout_output *lo =
|
||||
wlr_output_layout_add(server->output_layout, output->wlr_output,
|
||||
output->layout_box.x, output->layout_box.y);
|
||||
wlr_scene_output_layout_add_output(server->scene_output_layout, lo,
|
||||
output->scene_output);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
@ -196,7 +198,7 @@ handle_output_frame(struct wl_listener *listener, void *data) {
|
|||
if(scene_output == NULL) {
|
||||
return;
|
||||
}
|
||||
wlr_scene_output_commit(scene_output,NULL);
|
||||
wlr_scene_output_commit(scene_output, NULL);
|
||||
|
||||
struct timespec now = {0};
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
|
@ -325,12 +327,14 @@ output_apply_config(struct cg_server *server, struct cg_output *output,
|
|||
return;
|
||||
}
|
||||
if(wlr_box_empty(&output->layout_box)) {
|
||||
struct wlr_output_layout_output *lo=wlr_output_layout_add(server->output_layout, wlr_output,
|
||||
config->pos.x, config->pos.y);
|
||||
wlr_scene_output_layout_add_output(server->scene_output_layout,lo,output->scene_output);
|
||||
struct wlr_output_layout_output *lo =
|
||||
wlr_output_layout_add(server->output_layout, wlr_output,
|
||||
config->pos.x, config->pos.y);
|
||||
wlr_scene_output_layout_add_output(server->scene_output_layout, lo,
|
||||
output->scene_output);
|
||||
} else {
|
||||
wlr_scene_output_set_position(output->scene_output,
|
||||
config->pos.x, config->pos.y);
|
||||
wlr_scene_output_set_position(output->scene_output, config->pos.x,
|
||||
config->pos.y);
|
||||
}
|
||||
if(output->workspaces != NULL) {
|
||||
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
|
||||
|
|
@ -369,10 +373,12 @@ output_apply_config(struct cg_server *server, struct cg_output *output,
|
|||
// future.
|
||||
wlr_output_layout_get_box(server->output_layout, output->wlr_output,
|
||||
&output->layout_box);
|
||||
wlr_output_layout_remove(server->output_layout,output->wlr_output);
|
||||
struct wlr_output_layout_output *lo=wlr_output_layout_add(server->output_layout, output->wlr_output,
|
||||
output->layout_box.x, output->layout_box.y);
|
||||
wlr_scene_output_layout_add_output(server->scene_output_layout,lo,output->scene_output);
|
||||
wlr_output_layout_remove(server->output_layout, output->wlr_output);
|
||||
struct wlr_output_layout_output *lo =
|
||||
wlr_output_layout_add(server->output_layout, output->wlr_output,
|
||||
output->layout_box.x, output->layout_box.y);
|
||||
wlr_scene_output_layout_add_output(server->scene_output_layout, lo,
|
||||
output->scene_output);
|
||||
|
||||
struct wlr_output_mode *preferred_mode =
|
||||
wlr_output_preferred_mode(wlr_output);
|
||||
|
|
@ -406,8 +412,7 @@ output_apply_config(struct cg_server *server, struct cg_output *output,
|
|||
output->bg = wlr_scene_rect_create(
|
||||
&scene_output->scene->tree, output->wlr_output->width,
|
||||
output->wlr_output->height, server->bg_color);
|
||||
wlr_scene_node_set_position(&output->bg->node,
|
||||
scene_output->x,
|
||||
wlr_scene_node_set_position(&output->bg->node, scene_output->x,
|
||||
scene_output->y);
|
||||
wlr_scene_node_lower_to_bottom(&output->bg->node);
|
||||
}
|
||||
|
|
@ -527,7 +532,8 @@ handle_output_commit(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
if(event->state->committed &
|
||||
(WLR_OUTPUT_STATE_TRANSFORM | WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_MODE)) {
|
||||
(WLR_OUTPUT_STATE_TRANSFORM | WLR_OUTPUT_STATE_SCALE |
|
||||
WLR_OUTPUT_STATE_MODE)) {
|
||||
struct cg_view *view;
|
||||
wl_list_for_each(
|
||||
view, &output->workspaces[output->curr_workspace]->views, link) {
|
||||
|
|
@ -604,7 +610,7 @@ handle_new_output(struct wl_listener *listener, void *data) {
|
|||
} else {
|
||||
output = calloc(1, sizeof(struct cg_output));
|
||||
}
|
||||
output->scene_output=wlr_scene_output_create(server->scene,wlr_output);
|
||||
output->scene_output = wlr_scene_output_create(server->scene, wlr_output);
|
||||
if(!output) {
|
||||
wlr_log(WLR_ERROR, "Failed to allocate output");
|
||||
return;
|
||||
|
|
@ -670,9 +676,8 @@ handle_new_output(struct wl_listener *listener, void *data) {
|
|||
wlr_output_set_mode(wlr_output, preferred_mode);
|
||||
}
|
||||
wlr_output_set_transform(wlr_output, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||
wlr_scene_output_set_position(output->scene_output,
|
||||
output->layout_box.x,
|
||||
output->layout_box.y);
|
||||
wlr_scene_output_set_position(
|
||||
output->scene_output, output->layout_box.x, output->layout_box.y);
|
||||
wlr_output_enable(wlr_output, true);
|
||||
wlr_output_commit(wlr_output);
|
||||
output_configure(server, output);
|
||||
|
|
@ -680,7 +685,7 @@ handle_new_output(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
wlr_cursor_set_xcursor(server->seat->cursor, server->seat->xcursor_manager,
|
||||
DEFAULT_XCURSOR);
|
||||
DEFAULT_XCURSOR);
|
||||
wlr_cursor_warp(server->seat->cursor, NULL, 0, 0);
|
||||
|
||||
output->destroy.notify = handle_output_destroy;
|
||||
|
|
|
|||
8
seat.c
8
seat.c
|
|
@ -21,7 +21,6 @@
|
|||
#include <wlr/types/wlr_seat.h>
|
||||
#include <wlr/types/wlr_touch.h>
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#include <wlr/types/wlr_idle_notify_v1.h>
|
||||
#include <wlr/util/log.h>
|
||||
#if CG_HAS_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
|
|
@ -62,7 +61,8 @@ update_capabilities(const struct cg_seat *seat) {
|
|||
seat->enable_cursor == false) {
|
||||
wlr_cursor_unset_image(seat->cursor);
|
||||
} else {
|
||||
wlr_cursor_set_xcursor(seat->cursor, seat->xcursor_manager, DEFAULT_XCURSOR);
|
||||
wlr_cursor_set_xcursor(seat->cursor, seat->xcursor_manager,
|
||||
DEFAULT_XCURSOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -204,8 +204,8 @@ handle_command_key_bindings(struct cg_server *server, xkb_keysym_t sym,
|
|||
&server->scene->tree.node, server->seat->cursor->x,
|
||||
server->seat->cursor->y, &sx, &sy);
|
||||
if(server->seat->enable_cursor) {
|
||||
wlr_cursor_set_xcursor(server->seat->cursor, server->seat->xcursor_manager,
|
||||
"left_ptr");
|
||||
wlr_cursor_set_xcursor(server->seat->cursor,
|
||||
server->seat->xcursor_manager, "left_ptr");
|
||||
if(node && node->type == WLR_SCENE_NODE_BUFFER) {
|
||||
struct wlr_scene_surface *scene_surface =
|
||||
wlr_scene_surface_try_from_buffer(
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ handle_xdg_shell_surface_new(struct wl_listener *listener, void *data) {
|
|||
xdg_shell_view->map.notify = handle_xdg_shell_surface_map;
|
||||
wl_signal_add(&xdg_surface->surface->events.map, &xdg_shell_view->map);
|
||||
xdg_shell_view->unmap.notify = handle_xdg_shell_surface_unmap;
|
||||
wl_signal_add(&xdg_surface->surface->events.unmap, &xdg_shell_view->unmap);
|
||||
wl_signal_add(&xdg_surface->surface->events.unmap,
|
||||
&xdg_shell_view->unmap);
|
||||
xdg_shell_view->destroy.notify = handle_xdg_shell_surface_destroy;
|
||||
wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_view->destroy);
|
||||
xdg_shell_view->request_fullscreen.notify =
|
||||
|
|
|
|||
15
xwayland.c
15
xwayland.c
|
|
@ -42,7 +42,7 @@ static pid_t
|
|||
get_pid(const struct cg_view *view) {
|
||||
struct wlr_xwayland_surface *surf =
|
||||
wlr_xwayland_surface_try_from_wlr_surface(view->wlr_surface);
|
||||
if(surf==NULL) {
|
||||
if(surf == NULL) {
|
||||
return -1;
|
||||
} else {
|
||||
return surf->pid;
|
||||
|
|
@ -173,9 +173,8 @@ static const struct cg_view_impl xwayland_view_impl = {
|
|||
static void
|
||||
handle_xwayland_surface_associate(struct wl_listener *listener, void *data) {
|
||||
struct cg_xwayland_view *xwayland_view =
|
||||
wl_container_of(listener, xwayland_view, associate);
|
||||
struct wlr_xwayland_surface *xsurface =
|
||||
xwayland_view->xwayland_surface;
|
||||
wl_container_of(listener, xwayland_view, associate);
|
||||
struct wlr_xwayland_surface *xsurface = xwayland_view->xwayland_surface;
|
||||
wl_signal_add(&xsurface->surface->events.unmap, &xwayland_view->unmap);
|
||||
xwayland_view->unmap.notify = handle_xwayland_surface_unmap;
|
||||
wl_signal_add(&xsurface->surface->events.map, &xwayland_view->map);
|
||||
|
|
@ -185,7 +184,7 @@ handle_xwayland_surface_associate(struct wl_listener *listener, void *data) {
|
|||
static void
|
||||
handle_xwayland_surface_dissociate(struct wl_listener *listener, void *data) {
|
||||
struct cg_xwayland_view *xwayland_view =
|
||||
wl_container_of(listener, xwayland_view, dissociate);
|
||||
wl_container_of(listener, xwayland_view, dissociate);
|
||||
wl_list_remove(&xwayland_view->map.link);
|
||||
wl_list_remove(&xwayland_view->unmap.link);
|
||||
}
|
||||
|
|
@ -208,9 +207,11 @@ handle_xwayland_surface_new(struct wl_listener *listener, void *data) {
|
|||
xwayland_view->xwayland_surface = xwayland_surface;
|
||||
|
||||
xwayland_view->associate.notify = handle_xwayland_surface_associate;
|
||||
wl_signal_add(&xwayland_surface->events.associate, &xwayland_view->associate);
|
||||
wl_signal_add(&xwayland_surface->events.associate,
|
||||
&xwayland_view->associate);
|
||||
xwayland_view->dissociate.notify = handle_xwayland_surface_dissociate;
|
||||
wl_signal_add(&xwayland_surface->events.dissociate, &xwayland_view->dissociate);
|
||||
wl_signal_add(&xwayland_surface->events.dissociate,
|
||||
&xwayland_view->dissociate);
|
||||
xwayland_view->destroy.notify = handle_xwayland_surface_destroy;
|
||||
wl_signal_add(&xwayland_surface->events.destroy, &xwayland_view->destroy);
|
||||
xwayland_view->request_fullscreen.notify =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue