mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
react to wlroots changes
This commit is contained in:
parent
8fa589a132
commit
4eb4536b28
5 changed files with 48 additions and 8 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -16,7 +16,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: packages
|
- name: packages
|
||||||
run: |
|
run: |
|
||||||
apk add gcc git libevdev-dev libinput-dev libxkbcommon-dev libxml2-dev meson musl-dev wayland-dev wayland-protocols wlroots-dev xwayland
|
apk add gcc libevdev-dev libinput-dev libxkbcommon-dev libxml2-dev meson musl-dev wayland-dev wayland-protocols wlroots-dev xwayland
|
||||||
# actions/checkout@v3 clones the repository
|
# actions/checkout@v3 clones the repository
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: setup
|
- name: setup
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,11 @@ static void process_cursor_motion(struct wb_server *server, uint32_t time) {
|
||||||
* default. This is what makes the cursor image appear when you move it
|
* default. This is what makes the cursor image appear when you move it
|
||||||
* around the screen, not over any views. */
|
* around the screen, not over any views. */
|
||||||
wlr_xcursor_manager_set_cursor_image(
|
wlr_xcursor_manager_set_cursor_image(
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 2)
|
||||||
|
server->cursor->xcursor_manager, "default", server->cursor->cursor);
|
||||||
|
#else
|
||||||
server->cursor->xcursor_manager, "left_ptr", server->cursor->cursor);
|
server->cursor->xcursor_manager, "left_ptr", server->cursor->cursor);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (surface) {
|
if (surface) {
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -116,5 +116,12 @@ void new_output_notify(struct wl_listener *listener, void *data) {
|
||||||
* display, which Wayland clients can see to find out information about the
|
* display, which Wayland clients can see to find out information about the
|
||||||
* output (such as DPI, scale factor, manufacturer, etc).
|
* output (such as DPI, scale factor, manufacturer, etc).
|
||||||
*/
|
*/
|
||||||
wlr_output_layout_add_auto(server->output_layout, wlr_output);
|
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||||
|
if (!wlr_output_layout_add_auto(server->output_layout, wlr_output)) {
|
||||||
|
wlr_log(WLR_ERROR, "%s", _("Could not add an output layout."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
wlr_output_layout_add_auto(server->output_layout, wlr_output);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ struct wb_view *get_view_at(
|
||||||
}
|
}
|
||||||
struct wlr_scene_buffer *scene_buffer = wlr_scene_buffer_from_node(node);
|
struct wlr_scene_buffer *scene_buffer = wlr_scene_buffer_from_node(node);
|
||||||
struct wlr_scene_surface *scene_surface =
|
struct wlr_scene_surface *scene_surface =
|
||||||
|
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||||
|
wlr_scene_surface_try_from_buffer(scene_buffer);
|
||||||
|
#else
|
||||||
wlr_scene_surface_from_buffer(scene_buffer);
|
wlr_scene_surface_from_buffer(scene_buffer);
|
||||||
|
#endif
|
||||||
if (!scene_surface) {
|
if (!scene_surface) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -30,11 +34,18 @@ struct wb_view *get_view_at(
|
||||||
|
|
||||||
void focus_view(struct wb_view *view, struct wlr_surface *surface) {
|
void focus_view(struct wb_view *view, struct wlr_surface *surface) {
|
||||||
/* Note: this function only deals with keyboard focus. */
|
/* Note: this function only deals with keyboard focus. */
|
||||||
if (view == NULL || surface == NULL || !wlr_surface_is_xdg_surface(surface)) {
|
if (view == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||||
|
struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_try_from_wlr_surface(surface);
|
||||||
|
#else
|
||||||
|
if (surface == NULL || !wlr_surface_is_xdg_surface(surface))
|
||||||
|
return;
|
||||||
|
|
||||||
struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_from_wlr_surface(surface);
|
struct wlr_xdg_surface *xdg_surface = wlr_xdg_surface_from_wlr_surface(surface);
|
||||||
|
#endif
|
||||||
if (xdg_surface)
|
if (xdg_surface)
|
||||||
wlr_log(WLR_INFO, "%s: %s", _("Keyboard focus is now on surface"),
|
wlr_log(WLR_INFO, "%s: %s", _("Keyboard focus is now on surface"),
|
||||||
xdg_surface->toplevel->app_id);
|
xdg_surface->toplevel->app_id);
|
||||||
|
|
@ -46,16 +57,25 @@ void focus_view(struct wb_view *view, struct wlr_surface *surface) {
|
||||||
/* Don't re-focus an already focused surface. */
|
/* Don't re-focus an already focused surface. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prev_surface && wlr_surface_is_xdg_surface(prev_surface)) {
|
if (prev_surface) {
|
||||||
/*
|
/*
|
||||||
* Deactivate the previously focused surface. This lets the client know
|
* Deactivate the previously focused surface. This lets the client know
|
||||||
* it no longer has focus and the client will repaint accordingly, e.g.
|
* it no longer has focus and the client will repaint accordingly, e.g.
|
||||||
* stop displaying a caret.
|
* stop displaying a caret.
|
||||||
*/
|
*/
|
||||||
|
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||||
struct wlr_xdg_surface *previous =
|
struct wlr_xdg_surface *previous =
|
||||||
wlr_xdg_surface_from_wlr_surface(prev_surface);
|
wlr_xdg_surface_try_from_wlr_surface(prev_surface);
|
||||||
|
#else
|
||||||
|
struct wlr_xdg_surface *previous;
|
||||||
|
if (wlr_surface_is_xdg_surface(prev_surface)) {
|
||||||
|
previous = wlr_xdg_surface_from_wlr_surface(prev_surface);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
|
||||||
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
|
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* Move the view to the front */
|
/* Move the view to the front */
|
||||||
if (!server->seat->focused_layer) {
|
if (!server->seat->focused_layer) {
|
||||||
wlr_scene_node_raise_to_top(&view->scene_tree->node);
|
wlr_scene_node_raise_to_top(&view->scene_tree->node);
|
||||||
|
|
@ -293,7 +313,9 @@ static void handle_new_popup(struct wl_listener *listener, void *data) {
|
||||||
view->geometry.x + popup->current.geometry.x,
|
view->geometry.x + popup->current.geometry.x,
|
||||||
view->geometry.y + popup->current.geometry.y);
|
view->geometry.y + popup->current.geometry.y);
|
||||||
|
|
||||||
if (!wlr_output) return;
|
if (!wlr_output) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
struct wb_output *output = wlr_output->data;
|
struct wb_output *output = wlr_output->data;
|
||||||
|
|
||||||
int top_margin = (view->server->config) ?
|
int top_margin = (view->server->config) ?
|
||||||
|
|
@ -320,9 +342,16 @@ static void handle_new_xdg_surface(struct wl_listener *listener, void *data) {
|
||||||
* we always set the user data field of xdg_surfaces to the corresponding
|
* we always set the user data field of xdg_surfaces to the corresponding
|
||||||
* scene node. */
|
* scene node. */
|
||||||
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||||
|
#if WLR_CHECK_VERSION(0, 17, 0)
|
||||||
|
struct wlr_xdg_surface *parent = wlr_xdg_surface_try_from_wlr_surface(
|
||||||
|
xdg_surface->popup->parent);
|
||||||
|
if (parent != NULL) {
|
||||||
|
#else
|
||||||
if (wlr_surface_is_xdg_surface(xdg_surface->popup->parent)) {
|
if (wlr_surface_is_xdg_surface(xdg_surface->popup->parent)) {
|
||||||
struct wlr_xdg_surface *parent = wlr_xdg_surface_from_wlr_surface(
|
struct wlr_xdg_surface *parent = wlr_xdg_surface_from_wlr_surface(
|
||||||
xdg_surface->popup->parent);
|
xdg_surface->popup->parent);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct wlr_scene_tree *parent_tree = parent->data;
|
struct wlr_scene_tree *parent_tree = parent->data;
|
||||||
xdg_surface->data = wlr_scene_xdg_surface_create(
|
xdg_surface->data = wlr_scene_xdg_surface_create(
|
||||||
parent_tree, xdg_surface);
|
parent_tree, xdg_surface);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue