mirror of
https://github.com/labwc/labwc.git
synced 2026-03-26 07:58:08 -04:00
tree-wide: rename g_server to just server
This commit is contained in:
parent
8d46da9db1
commit
4f72e6775e
61 changed files with 955 additions and 955 deletions
|
|
@ -133,7 +133,7 @@ struct cycle_osd_impl {
|
||||||
*/
|
*/
|
||||||
void (*init)(struct cycle_osd_output *osd_output);
|
void (*init)(struct cycle_osd_output *osd_output);
|
||||||
/*
|
/*
|
||||||
* Update the OSD to highlight g_server.cycle.selected_view.
|
* Update the OSD to highlight server.cycle.selected_view.
|
||||||
*/
|
*/
|
||||||
void (*update)(struct cycle_osd_output *osd_output);
|
void (*update)(struct cycle_osd_output *osd_output);
|
||||||
};
|
};
|
||||||
|
|
@ -157,7 +157,7 @@ void cycle_osd_scroll_init(struct cycle_osd_output *osd_output,
|
||||||
int nr_cols, int nr_rows, int nr_visible_rows,
|
int nr_cols, int nr_rows, int nr_visible_rows,
|
||||||
float *border_color, float *bg_color);
|
float *border_color, float *bg_color);
|
||||||
|
|
||||||
/* Scroll the OSD to show g_server.cycle.selected_view if needed */
|
/* Scroll the OSD to show server.cycle.selected_view if needed */
|
||||||
void cycle_osd_scroll_update(struct cycle_osd_output *osd_output);
|
void cycle_osd_scroll_update(struct cycle_osd_output *osd_output);
|
||||||
|
|
||||||
extern struct cycle_osd_impl cycle_osd_classic_impl;
|
extern struct cycle_osd_impl cycle_osd_classic_impl;
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@ struct view;
|
||||||
struct wlr_surface;
|
struct wlr_surface;
|
||||||
|
|
||||||
void kde_server_decoration_init(void);
|
void kde_server_decoration_init(void);
|
||||||
void xdg_server_decoration_init(void);
|
void xdserver_decoration_init(void);
|
||||||
|
|
||||||
void kde_server_decoration_update_default(void);
|
void kde_server_decoration_update_default(void);
|
||||||
void kde_server_decoration_set_view(struct view *view, struct wlr_surface *surface);
|
void kde_server_decoration_set_view(struct view *view, struct wlr_surface *surface);
|
||||||
|
|
||||||
void kde_server_decoration_finish(void);
|
void kde_server_decoration_finish(void);
|
||||||
void xdg_server_decoration_finish(void);
|
void xdserver_decoration_finish(void);
|
||||||
|
|
||||||
#endif /* LABWC_DECORATIONS_H */
|
#endif /* LABWC_DECORATIONS_H */
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ void cursor_context_save(struct cursor_context_saved *saved_ctx,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cursor_get_resize_edges - calculate resize edge based on cursor position
|
* cursor_get_resize_edges - calculate resize edge based on cursor position
|
||||||
* @cursor - the current cursor (usually g_server.seat.cursor)
|
* @cursor - the current cursor (usually server.seat.cursor)
|
||||||
* @cursor_context - result of get_cursor_context()
|
* @cursor_context - result of get_cursor_context()
|
||||||
*
|
*
|
||||||
* Calculates the resize edge combination that is most appropriate based
|
* Calculates the resize edge combination that is most appropriate based
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ struct server {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* defined in main.c */
|
/* defined in main.c */
|
||||||
extern struct server g_server;
|
extern struct server server;
|
||||||
|
|
||||||
void xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup);
|
void xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup);
|
||||||
void xdg_shell_init(void);
|
void xdg_shell_init(void);
|
||||||
|
|
@ -405,8 +405,8 @@ void seat_focus_override_end(struct seat *seat, bool restore_focus);
|
||||||
/**
|
/**
|
||||||
* interactive_anchor_to_cursor() - repositions the geometry to remain
|
* interactive_anchor_to_cursor() - repositions the geometry to remain
|
||||||
* underneath the cursor when its size changes during interactive move.
|
* underneath the cursor when its size changes during interactive move.
|
||||||
* This function also resizes g_server.grab_box and repositions it to remain
|
* This function also resizes server.grab_box and repositions it to remain
|
||||||
* underneath g_server.grab_{x,y}.
|
* underneath server.grab_{x,y}.
|
||||||
*
|
*
|
||||||
* geo->{width,height} are provided by the caller.
|
* geo->{width,height} are provided by the caller.
|
||||||
* geo->{x,y} are computed by this function.
|
* geo->{x,y} are computed by this function.
|
||||||
|
|
|
||||||
|
|
@ -84,10 +84,10 @@ struct menu *menu_get_by_id(const char *id);
|
||||||
/**
|
/**
|
||||||
* menu_open_root - open menu on position (x, y)
|
* menu_open_root - open menu on position (x, y)
|
||||||
*
|
*
|
||||||
* This function will close g_server.menu_current, open the
|
* This function will close server.menu_current, open the
|
||||||
* new menu and assign @menu to g_server.menu_current.
|
* new menu and assign @menu to server.menu_current.
|
||||||
*
|
*
|
||||||
* Additionally, g_server.input_mode will be set to LAB_INPUT_STATE_MENU.
|
* Additionally, server.input_mode will be set to LAB_INPUT_STATE_MENU.
|
||||||
*/
|
*/
|
||||||
void menu_open_root(struct menu *menu, int x, int y);
|
void menu_open_root(struct menu *menu, int x, int y);
|
||||||
|
|
||||||
|
|
@ -102,10 +102,10 @@ void menu_process_cursor_motion(struct wlr_scene_node *node);
|
||||||
/**
|
/**
|
||||||
* menu_close_root- close root menu
|
* menu_close_root- close root menu
|
||||||
*
|
*
|
||||||
* This function will close g_server.menu_current and set it to NULL.
|
* This function will close server.menu_current and set it to NULL.
|
||||||
* Asserts that g_server.input_mode is set to LAB_INPUT_STATE_MENU.
|
* Asserts that server.input_mode is set to LAB_INPUT_STATE_MENU.
|
||||||
*
|
*
|
||||||
* Additionally, g_server.input_mode will be set to LAB_INPUT_STATE_PASSTHROUGH.
|
* Additionally, server.input_mode will be set to LAB_INPUT_STATE_PASSTHROUGH.
|
||||||
*/
|
*/
|
||||||
void menu_close_root(void);
|
void menu_close_root(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ bool view_matches_query(struct view *view, struct view_query *query);
|
||||||
* @criteria: Criteria to match against.
|
* @criteria: Criteria to match against.
|
||||||
* Example:
|
* Example:
|
||||||
* struct view *view;
|
* struct view *view;
|
||||||
* for_each_view(view, &g_server.views, LAB_VIEW_CRITERIA_NONE) {
|
* for_each_view(view, &server.views, LAB_VIEW_CRITERIA_NONE) {
|
||||||
* printf("%s\n", view_get_string_prop(view, "app_id"));
|
* printf("%s\n", view_get_string_prop(view, "app_id"));
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
@ -373,7 +373,7 @@ bool view_matches_query(struct view *view, struct view_query *query);
|
||||||
* @criteria: Criteria to match against.
|
* @criteria: Criteria to match against.
|
||||||
* Example:
|
* Example:
|
||||||
* struct view *view;
|
* struct view *view;
|
||||||
* for_each_view_reverse(view, &g_server.views, LAB_VIEW_CRITERIA_NONE) {
|
* for_each_view_reverse(view, &server.views, LAB_VIEW_CRITERIA_NONE) {
|
||||||
* printf("%s\n", view_get_string_prop(view, "app_id"));
|
* printf("%s\n", view_get_string_prop(view, "app_id"));
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
46
src/action.c
46
src/action.c
|
|
@ -745,8 +745,8 @@ show_menu(struct view *view, struct cursor_context *ctx,
|
||||||
const char *menu_name, bool at_cursor,
|
const char *menu_name, bool at_cursor,
|
||||||
const char *pos_x, const char *pos_y)
|
const char *pos_x, const char *pos_y)
|
||||||
{
|
{
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH
|
||||||
&& g_server.input_mode != LAB_INPUT_STATE_MENU) {
|
&& server.input_mode != LAB_INPUT_STATE_MENU) {
|
||||||
/* Prevent opening a menu while resizing / moving a view */
|
/* Prevent opening a menu while resizing / moving a view */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -756,8 +756,8 @@ show_menu(struct view *view, struct cursor_context *ctx,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = g_server.seat.cursor->x;
|
int x = server.seat.cursor->x;
|
||||||
int y = g_server.seat.cursor->y;
|
int y = server.seat.cursor->y;
|
||||||
|
|
||||||
/* The client menu needs an active client */
|
/* The client menu needs an active client */
|
||||||
bool is_client_menu = !strcasecmp(menu_name, "client-menu");
|
bool is_client_menu = !strcasecmp(menu_name, "client-menu");
|
||||||
|
|
@ -776,7 +776,7 @@ show_menu(struct view *view, struct cursor_context *ctx,
|
||||||
int lx, ly;
|
int lx, ly;
|
||||||
wlr_scene_node_coords(ctx->node, &lx, &ly);
|
wlr_scene_node_coords(ctx->node, &lx, &ly);
|
||||||
/* MAX() prevents negative x when the window is maximized */
|
/* MAX() prevents negative x when the window is maximized */
|
||||||
x = MAX(x, lx - g_server.theme->menu_border_width);
|
x = MAX(x, lx - server.theme->menu_border_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -786,7 +786,7 @@ show_menu(struct view *view, struct cursor_context *ctx,
|
||||||
*/
|
*/
|
||||||
if (pos_x && pos_y) {
|
if (pos_x && pos_y) {
|
||||||
struct output *output = output_nearest_to(
|
struct output *output = output_nearest_to(
|
||||||
g_server.seat.cursor->x, g_server.seat.cursor->y);
|
server.seat.cursor->x, server.seat.cursor->y);
|
||||||
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
||||||
|
|
||||||
if (!strcasecmp(pos_x, "center")) {
|
if (!strcasecmp(pos_x, "center")) {
|
||||||
|
|
@ -846,7 +846,7 @@ view_for_action(struct view *activator, struct action *action, struct cursor_con
|
||||||
return ctx->view;
|
return ctx->view;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return g_server.active_view;
|
return server.active_view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1079,7 +1079,7 @@ warp_cursor(struct view *view, const char *to, const char *x, const char *y)
|
||||||
target_area.y + target_area.height + offset_y;
|
target_area.y + target_area.height + offset_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_cursor_warp(g_server.seat.cursor, NULL, goto_x, goto_y);
|
wlr_cursor_warp(server.seat.cursor, NULL, goto_x, goto_y);
|
||||||
cursor_update_focus();
|
cursor_update_focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1117,7 +1117,7 @@ run_action(struct view *view, struct action *action,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_TYPE_EXIT:
|
case ACTION_TYPE_EXIT:
|
||||||
wl_display_terminate(g_server.wl_display);
|
wl_display_terminate(server.wl_display);
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_MOVE_TO_EDGE:
|
case ACTION_TYPE_MOVE_TO_EDGE:
|
||||||
if (view) {
|
if (view) {
|
||||||
|
|
@ -1172,7 +1172,7 @@ run_action(struct view *view, struct action *action,
|
||||||
.app_id = action_get_int(action, "identifier",
|
.app_id = action_get_int(action, "identifier",
|
||||||
CYCLE_APP_ID_ALL),
|
CYCLE_APP_ID_ALL),
|
||||||
};
|
};
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||||
cycle_step(dir);
|
cycle_step(dir);
|
||||||
} else {
|
} else {
|
||||||
cycle_begin(dir, filter);
|
cycle_begin(dir, filter);
|
||||||
|
|
@ -1250,7 +1250,7 @@ run_action(struct view *view, struct action *action,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_UNFOCUS:
|
case ACTION_TYPE_UNFOCUS:
|
||||||
seat_focus_surface(&g_server.seat, NULL);
|
seat_focus_surface(&server.seat, NULL);
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_ICONIFY:
|
case ACTION_TYPE_ICONIFY:
|
||||||
if (view) {
|
if (view) {
|
||||||
|
|
@ -1274,7 +1274,7 @@ run_action(struct view *view, struct action *action,
|
||||||
* set by button press handling. For keybind-triggered
|
* set by button press handling. For keybind-triggered
|
||||||
* Move, set it now from current cursor position.
|
* Move, set it now from current cursor position.
|
||||||
*/
|
*/
|
||||||
if (view != g_server.seat.pressed.ctx.view) {
|
if (view != server.seat.pressed.ctx.view) {
|
||||||
interactive_set_grab_context(ctx);
|
interactive_set_grab_context(ctx);
|
||||||
}
|
}
|
||||||
interactive_begin(view, LAB_INPUT_STATE_MOVE,
|
interactive_begin(view, LAB_INPUT_STATE_MOVE,
|
||||||
|
|
@ -1295,7 +1295,7 @@ run_action(struct view *view, struct action *action,
|
||||||
* set by button press handling. For keybind-triggered
|
* set by button press handling. For keybind-triggered
|
||||||
* Resize, set it now from current cursor position.
|
* Resize, set it now from current cursor position.
|
||||||
*/
|
*/
|
||||||
if (view != g_server.seat.pressed.ctx.view) {
|
if (view != server.seat.pressed.ctx.view) {
|
||||||
interactive_set_grab_context(ctx);
|
interactive_set_grab_context(ctx);
|
||||||
}
|
}
|
||||||
interactive_begin(view, LAB_INPUT_STATE_RESIZE,
|
interactive_begin(view, LAB_INPUT_STATE_RESIZE,
|
||||||
|
|
@ -1370,12 +1370,12 @@ run_action(struct view *view, struct action *action,
|
||||||
* a required argument for both SendToDesktop and GoToDesktop.
|
* a required argument for both SendToDesktop and GoToDesktop.
|
||||||
*/
|
*/
|
||||||
struct workspace *target_workspace = workspaces_find(
|
struct workspace *target_workspace = workspaces_find(
|
||||||
g_server.workspaces.current, to, wrap);
|
server.workspaces.current, to, wrap);
|
||||||
if (action->type == ACTION_TYPE_GO_TO_DESKTOP) {
|
if (action->type == ACTION_TYPE_GO_TO_DESKTOP) {
|
||||||
bool toggle = action_get_bool(action, "toggle", false);
|
bool toggle = action_get_bool(action, "toggle", false);
|
||||||
if (target_workspace == g_server.workspaces.current
|
if (target_workspace == server.workspaces.current
|
||||||
&& toggle) {
|
&& toggle) {
|
||||||
target_workspace = g_server.workspaces.last;
|
target_workspace = server.workspaces.last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!target_workspace) {
|
if (!target_workspace) {
|
||||||
|
|
@ -1386,7 +1386,7 @@ run_action(struct view *view, struct action *action,
|
||||||
follow = action_get_bool(action, "follow", true);
|
follow = action_get_bool(action, "follow", true);
|
||||||
|
|
||||||
/* Ensure that the focus is not on another desktop */
|
/* Ensure that the focus is not on another desktop */
|
||||||
if (!follow && g_server.active_view == view) {
|
if (!follow && server.active_view == view) {
|
||||||
desktop_focus_topmost_view();
|
desktop_focus_topmost_view();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1570,14 +1570,14 @@ run_action(struct view *view, struct action *action,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_ENABLE_SCROLL_WHEEL_EMULATION:
|
case ACTION_TYPE_ENABLE_SCROLL_WHEEL_EMULATION:
|
||||||
g_server.seat.cursor_scroll_wheel_emulation = true;
|
server.seat.cursor_scroll_wheel_emulation = true;
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_DISABLE_SCROLL_WHEEL_EMULATION:
|
case ACTION_TYPE_DISABLE_SCROLL_WHEEL_EMULATION:
|
||||||
g_server.seat.cursor_scroll_wheel_emulation = false;
|
server.seat.cursor_scroll_wheel_emulation = false;
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_TOGGLE_SCROLL_WHEEL_EMULATION:
|
case ACTION_TYPE_TOGGLE_SCROLL_WHEEL_EMULATION:
|
||||||
g_server.seat.cursor_scroll_wheel_emulation =
|
server.seat.cursor_scroll_wheel_emulation =
|
||||||
!g_server.seat.cursor_scroll_wheel_emulation;
|
!server.seat.cursor_scroll_wheel_emulation;
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_ENABLE_TABLET_MOUSE_EMULATION:
|
case ACTION_TYPE_ENABLE_TABLET_MOUSE_EMULATION:
|
||||||
rc.tablet.force_mouse_emulation = true;
|
rc.tablet.force_mouse_emulation = true;
|
||||||
|
|
@ -1605,7 +1605,7 @@ run_action(struct view *view, struct action *action,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_TYPE_HIDE_CURSOR:
|
case ACTION_TYPE_HIDE_CURSOR:
|
||||||
cursor_set_visible(&g_server.seat, false);
|
cursor_set_visible(&server.seat, false);
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_INVALID:
|
case ACTION_TYPE_INVALID:
|
||||||
wlr_log(WLR_ERROR, "Not executing unknown action");
|
wlr_log(WLR_ERROR, "Not executing unknown action");
|
||||||
|
|
@ -1640,7 +1640,7 @@ actions_run(struct view *activator, struct wl_list *actions, struct cursor_conte
|
||||||
|
|
||||||
struct action *action;
|
struct action *action;
|
||||||
wl_list_for_each(action, actions, link) {
|
wl_list_for_each(action, actions, link) {
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_CYCLE
|
if (server.input_mode == LAB_INPUT_STATE_CYCLE
|
||||||
&& action->type != ACTION_TYPE_NEXT_WINDOW
|
&& action->type != ACTION_TYPE_NEXT_WINDOW
|
||||||
&& action->type != ACTION_TYPE_PREVIOUS_WINDOW) {
|
&& action->type != ACTION_TYPE_PREVIOUS_WINDOW) {
|
||||||
wlr_log(WLR_INFO, "Only NextWindow or PreviousWindow "
|
wlr_log(WLR_INFO, "Only NextWindow or PreviousWindow "
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ update_keycodes_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
|
||||||
void
|
void
|
||||||
keybind_update_keycodes(void)
|
keybind_update_keycodes(void)
|
||||||
{
|
{
|
||||||
struct xkb_state *state = g_server.seat.keyboard_group->keyboard.xkb_state;
|
struct xkb_state *state = server.seat.keyboard_group->keyboard.xkb_state;
|
||||||
struct xkb_keymap *keymap = xkb_state_get_keymap(state);
|
struct xkb_keymap *keymap = xkb_state_get_keymap(state);
|
||||||
|
|
||||||
struct keybind *keybind;
|
struct keybind *keybind;
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ should_update_activation(void)
|
||||||
|
|
||||||
/* With no valid preference, update when a DRM backend is in use */
|
/* With no valid preference, update when a DRM backend is in use */
|
||||||
bool have_drm = false;
|
bool have_drm = false;
|
||||||
wlr_multi_for_each_backend(g_server.backend, backend_check_drm, &have_drm);
|
wlr_multi_for_each_backend(server.backend, backend_check_drm, &have_drm);
|
||||||
return have_drm;
|
return have_drm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ static void
|
||||||
update_preview_outlines(struct view *view)
|
update_preview_outlines(struct view *view)
|
||||||
{
|
{
|
||||||
/* Create / Update preview outline tree */
|
/* Create / Update preview outline tree */
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct lab_scene_rect *rect = g_server.cycle.preview_outline;
|
struct lab_scene_rect *rect = server.cycle.preview_outline;
|
||||||
if (!rect) {
|
if (!rect) {
|
||||||
struct lab_scene_rect_options opts = {
|
struct lab_scene_rect_options opts = {
|
||||||
.border_colors = (float *[3]) {
|
.border_colors = (float *[3]) {
|
||||||
|
|
@ -38,10 +38,10 @@ update_preview_outlines(struct view *view)
|
||||||
.nr_borders = 3,
|
.nr_borders = 3,
|
||||||
.border_width = theme->osd_window_switcher_preview_border_width,
|
.border_width = theme->osd_window_switcher_preview_border_width,
|
||||||
};
|
};
|
||||||
rect = lab_scene_rect_create(&g_server.scene->tree, &opts);
|
rect = lab_scene_rect_create(&server.scene->tree, &opts);
|
||||||
wlr_scene_node_place_above(&rect->tree->node,
|
wlr_scene_node_place_above(&rect->tree->node,
|
||||||
&g_server.cycle_preview_tree->node);
|
&server.cycle_preview_tree->node);
|
||||||
g_server.cycle.preview_outline = rect;
|
server.cycle.preview_outline = rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box geo = ssd_max_extents(view);
|
struct wlr_box geo = ssd_max_extents(view);
|
||||||
|
|
@ -53,19 +53,19 @@ update_preview_outlines(struct view *view)
|
||||||
static struct view *
|
static struct view *
|
||||||
get_next_selected_view(enum lab_cycle_dir dir)
|
get_next_selected_view(enum lab_cycle_dir dir)
|
||||||
{
|
{
|
||||||
struct cycle_state *cycle = &g_server.cycle;
|
struct cycle_state *cycle = &server.cycle;
|
||||||
assert(cycle->selected_view);
|
assert(cycle->selected_view);
|
||||||
assert(!wl_list_empty(&g_server.cycle.views));
|
assert(!wl_list_empty(&server.cycle.views));
|
||||||
|
|
||||||
struct wl_list *link;
|
struct wl_list *link;
|
||||||
if (dir == LAB_CYCLE_DIR_FORWARD) {
|
if (dir == LAB_CYCLE_DIR_FORWARD) {
|
||||||
link = cycle->selected_view->cycle_link.next;
|
link = cycle->selected_view->cycle_link.next;
|
||||||
if (link == &g_server.cycle.views) {
|
if (link == &server.cycle.views) {
|
||||||
link = link->next;
|
link = link->next;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
link = cycle->selected_view->cycle_link.prev;
|
link = cycle->selected_view->cycle_link.prev;
|
||||||
if (link == &g_server.cycle.views) {
|
if (link == &server.cycle.views) {
|
||||||
link = link->prev;
|
link = link->prev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,9 +84,9 @@ get_first_view(struct wl_list *views)
|
||||||
void
|
void
|
||||||
cycle_reinitialize(void)
|
cycle_reinitialize(void)
|
||||||
{
|
{
|
||||||
struct cycle_state *cycle = &g_server.cycle;
|
struct cycle_state *cycle = &server.cycle;
|
||||||
|
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_CYCLE) {
|
if (server.input_mode != LAB_INPUT_STATE_CYCLE) {
|
||||||
/* OSD not active, no need for clean up */
|
/* OSD not active, no need for clean up */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ cycle_reinitialize(void)
|
||||||
} else {
|
} else {
|
||||||
/* should be unreachable */
|
/* should be unreachable */
|
||||||
wlr_log(WLR_ERROR, "could not find view to select");
|
wlr_log(WLR_ERROR, "could not find view to select");
|
||||||
cycle->selected_view = get_first_view(&g_server.cycle.views);
|
cycle->selected_view = get_first_view(&server.cycle.views);
|
||||||
}
|
}
|
||||||
update_cycle();
|
update_cycle();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -121,35 +121,35 @@ cycle_reinitialize(void)
|
||||||
void
|
void
|
||||||
cycle_on_cursor_release(struct wlr_scene_node *node)
|
cycle_on_cursor_release(struct wlr_scene_node *node)
|
||||||
{
|
{
|
||||||
assert(g_server.input_mode == LAB_INPUT_STATE_CYCLE);
|
assert(server.input_mode == LAB_INPUT_STATE_CYCLE);
|
||||||
|
|
||||||
struct cycle_osd_item *item = node_cycle_osd_item_from_node(node);
|
struct cycle_osd_item *item = node_cycle_osd_item_from_node(node);
|
||||||
g_server.cycle.selected_view = item->view;
|
server.cycle.selected_view = item->view;
|
||||||
cycle_finish(/*switch_focus*/ true);
|
cycle_finish(/*switch_focus*/ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
restore_preview_node(void)
|
restore_preview_node(void)
|
||||||
{
|
{
|
||||||
if (g_server.cycle.preview_node) {
|
if (server.cycle.preview_node) {
|
||||||
wlr_scene_node_reparent(g_server.cycle.preview_node,
|
wlr_scene_node_reparent(server.cycle.preview_node,
|
||||||
g_server.cycle.preview_dummy->parent);
|
server.cycle.preview_dummy->parent);
|
||||||
wlr_scene_node_place_above(g_server.cycle.preview_node,
|
wlr_scene_node_place_above(server.cycle.preview_node,
|
||||||
g_server.cycle.preview_dummy);
|
server.cycle.preview_dummy);
|
||||||
wlr_scene_node_destroy(g_server.cycle.preview_dummy);
|
wlr_scene_node_destroy(server.cycle.preview_dummy);
|
||||||
|
|
||||||
/* Node was disabled / minimized before, disable again */
|
/* Node was disabled / minimized before, disable again */
|
||||||
if (!g_server.cycle.preview_was_enabled) {
|
if (!server.cycle.preview_was_enabled) {
|
||||||
wlr_scene_node_set_enabled(g_server.cycle.preview_node, false);
|
wlr_scene_node_set_enabled(server.cycle.preview_node, false);
|
||||||
}
|
}
|
||||||
if (g_server.cycle.preview_was_shaded) {
|
if (server.cycle.preview_was_shaded) {
|
||||||
struct view *view = node_view_from_node(g_server.cycle.preview_node);
|
struct view *view = node_view_from_node(server.cycle.preview_node);
|
||||||
view_set_shade(view, true);
|
view_set_shade(view, true);
|
||||||
}
|
}
|
||||||
g_server.cycle.preview_node = NULL;
|
server.cycle.preview_node = NULL;
|
||||||
g_server.cycle.preview_dummy = NULL;
|
server.cycle.preview_dummy = NULL;
|
||||||
g_server.cycle.preview_was_enabled = false;
|
server.cycle.preview_was_enabled = false;
|
||||||
g_server.cycle.preview_was_shaded = false;
|
server.cycle.preview_was_shaded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ void
|
||||||
cycle_begin(enum lab_cycle_dir direction,
|
cycle_begin(enum lab_cycle_dir direction,
|
||||||
struct cycle_filter filter)
|
struct cycle_filter filter)
|
||||||
{
|
{
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,18 +165,18 @@ cycle_begin(enum lab_cycle_dir direction,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *active_view = g_server.active_view;
|
struct view *active_view = server.active_view;
|
||||||
if (active_view && active_view->cycle_link.next) {
|
if (active_view && active_view->cycle_link.next) {
|
||||||
/* Select the active view it's in the cycle list */
|
/* Select the active view it's in the cycle list */
|
||||||
g_server.cycle.selected_view = active_view;
|
server.cycle.selected_view = active_view;
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise, select the first view in the cycle list */
|
/* Otherwise, select the first view in the cycle list */
|
||||||
g_server.cycle.selected_view = get_first_view(&g_server.cycle.views);
|
server.cycle.selected_view = get_first_view(&server.cycle.views);
|
||||||
}
|
}
|
||||||
/* Pre-select the next view in the given direction */
|
/* Pre-select the next view in the given direction */
|
||||||
g_server.cycle.selected_view = get_next_selected_view(direction);
|
server.cycle.selected_view = get_next_selected_view(direction);
|
||||||
|
|
||||||
seat_focus_override_begin(&g_server.seat,
|
seat_focus_override_begin(&server.seat,
|
||||||
LAB_INPUT_STATE_CYCLE, LAB_CURSOR_DEFAULT);
|
LAB_INPUT_STATE_CYCLE, LAB_CURSOR_DEFAULT);
|
||||||
update_cycle();
|
update_cycle();
|
||||||
|
|
||||||
|
|
@ -187,23 +187,23 @@ cycle_begin(enum lab_cycle_dir direction,
|
||||||
void
|
void
|
||||||
cycle_step(enum lab_cycle_dir direction)
|
cycle_step(enum lab_cycle_dir direction)
|
||||||
{
|
{
|
||||||
assert(g_server.input_mode == LAB_INPUT_STATE_CYCLE);
|
assert(server.input_mode == LAB_INPUT_STATE_CYCLE);
|
||||||
|
|
||||||
g_server.cycle.selected_view = get_next_selected_view(direction);
|
server.cycle.selected_view = get_next_selected_view(direction);
|
||||||
update_cycle();
|
update_cycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cycle_finish(bool switch_focus)
|
cycle_finish(bool switch_focus)
|
||||||
{
|
{
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_CYCLE) {
|
if (server.input_mode != LAB_INPUT_STATE_CYCLE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *selected_view = g_server.cycle.selected_view;
|
struct view *selected_view = server.cycle.selected_view;
|
||||||
destroy_cycle();
|
destroy_cycle();
|
||||||
|
|
||||||
seat_focus_override_end(&g_server.seat, /*restore_focus*/ false);
|
seat_focus_override_end(&server.seat, /*restore_focus*/ false);
|
||||||
|
|
||||||
/* Hiding OSD may need a cursor change */
|
/* Hiding OSD may need a cursor change */
|
||||||
cursor_update_focus();
|
cursor_update_focus();
|
||||||
|
|
@ -221,7 +221,7 @@ preview_selected_view(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
assert(view->scene_tree);
|
assert(view->scene_tree);
|
||||||
struct cycle_state *cycle = &g_server.cycle;
|
struct cycle_state *cycle = &server.cycle;
|
||||||
|
|
||||||
/* Move previous selected node back to its original place */
|
/* Move previous selected node back to its original place */
|
||||||
restore_preview_node();
|
restore_preview_node();
|
||||||
|
|
@ -244,7 +244,7 @@ preview_selected_view(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_scene_node_reparent(cycle->preview_node,
|
wlr_scene_node_reparent(cycle->preview_node,
|
||||||
g_server.cycle_preview_tree);
|
server.cycle_preview_tree);
|
||||||
|
|
||||||
/* Finally raise selected node to the top */
|
/* Finally raise selected node to the top */
|
||||||
wlr_scene_node_raise_to_top(cycle->preview_node);
|
wlr_scene_node_raise_to_top(cycle->preview_node);
|
||||||
|
|
@ -274,7 +274,7 @@ get_outputs_by_filter(enum cycle_output_filter output_filter)
|
||||||
output = output_nearest_to_cursor();
|
output = output_nearest_to_cursor();
|
||||||
break;
|
break;
|
||||||
case CYCLE_OUTPUT_FOCUSED: {
|
case CYCLE_OUTPUT_FOCUSED: {
|
||||||
struct view *view = g_server.active_view;
|
struct view *view = server.active_view;
|
||||||
if (view && output_is_usable(view->output)) {
|
if (view && output_is_usable(view->output)) {
|
||||||
output = view->output;
|
output = view->output;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -337,12 +337,12 @@ init_cycle(struct cycle_filter filter)
|
||||||
get_outputs_by_filter(filter.output);
|
get_outputs_by_filter(filter.output);
|
||||||
|
|
||||||
const char *cycle_app_id = NULL;
|
const char *cycle_app_id = NULL;
|
||||||
if (filter.app_id == CYCLE_APP_ID_CURRENT && g_server.active_view) {
|
if (filter.app_id == CYCLE_APP_ID_CURRENT && server.active_view) {
|
||||||
cycle_app_id = g_server.active_view->app_id;
|
cycle_app_id = server.active_view->app_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *view;
|
struct view *view;
|
||||||
for_each_view(view, &g_server.views, criteria) {
|
for_each_view(view, &server.views, criteria) {
|
||||||
if (filter.output != CYCLE_OUTPUT_ALL) {
|
if (filter.output != CYCLE_OUTPUT_ALL) {
|
||||||
if (!view->output || !(cycle_outputs & view->output->id_bit)) {
|
if (!view->output || !(cycle_outputs & view->output->id_bit)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -353,22 +353,22 @@ init_cycle(struct cycle_filter filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc.window_switcher.order == WINDOW_SWITCHER_ORDER_AGE) {
|
if (rc.window_switcher.order == WINDOW_SWITCHER_ORDER_AGE) {
|
||||||
insert_view_ordered_by_age(&g_server.cycle.views, view);
|
insert_view_ordered_by_age(&server.cycle.views, view);
|
||||||
} else {
|
} else {
|
||||||
wl_list_append(&g_server.cycle.views, &view->cycle_link);
|
wl_list_append(&server.cycle.views, &view->cycle_link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wl_list_empty(&g_server.cycle.views)) {
|
if (wl_list_empty(&server.cycle.views)) {
|
||||||
wlr_log(WLR_DEBUG, "no views to switch between");
|
wlr_log(WLR_DEBUG, "no views to switch between");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
g_server.cycle.filter = filter;
|
server.cycle.filter = filter;
|
||||||
|
|
||||||
if (rc.window_switcher.osd.show) {
|
if (rc.window_switcher.osd.show) {
|
||||||
/* Create OSD */
|
/* Create OSD */
|
||||||
uint64_t osd_outputs = get_outputs_by_filter(rc.window_switcher.osd.output_filter);
|
uint64_t osd_outputs = get_outputs_by_filter(rc.window_switcher.osd.output_filter);
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!(osd_outputs & output->id_bit)) {
|
if (!(osd_outputs & output->id_bit)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -377,7 +377,7 @@ init_cycle(struct cycle_filter filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cycle_osd_output *osd_output = znew(*osd_output);
|
struct cycle_osd_output *osd_output = znew(*osd_output);
|
||||||
wl_list_append(&g_server.cycle.osd_outputs, &osd_output->link);
|
wl_list_append(&server.cycle.osd_outputs, &osd_output->link);
|
||||||
osd_output->output = output;
|
osd_output->output = output;
|
||||||
wl_list_init(&osd_output->items);
|
wl_list_init(&osd_output->items);
|
||||||
|
|
||||||
|
|
@ -395,7 +395,7 @@ init_cycle(struct cycle_filter filter)
|
||||||
static void
|
static void
|
||||||
update_cycle(void)
|
update_cycle(void)
|
||||||
{
|
{
|
||||||
struct cycle_state *cycle = &g_server.cycle;
|
struct cycle_state *cycle = &server.cycle;
|
||||||
|
|
||||||
if (rc.window_switcher.osd.show) {
|
if (rc.window_switcher.osd.show) {
|
||||||
struct cycle_osd_output *osd_output;
|
struct cycle_osd_output *osd_output;
|
||||||
|
|
@ -416,29 +416,29 @@ update_cycle(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resets all the states in g_server.cycle */
|
/* Resets all the states in server.cycle */
|
||||||
static void
|
static void
|
||||||
destroy_cycle(void)
|
destroy_cycle(void)
|
||||||
{
|
{
|
||||||
struct cycle_osd_output *osd_output, *tmp;
|
struct cycle_osd_output *osd_output, *tmp;
|
||||||
wl_list_for_each_safe(osd_output, tmp, &g_server.cycle.osd_outputs, link) {
|
wl_list_for_each_safe(osd_output, tmp, &server.cycle.osd_outputs, link) {
|
||||||
/* calls handle_osd_tree_destroy() */
|
/* calls handle_osd_tree_destroy() */
|
||||||
wlr_scene_node_destroy(&osd_output->tree->node);
|
wlr_scene_node_destroy(&osd_output->tree->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_preview_node();
|
restore_preview_node();
|
||||||
|
|
||||||
if (g_server.cycle.preview_outline) {
|
if (server.cycle.preview_outline) {
|
||||||
wlr_scene_node_destroy(&g_server.cycle.preview_outline->tree->node);
|
wlr_scene_node_destroy(&server.cycle.preview_outline->tree->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *view, *tmp2;
|
struct view *view, *tmp2;
|
||||||
wl_list_for_each_safe(view, tmp2, &g_server.cycle.views, cycle_link) {
|
wl_list_for_each_safe(view, tmp2, &server.cycle.views, cycle_link) {
|
||||||
wl_list_remove(&view->cycle_link);
|
wl_list_remove(&view->cycle_link);
|
||||||
view->cycle_link = (struct wl_list){0};
|
view->cycle_link = (struct wl_list){0};
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.cycle = (struct cycle_state){0};
|
server.cycle = (struct cycle_state){0};
|
||||||
wl_list_init(&g_server.cycle.views);
|
wl_list_init(&server.cycle.views);
|
||||||
wl_list_init(&g_server.cycle.osd_outputs);
|
wl_list_init(&server.cycle.osd_outputs);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ create_fields_scene(struct view *view,
|
||||||
struct wlr_scene_tree *parent, const float *text_color,
|
struct wlr_scene_tree *parent, const float *text_color,
|
||||||
const float *bg_color, int field_widths_sum, int x, int y)
|
const float *bg_color, int field_widths_sum, int x, int y)
|
||||||
{
|
{
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct window_switcher_classic_theme *switcher_theme =
|
struct window_switcher_classic_theme *switcher_theme =
|
||||||
&theme->osd_window_switcher_classic;
|
&theme->osd_window_switcher_classic;
|
||||||
|
|
||||||
|
|
@ -80,16 +80,16 @@ static void
|
||||||
cycle_osd_classic_init(struct cycle_osd_output *osd_output)
|
cycle_osd_classic_init(struct cycle_osd_output *osd_output)
|
||||||
{
|
{
|
||||||
struct output *output = osd_output->output;
|
struct output *output = osd_output->output;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct window_switcher_classic_theme *switcher_theme =
|
struct window_switcher_classic_theme *switcher_theme =
|
||||||
&theme->osd_window_switcher_classic;
|
&theme->osd_window_switcher_classic;
|
||||||
int padding = theme->osd_border_width + switcher_theme->padding;
|
int padding = theme->osd_border_width + switcher_theme->padding;
|
||||||
bool show_workspace = wl_list_length(&rc.workspace_config.workspaces) > 1;
|
bool show_workspace = wl_list_length(&rc.workspace_config.workspaces) > 1;
|
||||||
const char *workspace_name = g_server.workspaces.current->name;
|
const char *workspace_name = server.workspaces.current->name;
|
||||||
int nr_views = wl_list_length(&g_server.cycle.views);
|
int nr_views = wl_list_length(&server.cycle.views);
|
||||||
|
|
||||||
struct wlr_box output_box;
|
struct wlr_box output_box;
|
||||||
wlr_output_layout_get_box(g_server.output_layout, output->wlr_output,
|
wlr_output_layout_get_box(server.output_layout, output->wlr_output,
|
||||||
&output_box);
|
&output_box);
|
||||||
|
|
||||||
int w = switcher_theme->width;
|
int w = switcher_theme->width;
|
||||||
|
|
@ -164,7 +164,7 @@ cycle_osd_classic_init(struct cycle_osd_output *osd_output)
|
||||||
|
|
||||||
/* Draw text for each node */
|
/* Draw text for each node */
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.cycle.views, cycle_link) {
|
wl_list_for_each(view, &server.cycle.views, cycle_link) {
|
||||||
struct cycle_osd_classic_item *item = znew(*item);
|
struct cycle_osd_classic_item *item = znew(*item);
|
||||||
wl_list_append(&osd_output->items, &item->base.link);
|
wl_list_append(&osd_output->items, &item->base.link);
|
||||||
item->base.view = view;
|
item->base.view = view;
|
||||||
|
|
@ -245,7 +245,7 @@ cycle_osd_classic_update(struct cycle_osd_output *osd_output)
|
||||||
|
|
||||||
struct cycle_osd_classic_item *item;
|
struct cycle_osd_classic_item *item;
|
||||||
wl_list_for_each(item, &osd_output->items, base.link) {
|
wl_list_for_each(item, &osd_output->items, base.link) {
|
||||||
bool active = item->base.view == g_server.cycle.selected_view;
|
bool active = item->base.view == server.cycle.selected_view;
|
||||||
wlr_scene_node_set_enabled(&item->normal_tree->node, !active);
|
wlr_scene_node_set_enabled(&item->normal_tree->node, !active);
|
||||||
wlr_scene_node_set_enabled(&item->active_tree->node, active);
|
wlr_scene_node_set_enabled(&item->active_tree->node, active);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ static void
|
||||||
field_set_output_short(struct buf *buf, struct view *view, const char *format)
|
field_set_output_short(struct buf *buf, struct view *view, const char *format)
|
||||||
{
|
{
|
||||||
/* custom type conversion-specifier: o */
|
/* custom type conversion-specifier: o */
|
||||||
if (wl_list_length(&g_server.outputs) > 1 &&
|
if (wl_list_length(&server.outputs) > 1 &&
|
||||||
output_is_usable(view->output)) {
|
output_is_usable(view->output)) {
|
||||||
buf_add(buf, view->output->wlr_output->name);
|
buf_add(buf, view->output->wlr_output->name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ get_cycle_idx(struct cycle_osd_output *osd_output)
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
struct cycle_osd_item *item;
|
struct cycle_osd_item *item;
|
||||||
wl_list_for_each(item, &osd_output->items, link) {
|
wl_list_for_each(item, &osd_output->items, link) {
|
||||||
if (item->view == g_server.cycle.selected_view) {
|
if (item->view == server.cycle.selected_view) {
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ render_node(struct wlr_render_pass *pass,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
struct wlr_texture *texture = wlr_texture_from_buffer(
|
struct wlr_texture *texture = wlr_texture_from_buffer(
|
||||||
g_server.renderer, scene_buffer->buffer);
|
server.renderer, scene_buffer->buffer);
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -82,11 +82,11 @@ render_thumb(struct output *output, struct view *view)
|
||||||
*/
|
*/
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct wlr_buffer *buffer = wlr_allocator_create_buffer(g_server.allocator,
|
struct wlr_buffer *buffer = wlr_allocator_create_buffer(server.allocator,
|
||||||
view->current.width, view->current.height,
|
view->current.width, view->current.height,
|
||||||
&output->wlr_output->swapchain->format);
|
&output->wlr_output->swapchain->format);
|
||||||
struct wlr_render_pass *pass = wlr_renderer_begin_buffer_pass(
|
struct wlr_render_pass *pass = wlr_renderer_begin_buffer_pass(
|
||||||
g_server.renderer, buffer, NULL);
|
server.renderer, buffer, NULL);
|
||||||
render_node(pass, &view->content_tree->node, 0, 0);
|
render_node(pass, &view->content_tree->node, 0, 0);
|
||||||
if (!wlr_render_pass_submit(pass)) {
|
if (!wlr_render_pass_submit(pass)) {
|
||||||
wlr_log(WLR_ERROR, "failed to submit render pass");
|
wlr_log(WLR_ERROR, "failed to submit render pass");
|
||||||
|
|
@ -119,7 +119,7 @@ static struct cycle_osd_thumbnail_item *
|
||||||
create_item_scene(struct wlr_scene_tree *parent, struct view *view,
|
create_item_scene(struct wlr_scene_tree *parent, struct view *view,
|
||||||
struct cycle_osd_output *osd_output)
|
struct cycle_osd_output *osd_output)
|
||||||
{
|
{
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct window_switcher_thumbnail_theme *switcher_theme =
|
struct window_switcher_thumbnail_theme *switcher_theme =
|
||||||
&theme->osd_window_switcher_thumbnail;
|
&theme->osd_window_switcher_thumbnail;
|
||||||
int padding = theme->border_width + switcher_theme->item_padding;
|
int padding = theme->border_width + switcher_theme->item_padding;
|
||||||
|
|
@ -196,7 +196,7 @@ static void
|
||||||
get_items_geometry(struct output *output, int nr_thumbs,
|
get_items_geometry(struct output *output, int nr_thumbs,
|
||||||
int *nr_cols, int *nr_rows, int *nr_visible_rows)
|
int *nr_cols, int *nr_rows, int *nr_visible_rows)
|
||||||
{
|
{
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct window_switcher_thumbnail_theme *switcher_theme =
|
struct window_switcher_thumbnail_theme *switcher_theme =
|
||||||
&theme->osd_window_switcher_thumbnail;
|
&theme->osd_window_switcher_thumbnail;
|
||||||
int output_width, output_height;
|
int output_width, output_height;
|
||||||
|
|
@ -232,7 +232,7 @@ static void
|
||||||
cycle_osd_thumbnail_init(struct cycle_osd_output *osd_output)
|
cycle_osd_thumbnail_init(struct cycle_osd_output *osd_output)
|
||||||
{
|
{
|
||||||
struct output *output = osd_output->output;
|
struct output *output = osd_output->output;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct window_switcher_thumbnail_theme *switcher_theme =
|
struct window_switcher_thumbnail_theme *switcher_theme =
|
||||||
&theme->osd_window_switcher_thumbnail;
|
&theme->osd_window_switcher_thumbnail;
|
||||||
int padding = theme->osd_border_width + switcher_theme->padding;
|
int padding = theme->osd_border_width + switcher_theme->padding;
|
||||||
|
|
@ -240,7 +240,7 @@ cycle_osd_thumbnail_init(struct cycle_osd_output *osd_output)
|
||||||
osd_output->tree = lab_wlr_scene_tree_create(output->cycle_osd_tree);
|
osd_output->tree = lab_wlr_scene_tree_create(output->cycle_osd_tree);
|
||||||
osd_output->items_tree = lab_wlr_scene_tree_create(osd_output->tree);
|
osd_output->items_tree = lab_wlr_scene_tree_create(osd_output->tree);
|
||||||
|
|
||||||
int nr_views = wl_list_length(&g_server.cycle.views);
|
int nr_views = wl_list_length(&server.cycle.views);
|
||||||
assert(nr_views > 0);
|
assert(nr_views > 0);
|
||||||
int nr_cols, nr_rows, nr_visible_rows;
|
int nr_cols, nr_rows, nr_visible_rows;
|
||||||
get_items_geometry(output, nr_views, &nr_cols, &nr_rows, &nr_visible_rows);
|
get_items_geometry(output, nr_views, &nr_cols, &nr_rows, &nr_visible_rows);
|
||||||
|
|
@ -248,7 +248,7 @@ cycle_osd_thumbnail_init(struct cycle_osd_output *osd_output)
|
||||||
/* items */
|
/* items */
|
||||||
struct view *view;
|
struct view *view;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
wl_list_for_each(view, &g_server.cycle.views, cycle_link) {
|
wl_list_for_each(view, &server.cycle.views, cycle_link) {
|
||||||
struct cycle_osd_thumbnail_item *item = create_item_scene(
|
struct cycle_osd_thumbnail_item *item = create_item_scene(
|
||||||
osd_output->items_tree, view, osd_output);
|
osd_output->items_tree, view, osd_output);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
|
@ -289,7 +289,7 @@ cycle_osd_thumbnail_init(struct cycle_osd_output *osd_output)
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
struct wlr_box output_box;
|
struct wlr_box output_box;
|
||||||
wlr_output_layout_get_box(g_server.output_layout, output->wlr_output,
|
wlr_output_layout_get_box(server.output_layout, output->wlr_output,
|
||||||
&output_box);
|
&output_box);
|
||||||
int lx = output_box.x + (output_box.width - bg_opts.width) / 2;
|
int lx = output_box.x + (output_box.width - bg_opts.width) / 2;
|
||||||
int ly = output_box.y + (output_box.height - bg_opts.height) / 2;
|
int ly = output_box.y + (output_box.height - bg_opts.height) / 2;
|
||||||
|
|
@ -303,7 +303,7 @@ cycle_osd_thumbnail_update(struct cycle_osd_output *osd_output)
|
||||||
|
|
||||||
struct cycle_osd_thumbnail_item *item;
|
struct cycle_osd_thumbnail_item *item;
|
||||||
wl_list_for_each(item, &osd_output->items, base.link) {
|
wl_list_for_each(item, &osd_output->items, base.link) {
|
||||||
bool active = (item->base.view == g_server.cycle.selected_view);
|
bool active = (item->base.view == server.cycle.selected_view);
|
||||||
wlr_scene_node_set_enabled(&item->active_bg->tree->node, active);
|
wlr_scene_node_set_enabled(&item->active_bg->tree->node, active);
|
||||||
wlr_scene_node_set_enabled(
|
wlr_scene_node_set_enabled(
|
||||||
&item->active_label->scene_buffer->node, active);
|
&item->active_label->scene_buffer->node, active);
|
||||||
|
|
|
||||||
58
src/debug.c
58
src/debug.c
|
|
@ -92,7 +92,7 @@ static struct workspace *
|
||||||
get_workspace_from_node(struct wlr_scene_node *node)
|
get_workspace_from_node(struct wlr_scene_node *node)
|
||||||
{
|
{
|
||||||
struct workspace *workspace;
|
struct workspace *workspace;
|
||||||
wl_list_for_each(workspace, &g_server.workspaces.all, link) {
|
wl_list_for_each(workspace, &server.workspaces.all, link) {
|
||||||
if (&workspace->tree->node == node) {
|
if (&workspace->tree->node == node) {
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
@ -107,23 +107,23 @@ get_special(struct wlr_scene_node *node)
|
||||||
node->parent ? node->parent->node.parent : NULL;
|
node->parent ? node->parent->node.parent : NULL;
|
||||||
struct wlr_scene_tree *grand_grand_parent =
|
struct wlr_scene_tree *grand_grand_parent =
|
||||||
grand_parent ? grand_parent->node.parent : NULL;
|
grand_parent ? grand_parent->node.parent : NULL;
|
||||||
if (node == &g_server.scene->tree.node) {
|
if (node == &server.scene->tree.node) {
|
||||||
return "g_server.scene";
|
return "server.scene";
|
||||||
}
|
}
|
||||||
if (node == &g_server.menu_tree->node) {
|
if (node == &server.menu_tree->node) {
|
||||||
return "g_server.menu_tree";
|
return "server.menu_tree";
|
||||||
}
|
}
|
||||||
if (node == &g_server.workspace_tree->node) {
|
if (node == &server.workspace_tree->node) {
|
||||||
return "g_server.workspace_tree";
|
return "server.workspace_tree";
|
||||||
}
|
}
|
||||||
if (node->parent == g_server.workspace_tree) {
|
if (node->parent == server.workspace_tree) {
|
||||||
struct workspace *workspace = get_workspace_from_node(node);
|
struct workspace *workspace = get_workspace_from_node(node);
|
||||||
if (workspace) {
|
if (workspace) {
|
||||||
return workspace->name;
|
return workspace->name;
|
||||||
}
|
}
|
||||||
return "unknown workspace";
|
return "unknown workspace";
|
||||||
}
|
}
|
||||||
if (grand_parent == g_server.workspace_tree) {
|
if (grand_parent == server.workspace_tree) {
|
||||||
struct workspace *workspace =
|
struct workspace *workspace =
|
||||||
get_workspace_from_node(&node->parent->node);
|
get_workspace_from_node(&node->parent->node);
|
||||||
if (workspace) {
|
if (workspace) {
|
||||||
|
|
@ -138,9 +138,9 @@ get_special(struct wlr_scene_node *node)
|
||||||
}
|
}
|
||||||
return "unknown tree";
|
return "unknown tree";
|
||||||
}
|
}
|
||||||
if (node->parent == &g_server.scene->tree) {
|
if (node->parent == &server.scene->tree) {
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (node == &output->cycle_osd_tree->node) {
|
if (node == &output->cycle_osd_tree->node) {
|
||||||
return "output->osd_tree";
|
return "output->osd_tree";
|
||||||
}
|
}
|
||||||
|
|
@ -157,33 +157,33 @@ get_special(struct wlr_scene_node *node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node == &g_server.xdg_popup_tree->node) {
|
if (node == &server.xdg_popup_tree->node) {
|
||||||
return "g_server.xdg_popup_tree";
|
return "server.xdg_popup_tree";
|
||||||
}
|
}
|
||||||
if (node == &g_server.seat.drag.icons->node) {
|
if (node == &server.seat.drag.icons->node) {
|
||||||
return "seat->drag.icons";
|
return "seat->drag.icons";
|
||||||
}
|
}
|
||||||
if (g_server.seat.overlay.rect
|
if (server.seat.overlay.rect
|
||||||
&& node == &g_server.seat.overlay.rect->tree->node) {
|
&& node == &server.seat.overlay.rect->tree->node) {
|
||||||
/* Created on-demand */
|
/* Created on-demand */
|
||||||
return "seat->overlay.rect";
|
return "seat->overlay.rect";
|
||||||
}
|
}
|
||||||
if (g_server.seat.input_method_relay->popup_tree
|
if (server.seat.input_method_relay->popup_tree
|
||||||
&& node == &g_server.seat.input_method_relay->popup_tree->node) {
|
&& node == &server.seat.input_method_relay->popup_tree->node) {
|
||||||
/* Created on-demand */
|
/* Created on-demand */
|
||||||
return "seat->im_relay->popup_tree";
|
return "seat->im_relay->popup_tree";
|
||||||
}
|
}
|
||||||
if (g_server.cycle.preview_outline
|
if (server.cycle.preview_outline
|
||||||
&& node == &g_server.cycle.preview_outline->tree->node) {
|
&& node == &server.cycle.preview_outline->tree->node) {
|
||||||
/* Created on-demand */
|
/* Created on-demand */
|
||||||
return "cycle_state->preview_outline";
|
return "cycle_state->preview_outline";
|
||||||
}
|
}
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
if (node == &g_server.unmanaged_tree->node) {
|
if (node == &server.unmanaged_tree->node) {
|
||||||
return "g_server.unmanaged_tree";
|
return "server.unmanaged_tree";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (grand_grand_parent == g_server.workspace_tree && node->data) {
|
if (grand_grand_parent == server.workspace_tree && node->data) {
|
||||||
last_view = node_view_from_node(node);
|
last_view = node_view_from_node(node);
|
||||||
}
|
}
|
||||||
const char *view_part = get_view_part(last_view, node);
|
const char *view_part = get_view_part(last_view, node);
|
||||||
|
|
@ -234,13 +234,13 @@ dump_tree(struct wlr_scene_node *node,
|
||||||
}
|
}
|
||||||
printf("%.*s %*c %4d %4d [%p]\n", max_width - 1, type, padding, ' ', x, y, node);
|
printf("%.*s %*c %4d %4d [%p]\n", max_width - 1, type, padding, ' ', x, y, node);
|
||||||
|
|
||||||
if ((IGNORE_MENU && node == &g_server.menu_tree->node)
|
if ((IGNORE_MENU && node == &server.menu_tree->node)
|
||||||
|| (IGNORE_SSD && last_view
|
|| (IGNORE_SSD && last_view
|
||||||
&& ssd_debug_is_root_node(last_view->ssd, node))
|
&& ssd_debug_is_root_node(last_view->ssd, node))
|
||||||
|| (IGNORE_CYCLE_PREVIEW_OUTLINE && g_server.cycle.preview_outline
|
|| (IGNORE_CYCLE_PREVIEW_OUTLINE && server.cycle.preview_outline
|
||||||
&& node == &g_server.cycle.preview_outline->tree->node)
|
&& node == &server.cycle.preview_outline->tree->node)
|
||||||
|| (IGNORE_SNAPPING_OVERLAY && g_server.seat.overlay.rect
|
|| (IGNORE_SNAPPING_OVERLAY && server.seat.overlay.rect
|
||||||
&& node == &g_server.seat.overlay.rect->tree->node)) {
|
&& node == &server.seat.overlay.rect->tree->node)) {
|
||||||
printf("%*c%s\n", pos + 4 + INDENT_SIZE, ' ', "<skipping children>");
|
printf("%*c%s\n", pos + 4 + INDENT_SIZE, ' ', "<skipping children>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -259,7 +259,7 @@ void
|
||||||
debug_dump_scene(void)
|
debug_dump_scene(void)
|
||||||
{
|
{
|
||||||
printf("\n");
|
printf("\n");
|
||||||
dump_tree(&g_server.scene->tree.node, 0, 0, 0);
|
dump_tree(&server.scene->tree.node, 0, 0, 0);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ void
|
||||||
kde_server_decoration_init(void)
|
kde_server_decoration_init(void)
|
||||||
{
|
{
|
||||||
assert(!kde_deco_mgr);
|
assert(!kde_deco_mgr);
|
||||||
kde_deco_mgr = wlr_server_decoration_manager_create(g_server.wl_display);
|
kde_deco_mgr = wlr_server_decoration_manager_create(server.wl_display);
|
||||||
if (!kde_deco_mgr) {
|
if (!kde_deco_mgr) {
|
||||||
wlr_log(WLR_ERROR, "unable to create the kde server deco manager");
|
wlr_log(WLR_ERROR, "unable to create the kde server deco manager");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
@ -131,12 +131,12 @@ kde_server_decoration_init(void)
|
||||||
wl_list_init(&decorations);
|
wl_list_init(&decorations);
|
||||||
kde_server_decoration_update_default();
|
kde_server_decoration_update_default();
|
||||||
|
|
||||||
wl_signal_add(&kde_deco_mgr->events.new_decoration, &g_server.kde_server_decoration);
|
wl_signal_add(&kde_deco_mgr->events.new_decoration, &server.kde_server_decoration);
|
||||||
g_server.kde_server_decoration.notify = handle_new_server_decoration;
|
server.kde_server_decoration.notify = handle_new_server_decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kde_server_decoration_finish(void)
|
kde_server_decoration_finish(void)
|
||||||
{
|
{
|
||||||
wl_list_remove(&g_server.kde_server_decoration.link);
|
wl_list_remove(&server.kde_server_decoration.link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,22 +115,22 @@ xdg_toplevel_decoration(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xdg_server_decoration_init(void)
|
xdserver_decoration_init(void)
|
||||||
{
|
{
|
||||||
struct wlr_xdg_decoration_manager_v1 *xdg_deco_mgr = NULL;
|
struct wlr_xdg_decoration_manager_v1 *xdg_deco_mgr = NULL;
|
||||||
xdg_deco_mgr = wlr_xdg_decoration_manager_v1_create(g_server.wl_display);
|
xdg_deco_mgr = wlr_xdg_decoration_manager_v1_create(server.wl_display);
|
||||||
if (!xdg_deco_mgr) {
|
if (!xdg_deco_mgr) {
|
||||||
wlr_log(WLR_ERROR, "unable to create the XDG deco manager");
|
wlr_log(WLR_ERROR, "unable to create the XDG deco manager");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_add(&xdg_deco_mgr->events.new_toplevel_decoration,
|
wl_signal_add(&xdg_deco_mgr->events.new_toplevel_decoration,
|
||||||
&g_server.xdg_toplevel_decoration);
|
&server.xdg_toplevel_decoration);
|
||||||
g_server.xdg_toplevel_decoration.notify = xdg_toplevel_decoration;
|
server.xdg_toplevel_decoration.notify = xdg_toplevel_decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xdg_server_decoration_finish(void)
|
xdserver_decoration_finish(void)
|
||||||
{
|
{
|
||||||
wl_list_remove(&g_server.xdg_toplevel_decoration.link);
|
wl_list_remove(&server.xdg_toplevel_decoration.link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ desktop_entry_init(void)
|
||||||
/* basedir_ctx is not referenced by other objects */
|
/* basedir_ctx is not referenced by other objects */
|
||||||
sfdo_basedir_ctx_destroy(basedir_ctx);
|
sfdo_basedir_ctx_destroy(basedir_ctx);
|
||||||
|
|
||||||
g_server.sfdo = sfdo;
|
server.sfdo = sfdo;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err_icon_theme:
|
err_icon_theme:
|
||||||
|
|
@ -157,7 +157,7 @@ err_basedir_ctx:
|
||||||
void
|
void
|
||||||
desktop_entry_finish(void)
|
desktop_entry_finish(void)
|
||||||
{
|
{
|
||||||
struct sfdo *sfdo = g_server.sfdo;
|
struct sfdo *sfdo = server.sfdo;
|
||||||
if (!sfdo) {
|
if (!sfdo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ desktop_entry_finish(void)
|
||||||
sfdo_icon_ctx_destroy(sfdo->icon_ctx);
|
sfdo_icon_ctx_destroy(sfdo->icon_ctx);
|
||||||
sfdo_desktop_ctx_destroy(sfdo->desktop_ctx);
|
sfdo_desktop_ctx_destroy(sfdo->desktop_ctx);
|
||||||
free(sfdo);
|
free(sfdo);
|
||||||
g_server.sfdo = NULL;
|
server.sfdo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct icon_ctx {
|
struct icon_ctx {
|
||||||
|
|
@ -355,7 +355,7 @@ desktop_entry_load_icon(const char *icon_name, int size, float scale)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sfdo *sfdo = g_server.sfdo;
|
struct sfdo *sfdo = server.sfdo;
|
||||||
if (!sfdo) {
|
if (!sfdo) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -393,7 +393,7 @@ desktop_entry_load_icon_from_app_id(const char *app_id, int size, float scale)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sfdo *sfdo = g_server.sfdo;
|
struct sfdo *sfdo = server.sfdo;
|
||||||
if (!sfdo) {
|
if (!sfdo) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -419,7 +419,7 @@ desktop_entry_name_lookup(const char *app_id)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sfdo *sfdo = g_server.sfdo;
|
struct sfdo *sfdo = server.sfdo;
|
||||||
if (!sfdo) {
|
if (!sfdo) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ desktop_arrange_all_views(void)
|
||||||
* views.
|
* views.
|
||||||
*/
|
*/
|
||||||
struct view *view;
|
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)) {
|
if (!wlr_box_empty(&view->pending)) {
|
||||||
view_adjust_for_layout_change(view);
|
view_adjust_for_layout_change(view);
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ desktop_arrange_all_views(void)
|
||||||
static void
|
static void
|
||||||
set_or_offer_focus(struct view *view)
|
set_or_offer_focus(struct view *view)
|
||||||
{
|
{
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
switch (view_wants_focus(view)) {
|
switch (view_wants_focus(view)) {
|
||||||
case VIEW_WANTS_FOCUS_ALWAYS:
|
case VIEW_WANTS_FOCUS_ALWAYS:
|
||||||
if (view->surface != seat->seat->keyboard_state.focused_surface) {
|
if (view->surface != seat->seat->keyboard_state.focused_surface) {
|
||||||
|
|
@ -76,7 +76,7 @@ desktop_focus_view(struct view *view, bool raise)
|
||||||
return;
|
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");
|
wlr_log(WLR_DEBUG, "not focusing window while window switching");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +138,7 @@ static struct view *
|
||||||
desktop_topmost_focusable_view(void)
|
desktop_topmost_focusable_view(void)
|
||||||
{
|
{
|
||||||
struct view *view;
|
struct view *view;
|
||||||
for_each_view(view, &g_server.views,
|
for_each_view(view, &server.views,
|
||||||
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||||
if (!view->minimized) {
|
if (!view->minimized) {
|
||||||
return view;
|
return view;
|
||||||
|
|
@ -158,22 +158,22 @@ desktop_focus_topmost_view(void)
|
||||||
* Defocus previous focused surface/view if no longer
|
* Defocus previous focused surface/view if no longer
|
||||||
* focusable (e.g. unmapped or on a different workspace).
|
* focusable (e.g. unmapped or on a different workspace).
|
||||||
*/
|
*/
|
||||||
seat_focus_surface(&g_server.seat, NULL);
|
seat_focus_surface(&server.seat, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
desktop_focus_output(struct output *output)
|
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) {
|
!= LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct view *view;
|
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) {
|
if (view->outputs & output->id_bit) {
|
||||||
desktop_focus_view(view, /*raise*/ false);
|
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.x + view->current.width / 2,
|
||||||
view->current.y + view->current.height / 2);
|
view->current.y + view->current.height / 2);
|
||||||
cursor_update_focus();
|
cursor_update_focus();
|
||||||
|
|
@ -182,9 +182,9 @@ desktop_focus_output(struct output *output)
|
||||||
}
|
}
|
||||||
/* No view found on desired output */
|
/* No view found on desired output */
|
||||||
struct wlr_box layout_box;
|
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);
|
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.x + output->usable_area.x + output->usable_area.width / 2,
|
||||||
layout_box.y + output->usable_area.y + output->usable_area.height / 2);
|
layout_box.y + output->usable_area.y + output->usable_area.height / 2);
|
||||||
cursor_update_focus();
|
cursor_update_focus();
|
||||||
|
|
@ -198,7 +198,7 @@ desktop_update_top_layer_visibility(void)
|
||||||
uint32_t top = ZWLR_LAYER_SHELL_V1_LAYER_TOP;
|
uint32_t top = ZWLR_LAYER_SHELL_V1_LAYER_TOP;
|
||||||
|
|
||||||
/* Enable all top layers */
|
/* 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)) {
|
if (!output_is_usable(output)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -210,7 +210,7 @@ desktop_update_top_layer_visibility(void)
|
||||||
* any views above it
|
* any views above it
|
||||||
*/
|
*/
|
||||||
uint64_t outputs_covered = 0;
|
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) {
|
if (view->minimized) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -263,19 +263,19 @@ struct cursor_context
|
||||||
get_cursor_context(void)
|
get_cursor_context(void)
|
||||||
{
|
{
|
||||||
struct cursor_context ret = {.type = LAB_NODE_NONE};
|
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 */
|
/* Prevent drag icons to be on top of the hitbox detection */
|
||||||
if (g_server.seat.drag.active) {
|
if (server.seat.drag.active) {
|
||||||
dnd_icons_show(&g_server.seat, false);
|
dnd_icons_show(&server.seat, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_scene_node *node =
|
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);
|
cursor->x, cursor->y, &ret.sx, &ret.sy);
|
||||||
|
|
||||||
if (g_server.seat.drag.active) {
|
if (server.seat.drag.active) {
|
||||||
dnd_icons_show(&g_server.seat, true);
|
dnd_icons_show(&server.seat, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
|
|
@ -290,7 +290,7 @@ get_cursor_context(void)
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
/* TODO: attach LAB_NODE_UNMANAGED node-descriptor to unmanaged surfaces */
|
/* TODO: attach LAB_NODE_UNMANAGED node-descriptor to unmanaged surfaces */
|
||||||
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
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;
|
ret.type = LAB_NODE_UNMANAGED;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ handle_drag_destroy(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
dnd_init(struct seat *seat)
|
dnd_init(struct seat *seat)
|
||||||
{
|
{
|
||||||
seat->drag.icons = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
seat->drag.icons = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
wlr_scene_node_set_enabled(&seat->drag.icons->node, false);
|
wlr_scene_node_set_enabled(&seat->drag.icons->node, false);
|
||||||
|
|
||||||
seat->drag.events.request.notify = handle_drag_request;
|
seat->drag.events.request.notify = handle_drag_request;
|
||||||
|
|
|
||||||
10
src/edges.c
10
src/edges.c
|
|
@ -353,17 +353,17 @@ edges_calculate_visibility(struct view *ignored_view)
|
||||||
*/
|
*/
|
||||||
struct output *output;
|
struct output *output;
|
||||||
struct wlr_box layout_box;
|
struct wlr_box layout_box;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
output->wlr_output, &layout_box);
|
output->wlr_output, &layout_box);
|
||||||
pixman_region32_union_rect(®ion, ®ion,
|
pixman_region32_union_rect(®ion, ®ion,
|
||||||
layout_box.x, layout_box.y, layout_box.width, layout_box.height);
|
layout_box.x, layout_box.y, layout_box.width, layout_box.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
subtract_node_tree(&g_server.scene->tree, ®ion, ignored_view);
|
subtract_node_tree(&server.scene->tree, ®ion, ignored_view);
|
||||||
|
|
||||||
pixman_region32_fini(®ion);
|
pixman_region32_fini(®ion);
|
||||||
}
|
}
|
||||||
|
|
@ -389,7 +389,7 @@ edges_find_neighbors(struct border *nearest_edges, struct view *view,
|
||||||
edges_for_target_geometry(&target_edges, view, target);
|
edges_for_target_geometry(&target_edges, view, target);
|
||||||
|
|
||||||
struct view *v;
|
struct view *v;
|
||||||
for_each_view(v, &g_server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
for_each_view(v, &server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||||
if (v == view || v->minimized || !output_is_usable(v->output)) {
|
if (v == view || v->minimized || !output_is_usable(v->output)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -447,7 +447,7 @@ edges_find_outputs(struct border *nearest_edges, struct view *view,
|
||||||
edges_for_target_geometry(&target_edges, view, target);
|
edges_for_target_geometry(&target_edges, view, target);
|
||||||
|
|
||||||
struct output *o;
|
struct output *o;
|
||||||
wl_list_for_each(o, &g_server.outputs, link) {
|
wl_list_for_each(o, &server.outputs, link) {
|
||||||
if (!output_is_usable(o)) {
|
if (!output_is_usable(o)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ void
|
||||||
ext_foreign_toplevel_init(struct ext_foreign_toplevel *ext_toplevel,
|
ext_foreign_toplevel_init(struct ext_foreign_toplevel *ext_toplevel,
|
||||||
struct view *view)
|
struct view *view)
|
||||||
{
|
{
|
||||||
assert(g_server.foreign_toplevel_list);
|
assert(server.foreign_toplevel_list);
|
||||||
ext_toplevel->view = view;
|
ext_toplevel->view = view;
|
||||||
|
|
||||||
struct wlr_ext_foreign_toplevel_handle_v1_state state = {
|
struct wlr_ext_foreign_toplevel_handle_v1_state state = {
|
||||||
|
|
@ -67,7 +67,7 @@ ext_foreign_toplevel_init(struct ext_foreign_toplevel *ext_toplevel,
|
||||||
.app_id = view->app_id,
|
.app_id = view->app_id,
|
||||||
};
|
};
|
||||||
ext_toplevel->handle = wlr_ext_foreign_toplevel_handle_v1_create(
|
ext_toplevel->handle = wlr_ext_foreign_toplevel_handle_v1_create(
|
||||||
g_server.foreign_toplevel_list, &state);
|
server.foreign_toplevel_list, &state);
|
||||||
|
|
||||||
if (!ext_toplevel->handle) {
|
if (!ext_toplevel->handle) {
|
||||||
wlr_log(WLR_ERROR, "cannot create ext toplevel handle for (%s)",
|
wlr_log(WLR_ERROR, "cannot create ext toplevel handle for (%s)",
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ handle_new_outputs(struct wl_listener *listener, void *data)
|
||||||
* wlr_foreign_toplevel handle the rest.
|
* wlr_foreign_toplevel handle the rest.
|
||||||
*/
|
*/
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (view_on_output(wlr_toplevel->view, output)) {
|
if (view_on_output(wlr_toplevel->view, output)) {
|
||||||
wlr_foreign_toplevel_handle_v1_output_enter(
|
wlr_foreign_toplevel_handle_v1_output_enter(
|
||||||
wlr_toplevel->handle, output->wlr_output);
|
wlr_toplevel->handle, output->wlr_output);
|
||||||
|
|
@ -184,11 +184,11 @@ void
|
||||||
wlr_foreign_toplevel_init(struct wlr_foreign_toplevel *wlr_toplevel,
|
wlr_foreign_toplevel_init(struct wlr_foreign_toplevel *wlr_toplevel,
|
||||||
struct view *view)
|
struct view *view)
|
||||||
{
|
{
|
||||||
assert(g_server.foreign_toplevel_manager);
|
assert(server.foreign_toplevel_manager);
|
||||||
wlr_toplevel->view = view;
|
wlr_toplevel->view = view;
|
||||||
|
|
||||||
wlr_toplevel->handle = wlr_foreign_toplevel_handle_v1_create(
|
wlr_toplevel->handle = wlr_foreign_toplevel_handle_v1_create(
|
||||||
g_server.foreign_toplevel_manager);
|
server.foreign_toplevel_manager);
|
||||||
if (!wlr_toplevel->handle) {
|
if (!wlr_toplevel->handle) {
|
||||||
wlr_log(WLR_ERROR, "cannot create wlr foreign toplevel handle for (%s)",
|
wlr_log(WLR_ERROR, "cannot create wlr foreign toplevel handle for (%s)",
|
||||||
view->title);
|
view->title);
|
||||||
|
|
@ -203,7 +203,7 @@ wlr_foreign_toplevel_init(struct wlr_foreign_toplevel *wlr_toplevel,
|
||||||
handle_minimized(&wlr_toplevel->on_view.minimized, NULL);
|
handle_minimized(&wlr_toplevel->on_view.minimized, NULL);
|
||||||
handle_fullscreened(&wlr_toplevel->on_view.fullscreened, NULL);
|
handle_fullscreened(&wlr_toplevel->on_view.fullscreened, NULL);
|
||||||
handle_activated(&wlr_toplevel->on_view.activated,
|
handle_activated(&wlr_toplevel->on_view.activated,
|
||||||
&(bool){view == g_server.active_view});
|
&(bool){view == server.active_view});
|
||||||
|
|
||||||
/* Client side requests */
|
/* Client side requests */
|
||||||
CONNECT_SIGNAL(wlr_toplevel->handle, &wlr_toplevel->on, request_maximize);
|
CONNECT_SIGNAL(wlr_toplevel->handle, &wlr_toplevel->on, request_maximize);
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ handle_request_set_cursor(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, request_set_cursor);
|
struct seat *seat = wl_container_of(listener, seat, request_set_cursor);
|
||||||
|
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
/* Prevent setting a cursor image when moving or resizing */
|
/* Prevent setting a cursor image when moving or resizing */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -208,7 +208,7 @@ handle_request_set_shape(struct wl_listener *listener, void *data)
|
||||||
struct wlr_seat_client *focused_client = seat->seat->pointer_state.focused_client;
|
struct wlr_seat_client *focused_client = seat->seat->pointer_state.focused_client;
|
||||||
|
|
||||||
/* Prevent setting a cursor image when moving or resizing */
|
/* Prevent setting a cursor image when moving or resizing */
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -267,10 +267,10 @@ handle_request_set_primary_selection(struct wl_listener *listener, void *data)
|
||||||
static void
|
static void
|
||||||
process_cursor_move(uint32_t time)
|
process_cursor_move(uint32_t time)
|
||||||
{
|
{
|
||||||
struct view *view = g_server.grabbed_view;
|
struct view *view = server.grabbed_view;
|
||||||
|
|
||||||
int x = g_server.grab_box.x + (g_server.seat.cursor->x - g_server.grab_x);
|
int x = server.grab_box.x + (server.seat.cursor->x - server.grab_x);
|
||||||
int y = g_server.grab_box.y + (g_server.seat.cursor->y - g_server.grab_y);
|
int y = server.grab_box.y + (server.seat.cursor->y - server.grab_y);
|
||||||
|
|
||||||
/* Apply resistance for maximized/tiled view */
|
/* Apply resistance for maximized/tiled view */
|
||||||
bool needs_untile = resistance_unsnap_apply(view, &x, &y);
|
bool needs_untile = resistance_unsnap_apply(view, &x, &y);
|
||||||
|
|
@ -300,7 +300,7 @@ process_cursor_move(uint32_t time)
|
||||||
resistance_move_apply(view, &x, &y);
|
resistance_move_apply(view, &x, &y);
|
||||||
|
|
||||||
view_move(view, x, y);
|
view_move(view, x, y);
|
||||||
overlay_update(&g_server.seat);
|
overlay_update(&server.seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -310,8 +310,8 @@ process_cursor_resize(uint32_t time)
|
||||||
static uint32_t last_resize_time = 0;
|
static uint32_t last_resize_time = 0;
|
||||||
static struct view *last_resize_view = NULL;
|
static struct view *last_resize_view = NULL;
|
||||||
|
|
||||||
assert(g_server.grabbed_view);
|
assert(server.grabbed_view);
|
||||||
if (g_server.grabbed_view == last_resize_view) {
|
if (server.grabbed_view == last_resize_view) {
|
||||||
int32_t refresh = 0;
|
int32_t refresh = 0;
|
||||||
if (output_is_usable(last_resize_view->output)) {
|
if (output_is_usable(last_resize_view->output)) {
|
||||||
refresh = last_resize_view->output->wlr_output->refresh;
|
refresh = last_resize_view->output->wlr_output->refresh;
|
||||||
|
|
@ -327,43 +327,43 @@ process_cursor_resize(uint32_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
last_resize_time = time;
|
last_resize_time = time;
|
||||||
last_resize_view = g_server.grabbed_view;
|
last_resize_view = server.grabbed_view;
|
||||||
|
|
||||||
double dx = g_server.seat.cursor->x - g_server.grab_x;
|
double dx = server.seat.cursor->x - server.grab_x;
|
||||||
double dy = g_server.seat.cursor->y - g_server.grab_y;
|
double dy = server.seat.cursor->y - server.grab_y;
|
||||||
|
|
||||||
struct view *view = g_server.grabbed_view;
|
struct view *view = server.grabbed_view;
|
||||||
struct wlr_box new_view_geo = view->current;
|
struct wlr_box new_view_geo = view->current;
|
||||||
|
|
||||||
if (g_server.resize_edges & LAB_EDGE_TOP) {
|
if (server.resize_edges & LAB_EDGE_TOP) {
|
||||||
/* Shift y to anchor bottom edge when resizing top */
|
/* Shift y to anchor bottom edge when resizing top */
|
||||||
new_view_geo.y = g_server.grab_box.y + dy;
|
new_view_geo.y = server.grab_box.y + dy;
|
||||||
new_view_geo.height = g_server.grab_box.height - dy;
|
new_view_geo.height = server.grab_box.height - dy;
|
||||||
} else if (g_server.resize_edges & LAB_EDGE_BOTTOM) {
|
} else if (server.resize_edges & LAB_EDGE_BOTTOM) {
|
||||||
new_view_geo.height = g_server.grab_box.height + dy;
|
new_view_geo.height = server.grab_box.height + dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.resize_edges & LAB_EDGE_LEFT) {
|
if (server.resize_edges & LAB_EDGE_LEFT) {
|
||||||
/* Shift x to anchor right edge when resizing left */
|
/* Shift x to anchor right edge when resizing left */
|
||||||
new_view_geo.x = g_server.grab_box.x + dx;
|
new_view_geo.x = server.grab_box.x + dx;
|
||||||
new_view_geo.width = g_server.grab_box.width - dx;
|
new_view_geo.width = server.grab_box.width - dx;
|
||||||
} else if (g_server.resize_edges & LAB_EDGE_RIGHT) {
|
} else if (server.resize_edges & LAB_EDGE_RIGHT) {
|
||||||
new_view_geo.width = g_server.grab_box.width + dx;
|
new_view_geo.width = server.grab_box.width + dx;
|
||||||
}
|
}
|
||||||
|
|
||||||
resistance_resize_apply(view, &new_view_geo);
|
resistance_resize_apply(view, &new_view_geo);
|
||||||
view_adjust_size(view, &new_view_geo.width, &new_view_geo.height);
|
view_adjust_size(view, &new_view_geo.width, &new_view_geo.height);
|
||||||
|
|
||||||
if (g_server.resize_edges & LAB_EDGE_TOP) {
|
if (server.resize_edges & LAB_EDGE_TOP) {
|
||||||
/* After size adjustments, make sure to anchor bottom edge */
|
/* After size adjustments, make sure to anchor bottom edge */
|
||||||
new_view_geo.y = g_server.grab_box.y +
|
new_view_geo.y = server.grab_box.y +
|
||||||
g_server.grab_box.height - new_view_geo.height;
|
server.grab_box.height - new_view_geo.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.resize_edges & LAB_EDGE_LEFT) {
|
if (server.resize_edges & LAB_EDGE_LEFT) {
|
||||||
/* After size adjustments, make sure to anchor bottom right */
|
/* After size adjustments, make sure to anchor bottom right */
|
||||||
new_view_geo.x = g_server.grab_box.x +
|
new_view_geo.x = server.grab_box.x +
|
||||||
g_server.grab_box.width - new_view_geo.width;
|
server.grab_box.width - new_view_geo.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc.resize_draw_contents) {
|
if (rc.resize_draw_contents) {
|
||||||
|
|
@ -536,12 +536,12 @@ static void
|
||||||
cursor_update_common(const struct cursor_context *ctx,
|
cursor_update_common(const struct cursor_context *ctx,
|
||||||
struct cursor_context *notified_ctx)
|
struct cursor_context *notified_ctx)
|
||||||
{
|
{
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
struct wlr_seat *wlr_seat = seat->seat;
|
struct wlr_seat *wlr_seat = seat->seat;
|
||||||
|
|
||||||
ssd_update_hovered_button(ctx->node);
|
ssd_update_hovered_button(ctx->node);
|
||||||
|
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
/*
|
/*
|
||||||
* Prevent updating focus/cursor image during
|
* Prevent updating focus/cursor image during
|
||||||
* interactive move/resize, window switcher and
|
* interactive move/resize, window switcher and
|
||||||
|
|
@ -565,8 +565,8 @@ cursor_update_common(const struct cursor_context *ctx,
|
||||||
int lx, ly;
|
int lx, ly;
|
||||||
wlr_scene_node_coords(seat->pressed.ctx.node, &lx, &ly);
|
wlr_scene_node_coords(seat->pressed.ctx.node, &lx, &ly);
|
||||||
*notified_ctx = seat->pressed.ctx;
|
*notified_ctx = seat->pressed.ctx;
|
||||||
notified_ctx->sx = g_server.seat.cursor->x - lx;
|
notified_ctx->sx = server.seat.cursor->x - lx;
|
||||||
notified_ctx->sy = g_server.seat.cursor->y - ly;
|
notified_ctx->sy = server.seat.cursor->y - ly;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -623,21 +623,21 @@ bool
|
||||||
cursor_process_motion(uint32_t time, double *sx, double *sy)
|
cursor_process_motion(uint32_t time, double *sx, double *sy)
|
||||||
{
|
{
|
||||||
/* If the mode is non-passthrough, delegate to those functions. */
|
/* If the mode is non-passthrough, delegate to those functions. */
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MOVE) {
|
if (server.input_mode == LAB_INPUT_STATE_MOVE) {
|
||||||
process_cursor_move(time);
|
process_cursor_move(time);
|
||||||
return false;
|
return false;
|
||||||
} else if (g_server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
} else if (server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
||||||
process_cursor_resize(time);
|
process_cursor_resize(time);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, find view under the pointer and send the event along */
|
/* Otherwise, find view under the pointer and send the event along */
|
||||||
struct cursor_context ctx = get_cursor_context();
|
struct cursor_context ctx = get_cursor_context();
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
if (ctx.type == LAB_NODE_MENUITEM) {
|
if (ctx.type == LAB_NODE_MENUITEM) {
|
||||||
menu_process_cursor_motion(ctx.node);
|
menu_process_cursor_motion(ctx.node);
|
||||||
cursor_set(&g_server.seat, LAB_CURSOR_DEFAULT);
|
cursor_set(&server.seat, LAB_CURSOR_DEFAULT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -712,7 +712,7 @@ _cursor_update_focus(void)
|
||||||
* Always focus the surface below the cursor when
|
* Always focus the surface below the cursor when
|
||||||
* followMouse=yes and followMouseRequiresMovement=no.
|
* followMouse=yes and followMouseRequiresMovement=no.
|
||||||
*/
|
*/
|
||||||
desktop_focus_view_or_surface(&g_server.seat, ctx.view,
|
desktop_focus_view_or_surface(&server.seat, ctx.view,
|
||||||
ctx.surface, rc.raise_on_focus);
|
ctx.surface, rc.raise_on_focus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -735,7 +735,7 @@ static void
|
||||||
warp_cursor_to_constraint_hint(struct seat *seat,
|
warp_cursor_to_constraint_hint(struct seat *seat,
|
||||||
struct wlr_pointer_constraint_v1 *constraint)
|
struct wlr_pointer_constraint_v1 *constraint)
|
||||||
{
|
{
|
||||||
if (!g_server.active_view) {
|
if (!server.active_view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -744,8 +744,8 @@ warp_cursor_to_constraint_hint(struct seat *seat,
|
||||||
double sx = constraint->current.cursor_hint.x;
|
double sx = constraint->current.cursor_hint.x;
|
||||||
double sy = constraint->current.cursor_hint.y;
|
double sy = constraint->current.cursor_hint.y;
|
||||||
wlr_cursor_warp(seat->cursor, NULL,
|
wlr_cursor_warp(seat->cursor, NULL,
|
||||||
g_server.active_view->current.x + sx,
|
server.active_view->current.x + sx,
|
||||||
g_server.active_view->current.y + sy);
|
server.active_view->current.y + sy);
|
||||||
|
|
||||||
/* Make sure we are not sending unnecessary surface movements */
|
/* Make sure we are not sending unnecessary surface movements */
|
||||||
wlr_seat_pointer_warp(seat->seat, sx, sy);
|
wlr_seat_pointer_warp(seat->seat, sx, sy);
|
||||||
|
|
@ -791,11 +791,11 @@ create_constraint(struct wl_listener *listener, void *data)
|
||||||
struct constraint *constraint = znew(*constraint);
|
struct constraint *constraint = znew(*constraint);
|
||||||
|
|
||||||
constraint->constraint = wlr_constraint;
|
constraint->constraint = wlr_constraint;
|
||||||
constraint->seat = &g_server.seat;
|
constraint->seat = &server.seat;
|
||||||
constraint->destroy.notify = handle_constraint_destroy;
|
constraint->destroy.notify = handle_constraint_destroy;
|
||||||
wl_signal_add(&wlr_constraint->events.destroy, &constraint->destroy);
|
wl_signal_add(&wlr_constraint->events.destroy, &constraint->destroy);
|
||||||
|
|
||||||
struct view *view = g_server.active_view;
|
struct view *view = server.active_view;
|
||||||
if (view && view->surface == wlr_constraint->surface) {
|
if (view && view->surface == wlr_constraint->surface) {
|
||||||
constrain_cursor(wlr_constraint);
|
constrain_cursor(wlr_constraint);
|
||||||
}
|
}
|
||||||
|
|
@ -805,7 +805,7 @@ void
|
||||||
constrain_cursor(struct wlr_pointer_constraint_v1
|
constrain_cursor(struct wlr_pointer_constraint_v1
|
||||||
*constraint)
|
*constraint)
|
||||||
{
|
{
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
if (seat->current_constraint == constraint) {
|
if (seat->current_constraint == constraint) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -835,7 +835,7 @@ constrain_cursor(struct wlr_pointer_constraint_v1
|
||||||
static void
|
static void
|
||||||
apply_constraint(struct seat *seat, struct wlr_pointer *pointer, double *x, double *y)
|
apply_constraint(struct seat *seat, struct wlr_pointer *pointer, double *x, double *y)
|
||||||
{
|
{
|
||||||
if (!g_server.active_view) {
|
if (!server.active_view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!seat->current_constraint
|
if (!seat->current_constraint
|
||||||
|
|
@ -848,8 +848,8 @@ apply_constraint(struct seat *seat, struct wlr_pointer *pointer, double *x, doub
|
||||||
double sx = seat->cursor->x;
|
double sx = seat->cursor->x;
|
||||||
double sy = seat->cursor->y;
|
double sy = seat->cursor->y;
|
||||||
|
|
||||||
sx -= g_server.active_view->current.x;
|
sx -= server.active_view->current.x;
|
||||||
sy -= g_server.active_view->current.y;
|
sy -= server.active_view->current.y;
|
||||||
|
|
||||||
double sx_confined, sy_confined;
|
double sx_confined, sy_confined;
|
||||||
if (!wlr_region_confine(&seat->current_constraint->region, sx, sy,
|
if (!wlr_region_confine(&seat->current_constraint->region, sx, sy,
|
||||||
|
|
@ -949,7 +949,7 @@ handle_motion(struct wl_listener *listener, void *data)
|
||||||
WL_POINTER_AXIS_SOURCE_CONTINUOUS, event->time_msec);
|
WL_POINTER_AXIS_SOURCE_CONTINUOUS, event->time_msec);
|
||||||
} else {
|
} else {
|
||||||
wlr_relative_pointer_manager_v1_send_relative_motion(
|
wlr_relative_pointer_manager_v1_send_relative_motion(
|
||||||
g_server.relative_pointer_manager,
|
server.relative_pointer_manager,
|
||||||
seat->seat, (uint64_t)event->time_msec * 1000,
|
seat->seat, (uint64_t)event->time_msec * 1000,
|
||||||
event->delta_x, event->delta_y, event->unaccel_dx,
|
event->delta_x, event->delta_y, event->unaccel_dx,
|
||||||
event->unaccel_dy);
|
event->unaccel_dy);
|
||||||
|
|
@ -989,12 +989,12 @@ handle_motion_absolute(struct wl_listener *listener, void *data)
|
||||||
static void
|
static void
|
||||||
process_release_mousebinding(struct cursor_context *ctx, uint32_t button)
|
process_release_mousebinding(struct cursor_context *ctx, uint32_t button)
|
||||||
{
|
{
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mousebind *mousebind;
|
struct mousebind *mousebind;
|
||||||
uint32_t modifiers = keyboard_get_all_modifiers(&g_server.seat);
|
uint32_t modifiers = keyboard_get_all_modifiers(&server.seat);
|
||||||
|
|
||||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||||
if (ctx->type == LAB_NODE_CLIENT
|
if (ctx->type == LAB_NODE_CLIENT
|
||||||
|
|
@ -1058,14 +1058,14 @@ static bool
|
||||||
process_press_mousebinding(struct cursor_context *ctx,
|
process_press_mousebinding(struct cursor_context *ctx,
|
||||||
uint32_t button)
|
uint32_t button)
|
||||||
{
|
{
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mousebind *mousebind;
|
struct mousebind *mousebind;
|
||||||
bool double_click = is_double_click(rc.doubleclick_time, button, ctx);
|
bool double_click = is_double_click(rc.doubleclick_time, button, ctx);
|
||||||
bool consumed_by_frame_context = false;
|
bool consumed_by_frame_context = false;
|
||||||
uint32_t modifiers = keyboard_get_all_modifiers(&g_server.seat);
|
uint32_t modifiers = keyboard_get_all_modifiers(&server.seat);
|
||||||
|
|
||||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||||
if (ctx->type == LAB_NODE_CLIENT
|
if (ctx->type == LAB_NODE_CLIENT
|
||||||
|
|
@ -1145,7 +1145,7 @@ cursor_process_button_press(struct seat *seat, uint32_t button, uint32_t time_ms
|
||||||
interactive_set_grab_context(&ctx);
|
interactive_set_grab_context(&ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MENU) {
|
if (server.input_mode == LAB_INPUT_STATE_MENU) {
|
||||||
/*
|
/*
|
||||||
* If menu was already opened on press, set a very small value
|
* If menu was already opened on press, set a very small value
|
||||||
* so subsequent release always closes menu or selects menu item.
|
* so subsequent release always closes menu or selects menu item.
|
||||||
|
|
@ -1213,7 +1213,7 @@ cursor_process_button_release(struct seat *seat, uint32_t button,
|
||||||
|
|
||||||
cursor_context_save(&seat->pressed, NULL);
|
cursor_context_save(&seat->pressed, NULL);
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MENU) {
|
if (server.input_mode == LAB_INPUT_STATE_MENU) {
|
||||||
/* TODO: take into account overflow of time_msec */
|
/* TODO: take into account overflow of time_msec */
|
||||||
if (time_msec - press_msec > rc.menu_ignore_button_release_period) {
|
if (time_msec - press_msec > rc.menu_ignore_button_release_period) {
|
||||||
if (ctx.type == LAB_NODE_MENUITEM) {
|
if (ctx.type == LAB_NODE_MENUITEM) {
|
||||||
|
|
@ -1225,14 +1225,14 @@ cursor_process_button_release(struct seat *seat, uint32_t button,
|
||||||
}
|
}
|
||||||
return notify;
|
return notify;
|
||||||
}
|
}
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||||
if (ctx.type == LAB_NODE_CYCLE_OSD_ITEM) {
|
if (ctx.type == LAB_NODE_CYCLE_OSD_ITEM) {
|
||||||
cycle_on_cursor_release(ctx.node);
|
cycle_on_cursor_release(ctx.node);
|
||||||
}
|
}
|
||||||
return notify;
|
return notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return notify;
|
return notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1262,17 +1262,17 @@ cursor_finish_button_release(struct seat *seat, uint32_t button)
|
||||||
|
|
||||||
lab_set_remove(&seat->bound_buttons, button);
|
lab_set_remove(&seat->bound_buttons, button);
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MOVE
|
if (server.input_mode == LAB_INPUT_STATE_MOVE
|
||||||
|| g_server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
|| server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
||||||
if (resize_outlines_enabled(g_server.grabbed_view)) {
|
if (resize_outlines_enabled(server.grabbed_view)) {
|
||||||
resize_outlines_finish(g_server.grabbed_view);
|
resize_outlines_finish(server.grabbed_view);
|
||||||
}
|
}
|
||||||
/* Exit interactive move/resize mode */
|
/* Exit interactive move/resize mode */
|
||||||
interactive_finish(g_server.grabbed_view);
|
interactive_finish(server.grabbed_view);
|
||||||
return true;
|
return true;
|
||||||
} else if (g_server.grabbed_view) {
|
} else if (server.grabbed_view) {
|
||||||
/* Button was released without starting move/resize */
|
/* Button was released without starting move/resize */
|
||||||
interactive_cancel(g_server.grabbed_view);
|
interactive_cancel(server.grabbed_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1366,11 +1366,11 @@ process_cursor_axis(enum wl_pointer_axis orientation,
|
||||||
double delta, double delta_discrete)
|
double delta, double delta_discrete)
|
||||||
{
|
{
|
||||||
struct cursor_context ctx = get_cursor_context();
|
struct cursor_context ctx = get_cursor_context();
|
||||||
uint32_t modifiers = keyboard_get_all_modifiers(&g_server.seat);
|
uint32_t modifiers = keyboard_get_all_modifiers(&server.seat);
|
||||||
|
|
||||||
enum direction direction = LAB_DIRECTION_INVALID;
|
enum direction direction = LAB_DIRECTION_INVALID;
|
||||||
struct scroll_info info = compare_delta(delta, delta_discrete,
|
struct scroll_info info = compare_delta(delta, delta_discrete,
|
||||||
&g_server.seat.accumulated_scrolls[orientation]);
|
&server.seat.accumulated_scrolls[orientation]);
|
||||||
|
|
||||||
if (orientation == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
|
if (orientation == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
|
||||||
if (info.direction < 0) {
|
if (info.direction < 0) {
|
||||||
|
|
@ -1504,7 +1504,7 @@ cursor_emulate_move(struct seat *seat, struct wlr_input_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_relative_pointer_manager_v1_send_relative_motion(
|
wlr_relative_pointer_manager_v1_send_relative_motion(
|
||||||
g_server.relative_pointer_manager,
|
server.relative_pointer_manager,
|
||||||
seat->seat, (uint64_t)time_msec * 1000,
|
seat->seat, (uint64_t)time_msec * 1000,
|
||||||
dx, dy, dx, dy);
|
dx, dy, dx, dy);
|
||||||
|
|
||||||
|
|
@ -1633,7 +1633,7 @@ cursor_init(struct seat *seat)
|
||||||
CONNECT_SIGNAL(seat->seat, seat, request_set_cursor);
|
CONNECT_SIGNAL(seat->seat, seat, request_set_cursor);
|
||||||
|
|
||||||
struct wlr_cursor_shape_manager_v1 *cursor_shape_manager =
|
struct wlr_cursor_shape_manager_v1 *cursor_shape_manager =
|
||||||
wlr_cursor_shape_manager_v1_create(g_server.wl_display,
|
wlr_cursor_shape_manager_v1_create(server.wl_display,
|
||||||
LAB_CURSOR_SHAPE_V1_VERSION);
|
LAB_CURSOR_SHAPE_V1_VERSION);
|
||||||
if (!cursor_shape_manager) {
|
if (!cursor_shape_manager) {
|
||||||
wlr_log(WLR_ERROR, "unable to create cursor_shape interface");
|
wlr_log(WLR_ERROR, "unable to create cursor_shape interface");
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ handle_hold_end(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
gestures_init(struct seat *seat)
|
gestures_init(struct seat *seat)
|
||||||
{
|
{
|
||||||
seat->pointer_gestures = wlr_pointer_gestures_v1_create(g_server.wl_display);
|
seat->pointer_gestures = wlr_pointer_gestures_v1_create(server.wl_display);
|
||||||
|
|
||||||
CONNECT_SIGNAL(seat->cursor, seat, pinch_begin);
|
CONNECT_SIGNAL(seat->cursor, seat, pinch_begin);
|
||||||
CONNECT_SIGNAL(seat->cursor, seat, pinch_update);
|
CONNECT_SIGNAL(seat->cursor, seat, pinch_update);
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ update_popup_position(struct input_method_popup *popup)
|
||||||
}
|
}
|
||||||
struct wlr_box output_box;
|
struct wlr_box output_box;
|
||||||
wlr_output_layout_get_box(
|
wlr_output_layout_get_box(
|
||||||
g_server.output_layout, output->wlr_output, &output_box);
|
server.output_layout, output->wlr_output, &output_box);
|
||||||
|
|
||||||
/* Use xdg-positioner utilities to position popup */
|
/* Use xdg-positioner utilities to position popup */
|
||||||
struct wlr_xdg_positioner_rules rules = {
|
struct wlr_xdg_positioner_rules rules = {
|
||||||
|
|
@ -582,14 +582,14 @@ input_method_relay_create(struct seat *seat)
|
||||||
relay->seat = seat;
|
relay->seat = seat;
|
||||||
wl_list_init(&relay->text_inputs);
|
wl_list_init(&relay->text_inputs);
|
||||||
wl_list_init(&relay->popups);
|
wl_list_init(&relay->popups);
|
||||||
relay->popup_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
relay->popup_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
|
|
||||||
relay->new_text_input.notify = handle_new_text_input;
|
relay->new_text_input.notify = handle_new_text_input;
|
||||||
wl_signal_add(&g_server.text_input_manager->events.text_input,
|
wl_signal_add(&server.text_input_manager->events.text_input,
|
||||||
&relay->new_text_input);
|
&relay->new_text_input);
|
||||||
|
|
||||||
relay->new_input_method.notify = handle_new_input_method;
|
relay->new_input_method.notify = handle_new_input_method;
|
||||||
wl_signal_add(&g_server.input_method_manager->events.input_method,
|
wl_signal_add(&server.input_method_manager->events.input_method,
|
||||||
&relay->new_input_method);
|
&relay->new_input_method);
|
||||||
|
|
||||||
relay->focused_surface_destroy.notify = handle_focused_surface_destroy;
|
relay->focused_surface_destroy.notify = handle_focused_surface_destroy;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ keyboard_reset_current_keybind(void)
|
||||||
static void
|
static void
|
||||||
change_vt(unsigned int vt)
|
change_vt(unsigned int vt)
|
||||||
{
|
{
|
||||||
wlr_session_change_vt(g_server.session, vt);
|
wlr_session_change_vt(server.session, vt);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
|
@ -133,14 +133,14 @@ handle_modifiers(struct wl_listener *listener, void *data)
|
||||||
struct seat *seat = keyboard->base.seat;
|
struct seat *seat = keyboard->base.seat;
|
||||||
struct wlr_keyboard *wlr_keyboard = keyboard->wlr_keyboard;
|
struct wlr_keyboard *wlr_keyboard = keyboard->wlr_keyboard;
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MOVE) {
|
if (server.input_mode == LAB_INPUT_STATE_MOVE) {
|
||||||
/* Any change to the modifier state re-enable region snap */
|
/* Any change to the modifier state re-enable region snap */
|
||||||
seat->region_prevent_snap = false;
|
seat->region_prevent_snap = false;
|
||||||
/* Pressing/releasing modifier key may show/hide region overlay */
|
/* Pressing/releasing modifier key may show/hide region overlay */
|
||||||
overlay_update(seat);
|
overlay_update(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cycling = g_server.input_mode == LAB_INPUT_STATE_CYCLE;
|
bool cycling = server.input_mode == LAB_INPUT_STATE_CYCLE;
|
||||||
|
|
||||||
if ((cycling || seat->workspace_osd_shown_by_modifier)
|
if ((cycling || seat->workspace_osd_shown_by_modifier)
|
||||||
&& !keyboard_get_all_modifiers(seat)) {
|
&& !keyboard_get_all_modifiers(seat)) {
|
||||||
|
|
@ -195,7 +195,7 @@ match_keybinding_for_sym(uint32_t modifiers,
|
||||||
if (modifiers ^ keybind->modifiers) {
|
if (modifiers ^ keybind->modifiers) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (view_inhibits_actions(g_server.active_view, &keybind->actions)) {
|
if (view_inhibits_actions(server.active_view, &keybind->actions)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (sym == XKB_KEY_NoSymbol) {
|
if (sym == XKB_KEY_NoSymbol) {
|
||||||
|
|
@ -416,7 +416,7 @@ handle_change_vt_key(struct keyboard *keyboard,
|
||||||
static void
|
static void
|
||||||
handle_menu_keys(struct keysyms *syms)
|
handle_menu_keys(struct keysyms *syms)
|
||||||
{
|
{
|
||||||
assert(g_server.input_mode == LAB_INPUT_STATE_MENU);
|
assert(server.input_mode == LAB_INPUT_STATE_MENU);
|
||||||
|
|
||||||
for (int i = 0; i < syms->nr_syms; i++) {
|
for (int i = 0; i < syms->nr_syms; i++) {
|
||||||
switch (syms->syms[i]) {
|
switch (syms->syms[i]) {
|
||||||
|
|
@ -484,7 +484,7 @@ handle_compositor_keybindings(struct keyboard *keyboard,
|
||||||
{
|
{
|
||||||
struct wlr_keyboard *wlr_keyboard = keyboard->wlr_keyboard;
|
struct wlr_keyboard *wlr_keyboard = keyboard->wlr_keyboard;
|
||||||
struct keyinfo keyinfo = get_keyinfo(wlr_keyboard, event->keycode);
|
struct keyinfo keyinfo = get_keyinfo(wlr_keyboard, event->keycode);
|
||||||
bool locked = g_server.session_lock_manager->locked;
|
bool locked = server.session_lock_manager->locked;
|
||||||
|
|
||||||
key_state_set_pressed(event->keycode,
|
key_state_set_pressed(event->keycode,
|
||||||
event->state == WL_KEYBOARD_KEY_STATE_PRESSED);
|
event->state == WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||||
|
|
@ -515,11 +515,11 @@ handle_compositor_keybindings(struct keyboard *keyboard,
|
||||||
* _all_ key press/releases are registered
|
* _all_ key press/releases are registered
|
||||||
*/
|
*/
|
||||||
if (!locked) {
|
if (!locked) {
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MENU) {
|
if (server.input_mode == LAB_INPUT_STATE_MENU) {
|
||||||
key_state_store_pressed_key_as_bound(event->keycode);
|
key_state_store_pressed_key_as_bound(event->keycode);
|
||||||
handle_menu_keys(&keyinfo.translated);
|
handle_menu_keys(&keyinfo.translated);
|
||||||
return LAB_KEY_HANDLED_TRUE;
|
return LAB_KEY_HANDLED_TRUE;
|
||||||
} else if (g_server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
} else if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||||
if (handle_cycle_view_key(&keyinfo)) {
|
if (handle_cycle_view_key(&keyinfo)) {
|
||||||
key_state_store_pressed_key_as_bound(event->keycode);
|
key_state_store_pressed_key_as_bound(event->keycode);
|
||||||
return LAB_KEY_HANDLED_TRUE;
|
return LAB_KEY_HANDLED_TRUE;
|
||||||
|
|
@ -580,7 +580,7 @@ start_keybind_repeat(struct keyboard *keyboard,
|
||||||
keyboard->keybind_repeat_keycode = event->keycode;
|
keyboard->keybind_repeat_keycode = event->keycode;
|
||||||
keyboard->keybind_repeat_rate = wlr_keyboard->repeat_info.rate;
|
keyboard->keybind_repeat_rate = wlr_keyboard->repeat_info.rate;
|
||||||
keyboard->keybind_repeat = wl_event_loop_add_timer(
|
keyboard->keybind_repeat = wl_event_loop_add_timer(
|
||||||
g_server.wl_event_loop, handle_keybind_repeat, keyboard);
|
server.wl_event_loop, handle_keybind_repeat, keyboard);
|
||||||
wl_event_source_timer_update(keyboard->keybind_repeat,
|
wl_event_source_timer_update(keyboard->keybind_repeat,
|
||||||
wlr_keyboard->repeat_info.delay);
|
wlr_keyboard->repeat_info.delay);
|
||||||
}
|
}
|
||||||
|
|
@ -724,15 +724,15 @@ reset_window_keyboard_layout_groups(void)
|
||||||
* but let's keep it simple for now and just reset them all.
|
* but let's keep it simple for now and just reset them all.
|
||||||
*/
|
*/
|
||||||
struct view *view;
|
struct view *view;
|
||||||
for_each_view(view, &g_server.views, LAB_VIEW_CRITERIA_NONE) {
|
for_each_view(view, &server.views, LAB_VIEW_CRITERIA_NONE) {
|
||||||
view->keyboard_layout = 0;
|
view->keyboard_layout = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *active_view = g_server.active_view;
|
struct view *active_view = server.active_view;
|
||||||
if (!active_view) {
|
if (!active_view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
keyboard_update_layout(&g_server.seat, active_view->keyboard_layout);
|
keyboard_update_layout(&server.seat, active_view->keyboard_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -183,9 +183,9 @@ tablet_pad_create(struct seat *seat, struct wlr_input_device *wlr_device)
|
||||||
pad->seat = seat;
|
pad->seat = seat;
|
||||||
pad->wlr_input_device = wlr_device;
|
pad->wlr_input_device = wlr_device;
|
||||||
pad->pad = wlr_tablet_pad_from_input_device(wlr_device);
|
pad->pad = wlr_tablet_pad_from_input_device(wlr_device);
|
||||||
if (g_server.tablet_manager) {
|
if (server.tablet_manager) {
|
||||||
pad->pad_v2 = wlr_tablet_pad_create(
|
pad->pad_v2 = wlr_tablet_pad_create(
|
||||||
g_server.tablet_manager, seat->seat, wlr_device);
|
server.tablet_manager, seat->seat, wlr_device);
|
||||||
}
|
}
|
||||||
pad->pad->data = pad;
|
pad->pad->data = pad;
|
||||||
wlr_log(WLR_INFO, "tablet pad capabilities: %zu button(s) %zu strip(s) %zu ring(s)",
|
wlr_log(WLR_INFO, "tablet pad capabilities: %zu button(s) %zu strip(s) %zu ring(s)",
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ handle_set_cursor(struct wl_listener *listener, void *data)
|
||||||
struct wlr_seat_client *focused_client =
|
struct wlr_seat_client *focused_client =
|
||||||
seat->seat->pointer_state.focused_client;
|
seat->seat->pointer_state.focused_client;
|
||||||
|
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ tablet_tool_create(struct seat *seat,
|
||||||
struct drawing_tablet_tool *tool = znew(*tool);
|
struct drawing_tablet_tool *tool = znew(*tool);
|
||||||
tool->seat = seat;
|
tool->seat = seat;
|
||||||
tool->tool_v2 =
|
tool->tool_v2 =
|
||||||
wlr_tablet_tool_create(g_server.tablet_manager,
|
wlr_tablet_tool_create(server.tablet_manager,
|
||||||
seat->seat, wlr_tablet_tool);
|
seat->seat, wlr_tablet_tool);
|
||||||
wlr_tablet_tool->data = tool;
|
wlr_tablet_tool->data = tool;
|
||||||
wlr_log(WLR_INFO, "tablet tool capabilities:%s%s%s%s%s%s",
|
wlr_log(WLR_INFO, "tablet tool capabilities:%s%s%s%s%s%s",
|
||||||
|
|
@ -239,7 +239,7 @@ tablet_get_coords(struct drawing_tablet *tablet, struct drawing_tablet_tool *too
|
||||||
|
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
struct wlr_scene_node *node =
|
struct wlr_scene_node *node =
|
||||||
wlr_scene_node_at(&g_server.scene->tree.node, lx, ly, &sx, &sy);
|
wlr_scene_node_at(&server.scene->tree.node, lx, ly, &sx, &sy);
|
||||||
|
|
||||||
/* find the surface and return it if it accepts tablet events */
|
/* find the surface and return it if it accepts tablet events */
|
||||||
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
||||||
|
|
@ -449,7 +449,7 @@ handle_tablet_tool_axis(struct wl_listener *listener, void *data)
|
||||||
* Note that surface is also NULL when mouse emulation is forced.
|
* Note that surface is also NULL when mouse emulation is forced.
|
||||||
*/
|
*/
|
||||||
if (!is_down_mouse_emulation && ((surface
|
if (!is_down_mouse_emulation && ((surface
|
||||||
&& g_server.input_mode == LAB_INPUT_STATE_PASSTHROUGH)
|
&& server.input_mode == LAB_INPUT_STATE_PASSTHROUGH)
|
||||||
|| wlr_tablet_tool_v2_has_implicit_grab(tool->tool_v2))) {
|
|| wlr_tablet_tool_v2_has_implicit_grab(tool->tool_v2))) {
|
||||||
/* motion seems to be supported by all tools */
|
/* motion seems to be supported by all tools */
|
||||||
notify_motion(tablet, tool, surface, x, y, dx, dy, ev->time_msec);
|
notify_motion(tablet, tool, surface, x, y, dx, dy, ev->time_msec);
|
||||||
|
|
@ -719,9 +719,9 @@ tablet_create(struct seat *seat, struct wlr_input_device *wlr_device)
|
||||||
tablet->wlr_input_device = wlr_device;
|
tablet->wlr_input_device = wlr_device;
|
||||||
tablet->tablet = wlr_tablet_from_input_device(wlr_device);
|
tablet->tablet = wlr_tablet_from_input_device(wlr_device);
|
||||||
tablet->tablet->data = tablet;
|
tablet->tablet->data = tablet;
|
||||||
if (g_server.tablet_manager) {
|
if (server.tablet_manager) {
|
||||||
tablet->tablet_v2 = wlr_tablet_create(
|
tablet->tablet_v2 = wlr_tablet_create(
|
||||||
g_server.tablet_manager, seat->seat, wlr_device);
|
server.tablet_manager, seat->seat, wlr_device);
|
||||||
}
|
}
|
||||||
wlr_log(WLR_INFO, "tablet dimensions: %.2fmm x %.2fmm",
|
wlr_log(WLR_INFO, "tablet dimensions: %.2fmm x %.2fmm",
|
||||||
tablet->tablet->width_mm, tablet->tablet->height_mm);
|
tablet->tablet->width_mm, tablet->tablet->height_mm);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ touch_get_coords(struct seat *seat, struct wlr_touch *touch, double x, double y,
|
||||||
* This matches normal pointer/mouse behavior where the first click on
|
* This matches normal pointer/mouse behavior where the first click on
|
||||||
* a surface closes a root/client menu.
|
* a surface closes a root/client menu.
|
||||||
*/
|
*/
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MENU) {
|
if (server.input_mode == LAB_INPUT_STATE_MENU) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ touch_get_coords(struct seat *seat, struct wlr_touch *touch, double x, double y,
|
||||||
|
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
struct wlr_scene_node *node =
|
struct wlr_scene_node *node =
|
||||||
wlr_scene_node_at(&g_server.scene->tree.node, lx, ly, &sx, &sy);
|
wlr_scene_node_at(&server.scene->tree.node, lx, ly, &sx, &sy);
|
||||||
|
|
||||||
*x_offset = lx - sx;
|
*x_offset = lx - sx;
|
||||||
*y_offset = ly - sy;
|
*y_offset = ly - sy;
|
||||||
|
|
|
||||||
|
|
@ -38,20 +38,20 @@ max_move_scale(double pos_cursor, double pos_old, double size_old,
|
||||||
void
|
void
|
||||||
interactive_anchor_to_cursor(struct wlr_box *geo)
|
interactive_anchor_to_cursor(struct wlr_box *geo)
|
||||||
{
|
{
|
||||||
assert(g_server.input_mode == LAB_INPUT_STATE_MOVE);
|
assert(server.input_mode == LAB_INPUT_STATE_MOVE);
|
||||||
if (wlr_box_empty(geo)) {
|
if (wlr_box_empty(geo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Resize grab_box while anchoring it to grab_{x,y} */
|
/* Resize grab_box while anchoring it to grab_{x,y} */
|
||||||
g_server.grab_box.x = max_move_scale(g_server.grab_x, g_server.grab_box.x,
|
server.grab_box.x = max_move_scale(server.grab_x, server.grab_box.x,
|
||||||
g_server.grab_box.width, geo->width);
|
server.grab_box.width, geo->width);
|
||||||
g_server.grab_box.y = max_move_scale(g_server.grab_y, g_server.grab_box.y,
|
server.grab_box.y = max_move_scale(server.grab_y, server.grab_box.y,
|
||||||
g_server.grab_box.height, geo->height);
|
server.grab_box.height, geo->height);
|
||||||
g_server.grab_box.width = geo->width;
|
server.grab_box.width = geo->width;
|
||||||
g_server.grab_box.height = geo->height;
|
server.grab_box.height = geo->height;
|
||||||
|
|
||||||
geo->x = g_server.grab_box.x + (g_server.seat.cursor->x - g_server.grab_x);
|
geo->x = server.grab_box.x + (server.seat.cursor->x - server.grab_x);
|
||||||
geo->y = g_server.grab_box.y + (g_server.seat.cursor->y - g_server.grab_y);
|
geo->y = server.grab_box.y + (server.seat.cursor->y - server.grab_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -65,16 +65,16 @@ interactive_set_grab_context(const struct cursor_context *ctx)
|
||||||
if (!ctx->view) {
|
if (!ctx->view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.grabbed_view = ctx->view;
|
server.grabbed_view = ctx->view;
|
||||||
g_server.grab_x = g_server.seat.cursor->x;
|
server.grab_x = server.seat.cursor->x;
|
||||||
g_server.grab_y = g_server.seat.cursor->y;
|
server.grab_y = server.seat.cursor->y;
|
||||||
g_server.grab_box = ctx->view->current;
|
server.grab_box = ctx->view->current;
|
||||||
g_server.resize_edges =
|
server.resize_edges =
|
||||||
cursor_get_resize_edges(g_server.seat.cursor, ctx);
|
cursor_get_resize_edges(server.seat.cursor, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -86,10 +86,10 @@ interactive_begin(struct view *view, enum input_mode mode, enum lab_edge edges)
|
||||||
* the compositor stops propagating pointer events to clients and
|
* the compositor stops propagating pointer events to clients and
|
||||||
* instead consumes them itself, to move or resize windows.
|
* instead consumes them itself, to move or resize windows.
|
||||||
*/
|
*/
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH
|
||||||
|| view != g_server.grabbed_view) {
|
|| view != server.grabbed_view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ interactive_begin(struct view *view, enum input_mode mode, enum lab_edge edges)
|
||||||
* Otherwise, they were set already from cursor context.
|
* Otherwise, they were set already from cursor context.
|
||||||
*/
|
*/
|
||||||
if (edges != LAB_EDGE_NONE) {
|
if (edges != LAB_EDGE_NONE) {
|
||||||
g_server.resize_edges = edges;
|
server.resize_edges = edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -146,15 +146,15 @@ interactive_begin(struct view *view, enum input_mode mode, enum lab_edge edges)
|
||||||
* keep the same geometry as the starting point.
|
* keep the same geometry as the starting point.
|
||||||
*/
|
*/
|
||||||
enum view_axis maximized = view->maximized;
|
enum view_axis maximized = view->maximized;
|
||||||
if (g_server.resize_edges & LAB_EDGES_LEFT_RIGHT) {
|
if (server.resize_edges & LAB_EDGES_LEFT_RIGHT) {
|
||||||
maximized &= ~VIEW_AXIS_HORIZONTAL;
|
maximized &= ~VIEW_AXIS_HORIZONTAL;
|
||||||
}
|
}
|
||||||
if (g_server.resize_edges & LAB_EDGES_TOP_BOTTOM) {
|
if (server.resize_edges & LAB_EDGES_TOP_BOTTOM) {
|
||||||
maximized &= ~VIEW_AXIS_VERTICAL;
|
maximized &= ~VIEW_AXIS_VERTICAL;
|
||||||
}
|
}
|
||||||
view_set_maximized(view, maximized);
|
view_set_maximized(view, maximized);
|
||||||
view_set_untiled(view);
|
view_set_untiled(view);
|
||||||
cursor_shape = cursor_get_from_edge(g_server.resize_edges);
|
cursor_shape = cursor_get_from_edge(server.resize_edges);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -198,7 +198,7 @@ edge_from_cursor(struct seat *seat, struct output **dest_output,
|
||||||
*edge1 = LAB_EDGE_NONE;
|
*edge1 = LAB_EDGE_NONE;
|
||||||
*edge2 = LAB_EDGE_NONE;
|
*edge2 = LAB_EDGE_NONE;
|
||||||
|
|
||||||
if (!view_is_floating(g_server.grabbed_view)) {
|
if (!view_is_floating(server.grabbed_view)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,25 +220,25 @@ edge_from_cursor(struct seat *seat, struct output **dest_output,
|
||||||
int bottom_range = rc.snap_edge_range_outer;
|
int bottom_range = rc.snap_edge_range_outer;
|
||||||
int left_range = rc.snap_edge_range_outer;
|
int left_range = rc.snap_edge_range_outer;
|
||||||
int right_range = rc.snap_edge_range_outer;
|
int right_range = rc.snap_edge_range_outer;
|
||||||
if (wlr_output_layout_adjacent_output(g_server.output_layout, WLR_DIRECTION_UP,
|
if (wlr_output_layout_adjacent_output(server.output_layout, WLR_DIRECTION_UP,
|
||||||
output->wlr_output, cursor_x, cursor_y)) {
|
output->wlr_output, cursor_x, cursor_y)) {
|
||||||
top_range = rc.snap_edge_range_inner;
|
top_range = rc.snap_edge_range_inner;
|
||||||
}
|
}
|
||||||
if (wlr_output_layout_adjacent_output(g_server.output_layout, WLR_DIRECTION_DOWN,
|
if (wlr_output_layout_adjacent_output(server.output_layout, WLR_DIRECTION_DOWN,
|
||||||
output->wlr_output, cursor_x, cursor_y)) {
|
output->wlr_output, cursor_x, cursor_y)) {
|
||||||
bottom_range = rc.snap_edge_range_inner;
|
bottom_range = rc.snap_edge_range_inner;
|
||||||
}
|
}
|
||||||
if (wlr_output_layout_adjacent_output(g_server.output_layout, WLR_DIRECTION_LEFT,
|
if (wlr_output_layout_adjacent_output(server.output_layout, WLR_DIRECTION_LEFT,
|
||||||
output->wlr_output, cursor_x, cursor_y)) {
|
output->wlr_output, cursor_x, cursor_y)) {
|
||||||
left_range = rc.snap_edge_range_inner;
|
left_range = rc.snap_edge_range_inner;
|
||||||
}
|
}
|
||||||
if (wlr_output_layout_adjacent_output(g_server.output_layout, WLR_DIRECTION_RIGHT,
|
if (wlr_output_layout_adjacent_output(server.output_layout, WLR_DIRECTION_RIGHT,
|
||||||
output->wlr_output, cursor_x, cursor_y)) {
|
output->wlr_output, cursor_x, cursor_y)) {
|
||||||
right_range = rc.snap_edge_range_inner;
|
right_range = rc.snap_edge_range_inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate into output local coordinates */
|
/* Translate into output local coordinates */
|
||||||
wlr_output_layout_output_coords(g_server.output_layout,
|
wlr_output_layout_output_coords(server.output_layout,
|
||||||
output->wlr_output, &cursor_x, &cursor_y);
|
output->wlr_output, &cursor_x, &cursor_y);
|
||||||
|
|
||||||
struct wlr_box *area = &output->usable_area;
|
struct wlr_box *area = &output->usable_area;
|
||||||
|
|
@ -283,7 +283,7 @@ snap_to_edge(struct view *view)
|
||||||
{
|
{
|
||||||
struct output *output;
|
struct output *output;
|
||||||
enum lab_edge edge1, edge2;
|
enum lab_edge edge1, edge2;
|
||||||
if (!edge_from_cursor(&g_server.seat, &output, &edge1, &edge2)) {
|
if (!edge_from_cursor(&server.seat, &output, &edge1, &edge2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
enum lab_edge edge = edge1 | edge2;
|
enum lab_edge edge = edge1 | edge2;
|
||||||
|
|
@ -320,11 +320,11 @@ interactive_finish(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
if (g_server.grabbed_view != view) {
|
if (server.grabbed_view != view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MOVE) {
|
if (server.input_mode == LAB_INPUT_STATE_MOVE) {
|
||||||
if (!snap_to_region(view)) {
|
if (!snap_to_region(view)) {
|
||||||
snap_to_edge(view);
|
snap_to_edge(view);
|
||||||
}
|
}
|
||||||
|
|
@ -343,25 +343,25 @@ interactive_cancel(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
if (g_server.grabbed_view != view) {
|
if (server.grabbed_view != view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.grabbed_view = NULL;
|
server.grabbed_view = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's possible that grabbed_view was set but interactive_begin()
|
* It's possible that grabbed_view was set but interactive_begin()
|
||||||
* wasn't called yet. In that case, we are done.
|
* wasn't called yet. In that case, we are done.
|
||||||
*/
|
*/
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_MOVE
|
if (server.input_mode != LAB_INPUT_STATE_MOVE
|
||||||
&& g_server.input_mode != LAB_INPUT_STATE_RESIZE) {
|
&& server.input_mode != LAB_INPUT_STATE_RESIZE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay_finish(&g_server.seat);
|
overlay_finish(&server.seat);
|
||||||
|
|
||||||
resize_indicator_hide(view);
|
resize_indicator_hide(view);
|
||||||
|
|
||||||
/* Restore keyboard/pointer focus */
|
/* Restore keyboard/pointer focus */
|
||||||
seat_focus_override_end(&g_server.seat, /*restore_focus*/ true);
|
seat_focus_override_end(&server.seat, /*restore_focus*/ true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
32
src/layers.c
32
src/layers.c
|
|
@ -79,7 +79,7 @@ layers_arrange(struct output *output)
|
||||||
apply_override(output, &usable_area);
|
apply_override(output, &usable_area);
|
||||||
|
|
||||||
struct wlr_scene_output *scene_output =
|
struct wlr_scene_output *scene_output =
|
||||||
wlr_scene_get_scene_output(g_server.scene, output->wlr_output);
|
wlr_scene_get_scene_output(server.scene, output->wlr_output);
|
||||||
if (!scene_output) {
|
if (!scene_output) {
|
||||||
wlr_log(WLR_DEBUG, "no wlr_scene_output");
|
wlr_log(WLR_DEBUG, "no wlr_scene_output");
|
||||||
return;
|
return;
|
||||||
|
|
@ -142,7 +142,7 @@ has_exclusive_interactivity(struct wlr_scene_layer_surface_v1 *scene)
|
||||||
static void
|
static void
|
||||||
try_to_focus_next_layer_or_toplevel(void)
|
try_to_focus_next_layer_or_toplevel(void)
|
||||||
{
|
{
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
struct output *output = output_nearest_to_cursor();
|
struct output *output = output_nearest_to_cursor();
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
goto no_output;
|
goto no_output;
|
||||||
|
|
@ -277,7 +277,7 @@ handle_surface_commit(struct wl_listener *listener, void *data)
|
||||||
* cursor-button-press).
|
* cursor-button-press).
|
||||||
*/
|
*/
|
||||||
if (is_on_demand(layer_surface)) {
|
if (is_on_demand(layer_surface)) {
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
if (seat->focused_layer == layer_surface) {
|
if (seat->focused_layer == layer_surface) {
|
||||||
/*
|
/*
|
||||||
* Must be change from EXCLUSIVE to ON_DEMAND,
|
* Must be change from EXCLUSIVE to ON_DEMAND,
|
||||||
|
|
@ -288,7 +288,7 @@ handle_surface_commit(struct wl_listener *listener, void *data)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* Handle EXCLUSIVE and NONE requests */
|
/* Handle EXCLUSIVE and NONE requests */
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
layer_try_set_focus(seat, layer_surface);
|
layer_try_set_focus(seat, layer_surface);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
|
@ -310,7 +310,7 @@ handle_node_destroy(struct wl_listener *listener, void *data)
|
||||||
struct lab_layer_surface *layer =
|
struct lab_layer_surface *layer =
|
||||||
wl_container_of(listener, layer, node_destroy);
|
wl_container_of(listener, layer, node_destroy);
|
||||||
|
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the surface of this node has the current keyboard focus, then we
|
* If the surface of this node has the current keyboard focus, then we
|
||||||
|
|
@ -372,7 +372,7 @@ handle_unmap(struct wl_listener *listener, void *data)
|
||||||
if (layer_surface->output) {
|
if (layer_surface->output) {
|
||||||
output_update_usable_area(layer_surface->output->data);
|
output_update_usable_area(layer_surface->output->data);
|
||||||
}
|
}
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
if (seat->focused_layer == layer_surface) {
|
if (seat->focused_layer == layer_surface) {
|
||||||
try_to_focus_next_layer_or_toplevel();
|
try_to_focus_next_layer_or_toplevel();
|
||||||
}
|
}
|
||||||
|
|
@ -422,7 +422,7 @@ handle_map(struct wl_listener *listener, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
layer_try_set_focus(seat, layer->scene_layer_surface->layer_surface);
|
layer_try_set_focus(seat, layer->scene_layer_surface->layer_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -437,7 +437,7 @@ handle_popup_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct lab_layer_popup *popup =
|
struct lab_layer_popup *popup =
|
||||||
wl_container_of(listener, popup, destroy);
|
wl_container_of(listener, popup, destroy);
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
struct wlr_xdg_popup *_popup, *tmp;
|
struct wlr_xdg_popup *_popup, *tmp;
|
||||||
wl_list_for_each_safe(_popup, tmp, &popup->wlr_popup->base->popups, link) {
|
wl_list_for_each_safe(_popup, tmp, &popup->wlr_popup->base->popups, link) {
|
||||||
|
|
@ -527,7 +527,7 @@ handle_popup_commit(struct wl_listener *listener, void *data)
|
||||||
popup->commit.notify = NULL;
|
popup->commit.notify = NULL;
|
||||||
|
|
||||||
/* Force focus when popup was triggered by IPC */
|
/* Force focus when popup was triggered by IPC */
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
bool requesting_grab = !!popup->wlr_popup->seat;
|
bool requesting_grab = !!popup->wlr_popup->seat;
|
||||||
if (requesting_grab) {
|
if (requesting_grab) {
|
||||||
if (surface_is_focused(seat, popup->wlr_popup->parent)) {
|
if (surface_is_focused(seat, popup->wlr_popup->parent)) {
|
||||||
|
|
@ -606,7 +606,7 @@ move_popup_to_top_layer(struct lab_layer_surface *toplevel,
|
||||||
toplevel->scene_layer_surface->layer_surface->output;
|
toplevel->scene_layer_surface->layer_surface->output;
|
||||||
struct output *output = (struct output *)wlr_output->data;
|
struct output *output = (struct output *)wlr_output->data;
|
||||||
struct wlr_box box = { 0 };
|
struct wlr_box box = { 0 };
|
||||||
wlr_output_layout_get_box(g_server.output_layout, wlr_output, &box);
|
wlr_output_layout_get_box(server.output_layout, wlr_output, &box);
|
||||||
int lx = toplevel->scene_layer_surface->tree->node.x + box.x;
|
int lx = toplevel->scene_layer_surface->tree->node.x + box.x;
|
||||||
int ly = toplevel->scene_layer_surface->tree->node.y + box.y;
|
int ly = toplevel->scene_layer_surface->tree->node.y + box.y;
|
||||||
|
|
||||||
|
|
@ -631,7 +631,7 @@ handle_new_popup(struct wl_listener *listener, void *data)
|
||||||
wlr_scene_node_coords(&surface->tree->node, &lx, &ly);
|
wlr_scene_node_coords(&surface->tree->node, &lx, &ly);
|
||||||
|
|
||||||
struct wlr_box output_box = { 0 };
|
struct wlr_box output_box = { 0 };
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
output->wlr_output, &output_box);
|
output->wlr_output, &output_box);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -727,15 +727,15 @@ handle_new_layer_surface(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
layers_init(void)
|
layers_init(void)
|
||||||
{
|
{
|
||||||
g_server.layer_shell = wlr_layer_shell_v1_create(g_server.wl_display,
|
server.layer_shell = wlr_layer_shell_v1_create(server.wl_display,
|
||||||
LAB_LAYERSHELL_VERSION);
|
LAB_LAYERSHELL_VERSION);
|
||||||
g_server.new_layer_surface.notify = handle_new_layer_surface;
|
server.new_layer_surface.notify = handle_new_layer_surface;
|
||||||
wl_signal_add(&g_server.layer_shell->events.new_surface,
|
wl_signal_add(&server.layer_shell->events.new_surface,
|
||||||
&g_server.new_layer_surface);
|
&server.new_layer_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
layers_finish(void)
|
layers_finish(void)
|
||||||
{
|
{
|
||||||
wl_list_remove(&g_server.new_layer_surface.link);
|
wl_list_remove(&server.new_layer_surface.link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ box_logical_to_physical(struct wlr_box *box, struct wlr_output *output)
|
||||||
void
|
void
|
||||||
magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box *damage)
|
magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct wlr_box *damage)
|
||||||
{
|
{
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
bool fullscreen = (rc.mag_width == -1 || rc.mag_height == -1);
|
bool fullscreen = (rc.mag_width == -1 || rc.mag_height == -1);
|
||||||
|
|
||||||
struct wlr_box output_box = {
|
struct wlr_box output_box = {
|
||||||
|
|
@ -50,9 +50,9 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Cursor position in per-output logical coordinate */
|
/* Cursor position in per-output logical coordinate */
|
||||||
double cursor_logical_x = g_server.seat.cursor->x;
|
double cursor_logical_x = server.seat.cursor->x;
|
||||||
double cursor_logical_y = g_server.seat.cursor->y;
|
double cursor_logical_y = server.seat.cursor->y;
|
||||||
wlr_output_layout_output_coords(g_server.output_layout,
|
wlr_output_layout_output_coords(server.output_layout,
|
||||||
output->wlr_output, &cursor_logical_x, &cursor_logical_y);
|
output->wlr_output, &cursor_logical_x, &cursor_logical_y);
|
||||||
/* Cursor position in per-output physical coordinate */
|
/* Cursor position in per-output physical coordinate */
|
||||||
struct wlr_box cursor_pos = {
|
struct wlr_box cursor_pos = {
|
||||||
|
|
@ -95,7 +95,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
|
||||||
}
|
}
|
||||||
if (!tmp_buffer) {
|
if (!tmp_buffer) {
|
||||||
tmp_buffer = wlr_allocator_create_buffer(
|
tmp_buffer = wlr_allocator_create_buffer(
|
||||||
g_server.allocator, mag_box.width, mag_box.height,
|
server.allocator, mag_box.width, mag_box.height,
|
||||||
&output->wlr_output->swapchain->format);
|
&output->wlr_output->swapchain->format);
|
||||||
}
|
}
|
||||||
if (!tmp_buffer) {
|
if (!tmp_buffer) {
|
||||||
|
|
@ -104,7 +104,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp_texture) {
|
if (!tmp_texture) {
|
||||||
tmp_texture = wlr_texture_from_buffer(g_server.renderer, tmp_buffer);
|
tmp_texture = wlr_texture_from_buffer(server.renderer, tmp_buffer);
|
||||||
}
|
}
|
||||||
if (!tmp_texture) {
|
if (!tmp_texture) {
|
||||||
wlr_log(WLR_ERROR, "Failed to allocate temporary magnifier texture");
|
wlr_log(WLR_ERROR, "Failed to allocate temporary magnifier texture");
|
||||||
|
|
@ -115,7 +115,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
|
||||||
|
|
||||||
/* Extract source region into temporary buffer */
|
/* Extract source region into temporary buffer */
|
||||||
struct wlr_render_pass *tmp_render_pass = wlr_renderer_begin_buffer_pass(
|
struct wlr_render_pass *tmp_render_pass = wlr_renderer_begin_buffer_pass(
|
||||||
g_server.renderer, tmp_buffer, NULL);
|
server.renderer, tmp_buffer, NULL);
|
||||||
if (!tmp_render_pass) {
|
if (!tmp_render_pass) {
|
||||||
wlr_log(WLR_ERROR, "Failed to begin magnifier render pass");
|
wlr_log(WLR_ERROR, "Failed to begin magnifier render pass");
|
||||||
return;
|
return;
|
||||||
|
|
@ -123,7 +123,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
|
||||||
|
|
||||||
wlr_buffer_lock(output_buffer);
|
wlr_buffer_lock(output_buffer);
|
||||||
struct wlr_texture *output_texture = wlr_texture_from_buffer(
|
struct wlr_texture *output_texture = wlr_texture_from_buffer(
|
||||||
g_server.renderer, output_buffer);
|
server.renderer, output_buffer);
|
||||||
if (!output_texture) {
|
if (!output_texture) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
@ -150,7 +150,7 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w
|
||||||
|
|
||||||
/* Render to the output buffer itself */
|
/* Render to the output buffer itself */
|
||||||
tmp_render_pass = wlr_renderer_begin_buffer_pass(
|
tmp_render_pass = wlr_renderer_begin_buffer_pass(
|
||||||
g_server.renderer, output_buffer, NULL);
|
server.renderer, output_buffer, NULL);
|
||||||
if (!tmp_render_pass) {
|
if (!tmp_render_pass) {
|
||||||
wlr_log(WLR_ERROR, "Failed to begin second magnifier render pass");
|
wlr_log(WLR_ERROR, "Failed to begin second magnifier render pass");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
@ -223,7 +223,7 @@ output_wants_magnification(struct output *output)
|
||||||
{
|
{
|
||||||
static double x = -1;
|
static double x = -1;
|
||||||
static double y = -1;
|
static double y = -1;
|
||||||
struct wlr_cursor *cursor = g_server.seat.cursor;
|
struct wlr_cursor *cursor = server.seat.cursor;
|
||||||
if (!magnify_on) {
|
if (!magnify_on) {
|
||||||
x = -1;
|
x = -1;
|
||||||
y = -1;
|
y = -1;
|
||||||
|
|
@ -241,8 +241,8 @@ static void
|
||||||
enable_magnifier(bool enable)
|
enable_magnifier(bool enable)
|
||||||
{
|
{
|
||||||
magnify_on = enable;
|
magnify_on = enable;
|
||||||
g_server.scene->WLR_PRIVATE.direct_scanout = enable ? false
|
server.scene->WLR_PRIVATE.direct_scanout = enable ? false
|
||||||
: g_server.direct_scanout_enabled;
|
: server.direct_scanout_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toggles magnification on and off */
|
/* Toggles magnification on and off */
|
||||||
|
|
|
||||||
14
src/main.c
14
src/main.c
|
|
@ -23,7 +23,7 @@
|
||||||
* struct just adds noise to the code.
|
* struct just adds noise to the code.
|
||||||
*/
|
*/
|
||||||
struct rcxml rc = { 0 };
|
struct rcxml rc = { 0 };
|
||||||
struct server g_server = { 0 };
|
struct server server = { 0 };
|
||||||
|
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"config", required_argument, NULL, 'c'},
|
{"config", required_argument, NULL, 'c'},
|
||||||
|
|
@ -142,11 +142,11 @@ idle_callback(void *data)
|
||||||
|
|
||||||
/* Start session-manager if one is specified by -S|--session */
|
/* Start session-manager if one is specified by -S|--session */
|
||||||
if (ctx->primary_client) {
|
if (ctx->primary_client) {
|
||||||
g_server.primary_client_pid = spawn_primary_client(ctx->primary_client);
|
server.primary_client_pid = spawn_primary_client(ctx->primary_client);
|
||||||
if (g_server.primary_client_pid < 0) {
|
if (server.primary_client_pid < 0) {
|
||||||
wlr_log(WLR_ERROR, "fatal error starting primary client: %s",
|
wlr_log(WLR_ERROR, "fatal error starting primary client: %s",
|
||||||
ctx->primary_client);
|
ctx->primary_client);
|
||||||
wl_display_terminate(g_server.wl_display);
|
wl_display_terminate(server.wl_display);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,7 @@ main(int argc, char *argv[])
|
||||||
struct theme theme = { 0 };
|
struct theme theme = { 0 };
|
||||||
theme_init(&theme, rc.theme_name);
|
theme_init(&theme, rc.theme_name);
|
||||||
rc.theme = &theme;
|
rc.theme = &theme;
|
||||||
g_server.theme = &theme;
|
server.theme = &theme;
|
||||||
|
|
||||||
menu_init();
|
menu_init();
|
||||||
|
|
||||||
|
|
@ -269,9 +269,9 @@ main(int argc, char *argv[])
|
||||||
.primary_client = primary_client,
|
.primary_client = primary_client,
|
||||||
.startup_cmd = startup_cmd
|
.startup_cmd = startup_cmd
|
||||||
};
|
};
|
||||||
wl_event_loop_add_idle(g_server.wl_event_loop, idle_callback, &idle_ctx);
|
wl_event_loop_add_idle(server.wl_event_loop, idle_callback, &idle_ctx);
|
||||||
|
|
||||||
wl_display_run(g_server.wl_display);
|
wl_display_run(server.wl_display);
|
||||||
|
|
||||||
session_shutdown();
|
session_shutdown();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ static bool
|
||||||
is_unique_id(const char *id)
|
is_unique_id(const char *id)
|
||||||
{
|
{
|
||||||
struct menu *menu;
|
struct menu *menu;
|
||||||
wl_list_for_each(menu, &g_server.menus, link) {
|
wl_list_for_each(menu, &server.menus, link) {
|
||||||
if (!strcmp(menu->id, id)) {
|
if (!strcmp(menu->id, id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ menu_create(struct menu *parent, const char *id,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct menu *menu = znew(*menu);
|
struct menu *menu = znew(*menu);
|
||||||
wl_list_append(&g_server.menus, &menu->link);
|
wl_list_append(&server.menus, &menu->link);
|
||||||
|
|
||||||
wl_list_init(&menu->menuitems);
|
wl_list_init(&menu->menuitems);
|
||||||
menu->id = xstrdup(id);
|
menu->id = xstrdup(id);
|
||||||
|
|
@ -91,7 +91,7 @@ menu_get_by_id(const char *id)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct menu *menu;
|
struct menu *menu;
|
||||||
wl_list_for_each(menu, &g_server.menus, link) {
|
wl_list_for_each(menu, &server.menus, link) {
|
||||||
if (!strcmp(menu->id, id)) {
|
if (!strcmp(menu->id, id)) {
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +124,7 @@ static void
|
||||||
validate(void)
|
validate(void)
|
||||||
{
|
{
|
||||||
struct menu *menu;
|
struct menu *menu;
|
||||||
wl_list_for_each(menu, &g_server.menus, link) {
|
wl_list_for_each(menu, &server.menus, link) {
|
||||||
validate_menu(menu);
|
validate_menu(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ item_create(struct menu *menu, const char *text, const char *icon_name, bool sho
|
||||||
assert(menu);
|
assert(menu);
|
||||||
assert(text);
|
assert(text);
|
||||||
|
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct menuitem *menuitem = znew(*menuitem);
|
struct menuitem *menuitem = znew(*menuitem);
|
||||||
menuitem->parent = menu;
|
menuitem->parent = menu;
|
||||||
menuitem->selectable = true;
|
menuitem->selectable = true;
|
||||||
|
|
@ -166,7 +166,7 @@ item_create_scene_for_state(struct menuitem *item, float *text_color,
|
||||||
float *bg_color)
|
float *bg_color)
|
||||||
{
|
{
|
||||||
struct menu *menu = item->parent;
|
struct menu *menu = item->parent;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
/* Tree to hold background and label buffers */
|
/* Tree to hold background and label buffers */
|
||||||
struct wlr_scene_tree *tree = lab_wlr_scene_tree_create(item->tree);
|
struct wlr_scene_tree *tree = lab_wlr_scene_tree_create(item->tree);
|
||||||
|
|
@ -242,7 +242,7 @@ item_create_scene(struct menuitem *menuitem, int *item_y)
|
||||||
assert(menuitem);
|
assert(menuitem);
|
||||||
assert(menuitem->type == LAB_MENU_ITEM);
|
assert(menuitem->type == LAB_MENU_ITEM);
|
||||||
struct menu *menu = menuitem->parent;
|
struct menu *menu = menuitem->parent;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
/* Menu item root node */
|
/* Menu item root node */
|
||||||
menuitem->tree = lab_wlr_scene_tree_create(menu->scene_tree);
|
menuitem->tree = lab_wlr_scene_tree_create(menu->scene_tree);
|
||||||
|
|
@ -291,7 +291,7 @@ separator_create_scene(struct menuitem *menuitem, int *item_y)
|
||||||
assert(menuitem);
|
assert(menuitem);
|
||||||
assert(menuitem->type == LAB_MENU_SEPARATOR_LINE);
|
assert(menuitem->type == LAB_MENU_SEPARATOR_LINE);
|
||||||
struct menu *menu = menuitem->parent;
|
struct menu *menu = menuitem->parent;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
/* Menu item root node */
|
/* Menu item root node */
|
||||||
menuitem->tree = lab_wlr_scene_tree_create(menu->scene_tree);
|
menuitem->tree = lab_wlr_scene_tree_create(menu->scene_tree);
|
||||||
|
|
@ -337,7 +337,7 @@ title_create_scene(struct menuitem *menuitem, int *item_y)
|
||||||
assert(menuitem);
|
assert(menuitem);
|
||||||
assert(menuitem->type == LAB_MENU_TITLE);
|
assert(menuitem->type == LAB_MENU_TITLE);
|
||||||
struct menu *menu = menuitem->parent;
|
struct menu *menu = menuitem->parent;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
float *bg_color = theme->menu_title_bg_color;
|
float *bg_color = theme->menu_title_bg_color;
|
||||||
float *text_color = theme->menu_title_text_color;
|
float *text_color = theme->menu_title_text_color;
|
||||||
|
|
||||||
|
|
@ -411,11 +411,11 @@ static void
|
||||||
menu_create_scene(struct menu *menu)
|
menu_create_scene(struct menu *menu)
|
||||||
{
|
{
|
||||||
struct menuitem *item;
|
struct menuitem *item;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
assert(!menu->scene_tree);
|
assert(!menu->scene_tree);
|
||||||
|
|
||||||
menu->scene_tree = lab_wlr_scene_tree_create(g_server.menu_tree);
|
menu->scene_tree = lab_wlr_scene_tree_create(server.menu_tree);
|
||||||
wlr_scene_node_set_enabled(&menu->scene_tree->node, false);
|
wlr_scene_node_set_enabled(&menu->scene_tree->node, false);
|
||||||
|
|
||||||
/* Menu width is the maximum item width, capped by menu.width.{min,max} */
|
/* Menu width is the maximum item width, capped by menu.width.{min,max} */
|
||||||
|
|
@ -780,7 +780,7 @@ menu_hide_submenu(const char *id)
|
||||||
if (!hide_menu) {
|
if (!hide_menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_list_for_each(menu, &g_server.menus, link) {
|
wl_list_for_each(menu, &server.menus, link) {
|
||||||
struct menuitem *item, *next;
|
struct menuitem *item, *next;
|
||||||
wl_list_for_each_safe(item, next, &menu->menuitems, link) {
|
wl_list_for_each_safe(item, next, &menu->menuitems, link) {
|
||||||
if (item->submenu == hide_menu) {
|
if (item->submenu == hide_menu) {
|
||||||
|
|
@ -821,8 +821,8 @@ update_client_send_to_menu(void)
|
||||||
* GoToDesktop will be called as part of the action.
|
* GoToDesktop will be called as part of the action.
|
||||||
*/
|
*/
|
||||||
struct buf buf = BUF_INIT;
|
struct buf buf = BUF_INIT;
|
||||||
wl_list_for_each(workspace, &g_server.workspaces.all, link) {
|
wl_list_for_each(workspace, &server.workspaces.all, link) {
|
||||||
if (workspace == g_server.workspaces.current) {
|
if (workspace == server.workspaces.current) {
|
||||||
buf_add_fmt(&buf, ">%s<", workspace->name);
|
buf_add_fmt(&buf, ">%s<", workspace->name);
|
||||||
} else {
|
} else {
|
||||||
buf_add(&buf, workspace->name);
|
buf_add(&buf, workspace->name);
|
||||||
|
|
@ -866,20 +866,20 @@ update_client_list_combined_menu(void)
|
||||||
struct view *view;
|
struct view *view;
|
||||||
struct buf buffer = BUF_INIT;
|
struct buf buffer = BUF_INIT;
|
||||||
|
|
||||||
wl_list_for_each(workspace, &g_server.workspaces.all, link) {
|
wl_list_for_each(workspace, &server.workspaces.all, link) {
|
||||||
buf_add_fmt(&buffer, workspace == g_server.workspaces.current ? ">%s<" : "%s",
|
buf_add_fmt(&buffer, workspace == server.workspaces.current ? ">%s<" : "%s",
|
||||||
workspace->name);
|
workspace->name);
|
||||||
separator_create(menu, buffer.data);
|
separator_create(menu, buffer.data);
|
||||||
buf_clear(&buffer);
|
buf_clear(&buffer);
|
||||||
|
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
if (view->workspace == workspace) {
|
if (view->workspace == workspace) {
|
||||||
if (!view->foreign_toplevel
|
if (!view->foreign_toplevel
|
||||||
|| string_null_or_empty(view->title)) {
|
|| string_null_or_empty(view->title)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view == g_server.active_view) {
|
if (view == server.active_view) {
|
||||||
buf_add(&buffer, "*");
|
buf_add(&buffer, "*");
|
||||||
}
|
}
|
||||||
if (view->minimized) {
|
if (view->minimized) {
|
||||||
|
|
@ -966,7 +966,7 @@ init_windowmenu(void)
|
||||||
void
|
void
|
||||||
menu_init(void)
|
menu_init(void)
|
||||||
{
|
{
|
||||||
wl_list_init(&g_server.menus);
|
wl_list_init(&server.menus);
|
||||||
|
|
||||||
/* Just create placeholder. Contents will be created when launched */
|
/* Just create placeholder. Contents will be created when launched */
|
||||||
menu_create(NULL, "client-list-combined-menu", _("Windows"));
|
menu_create(NULL, "client-list-combined-menu", _("Windows"));
|
||||||
|
|
@ -982,7 +982,7 @@ static void
|
||||||
nullify_item_pointing_to_this_menu(struct menu *menu)
|
nullify_item_pointing_to_this_menu(struct menu *menu)
|
||||||
{
|
{
|
||||||
struct menu *iter;
|
struct menu *iter;
|
||||||
wl_list_for_each(iter, &g_server.menus, link) {
|
wl_list_for_each(iter, &server.menus, link) {
|
||||||
struct menuitem *item;
|
struct menuitem *item;
|
||||||
wl_list_for_each(item, &iter->menuitems, link) {
|
wl_list_for_each(item, &iter->menuitems, link) {
|
||||||
if (item->submenu == menu) {
|
if (item->submenu == menu) {
|
||||||
|
|
@ -1013,7 +1013,7 @@ menu_free(struct menu *menu)
|
||||||
/* Keep items clean on pipemenu destruction */
|
/* Keep items clean on pipemenu destruction */
|
||||||
nullify_item_pointing_to_this_menu(menu);
|
nullify_item_pointing_to_this_menu(menu);
|
||||||
|
|
||||||
if (g_server.menu_current == menu) {
|
if (server.menu_current == menu) {
|
||||||
menu_close_root();
|
menu_close_root();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1046,7 +1046,7 @@ void
|
||||||
menu_finish(void)
|
menu_finish(void)
|
||||||
{
|
{
|
||||||
struct menu *menu, *tmp_menu;
|
struct menu *menu, *tmp_menu;
|
||||||
wl_list_for_each_safe(menu, tmp_menu, &g_server.menus, link) {
|
wl_list_for_each_safe(menu, tmp_menu, &server.menus, link) {
|
||||||
menu_free(menu);
|
menu_free(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1055,8 +1055,8 @@ void
|
||||||
menu_on_view_destroy(struct view *view)
|
menu_on_view_destroy(struct view *view)
|
||||||
{
|
{
|
||||||
/* If the view being destroy has an open window menu, then close it */
|
/* If the view being destroy has an open window menu, then close it */
|
||||||
if (g_server.menu_current
|
if (server.menu_current
|
||||||
&& g_server.menu_current->triggered_by_view == view) {
|
&& server.menu_current->triggered_by_view == view) {
|
||||||
menu_close_root();
|
menu_close_root();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1108,10 +1108,10 @@ static void
|
||||||
reset_pipemenus(void)
|
reset_pipemenus(void)
|
||||||
{
|
{
|
||||||
wlr_log(WLR_DEBUG, "number of menus before close=%d",
|
wlr_log(WLR_DEBUG, "number of menus before close=%d",
|
||||||
wl_list_length(&g_server.menus));
|
wl_list_length(&server.menus));
|
||||||
|
|
||||||
struct menu *iter, *tmp;
|
struct menu *iter, *tmp;
|
||||||
wl_list_for_each_safe(iter, tmp, &g_server.menus, link) {
|
wl_list_for_each_safe(iter, tmp, &server.menus, link) {
|
||||||
if (iter->is_pipemenu_child) {
|
if (iter->is_pipemenu_child) {
|
||||||
/* Destroy submenus of pipemenus */
|
/* Destroy submenus of pipemenus */
|
||||||
menu_free(iter);
|
menu_free(iter);
|
||||||
|
|
@ -1125,7 +1125,7 @@ reset_pipemenus(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "number of menus after close=%d",
|
wlr_log(WLR_DEBUG, "number of menus after close=%d",
|
||||||
wl_list_length(&g_server.menus));
|
wl_list_length(&server.menus));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1179,11 +1179,11 @@ menu_open_root(struct menu *menu, int x, int y)
|
||||||
{
|
{
|
||||||
assert(menu);
|
assert(menu);
|
||||||
|
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!g_server.menu_current);
|
assert(!server.menu_current);
|
||||||
|
|
||||||
struct wlr_box anchor_rect = {.x = x, .y = y};
|
struct wlr_box anchor_rect = {.x = x, .y = y};
|
||||||
if (menu->execute) {
|
if (menu->execute) {
|
||||||
|
|
@ -1192,9 +1192,9 @@ menu_open_root(struct menu *menu, int x, int y)
|
||||||
open_menu(menu, anchor_rect);
|
open_menu(menu, anchor_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.menu_current = menu;
|
server.menu_current = menu;
|
||||||
selected_item = NULL;
|
selected_item = NULL;
|
||||||
seat_focus_override_begin(&g_server.seat,
|
seat_focus_override_begin(&server.seat,
|
||||||
LAB_INPUT_STATE_MENU, LAB_CURSOR_DEFAULT);
|
LAB_INPUT_STATE_MENU, LAB_CURSOR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1307,10 +1307,10 @@ open_pipemenu_async(struct menu *pipemenu, struct wlr_box anchor_rect)
|
||||||
ctx->pipemenu = pipemenu;
|
ctx->pipemenu = pipemenu;
|
||||||
pipemenu->pipe_ctx = ctx;
|
pipemenu->pipe_ctx = ctx;
|
||||||
|
|
||||||
ctx->event_read = wl_event_loop_add_fd(g_server.wl_event_loop,
|
ctx->event_read = wl_event_loop_add_fd(server.wl_event_loop,
|
||||||
pipe_fd, WL_EVENT_READABLE, handle_pipemenu_readable, ctx);
|
pipe_fd, WL_EVENT_READABLE, handle_pipemenu_readable, ctx);
|
||||||
|
|
||||||
ctx->event_timeout = wl_event_loop_add_timer(g_server.wl_event_loop,
|
ctx->event_timeout = wl_event_loop_add_timer(server.wl_event_loop,
|
||||||
handle_pipemenu_timeout, ctx);
|
handle_pipemenu_timeout, ctx);
|
||||||
wl_event_source_timer_update(ctx->event_timeout, PIPEMENU_TIMEOUT_IN_MS);
|
wl_event_source_timer_update(ctx->event_timeout, PIPEMENU_TIMEOUT_IN_MS);
|
||||||
|
|
||||||
|
|
@ -1351,7 +1351,7 @@ menu_process_item_selection(struct menuitem *item)
|
||||||
item->submenu->parent = item->parent;
|
item->submenu->parent = item->parent;
|
||||||
/* And open the new submenu tree */
|
/* And open the new submenu tree */
|
||||||
struct wlr_box anchor_rect =
|
struct wlr_box anchor_rect =
|
||||||
get_item_anchor_rect(g_server.theme, item);
|
get_item_anchor_rect(server.theme, item);
|
||||||
if (item->submenu->execute && !item->submenu->scene_tree) {
|
if (item->submenu->execute && !item->submenu->scene_tree) {
|
||||||
open_pipemenu_async(item->submenu, anchor_rect);
|
open_pipemenu_async(item->submenu, anchor_rect);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1366,7 +1366,7 @@ menu_process_item_selection(struct menuitem *item)
|
||||||
static struct menu *
|
static struct menu *
|
||||||
get_selection_leaf(void)
|
get_selection_leaf(void)
|
||||||
{
|
{
|
||||||
struct menu *menu = g_server.menu_current;
|
struct menu *menu = server.menu_current;
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1420,9 +1420,9 @@ menu_execute_item(struct menuitem *item)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_close(g_server.menu_current);
|
menu_close(server.menu_current);
|
||||||
g_server.menu_current = NULL;
|
server.menu_current = NULL;
|
||||||
seat_focus_override_end(&g_server.seat, /*restore_focus*/ true);
|
seat_focus_override_end(&server.seat, /*restore_focus*/ true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We call the actions after closing the menu so that virtual keyboard
|
* We call the actions after closing the menu so that virtual keyboard
|
||||||
|
|
@ -1518,19 +1518,19 @@ menu_process_cursor_motion(struct wlr_scene_node *node)
|
||||||
void
|
void
|
||||||
menu_close_root(void)
|
menu_close_root(void)
|
||||||
{
|
{
|
||||||
assert(g_server.input_mode == LAB_INPUT_STATE_MENU);
|
assert(server.input_mode == LAB_INPUT_STATE_MENU);
|
||||||
assert(g_server.menu_current);
|
assert(server.menu_current);
|
||||||
|
|
||||||
menu_close(g_server.menu_current);
|
menu_close(server.menu_current);
|
||||||
g_server.menu_current = NULL;
|
server.menu_current = NULL;
|
||||||
reset_pipemenus();
|
reset_pipemenus();
|
||||||
seat_focus_override_end(&g_server.seat, /*restore_focus*/ true);
|
seat_focus_override_end(&server.seat, /*restore_focus*/ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
menu_reconfigure(void)
|
menu_reconfigure(void)
|
||||||
{
|
{
|
||||||
menu_finish();
|
menu_finish();
|
||||||
g_server.menu_current = NULL;
|
server.menu_current = NULL;
|
||||||
menu_init();
|
menu_init();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ output_virtual_add(const char *output_name,
|
||||||
if (output_name) {
|
if (output_name) {
|
||||||
/* Prevent creating outputs with the same name */
|
/* Prevent creating outputs with the same name */
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (wlr_output_is_headless(output->wlr_output) &&
|
if (wlr_output_is_headless(output->wlr_output) &&
|
||||||
!strcmp(output->wlr_output->name, output_name)) {
|
!strcmp(output->wlr_output->name, output_name)) {
|
||||||
wlr_log(WLR_DEBUG,
|
wlr_log(WLR_DEBUG,
|
||||||
|
|
@ -46,13 +46,13 @@ output_virtual_add(const char *output_name,
|
||||||
* we may end up calling the new output handler twice, one time manually
|
* we may end up calling the new output handler twice, one time manually
|
||||||
* and one time by the headless backend when it starts up and sends the
|
* and one time by the headless backend when it starts up and sends the
|
||||||
* signal for all its configured outputs. Rather than keeping a global
|
* signal for all its configured outputs. Rather than keeping a global
|
||||||
* g_server.headless.started state around that we could check here we just
|
* server.headless.started state around that we could check here we just
|
||||||
* ignore duplicated new output calls in handle_new_output().
|
* ignore duplicated new output calls in handle_new_output().
|
||||||
*/
|
*/
|
||||||
wl_list_remove(&g_server.new_output.link);
|
wl_list_remove(&server.new_output.link);
|
||||||
|
|
||||||
struct wlr_output *wlr_output = wlr_headless_add_output(
|
struct wlr_output *wlr_output = wlr_headless_add_output(
|
||||||
g_server.headless.backend, 1920, 1080);
|
server.headless.backend, 1920, 1080);
|
||||||
|
|
||||||
if (!wlr_output) {
|
if (!wlr_output) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create virtual output %s",
|
wlr_log(WLR_ERROR, "Failed to create virtual output %s",
|
||||||
|
|
@ -69,20 +69,20 @@ output_virtual_add(const char *output_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify about the new output manually */
|
/* Notify about the new output manually */
|
||||||
if (g_server.new_output.notify) {
|
if (server.new_output.notify) {
|
||||||
g_server.new_output.notify(&g_server.new_output, wlr_output);
|
server.new_output.notify(&server.new_output, wlr_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_handler:
|
restore_handler:
|
||||||
/* And finally restore output notifications */
|
/* And finally restore output notifications */
|
||||||
wl_signal_add(&g_server.backend->events.new_output, &g_server.new_output);
|
wl_signal_add(&server.backend->events.new_output, &server.new_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
output_virtual_remove(const char *output_name)
|
output_virtual_remove(const char *output_name)
|
||||||
{
|
{
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!wlr_output_is_headless(output->wlr_output)
|
if (!wlr_output_is_headless(output->wlr_output)
|
||||||
|| output->wlr_output == fallback_output) {
|
|| output->wlr_output == fallback_output) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -111,7 +111,7 @@ output_virtual_remove(const char *output_name)
|
||||||
void
|
void
|
||||||
output_virtual_update_fallback(void)
|
output_virtual_update_fallback(void)
|
||||||
{
|
{
|
||||||
struct wl_list *layout_outputs = &g_server.output_layout->outputs;
|
struct wl_list *layout_outputs = &server.output_layout->outputs;
|
||||||
const char *fallback_output_name = getenv("LABWC_FALLBACK_OUTPUT");
|
const char *fallback_output_name = getenv("LABWC_FALLBACK_OUTPUT");
|
||||||
|
|
||||||
if (!fallback_output && wl_list_empty(layout_outputs)
|
if (!fallback_output && wl_list_empty(layout_outputs)
|
||||||
|
|
|
||||||
184
src/output.c
184
src/output.c
|
|
@ -51,7 +51,7 @@ output_get_tearing_allowance(struct output *output)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *view = g_server.active_view;
|
struct view *view = server.active_view;
|
||||||
|
|
||||||
/* tearing is only allowed for the output with the active view */
|
/* tearing is only allowed for the output with the active view */
|
||||||
if (!view || view->output != output) {
|
if (!view || view->output != output) {
|
||||||
|
|
@ -96,7 +96,7 @@ output_apply_gamma(struct output *output)
|
||||||
output->gamma_lut_changed = false;
|
output->gamma_lut_changed = false;
|
||||||
struct wlr_gamma_control_v1 *gamma_control =
|
struct wlr_gamma_control_v1 *gamma_control =
|
||||||
wlr_gamma_control_manager_v1_get_control(
|
wlr_gamma_control_manager_v1_get_control(
|
||||||
g_server.gamma_control_manager_v1,
|
server.gamma_control_manager_v1,
|
||||||
output->wlr_output);
|
output->wlr_output);
|
||||||
|
|
||||||
if (!wlr_gamma_control_v1_apply(gamma_control, &pending)) {
|
if (!wlr_gamma_control_v1_apply(gamma_control, &pending)) {
|
||||||
|
|
@ -126,7 +126,7 @@ handle_output_frame(struct wl_listener *listener, void *data)
|
||||||
/*
|
/*
|
||||||
* skip painting the session when it exists but is not active.
|
* skip painting the session when it exists but is not active.
|
||||||
*/
|
*/
|
||||||
if (g_server.session && !g_server.session->active) {
|
if (server.session && !server.session->active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ static void
|
||||||
handle_output_destroy(struct wl_listener *listener, void *data)
|
handle_output_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct output *output = wl_container_of(listener, output, destroy);
|
struct output *output = wl_container_of(listener, output, destroy);
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
regions_evacuate_output(output);
|
regions_evacuate_output(output);
|
||||||
regions_destroy(seat, &output->regions);
|
regions_destroy(seat, &output->regions);
|
||||||
if (seat->overlay.active.output == output) {
|
if (seat->overlay.active.output == output) {
|
||||||
|
|
@ -181,7 +181,7 @@ handle_output_destroy(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
if (view->output == output) {
|
if (view->output == output) {
|
||||||
view_on_output_destroy(view);
|
view_on_output_destroy(view);
|
||||||
}
|
}
|
||||||
|
|
@ -201,13 +201,13 @@ handle_output_destroy(struct wl_listener *listener, void *data)
|
||||||
* windows and cannot be reconnected. Exit the compositor
|
* windows and cannot be reconnected. Exit the compositor
|
||||||
* when the last one is destroyed.
|
* when the last one is destroyed.
|
||||||
*/
|
*/
|
||||||
if (wl_list_empty(&g_server.outputs) && (
|
if (wl_list_empty(&server.outputs) && (
|
||||||
wlr_output_is_wl(output->wlr_output)
|
wlr_output_is_wl(output->wlr_output)
|
||||||
#if WLR_HAS_X11_BACKEND
|
#if WLR_HAS_X11_BACKEND
|
||||||
|| wlr_output_is_x11(output->wlr_output)
|
|| wlr_output_is_x11(output->wlr_output)
|
||||||
#endif
|
#endif
|
||||||
)) {
|
)) {
|
||||||
wl_display_terminate(g_server.wl_display);
|
wl_display_terminate(server.wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -263,7 +263,7 @@ add_output_to_layout(struct output *output)
|
||||||
{
|
{
|
||||||
struct wlr_output *wlr_output = output->wlr_output;
|
struct wlr_output *wlr_output = output->wlr_output;
|
||||||
struct wlr_output_layout_output *layout_output =
|
struct wlr_output_layout_output *layout_output =
|
||||||
wlr_output_layout_add_auto(g_server.output_layout, wlr_output);
|
wlr_output_layout_add_auto(server.output_layout, wlr_output);
|
||||||
if (!layout_output) {
|
if (!layout_output) {
|
||||||
wlr_log(WLR_ERROR, "unable to add output to layout");
|
wlr_log(WLR_ERROR, "unable to add output to layout");
|
||||||
return;
|
return;
|
||||||
|
|
@ -271,7 +271,7 @@ add_output_to_layout(struct output *output)
|
||||||
|
|
||||||
if (!output->scene_output) {
|
if (!output->scene_output) {
|
||||||
output->scene_output =
|
output->scene_output =
|
||||||
wlr_scene_output_create(g_server.scene, wlr_output);
|
wlr_scene_output_create(server.scene, wlr_output);
|
||||||
if (!output->scene_output) {
|
if (!output->scene_output) {
|
||||||
wlr_log(WLR_ERROR, "unable to create scene output");
|
wlr_log(WLR_ERROR, "unable to create scene output");
|
||||||
return;
|
return;
|
||||||
|
|
@ -281,21 +281,21 @@ add_output_to_layout(struct output *output)
|
||||||
* safe to call twice, so we call it only when initially
|
* safe to call twice, so we call it only when initially
|
||||||
* creating the scene_output.
|
* creating the scene_output.
|
||||||
*/
|
*/
|
||||||
wlr_scene_output_layout_add_output(g_server.scene_layout,
|
wlr_scene_output_layout_add_output(server.scene_layout,
|
||||||
layout_output, output->scene_output);
|
layout_output, output->scene_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
lab_cosmic_workspace_group_output_enter(
|
lab_cosmic_workspace_group_output_enter(
|
||||||
g_server.workspaces.cosmic_group, output->wlr_output);
|
server.workspaces.cosmic_group, output->wlr_output);
|
||||||
lab_ext_workspace_group_output_enter(
|
lab_ext_workspace_group_output_enter(
|
||||||
g_server.workspaces.ext_group, output->wlr_output);
|
server.workspaces.ext_group, output->wlr_output);
|
||||||
|
|
||||||
/* (Re-)create regions from config */
|
/* (Re-)create regions from config */
|
||||||
regions_reconfigure_output(output);
|
regions_reconfigure_output(output);
|
||||||
|
|
||||||
/* Create lock surface if needed */
|
/* Create lock surface if needed */
|
||||||
if (g_server.session_lock_manager->locked) {
|
if (server.session_lock_manager->locked) {
|
||||||
session_lock_output_create(g_server.session_lock_manager, output);
|
session_lock_output_create(server.session_lock_manager, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,9 +413,9 @@ configure_new_output(struct output *output)
|
||||||
* calling do_output_layout_change(); this ensures that the
|
* calling do_output_layout_change(); this ensures that the
|
||||||
* wlr_output_cursor is created for the new output.
|
* wlr_output_cursor is created for the new output.
|
||||||
*/
|
*/
|
||||||
g_server.pending_output_layout_change++;
|
server.pending_output_layout_change++;
|
||||||
add_output_to_layout(output);
|
add_output_to_layout(output);
|
||||||
g_server.pending_output_layout_change--;
|
server.pending_output_layout_change--;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t
|
static uint64_t
|
||||||
|
|
@ -423,7 +423,7 @@ get_unused_output_id_bit(void)
|
||||||
{
|
{
|
||||||
uint64_t used_id_bits = 0;
|
uint64_t used_id_bits = 0;
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
used_id_bits |= output->id_bit;
|
used_id_bits |= output->id_bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -431,7 +431,7 @@ get_unused_output_id_bit(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t id_bit = g_server.next_output_id_bit;
|
uint64_t id_bit = server.next_output_id_bit;
|
||||||
/*
|
/*
|
||||||
* __builtin_popcountll() should be supported by GCC & clang.
|
* __builtin_popcountll() should be supported by GCC & clang.
|
||||||
* If it causes portability issues, just remove the assert.
|
* If it causes portability issues, just remove the assert.
|
||||||
|
|
@ -448,7 +448,7 @@ get_unused_output_id_bit(void)
|
||||||
* can cycle through all 64 available bits, making re-use less
|
* can cycle through all 64 available bits, making re-use less
|
||||||
* frequent (on a best-effort basis).
|
* frequent (on a best-effort basis).
|
||||||
*/
|
*/
|
||||||
g_server.next_output_id_bit = (id_bit << 1) | (id_bit >> 63);
|
server.next_output_id_bit = (id_bit << 1) | (id_bit >> 63);
|
||||||
|
|
||||||
return id_bit;
|
return id_bit;
|
||||||
}
|
}
|
||||||
|
|
@ -463,7 +463,7 @@ handle_new_output(struct wl_listener *listener, void *data)
|
||||||
struct wlr_output *wlr_output = data;
|
struct wlr_output *wlr_output = data;
|
||||||
|
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (output->wlr_output == wlr_output) {
|
if (output->wlr_output == wlr_output) {
|
||||||
/*
|
/*
|
||||||
* This is a duplicated notification.
|
* This is a duplicated notification.
|
||||||
|
|
@ -503,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.
|
* 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 LAB_WLR_VERSION_AT_LEAST(0, 19, 1)
|
||||||
if (g_server.drm_lease_manager && wlr_output_is_drm(wlr_output)) {
|
if (server.drm_lease_manager && wlr_output_is_drm(wlr_output)) {
|
||||||
wlr_drm_lease_v1_manager_offer_output(
|
wlr_drm_lease_v1_manager_offer_output(
|
||||||
g_server.drm_lease_manager, wlr_output);
|
server.drm_lease_manager, wlr_output);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -521,8 +521,8 @@ handle_new_output(struct wl_listener *listener, void *data)
|
||||||
* Configures the output created by the backend to use our allocator
|
* Configures the output created by the backend to use our allocator
|
||||||
* and our renderer. Must be done once, before committing the output
|
* and our renderer. Must be done once, before committing the output
|
||||||
*/
|
*/
|
||||||
if (!wlr_output_init_render(wlr_output, g_server.allocator,
|
if (!wlr_output_init_render(wlr_output, server.allocator,
|
||||||
g_server.renderer)) {
|
server.renderer)) {
|
||||||
wlr_log(WLR_ERROR, "unable to init output renderer");
|
wlr_log(WLR_ERROR, "unable to init output renderer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -533,7 +533,7 @@ handle_new_output(struct wl_listener *listener, void *data)
|
||||||
output->id_bit = id_bit;
|
output->id_bit = id_bit;
|
||||||
output_state_init(output);
|
output_state_init(output);
|
||||||
|
|
||||||
wl_list_insert(&g_server.outputs, &output->link);
|
wl_list_insert(&server.outputs, &output->link);
|
||||||
|
|
||||||
output->destroy.notify = handle_output_destroy;
|
output->destroy.notify = handle_output_destroy;
|
||||||
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
|
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
|
||||||
|
|
@ -551,11 +551,11 @@ handle_new_output(struct wl_listener *listener, void *data)
|
||||||
*/
|
*/
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(output->layer_tree); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(output->layer_tree); i++) {
|
||||||
output->layer_tree[i] =
|
output->layer_tree[i] =
|
||||||
lab_wlr_scene_tree_create(&g_server.scene->tree);
|
lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
}
|
}
|
||||||
output->layer_popup_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(&g_server.scene->tree);
|
output->cycle_osd_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
output->session_lock_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
output->session_lock_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the z-positions to achieve the following order (from top to
|
* Set the z-positions to achieve the following order (from top to
|
||||||
|
|
@ -573,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[1]->node);
|
||||||
wlr_scene_node_lower_to_bottom(&output->layer_tree[0]->node);
|
wlr_scene_node_lower_to_bottom(&output->layer_tree[0]->node);
|
||||||
|
|
||||||
struct wlr_scene_node *menu_node = &g_server.menu_tree->node;
|
struct wlr_scene_node *menu_node = &server.menu_tree->node;
|
||||||
wlr_scene_node_place_below(&output->layer_tree[2]->node, menu_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_tree[3]->node, menu_node);
|
||||||
wlr_scene_node_place_below(&output->layer_popup_tree->node, menu_node);
|
wlr_scene_node_place_below(&output->layer_popup_tree->node, menu_node);
|
||||||
|
|
@ -599,34 +599,34 @@ static void output_manager_init(void);
|
||||||
void
|
void
|
||||||
output_init(void)
|
output_init(void)
|
||||||
{
|
{
|
||||||
g_server.gamma_control_manager_v1 =
|
server.gamma_control_manager_v1 =
|
||||||
wlr_gamma_control_manager_v1_create(g_server.wl_display);
|
wlr_gamma_control_manager_v1_create(server.wl_display);
|
||||||
|
|
||||||
g_server.new_output.notify = handle_new_output;
|
server.new_output.notify = handle_new_output;
|
||||||
wl_signal_add(&g_server.backend->events.new_output, &g_server.new_output);
|
wl_signal_add(&server.backend->events.new_output, &server.new_output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create an output layout, which is a wlroots utility for working with
|
* Create an output layout, which is a wlroots utility for working with
|
||||||
* an arrangement of screens in a physical layout.
|
* an arrangement of screens in a physical layout.
|
||||||
*/
|
*/
|
||||||
g_server.output_layout = wlr_output_layout_create(g_server.wl_display);
|
server.output_layout = wlr_output_layout_create(server.wl_display);
|
||||||
if (!g_server.output_layout) {
|
if (!server.output_layout) {
|
||||||
wlr_log(WLR_ERROR, "unable to create output layout");
|
wlr_log(WLR_ERROR, "unable to create output layout");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
g_server.scene_layout = wlr_scene_attach_output_layout(g_server.scene,
|
server.scene_layout = wlr_scene_attach_output_layout(server.scene,
|
||||||
g_server.output_layout);
|
server.output_layout);
|
||||||
if (!g_server.scene_layout) {
|
if (!server.scene_layout) {
|
||||||
wlr_log(WLR_ERROR, "unable to create scene layout");
|
wlr_log(WLR_ERROR, "unable to create scene layout");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable screen recording with wf-recorder */
|
/* Enable screen recording with wf-recorder */
|
||||||
wlr_xdg_output_manager_v1_create(g_server.wl_display,
|
wlr_xdg_output_manager_v1_create(server.wl_display,
|
||||||
g_server.output_layout);
|
server.output_layout);
|
||||||
|
|
||||||
wl_list_init(&g_server.outputs);
|
wl_list_init(&server.outputs);
|
||||||
g_server.next_output_id_bit = (1 << 0);
|
server.next_output_id_bit = (1 << 0);
|
||||||
|
|
||||||
output_manager_init();
|
output_manager_init();
|
||||||
}
|
}
|
||||||
|
|
@ -636,7 +636,7 @@ static void output_manager_finish(void);
|
||||||
void
|
void
|
||||||
output_finish(void)
|
output_finish(void)
|
||||||
{
|
{
|
||||||
wl_list_remove(&g_server.new_output.link);
|
wl_list_remove(&server.new_output.link);
|
||||||
output_manager_finish();
|
output_manager_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -651,15 +651,15 @@ output_update_for_layout_change(void)
|
||||||
* align with the seat cursor. Re-set the cursor image so that
|
* align with the seat cursor. Re-set the cursor image so that
|
||||||
* the cursor isn't invisible on new outputs.
|
* the cursor isn't invisible on new outputs.
|
||||||
*/
|
*/
|
||||||
wlr_cursor_move(g_server.seat.cursor, NULL, 0, 0);
|
wlr_cursor_move(server.seat.cursor, NULL, 0, 0);
|
||||||
cursor_update_image(&g_server.seat);
|
cursor_update_image(&server.seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
output_config_apply(struct wlr_output_configuration_v1 *config)
|
output_config_apply(struct wlr_output_configuration_v1 *config)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
g_server.pending_output_layout_change++;
|
server.pending_output_layout_change++;
|
||||||
|
|
||||||
struct wlr_output_configuration_head_v1 *head;
|
struct wlr_output_configuration_head_v1 *head;
|
||||||
wl_list_for_each(head, &config->heads, link) {
|
wl_list_for_each(head, &config->heads, link) {
|
||||||
|
|
@ -708,7 +708,7 @@ output_config_apply(struct wlr_output_configuration_v1 *config)
|
||||||
* been enabled but not yet been added to the layout.
|
* been enabled but not yet been added to the layout.
|
||||||
*/
|
*/
|
||||||
bool was_in_layout =
|
bool was_in_layout =
|
||||||
!!wlr_output_layout_get(g_server.output_layout, o);
|
!!wlr_output_layout_get(server.output_layout, o);
|
||||||
|
|
||||||
if (output_enabled) {
|
if (output_enabled) {
|
||||||
if (!was_in_layout) {
|
if (!was_in_layout) {
|
||||||
|
|
@ -716,23 +716,23 @@ output_config_apply(struct wlr_output_configuration_v1 *config)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box pos = {0};
|
struct wlr_box pos = {0};
|
||||||
wlr_output_layout_get_box(g_server.output_layout, o, &pos);
|
wlr_output_layout_get_box(server.output_layout, o, &pos);
|
||||||
if (pos.x != head->state.x || pos.y != head->state.y) {
|
if (pos.x != head->state.x || pos.y != head->state.y) {
|
||||||
/*
|
/*
|
||||||
* This overrides the automatic layout
|
* This overrides the automatic layout
|
||||||
*
|
*
|
||||||
* wlr_output_layout_add() in fact means _move()
|
* wlr_output_layout_add() in fact means _move()
|
||||||
*/
|
*/
|
||||||
wlr_output_layout_add(g_server.output_layout, o,
|
wlr_output_layout_add(server.output_layout, o,
|
||||||
head->state.x, head->state.y);
|
head->state.x, head->state.y);
|
||||||
}
|
}
|
||||||
} else if (was_in_layout) {
|
} else if (was_in_layout) {
|
||||||
regions_evacuate_output(output);
|
regions_evacuate_output(output);
|
||||||
|
|
||||||
lab_cosmic_workspace_group_output_leave(
|
lab_cosmic_workspace_group_output_leave(
|
||||||
g_server.workspaces.cosmic_group, output->wlr_output);
|
server.workspaces.cosmic_group, output->wlr_output);
|
||||||
lab_ext_workspace_group_output_leave(
|
lab_ext_workspace_group_output_leave(
|
||||||
g_server.workspaces.ext_group, output->wlr_output);
|
server.workspaces.ext_group, output->wlr_output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At time of writing, wlr_output_layout_remove()
|
* At time of writing, wlr_output_layout_remove()
|
||||||
|
|
@ -743,12 +743,12 @@ output_config_apply(struct wlr_output_configuration_v1 *config)
|
||||||
* calling wlr_output_layout_remove().
|
* calling wlr_output_layout_remove().
|
||||||
*/
|
*/
|
||||||
wlr_scene_output_destroy(output->scene_output);
|
wlr_scene_output_destroy(output->scene_output);
|
||||||
wlr_output_layout_remove(g_server.output_layout, o);
|
wlr_output_layout_remove(server.output_layout, o);
|
||||||
output->scene_output = NULL;
|
output->scene_output = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.pending_output_layout_change--;
|
server.pending_output_layout_change--;
|
||||||
do_output_layout_change();
|
do_output_layout_change();
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
@ -839,14 +839,14 @@ handle_output_manager_apply(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
wlr_output_configuration_v1_destroy(config);
|
wlr_output_configuration_v1_destroy(config);
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
wlr_xcursor_manager_load(g_server.seat.xcursor_manager,
|
wlr_xcursor_manager_load(server.seat.xcursor_manager,
|
||||||
output->wlr_output->scale);
|
output->wlr_output->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-set cursor image in case scale changed */
|
/* Re-set cursor image in case scale changed */
|
||||||
cursor_update_focus();
|
cursor_update_focus();
|
||||||
cursor_update_image(&g_server.seat);
|
cursor_update_image(&server.seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -865,7 +865,7 @@ wlr_output_configuration_v1 *create_output_config(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
struct wlr_output_configuration_head_v1 *head =
|
struct wlr_output_configuration_head_v1 *head =
|
||||||
wlr_output_configuration_head_v1_create(config,
|
wlr_output_configuration_head_v1_create(config,
|
||||||
output->wlr_output);
|
output->wlr_output);
|
||||||
|
|
@ -886,18 +886,18 @@ wlr_output_configuration_v1 *create_output_config(void)
|
||||||
static void
|
static void
|
||||||
do_output_layout_change(void)
|
do_output_layout_change(void)
|
||||||
{
|
{
|
||||||
if (!g_server.pending_output_layout_change) {
|
if (!server.pending_output_layout_change) {
|
||||||
struct wlr_output_configuration_v1 *config =
|
struct wlr_output_configuration_v1 *config =
|
||||||
create_output_config();
|
create_output_config();
|
||||||
if (config) {
|
if (config) {
|
||||||
wlr_output_manager_v1_set_configuration(
|
wlr_output_manager_v1_set_configuration(
|
||||||
g_server.output_manager, config);
|
server.output_manager, config);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
"wlr_output_manager_v1_set_configuration()");
|
"wlr_output_manager_v1_set_configuration()");
|
||||||
}
|
}
|
||||||
output_update_for_layout_change();
|
output_update_for_layout_change();
|
||||||
seat_output_layout_changed(&g_server.seat);
|
seat_output_layout_changed(&server.seat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -905,9 +905,9 @@ static void
|
||||||
handle_output_layout_change(struct wl_listener *listener, void *data)
|
handle_output_layout_change(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
/* Prevents unnecessary layout recalculations */
|
/* Prevents unnecessary layout recalculations */
|
||||||
g_server.pending_output_layout_change++;
|
server.pending_output_layout_change++;
|
||||||
output_virtual_update_fallback();
|
output_virtual_update_fallback();
|
||||||
g_server.pending_output_layout_change--;
|
server.pending_output_layout_change--;
|
||||||
|
|
||||||
do_output_layout_change();
|
do_output_layout_change();
|
||||||
}
|
}
|
||||||
|
|
@ -928,39 +928,39 @@ handle_gamma_control_set_gamma(struct wl_listener *listener, void *data)
|
||||||
static void
|
static void
|
||||||
output_manager_init(void)
|
output_manager_init(void)
|
||||||
{
|
{
|
||||||
g_server.output_manager = wlr_output_manager_v1_create(g_server.wl_display);
|
server.output_manager = wlr_output_manager_v1_create(server.wl_display);
|
||||||
|
|
||||||
g_server.output_layout_change.notify = handle_output_layout_change;
|
server.output_layout_change.notify = handle_output_layout_change;
|
||||||
wl_signal_add(&g_server.output_layout->events.change,
|
wl_signal_add(&server.output_layout->events.change,
|
||||||
&g_server.output_layout_change);
|
&server.output_layout_change);
|
||||||
|
|
||||||
g_server.output_manager_apply.notify = handle_output_manager_apply;
|
server.output_manager_apply.notify = handle_output_manager_apply;
|
||||||
wl_signal_add(&g_server.output_manager->events.apply,
|
wl_signal_add(&server.output_manager->events.apply,
|
||||||
&g_server.output_manager_apply);
|
&server.output_manager_apply);
|
||||||
|
|
||||||
g_server.output_manager_test.notify = handle_output_manager_test;
|
server.output_manager_test.notify = handle_output_manager_test;
|
||||||
wl_signal_add(&g_server.output_manager->events.test,
|
wl_signal_add(&server.output_manager->events.test,
|
||||||
&g_server.output_manager_test);
|
&server.output_manager_test);
|
||||||
|
|
||||||
g_server.gamma_control_set_gamma.notify = handle_gamma_control_set_gamma;
|
server.gamma_control_set_gamma.notify = handle_gamma_control_set_gamma;
|
||||||
wl_signal_add(&g_server.gamma_control_manager_v1->events.set_gamma,
|
wl_signal_add(&server.gamma_control_manager_v1->events.set_gamma,
|
||||||
&g_server.gamma_control_set_gamma);
|
&server.gamma_control_set_gamma);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_manager_finish(void)
|
output_manager_finish(void)
|
||||||
{
|
{
|
||||||
wl_list_remove(&g_server.output_layout_change.link);
|
wl_list_remove(&server.output_layout_change.link);
|
||||||
wl_list_remove(&g_server.output_manager_apply.link);
|
wl_list_remove(&server.output_manager_apply.link);
|
||||||
wl_list_remove(&g_server.output_manager_test.link);
|
wl_list_remove(&server.output_manager_test.link);
|
||||||
wl_list_remove(&g_server.gamma_control_set_gamma.link);
|
wl_list_remove(&server.gamma_control_set_gamma.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct output *
|
struct output *
|
||||||
output_from_wlr_output(struct wlr_output *wlr_output)
|
output_from_wlr_output(struct wlr_output *wlr_output)
|
||||||
{
|
{
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (output->wlr_output == wlr_output) {
|
if (output->wlr_output == wlr_output) {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
@ -972,7 +972,7 @@ struct output *
|
||||||
output_from_name(const char *name)
|
output_from_name(const char *name)
|
||||||
{
|
{
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!output_is_usable(output) || !output->wlr_output->name) {
|
if (!output_is_usable(output) || !output->wlr_output->name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -987,18 +987,18 @@ struct output *
|
||||||
output_nearest_to(int lx, int ly)
|
output_nearest_to(int lx, int ly)
|
||||||
{
|
{
|
||||||
double closest_x, closest_y;
|
double closest_x, closest_y;
|
||||||
wlr_output_layout_closest_point(g_server.output_layout, NULL, lx, ly,
|
wlr_output_layout_closest_point(server.output_layout, NULL, lx, ly,
|
||||||
&closest_x, &closest_y);
|
&closest_x, &closest_y);
|
||||||
|
|
||||||
return output_from_wlr_output(wlr_output_layout_output_at(g_server.output_layout,
|
return output_from_wlr_output(wlr_output_layout_output_at(server.output_layout,
|
||||||
closest_x, closest_y));
|
closest_x, closest_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct output *
|
struct output *
|
||||||
output_nearest_to_cursor(void)
|
output_nearest_to_cursor(void)
|
||||||
{
|
{
|
||||||
return output_nearest_to(g_server.seat.cursor->x,
|
return output_nearest_to(server.seat.cursor->x,
|
||||||
g_server.seat.cursor->y);
|
server.seat.cursor->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct output *
|
struct output *
|
||||||
|
|
@ -1022,7 +1022,7 @@ output_get_adjacent(struct output *output, enum lab_edge edge, bool wrap)
|
||||||
/* Determine any adjacent output in the appropriate direction */
|
/* Determine any adjacent output in the appropriate direction */
|
||||||
struct wlr_output *new_output = NULL;
|
struct wlr_output *new_output = NULL;
|
||||||
struct wlr_output *current_output = output->wlr_output;
|
struct wlr_output *current_output = output->wlr_output;
|
||||||
struct wlr_output_layout *layout = g_server.output_layout;
|
struct wlr_output_layout *layout = server.output_layout;
|
||||||
/* Cast from enum lab_edge to enum wlr_direction is safe */
|
/* Cast from enum lab_edge to enum wlr_direction is safe */
|
||||||
new_output = wlr_output_layout_adjacent_output(layout,
|
new_output = wlr_output_layout_adjacent_output(layout,
|
||||||
(enum wlr_direction)edge, current_output, lx, ly);
|
(enum wlr_direction)edge, current_output, lx, ly);
|
||||||
|
|
@ -1076,10 +1076,10 @@ update_usable_area(struct output *output)
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
if (view->mapped && view->type == LAB_XWAYLAND_VIEW) {
|
if (view->mapped && view->type == LAB_XWAYLAND_VIEW) {
|
||||||
xwayland_adjust_usable_area(view,
|
xwayland_adjust_usable_area(view,
|
||||||
g_server.output_layout,
|
server.output_layout,
|
||||||
output->wlr_output, &output->usable_area);
|
output->wlr_output, &output->usable_area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1105,7 +1105,7 @@ output_update_all_usable_areas(bool layout_changed)
|
||||||
bool usable_area_changed = false;
|
bool usable_area_changed = false;
|
||||||
struct output *output;
|
struct output *output;
|
||||||
|
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (update_usable_area(output)) {
|
if (update_usable_area(output)) {
|
||||||
usable_area_changed = true;
|
usable_area_changed = true;
|
||||||
regions_update_geometry(output);
|
regions_update_geometry(output);
|
||||||
|
|
@ -1129,7 +1129,7 @@ output_usable_area_in_layout_coords(struct output *output)
|
||||||
}
|
}
|
||||||
struct wlr_box box = output->usable_area;
|
struct wlr_box box = output->usable_area;
|
||||||
double ox = 0, oy = 0;
|
double ox = 0, oy = 0;
|
||||||
wlr_output_layout_output_coords(g_server.output_layout,
|
wlr_output_layout_output_coords(server.output_layout,
|
||||||
output->wlr_output, &ox, &oy);
|
output->wlr_output, &ox, &oy);
|
||||||
box.x -= ox;
|
box.x -= ox;
|
||||||
box.y -= oy;
|
box.y -= oy;
|
||||||
|
|
@ -1161,7 +1161,7 @@ handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
|
||||||
* Re-set the cursor image so that the cursor
|
* Re-set the cursor image so that the cursor
|
||||||
* isn't invisible on the newly enabled output.
|
* isn't invisible on the newly enabled output.
|
||||||
*/
|
*/
|
||||||
cursor_update_image(&g_server.seat);
|
cursor_update_image(&server.seat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ static void
|
||||||
show_overlay(struct seat *seat, struct theme_snapping_overlay *overlay_theme,
|
show_overlay(struct seat *seat, struct theme_snapping_overlay *overlay_theme,
|
||||||
struct wlr_box *box)
|
struct wlr_box *box)
|
||||||
{
|
{
|
||||||
struct view *view = g_server.grabbed_view;
|
struct view *view = server.grabbed_view;
|
||||||
assert(view);
|
assert(view);
|
||||||
assert(!seat->overlay.rect);
|
assert(!seat->overlay.rect);
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ edge_has_adjacent_output_from_cursor(struct seat *seat, struct output *output,
|
||||||
}
|
}
|
||||||
/* Cast from enum lab_edge to enum wlr_direction is safe */
|
/* Cast from enum lab_edge to enum wlr_direction is safe */
|
||||||
return wlr_output_layout_adjacent_output(
|
return wlr_output_layout_adjacent_output(
|
||||||
g_server.output_layout, (enum wlr_direction)edge,
|
server.output_layout, (enum wlr_direction)edge,
|
||||||
output->wlr_output, seat->cursor->x, seat->cursor->y);
|
output->wlr_output, seat->cursor->x, seat->cursor->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ show_edge_overlay(struct seat *seat, enum lab_edge edge1, enum lab_edge edge2,
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
if (!seat->overlay.timer) {
|
if (!seat->overlay.timer) {
|
||||||
seat->overlay.timer = wl_event_loop_add_timer(
|
seat->overlay.timer = wl_event_loop_add_timer(
|
||||||
g_server.wl_event_loop,
|
server.wl_event_loop,
|
||||||
handle_edge_overlay_timeout, seat);
|
handle_edge_overlay_timeout, seat);
|
||||||
}
|
}
|
||||||
/* Show overlay <snapping><preview><delay>ms later */
|
/* Show overlay <snapping><preview><delay>ms later */
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ count_views(struct view *view)
|
||||||
int nviews = 0;
|
int nviews = 0;
|
||||||
|
|
||||||
struct view *v;
|
struct view *v;
|
||||||
for_each_view(v, &g_server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
for_each_view(v, &server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||||
/* Ignore the target view or anything on a different output */
|
/* Ignore the target view or anything on a different output */
|
||||||
if (v == view || v->output != output) {
|
if (v == view || v->output != output) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -141,7 +141,7 @@ build_grid(struct overlap_bitmap *bmp, struct view *view)
|
||||||
int nr_cols = 2;
|
int nr_cols = 2;
|
||||||
|
|
||||||
struct view *v;
|
struct view *v;
|
||||||
for_each_view(v, &g_server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
for_each_view(v, &server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||||
if (v == view || v->output != output) {
|
if (v == view || v->output != output) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -242,7 +242,7 @@ build_overlap(struct overlap_bitmap *bmp, struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *v;
|
struct view *v;
|
||||||
for_each_view(v, &g_server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
for_each_view(v, &server.views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||||
if (v == view || v->output != output) {
|
if (v == view || v->output != output) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@
|
||||||
bool
|
bool
|
||||||
regions_should_snap(void)
|
regions_should_snap(void)
|
||||||
{
|
{
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_MOVE
|
if (server.input_mode != LAB_INPUT_STATE_MOVE
|
||||||
|| wl_list_empty(&rc.regions)
|
|| wl_list_empty(&rc.regions)
|
||||||
|| g_server.seat.region_prevent_snap
|
|| server.seat.region_prevent_snap
|
||||||
|| !view_is_floating(g_server.grabbed_view)) {
|
|| !view_is_floating(server.grabbed_view)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return keyboard_get_all_modifiers(&g_server.seat);
|
return keyboard_get_all_modifiers(&server.seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct region *
|
struct region *
|
||||||
|
|
@ -46,11 +46,11 @@ regions_from_name(const char *region_name, struct output *output)
|
||||||
struct region *
|
struct region *
|
||||||
regions_from_cursor(void)
|
regions_from_cursor(void)
|
||||||
{
|
{
|
||||||
double lx = g_server.seat.cursor->x;
|
double lx = server.seat.cursor->x;
|
||||||
double ly = g_server.seat.cursor->y;
|
double ly = server.seat.cursor->y;
|
||||||
|
|
||||||
struct wlr_output *wlr_output = wlr_output_layout_output_at(
|
struct wlr_output *wlr_output = wlr_output_layout_output_at(
|
||||||
g_server.output_layout, lx, ly);
|
server.output_layout, lx, ly);
|
||||||
struct output *output = output_from_wlr_output(wlr_output);
|
struct output *output = output_from_wlr_output(wlr_output);
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -81,7 +81,7 @@ regions_reconfigure_output(struct output *output)
|
||||||
/* Evacuate views and destroy current regions */
|
/* Evacuate views and destroy current regions */
|
||||||
if (!wl_list_empty(&output->regions)) {
|
if (!wl_list_empty(&output->regions)) {
|
||||||
regions_evacuate_output(output);
|
regions_evacuate_output(output);
|
||||||
regions_destroy(&g_server.seat, &output->regions);
|
regions_destroy(&server.seat, &output->regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize regions from config */
|
/* Initialize regions from config */
|
||||||
|
|
@ -105,7 +105,7 @@ regions_reconfigure(void)
|
||||||
struct output *output;
|
struct output *output;
|
||||||
|
|
||||||
/* Evacuate views and initialize regions from config */
|
/* Evacuate views and initialize regions from config */
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
regions_reconfigure_output(output);
|
regions_reconfigure_output(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,7 +149,7 @@ regions_evacuate_output(struct output *output)
|
||||||
{
|
{
|
||||||
assert(output);
|
assert(output);
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
if (view->tiled_region && view->tiled_region->output == output) {
|
if (view->tiled_region && view->tiled_region->output == output) {
|
||||||
view_evacuate_region(view);
|
view_evacuate_region(view);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ resistance_resize_apply(struct view *view, struct wlr_box *new_geom)
|
||||||
edges_initialize(&next_edges);
|
edges_initialize(&next_edges);
|
||||||
|
|
||||||
/* Use a constrained, effective geometry for snapping if appropriate */
|
/* Use a constrained, effective geometry for snapping if appropriate */
|
||||||
enum lab_edge resize_edges = g_server.resize_edges;
|
enum lab_edge resize_edges = server.resize_edges;
|
||||||
struct wlr_box origin =
|
struct wlr_box origin =
|
||||||
snap_constraints_effective(view, resize_edges, /* use_pending */ false);
|
snap_constraints_effective(view, resize_edges, /* use_pending */ false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ resize_outlines_update(struct view *view, struct wlr_box new_geo)
|
||||||
if (!outlines->rect) {
|
if (!outlines->rect) {
|
||||||
struct lab_scene_rect_options opts = {
|
struct lab_scene_rect_options opts = {
|
||||||
.border_colors = (float *[3]) {
|
.border_colors = (float *[3]) {
|
||||||
g_server.theme->osd_bg_color,
|
server.theme->osd_bg_color,
|
||||||
g_server.theme->osd_label_text_color,
|
server.theme->osd_label_text_color,
|
||||||
g_server.theme->osd_bg_color,
|
server.theme->osd_bg_color,
|
||||||
},
|
},
|
||||||
.nr_borders = 3,
|
.nr_borders = 3,
|
||||||
.border_width = 1,
|
.border_width = 1,
|
||||||
|
|
|
||||||
42
src/seat.c
42
src/seat.c
|
|
@ -354,7 +354,7 @@ output_by_name(const char *name)
|
||||||
{
|
{
|
||||||
assert(name);
|
assert(name);
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!strcasecmp(output->wlr_output->name, name)) {
|
if (!strcasecmp(output->wlr_output->name, name)) {
|
||||||
return output->wlr_output;
|
return output->wlr_output;
|
||||||
}
|
}
|
||||||
|
|
@ -609,28 +609,28 @@ handle_focus_change(struct wl_listener *listener, void *data)
|
||||||
* We clear the keyboard focus at the beginning of Move/Resize, window
|
* We clear the keyboard focus at the beginning of Move/Resize, window
|
||||||
* switcher and opening menus, but don't want to deactivate the view.
|
* switcher and opening menus, but don't want to deactivate the view.
|
||||||
*/
|
*/
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view != g_server.active_view) {
|
if (view != server.active_view) {
|
||||||
if (g_server.active_view) {
|
if (server.active_view) {
|
||||||
view_set_activated(g_server.active_view, false);
|
view_set_activated(server.active_view, false);
|
||||||
}
|
}
|
||||||
if (view) {
|
if (view) {
|
||||||
view_set_activated(view, true);
|
view_set_activated(view, true);
|
||||||
tablet_pad_enter_surface(seat, surface);
|
tablet_pad_enter_surface(seat, surface);
|
||||||
}
|
}
|
||||||
g_server.active_view = view;
|
server.active_view = view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
seat_init(void)
|
seat_init(void)
|
||||||
{
|
{
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
seat->seat = wlr_seat_create(g_server.wl_display, "seat0");
|
seat->seat = wlr_seat_create(server.wl_display, "seat0");
|
||||||
if (!seat->seat) {
|
if (!seat->seat) {
|
||||||
wlr_log(WLR_ERROR, "cannot allocate seat");
|
wlr_log(WLR_ERROR, "cannot allocate seat");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
@ -640,15 +640,15 @@ seat_init(void)
|
||||||
wl_list_init(&seat->constraint_commit.link);
|
wl_list_init(&seat->constraint_commit.link);
|
||||||
wl_list_init(&seat->inputs);
|
wl_list_init(&seat->inputs);
|
||||||
|
|
||||||
CONNECT_SIGNAL(g_server.backend, seat, new_input);
|
CONNECT_SIGNAL(server.backend, seat, new_input);
|
||||||
CONNECT_SIGNAL(&seat->seat->keyboard_state, seat, focus_change);
|
CONNECT_SIGNAL(&seat->seat->keyboard_state, seat, focus_change);
|
||||||
|
|
||||||
seat->virtual_pointer = wlr_virtual_pointer_manager_v1_create(
|
seat->virtual_pointer = wlr_virtual_pointer_manager_v1_create(
|
||||||
g_server.wl_display);
|
server.wl_display);
|
||||||
CONNECT_SIGNAL(seat->virtual_pointer, seat, new_virtual_pointer);
|
CONNECT_SIGNAL(seat->virtual_pointer, seat, new_virtual_pointer);
|
||||||
|
|
||||||
seat->virtual_keyboard = wlr_virtual_keyboard_manager_v1_create(
|
seat->virtual_keyboard = wlr_virtual_keyboard_manager_v1_create(
|
||||||
g_server.wl_display);
|
server.wl_display);
|
||||||
CONNECT_SIGNAL(seat->virtual_keyboard, seat, new_virtual_keyboard);
|
CONNECT_SIGNAL(seat->virtual_keyboard, seat, new_virtual_keyboard);
|
||||||
|
|
||||||
seat->input_method_relay = input_method_relay_create(seat);
|
seat->input_method_relay = input_method_relay_create(seat);
|
||||||
|
|
@ -660,7 +660,7 @@ seat_init(void)
|
||||||
wlr_log(WLR_ERROR, "unable to create cursor");
|
wlr_log(WLR_ERROR, "unable to create cursor");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
wlr_cursor_attach_output_layout(seat->cursor, g_server.output_layout);
|
wlr_cursor_attach_output_layout(seat->cursor, server.output_layout);
|
||||||
|
|
||||||
wl_list_init(&seat->tablets);
|
wl_list_init(&seat->tablets);
|
||||||
wl_list_init(&seat->tablet_tools);
|
wl_list_init(&seat->tablet_tools);
|
||||||
|
|
@ -672,7 +672,7 @@ seat_init(void)
|
||||||
void
|
void
|
||||||
seat_finish(void)
|
seat_finish(void)
|
||||||
{
|
{
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
wl_list_remove(&seat->new_input.link);
|
wl_list_remove(&seat->new_input.link);
|
||||||
wl_list_remove(&seat->focus_change.link);
|
wl_list_remove(&seat->focus_change.link);
|
||||||
wl_list_remove(&seat->new_virtual_pointer.link);
|
wl_list_remove(&seat->new_virtual_pointer.link);
|
||||||
|
|
@ -729,7 +729,7 @@ seat_pointer_end_grab(struct seat *seat, struct wlr_surface *surface)
|
||||||
void
|
void
|
||||||
seat_reconfigure(void)
|
seat_reconfigure(void)
|
||||||
{
|
{
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
struct input *input;
|
struct input *input;
|
||||||
cursor_reload(seat);
|
cursor_reload(seat);
|
||||||
overlay_finish(seat);
|
overlay_finish(seat);
|
||||||
|
|
@ -760,7 +760,7 @@ seat_reconfigure(void)
|
||||||
void
|
void
|
||||||
seat_force_focus_surface(struct seat *seat, struct wlr_surface *surface)
|
seat_force_focus_surface(struct seat *seat, struct wlr_surface *surface)
|
||||||
{
|
{
|
||||||
if (g_server.session_lock_manager->locked) {
|
if (server.session_lock_manager->locked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t *pressed_sent_keycodes = key_state_pressed_sent_keycodes();
|
uint32_t *pressed_sent_keycodes = key_state_pressed_sent_keycodes();
|
||||||
|
|
@ -787,7 +787,7 @@ seat_focus(struct seat *seat, struct wlr_surface *surface,
|
||||||
* It should also come before the !surface condition, or the
|
* It should also come before the !surface condition, or the
|
||||||
* lock screen may lose focus and become impossible to unlock.
|
* lock screen may lose focus and become impossible to unlock.
|
||||||
*/
|
*/
|
||||||
if (g_server.session_lock_manager->locked && !is_lock_surface) {
|
if (server.session_lock_manager->locked && !is_lock_surface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -823,7 +823,7 @@ seat_focus(struct seat *seat, struct wlr_surface *surface,
|
||||||
input_method_relay_set_focus(seat->input_method_relay, surface);
|
input_method_relay_set_focus(seat->input_method_relay, surface);
|
||||||
|
|
||||||
struct wlr_pointer_constraint_v1 *constraint =
|
struct wlr_pointer_constraint_v1 *constraint =
|
||||||
wlr_pointer_constraints_v1_constraint_for_surface(g_server.constraints,
|
wlr_pointer_constraints_v1_constraint_for_surface(server.constraints,
|
||||||
surface, seat->seat);
|
surface, seat->seat);
|
||||||
constrain_cursor(constraint);
|
constrain_cursor(constraint);
|
||||||
}
|
}
|
||||||
|
|
@ -832,7 +832,7 @@ void
|
||||||
seat_focus_surface(struct seat *seat, struct wlr_surface *surface)
|
seat_focus_surface(struct seat *seat, struct wlr_surface *surface)
|
||||||
{
|
{
|
||||||
/* Don't update focus while window switcher, Move/Resize and menu interaction */
|
/* Don't update focus while window switcher, Move/Resize and menu interaction */
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
if (server.input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
seat_focus(seat, surface, /*replace_exclusive_layer*/ false,
|
seat_focus(seat, surface, /*replace_exclusive_layer*/ false,
|
||||||
|
|
@ -894,9 +894,9 @@ seat_focus_override_begin(struct seat *seat, enum input_mode input_mode,
|
||||||
enum lab_cursors cursor_shape)
|
enum lab_cursors cursor_shape)
|
||||||
{
|
{
|
||||||
assert(!seat->focus_override.surface);
|
assert(!seat->focus_override.surface);
|
||||||
assert(g_server.input_mode == LAB_INPUT_STATE_PASSTHROUGH);
|
assert(server.input_mode == LAB_INPUT_STATE_PASSTHROUGH);
|
||||||
|
|
||||||
g_server.input_mode = input_mode;
|
server.input_mode = input_mode;
|
||||||
|
|
||||||
seat->focus_override.surface = seat->seat->keyboard_state.focused_surface;
|
seat->focus_override.surface = seat->seat->keyboard_state.focused_surface;
|
||||||
if (seat->focus_override.surface) {
|
if (seat->focus_override.surface) {
|
||||||
|
|
@ -915,7 +915,7 @@ seat_focus_override_begin(struct seat *seat, enum input_mode input_mode,
|
||||||
void
|
void
|
||||||
seat_focus_override_end(struct seat *seat, bool restore_focus)
|
seat_focus_override_end(struct seat *seat, bool restore_focus)
|
||||||
{
|
{
|
||||||
g_server.input_mode = LAB_INPUT_STATE_PASSTHROUGH;
|
server.input_mode = LAB_INPUT_STATE_PASSTHROUGH;
|
||||||
|
|
||||||
if (seat->focus_override.surface) {
|
if (seat->focus_override.surface) {
|
||||||
if (restore_focus) {
|
if (restore_focus) {
|
||||||
|
|
|
||||||
322
src/server.c
322
src/server.c
|
|
@ -86,8 +86,8 @@ reload_config_and_theme(void)
|
||||||
scaled_buffer_invalidate_sharing();
|
scaled_buffer_invalidate_sharing();
|
||||||
rcxml_finish();
|
rcxml_finish();
|
||||||
rcxml_read(rc.config_file);
|
rcxml_read(rc.config_file);
|
||||||
theme_finish(g_server.theme);
|
theme_finish(server.theme);
|
||||||
theme_init(g_server.theme, rc.theme_name);
|
theme_init(server.theme, rc.theme_name);
|
||||||
|
|
||||||
#if HAVE_LIBSFDO
|
#if HAVE_LIBSFDO
|
||||||
desktop_entry_finish();
|
desktop_entry_finish();
|
||||||
|
|
@ -95,7 +95,7 @@ reload_config_and_theme(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
view_reload_ssd(view);
|
view_reload_ssd(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ reload_config_and_theme(void)
|
||||||
static int
|
static int
|
||||||
handle_sighup(int signal, void *data)
|
handle_sighup(int signal, void *data)
|
||||||
{
|
{
|
||||||
keyboard_cancel_all_keybind_repeats(&g_server.seat);
|
keyboard_cancel_all_keybind_repeats(&server.seat);
|
||||||
session_environment_init();
|
session_environment_init();
|
||||||
reload_config_and_theme();
|
reload_config_and_theme();
|
||||||
output_virtual_update_fallback();
|
output_virtual_update_fallback();
|
||||||
|
|
@ -145,8 +145,8 @@ handle_sigchld(int signal, void *data)
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
/* Ensure that we do not break xwayland lazy initialization */
|
/* Ensure that we do not break xwayland lazy initialization */
|
||||||
if (g_server.xwayland && g_server.xwayland->server
|
if (server.xwayland && server.xwayland->server
|
||||||
&& info.si_pid == g_server.xwayland->server->pid) {
|
&& info.si_pid == server.xwayland->server->pid) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -184,9 +184,9 @@ handle_sigchld(int signal, void *data)
|
||||||
" please report", (long)info.si_pid, info.si_code);
|
" please report", (long)info.si_pid, info.si_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.si_pid == g_server.primary_client_pid) {
|
if (info.si_pid == server.primary_client_pid) {
|
||||||
wlr_log(WLR_INFO, "primary client %ld exited", (long)info.si_pid);
|
wlr_log(WLR_INFO, "primary client %ld exited", (long)info.si_pid);
|
||||||
wl_display_terminate(g_server.wl_display);
|
wl_display_terminate(server.wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -303,8 +303,8 @@ server_global_filter(const struct wl_client *client, const struct wl_global *glo
|
||||||
(void)iface;
|
(void)iface;
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct wl_client *xwayland_client = (g_server.xwayland && g_server.xwayland->server)
|
struct wl_client *xwayland_client = (server.xwayland && server.xwayland->server)
|
||||||
? g_server.xwayland->server->client
|
? server.xwayland->server->client
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
if (client != xwayland_client && !strcmp(iface->name, xwayland_shell_v1_interface.name)) {
|
if (client != xwayland_client && !strcmp(iface->name, xwayland_shell_v1_interface.name)) {
|
||||||
|
|
@ -316,8 +316,8 @@ server_global_filter(const struct wl_client *client, const struct wl_global *glo
|
||||||
/* Do not allow security_context_manager_v1 to clients with a security context attached */
|
/* Do not allow security_context_manager_v1 to clients with a security context attached */
|
||||||
const struct wlr_security_context_v1_state *security_context =
|
const struct wlr_security_context_v1_state *security_context =
|
||||||
wlr_security_context_manager_v1_lookup_client(
|
wlr_security_context_manager_v1_lookup_client(
|
||||||
g_server.security_context_manager_v1, (struct wl_client *)client);
|
server.security_context_manager_v1, (struct wl_client *)client);
|
||||||
if (security_context && global == g_server.security_context_manager_v1->global) {
|
if (security_context && global == server.security_context_manager_v1->global) {
|
||||||
return false;
|
return false;
|
||||||
} else if (security_context) {
|
} else if (security_context) {
|
||||||
/*
|
/*
|
||||||
|
|
@ -380,34 +380,34 @@ handle_renderer_lost(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
wlr_log(WLR_INFO, "Re-creating renderer after GPU reset");
|
wlr_log(WLR_INFO, "Re-creating renderer after GPU reset");
|
||||||
|
|
||||||
struct wlr_renderer *renderer = wlr_renderer_autocreate(g_server.backend);
|
struct wlr_renderer *renderer = wlr_renderer_autocreate(server.backend);
|
||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
wlr_log(WLR_ERROR, "Unable to create renderer");
|
wlr_log(WLR_ERROR, "Unable to create renderer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_allocator *allocator =
|
struct wlr_allocator *allocator =
|
||||||
wlr_allocator_autocreate(g_server.backend, renderer);
|
wlr_allocator_autocreate(server.backend, renderer);
|
||||||
if (!allocator) {
|
if (!allocator) {
|
||||||
wlr_log(WLR_ERROR, "Unable to create allocator");
|
wlr_log(WLR_ERROR, "Unable to create allocator");
|
||||||
wlr_renderer_destroy(renderer);
|
wlr_renderer_destroy(renderer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_renderer *old_renderer = g_server.renderer;
|
struct wlr_renderer *old_renderer = server.renderer;
|
||||||
struct wlr_allocator *old_allocator = g_server.allocator;
|
struct wlr_allocator *old_allocator = server.allocator;
|
||||||
g_server.renderer = renderer;
|
server.renderer = renderer;
|
||||||
g_server.allocator = allocator;
|
server.allocator = allocator;
|
||||||
|
|
||||||
wl_list_remove(&g_server.renderer_lost.link);
|
wl_list_remove(&server.renderer_lost.link);
|
||||||
wl_signal_add(&g_server.renderer->events.lost, &g_server.renderer_lost);
|
wl_signal_add(&server.renderer->events.lost, &server.renderer_lost);
|
||||||
|
|
||||||
wlr_compositor_set_renderer(g_server.compositor, renderer);
|
wlr_compositor_set_renderer(server.compositor, renderer);
|
||||||
|
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
wlr_output_init_render(output->wlr_output,
|
wlr_output_init_render(output->wlr_output,
|
||||||
g_server.allocator, g_server.renderer);
|
server.allocator, server.renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_config_and_theme();
|
reload_config_and_theme();
|
||||||
|
|
@ -421,27 +421,27 @@ handle_renderer_lost(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
server_init(void)
|
server_init(void)
|
||||||
{
|
{
|
||||||
g_server.primary_client_pid = -1;
|
server.primary_client_pid = -1;
|
||||||
g_server.wl_display = wl_display_create();
|
server.wl_display = wl_display_create();
|
||||||
if (!g_server.wl_display) {
|
if (!server.wl_display) {
|
||||||
wlr_log(WLR_ERROR, "cannot allocate a wayland display");
|
wlr_log(WLR_ERROR, "cannot allocate a wayland display");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
/* Increase max client buffer size to make slow clients less likely to terminate */
|
/* Increase max client buffer size to make slow clients less likely to terminate */
|
||||||
wl_display_set_default_max_buffer_size(g_server.wl_display, 1024 * 1024);
|
wl_display_set_default_max_buffer_size(server.wl_display, 1024 * 1024);
|
||||||
|
|
||||||
wl_display_set_global_filter(g_server.wl_display, server_global_filter, NULL);
|
wl_display_set_global_filter(server.wl_display, server_global_filter, NULL);
|
||||||
g_server.wl_event_loop = wl_display_get_event_loop(g_server.wl_display);
|
server.wl_event_loop = wl_display_get_event_loop(server.wl_display);
|
||||||
|
|
||||||
/* Catch signals */
|
/* Catch signals */
|
||||||
g_server.sighup_source = wl_event_loop_add_signal(
|
server.sighup_source = wl_event_loop_add_signal(
|
||||||
g_server.wl_event_loop, SIGHUP, handle_sighup, NULL);
|
server.wl_event_loop, SIGHUP, handle_sighup, NULL);
|
||||||
g_server.sigint_source = wl_event_loop_add_signal(
|
server.sigint_source = wl_event_loop_add_signal(
|
||||||
g_server.wl_event_loop, SIGINT, handle_sigterm, g_server.wl_display);
|
server.wl_event_loop, SIGINT, handle_sigterm, server.wl_display);
|
||||||
g_server.sigterm_source = wl_event_loop_add_signal(
|
server.sigterm_source = wl_event_loop_add_signal(
|
||||||
g_server.wl_event_loop, SIGTERM, handle_sigterm, g_server.wl_display);
|
server.wl_event_loop, SIGTERM, handle_sigterm, server.wl_display);
|
||||||
g_server.sigchld_source = wl_event_loop_add_signal(
|
server.sigchld_source = wl_event_loop_add_signal(
|
||||||
g_server.wl_event_loop, SIGCHLD, handle_sigchld, NULL);
|
server.wl_event_loop, SIGCHLD, handle_sigchld, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prevent wayland clients that request the X11 clipboard but closing
|
* Prevent wayland clients that request the X11 clipboard but closing
|
||||||
|
|
@ -459,31 +459,31 @@ server_init(void)
|
||||||
* backend based on the current environment, such as opening an x11
|
* backend based on the current environment, such as opening an x11
|
||||||
* window if an x11 server is running.
|
* window if an x11 server is running.
|
||||||
*/
|
*/
|
||||||
g_server.backend = wlr_backend_autocreate(
|
server.backend = wlr_backend_autocreate(
|
||||||
g_server.wl_event_loop, &g_server.session);
|
server.wl_event_loop, &server.session);
|
||||||
if (!g_server.backend) {
|
if (!server.backend) {
|
||||||
wlr_log(WLR_ERROR, "unable to create backend");
|
wlr_log(WLR_ERROR, "unable to create backend");
|
||||||
fprintf(stderr, helpful_seat_error_message);
|
fprintf(stderr, helpful_seat_error_message);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create headless backend to enable adding virtual outputs later on */
|
/* Create headless backend to enable adding virtual outputs later on */
|
||||||
wlr_multi_for_each_backend(g_server.backend,
|
wlr_multi_for_each_backend(server.backend,
|
||||||
get_headless_backend, &g_server.headless.backend);
|
get_headless_backend, &server.headless.backend);
|
||||||
|
|
||||||
if (!g_server.headless.backend) {
|
if (!server.headless.backend) {
|
||||||
wlr_log(WLR_DEBUG, "manually creating headless backend");
|
wlr_log(WLR_DEBUG, "manually creating headless backend");
|
||||||
g_server.headless.backend = wlr_headless_backend_create(
|
server.headless.backend = wlr_headless_backend_create(
|
||||||
g_server.wl_event_loop);
|
server.wl_event_loop);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_DEBUG, "headless backend already exists");
|
wlr_log(WLR_DEBUG, "headless backend already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_server.headless.backend) {
|
if (!server.headless.backend) {
|
||||||
wlr_log(WLR_ERROR, "unable to create headless backend");
|
wlr_log(WLR_ERROR, "unable to create headless backend");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
wlr_multi_backend_add(g_server.backend, g_server.headless.backend);
|
wlr_multi_backend_add(server.backend, server.headless.backend);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we don't populate headless backend with a virtual output (that we
|
* If we don't populate headless backend with a virtual output (that we
|
||||||
|
|
@ -491,7 +491,7 @@ server_init(void)
|
||||||
* later do not work properly when overlaid on real output. Content is
|
* later do not work properly when overlaid on real output. Content is
|
||||||
* drawn on the virtual output, but not drawn on the real output.
|
* drawn on the virtual output, but not drawn on the real output.
|
||||||
*/
|
*/
|
||||||
wlr_output_destroy(wlr_headless_add_output(g_server.headless.backend, 0, 0));
|
wlr_output_destroy(wlr_headless_add_output(server.headless.backend, 0, 0));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The
|
* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The
|
||||||
|
|
@ -499,38 +499,38 @@ server_init(void)
|
||||||
* The renderer is responsible for defining the various pixel formats it
|
* The renderer is responsible for defining the various pixel formats it
|
||||||
* supports for shared memory, this configures that for clients.
|
* supports for shared memory, this configures that for clients.
|
||||||
*/
|
*/
|
||||||
g_server.renderer = wlr_renderer_autocreate(g_server.backend);
|
server.renderer = wlr_renderer_autocreate(server.backend);
|
||||||
if (!g_server.renderer) {
|
if (!server.renderer) {
|
||||||
wlr_log(WLR_ERROR, "unable to create renderer");
|
wlr_log(WLR_ERROR, "unable to create renderer");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.renderer_lost.notify = handle_renderer_lost;
|
server.renderer_lost.notify = handle_renderer_lost;
|
||||||
wl_signal_add(&g_server.renderer->events.lost, &g_server.renderer_lost);
|
wl_signal_add(&server.renderer->events.lost, &server.renderer_lost);
|
||||||
|
|
||||||
if (!wlr_renderer_init_wl_shm(g_server.renderer, g_server.wl_display)) {
|
if (!wlr_renderer_init_wl_shm(server.renderer, server.wl_display)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize shared memory pool");
|
wlr_log(WLR_ERROR, "Failed to initialize shared memory pool");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlr_renderer_get_texture_formats(
|
if (wlr_renderer_get_texture_formats(
|
||||||
g_server.renderer, WLR_BUFFER_CAP_DMABUF)) {
|
server.renderer, WLR_BUFFER_CAP_DMABUF)) {
|
||||||
if (wlr_renderer_get_drm_fd(g_server.renderer) >= 0) {
|
if (wlr_renderer_get_drm_fd(server.renderer) >= 0) {
|
||||||
wlr_drm_create(g_server.wl_display, g_server.renderer);
|
wlr_drm_create(server.wl_display, server.renderer);
|
||||||
}
|
}
|
||||||
g_server.linux_dmabuf = wlr_linux_dmabuf_v1_create_with_renderer(
|
server.linux_dmabuf = wlr_linux_dmabuf_v1_create_with_renderer(
|
||||||
g_server.wl_display,
|
server.wl_display,
|
||||||
LAB_WLR_LINUX_DMABUF_VERSION,
|
LAB_WLR_LINUX_DMABUF_VERSION,
|
||||||
g_server.renderer);
|
server.renderer);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_DEBUG, "unable to initialize dmabuf");
|
wlr_log(WLR_DEBUG, "unable to initialize dmabuf");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlr_renderer_get_drm_fd(g_server.renderer) >= 0 &&
|
if (wlr_renderer_get_drm_fd(server.renderer) >= 0 &&
|
||||||
g_server.renderer->features.timeline &&
|
server.renderer->features.timeline &&
|
||||||
g_server.backend->features.timeline) {
|
server.backend->features.timeline) {
|
||||||
wlr_linux_drm_syncobj_manager_v1_create(g_server.wl_display, 1,
|
wlr_linux_drm_syncobj_manager_v1_create(server.wl_display, 1,
|
||||||
wlr_renderer_get_drm_fd(g_server.renderer));
|
wlr_renderer_get_drm_fd(server.renderer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -538,22 +538,22 @@ server_init(void)
|
||||||
* the renderer and the backend. It handles the buffer creation,
|
* the renderer and the backend. It handles the buffer creation,
|
||||||
* allowing wlroots to render onto the screen
|
* allowing wlroots to render onto the screen
|
||||||
*/
|
*/
|
||||||
g_server.allocator = wlr_allocator_autocreate(
|
server.allocator = wlr_allocator_autocreate(
|
||||||
g_server.backend, g_server.renderer);
|
server.backend, server.renderer);
|
||||||
if (!g_server.allocator) {
|
if (!server.allocator) {
|
||||||
wlr_log(WLR_ERROR, "unable to create allocator");
|
wlr_log(WLR_ERROR, "unable to create allocator");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&g_server.views);
|
wl_list_init(&server.views);
|
||||||
wl_list_init(&g_server.unmanaged_surfaces);
|
wl_list_init(&server.unmanaged_surfaces);
|
||||||
wl_list_init(&g_server.cycle.views);
|
wl_list_init(&server.cycle.views);
|
||||||
wl_list_init(&g_server.cycle.osd_outputs);
|
wl_list_init(&server.cycle.osd_outputs);
|
||||||
|
|
||||||
g_server.scene = wlr_scene_create();
|
server.scene = wlr_scene_create();
|
||||||
die_if_null(g_server.scene);
|
die_if_null(server.scene);
|
||||||
|
|
||||||
g_server.direct_scanout_enabled = g_server.scene->WLR_PRIVATE.direct_scanout;
|
server.direct_scanout_enabled = server.scene->WLR_PRIVATE.direct_scanout;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The order in which the scene-trees below are created determines the
|
* The order in which the scene-trees below are created determines the
|
||||||
|
|
@ -564,14 +564,14 @@ server_init(void)
|
||||||
* | ---------------------------------- | -------------------------------------
|
* | ---------------------------------- | -------------------------------------
|
||||||
* | output->session_lock_tree | session lock surfaces (e.g. swaylock)
|
* | output->session_lock_tree | session lock surfaces (e.g. swaylock)
|
||||||
* | output->cycle_osd_tree | window switcher's on-screen display
|
* | output->cycle_osd_tree | window switcher's on-screen display
|
||||||
* | g_server.cycle_preview_tree | window switcher's previewed window
|
* | server.cycle_preview_tree | window switcher's previewed window
|
||||||
* | g_server.menu_tree | labwc's server-side menus
|
* | server.menu_tree | labwc's server-side menus
|
||||||
* | output->layer_popup_tree | xdg popups on layer surfaces
|
* | output->layer_popup_tree | xdg popups on layer surfaces
|
||||||
* | output->layer_tree[3] | overlay layer surfaces (e.g. rofi)
|
* | output->layer_tree[3] | overlay layer surfaces (e.g. rofi)
|
||||||
* | output->layer_tree[2] | top layer surfaces (e.g. waybar)
|
* | output->layer_tree[2] | top layer surfaces (e.g. waybar)
|
||||||
* | g_server.unmanaged_tree | unmanaged X11 surfaces (e.g. dmenu)
|
* | server.unmanaged_tree | unmanaged X11 surfaces (e.g. dmenu)
|
||||||
* | g_server.xdg_popup_tree | xdg popups on xdg windows
|
* | server.xdg_popup_tree | xdg popups on xdg windows
|
||||||
* | g_server.workspace_tree |
|
* | server.workspace_tree |
|
||||||
* | + workspace->tree |
|
* | + workspace->tree |
|
||||||
* | + workspace->view_trees[1] | always-on-top xdg/X11 windows
|
* | + workspace->view_trees[1] | always-on-top xdg/X11 windows
|
||||||
* | + workspace->view_trees[0] | normal xdg/X11 windows (e.g. firefox)
|
* | + workspace->view_trees[0] | normal xdg/X11 windows (e.g. firefox)
|
||||||
|
|
@ -580,13 +580,13 @@ server_init(void)
|
||||||
* | output->layer_tree[0] | background layer surfaces (e.g. swaybg)
|
* | output->layer_tree[0] | background layer surfaces (e.g. swaybg)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_server.workspace_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
server.workspace_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
g_server.xdg_popup_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
server.xdg_popup_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
g_server.unmanaged_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
server.unmanaged_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
#endif
|
#endif
|
||||||
g_server.menu_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
server.menu_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
g_server.cycle_preview_tree = lab_wlr_scene_tree_create(&g_server.scene->tree);
|
server.cycle_preview_tree = lab_wlr_scene_tree_create(&server.scene->tree);
|
||||||
|
|
||||||
workspaces_init();
|
workspaces_init();
|
||||||
|
|
||||||
|
|
@ -599,16 +599,16 @@ server_init(void)
|
||||||
* room for you to dig your fingers in and play with their behavior if
|
* room for you to dig your fingers in and play with their behavior if
|
||||||
* you want.
|
* you want.
|
||||||
*/
|
*/
|
||||||
g_server.compositor = wlr_compositor_create(g_server.wl_display,
|
server.compositor = wlr_compositor_create(server.wl_display,
|
||||||
LAB_WLR_COMPOSITOR_VERSION, g_server.renderer);
|
LAB_WLR_COMPOSITOR_VERSION, server.renderer);
|
||||||
if (!g_server.compositor) {
|
if (!server.compositor) {
|
||||||
wlr_log(WLR_ERROR, "unable to create the wlroots compositor");
|
wlr_log(WLR_ERROR, "unable to create the wlroots compositor");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
wlr_subcompositor_create(g_server.wl_display);
|
wlr_subcompositor_create(server.wl_display);
|
||||||
|
|
||||||
struct wlr_data_device_manager *device_manager = NULL;
|
struct wlr_data_device_manager *device_manager = NULL;
|
||||||
device_manager = wlr_data_device_manager_create(g_server.wl_display);
|
device_manager = wlr_data_device_manager_create(server.wl_display);
|
||||||
if (!device_manager) {
|
if (!device_manager) {
|
||||||
wlr_log(WLR_ERROR, "unable to create data device manager");
|
wlr_log(WLR_ERROR, "unable to create data device manager");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
@ -625,103 +625,103 @@ server_init(void)
|
||||||
* https://wayfire.org/2020/08/04/Wayfire-0-5.html
|
* https://wayfire.org/2020/08/04/Wayfire-0-5.html
|
||||||
*/
|
*/
|
||||||
if (rc.primary_selection) {
|
if (rc.primary_selection) {
|
||||||
wlr_primary_selection_v1_device_manager_create(g_server.wl_display);
|
wlr_primary_selection_v1_device_manager_create(server.wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.input_method_manager = wlr_input_method_manager_v2_create(
|
server.input_method_manager = wlr_input_method_manager_v2_create(
|
||||||
g_server.wl_display);
|
server.wl_display);
|
||||||
g_server.text_input_manager = wlr_text_input_manager_v3_create(
|
server.text_input_manager = wlr_text_input_manager_v3_create(
|
||||||
g_server.wl_display);
|
server.wl_display);
|
||||||
seat_init();
|
seat_init();
|
||||||
xdg_shell_init();
|
xdg_shell_init();
|
||||||
kde_server_decoration_init();
|
kde_server_decoration_init();
|
||||||
xdg_server_decoration_init();
|
xdserver_decoration_init();
|
||||||
|
|
||||||
struct wlr_presentation *presentation = wlr_presentation_create(
|
struct wlr_presentation *presentation = wlr_presentation_create(
|
||||||
g_server.wl_display, g_server.backend,
|
server.wl_display, server.backend,
|
||||||
LAB_WLR_PRESENTATION_TIME_VERSION);
|
LAB_WLR_PRESENTATION_TIME_VERSION);
|
||||||
if (!presentation) {
|
if (!presentation) {
|
||||||
wlr_log(WLR_ERROR, "unable to create presentation interface");
|
wlr_log(WLR_ERROR, "unable to create presentation interface");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (g_server.linux_dmabuf) {
|
if (server.linux_dmabuf) {
|
||||||
wlr_scene_set_linux_dmabuf_v1(g_server.scene, g_server.linux_dmabuf);
|
wlr_scene_set_linux_dmabuf_v1(server.scene, server.linux_dmabuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_export_dmabuf_manager_v1_create(g_server.wl_display);
|
wlr_export_dmabuf_manager_v1_create(server.wl_display);
|
||||||
wlr_screencopy_manager_v1_create(g_server.wl_display);
|
wlr_screencopy_manager_v1_create(server.wl_display);
|
||||||
wlr_ext_image_copy_capture_manager_v1_create(g_server.wl_display, 1);
|
wlr_ext_image_copy_capture_manager_v1_create(server.wl_display, 1);
|
||||||
wlr_ext_output_image_capture_source_manager_v1_create(g_server.wl_display, 1);
|
wlr_ext_output_image_capture_source_manager_v1_create(server.wl_display, 1);
|
||||||
wlr_data_control_manager_v1_create(g_server.wl_display);
|
wlr_data_control_manager_v1_create(server.wl_display);
|
||||||
wlr_ext_data_control_manager_v1_create(g_server.wl_display,
|
wlr_ext_data_control_manager_v1_create(server.wl_display,
|
||||||
LAB_EXT_DATA_CONTROL_VERSION);
|
LAB_EXT_DATA_CONTROL_VERSION);
|
||||||
g_server.security_context_manager_v1 =
|
server.security_context_manager_v1 =
|
||||||
wlr_security_context_manager_v1_create(g_server.wl_display);
|
wlr_security_context_manager_v1_create(server.wl_display);
|
||||||
wlr_viewporter_create(g_server.wl_display);
|
wlr_viewporter_create(server.wl_display);
|
||||||
wlr_single_pixel_buffer_manager_v1_create(g_server.wl_display);
|
wlr_single_pixel_buffer_manager_v1_create(server.wl_display);
|
||||||
wlr_fractional_scale_manager_v1_create(g_server.wl_display,
|
wlr_fractional_scale_manager_v1_create(server.wl_display,
|
||||||
LAB_WLR_FRACTIONAL_SCALE_V1_VERSION);
|
LAB_WLR_FRACTIONAL_SCALE_V1_VERSION);
|
||||||
|
|
||||||
idle_manager_create(g_server.wl_display);
|
idle_manager_create(server.wl_display);
|
||||||
|
|
||||||
g_server.relative_pointer_manager = wlr_relative_pointer_manager_v1_create(
|
server.relative_pointer_manager = wlr_relative_pointer_manager_v1_create(
|
||||||
g_server.wl_display);
|
server.wl_display);
|
||||||
g_server.constraints = wlr_pointer_constraints_v1_create(
|
server.constraints = wlr_pointer_constraints_v1_create(
|
||||||
g_server.wl_display);
|
server.wl_display);
|
||||||
|
|
||||||
g_server.new_constraint.notify = create_constraint;
|
server.new_constraint.notify = create_constraint;
|
||||||
wl_signal_add(&g_server.constraints->events.new_constraint,
|
wl_signal_add(&server.constraints->events.new_constraint,
|
||||||
&g_server.new_constraint);
|
&server.new_constraint);
|
||||||
|
|
||||||
g_server.foreign_toplevel_manager =
|
server.foreign_toplevel_manager =
|
||||||
wlr_foreign_toplevel_manager_v1_create(g_server.wl_display);
|
wlr_foreign_toplevel_manager_v1_create(server.wl_display);
|
||||||
|
|
||||||
g_server.foreign_toplevel_list =
|
server.foreign_toplevel_list =
|
||||||
wlr_ext_foreign_toplevel_list_v1_create(
|
wlr_ext_foreign_toplevel_list_v1_create(
|
||||||
g_server.wl_display, LAB_EXT_FOREIGN_TOPLEVEL_LIST_VERSION);
|
server.wl_display, LAB_EXT_FOREIGN_TOPLEVEL_LIST_VERSION);
|
||||||
|
|
||||||
wlr_alpha_modifier_v1_create(g_server.wl_display);
|
wlr_alpha_modifier_v1_create(server.wl_display);
|
||||||
|
|
||||||
session_lock_init();
|
session_lock_init();
|
||||||
|
|
||||||
g_server.drm_lease_manager = wlr_drm_lease_v1_manager_create(
|
server.drm_lease_manager = wlr_drm_lease_v1_manager_create(
|
||||||
g_server.wl_display, g_server.backend);
|
server.wl_display, server.backend);
|
||||||
if (g_server.drm_lease_manager) {
|
if (server.drm_lease_manager) {
|
||||||
g_server.drm_lease_request.notify = handle_drm_lease_request;
|
server.drm_lease_request.notify = handle_drm_lease_request;
|
||||||
wl_signal_add(&g_server.drm_lease_manager->events.request,
|
wl_signal_add(&server.drm_lease_manager->events.request,
|
||||||
&g_server.drm_lease_request);
|
&server.drm_lease_request);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_DEBUG, "Failed to create wlr_drm_lease_device_v1");
|
wlr_log(WLR_DEBUG, "Failed to create wlr_drm_lease_device_v1");
|
||||||
wlr_log(WLR_INFO, "VR will not be available");
|
wlr_log(WLR_INFO, "VR will not be available");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.output_power_manager_v1 =
|
server.output_power_manager_v1 =
|
||||||
wlr_output_power_manager_v1_create(g_server.wl_display);
|
wlr_output_power_manager_v1_create(server.wl_display);
|
||||||
g_server.output_power_manager_set_mode.notify =
|
server.output_power_manager_set_mode.notify =
|
||||||
handle_output_power_manager_set_mode;
|
handle_output_power_manager_set_mode;
|
||||||
wl_signal_add(&g_server.output_power_manager_v1->events.set_mode,
|
wl_signal_add(&server.output_power_manager_v1->events.set_mode,
|
||||||
&g_server.output_power_manager_set_mode);
|
&server.output_power_manager_set_mode);
|
||||||
|
|
||||||
g_server.tearing_control = wlr_tearing_control_manager_v1_create(g_server.wl_display, 1);
|
server.tearing_control = wlr_tearing_control_manager_v1_create(server.wl_display, 1);
|
||||||
g_server.tearing_new_object.notify = handle_tearing_new_object;
|
server.tearing_new_object.notify = handle_tearing_new_object;
|
||||||
wl_signal_add(&g_server.tearing_control->events.new_object, &g_server.tearing_new_object);
|
wl_signal_add(&server.tearing_control->events.new_object, &server.tearing_new_object);
|
||||||
|
|
||||||
g_server.tablet_manager = wlr_tablet_v2_create(g_server.wl_display);
|
server.tablet_manager = wlr_tablet_v2_create(server.wl_display);
|
||||||
|
|
||||||
layers_init();
|
layers_init();
|
||||||
|
|
||||||
/* These get cleaned up automatically on display destroy */
|
/* These get cleaned up automatically on display destroy */
|
||||||
struct wlr_xdg_foreign_registry *registry =
|
struct wlr_xdg_foreign_registry *registry =
|
||||||
wlr_xdg_foreign_registry_create(g_server.wl_display);
|
wlr_xdg_foreign_registry_create(server.wl_display);
|
||||||
wlr_xdg_foreign_v1_create(g_server.wl_display, registry);
|
wlr_xdg_foreign_v1_create(server.wl_display, registry);
|
||||||
wlr_xdg_foreign_v2_create(g_server.wl_display, registry);
|
wlr_xdg_foreign_v2_create(server.wl_display, registry);
|
||||||
|
|
||||||
#if HAVE_LIBSFDO
|
#if HAVE_LIBSFDO
|
||||||
desktop_entry_init();
|
desktop_entry_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
xwayland_server_init(g_server.compositor);
|
xwayland_server_init(server.compositor);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -729,7 +729,7 @@ void
|
||||||
server_start(void)
|
server_start(void)
|
||||||
{
|
{
|
||||||
/* Add a Unix socket to the Wayland display. */
|
/* Add a Unix socket to the Wayland display. */
|
||||||
const char *socket = wl_display_add_socket_auto(g_server.wl_display);
|
const char *socket = wl_display_add_socket_auto(server.wl_display);
|
||||||
if (!socket) {
|
if (!socket) {
|
||||||
wlr_log_errno(WLR_ERROR, "unable to open wayland socket");
|
wlr_log_errno(WLR_ERROR, "unable to open wayland socket");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
@ -739,7 +739,7 @@ server_start(void)
|
||||||
* Start the backend. This will enumerate outputs and inputs, become
|
* Start the backend. This will enumerate outputs and inputs, become
|
||||||
* the DRM master, etc
|
* the DRM master, etc
|
||||||
*/
|
*/
|
||||||
if (!wlr_backend_start(g_server.backend)) {
|
if (!wlr_backend_start(server.backend)) {
|
||||||
wlr_log(WLR_ERROR, "unable to start the wlroots backend");
|
wlr_log(WLR_ERROR, "unable to start the wlroots backend");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
@ -763,35 +763,35 @@ server_finish(void)
|
||||||
#if HAVE_LIBSFDO
|
#if HAVE_LIBSFDO
|
||||||
desktop_entry_finish();
|
desktop_entry_finish();
|
||||||
#endif
|
#endif
|
||||||
wl_event_source_remove(g_server.sighup_source);
|
wl_event_source_remove(server.sighup_source);
|
||||||
wl_event_source_remove(g_server.sigint_source);
|
wl_event_source_remove(server.sigint_source);
|
||||||
wl_event_source_remove(g_server.sigterm_source);
|
wl_event_source_remove(server.sigterm_source);
|
||||||
wl_event_source_remove(g_server.sigchld_source);
|
wl_event_source_remove(server.sigchld_source);
|
||||||
|
|
||||||
wl_display_destroy_clients(g_server.wl_display);
|
wl_display_destroy_clients(server.wl_display);
|
||||||
|
|
||||||
seat_finish();
|
seat_finish();
|
||||||
output_finish();
|
output_finish();
|
||||||
xdg_shell_finish();
|
xdg_shell_finish();
|
||||||
layers_finish();
|
layers_finish();
|
||||||
kde_server_decoration_finish();
|
kde_server_decoration_finish();
|
||||||
xdg_server_decoration_finish();
|
xdserver_decoration_finish();
|
||||||
wl_list_remove(&g_server.new_constraint.link);
|
wl_list_remove(&server.new_constraint.link);
|
||||||
wl_list_remove(&g_server.output_power_manager_set_mode.link);
|
wl_list_remove(&server.output_power_manager_set_mode.link);
|
||||||
wl_list_remove(&g_server.tearing_new_object.link);
|
wl_list_remove(&server.tearing_new_object.link);
|
||||||
if (g_server.drm_lease_request.notify) {
|
if (server.drm_lease_request.notify) {
|
||||||
wl_list_remove(&g_server.drm_lease_request.link);
|
wl_list_remove(&server.drm_lease_request.link);
|
||||||
g_server.drm_lease_request.notify = NULL;
|
server.drm_lease_request.notify = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_backend_destroy(g_server.backend);
|
wlr_backend_destroy(server.backend);
|
||||||
wlr_allocator_destroy(g_server.allocator);
|
wlr_allocator_destroy(server.allocator);
|
||||||
|
|
||||||
wl_list_remove(&g_server.renderer_lost.link);
|
wl_list_remove(&server.renderer_lost.link);
|
||||||
wlr_renderer_destroy(g_server.renderer);
|
wlr_renderer_destroy(server.renderer);
|
||||||
|
|
||||||
workspaces_destroy();
|
workspaces_destroy();
|
||||||
wlr_scene_node_destroy(&g_server.scene->tree.node);
|
wlr_scene_node_destroy(&server.scene->tree.node);
|
||||||
|
|
||||||
wl_display_destroy(g_server.wl_display);
|
wl_display_destroy(server.wl_display);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ static void
|
||||||
focus_surface(struct session_lock_manager *manager, struct wlr_surface *focused)
|
focus_surface(struct session_lock_manager *manager, struct wlr_surface *focused)
|
||||||
{
|
{
|
||||||
manager->focused = focused;
|
manager->focused = focused;
|
||||||
seat_focus_lock_surface(&g_server.seat, focused);
|
seat_focus_lock_surface(&server.seat, focused);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -78,7 +78,7 @@ handle_surface_map(struct wl_listener *listener, void *data)
|
||||||
* buffer has not been actually attached to the surface.
|
* buffer has not been actually attached to the surface.
|
||||||
*/
|
*/
|
||||||
wl_event_loop_add_idle(
|
wl_event_loop_add_idle(
|
||||||
g_server.wl_event_loop, update_focus, output);
|
server.wl_event_loop, update_focus, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -98,7 +98,7 @@ static void
|
||||||
lock_output_reconfigure(struct session_lock_output *output)
|
lock_output_reconfigure(struct session_lock_output *output)
|
||||||
{
|
{
|
||||||
struct wlr_box box;
|
struct wlr_box box;
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
output->output->wlr_output, &box);
|
output->output->wlr_output, &box);
|
||||||
wlr_scene_rect_set_size(output->background, box.width, box.height);
|
wlr_scene_rect_set_size(output->background, box.width, box.height);
|
||||||
if (output->surface) {
|
if (output->surface) {
|
||||||
|
|
@ -191,7 +191,7 @@ static void
|
||||||
align_session_lock_tree(struct output *output)
|
align_session_lock_tree(struct output *output)
|
||||||
{
|
{
|
||||||
struct wlr_box box;
|
struct wlr_box box;
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
output->wlr_output, &box);
|
output->wlr_output, &box);
|
||||||
wlr_scene_node_set_position(&output->session_lock_tree->node, box.x, box.y);
|
wlr_scene_node_set_position(&output->session_lock_tree->node, box.x, box.y);
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +228,7 @@ session_lock_output_create(struct session_lock_manager *manager, struct output *
|
||||||
* already locked, blank immediately.
|
* already locked, blank immediately.
|
||||||
*/
|
*/
|
||||||
lock_output->blank_timer =
|
lock_output->blank_timer =
|
||||||
wl_event_loop_add_timer(g_server.wl_event_loop,
|
wl_event_loop_add_timer(server.wl_event_loop,
|
||||||
handle_output_blank_timeout, lock_output);
|
handle_output_blank_timeout, lock_output);
|
||||||
if (!manager->locked) {
|
if (!manager->locked) {
|
||||||
wlr_scene_node_set_enabled(&background->node, false);
|
wlr_scene_node_set_enabled(&background->node, false);
|
||||||
|
|
@ -323,11 +323,11 @@ handle_new_session_lock(struct wl_listener *listener, void *data)
|
||||||
assert(wl_list_empty(&manager->lock_outputs));
|
assert(wl_list_empty(&manager->lock_outputs));
|
||||||
|
|
||||||
/* Remember the focused view to restore it on unlock */
|
/* Remember the focused view to restore it on unlock */
|
||||||
manager->last_active_view = g_server.active_view;
|
manager->last_active_view = server.active_view;
|
||||||
seat_focus_surface(&g_server.seat, NULL);
|
seat_focus_surface(&server.seat, NULL);
|
||||||
|
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
session_lock_output_create(manager, output);
|
session_lock_output_create(manager, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ handle_manager_destroy(struct wl_listener *listener, void *data)
|
||||||
session_lock_destroy(manager);
|
session_lock_destroy(manager);
|
||||||
wl_list_remove(&manager->new_lock.link);
|
wl_list_remove(&manager->new_lock.link);
|
||||||
wl_list_remove(&manager->destroy.link);
|
wl_list_remove(&manager->destroy.link);
|
||||||
g_server.session_lock_manager = NULL;
|
server.session_lock_manager = NULL;
|
||||||
free(manager);
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,8 +361,8 @@ void
|
||||||
session_lock_init(void)
|
session_lock_init(void)
|
||||||
{
|
{
|
||||||
struct session_lock_manager *manager = znew(*manager);
|
struct session_lock_manager *manager = znew(*manager);
|
||||||
g_server.session_lock_manager = manager;
|
server.session_lock_manager = manager;
|
||||||
manager->wlr_manager = wlr_session_lock_manager_v1_create(g_server.wl_display);
|
manager->wlr_manager = wlr_session_lock_manager_v1_create(server.wl_display);
|
||||||
wl_list_init(&manager->lock_outputs);
|
wl_list_init(&manager->lock_outputs);
|
||||||
|
|
||||||
manager->new_lock.notify = handle_new_session_lock;
|
manager->new_lock.notify = handle_new_session_lock;
|
||||||
|
|
@ -375,16 +375,16 @@ session_lock_init(void)
|
||||||
void
|
void
|
||||||
session_lock_update_for_layout_change(void)
|
session_lock_update_for_layout_change(void)
|
||||||
{
|
{
|
||||||
if (!g_server.session_lock_manager->locked) {
|
if (!server.session_lock_manager->locked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
align_session_lock_tree(output);
|
align_session_lock_tree(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct session_lock_manager *manager = g_server.session_lock_manager;
|
struct session_lock_manager *manager = server.session_lock_manager;
|
||||||
struct session_lock_output *lock_output;
|
struct session_lock_output *lock_output;
|
||||||
wl_list_for_each(lock_output, &manager->lock_outputs, link) {
|
wl_list_for_each(lock_output, &manager->lock_outputs, link) {
|
||||||
lock_output_reconfigure(lock_output);
|
lock_output_reconfigure(lock_output);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ wants_indicator(struct view *view)
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
if (rc.resize_indicator == LAB_RESIZE_INDICATOR_NON_PIXEL) {
|
if (rc.resize_indicator == LAB_RESIZE_INDICATOR_NON_PIXEL) {
|
||||||
if (g_server.input_mode != LAB_INPUT_STATE_RESIZE) {
|
if (server.input_mode != LAB_INPUT_STATE_RESIZE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct view_size_hints hints = view_get_size_hints(view);
|
struct view_size_hints hints = view_get_size_hints(view);
|
||||||
|
|
@ -77,12 +77,12 @@ void
|
||||||
resize_indicator_reconfigure(void)
|
resize_indicator_reconfigure(void)
|
||||||
{
|
{
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
struct resize_indicator *indicator = &view->resize_indicator;
|
struct resize_indicator *indicator = &view->resize_indicator;
|
||||||
if (indicator->tree) {
|
if (indicator->tree) {
|
||||||
resize_indicator_reconfigure_view(indicator);
|
resize_indicator_reconfigure_view(indicator);
|
||||||
}
|
}
|
||||||
if (view != g_server.grabbed_view) {
|
if (view != server.grabbed_view) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ void
|
||||||
resize_indicator_update(struct view *view)
|
resize_indicator_update(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
assert(view == g_server.grabbed_view);
|
assert(view == server.grabbed_view);
|
||||||
|
|
||||||
if (!wants_indicator(view)) {
|
if (!wants_indicator(view)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -173,21 +173,21 @@ resize_indicator_update(struct view *view)
|
||||||
view_box.height = view_effective_height(view, /* use_pending */ false);
|
view_box.height = view_effective_height(view, /* use_pending */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
if (server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
||||||
struct view_size_hints hints = view_get_size_hints(view);
|
struct view_size_hints hints = view_get_size_hints(view);
|
||||||
snprintf(text, sizeof(text), "%d x %d",
|
snprintf(text, sizeof(text), "%d x %d",
|
||||||
MAX(0, view_box.width - hints.base_width)
|
MAX(0, view_box.width - hints.base_width)
|
||||||
/ MAX(1, hints.width_inc),
|
/ MAX(1, hints.width_inc),
|
||||||
MAX(0, view_box.height - hints.base_height)
|
MAX(0, view_box.height - hints.base_height)
|
||||||
/ MAX(1, hints.height_inc));
|
/ MAX(1, hints.height_inc));
|
||||||
} else if (g_server.input_mode == LAB_INPUT_STATE_MOVE) {
|
} else if (server.input_mode == LAB_INPUT_STATE_MOVE) {
|
||||||
struct border margin = ssd_get_margin(view->ssd);
|
struct border margin = ssd_get_margin(view->ssd);
|
||||||
snprintf(text, sizeof(text), "%d , %d",
|
snprintf(text, sizeof(text), "%d , %d",
|
||||||
view_box.x - margin.left,
|
view_box.x - margin.left,
|
||||||
view_box.y - margin.top);
|
view_box.y - margin.top);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "Invalid input mode for indicator update %u",
|
wlr_log(WLR_ERROR, "Invalid input mode for indicator update %u",
|
||||||
g_server.input_mode);
|
server.input_mode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ ssd_border_create(struct ssd *ssd)
|
||||||
assert(!ssd->border.tree);
|
assert(!ssd->border.tree);
|
||||||
|
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int height = view_effective_height(view, /* use_pending */ false);
|
int height = view_effective_height(view, /* use_pending */ false);
|
||||||
int full_width = width + 2 * theme->border_width;
|
int full_width = width + 2 * theme->border_width;
|
||||||
|
|
@ -90,7 +90,7 @@ ssd_border_update(struct ssd *ssd)
|
||||||
ssd->margin = ssd_thickness(ssd->view);
|
ssd->margin = ssd_thickness(ssd->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int height = view_effective_height(view, /* use_pending */ false);
|
int height = view_effective_height(view, /* use_pending */ false);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ void
|
||||||
ssd_extents_create(struct ssd *ssd)
|
ssd_extents_create(struct ssd *ssd)
|
||||||
{
|
{
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
int border_width = MAX(0, MAX(rc.resize_minimum_area, theme->border_width));
|
int border_width = MAX(0, MAX(rc.resize_minimum_area, theme->border_width));
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ ssd_extents_update(struct ssd *ssd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int height = view_effective_height(view, /* use_pending */ false);
|
int height = view_effective_height(view, /* use_pending */ false);
|
||||||
|
|
@ -120,7 +120,7 @@ ssd_extents_update(struct ssd *ssd)
|
||||||
pixman_region32_t usable;
|
pixman_region32_t usable;
|
||||||
pixman_region32_init(&usable);
|
pixman_region32_init(&usable);
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!view_on_output(view, output)) {
|
if (!view_on_output(view, output)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ static void
|
||||||
set_shadow_geometry(struct ssd *ssd)
|
set_shadow_geometry(struct ssd *ssd)
|
||||||
{
|
{
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
int titlebar_height = ssd->titlebar.height;
|
int titlebar_height = ssd->titlebar.height;
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int height = view_effective_height(view, false) + titlebar_height;
|
int height = view_effective_height(view, false) + titlebar_height;
|
||||||
|
|
@ -203,7 +203,7 @@ ssd_shadow_create(struct ssd *ssd)
|
||||||
|
|
||||||
ssd->shadow.tree = lab_wlr_scene_tree_create(ssd->tree);
|
ssd->shadow.tree = lab_wlr_scene_tree_create(ssd->tree);
|
||||||
|
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
|
|
||||||
enum ssd_active_state active;
|
enum ssd_active_state active;
|
||||||
|
|
@ -256,7 +256,7 @@ ssd_shadow_update(struct ssd *ssd)
|
||||||
assert(ssd->shadow.tree);
|
assert(ssd->shadow.tree);
|
||||||
|
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
||||||
bool tiled_shadows = false;
|
bool tiled_shadows = false;
|
||||||
if (rc.shadows_on_tiled) {
|
if (rc.shadows_on_tiled) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ void
|
||||||
ssd_titlebar_create(struct ssd *ssd)
|
ssd_titlebar_create(struct ssd *ssd)
|
||||||
{
|
{
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int corner_width = ssd_get_corner_width();
|
int corner_width = ssd_get_corner_width();
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ ssd_titlebar_create(struct ssd *ssd)
|
||||||
* TODO: remove once https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3990
|
* TODO: remove once https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3990
|
||||||
* is solved
|
* is solved
|
||||||
*/
|
*/
|
||||||
if (wlr_renderer_is_pixman(g_server.renderer)) {
|
if (wlr_renderer_is_pixman(server.renderer)) {
|
||||||
wlr_scene_buffer_set_filter_mode(
|
wlr_scene_buffer_set_filter_mode(
|
||||||
subtree->bar, WLR_SCALE_FILTER_NEAREST);
|
subtree->bar, WLR_SCALE_FILTER_NEAREST);
|
||||||
}
|
}
|
||||||
|
|
@ -160,7 +160,7 @@ set_squared_corners(struct ssd *ssd, bool enable)
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int corner_width = ssd_get_corner_width();
|
int corner_width = ssd_get_corner_width();
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
int x = enable ? 0 : corner_width;
|
int x = enable ? 0 : corner_width;
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ static void
|
||||||
update_visible_buttons(struct ssd *ssd)
|
update_visible_buttons(struct ssd *ssd)
|
||||||
{
|
{
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
int width = MAX(view->current.width - 2 * theme->window_titlebar_padding_width, 0);
|
int width = MAX(view->current.width - 2 * theme->window_titlebar_padding_width, 0);
|
||||||
int button_width = theme->window_button_width;
|
int button_width = theme->window_button_width;
|
||||||
int button_spacing = theme->window_button_spacing;
|
int button_spacing = theme->window_button_spacing;
|
||||||
|
|
@ -273,7 +273,7 @@ ssd_titlebar_update(struct ssd *ssd)
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int corner_width = ssd_get_corner_width();
|
int corner_width = ssd_get_corner_width();
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
||||||
bool squared = ssd_should_be_squared(ssd);
|
bool squared = ssd_should_be_squared(ssd);
|
||||||
|
|
@ -365,7 +365,7 @@ static void
|
||||||
ssd_update_title_positions(struct ssd *ssd, int offset_left, int offset_right)
|
ssd_update_title_positions(struct ssd *ssd, int offset_left, int offset_right)
|
||||||
{
|
{
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
int title_bg_width = width - offset_left - offset_right;
|
int title_bg_width = width - offset_left - offset_right;
|
||||||
|
|
||||||
|
|
@ -413,9 +413,9 @@ static void
|
||||||
get_title_offsets(struct ssd *ssd, int *offset_left, int *offset_right)
|
get_title_offsets(struct ssd *ssd, int *offset_left, int *offset_right)
|
||||||
{
|
{
|
||||||
struct ssd_titlebar_subtree *subtree = &ssd->titlebar.subtrees[SSD_ACTIVE];
|
struct ssd_titlebar_subtree *subtree = &ssd->titlebar.subtrees[SSD_ACTIVE];
|
||||||
int button_width = g_server.theme->window_button_width;
|
int button_width = server.theme->window_button_width;
|
||||||
int button_spacing = g_server.theme->window_button_spacing;
|
int button_spacing = server.theme->window_button_spacing;
|
||||||
int padding_width = g_server.theme->window_titlebar_padding_width;
|
int padding_width = server.theme->window_titlebar_padding_width;
|
||||||
*offset_left = padding_width;
|
*offset_left = padding_width;
|
||||||
*offset_right = padding_width;
|
*offset_right = padding_width;
|
||||||
|
|
||||||
|
|
@ -443,7 +443,7 @@ ssd_update_title(struct ssd *ssd)
|
||||||
/* view->title is never NULL (instead it can be an empty string) */
|
/* view->title is never NULL (instead it can be an empty string) */
|
||||||
assert(view->title);
|
assert(view->title);
|
||||||
|
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
struct ssd_state_title *state = &ssd->state.title;
|
struct ssd_state_title *state = &ssd->state.title;
|
||||||
bool title_unchanged = state->text && !strcmp(view->title, state->text);
|
bool title_unchanged = state->text && !strcmp(view->title, state->text);
|
||||||
|
|
||||||
|
|
@ -493,17 +493,17 @@ ssd_update_hovered_button(struct wlr_scene_node *node)
|
||||||
|
|
||||||
if (node && node->data) {
|
if (node && node->data) {
|
||||||
button = node_try_ssd_button_from_node(node);
|
button = node_try_ssd_button_from_node(node);
|
||||||
if (button == g_server.hovered_button) {
|
if (button == server.hovered_button) {
|
||||||
/* Cursor is still on the same button */
|
/* Cursor is still on the same button */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable old hover */
|
/* Disable old hover */
|
||||||
if (g_server.hovered_button) {
|
if (server.hovered_button) {
|
||||||
update_button_state(g_server.hovered_button, LAB_BS_HOVERED, false);
|
update_button_state(server.hovered_button, LAB_BS_HOVERED, false);
|
||||||
}
|
}
|
||||||
g_server.hovered_button = button;
|
server.hovered_button = button;
|
||||||
if (button) {
|
if (button) {
|
||||||
update_button_state(button, LAB_BS_HOVERED, true);
|
update_button_state(button, LAB_BS_HOVERED, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ ssd_thickness(struct view *view)
|
||||||
return (struct border){ 0 };
|
return (struct border){ 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
if (view->maximized == VIEW_AXIS_BOTH) {
|
if (view->maximized == VIEW_AXIS_BOTH) {
|
||||||
struct border thickness = { 0 };
|
struct border thickness = { 0 };
|
||||||
|
|
@ -101,7 +101,7 @@ ssd_get_resizing_type(const struct ssd *ssd, struct wlr_cursor *cursor)
|
||||||
|
|
||||||
if (view_titlebar_visible(view)) {
|
if (view_titlebar_visible(view)) {
|
||||||
/* If the titlebar is visible, consider it part of the view */
|
/* If the titlebar is visible, consider it part of the view */
|
||||||
int titlebar_height = g_server.theme->titlebar_height;
|
int titlebar_height = server.theme->titlebar_height;
|
||||||
view_box.y -= titlebar_height;
|
view_box.y -= titlebar_height;
|
||||||
view_box.height += titlebar_height;
|
view_box.height += titlebar_height;
|
||||||
}
|
}
|
||||||
|
|
@ -156,7 +156,7 @@ ssd_create(struct view *view, bool active)
|
||||||
LAB_NODE_SSD_ROOT, view, /*data*/ NULL);
|
LAB_NODE_SSD_ROOT, view, /*data*/ NULL);
|
||||||
|
|
||||||
wlr_scene_node_lower_to_bottom(&ssd->tree->node);
|
wlr_scene_node_lower_to_bottom(&ssd->tree->node);
|
||||||
ssd->titlebar.height = g_server.theme->titlebar_height;
|
ssd->titlebar.height = server.theme->titlebar_height;
|
||||||
ssd_shadow_create(ssd);
|
ssd_shadow_create(ssd);
|
||||||
ssd_extents_create(ssd);
|
ssd_extents_create(ssd);
|
||||||
/*
|
/*
|
||||||
|
|
@ -257,7 +257,7 @@ ssd_set_titlebar(struct ssd *ssd, bool enabled)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_scene_node_set_enabled(&ssd->titlebar.tree->node, enabled);
|
wlr_scene_node_set_enabled(&ssd->titlebar.tree->node, enabled);
|
||||||
ssd->titlebar.height = enabled ? g_server.theme->titlebar_height : 0;
|
ssd->titlebar.height = enabled ? server.theme->titlebar_height : 0;
|
||||||
ssd_border_update(ssd);
|
ssd_border_update(ssd);
|
||||||
ssd_extents_update(ssd);
|
ssd_extents_update(ssd);
|
||||||
ssd_shadow_update(ssd);
|
ssd_shadow_update(ssd);
|
||||||
|
|
@ -273,9 +273,9 @@ ssd_destroy(struct ssd *ssd)
|
||||||
|
|
||||||
/* Maybe reset hover view */
|
/* Maybe reset hover view */
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
if (g_server.hovered_button && node_view_from_node(
|
if (server.hovered_button && node_view_from_node(
|
||||||
g_server.hovered_button->node) == view) {
|
server.hovered_button->node) == view) {
|
||||||
g_server.hovered_button = NULL;
|
server.hovered_button = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy subcomponents */
|
/* Destroy subcomponents */
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ handle_tearing_new_object(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
enum wp_tearing_control_v1_presentation_hint hint =
|
enum wp_tearing_control_v1_presentation_hint hint =
|
||||||
wlr_tearing_control_manager_v1_surface_hint_from_surface
|
wlr_tearing_control_manager_v1_surface_hint_from_surface
|
||||||
(g_server.tearing_control, tearing_control->surface);
|
(server.tearing_control, tearing_control->surface);
|
||||||
wlr_log(WLR_DEBUG, "New presentation hint %d received for surface %p",
|
wlr_log(WLR_DEBUG, "New presentation hint %d received for surface %p",
|
||||||
hint, tearing_control->surface);
|
hint, tearing_control->surface);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -634,7 +634,7 @@ theme_builtin(struct theme *theme)
|
||||||
theme->osd_border_color[0] = FLT_MIN;
|
theme->osd_border_color[0] = FLT_MIN;
|
||||||
theme->osd_label_text_color[0] = FLT_MIN;
|
theme->osd_label_text_color[0] = FLT_MIN;
|
||||||
|
|
||||||
if (wlr_renderer_is_pixman(g_server.renderer)) {
|
if (wlr_renderer_is_pixman(server.renderer)) {
|
||||||
/* Draw only outlined overlay by default to save CPU resource */
|
/* Draw only outlined overlay by default to save CPU resource */
|
||||||
theme->snapping_overlay_region.bg_enabled = false;
|
theme->snapping_overlay_region.bg_enabled = false;
|
||||||
theme->snapping_overlay_edge.bg_enabled = false;
|
theme->snapping_overlay_edge.bg_enabled = false;
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,11 @@ view_impl_unmap(struct view *view)
|
||||||
* When exiting an xwayland application with multiple views
|
* When exiting an xwayland application with multiple views
|
||||||
* mapped, a race condition can occur: after the topmost view
|
* mapped, a race condition can occur: after the topmost view
|
||||||
* is unmapped, the next view under it is offered focus, but is
|
* is unmapped, the next view under it is offered focus, but is
|
||||||
* also unmapped before accepting focus (so g_server.active_view
|
* also unmapped before accepting focus (so server.active_view
|
||||||
* remains NULL). To avoid being left with no active view at
|
* remains NULL). To avoid being left with no active view at
|
||||||
* all, check for that case also.
|
* all, check for that case also.
|
||||||
*/
|
*/
|
||||||
if (view == g_server.active_view || !g_server.active_view) {
|
if (view == server.active_view || !server.active_view) {
|
||||||
desktop_focus_topmost_view();
|
desktop_focus_topmost_view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,9 +71,9 @@ view_impl_unmap(struct view *view)
|
||||||
static bool
|
static bool
|
||||||
resizing_edge(struct view *view, enum lab_edge edge)
|
resizing_edge(struct view *view, enum lab_edge edge)
|
||||||
{
|
{
|
||||||
return g_server.input_mode == LAB_INPUT_STATE_RESIZE
|
return server.input_mode == LAB_INPUT_STATE_RESIZE
|
||||||
&& g_server.grabbed_view == view
|
&& server.grabbed_view == view
|
||||||
&& (g_server.resize_edges & edge);
|
&& (server.resize_edges & edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
62
src/view.c
62
src/view.c
|
|
@ -69,7 +69,7 @@ security_context_from_view(struct view *view)
|
||||||
if (view && view->surface && view->surface->resource) {
|
if (view && view->surface && view->surface->resource) {
|
||||||
struct wl_client *client = wl_resource_get_client(view->surface->resource);
|
struct wl_client *client = wl_resource_get_client(view->surface->resource);
|
||||||
return wlr_security_context_manager_v1_lookup_client(
|
return wlr_security_context_manager_v1_lookup_client(
|
||||||
g_server.security_context_manager_v1, client);
|
server.security_context_manager_v1, client);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +176,7 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!query_tristate_match(query->focused, g_server.active_view == view)) {
|
if (!query_tristate_match(query->focused, server.active_view == view)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +202,7 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
|
|
||||||
if (query->desktop) {
|
if (query->desktop) {
|
||||||
const char *view_workspace = view->workspace->name;
|
const char *view_workspace = view->workspace->name;
|
||||||
struct workspace *current = g_server.workspaces.current;
|
struct workspace *current = server.workspaces.current;
|
||||||
|
|
||||||
if (!strcasecmp(query->desktop, "other")) {
|
if (!strcasecmp(query->desktop, "other")) {
|
||||||
/* "other" means the view is NOT on the current desktop */
|
/* "other" means the view is NOT on the current desktop */
|
||||||
|
|
@ -268,7 +268,7 @@ matches_criteria(struct view *view, enum lab_view_criteria criteria)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (criteria & LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
if (criteria & LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||||
if (view->workspace != g_server.workspaces.current) {
|
if (view->workspace != server.workspaces.current) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -342,7 +342,7 @@ view_array_append(struct wl_array *views,
|
||||||
enum lab_view_criteria criteria)
|
enum lab_view_criteria criteria)
|
||||||
{
|
{
|
||||||
struct view *view;
|
struct view *view;
|
||||||
for_each_view(view, &g_server.views, criteria) {
|
for_each_view(view, &server.views, criteria) {
|
||||||
struct view **entry = wl_array_add(views, sizeof(*entry));
|
struct view **entry = wl_array_add(views, sizeof(*entry));
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
wlr_log(WLR_ERROR, "wl_array_add(): out of memory");
|
wlr_log(WLR_ERROR, "wl_array_add(): out of memory");
|
||||||
|
|
@ -472,10 +472,10 @@ view_set_activated(struct view *view, bool activated)
|
||||||
if (!activated) {
|
if (!activated) {
|
||||||
/* Store configured keyboard layout per view */
|
/* Store configured keyboard layout per view */
|
||||||
view->keyboard_layout =
|
view->keyboard_layout =
|
||||||
g_server.seat.keyboard_group->keyboard.modifiers.group;
|
server.seat.keyboard_group->keyboard.modifiers.group;
|
||||||
} else {
|
} else {
|
||||||
/* Switch to previously stored keyboard layout */
|
/* Switch to previously stored keyboard layout */
|
||||||
keyboard_update_layout(&g_server.seat, view->keyboard_layout);
|
keyboard_update_layout(&server.seat, view->keyboard_layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output_set_has_fullscreen_view(view->output, view->fullscreen);
|
output_set_has_fullscreen_view(view->output, view->fullscreen);
|
||||||
|
|
@ -509,10 +509,10 @@ static void
|
||||||
view_update_outputs(struct view *view)
|
view_update_outputs(struct view *view)
|
||||||
{
|
{
|
||||||
struct output *output;
|
struct output *output;
|
||||||
struct wlr_output_layout *layout = g_server.output_layout;
|
struct wlr_output_layout *layout = server.output_layout;
|
||||||
|
|
||||||
uint64_t new_outputs = 0;
|
uint64_t new_outputs = 0;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (output_is_usable(output) && wlr_output_layout_intersects(
|
if (output_is_usable(output) && wlr_output_layout_intersects(
|
||||||
layout, output->wlr_output, &view->current)) {
|
layout, output->wlr_output, &view->current)) {
|
||||||
new_outputs |= output->id_bit;
|
new_outputs |= output->id_bit;
|
||||||
|
|
@ -562,7 +562,7 @@ view_moved(struct view *view)
|
||||||
view_update_outputs(view);
|
view_update_outputs(view);
|
||||||
ssd_update_geometry(view->ssd);
|
ssd_update_geometry(view->ssd);
|
||||||
cursor_update_focus();
|
cursor_update_focus();
|
||||||
if (rc.resize_indicator && g_server.grabbed_view == view) {
|
if (rc.resize_indicator && server.grabbed_view == view) {
|
||||||
resize_indicator_update(view);
|
resize_indicator_update(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -641,7 +641,7 @@ view_compute_near_cursor_position(struct view *view, struct wlr_box *geom)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct border margin = ssd_thickness(view);
|
struct border margin = ssd_thickness(view);
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
int total_width = geom->width + margin.left + margin.right;
|
int total_width = geom->width + margin.left + margin.right;
|
||||||
int total_height = geom->height + margin.top + margin.bottom;
|
int total_height = geom->height + margin.top + margin.bottom;
|
||||||
|
|
@ -746,7 +746,7 @@ _minimize(struct view *view, bool minimized, bool *need_refocus)
|
||||||
* - unminimizing any mapped view
|
* - unminimizing any mapped view
|
||||||
*/
|
*/
|
||||||
*need_refocus |= (minimized ?
|
*need_refocus |= (minimized ?
|
||||||
(view == g_server.active_view) : view->mapped);
|
(view == server.active_view) : view->mapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -785,7 +785,7 @@ view_minimize(struct view *view, bool minimized)
|
||||||
assert(view);
|
assert(view);
|
||||||
bool need_refocus = false;
|
bool need_refocus = false;
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
if (server.input_mode == LAB_INPUT_STATE_CYCLE) {
|
||||||
wlr_log(WLR_ERROR, "not minimizing window while window switching");
|
wlr_log(WLR_ERROR, "not minimizing window while window switching");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -860,7 +860,7 @@ adjust_floating_geometry(struct view *view, struct wlr_box *geometry,
|
||||||
|
|
||||||
bool adjusted = false;
|
bool adjusted = false;
|
||||||
bool onscreen = false;
|
bool onscreen = false;
|
||||||
if (wlr_output_layout_intersects(g_server.output_layout,
|
if (wlr_output_layout_intersects(server.output_layout,
|
||||||
view->output->wlr_output, geometry)) {
|
view->output->wlr_output, geometry)) {
|
||||||
/* Always make sure the titlebar starts within the usable area */
|
/* Always make sure the titlebar starts within the usable area */
|
||||||
struct border margin = ssd_get_margin(view->ssd);
|
struct border margin = ssd_get_margin(view->ssd);
|
||||||
|
|
@ -994,7 +994,7 @@ view_compute_cascaded_position(struct view *view, struct wlr_box *geom)
|
||||||
/* TODO: move this logic to rcxml.c */
|
/* TODO: move this logic to rcxml.c */
|
||||||
int offset_x = rc.placement_cascade_offset_x;
|
int offset_x = rc.placement_cascade_offset_x;
|
||||||
int offset_y = rc.placement_cascade_offset_y;
|
int offset_y = rc.placement_cascade_offset_y;
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
int default_offset = theme->titlebar_height + theme->border_width + 5;
|
int default_offset = theme->titlebar_height + theme->border_width + 5;
|
||||||
if (offset_x <= 0) {
|
if (offset_x <= 0) {
|
||||||
offset_x = default_offset;
|
offset_x = default_offset;
|
||||||
|
|
@ -1014,7 +1014,7 @@ view_compute_cascaded_position(struct view *view, struct wlr_box *geom)
|
||||||
|
|
||||||
/* Iterate over views from top to bottom */
|
/* Iterate over views from top to bottom */
|
||||||
struct view *other_view;
|
struct view *other_view;
|
||||||
for_each_view(other_view, &g_server.views,
|
for_each_view(other_view, &server.views,
|
||||||
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||||
struct wlr_box other = ssd_max_extents(other_view);
|
struct wlr_box other = ssd_max_extents(other_view);
|
||||||
if (other_view == view
|
if (other_view == view
|
||||||
|
|
@ -1249,7 +1249,7 @@ view_apply_fullscreen_geometry(struct view *view)
|
||||||
assert(output_is_usable(view->output));
|
assert(output_is_usable(view->output));
|
||||||
|
|
||||||
struct wlr_box box = { 0 };
|
struct wlr_box box = { 0 };
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
view->output->wlr_output, &box);
|
view->output->wlr_output, &box);
|
||||||
view_move_resize(view, box);
|
view_move_resize(view, box);
|
||||||
}
|
}
|
||||||
|
|
@ -1403,8 +1403,8 @@ view_set_untiled(struct view *view)
|
||||||
static bool
|
static bool
|
||||||
in_interactive_move(struct view *view)
|
in_interactive_move(struct view *view)
|
||||||
{
|
{
|
||||||
return (g_server.input_mode == LAB_INPUT_STATE_MOVE
|
return (server.input_mode == LAB_INPUT_STATE_MOVE
|
||||||
&& g_server.grabbed_view == view);
|
&& server.grabbed_view == view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1598,7 +1598,7 @@ decorate(struct view *view)
|
||||||
{
|
{
|
||||||
if (!view->ssd) {
|
if (!view->ssd) {
|
||||||
view->ssd = ssd_create(view,
|
view->ssd = ssd_create(view,
|
||||||
view == g_server.active_view);
|
view == server.active_view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2166,7 +2166,7 @@ static void
|
||||||
move_to_front(struct view *view)
|
move_to_front(struct view *view)
|
||||||
{
|
{
|
||||||
wl_list_remove(&view->link);
|
wl_list_remove(&view->link);
|
||||||
wl_list_insert(&g_server.views, &view->link);
|
wl_list_insert(&server.views, &view->link);
|
||||||
wlr_scene_node_raise_to_top(&view->scene_tree->node);
|
wlr_scene_node_raise_to_top(&view->scene_tree->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2174,7 +2174,7 @@ static void
|
||||||
move_to_back(struct view *view)
|
move_to_back(struct view *view)
|
||||||
{
|
{
|
||||||
wl_list_remove(&view->link);
|
wl_list_remove(&view->link);
|
||||||
wl_list_append(&g_server.views, &view->link);
|
wl_list_append(&server.views, &view->link);
|
||||||
wlr_scene_node_lower_to_bottom(&view->scene_tree->node);
|
wlr_scene_node_lower_to_bottom(&view->scene_tree->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2188,14 +2188,14 @@ void
|
||||||
view_move_to_front(struct view *view)
|
view_move_to_front(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
assert(!wl_list_empty(&g_server.views));
|
assert(!wl_list_empty(&server.views));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether the view is already in front, or is the root
|
* Check whether the view is already in front, or is the root
|
||||||
* parent of the view in front (in which case we don't want to
|
* parent of the view in front (in which case we don't want to
|
||||||
* raise it in front of its sub-view).
|
* raise it in front of its sub-view).
|
||||||
*/
|
*/
|
||||||
struct view *front = wl_container_of(g_server.views.next, front, link);
|
struct view *front = wl_container_of(server.views.next, front, link);
|
||||||
if (view == front || view == view_get_root(front)) {
|
if (view == front || view == view_get_root(front)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2422,7 +2422,7 @@ view_set_shade(struct view *view, bool shaded)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this window is being resized, cancel the resize when shading */
|
/* If this window is being resized, cancel the resize when shading */
|
||||||
if (shaded && g_server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
if (shaded && server.input_mode == LAB_INPUT_STATE_RESIZE) {
|
||||||
interactive_cancel(view);
|
interactive_cancel(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2511,16 +2511,16 @@ view_destroy(struct view *view)
|
||||||
* This check is (in theory) redundant since interactive_cancel()
|
* This check is (in theory) redundant since interactive_cancel()
|
||||||
* is called at unmap. Leaving it here just to be sure.
|
* is called at unmap. Leaving it here just to be sure.
|
||||||
*/
|
*/
|
||||||
if (g_server.grabbed_view == view) {
|
if (server.grabbed_view == view) {
|
||||||
interactive_cancel(view);
|
interactive_cancel(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.active_view == view) {
|
if (server.active_view == view) {
|
||||||
g_server.active_view = NULL;
|
server.active_view = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.session_lock_manager->last_active_view == view) {
|
if (server.session_lock_manager->last_active_view == view) {
|
||||||
g_server.session_lock_manager->last_active_view = NULL;
|
server.session_lock_manager->last_active_view = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->tiled_region_evacuate) {
|
if (view->tiled_region_evacuate) {
|
||||||
|
|
@ -2560,7 +2560,7 @@ view_destroy(struct view *view)
|
||||||
zfree(view->title);
|
zfree(view->title);
|
||||||
zfree(view->app_id);
|
zfree(view->app_id);
|
||||||
|
|
||||||
/* Remove view from g_server.views */
|
/* Remove view from server.views */
|
||||||
wl_list_remove(&view->link);
|
wl_list_remove(&view->link);
|
||||||
free(view);
|
free(view);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
static bool
|
static bool
|
||||||
other_instances_exist(struct view *self, struct view_query *query)
|
other_instances_exist(struct view *self, struct view_query *query)
|
||||||
{
|
{
|
||||||
struct wl_list *views = &g_server.views;
|
struct wl_list *views = &server.views;
|
||||||
struct view *view;
|
struct view *view;
|
||||||
|
|
||||||
wl_list_for_each(view, views, link) {
|
wl_list_for_each(view, views, link) {
|
||||||
|
|
|
||||||
122
src/workspaces.c
122
src/workspaces.c
|
|
@ -64,7 +64,7 @@ parse_workspace_index(const char *name)
|
||||||
static void
|
static void
|
||||||
_osd_update(void)
|
_osd_update(void)
|
||||||
{
|
{
|
||||||
struct theme *theme = g_server.theme;
|
struct theme *theme = server.theme;
|
||||||
|
|
||||||
/* Settings */
|
/* Settings */
|
||||||
uint16_t margin = 10;
|
uint16_t margin = 10;
|
||||||
|
|
@ -75,7 +75,7 @@ _osd_update(void)
|
||||||
theme->osd_workspace_switcher_boxes_height == 0;
|
theme->osd_workspace_switcher_boxes_height == 0;
|
||||||
|
|
||||||
/* Dimensions */
|
/* Dimensions */
|
||||||
size_t workspace_count = wl_list_length(&g_server.workspaces.all);
|
size_t workspace_count = wl_list_length(&server.workspaces.all);
|
||||||
uint16_t marker_width = workspace_count * (rect_width + padding) - padding;
|
uint16_t marker_width = workspace_count * (rect_width + padding) - padding;
|
||||||
uint16_t width = margin * 2 + (marker_width < 200 ? 200 : marker_width);
|
uint16_t width = margin * 2 + (marker_width < 200 ? 200 : marker_width);
|
||||||
uint16_t height = margin * (hide_boxes ? 2 : 3) + rect_height + font_height(&rc.font_osd);
|
uint16_t height = margin * (hide_boxes ? 2 : 3) + rect_height + font_height(&rc.font_osd);
|
||||||
|
|
@ -85,7 +85,7 @@ _osd_update(void)
|
||||||
struct workspace *workspace;
|
struct workspace *workspace;
|
||||||
|
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -115,9 +115,9 @@ _osd_update(void)
|
||||||
uint16_t x;
|
uint16_t x;
|
||||||
if (!hide_boxes) {
|
if (!hide_boxes) {
|
||||||
x = (width - marker_width) / 2;
|
x = (width - marker_width) / 2;
|
||||||
wl_list_for_each(workspace, &g_server.workspaces.all, link) {
|
wl_list_for_each(workspace, &server.workspaces.all, link) {
|
||||||
bool active = workspace == g_server.workspaces.current;
|
bool active = workspace == server.workspaces.current;
|
||||||
set_cairo_color(cairo, g_server.theme->osd_label_text_color);
|
set_cairo_color(cairo, server.theme->osd_label_text_color);
|
||||||
struct wlr_fbox fbox = {
|
struct wlr_fbox fbox = {
|
||||||
.x = x,
|
.x = x,
|
||||||
.y = margin,
|
.y = margin,
|
||||||
|
|
@ -136,13 +136,13 @@ _osd_update(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Text */
|
/* Text */
|
||||||
set_cairo_color(cairo, g_server.theme->osd_label_text_color);
|
set_cairo_color(cairo, server.theme->osd_label_text_color);
|
||||||
PangoLayout *layout = pango_cairo_create_layout(cairo);
|
PangoLayout *layout = pango_cairo_create_layout(cairo);
|
||||||
pango_context_set_round_glyph_positions(pango_layout_get_context(layout), false);
|
pango_context_set_round_glyph_positions(pango_layout_get_context(layout), false);
|
||||||
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
|
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
|
||||||
|
|
||||||
/* Center workspace indicator on the x axis */
|
/* Center workspace indicator on the x axis */
|
||||||
int req_width = font_width(&rc.font_osd, g_server.workspaces.current->name);
|
int req_width = font_width(&rc.font_osd, server.workspaces.current->name);
|
||||||
req_width = MIN(req_width, width - 2 * margin);
|
req_width = MIN(req_width, width - 2 * margin);
|
||||||
x = (width - req_width) / 2;
|
x = (width - req_width) / 2;
|
||||||
if (!hide_boxes) {
|
if (!hide_boxes) {
|
||||||
|
|
@ -155,7 +155,7 @@ _osd_update(void)
|
||||||
pango_layout_set_font_description(layout, desc);
|
pango_layout_set_font_description(layout, desc);
|
||||||
pango_layout_set_width(layout, req_width * PANGO_SCALE);
|
pango_layout_set_width(layout, req_width * PANGO_SCALE);
|
||||||
pango_font_description_free(desc);
|
pango_font_description_free(desc);
|
||||||
pango_layout_set_text(layout, g_server.workspaces.current->name, -1);
|
pango_layout_set_text(layout, server.workspaces.current->name, -1);
|
||||||
pango_cairo_show_layout(cairo, layout);
|
pango_cairo_show_layout(cairo, layout);
|
||||||
|
|
||||||
g_object_unref(layout);
|
g_object_unref(layout);
|
||||||
|
|
@ -165,11 +165,11 @@ _osd_update(void)
|
||||||
|
|
||||||
if (!output->workspace_osd) {
|
if (!output->workspace_osd) {
|
||||||
output->workspace_osd = lab_wlr_scene_buffer_create(
|
output->workspace_osd = lab_wlr_scene_buffer_create(
|
||||||
&g_server.scene->tree, NULL);
|
&server.scene->tree, NULL);
|
||||||
}
|
}
|
||||||
/* Position the whole thing */
|
/* Position the whole thing */
|
||||||
struct wlr_box output_box;
|
struct wlr_box output_box;
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
output->wlr_output, &output_box);
|
output->wlr_output, &output_box);
|
||||||
int lx = output_box.x + (output_box.width - width) / 2;
|
int lx = output_box.x + (output_box.width - width) / 2;
|
||||||
int ly = output_box.y + (output_box.height - height) / 2;
|
int ly = output_box.y + (output_box.height - height) / 2;
|
||||||
|
|
@ -192,7 +192,7 @@ workspace_find_by_name(const char *name)
|
||||||
size_t parsed_index = parse_workspace_index(name);
|
size_t parsed_index = parse_workspace_index(name);
|
||||||
if (parsed_index) {
|
if (parsed_index) {
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
wl_list_for_each(workspace, &g_server.workspaces.all, link) {
|
wl_list_for_each(workspace, &server.workspaces.all, link) {
|
||||||
if (parsed_index == ++index) {
|
if (parsed_index == ++index) {
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +200,7 @@ workspace_find_by_name(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* by name */
|
/* by name */
|
||||||
wl_list_for_each(workspace, &g_server.workspaces.all, link) {
|
wl_list_for_each(workspace, &server.workspaces.all, link) {
|
||||||
if (!strcmp(workspace->name, name)) {
|
if (!strcmp(workspace->name, name)) {
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
@ -234,18 +234,18 @@ add_workspace(const char *name)
|
||||||
{
|
{
|
||||||
struct workspace *workspace = znew(*workspace);
|
struct workspace *workspace = znew(*workspace);
|
||||||
workspace->name = xstrdup(name);
|
workspace->name = xstrdup(name);
|
||||||
workspace->tree = lab_wlr_scene_tree_create(g_server.workspace_tree);
|
workspace->tree = lab_wlr_scene_tree_create(server.workspace_tree);
|
||||||
workspace->view_trees[VIEW_LAYER_ALWAYS_ON_BOTTOM] =
|
workspace->view_trees[VIEW_LAYER_ALWAYS_ON_BOTTOM] =
|
||||||
lab_wlr_scene_tree_create(workspace->tree);
|
lab_wlr_scene_tree_create(workspace->tree);
|
||||||
workspace->view_trees[VIEW_LAYER_NORMAL] =
|
workspace->view_trees[VIEW_LAYER_NORMAL] =
|
||||||
lab_wlr_scene_tree_create(workspace->tree);
|
lab_wlr_scene_tree_create(workspace->tree);
|
||||||
workspace->view_trees[VIEW_LAYER_ALWAYS_ON_TOP] =
|
workspace->view_trees[VIEW_LAYER_ALWAYS_ON_TOP] =
|
||||||
lab_wlr_scene_tree_create(workspace->tree);
|
lab_wlr_scene_tree_create(workspace->tree);
|
||||||
wl_list_append(&g_server.workspaces.all, &workspace->link);
|
wl_list_append(&server.workspaces.all, &workspace->link);
|
||||||
wlr_scene_node_set_enabled(&workspace->tree->node, false);
|
wlr_scene_node_set_enabled(&workspace->tree->node, false);
|
||||||
|
|
||||||
/* cosmic */
|
/* cosmic */
|
||||||
workspace->cosmic_workspace = lab_cosmic_workspace_create(g_server.workspaces.cosmic_group);
|
workspace->cosmic_workspace = lab_cosmic_workspace_create(server.workspaces.cosmic_group);
|
||||||
lab_cosmic_workspace_set_name(workspace->cosmic_workspace, name);
|
lab_cosmic_workspace_set_name(workspace->cosmic_workspace, name);
|
||||||
|
|
||||||
workspace->on_cosmic.activate.notify = handle_cosmic_workspace_activate;
|
workspace->on_cosmic.activate.notify = handle_cosmic_workspace_activate;
|
||||||
|
|
@ -254,8 +254,8 @@ add_workspace(const char *name)
|
||||||
|
|
||||||
/* ext */
|
/* ext */
|
||||||
workspace->ext_workspace = lab_ext_workspace_create(
|
workspace->ext_workspace = lab_ext_workspace_create(
|
||||||
g_server.workspaces.ext_manager, /*id*/ NULL);
|
server.workspaces.ext_manager, /*id*/ NULL);
|
||||||
lab_ext_workspace_assign_to_group(workspace->ext_workspace, g_server.workspaces.ext_group);
|
lab_ext_workspace_assign_to_group(workspace->ext_workspace, server.workspaces.ext_group);
|
||||||
lab_ext_workspace_set_name(workspace->ext_workspace, name);
|
lab_ext_workspace_set_name(workspace->ext_workspace, name);
|
||||||
|
|
||||||
workspace->on_ext.activate.notify = handle_ext_workspace_activate;
|
workspace->on_ext.activate.notify = handle_ext_workspace_activate;
|
||||||
|
|
@ -298,7 +298,7 @@ workspace_has_views(struct workspace *workspace)
|
||||||
{
|
{
|
||||||
struct view *view;
|
struct view *view;
|
||||||
|
|
||||||
for_each_view(view, &g_server.views, LAB_VIEW_CRITERIA_NO_OMNIPRESENT) {
|
for_each_view(view, &server.views, LAB_VIEW_CRITERIA_NO_OMNIPRESENT) {
|
||||||
if (view->workspace == workspace) {
|
if (view->workspace == workspace) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -379,21 +379,21 @@ _osd_show(void)
|
||||||
|
|
||||||
_osd_update();
|
_osd_update();
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (output_is_usable(output) && output->workspace_osd) {
|
if (output_is_usable(output) && output->workspace_osd) {
|
||||||
wlr_scene_node_set_enabled(&output->workspace_osd->node, true);
|
wlr_scene_node_set_enabled(&output->workspace_osd->node, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keyboard_get_all_modifiers(&g_server.seat)) {
|
if (keyboard_get_all_modifiers(&server.seat)) {
|
||||||
/* Hidden by release of all modifiers */
|
/* Hidden by release of all modifiers */
|
||||||
g_server.seat.workspace_osd_shown_by_modifier = true;
|
server.seat.workspace_osd_shown_by_modifier = true;
|
||||||
} else {
|
} else {
|
||||||
/* Hidden by timer */
|
/* Hidden by timer */
|
||||||
if (!g_server.seat.workspace_osd_timer) {
|
if (!server.seat.workspace_osd_timer) {
|
||||||
g_server.seat.workspace_osd_timer = wl_event_loop_add_timer(
|
server.seat.workspace_osd_timer = wl_event_loop_add_timer(
|
||||||
g_server.wl_event_loop, _osd_handle_timeout, &g_server.seat);
|
server.wl_event_loop, _osd_handle_timeout, &server.seat);
|
||||||
}
|
}
|
||||||
wl_event_source_timer_update(g_server.seat.workspace_osd_timer,
|
wl_event_source_timer_update(server.seat.workspace_osd_timer,
|
||||||
rc.workspace_config.popuptime);
|
rc.workspace_config.popuptime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -402,21 +402,21 @@ _osd_show(void)
|
||||||
void
|
void
|
||||||
workspaces_init(void)
|
workspaces_init(void)
|
||||||
{
|
{
|
||||||
g_server.workspaces.cosmic_manager = lab_cosmic_workspace_manager_create(
|
server.workspaces.cosmic_manager = lab_cosmic_workspace_manager_create(
|
||||||
g_server.wl_display, /* capabilities */ CW_CAP_WS_ACTIVATE,
|
server.wl_display, /* capabilities */ CW_CAP_WS_ACTIVATE,
|
||||||
COSMIC_WORKSPACES_VERSION);
|
COSMIC_WORKSPACES_VERSION);
|
||||||
|
|
||||||
g_server.workspaces.ext_manager = lab_ext_workspace_manager_create(
|
server.workspaces.ext_manager = lab_ext_workspace_manager_create(
|
||||||
g_server.wl_display, /* capabilities */ WS_CAP_WS_ACTIVATE,
|
server.wl_display, /* capabilities */ WS_CAP_WS_ACTIVATE,
|
||||||
EXT_WORKSPACES_VERSION);
|
EXT_WORKSPACES_VERSION);
|
||||||
|
|
||||||
g_server.workspaces.cosmic_group = lab_cosmic_workspace_group_create(
|
server.workspaces.cosmic_group = lab_cosmic_workspace_group_create(
|
||||||
g_server.workspaces.cosmic_manager);
|
server.workspaces.cosmic_manager);
|
||||||
|
|
||||||
g_server.workspaces.ext_group = lab_ext_workspace_group_create(
|
server.workspaces.ext_group = lab_ext_workspace_group_create(
|
||||||
g_server.workspaces.ext_manager);
|
server.workspaces.ext_manager);
|
||||||
|
|
||||||
wl_list_init(&g_server.workspaces.all);
|
wl_list_init(&server.workspaces.all);
|
||||||
|
|
||||||
struct workspace_config *conf;
|
struct workspace_config *conf;
|
||||||
wl_list_for_each(conf, &rc.workspace_config.workspaces, link) {
|
wl_list_for_each(conf, &rc.workspace_config.workspaces, link) {
|
||||||
|
|
@ -430,7 +430,7 @@ workspaces_init(void)
|
||||||
char *initial_name = rc.workspace_config.initial_workspace_name;
|
char *initial_name = rc.workspace_config.initial_workspace_name;
|
||||||
struct workspace *initial = NULL;
|
struct workspace *initial = NULL;
|
||||||
struct workspace *first = wl_container_of(
|
struct workspace *first = wl_container_of(
|
||||||
g_server.workspaces.all.next, first, link);
|
server.workspaces.all.next, first, link);
|
||||||
|
|
||||||
if (initial_name) {
|
if (initial_name) {
|
||||||
initial = workspace_find_by_name(initial_name);
|
initial = workspace_find_by_name(initial_name);
|
||||||
|
|
@ -439,7 +439,7 @@ workspaces_init(void)
|
||||||
initial = first;
|
initial = first;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.workspaces.current = initial;
|
server.workspaces.current = initial;
|
||||||
wlr_scene_node_set_enabled(&initial->tree->node, true);
|
wlr_scene_node_set_enabled(&initial->tree->node, true);
|
||||||
lab_cosmic_workspace_set_active(initial->cosmic_workspace, true);
|
lab_cosmic_workspace_set_active(initial->cosmic_workspace, true);
|
||||||
lab_ext_workspace_set_active(initial->ext_workspace, true);
|
lab_ext_workspace_set_active(initial->ext_workspace, true);
|
||||||
|
|
@ -454,18 +454,18 @@ void
|
||||||
workspaces_switch_to(struct workspace *target, bool update_focus)
|
workspaces_switch_to(struct workspace *target, bool update_focus)
|
||||||
{
|
{
|
||||||
assert(target);
|
assert(target);
|
||||||
if (target == g_server.workspaces.current) {
|
if (target == server.workspaces.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable the old workspace */
|
/* Disable the old workspace */
|
||||||
wlr_scene_node_set_enabled(
|
wlr_scene_node_set_enabled(
|
||||||
&g_server.workspaces.current->tree->node, false);
|
&server.workspaces.current->tree->node, false);
|
||||||
|
|
||||||
lab_cosmic_workspace_set_active(
|
lab_cosmic_workspace_set_active(
|
||||||
g_server.workspaces.current->cosmic_workspace, false);
|
server.workspaces.current->cosmic_workspace, false);
|
||||||
lab_ext_workspace_set_active(
|
lab_ext_workspace_set_active(
|
||||||
g_server.workspaces.current->ext_workspace, false);
|
server.workspaces.current->ext_workspace, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move Omnipresent views to new workspace.
|
* Move Omnipresent views to new workspace.
|
||||||
|
|
@ -473,7 +473,7 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
|
||||||
* view_is_focusable() returns false (e.g. Conky).
|
* view_is_focusable() returns false (e.g. Conky).
|
||||||
*/
|
*/
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each_reverse(view, &g_server.views, link) {
|
wl_list_for_each_reverse(view, &server.views, link) {
|
||||||
if (view->visible_on_all_workspaces) {
|
if (view->visible_on_all_workspaces) {
|
||||||
view_move_to_workspace(view, target);
|
view_move_to_workspace(view, target);
|
||||||
}
|
}
|
||||||
|
|
@ -483,12 +483,12 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
|
||||||
wlr_scene_node_set_enabled(&target->tree->node, true);
|
wlr_scene_node_set_enabled(&target->tree->node, true);
|
||||||
|
|
||||||
/* Save the last visited workspace */
|
/* Save the last visited workspace */
|
||||||
g_server.workspaces.last = g_server.workspaces.current;
|
server.workspaces.last = server.workspaces.current;
|
||||||
|
|
||||||
/* Make sure new views will spawn on the new workspace */
|
/* Make sure new views will spawn on the new workspace */
|
||||||
g_server.workspaces.current = target;
|
server.workspaces.current = target;
|
||||||
|
|
||||||
struct view *grabbed_view = g_server.grabbed_view;
|
struct view *grabbed_view = server.grabbed_view;
|
||||||
if (grabbed_view) {
|
if (grabbed_view) {
|
||||||
view_move_to_workspace(grabbed_view, target);
|
view_move_to_workspace(grabbed_view, target);
|
||||||
}
|
}
|
||||||
|
|
@ -498,7 +498,7 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
|
||||||
* the focus is not already on an omnipresent view.
|
* the focus is not already on an omnipresent view.
|
||||||
*/
|
*/
|
||||||
if (update_focus) {
|
if (update_focus) {
|
||||||
struct view *active_view = g_server.active_view;
|
struct view *active_view = server.active_view;
|
||||||
if (!(active_view && active_view->visible_on_all_workspaces)) {
|
if (!(active_view && active_view->visible_on_all_workspaces)) {
|
||||||
desktop_focus_topmost_view();
|
desktop_focus_topmost_view();
|
||||||
}
|
}
|
||||||
|
|
@ -525,7 +525,7 @@ workspaces_osd_hide(struct seat *seat)
|
||||||
{
|
{
|
||||||
assert(seat);
|
assert(seat);
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!output->workspace_osd) {
|
if (!output->workspace_osd) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -545,12 +545,12 @@ workspaces_find(struct workspace *anchor, const char *name, bool wrap)
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct wl_list *workspaces = &g_server.workspaces.all;
|
struct wl_list *workspaces = &server.workspaces.all;
|
||||||
|
|
||||||
if (!strcasecmp(name, "current")) {
|
if (!strcasecmp(name, "current")) {
|
||||||
return anchor;
|
return anchor;
|
||||||
} else if (!strcasecmp(name, "last")) {
|
} else if (!strcasecmp(name, "last")) {
|
||||||
return g_server.workspaces.last;
|
return server.workspaces.last;
|
||||||
} else if (!strcasecmp(name, "left")) {
|
} else if (!strcasecmp(name, "left")) {
|
||||||
return get_prev(anchor, workspaces, wrap);
|
return get_prev(anchor, workspaces, wrap);
|
||||||
} else if (!strcasecmp(name, "right")) {
|
} else if (!strcasecmp(name, "right")) {
|
||||||
|
|
@ -587,14 +587,14 @@ workspaces_reconfigure(void)
|
||||||
* - Destroy workspaces if fewer workspace are desired
|
* - Destroy workspaces if fewer workspace are desired
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct wl_list *workspace_link = g_server.workspaces.all.next;
|
struct wl_list *workspace_link = server.workspaces.all.next;
|
||||||
|
|
||||||
struct workspace_config *conf;
|
struct workspace_config *conf;
|
||||||
wl_list_for_each(conf, &rc.workspace_config.workspaces, link) {
|
wl_list_for_each(conf, &rc.workspace_config.workspaces, link) {
|
||||||
struct workspace *workspace = wl_container_of(
|
struct workspace *workspace = wl_container_of(
|
||||||
workspace_link, workspace, link);
|
workspace_link, workspace, link);
|
||||||
|
|
||||||
if (workspace_link == &g_server.workspaces.all) {
|
if (workspace_link == &server.workspaces.all) {
|
||||||
/* # of configured workspaces increased */
|
/* # of configured workspaces increased */
|
||||||
wlr_log(WLR_DEBUG, "Adding workspace \"%s\"",
|
wlr_log(WLR_DEBUG, "Adding workspace \"%s\"",
|
||||||
conf->name);
|
conf->name);
|
||||||
|
|
@ -614,16 +614,16 @@ workspaces_reconfigure(void)
|
||||||
workspace_link = workspace_link->next;
|
workspace_link = workspace_link->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workspace_link == &g_server.workspaces.all) {
|
if (workspace_link == &server.workspaces.all) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* # of configured workspaces decreased */
|
/* # of configured workspaces decreased */
|
||||||
overlay_finish(&g_server.seat);
|
overlay_finish(&server.seat);
|
||||||
struct workspace *first_workspace =
|
struct workspace *first_workspace =
|
||||||
wl_container_of(g_server.workspaces.all.next, first_workspace, link);
|
wl_container_of(server.workspaces.all.next, first_workspace, link);
|
||||||
|
|
||||||
while (workspace_link != &g_server.workspaces.all) {
|
while (workspace_link != &server.workspaces.all) {
|
||||||
struct workspace *workspace = wl_container_of(
|
struct workspace *workspace = wl_container_of(
|
||||||
workspace_link, workspace, link);
|
workspace_link, workspace, link);
|
||||||
|
|
||||||
|
|
@ -631,18 +631,18 @@ workspaces_reconfigure(void)
|
||||||
workspace->name);
|
workspace->name);
|
||||||
|
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
if (view->workspace == workspace) {
|
if (view->workspace == workspace) {
|
||||||
view_move_to_workspace(view, first_workspace);
|
view_move_to_workspace(view, first_workspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.workspaces.current == workspace) {
|
if (server.workspaces.current == workspace) {
|
||||||
workspaces_switch_to(first_workspace,
|
workspaces_switch_to(first_workspace,
|
||||||
/* update_focus */ true);
|
/* update_focus */ true);
|
||||||
}
|
}
|
||||||
if (g_server.workspaces.last == workspace) {
|
if (server.workspaces.last == workspace) {
|
||||||
g_server.workspaces.last = first_workspace;
|
server.workspaces.last = first_workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
workspace_link = workspace_link->next;
|
workspace_link = workspace_link->next;
|
||||||
|
|
@ -654,8 +654,8 @@ void
|
||||||
workspaces_destroy(void)
|
workspaces_destroy(void)
|
||||||
{
|
{
|
||||||
struct workspace *workspace, *tmp;
|
struct workspace *workspace, *tmp;
|
||||||
wl_list_for_each_safe(workspace, tmp, &g_server.workspaces.all, link) {
|
wl_list_for_each_safe(workspace, tmp, &server.workspaces.all, link) {
|
||||||
destroy_workspace(workspace);
|
destroy_workspace(workspace);
|
||||||
}
|
}
|
||||||
assert(wl_list_empty(&g_server.workspaces.all));
|
assert(wl_list_empty(&server.workspaces.all));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,15 +149,15 @@ xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup)
|
||||||
* this, we always set the user data field of wlr_surfaces to the
|
* this, we always set the user data field of wlr_surfaces to the
|
||||||
* corresponding scene node.
|
* corresponding scene node.
|
||||||
*
|
*
|
||||||
* xdg-popups live in g_server.xdg_popup_tree so that they can be
|
* xdg-popups live in server.xdg_popup_tree so that they can be
|
||||||
* rendered above always-on-top windows
|
* rendered above always-on-top windows
|
||||||
*/
|
*/
|
||||||
struct wlr_scene_tree *parent_tree = NULL;
|
struct wlr_scene_tree *parent_tree = NULL;
|
||||||
if (parent->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
if (parent->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||||
parent_tree = parent->surface->data;
|
parent_tree = parent->surface->data;
|
||||||
} else {
|
} else {
|
||||||
parent_tree = g_server.xdg_popup_tree;
|
parent_tree = server.xdg_popup_tree;
|
||||||
wlr_scene_node_set_position(&g_server.xdg_popup_tree->node,
|
wlr_scene_node_set_position(&server.xdg_popup_tree->node,
|
||||||
view->current.x, view->current.y);
|
view->current.x, view->current.y);
|
||||||
}
|
}
|
||||||
wlr_popup->base->surface->data =
|
wlr_popup->base->surface->data =
|
||||||
|
|
|
||||||
66
src/xdg.c
66
src/xdg.c
|
|
@ -131,8 +131,8 @@ set_initial_position(struct view *view)
|
||||||
|
|
||||||
view_constrain_size_to_that_of_usable_area(view);
|
view_constrain_size_to_that_of_usable_area(view);
|
||||||
|
|
||||||
if (g_server.input_mode == LAB_INPUT_STATE_MOVE
|
if (server.input_mode == LAB_INPUT_STATE_MOVE
|
||||||
&& view == g_server.grabbed_view) {
|
&& view == server.grabbed_view) {
|
||||||
/* Reposition the view while anchoring it to cursor */
|
/* Reposition the view while anchoring it to cursor */
|
||||||
interactive_anchor_to_cursor(&view->pending);
|
interactive_anchor_to_cursor(&view->pending);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -173,7 +173,7 @@ center_fullscreen_if_needed(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box output_box = {0};
|
struct wlr_box output_box = {0};
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
view->output->wlr_output, &output_box);
|
view->output->wlr_output, &output_box);
|
||||||
box_center(view->current.width, view->current.height, &output_box,
|
box_center(view->current.width, view->current.height, &output_box,
|
||||||
&output_box, &view->current.x, &view->current.y);
|
&output_box, &view->current.x, &view->current.y);
|
||||||
|
|
@ -437,7 +437,7 @@ set_pending_configure_serial(struct view *view, uint32_t serial)
|
||||||
view->pending_configure_serial = serial;
|
view->pending_configure_serial = serial;
|
||||||
if (!view->pending_configure_timeout) {
|
if (!view->pending_configure_timeout) {
|
||||||
view->pending_configure_timeout =
|
view->pending_configure_timeout =
|
||||||
wl_event_loop_add_timer(g_server.wl_event_loop,
|
wl_event_loop_add_timer(server.wl_event_loop,
|
||||||
handle_configure_timeout, view);
|
handle_configure_timeout, view);
|
||||||
}
|
}
|
||||||
wl_event_source_timer_update(view->pending_configure_timeout,
|
wl_event_source_timer_update(view->pending_configure_timeout,
|
||||||
|
|
@ -485,7 +485,7 @@ handle_request_move(struct wl_listener *listener, void *data)
|
||||||
* this client, to prevent the client from requesting this whenever they
|
* this client, to prevent the client from requesting this whenever they
|
||||||
* want.
|
* want.
|
||||||
*
|
*
|
||||||
* Note: interactive_begin() checks that view == g_server.grabbed_view.
|
* Note: interactive_begin() checks that view == server.grabbed_view.
|
||||||
*/
|
*/
|
||||||
struct view *view = wl_container_of(listener, view, request_move);
|
struct view *view = wl_container_of(listener, view, request_move);
|
||||||
interactive_begin(view, LAB_INPUT_STATE_MOVE, LAB_EDGE_NONE);
|
interactive_begin(view, LAB_INPUT_STATE_MOVE, LAB_EDGE_NONE);
|
||||||
|
|
@ -502,7 +502,7 @@ handle_request_resize(struct wl_listener *listener, void *data)
|
||||||
* this client, to prevent the client from requesting this whenever they
|
* this client, to prevent the client from requesting this whenever they
|
||||||
* want.
|
* want.
|
||||||
*
|
*
|
||||||
* Note: interactive_begin() checks that view == g_server.grabbed_view.
|
* Note: interactive_begin() checks that view == server.grabbed_view.
|
||||||
*/
|
*/
|
||||||
struct wlr_xdg_toplevel_resize_event *event = data;
|
struct wlr_xdg_toplevel_resize_event *event = data;
|
||||||
struct view *view = wl_container_of(listener, view, request_resize);
|
struct view *view = wl_container_of(listener, view, request_resize);
|
||||||
|
|
@ -562,7 +562,7 @@ handle_request_show_window_menu(struct wl_listener *listener, void *data)
|
||||||
assert(menu);
|
assert(menu);
|
||||||
menu->triggered_by_view = &xdg_toplevel_view->base;
|
menu->triggered_by_view = &xdg_toplevel_view->base;
|
||||||
|
|
||||||
struct wlr_cursor *cursor = g_server.seat.cursor;
|
struct wlr_cursor *cursor = server.seat.cursor;
|
||||||
menu_open_root(menu, cursor->x, cursor->y);
|
menu_open_root(menu, cursor->x, cursor->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -683,7 +683,7 @@ xdg_toplevel_view_append_children(struct view *self, struct wl_array *children)
|
||||||
struct wlr_xdg_toplevel *toplevel = xdg_toplevel_from_view(self);
|
struct wlr_xdg_toplevel *toplevel = xdg_toplevel_from_view(self);
|
||||||
struct view *view;
|
struct view *view;
|
||||||
|
|
||||||
wl_list_for_each_reverse(view, &g_server.views, link) {
|
wl_list_for_each_reverse(view, &server.views, link) {
|
||||||
if (view == self) {
|
if (view == self) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -978,7 +978,7 @@ handle_new_xdg_toplevel(struct wl_listener *listener, void *data)
|
||||||
view->output->wlr_output->scale);
|
view->output->wlr_output->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
view->workspace = g_server.workspaces.current;
|
view->workspace = server.workspaces.current;
|
||||||
view->scene_tree = lab_wlr_scene_tree_create(
|
view->scene_tree = lab_wlr_scene_tree_create(
|
||||||
view->workspace->view_trees[VIEW_LAYER_NORMAL]);
|
view->workspace->view_trees[VIEW_LAYER_NORMAL]);
|
||||||
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
|
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
|
||||||
|
|
@ -1039,8 +1039,8 @@ handle_new_xdg_toplevel(struct wl_listener *listener, void *data)
|
||||||
CONNECT_SIGNAL(toplevel, xdg_toplevel_view, request_show_window_menu);
|
CONNECT_SIGNAL(toplevel, xdg_toplevel_view, request_show_window_menu);
|
||||||
CONNECT_SIGNAL(xdg_surface, xdg_toplevel_view, new_popup);
|
CONNECT_SIGNAL(xdg_surface, xdg_toplevel_view, new_popup);
|
||||||
|
|
||||||
wl_list_insert(&g_server.views, &view->link);
|
wl_list_insert(&server.views, &view->link);
|
||||||
view->creation_id = g_server.next_view_creation_id++;
|
view->creation_id = server.next_view_creation_id++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1076,44 +1076,44 @@ handle_xdg_toplevel_icon_set_icon(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
xdg_shell_init(void)
|
xdg_shell_init(void)
|
||||||
{
|
{
|
||||||
g_server.xdg_shell = wlr_xdg_shell_create(g_server.wl_display,
|
server.xdg_shell = wlr_xdg_shell_create(server.wl_display,
|
||||||
LAB_XDG_SHELL_VERSION);
|
LAB_XDG_SHELL_VERSION);
|
||||||
if (!g_server.xdg_shell) {
|
if (!server.xdg_shell) {
|
||||||
wlr_log(WLR_ERROR, "unable to create the XDG shell interface");
|
wlr_log(WLR_ERROR, "unable to create the XDG shell interface");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.new_xdg_toplevel.notify = handle_new_xdg_toplevel;
|
server.new_xdg_toplevel.notify = handle_new_xdg_toplevel;
|
||||||
wl_signal_add(&g_server.xdg_shell->events.new_toplevel, &g_server.new_xdg_toplevel);
|
wl_signal_add(&server.xdg_shell->events.new_toplevel, &server.new_xdg_toplevel);
|
||||||
|
|
||||||
g_server.xdg_activation = wlr_xdg_activation_v1_create(g_server.wl_display);
|
server.xdg_activation = wlr_xdg_activation_v1_create(server.wl_display);
|
||||||
if (!g_server.xdg_activation) {
|
if (!server.xdg_activation) {
|
||||||
wlr_log(WLR_ERROR, "unable to create xdg_activation interface");
|
wlr_log(WLR_ERROR, "unable to create xdg_activation interface");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_server.xdg_activation_request.notify = handle_xdg_activation_request;
|
server.xdg_activation_request.notify = handle_xdg_activation_request;
|
||||||
wl_signal_add(&g_server.xdg_activation->events.request_activate,
|
wl_signal_add(&server.xdg_activation->events.request_activate,
|
||||||
&g_server.xdg_activation_request);
|
&server.xdg_activation_request);
|
||||||
|
|
||||||
g_server.xdg_activation_new_token.notify = handle_xdg_activation_new_token;
|
server.xdg_activation_new_token.notify = handle_xdg_activation_new_token;
|
||||||
wl_signal_add(&g_server.xdg_activation->events.new_token,
|
wl_signal_add(&server.xdg_activation->events.new_token,
|
||||||
&g_server.xdg_activation_new_token);
|
&server.xdg_activation_new_token);
|
||||||
|
|
||||||
g_server.xdg_toplevel_icon_manager = wlr_xdg_toplevel_icon_manager_v1_create(
|
server.xdg_toplevel_icon_manager = wlr_xdg_toplevel_icon_manager_v1_create(
|
||||||
g_server.wl_display, 1);
|
server.wl_display, 1);
|
||||||
g_server.xdg_toplevel_icon_set_icon.notify = handle_xdg_toplevel_icon_set_icon;
|
server.xdg_toplevel_icon_set_icon.notify = handle_xdg_toplevel_icon_set_icon;
|
||||||
wl_signal_add(&g_server.xdg_toplevel_icon_manager->events.set_icon,
|
wl_signal_add(&server.xdg_toplevel_icon_manager->events.set_icon,
|
||||||
&g_server.xdg_toplevel_icon_set_icon);
|
&server.xdg_toplevel_icon_set_icon);
|
||||||
|
|
||||||
wlr_xdg_wm_dialog_v1_create(g_server.wl_display, 1);
|
wlr_xdg_wm_dialog_v1_create(server.wl_display, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xdg_shell_finish(void)
|
xdg_shell_finish(void)
|
||||||
{
|
{
|
||||||
wl_list_remove(&g_server.new_xdg_toplevel.link);
|
wl_list_remove(&server.new_xdg_toplevel.link);
|
||||||
wl_list_remove(&g_server.xdg_activation_request.link);
|
wl_list_remove(&server.xdg_activation_request.link);
|
||||||
wl_list_remove(&g_server.xdg_activation_new_token.link);
|
wl_list_remove(&server.xdg_activation_new_token.link);
|
||||||
wl_list_remove(&g_server.xdg_toplevel_icon_set_icon.link);
|
wl_list_remove(&server.xdg_toplevel_icon_set_icon.link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ handle_grab_focus(struct wl_listener *listener, void *data)
|
||||||
unmanaged->ever_grabbed_focus = true;
|
unmanaged->ever_grabbed_focus = true;
|
||||||
if (unmanaged->node) {
|
if (unmanaged->node) {
|
||||||
assert(unmanaged->xwayland_surface->surface);
|
assert(unmanaged->xwayland_surface->surface);
|
||||||
seat_focus_surface(&g_server.seat,
|
seat_focus_surface(&server.seat,
|
||||||
unmanaged->xwayland_surface->surface);
|
unmanaged->xwayland_surface->surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,17 +59,17 @@ handle_map(struct wl_listener *listener, void *data)
|
||||||
assert(!unmanaged->node);
|
assert(!unmanaged->node);
|
||||||
|
|
||||||
/* Stack new surface on top */
|
/* Stack new surface on top */
|
||||||
wl_list_append(&g_server.unmanaged_surfaces, &unmanaged->link);
|
wl_list_append(&server.unmanaged_surfaces, &unmanaged->link);
|
||||||
|
|
||||||
CONNECT_SIGNAL(xsurface, unmanaged, set_geometry);
|
CONNECT_SIGNAL(xsurface, unmanaged, set_geometry);
|
||||||
|
|
||||||
if (wlr_xwayland_surface_override_redirect_wants_focus(xsurface)
|
if (wlr_xwayland_surface_override_redirect_wants_focus(xsurface)
|
||||||
|| unmanaged->ever_grabbed_focus) {
|
|| unmanaged->ever_grabbed_focus) {
|
||||||
seat_focus_surface(&g_server.seat, xsurface->surface);
|
seat_focus_surface(&server.seat, xsurface->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_scene_surface *scene_surface = wlr_scene_surface_create(
|
struct wlr_scene_surface *scene_surface = wlr_scene_surface_create(
|
||||||
g_server.unmanaged_tree, xsurface->surface);
|
server.unmanaged_tree, xsurface->surface);
|
||||||
die_if_null(scene_surface);
|
die_if_null(scene_surface);
|
||||||
unmanaged->node = &scene_surface->buffer->node;
|
unmanaged->node = &scene_surface->buffer->node;
|
||||||
|
|
||||||
|
|
@ -82,12 +82,12 @@ focus_next_surface(struct wlr_xwayland_surface *xsurface)
|
||||||
{
|
{
|
||||||
/* Try to focus on last created unmanaged xwayland surface */
|
/* Try to focus on last created unmanaged xwayland surface */
|
||||||
struct xwayland_unmanaged *u;
|
struct xwayland_unmanaged *u;
|
||||||
struct wl_list *list = &g_server.unmanaged_surfaces;
|
struct wl_list *list = &server.unmanaged_surfaces;
|
||||||
wl_list_for_each_reverse(u, list, link) {
|
wl_list_for_each_reverse(u, list, link) {
|
||||||
struct wlr_xwayland_surface *prev = u->xwayland_surface;
|
struct wlr_xwayland_surface *prev = u->xwayland_surface;
|
||||||
if (wlr_xwayland_surface_override_redirect_wants_focus(prev)
|
if (wlr_xwayland_surface_override_redirect_wants_focus(prev)
|
||||||
|| u->ever_grabbed_focus) {
|
|| u->ever_grabbed_focus) {
|
||||||
seat_focus_surface(&g_server.seat, prev->surface);
|
seat_focus_surface(&server.seat, prev->surface);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -113,8 +113,8 @@ focus_next_surface(struct wlr_xwayland_surface *xsurface)
|
||||||
* If modifying this logic, please test for regressions with
|
* If modifying this logic, please test for regressions with
|
||||||
* menus/tooltips in JetBrains CLion or similar.
|
* menus/tooltips in JetBrains CLion or similar.
|
||||||
*/
|
*/
|
||||||
if (g_server.active_view) {
|
if (server.active_view) {
|
||||||
seat_focus_surface(&g_server.seat, g_server.active_view->surface);
|
seat_focus_surface(&server.seat, server.active_view->surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ handle_unmap(struct wl_listener *listener, void *data)
|
||||||
struct xwayland_unmanaged *unmanaged =
|
struct xwayland_unmanaged *unmanaged =
|
||||||
wl_container_of(listener, unmanaged, mappable.unmap);
|
wl_container_of(listener, unmanaged, mappable.unmap);
|
||||||
struct wlr_xwayland_surface *xsurface = unmanaged->xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = unmanaged->xwayland_surface;
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
assert(unmanaged->node);
|
assert(unmanaged->node);
|
||||||
|
|
||||||
wl_list_remove(&unmanaged->link);
|
wl_list_remove(&unmanaged->link);
|
||||||
|
|
@ -214,7 +214,7 @@ handle_request_activate(struct wl_listener *listener, void *data)
|
||||||
if (!xsurface->surface || !xsurface->surface->mapped) {
|
if (!xsurface->surface || !xsurface->surface->mapped) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate that the unmanaged surface trying to grab focus is actually
|
* Validate that the unmanaged surface trying to grab focus is actually
|
||||||
|
|
@ -223,7 +223,7 @@ handle_request_activate(struct wl_listener *listener, void *data)
|
||||||
* FIXME: this logic is a bit incomplete/inconsistent. Refer to
|
* FIXME: this logic is a bit incomplete/inconsistent. Refer to
|
||||||
* https://github.com/labwc/labwc/discussions/2821 for more info.
|
* https://github.com/labwc/labwc/discussions/2821 for more info.
|
||||||
*/
|
*/
|
||||||
struct view *view = g_server.active_view;
|
struct view *view = server.active_view;
|
||||||
if (view && view->type == LAB_XWAYLAND_VIEW) {
|
if (view && view->type == LAB_XWAYLAND_VIEW) {
|
||||||
struct wlr_xwayland_surface *surf =
|
struct wlr_xwayland_surface *surf =
|
||||||
wlr_xwayland_surface_try_from_wlr_surface(view->surface);
|
wlr_xwayland_surface_try_from_wlr_surface(view->surface);
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ handle_request_move(struct wl_listener *listener, void *data)
|
||||||
* this client, to prevent the client from requesting this whenever they
|
* this client, to prevent the client from requesting this whenever they
|
||||||
* want.
|
* want.
|
||||||
*
|
*
|
||||||
* Note: interactive_begin() checks that view == g_server.grabbed_view.
|
* Note: interactive_begin() checks that view == server.grabbed_view.
|
||||||
*/
|
*/
|
||||||
struct view *view = wl_container_of(listener, view, request_move);
|
struct view *view = wl_container_of(listener, view, request_move);
|
||||||
interactive_begin(view, LAB_INPUT_STATE_MOVE, LAB_EDGE_NONE);
|
interactive_begin(view, LAB_INPUT_STATE_MOVE, LAB_EDGE_NONE);
|
||||||
|
|
@ -307,7 +307,7 @@ handle_request_resize(struct wl_listener *listener, void *data)
|
||||||
* this client, to prevent the client from requesting this whenever they
|
* this client, to prevent the client from requesting this whenever they
|
||||||
* want.
|
* want.
|
||||||
*
|
*
|
||||||
* Note: interactive_begin() checks that view == g_server.grabbed_view.
|
* Note: interactive_begin() checks that view == server.grabbed_view.
|
||||||
*/
|
*/
|
||||||
struct wlr_xwayland_resize_event *event = data;
|
struct wlr_xwayland_resize_event *event = data;
|
||||||
struct view *view = wl_container_of(listener, view, request_resize);
|
struct view *view = wl_container_of(listener, view, request_resize);
|
||||||
|
|
@ -388,7 +388,7 @@ xwayland_view_configure(struct view *view, struct wlr_box geo)
|
||||||
* workaround, move offscreen surfaces immediately.
|
* workaround, move offscreen surfaces immediately.
|
||||||
*/
|
*/
|
||||||
bool is_offscreen = !wlr_box_empty(&view->current) &&
|
bool is_offscreen = !wlr_box_empty(&view->current) &&
|
||||||
!wlr_output_layout_intersects(g_server.output_layout, NULL,
|
!wlr_output_layout_intersects(server.output_layout, NULL,
|
||||||
&view->current);
|
&view->current);
|
||||||
|
|
||||||
/* If not resizing, process the move immediately */
|
/* If not resizing, process the move immediately */
|
||||||
|
|
@ -605,7 +605,7 @@ update_icon(struct xwayland_view *xwayland_view)
|
||||||
|
|
||||||
xcb_window_t window_id = xwayland_view->xwayland_surface->window_id;
|
xcb_window_t window_id = xwayland_view->xwayland_surface->window_id;
|
||||||
|
|
||||||
xcb_connection_t *xcb_conn = wlr_xwayland_get_xwm_connection(g_server.xwayland);
|
xcb_connection_t *xcb_conn = wlr_xwayland_get_xwm_connection(server.xwayland);
|
||||||
xcb_get_property_cookie_t cookie = xcb_get_property(xcb_conn, 0,
|
xcb_get_property_cookie_t cookie = xcb_get_property(xcb_conn, 0,
|
||||||
window_id, atoms[ATOM_NET_WM_ICON], XCB_ATOM_CARDINAL, 0, 0x10000);
|
window_id, atoms[ATOM_NET_WM_ICON], XCB_ATOM_CARDINAL, 0, 0x10000);
|
||||||
xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_conn, cookie, NULL);
|
xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_conn, cookie, NULL);
|
||||||
|
|
@ -658,7 +658,7 @@ handle_focus_in(struct wl_listener *listener, void *data)
|
||||||
struct xwayland_view *xwayland_view =
|
struct xwayland_view *xwayland_view =
|
||||||
wl_container_of(listener, xwayland_view, focus_in);
|
wl_container_of(listener, xwayland_view, focus_in);
|
||||||
struct view *view = &xwayland_view->base;
|
struct view *view = &xwayland_view->base;
|
||||||
struct seat *seat = &g_server.seat;
|
struct seat *seat = &server.seat;
|
||||||
|
|
||||||
if (!view->surface) {
|
if (!view->surface) {
|
||||||
/*
|
/*
|
||||||
|
|
@ -878,7 +878,7 @@ handle_map(struct wl_listener *listener, void *data)
|
||||||
*/
|
*/
|
||||||
if (xwayland_view->focused_before_map) {
|
if (xwayland_view->focused_before_map) {
|
||||||
xwayland_view->focused_before_map = false;
|
xwayland_view->focused_before_map = false;
|
||||||
seat_focus_surface(&g_server.seat, view->surface);
|
seat_focus_surface(&server.seat, view->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
view_impl_map(view);
|
view_impl_map(view);
|
||||||
|
|
@ -941,7 +941,7 @@ xwayland_view_append_children(struct view *self, struct wl_array *children)
|
||||||
struct wlr_xwayland_surface *surface = xwayland_surface_from_view(self);
|
struct wlr_xwayland_surface *surface = xwayland_surface_from_view(self);
|
||||||
struct view *view;
|
struct view *view;
|
||||||
|
|
||||||
wl_list_for_each_reverse(view, &g_server.views, link) {
|
wl_list_for_each_reverse(view, &server.views, link) {
|
||||||
if (view == self) {
|
if (view == self) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1061,7 +1061,7 @@ xwayland_view_create(struct wlr_xwayland_surface *xsurface, bool mapped)
|
||||||
xwayland_view->xwayland_surface = xsurface;
|
xwayland_view->xwayland_surface = xsurface;
|
||||||
xsurface->data = view;
|
xsurface->data = view;
|
||||||
|
|
||||||
view->workspace = g_server.workspaces.current;
|
view->workspace = server.workspaces.current;
|
||||||
view->scene_tree = lab_wlr_scene_tree_create(
|
view->scene_tree = lab_wlr_scene_tree_create(
|
||||||
view->workspace->view_trees[VIEW_LAYER_NORMAL]);
|
view->workspace->view_trees[VIEW_LAYER_NORMAL]);
|
||||||
node_descriptor_create(&view->scene_tree->node,
|
node_descriptor_create(&view->scene_tree->node,
|
||||||
|
|
@ -1093,8 +1093,8 @@ xwayland_view_create(struct wlr_xwayland_surface *xsurface, bool mapped)
|
||||||
/* Events from the view itself */
|
/* Events from the view itself */
|
||||||
CONNECT_SIGNAL(view, &xwayland_view->on_view, always_on_top);
|
CONNECT_SIGNAL(view, &xwayland_view->on_view, always_on_top);
|
||||||
|
|
||||||
wl_list_insert(&g_server.views, &view->link);
|
wl_list_insert(&server.views, &view->link);
|
||||||
view->creation_id = g_server.next_view_creation_id++;
|
view->creation_id = server.next_view_creation_id++;
|
||||||
|
|
||||||
if (xsurface->surface) {
|
if (xsurface->surface) {
|
||||||
handle_associate(&xwayland_view->associate, NULL);
|
handle_associate(&xwayland_view->associate, NULL);
|
||||||
|
|
@ -1134,7 +1134,7 @@ static struct xwayland_view *
|
||||||
xwayland_view_from_window_id(xcb_window_t id)
|
xwayland_view_from_window_id(xcb_window_t id)
|
||||||
{
|
{
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &g_server.views, link) {
|
wl_list_for_each(view, &server.views, link) {
|
||||||
if (view->type != LAB_XWAYLAND_VIEW) {
|
if (view->type != LAB_XWAYLAND_VIEW) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1177,7 +1177,7 @@ static void
|
||||||
sync_atoms(void)
|
sync_atoms(void)
|
||||||
{
|
{
|
||||||
xcb_connection_t *xcb_conn =
|
xcb_connection_t *xcb_conn =
|
||||||
wlr_xwayland_get_xwm_connection(g_server.xwayland);
|
wlr_xwayland_get_xwm_connection(server.xwayland);
|
||||||
assert(xcb_conn);
|
assert(xcb_conn);
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "Syncing X11 atoms");
|
wlr_log(WLR_DEBUG, "Syncing X11 atoms");
|
||||||
|
|
@ -1220,47 +1220,47 @@ handle_server_ready(struct wl_listener *listener, void *data)
|
||||||
static void
|
static void
|
||||||
handle_xwm_ready(struct wl_listener *listener, void *data)
|
handle_xwm_ready(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
wlr_xwayland_set_seat(g_server.xwayland, g_server.seat.seat);
|
wlr_xwayland_set_seat(server.xwayland, server.seat.seat);
|
||||||
xwayland_update_workarea();
|
xwayland_update_workarea();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xwayland_server_init(struct wlr_compositor *compositor)
|
xwayland_server_init(struct wlr_compositor *compositor)
|
||||||
{
|
{
|
||||||
g_server.xwayland =
|
server.xwayland =
|
||||||
wlr_xwayland_create(g_server.wl_display,
|
wlr_xwayland_create(server.wl_display,
|
||||||
compositor, /* lazy */ !rc.xwayland_persistence);
|
compositor, /* lazy */ !rc.xwayland_persistence);
|
||||||
if (!g_server.xwayland) {
|
if (!server.xwayland) {
|
||||||
wlr_log(WLR_ERROR, "cannot create xwayland server");
|
wlr_log(WLR_ERROR, "cannot create xwayland server");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
g_server.xwayland_new_surface.notify = handle_new_surface;
|
server.xwayland_new_surface.notify = handle_new_surface;
|
||||||
wl_signal_add(&g_server.xwayland->events.new_surface,
|
wl_signal_add(&server.xwayland->events.new_surface,
|
||||||
&g_server.xwayland_new_surface);
|
&server.xwayland_new_surface);
|
||||||
|
|
||||||
g_server.xwayland_server_ready.notify = handle_server_ready;
|
server.xwayland_server_ready.notify = handle_server_ready;
|
||||||
wl_signal_add(&g_server.xwayland->server->events.ready,
|
wl_signal_add(&server.xwayland->server->events.ready,
|
||||||
&g_server.xwayland_server_ready);
|
&server.xwayland_server_ready);
|
||||||
|
|
||||||
g_server.xwayland_xwm_ready.notify = handle_xwm_ready;
|
server.xwayland_xwm_ready.notify = handle_xwm_ready;
|
||||||
wl_signal_add(&g_server.xwayland->events.ready,
|
wl_signal_add(&server.xwayland->events.ready,
|
||||||
&g_server.xwayland_xwm_ready);
|
&server.xwayland_xwm_ready);
|
||||||
|
|
||||||
g_server.xwayland->user_event_handler = handle_x11_event;
|
server.xwayland->user_event_handler = handle_x11_event;
|
||||||
|
|
||||||
if (setenv("DISPLAY", g_server.xwayland->display_name, true) < 0) {
|
if (setenv("DISPLAY", server.xwayland->display_name, true) < 0) {
|
||||||
wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland");
|
wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland");
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_DEBUG, "xwayland is running on display %s",
|
wlr_log(WLR_DEBUG, "xwayland is running on display %s",
|
||||||
g_server.xwayland->display_name);
|
server.xwayland->display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xcursor *xcursor;
|
struct wlr_xcursor *xcursor;
|
||||||
xcursor = wlr_xcursor_manager_get_xcursor(
|
xcursor = wlr_xcursor_manager_get_xcursor(
|
||||||
g_server.seat.xcursor_manager, XCURSOR_DEFAULT, 1);
|
server.seat.xcursor_manager, XCURSOR_DEFAULT, 1);
|
||||||
if (xcursor) {
|
if (xcursor) {
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
wlr_xwayland_set_cursor(g_server.xwayland, image->buffer,
|
wlr_xwayland_set_cursor(server.xwayland, image->buffer,
|
||||||
image->width * 4, image->width,
|
image->width * 4, image->width,
|
||||||
image->height, image->hotspot_x,
|
image->height, image->hotspot_x,
|
||||||
image->hotspot_y);
|
image->hotspot_y);
|
||||||
|
|
@ -1288,24 +1288,24 @@ xwayland_reset_cursor(void)
|
||||||
* - Start some X11 client
|
* - Start some X11 client
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!g_server.xwayland) {
|
if (!server.xwayland) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
||||||
g_server.seat.xcursor_manager, XCURSOR_DEFAULT, 1);
|
server.seat.xcursor_manager, XCURSOR_DEFAULT, 1);
|
||||||
|
|
||||||
if (xcursor && !g_server.xwayland->xwm) {
|
if (xcursor && !server.xwayland->xwm) {
|
||||||
/* Prevents setting the cursor on an active xwayland server */
|
/* Prevents setting the cursor on an active xwayland server */
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
wlr_xwayland_set_cursor(g_server.xwayland, image->buffer,
|
wlr_xwayland_set_cursor(server.xwayland, image->buffer,
|
||||||
image->width * 4, image->width,
|
image->width * 4, image->width,
|
||||||
image->height, image->hotspot_x,
|
image->height, image->hotspot_x,
|
||||||
image->hotspot_y);
|
image->hotspot_y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_server.xwayland->cursor) {
|
if (server.xwayland->cursor) {
|
||||||
/*
|
/*
|
||||||
* The previous configured theme has set the
|
* The previous configured theme has set the
|
||||||
* default cursor or the xwayland server is
|
* default cursor or the xwayland server is
|
||||||
|
|
@ -1313,23 +1313,23 @@ xwayland_reset_cursor(void)
|
||||||
* xcursor set that will be used on the next
|
* xcursor set that will be used on the next
|
||||||
* xwayland destroy -> lazy startup cycle.
|
* xwayland destroy -> lazy startup cycle.
|
||||||
*/
|
*/
|
||||||
zfree(g_server.xwayland->cursor);
|
zfree(server.xwayland->cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xwayland_server_finish(void)
|
xwayland_server_finish(void)
|
||||||
{
|
{
|
||||||
struct wlr_xwayland *xwayland = g_server.xwayland;
|
struct wlr_xwayland *xwayland = server.xwayland;
|
||||||
wl_list_remove(&g_server.xwayland_new_surface.link);
|
wl_list_remove(&server.xwayland_new_surface.link);
|
||||||
wl_list_remove(&g_server.xwayland_server_ready.link);
|
wl_list_remove(&server.xwayland_server_ready.link);
|
||||||
wl_list_remove(&g_server.xwayland_xwm_ready.link);
|
wl_list_remove(&server.xwayland_xwm_ready.link);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset g_server.xwayland to NULL first to prevent callbacks (like
|
* Reset server.xwayland to NULL first to prevent callbacks (like
|
||||||
* server_global_filter) from accessing it as it is destroyed
|
* server_global_filter) from accessing it as it is destroyed
|
||||||
*/
|
*/
|
||||||
g_server.xwayland = NULL;
|
server.xwayland = NULL;
|
||||||
wlr_xwayland_destroy(xwayland);
|
wlr_xwayland_destroy(xwayland);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1428,12 +1428,12 @@ xwayland_update_workarea(void)
|
||||||
* Do nothing if called during destroy or before xwayland is ready.
|
* Do nothing if called during destroy or before xwayland is ready.
|
||||||
* This function will be called again from the ready signal handler.
|
* This function will be called again from the ready signal handler.
|
||||||
*/
|
*/
|
||||||
if (!g_server.xwayland || !g_server.xwayland->xwm) {
|
if (!server.xwayland || !server.xwayland->xwm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box lb;
|
struct wlr_box lb;
|
||||||
wlr_output_layout_get_box(g_server.output_layout, NULL, &lb);
|
wlr_output_layout_get_box(server.output_layout, NULL, &lb);
|
||||||
|
|
||||||
/* Compute outer edges of layout (excluding negative regions) */
|
/* Compute outer edges of layout (excluding negative regions) */
|
||||||
int layout_left = MAX(0, lb.x);
|
int layout_left = MAX(0, lb.x);
|
||||||
|
|
@ -1448,13 +1448,13 @@ xwayland_update_workarea(void)
|
||||||
int workarea_bottom = layout_bottom;
|
int workarea_bottom = layout_bottom;
|
||||||
|
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &g_server.outputs, link) {
|
wl_list_for_each(output, &server.outputs, link) {
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box ob;
|
struct wlr_box ob;
|
||||||
wlr_output_layout_get_box(g_server.output_layout,
|
wlr_output_layout_get_box(server.output_layout,
|
||||||
output->wlr_output, &ob);
|
output->wlr_output, &ob);
|
||||||
|
|
||||||
/* Compute edges of output */
|
/* Compute edges of output */
|
||||||
|
|
@ -1497,15 +1497,15 @@ xwayland_update_workarea(void)
|
||||||
.width = workarea_right - workarea_left,
|
.width = workarea_right - workarea_left,
|
||||||
.height = workarea_bottom - workarea_top,
|
.height = workarea_bottom - workarea_top,
|
||||||
};
|
};
|
||||||
wlr_xwayland_set_workareas(g_server.xwayland, &workarea, 1);
|
wlr_xwayland_set_workareas(server.xwayland, &workarea, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xwayland_flush(void)
|
xwayland_flush(void)
|
||||||
{
|
{
|
||||||
if (!g_server.xwayland || !g_server.xwayland->xwm) {
|
if (!server.xwayland || !server.xwayland->xwm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_flush(wlr_xwayland_get_xwm_connection(g_server.xwayland));
|
xcb_flush(wlr_xwayland_get_xwm_connection(server.xwayland));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue