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

@ -41,8 +41,7 @@ box_logical_to_physical(struct wlr_box *box, struct wlr_output *output)
void
magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box *damage)
{
struct server *server = output->server;
struct theme *theme = server->theme;
struct theme *theme = g_server.theme;
bool fullscreen = (rc.mag_width == -1 || rc.mag_height == -1);
struct wlr_box output_box = {
@ -51,9 +50,9 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
};
/* Cursor position in per-output logical coordinate */
double cursor_logical_x = server->seat.cursor->x;
double cursor_logical_y = server->seat.cursor->y;
wlr_output_layout_output_coords(server->output_layout,
double cursor_logical_x = g_server.seat.cursor->x;
double cursor_logical_y = g_server.seat.cursor->y;
wlr_output_layout_output_coords(g_server.output_layout,
output->wlr_output, &cursor_logical_x, &cursor_logical_y);
/* Cursor position in per-output physical coordinate */
struct wlr_box cursor_pos = {
@ -96,7 +95,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
}
if (!tmp_buffer) {
tmp_buffer = wlr_allocator_create_buffer(
server->allocator, mag_box.width, mag_box.height,
g_server.allocator, mag_box.width, mag_box.height,
&output->wlr_output->swapchain->format);
}
if (!tmp_buffer) {
@ -105,7 +104,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
}
if (!tmp_texture) {
tmp_texture = wlr_texture_from_buffer(server->renderer, tmp_buffer);
tmp_texture = wlr_texture_from_buffer(g_server.renderer, tmp_buffer);
}
if (!tmp_texture) {
wlr_log(WLR_ERROR, "Failed to allocate temporary magnifier texture");
@ -116,7 +115,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
/* Extract source region into temporary buffer */
struct wlr_render_pass *tmp_render_pass = wlr_renderer_begin_buffer_pass(
server->renderer, tmp_buffer, NULL);
g_server.renderer, tmp_buffer, NULL);
if (!tmp_render_pass) {
wlr_log(WLR_ERROR, "Failed to begin magnifier render pass");
return;
@ -124,7 +123,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
wlr_buffer_lock(output_buffer);
struct wlr_texture *output_texture = wlr_texture_from_buffer(
server->renderer, output_buffer);
g_server.renderer, output_buffer);
if (!output_texture) {
goto cleanup;
}
@ -151,7 +150,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
/* Render to the output buffer itself */
tmp_render_pass = wlr_renderer_begin_buffer_pass(
server->renderer, output_buffer, NULL);
g_server.renderer, output_buffer, NULL);
if (!tmp_render_pass) {
wlr_log(WLR_ERROR, "Failed to begin second magnifier render pass");
goto cleanup;
@ -224,7 +223,7 @@ output_wants_magnification(struct output *output)
{
static double x = -1;
static double y = -1;
struct wlr_cursor *cursor = output->server->seat.cursor;
struct wlr_cursor *cursor = g_server.seat.cursor;
if (!magnify_on) {
x = -1;
y = -1;
@ -235,24 +234,24 @@ output_wants_magnification(struct output *output)
}
x = cursor->x;
y = cursor->y;
return output_nearest_to_cursor(output->server) == output;
return output_nearest_to_cursor() == output;
}
static void
enable_magnifier(struct server *server, bool enable)
enable_magnifier(bool enable)
{
magnify_on = enable;
server->scene->WLR_PRIVATE.direct_scanout = enable ? false
: server->direct_scanout_enabled;
g_server.scene->WLR_PRIVATE.direct_scanout = enable ? false
: g_server.direct_scanout_enabled;
}
/* Toggles magnification on and off */
void
magnifier_toggle(struct server *server)
magnifier_toggle(void)
{
enable_magnifier(server, !magnify_on);
enable_magnifier(!magnify_on);
struct output *output = output_nearest_to_cursor(server);
struct output *output = output_nearest_to_cursor();
if (output) {
wlr_output_schedule_frame(output->wlr_output);
}
@ -260,22 +259,22 @@ magnifier_toggle(struct server *server)
/* Increases and decreases magnification scale */
void
magnifier_set_scale(struct server *server, enum magnify_dir dir)
magnifier_set_scale(enum magnify_dir dir)
{
struct output *output = output_nearest_to_cursor(server);
struct output *output = output_nearest_to_cursor();
if (dir == MAGNIFY_INCREASE) {
if (magnify_on) {
mag_scale += rc.mag_increment;
} else {
enable_magnifier(server, true);
enable_magnifier(true);
mag_scale = 1.0 + rc.mag_increment;
}
} else {
if (magnify_on && mag_scale > 1.0 + rc.mag_increment) {
mag_scale -= rc.mag_increment;
} else {
enable_magnifier(server, false);
enable_magnifier(false);
}
}