tree-wide: auto-replace of (struct server *)

#!/bin/bash
    read -r -d '' EXPRS << EOF
    s/xwayland->server/xwayland->svr/g;

    s/\t*struct server \*server;\n//g;
    s/\t*struct server \*server =.*?;\n//gs;
    s/\t*.* = ([a-z_]*->)*server[;,]\n//g;
    s/\{\n\n/\{\n/g;
    s/\n\n+/\n\n/g;

    s/\(\s*struct server \*server\)/(void)/g;
    s/\(\s*struct server \*server,\s*/(/g;
    s/,\s*struct server \*server\)/)/g;
    s/,\s*struct server \*server,\s*/, /g;

    s/\(\s*([a-z_]*->)*server\)/()/g;
    s/\(\s*([a-z_]*->)*server,\s*/(/g;
    s/,\s*([a-z_]*->)*server\)/)/g;
    s/,\s*([a-z_]*->)*server,\s*/, /g;

    s/([a-z_]*->)*server->/g_server./g;

    s/xwayland->svr/xwayland->server/g;
    EOF

    find src include \( -name \*.c -o -name \*.h \) -exec \
        perl -0777 -i -pe "$EXPRS" \{\} \;
This commit is contained in:
John Lindgren 2026-02-23 11:56:39 -05:00 committed by Johan Malm
parent 60ac8f07bb
commit cb49bddf63
81 changed files with 1522 additions and 1682 deletions

View file

@ -46,14 +46,12 @@
bool
output_get_tearing_allowance(struct output *output)
{
struct server *server = output->server;
/* never allow tearing when disabled */
if (!rc.allow_tearing) {
return false;
}
struct view *view = server->active_view;
struct view *view = g_server.active_view;
/* tearing is only allowed for the output with the active view */
if (!view || view->output != output) {
@ -90,7 +88,6 @@ output_apply_gamma(struct output *output)
assert(output);
assert(output->gamma_lut_changed);
struct server *server = output->server;
struct wlr_scene_output *scene_output = output->scene_output;
struct wlr_output_state pending;
@ -99,7 +96,7 @@ output_apply_gamma(struct output *output)
output->gamma_lut_changed = false;
struct wlr_gamma_control_v1 *gamma_control =
wlr_gamma_control_manager_v1_get_control(
server->gamma_control_manager_v1,
g_server.gamma_control_manager_v1,
output->wlr_output);
if (!wlr_gamma_control_v1_apply(gamma_control, &pending)) {
@ -129,7 +126,7 @@ handle_output_frame(struct wl_listener *listener, void *data)
/*
* skip painting the session when it exists but is not active.
*/
if (output->server->session && !output->server->session->active) {
if (g_server.session && !g_server.session->active) {
return;
}
@ -160,8 +157,7 @@ static void
handle_output_destroy(struct wl_listener *listener, void *data)
{
struct output *output = wl_container_of(listener, output, destroy);
struct server *server = output->server;
struct seat *seat = &server->seat;
struct seat *seat = &g_server.seat;
regions_evacuate_output(output);
regions_destroy(seat, &output->regions);
if (seat->overlay.active.output == output) {
@ -185,7 +181,7 @@ handle_output_destroy(struct wl_listener *listener, void *data)
}
struct view *view;
wl_list_for_each(view, &server->views, link) {
wl_list_for_each(view, &g_server.views, link) {
if (view->output == output) {
view_on_output_destroy(view);
}
@ -205,13 +201,13 @@ handle_output_destroy(struct wl_listener *listener, void *data)
* windows and cannot be reconnected. Exit the compositor
* when the last one is destroyed.
*/
if (wl_list_empty(&server->outputs) && (
if (wl_list_empty(&g_server.outputs) && (
wlr_output_is_wl(output->wlr_output)
#if WLR_HAS_X11_BACKEND
|| wlr_output_is_x11(output->wlr_output)
#endif
)) {
wl_display_terminate(server->wl_display);
wl_display_terminate(g_server.wl_display);
}
/*
@ -260,14 +256,14 @@ handle_output_request_state(struct wl_listener *listener, void *data)
}
}
static void do_output_layout_change(struct server *server);
static void do_output_layout_change(void);
static void
add_output_to_layout(struct server *server, struct output *output)
add_output_to_layout(struct output *output)
{
struct wlr_output *wlr_output = output->wlr_output;
struct wlr_output_layout_output *layout_output =
wlr_output_layout_add_auto(server->output_layout, wlr_output);
wlr_output_layout_add_auto(g_server.output_layout, wlr_output);
if (!layout_output) {
wlr_log(WLR_ERROR, "unable to add output to layout");
return;
@ -275,7 +271,7 @@ add_output_to_layout(struct server *server, struct output *output)
if (!output->scene_output) {
output->scene_output =
wlr_scene_output_create(server->scene, wlr_output);
wlr_scene_output_create(g_server.scene, wlr_output);
if (!output->scene_output) {
wlr_log(WLR_ERROR, "unable to create scene output");
return;
@ -285,21 +281,21 @@ add_output_to_layout(struct server *server, struct output *output)
* safe to call twice, so we call it only when initially
* creating the scene_output.
*/
wlr_scene_output_layout_add_output(server->scene_layout,
wlr_scene_output_layout_add_output(g_server.scene_layout,
layout_output, output->scene_output);
}
lab_cosmic_workspace_group_output_enter(
server->workspaces.cosmic_group, output->wlr_output);
g_server.workspaces.cosmic_group, output->wlr_output);
lab_ext_workspace_group_output_enter(
server->workspaces.ext_group, output->wlr_output);
g_server.workspaces.ext_group, output->wlr_output);
/* (Re-)create regions from config */
regions_reconfigure_output(output);
/* Create lock surface if needed */
if (server->session_lock_manager->locked) {
session_lock_output_create(server->session_lock_manager, output);
if (g_server.session_lock_manager->locked) {
session_lock_output_create(g_server.session_lock_manager, output);
}
}
@ -388,7 +384,7 @@ output_test_auto(struct wlr_output *wlr_output, struct wlr_output_state *state,
}
static void
configure_new_output(struct server *server, struct output *output)
configure_new_output(struct output *output)
{
struct wlr_output *wlr_output = output->wlr_output;
@ -417,17 +413,17 @@ configure_new_output(struct server *server, struct output *output)
* calling do_output_layout_change(); this ensures that the
* wlr_output_cursor is created for the new output.
*/
server->pending_output_layout_change++;
add_output_to_layout(server, output);
server->pending_output_layout_change--;
g_server.pending_output_layout_change++;
add_output_to_layout(output);
g_server.pending_output_layout_change--;
}
static uint64_t
get_unused_output_id_bit(struct server *server)
get_unused_output_id_bit(void)
{
uint64_t used_id_bits = 0;
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
wl_list_for_each(output, &g_server.outputs, link) {
used_id_bits |= output->id_bit;
}
@ -435,7 +431,7 @@ get_unused_output_id_bit(struct server *server)
return 0;
}
uint64_t id_bit = server->next_output_id_bit;
uint64_t id_bit = g_server.next_output_id_bit;
/*
* __builtin_popcountll() should be supported by GCC & clang.
* If it causes portability issues, just remove the assert.
@ -452,7 +448,7 @@ get_unused_output_id_bit(struct server *server)
* can cycle through all 64 available bits, making re-use less
* frequent (on a best-effort basis).
*/
server->next_output_id_bit = (id_bit << 1) | (id_bit >> 63);
g_server.next_output_id_bit = (id_bit << 1) | (id_bit >> 63);
return id_bit;
}
@ -464,11 +460,10 @@ handle_new_output(struct wl_listener *listener, void *data)
* This event is raised by the backend when a new output (aka display
* or monitor) becomes available.
*/
struct server *server = wl_container_of(listener, server, new_output);
struct wlr_output *wlr_output = data;
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
wl_list_for_each(output, &g_server.outputs, link) {
if (output->wlr_output == wlr_output) {
/*
* This is a duplicated notification.
@ -480,7 +475,7 @@ handle_new_output(struct wl_listener *listener, void *data)
}
}
uint64_t id_bit = get_unused_output_id_bit(server);
uint64_t id_bit = get_unused_output_id_bit();
if (!id_bit) {
wlr_log(WLR_ERROR, "Cannot add more than 64 outputs");
return;
@ -508,9 +503,9 @@ handle_new_output(struct wl_listener *listener, void *data)
* TODO: remove once labwc starts tracking 0.20.x and the fix has been merged.
*/
#if LAB_WLR_VERSION_AT_LEAST(0, 19, 1)
if (server->drm_lease_manager && wlr_output_is_drm(wlr_output)) {
if (g_server.drm_lease_manager && wlr_output_is_drm(wlr_output)) {
wlr_drm_lease_v1_manager_offer_output(
server->drm_lease_manager, wlr_output);
g_server.drm_lease_manager, wlr_output);
}
#endif
@ -526,8 +521,8 @@ handle_new_output(struct wl_listener *listener, void *data)
* Configures the output created by the backend to use our allocator
* and our renderer. Must be done once, before committing the output
*/
if (!wlr_output_init_render(wlr_output, server->allocator,
server->renderer)) {
if (!wlr_output_init_render(wlr_output, g_server.allocator,
g_server.renderer)) {
wlr_log(WLR_ERROR, "unable to init output renderer");
return;
}
@ -535,11 +530,10 @@ handle_new_output(struct wl_listener *listener, void *data)
output = znew(*output);
output->wlr_output = wlr_output;
wlr_output->data = output;
output->server = server;
output->id_bit = id_bit;
output_state_init(output);
wl_list_insert(&server->outputs, &output->link);
wl_list_insert(&g_server.outputs, &output->link);
output->destroy.notify = handle_output_destroy;
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
@ -557,11 +551,11 @@ handle_new_output(struct wl_listener *listener, void *data)
*/
for (size_t i = 0; i < ARRAY_SIZE(output->layer_tree); i++) {
output->layer_tree[i] =
lab_wlr_scene_tree_create(&server->scene->tree);
lab_wlr_scene_tree_create(&g_server.scene->tree);
}
output->layer_popup_tree = lab_wlr_scene_tree_create(&server->scene->tree);
output->cycle_osd_tree = lab_wlr_scene_tree_create(&server->scene->tree);
output->session_lock_tree = lab_wlr_scene_tree_create(&server->scene->tree);
output->layer_popup_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
output->cycle_osd_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
output->session_lock_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
/*
* Set the z-positions to achieve the following order (from top to
@ -579,7 +573,7 @@ handle_new_output(struct wl_listener *listener, void *data)
wlr_scene_node_lower_to_bottom(&output->layer_tree[1]->node);
wlr_scene_node_lower_to_bottom(&output->layer_tree[0]->node);
struct wlr_scene_node *menu_node = &server->menu_tree->node;
struct wlr_scene_node *menu_node = &g_server.menu_tree->node;
wlr_scene_node_place_below(&output->layer_tree[2]->node, menu_node);
wlr_scene_node_place_below(&output->layer_tree[3]->node, menu_node);
wlr_scene_node_place_below(&output->layer_popup_tree->node, menu_node);
@ -594,84 +588,83 @@ handle_new_output(struct wl_listener *listener, void *data)
* might need tweaking if wlroots adds other output backends.
*/
if (rc.auto_enable_outputs || !wlr_output_is_drm(wlr_output)) {
configure_new_output(server, output);
configure_new_output(output);
}
do_output_layout_change(server);
do_output_layout_change();
}
static void output_manager_init(struct server *server);
static void output_manager_init(void);
void
output_init(struct server *server)
output_init(void)
{
server->gamma_control_manager_v1 =
wlr_gamma_control_manager_v1_create(server->wl_display);
g_server.gamma_control_manager_v1 =
wlr_gamma_control_manager_v1_create(g_server.wl_display);
server->new_output.notify = handle_new_output;
wl_signal_add(&server->backend->events.new_output, &server->new_output);
g_server.new_output.notify = handle_new_output;
wl_signal_add(&g_server.backend->events.new_output, &g_server.new_output);
/*
* Create an output layout, which is a wlroots utility for working with
* an arrangement of screens in a physical layout.
*/
server->output_layout = wlr_output_layout_create(server->wl_display);
if (!server->output_layout) {
g_server.output_layout = wlr_output_layout_create(g_server.wl_display);
if (!g_server.output_layout) {
wlr_log(WLR_ERROR, "unable to create output layout");
exit(EXIT_FAILURE);
}
server->scene_layout = wlr_scene_attach_output_layout(server->scene,
server->output_layout);
if (!server->scene_layout) {
g_server.scene_layout = wlr_scene_attach_output_layout(g_server.scene,
g_server.output_layout);
if (!g_server.scene_layout) {
wlr_log(WLR_ERROR, "unable to create scene layout");
exit(EXIT_FAILURE);
}
/* Enable screen recording with wf-recorder */
wlr_xdg_output_manager_v1_create(server->wl_display,
server->output_layout);
wlr_xdg_output_manager_v1_create(g_server.wl_display,
g_server.output_layout);
wl_list_init(&server->outputs);
server->next_output_id_bit = (1 << 0);
wl_list_init(&g_server.outputs);
g_server.next_output_id_bit = (1 << 0);
output_manager_init(server);
output_manager_init();
}
static void output_manager_finish(struct server *server);
static void output_manager_finish(void);
void
output_finish(struct server *server)
output_finish(void)
{
wl_list_remove(&server->new_output.link);
output_manager_finish(server);
wl_list_remove(&g_server.new_output.link);
output_manager_finish();
}
static void
output_update_for_layout_change(struct server *server)
output_update_for_layout_change(void)
{
output_update_all_usable_areas(server, /*layout_changed*/ true);
session_lock_update_for_layout_change(server);
output_update_all_usable_areas(/*layout_changed*/ true);
session_lock_update_for_layout_change();
/*
* "Move" each wlr_output_cursor (in per-output coordinates) to
* align with the seat cursor. Re-set the cursor image so that
* the cursor isn't invisible on new outputs.
*/
wlr_cursor_move(server->seat.cursor, NULL, 0, 0);
cursor_update_image(&server->seat);
wlr_cursor_move(g_server.seat.cursor, NULL, 0, 0);
cursor_update_image(&g_server.seat);
}
static bool
output_config_apply(struct server *server,
struct wlr_output_configuration_v1 *config)
output_config_apply(struct wlr_output_configuration_v1 *config)
{
bool success = true;
server->pending_output_layout_change++;
g_server.pending_output_layout_change++;
struct wlr_output_configuration_head_v1 *head;
wl_list_for_each(head, &config->heads, link) {
struct wlr_output *o = head->state.output;
struct output *output = output_from_wlr_output(server, o);
struct output *output = output_from_wlr_output(o);
struct wlr_output_state *os = &output->pending;
bool output_enabled = head->state.enabled;
@ -715,31 +708,31 @@ output_config_apply(struct server *server,
* been enabled but not yet been added to the layout.
*/
bool was_in_layout =
!!wlr_output_layout_get(server->output_layout, o);
!!wlr_output_layout_get(g_server.output_layout, o);
if (output_enabled) {
if (!was_in_layout) {
add_output_to_layout(server, output);
add_output_to_layout(output);
}
struct wlr_box pos = {0};
wlr_output_layout_get_box(server->output_layout, o, &pos);
wlr_output_layout_get_box(g_server.output_layout, o, &pos);
if (pos.x != head->state.x || pos.y != head->state.y) {
/*
* This overrides the automatic layout
*
* wlr_output_layout_add() in fact means _move()
*/
wlr_output_layout_add(server->output_layout, o,
wlr_output_layout_add(g_server.output_layout, o,
head->state.x, head->state.y);
}
} else if (was_in_layout) {
regions_evacuate_output(output);
lab_cosmic_workspace_group_output_leave(
server->workspaces.cosmic_group, output->wlr_output);
g_server.workspaces.cosmic_group, output->wlr_output);
lab_ext_workspace_group_output_leave(
server->workspaces.ext_group, output->wlr_output);
g_server.workspaces.ext_group, output->wlr_output);
/*
* At time of writing, wlr_output_layout_remove()
@ -750,13 +743,13 @@ output_config_apply(struct server *server,
* calling wlr_output_layout_remove().
*/
wlr_scene_output_destroy(output->scene_output);
wlr_output_layout_remove(server->output_layout, o);
wlr_output_layout_remove(g_server.output_layout, o);
output->scene_output = NULL;
}
}
server->pending_output_layout_change--;
do_output_layout_change(server);
g_server.pending_output_layout_change--;
do_output_layout_change();
return success;
}
@ -835,27 +828,25 @@ handle_output_manager_test(struct wl_listener *listener, void *data)
static void
handle_output_manager_apply(struct wl_listener *listener, void *data)
{
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);
if (config_is_good && output_config_apply(server, config)) {
if (config_is_good && output_config_apply(config)) {
wlr_output_configuration_v1_send_succeeded(config);
} else {
wlr_output_configuration_v1_send_failed(config);
}
wlr_output_configuration_v1_destroy(config);
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
wlr_xcursor_manager_load(server->seat.xcursor_manager,
wl_list_for_each(output, &g_server.outputs, link) {
wlr_xcursor_manager_load(g_server.seat.xcursor_manager,
output->wlr_output->scale);
}
/* Re-set cursor image in case scale changed */
cursor_update_focus(server);
cursor_update_image(&server->seat);
cursor_update_focus();
cursor_update_image(&g_server.seat);
}
/*
@ -864,7 +855,7 @@ handle_output_manager_apply(struct wl_listener *listener, void *data)
* interface
*/
static struct
wlr_output_configuration_v1 *create_output_config(struct server *server)
wlr_output_configuration_v1 *create_output_config(void)
{
struct wlr_output_configuration_v1 *config =
wlr_output_configuration_v1_create();
@ -874,7 +865,7 @@ wlr_output_configuration_v1 *create_output_config(struct server *server)
}
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
wl_list_for_each(output, &g_server.outputs, link) {
struct wlr_output_configuration_head_v1 *head =
wlr_output_configuration_head_v1_create(config,
output->wlr_output);
@ -893,35 +884,32 @@ wlr_output_configuration_v1 *create_output_config(struct server *server)
}
static void
do_output_layout_change(struct server *server)
do_output_layout_change(void)
{
if (!server->pending_output_layout_change) {
if (!g_server.pending_output_layout_change) {
struct wlr_output_configuration_v1 *config =
create_output_config(server);
create_output_config();
if (config) {
wlr_output_manager_v1_set_configuration(
server->output_manager, config);
g_server.output_manager, config);
} else {
wlr_log(WLR_ERROR,
"wlr_output_manager_v1_set_configuration()");
}
output_update_for_layout_change(server);
seat_output_layout_changed(&server->seat);
output_update_for_layout_change();
seat_output_layout_changed(&g_server.seat);
}
}
static void
handle_output_layout_change(struct wl_listener *listener, void *data)
{
struct server *server =
wl_container_of(listener, server, output_layout_change);
/* Prevents unnecessary layout recalculations */
server->pending_output_layout_change++;
output_virtual_update_fallback(server);
server->pending_output_layout_change--;
g_server.pending_output_layout_change++;
output_virtual_update_fallback();
g_server.pending_output_layout_change--;
do_output_layout_change(server);
do_output_layout_change();
}
static void
@ -938,41 +926,41 @@ handle_gamma_control_set_gamma(struct wl_listener *listener, void *data)
}
static void
output_manager_init(struct server *server)
output_manager_init(void)
{
server->output_manager = wlr_output_manager_v1_create(server->wl_display);
g_server.output_manager = wlr_output_manager_v1_create(g_server.wl_display);
server->output_layout_change.notify = handle_output_layout_change;
wl_signal_add(&server->output_layout->events.change,
&server->output_layout_change);
g_server.output_layout_change.notify = handle_output_layout_change;
wl_signal_add(&g_server.output_layout->events.change,
&g_server.output_layout_change);
server->output_manager_apply.notify = handle_output_manager_apply;
wl_signal_add(&server->output_manager->events.apply,
&server->output_manager_apply);
g_server.output_manager_apply.notify = handle_output_manager_apply;
wl_signal_add(&g_server.output_manager->events.apply,
&g_server.output_manager_apply);
server->output_manager_test.notify = handle_output_manager_test;
wl_signal_add(&server->output_manager->events.test,
&server->output_manager_test);
g_server.output_manager_test.notify = handle_output_manager_test;
wl_signal_add(&g_server.output_manager->events.test,
&g_server.output_manager_test);
server->gamma_control_set_gamma.notify = handle_gamma_control_set_gamma;
wl_signal_add(&server->gamma_control_manager_v1->events.set_gamma,
&server->gamma_control_set_gamma);
g_server.gamma_control_set_gamma.notify = handle_gamma_control_set_gamma;
wl_signal_add(&g_server.gamma_control_manager_v1->events.set_gamma,
&g_server.gamma_control_set_gamma);
}
static void
output_manager_finish(struct server *server)
output_manager_finish(void)
{
wl_list_remove(&server->output_layout_change.link);
wl_list_remove(&server->output_manager_apply.link);
wl_list_remove(&server->output_manager_test.link);
wl_list_remove(&server->gamma_control_set_gamma.link);
wl_list_remove(&g_server.output_layout_change.link);
wl_list_remove(&g_server.output_manager_apply.link);
wl_list_remove(&g_server.output_manager_test.link);
wl_list_remove(&g_server.gamma_control_set_gamma.link);
}
struct output *
output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
output_from_wlr_output(struct wlr_output *wlr_output)
{
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
wl_list_for_each(output, &g_server.outputs, link) {
if (output->wlr_output == wlr_output) {
return output;
}
@ -981,10 +969,10 @@ output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
}
struct output *
output_from_name(struct server *server, const char *name)
output_from_name(const char *name)
{
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
wl_list_for_each(output, &g_server.outputs, link) {
if (!output_is_usable(output) || !output->wlr_output->name) {
continue;
}
@ -996,22 +984,21 @@ output_from_name(struct server *server, const char *name)
}
struct output *
output_nearest_to(struct server *server, int lx, int ly)
output_nearest_to(int lx, int ly)
{
double closest_x, closest_y;
wlr_output_layout_closest_point(server->output_layout, NULL, lx, ly,
wlr_output_layout_closest_point(g_server.output_layout, NULL, lx, ly,
&closest_x, &closest_y);
return output_from_wlr_output(server,
wlr_output_layout_output_at(server->output_layout,
return output_from_wlr_output(wlr_output_layout_output_at(g_server.output_layout,
closest_x, closest_y));
}
struct output *
output_nearest_to_cursor(struct server *server)
output_nearest_to_cursor(void)
{
return output_nearest_to(server, server->seat.cursor->x,
server->seat.cursor->y);
return output_nearest_to(g_server.seat.cursor->x,
g_server.seat.cursor->y);
}
struct output *
@ -1035,7 +1022,7 @@ output_get_adjacent(struct output *output, enum lab_edge edge, bool wrap)
/* Determine any adjacent output in the appropriate direction */
struct wlr_output *new_output = NULL;
struct wlr_output *current_output = output->wlr_output;
struct wlr_output_layout *layout = output->server->output_layout;
struct wlr_output_layout *layout = g_server.output_layout;
/* Cast from enum lab_edge to enum wlr_direction is safe */
new_output = wlr_output_layout_adjacent_output(layout,
(enum wlr_direction)edge, current_output, lx, ly);
@ -1058,7 +1045,7 @@ output_get_adjacent(struct output *output, enum lab_edge edge, bool wrap)
return NULL;
}
output = output_from_wlr_output(output->server, new_output);
output = output_from_wlr_output(new_output);
if (!output_is_usable(output)) {
wlr_log(WLR_ERROR, "invalid output in layout");
return NULL;
@ -1089,10 +1076,10 @@ update_usable_area(struct output *output)
#if HAVE_XWAYLAND
struct view *view;
wl_list_for_each(view, &output->server->views, link) {
wl_list_for_each(view, &g_server.views, link) {
if (view->mapped && view->type == LAB_XWAYLAND_VIEW) {
xwayland_adjust_usable_area(view,
output->server->output_layout,
g_server.output_layout,
output->wlr_output, &output->usable_area);
}
}
@ -1106,19 +1093,19 @@ output_update_usable_area(struct output *output)
if (update_usable_area(output)) {
regions_update_geometry(output);
#if HAVE_XWAYLAND
xwayland_update_workarea(output->server);
xwayland_update_workarea();
#endif
desktop_arrange_all_views(output->server);
desktop_arrange_all_views();
}
}
void
output_update_all_usable_areas(struct server *server, bool layout_changed)
output_update_all_usable_areas(bool layout_changed)
{
bool usable_area_changed = false;
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
wl_list_for_each(output, &g_server.outputs, link) {
if (update_usable_area(output)) {
usable_area_changed = true;
regions_update_geometry(output);
@ -1128,9 +1115,9 @@ output_update_all_usable_areas(struct server *server, bool layout_changed)
}
if (usable_area_changed || layout_changed) {
#if HAVE_XWAYLAND
xwayland_update_workarea(server);
xwayland_update_workarea();
#endif
desktop_arrange_all_views(server);
desktop_arrange_all_views();
}
}
@ -1142,7 +1129,7 @@ output_usable_area_in_layout_coords(struct output *output)
}
struct wlr_box box = output->usable_area;
double ox = 0, oy = 0;
wlr_output_layout_output_coords(output->server->output_layout,
wlr_output_layout_output_coords(g_server.output_layout,
output->wlr_output, &ox, &oy);
box.x -= ox;
box.y -= oy;
@ -1152,8 +1139,6 @@ output_usable_area_in_layout_coords(struct output *output)
void
handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
{
struct server *server = wl_container_of(listener, server,
output_power_manager_set_mode);
struct wlr_output_power_v1_set_mode_event *event = data;
struct output *output = event->output->data;
assert(output);
@ -1176,7 +1161,7 @@ handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
* Re-set the cursor image so that the cursor
* isn't invisible on the newly enabled output.
*/
cursor_update_image(&server->seat);
cursor_update_image(&g_server.seat);
break;
}
}