tree-wide: rename g_server to just server

This commit is contained in:
John Lindgren 2026-03-19 12:05:43 -04:00 committed by Johan Malm
parent 8d46da9db1
commit 4f72e6775e
61 changed files with 955 additions and 955 deletions

View file

@ -36,7 +36,7 @@ desktop_arrange_all_views(void)
* views.
*/
struct view *view;
wl_list_for_each(view, &g_server.views, link) {
wl_list_for_each(view, &server.views, link) {
if (!wlr_box_empty(&view->pending)) {
view_adjust_for_layout_change(view);
}
@ -46,7 +46,7 @@ desktop_arrange_all_views(void)
static void
set_or_offer_focus(struct view *view)
{
struct seat *seat = &g_server.seat;
struct seat *seat = &server.seat;
switch (view_wants_focus(view)) {
case VIEW_WANTS_FOCUS_ALWAYS:
if (view->surface != seat->seat->keyboard_state.focused_surface) {
@ -76,7 +76,7 @@ desktop_focus_view(struct view *view, bool raise)
return;
}
if (g_server.input_mode == LAB_INPUT_STATE_CYCLE) {
if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
wlr_log(WLR_DEBUG, "not focusing window while window switching");
return;
}
@ -138,7 +138,7 @@ static struct view *
desktop_topmost_focusable_view(void)
{
struct view *view;
for_each_view(view, &g_server.views,
for_each_view(view, &server.views,
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
if (!view->minimized) {
return view;
@ -158,22 +158,22 @@ desktop_focus_topmost_view(void)
* Defocus previous focused surface/view if no longer
* focusable (e.g. unmapped or on a different workspace).
*/
seat_focus_surface(&g_server.seat, NULL);
seat_focus_surface(&server.seat, NULL);
}
}
void
desktop_focus_output(struct output *output)
{
if (!output_is_usable(output) || g_server.input_mode
if (!output_is_usable(output) || server.input_mode
!= LAB_INPUT_STATE_PASSTHROUGH) {
return;
}
struct view *view;
for_each_view(view, &g_server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
for_each_view(view, &server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
if (view->outputs & output->id_bit) {
desktop_focus_view(view, /*raise*/ false);
wlr_cursor_warp(g_server.seat.cursor, NULL,
wlr_cursor_warp(server.seat.cursor, NULL,
view->current.x + view->current.width / 2,
view->current.y + view->current.height / 2);
cursor_update_focus();
@ -182,9 +182,9 @@ desktop_focus_output(struct output *output)
}
/* No view found on desired output */
struct wlr_box layout_box;
wlr_output_layout_get_box(g_server.output_layout,
wlr_output_layout_get_box(server.output_layout,
output->wlr_output, &layout_box);
wlr_cursor_warp(g_server.seat.cursor, NULL,
wlr_cursor_warp(server.seat.cursor, NULL,
layout_box.x + output->usable_area.x + output->usable_area.width / 2,
layout_box.y + output->usable_area.y + output->usable_area.height / 2);
cursor_update_focus();
@ -198,7 +198,7 @@ desktop_update_top_layer_visibility(void)
uint32_t top = ZWLR_LAYER_SHELL_V1_LAYER_TOP;
/* Enable all top layers */
wl_list_for_each(output, &g_server.outputs, link) {
wl_list_for_each(output, &server.outputs, link) {
if (!output_is_usable(output)) {
continue;
}
@ -210,7 +210,7 @@ desktop_update_top_layer_visibility(void)
* any views above it
*/
uint64_t outputs_covered = 0;
for_each_view(view, &g_server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
for_each_view(view, &server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
if (view->minimized) {
continue;
}
@ -263,19 +263,19 @@ struct cursor_context
get_cursor_context(void)
{
struct cursor_context ret = {.type = LAB_NODE_NONE};
struct wlr_cursor *cursor = g_server.seat.cursor;
struct wlr_cursor *cursor = server.seat.cursor;
/* Prevent drag icons to be on top of the hitbox detection */
if (g_server.seat.drag.active) {
dnd_icons_show(&g_server.seat, false);
if (server.seat.drag.active) {
dnd_icons_show(&server.seat, false);
}
struct wlr_scene_node *node =
wlr_scene_node_at(&g_server.scene->tree.node,
wlr_scene_node_at(&server.scene->tree.node,
cursor->x, cursor->y, &ret.sx, &ret.sy);
if (g_server.seat.drag.active) {
dnd_icons_show(&g_server.seat, true);
if (server.seat.drag.active) {
dnd_icons_show(&server.seat, true);
}
if (!node) {
@ -290,7 +290,7 @@ get_cursor_context(void)
#if HAVE_XWAYLAND
/* TODO: attach LAB_NODE_UNMANAGED node-descriptor to unmanaged surfaces */
if (node->type == WLR_SCENE_NODE_BUFFER) {
if (node->parent == g_server.unmanaged_tree) {
if (node->parent == server.unmanaged_tree) {
ret.type = LAB_NODE_UNMANAGED;
return ret;
}