mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
Fix indentation in various files
This commit is contained in:
parent
f3ef1f907c
commit
a4eb90315e
@ -152,7 +152,7 @@ int main(int argc, char *argv[]) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool create_t1 = (simulate_activity_timeout != 0) &&
|
bool create_t1 = (simulate_activity_timeout != 0) &&
|
||||||
(simulate_activity_timeout < close_timeout);
|
(simulate_activity_timeout < close_timeout);
|
||||||
|
|
||||||
if (create_t1) {
|
if (create_t1) {
|
||||||
if (pthread_create(&t1, NULL, &simulate_activity, (void *)&arg) != 0) {
|
if (pthread_create(&t1, NULL, &simulate_activity, (void *)&arg) != 0) {
|
||||||
|
@ -4,15 +4,15 @@
|
|||||||
#include "rootston/input.h"
|
#include "rootston/input.h"
|
||||||
|
|
||||||
struct roots_switch {
|
struct roots_switch {
|
||||||
struct roots_seat *seat;
|
struct roots_seat *seat;
|
||||||
struct wlr_input_device *device;
|
struct wlr_input_device *device;
|
||||||
struct wl_listener device_destroy;
|
struct wl_listener device_destroy;
|
||||||
|
|
||||||
struct wl_listener toggle;
|
struct wl_listener toggle;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
void roots_switch_handle_toggle(struct roots_switch *lid_switch,
|
void roots_switch_handle_toggle(struct roots_switch *lid_switch,
|
||||||
struct wlr_event_switch_toggle *event);
|
struct wlr_event_switch_toggle *event);
|
||||||
|
|
||||||
#endif // ROOTSTON_SWITCH_H
|
#endif
|
||||||
|
@ -7,101 +7,101 @@
|
|||||||
|
|
||||||
static bool outputs_enabled = true;
|
static bool outputs_enabled = true;
|
||||||
|
|
||||||
static const char *exec_prefix = "exec ";
|
static const char exec_prefix[] = "exec ";
|
||||||
|
|
||||||
static void double_fork_shell_cmd(const char *shell_cmd) {
|
static void double_fork_shell_cmd(const char *shell_cmd) {
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
wlr_log(WLR_ERROR, "cannot execute binding command: fork() failed");
|
wlr_log(WLR_ERROR, "cannot execute binding command: fork() failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
execl("/bin/sh", "/bin/sh", "-c", shell_cmd, NULL);
|
execl("/bin/sh", "/bin/sh", "-c", shell_cmd, NULL);
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
_exit(pid == -1);
|
_exit(pid == -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
while (waitpid(pid, &status, 0) < 0) {
|
while (waitpid(pid, &status, 0) < 0) {
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wlr_log_errno(WLR_ERROR, "waitpid() on first child failed");
|
wlr_log_errno(WLR_ERROR, "waitpid() on first child failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
|
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(WLR_ERROR, "first child failed to fork command");
|
wlr_log(WLR_ERROR, "first child failed to fork command");
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_binding_command(struct roots_seat *seat,
|
void execute_binding_command(struct roots_seat *seat,
|
||||||
struct roots_input *input, const char *command) {
|
struct roots_input *input, const char *command) {
|
||||||
if (strcmp(command, "exit") == 0) {
|
if (strcmp(command, "exit") == 0) {
|
||||||
wl_display_terminate(input->server->wl_display);
|
wl_display_terminate(input->server->wl_display);
|
||||||
} else if (strcmp(command, "close") == 0) {
|
} else if (strcmp(command, "close") == 0) {
|
||||||
struct roots_view *focus = roots_seat_get_focus(seat);
|
struct roots_view *focus = roots_seat_get_focus(seat);
|
||||||
if (focus != NULL) {
|
if (focus != NULL) {
|
||||||
view_close(focus);
|
view_close(focus);
|
||||||
}
|
}
|
||||||
} else if (strcmp(command, "fullscreen") == 0) {
|
} else if (strcmp(command, "fullscreen") == 0) {
|
||||||
struct roots_view *focus = roots_seat_get_focus(seat);
|
struct roots_view *focus = roots_seat_get_focus(seat);
|
||||||
if (focus != NULL) {
|
if (focus != NULL) {
|
||||||
bool is_fullscreen = focus->fullscreen_output != NULL;
|
bool is_fullscreen = focus->fullscreen_output != NULL;
|
||||||
view_set_fullscreen(focus, !is_fullscreen, NULL);
|
view_set_fullscreen(focus, !is_fullscreen, NULL);
|
||||||
}
|
}
|
||||||
} else if (strcmp(command, "next_window") == 0) {
|
} else if (strcmp(command, "next_window") == 0) {
|
||||||
roots_seat_cycle_focus(seat);
|
roots_seat_cycle_focus(seat);
|
||||||
} else if (strcmp(command, "alpha") == 0) {
|
} else if (strcmp(command, "alpha") == 0) {
|
||||||
struct roots_view *focus = roots_seat_get_focus(seat);
|
struct roots_view *focus = roots_seat_get_focus(seat);
|
||||||
if (focus != NULL) {
|
if (focus != NULL) {
|
||||||
view_cycle_alpha(focus);
|
view_cycle_alpha(focus);
|
||||||
}
|
}
|
||||||
} else if (strncmp(exec_prefix, command, strlen(exec_prefix)) == 0) {
|
} else if (strncmp(exec_prefix, command, strlen(exec_prefix)) == 0) {
|
||||||
const char *shell_cmd = command + strlen(exec_prefix);
|
const char *shell_cmd = command + strlen(exec_prefix);
|
||||||
double_fork_shell_cmd(shell_cmd);
|
double_fork_shell_cmd(shell_cmd);
|
||||||
} else if (strcmp(command, "maximize") == 0) {
|
} else if (strcmp(command, "maximize") == 0) {
|
||||||
struct roots_view *focus = roots_seat_get_focus(seat);
|
struct roots_view *focus = roots_seat_get_focus(seat);
|
||||||
if (focus != NULL) {
|
if (focus != NULL) {
|
||||||
view_maximize(focus, !focus->maximized);
|
view_maximize(focus, !focus->maximized);
|
||||||
}
|
}
|
||||||
} else if (strcmp(command, "nop") == 0) {
|
} else if (strcmp(command, "nop") == 0) {
|
||||||
wlr_log(WLR_DEBUG, "nop command");
|
wlr_log(WLR_DEBUG, "nop command");
|
||||||
} else if (strcmp(command, "toggle_outputs") == 0) {
|
} else if (strcmp(command, "toggle_outputs") == 0) {
|
||||||
outputs_enabled = !outputs_enabled;
|
outputs_enabled = !outputs_enabled;
|
||||||
struct roots_output *output;
|
struct roots_output *output;
|
||||||
wl_list_for_each(output, &input->server->desktop->outputs, link) {
|
wl_list_for_each(output, &input->server->desktop->outputs, link) {
|
||||||
wlr_output_enable(output->wlr_output, outputs_enabled);
|
wlr_output_enable(output->wlr_output, outputs_enabled);
|
||||||
}
|
}
|
||||||
} else if (strcmp(command, "toggle_decoration_mode") == 0) {
|
} else if (strcmp(command, "toggle_decoration_mode") == 0) {
|
||||||
struct roots_view *focus = roots_seat_get_focus(seat);
|
struct roots_view *focus = roots_seat_get_focus(seat);
|
||||||
if (focus != NULL && focus->type == ROOTS_XDG_SHELL_VIEW) {
|
if (focus != NULL && focus->type == ROOTS_XDG_SHELL_VIEW) {
|
||||||
struct roots_xdg_toplevel_decoration *decoration =
|
struct roots_xdg_toplevel_decoration *decoration =
|
||||||
focus->roots_xdg_surface->xdg_toplevel_decoration;
|
focus->roots_xdg_surface->xdg_toplevel_decoration;
|
||||||
if (decoration != NULL) {
|
if (decoration != NULL) {
|
||||||
enum wlr_xdg_toplevel_decoration_v1_mode mode =
|
enum wlr_xdg_toplevel_decoration_v1_mode mode =
|
||||||
decoration->wlr_decoration->current_mode;
|
decoration->wlr_decoration->current_mode;
|
||||||
mode = mode == WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
|
mode = mode == WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
|
||||||
? WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE
|
? WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE
|
||||||
: WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
: WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
||||||
wlr_xdg_toplevel_decoration_v1_set_mode(
|
wlr_xdg_toplevel_decoration_v1_set_mode(
|
||||||
decoration->wlr_decoration, mode);
|
decoration->wlr_decoration, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strcmp(command, "break_pointer_constraint") == 0) {
|
} else if (strcmp(command, "break_pointer_constraint") == 0) {
|
||||||
struct wl_list *list = &input->seats;
|
struct wl_list *list = &input->seats;
|
||||||
struct roots_seat *seat;
|
struct roots_seat *seat;
|
||||||
wl_list_for_each(seat, list, link) {
|
wl_list_for_each(seat, list, link) {
|
||||||
roots_cursor_constrain(seat->cursor, NULL, NAN, NAN);
|
roots_cursor_constrain(seat->cursor, NULL, NAN, NAN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "unknown binding command: %s", command);
|
wlr_log(WLR_ERROR, "unknown binding command: %s", command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,22 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
#include "rootston/bindings.h"
|
#include "rootston/bindings.h"
|
||||||
#include "rootston/config.h"
|
|
||||||
#include "rootston/input.h"
|
|
||||||
#include "rootston/seat.h"
|
|
||||||
#include "rootston/switch.h"
|
|
||||||
|
|
||||||
void roots_switch_handle_toggle(struct roots_switch *lid_switch,
|
void roots_switch_handle_toggle(struct roots_switch *lid_switch,
|
||||||
struct wlr_event_switch_toggle *event) {
|
struct wlr_event_switch_toggle *event) {
|
||||||
struct wl_list *bound_switches = &lid_switch->seat->input->server->config->switches;
|
struct wl_list *bound_switches =
|
||||||
struct roots_switch_config *sc;
|
&lid_switch->seat->input->server->config->switches;
|
||||||
wl_list_for_each(sc, bound_switches, link) {
|
struct roots_switch_config *sc;
|
||||||
if ((sc->name != NULL && strcmp(event->device->name, sc->name) != 0) &&
|
wl_list_for_each(sc, bound_switches, link) {
|
||||||
(sc->name == NULL && event->switch_type != sc->switch_type)) {
|
if ((sc->name != NULL && strcmp(event->device->name, sc->name) != 0) &&
|
||||||
continue;
|
(sc->name == NULL && event->switch_type != sc->switch_type)) {
|
||||||
}
|
continue;
|
||||||
if (sc->switch_state != WLR_SWITCH_STATE_TOGGLE &&
|
}
|
||||||
event->switch_state != sc->switch_state) {
|
if (sc->switch_state != WLR_SWITCH_STATE_TOGGLE &&
|
||||||
continue;
|
event->switch_state != sc->switch_state) {
|
||||||
}
|
continue;
|
||||||
execute_binding_command(lid_switch->seat, lid_switch->seat->input, sc->command);
|
}
|
||||||
}
|
execute_binding_command(lid_switch->seat,
|
||||||
|
lid_switch->seat->input, sc->command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ void wlr_foreign_toplevel_handle_v1_output_enter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
toplevel_output =
|
toplevel_output =
|
||||||
calloc(1, sizeof(struct wlr_foreign_toplevel_handle_v1_output));
|
calloc(1, sizeof(struct wlr_foreign_toplevel_handle_v1_output));
|
||||||
if (!toplevel_output) {
|
if (!toplevel_output) {
|
||||||
wlr_log(WLR_ERROR, "failed to allocate memory for toplevel output");
|
wlr_log(WLR_ERROR, "failed to allocate memory for toplevel output");
|
||||||
return;
|
return;
|
||||||
@ -405,7 +405,7 @@ static struct wl_resource *create_toplevel_resource_for_resource(
|
|||||||
}
|
}
|
||||||
|
|
||||||
wl_resource_set_implementation(resource, &toplevel_handle_impl, toplevel,
|
wl_resource_set_implementation(resource, &toplevel_handle_impl, toplevel,
|
||||||
foreign_toplevel_resource_destroy);
|
foreign_toplevel_resource_destroy);
|
||||||
|
|
||||||
wl_list_insert(&toplevel->resources, wl_resource_get_link(resource));
|
wl_list_insert(&toplevel->resources, wl_resource_get_link(resource));
|
||||||
zwlr_foreign_toplevel_manager_v1_send_toplevel(manager_resource, resource);
|
zwlr_foreign_toplevel_manager_v1_send_toplevel(manager_resource, resource);
|
||||||
@ -469,12 +469,10 @@ static void toplevel_send_details_to_toplevel_resource(
|
|||||||
struct wlr_foreign_toplevel_handle_v1 *toplevel,
|
struct wlr_foreign_toplevel_handle_v1 *toplevel,
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
if (toplevel->title) {
|
if (toplevel->title) {
|
||||||
zwlr_foreign_toplevel_handle_v1_send_title(resource,
|
zwlr_foreign_toplevel_handle_v1_send_title(resource, toplevel->title);
|
||||||
toplevel->title);
|
|
||||||
}
|
}
|
||||||
if (toplevel->app_id) {
|
if (toplevel->app_id) {
|
||||||
zwlr_foreign_toplevel_handle_v1_send_app_id(resource,
|
zwlr_foreign_toplevel_handle_v1_send_app_id(resource, toplevel->app_id);
|
||||||
toplevel->app_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_foreign_toplevel_handle_v1_output *output;
|
struct wlr_foreign_toplevel_handle_v1_output *output;
|
||||||
@ -516,7 +514,7 @@ static void foreign_toplevel_manager_bind(struct wl_client *client, void *data,
|
|||||||
struct wl_resource *toplevel_resource =
|
struct wl_resource *toplevel_resource =
|
||||||
create_toplevel_resource_for_resource(toplevel, resource);
|
create_toplevel_resource_for_resource(toplevel, resource);
|
||||||
toplevel_send_details_to_toplevel_resource(toplevel,
|
toplevel_send_details_to_toplevel_resource(toplevel,
|
||||||
toplevel_resource);
|
toplevel_resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user