mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Use stable wlroots, making things easier on everybody
This commit is contained in:
parent
f233ac4cc6
commit
fcb38fe44f
9 changed files with 71 additions and 24 deletions
29
.build.yml
29
.build.yml
|
|
@ -1,36 +1,19 @@
|
||||||
|
# A SourceHut build manifest. See https://man.sr.ht/builds.sr.ht/manifest.md
|
||||||
|
# for more information.
|
||||||
|
#
|
||||||
image: archlinux
|
image: archlinux
|
||||||
packages:
|
packages:
|
||||||
# Base packages needed
|
|
||||||
- meson
|
- meson
|
||||||
- wayland
|
- wayland
|
||||||
- wayland-protocols
|
- wayland-protocols
|
||||||
- libxkbcommon
|
|
||||||
# Packages needed by Waybox
|
|
||||||
- libxml2
|
|
||||||
# Packages needed for wlroots
|
|
||||||
- mesa
|
|
||||||
- libdrm
|
|
||||||
- udev
|
|
||||||
- pixman
|
|
||||||
- seatd
|
|
||||||
# Packages needed for wlroots libinput backend
|
|
||||||
- libinput
|
- libinput
|
||||||
# Packages needed for wlroots Xwayland support
|
- libxkbcommon
|
||||||
|
- libxml2
|
||||||
|
- wlroots
|
||||||
- xorg-server-xwayland
|
- xorg-server-xwayland
|
||||||
- libxcb
|
|
||||||
- xcb-util-renderutil
|
|
||||||
- xcb-util-wm
|
|
||||||
- xcb-util-errors
|
|
||||||
- xcb-util-image
|
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/wizbright/waybox
|
- https://github.com/wizbright/waybox
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots
|
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
|
||||||
cd wlroots
|
|
||||||
meson --prefix=/usr build
|
|
||||||
ninja -C build
|
|
||||||
sudo ninja -C build install
|
|
||||||
- setup: |
|
- setup: |
|
||||||
cd waybox
|
cd waybox
|
||||||
meson build
|
meson build
|
||||||
|
|
|
||||||
29
.github/workflows/build.yml
vendored
Normal file
29
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# A GitHub Actions port of the old .build.yml. This has the advantage of being
|
||||||
|
# able to use GitHub actions, contexts, secrets, etc, to do more in the future
|
||||||
|
# than merely check whether a build succeeds or fails. It also allows to see
|
||||||
|
# whether builds succeed or fail on forks, which also has its advantages.
|
||||||
|
#
|
||||||
|
# The disadvantage is that it's less portable than .build.yml, which will work
|
||||||
|
# on at least GitHub, GitLab, and SourceHut, where GitHub Actions only work on
|
||||||
|
# GitHub.
|
||||||
|
#
|
||||||
|
name: build
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: archlinux:base-devel
|
||||||
|
steps:
|
||||||
|
- name: packages
|
||||||
|
run: |
|
||||||
|
pacman-key --init
|
||||||
|
pacman -Syu --noconfirm
|
||||||
|
pacman -S --noconfirm git meson libxkbcommon libinput libxml2 wayland wayland-protocols wlroots xorg-server-xwayland
|
||||||
|
# actions/checkout@v2 clones the repository
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: setup
|
||||||
|
run: |
|
||||||
|
meson build
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
ninja -C build
|
||||||
|
|
@ -26,6 +26,9 @@ struct wb_view {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wb_server *server;
|
struct wb_server *server;
|
||||||
struct wlr_xdg_toplevel *xdg_toplevel;
|
struct wlr_xdg_toplevel *xdg_toplevel;
|
||||||
|
#if !WLR_CHECK_VERSION(0, 16, 0)
|
||||||
|
struct wlr_xdg_surface *xdg_surface;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct wlr_xdg_toplevel_decoration_v1 *decoration;
|
struct wlr_xdg_toplevel_decoration_v1 *decoration;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <wlr/version.h>
|
||||||
|
#define WLR_CHECK_VERSION(major, minor, micro) (WLR_VERSION_NUM >= ((major << 16) | (minor << 8) | (micro)))
|
||||||
|
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
#include <wlr/render/allocator.h>
|
#include <wlr/render/allocator.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
|
@ -14,7 +17,9 @@
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
#include <wlr/types/wlr_subcompositor.h>
|
#include <wlr/types/wlr_subcompositor.h>
|
||||||
|
#endif
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
|
|
@ -42,7 +47,9 @@ struct wb_server {
|
||||||
struct wlr_output_layout *output_layout;
|
struct wlr_output_layout *output_layout;
|
||||||
struct wlr_xdg_output_manager_v1 *output_manager;
|
struct wlr_xdg_output_manager_v1 *output_manager;
|
||||||
struct wlr_renderer *renderer;
|
struct wlr_renderer *renderer;
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
struct wlr_subcompositor *subcompositor;
|
struct wlr_subcompositor *subcompositor;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct wb_config *config;
|
struct wb_config *config;
|
||||||
char *config_file;
|
char *config_file;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ cc = meson.get_compiler('c')
|
||||||
inc_dir = include_directories('include')
|
inc_dir = include_directories('include')
|
||||||
|
|
||||||
libxml2 = dependency('libxml-2.0')
|
libxml2 = dependency('libxml-2.0')
|
||||||
wlroots = dependency('wlroots', version: '>=0.16.0')
|
wlroots = dependency('wlroots', version: '>=0.15.0')
|
||||||
wayland_server = dependency('wayland-server', version: '>=1.15')
|
wayland_server = dependency('wayland-server', version: '>=1.15')
|
||||||
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
|
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
|
||||||
xkbcommon = dependency('xkbcommon')
|
xkbcommon = dependency('xkbcommon')
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,11 @@ static void process_cursor_resize(struct wb_server *server) {
|
||||||
|
|
||||||
int new_width = new_right - new_left;
|
int new_width = new_right - new_left;
|
||||||
int new_height = new_bottom - new_top;
|
int new_height = new_bottom - new_top;
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
wlr_xdg_toplevel_set_size(view->xdg_toplevel, new_width, new_height);
|
wlr_xdg_toplevel_set_size(view->xdg_toplevel, new_width, new_height);
|
||||||
|
#else
|
||||||
|
wlr_xdg_toplevel_set_size(view->xdg_surface, new_width, new_height);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_cursor_motion(struct wb_server *server, uint32_t time) {
|
static void process_cursor_motion(struct wb_server *server, uint32_t time) {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,11 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
|
||||||
struct wb_view *current_view = wl_container_of(
|
struct wb_view *current_view = wl_container_of(
|
||||||
server->views.next, current_view, link);
|
server->views.next, current_view, link);
|
||||||
if (wlr_surface_is_xdg_surface(current_view->xdg_toplevel->base->surface))
|
if (wlr_surface_is_xdg_surface(current_view->xdg_toplevel->base->surface))
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
wlr_xdg_toplevel_send_close(current_view->xdg_toplevel);
|
wlr_xdg_toplevel_send_close(current_view->xdg_toplevel);
|
||||||
|
#else
|
||||||
|
wlr_xdg_toplevel_send_close(current_view->xdg_surface);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case ACTION_EXECUTE:
|
case ACTION_EXECUTE:
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ bool wb_create_backend(struct wb_server* server) {
|
||||||
|
|
||||||
server->compositor = wlr_compositor_create(server->wl_display,
|
server->compositor = wlr_compositor_create(server->wl_display,
|
||||||
server->renderer);
|
server->renderer);
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
server->subcompositor = wlr_subcompositor_create(server->wl_display);
|
server->subcompositor = wlr_subcompositor_create(server->wl_display);
|
||||||
|
#endif
|
||||||
server->output_layout = wlr_output_layout_create();
|
server->output_layout = wlr_output_layout_create();
|
||||||
server->seat = wb_seat_create(server);
|
server->seat = wb_seat_create(server);
|
||||||
server->cursor = wb_cursor_create(server);
|
server->cursor = wb_cursor_create(server);
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,22 @@ void focus_view(struct wb_view *view, struct wlr_surface *surface) {
|
||||||
*/
|
*/
|
||||||
struct wlr_xdg_surface *previous = wlr_xdg_surface_from_wlr_surface(
|
struct wlr_xdg_surface *previous = wlr_xdg_surface_from_wlr_surface(
|
||||||
seat->keyboard_state.focused_surface);
|
seat->keyboard_state.focused_surface);
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
|
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
|
||||||
|
#else
|
||||||
|
wlr_xdg_toplevel_set_activated(previous, false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
||||||
/* Move the view to the front */
|
/* Move the view to the front */
|
||||||
wl_list_remove(&view->link);
|
wl_list_remove(&view->link);
|
||||||
wl_list_insert(&server->views, &view->link);
|
wl_list_insert(&server->views, &view->link);
|
||||||
/* Activate the new surface */
|
/* Activate the new surface */
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
wlr_xdg_toplevel_set_activated(view->xdg_toplevel, true);
|
wlr_xdg_toplevel_set_activated(view->xdg_toplevel, true);
|
||||||
|
#else
|
||||||
|
wlr_xdg_toplevel_set_activated(view->xdg_surface, true);
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Tell the seat to have the keyboard enter this surface. wlroots will keep
|
* Tell the seat to have the keyboard enter this surface. wlroots will keep
|
||||||
* track of this and automatically send key events to the appropriate
|
* track of this and automatically send key events to the appropriate
|
||||||
|
|
@ -62,7 +70,11 @@ static void xdg_surface_ack_configure(struct wl_listener *listener, void *data)
|
||||||
view->configured = view->y > 0;
|
view->configured = view->y > 0;
|
||||||
|
|
||||||
/* Set size here, so the view->y value will be known */
|
/* Set size here, so the view->y value will be known */
|
||||||
|
#if WLR_CHECK_VERSION(0, 16, 0)
|
||||||
wlr_xdg_toplevel_set_size(view->xdg_toplevel, geo_box.width - view->x, geo_box.height - view->y);
|
wlr_xdg_toplevel_set_size(view->xdg_toplevel, geo_box.width - view->x, geo_box.height - view->y);
|
||||||
|
#else
|
||||||
|
wlr_xdg_toplevel_set_size(view->xdg_surface, geo_box.width - view->x, geo_box.height - view->y);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,6 +184,9 @@ static void handle_new_xdg_surface(struct wl_listener *listener, void *data) {
|
||||||
calloc(1, sizeof(struct wb_view));
|
calloc(1, sizeof(struct wb_view));
|
||||||
view->server = server;
|
view->server = server;
|
||||||
view->xdg_toplevel = xdg_surface->toplevel;
|
view->xdg_toplevel = xdg_surface->toplevel;
|
||||||
|
#if !WLR_CHECK_VERSION(0, 16, 0)
|
||||||
|
view->xdg_surface = view->xdg_toplevel->base;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Listen to the various events it can emit */
|
/* Listen to the various events it can emit */
|
||||||
view->ack_configure.notify = xdg_surface_ack_configure;
|
view->ack_configure.notify = xdg_surface_ack_configure;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue