mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-03-21 05:33:55 -04:00
Merge e8c038cc8a into 6efb3b5042
This commit is contained in:
commit
3637187da7
8 changed files with 37 additions and 27 deletions
9
.github/workflows/main.yml
vendored
9
.github/workflows/main.yml
vendored
|
|
@ -5,6 +5,9 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
WLROOTS_VERSION: 0.19
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
compile:
|
compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -32,7 +35,7 @@ jobs:
|
||||||
pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc
|
pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc
|
||||||
|
|
||||||
- name: Fetch wlroots as a subproject
|
- name: Fetch wlroots as a subproject
|
||||||
run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.18
|
run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION
|
||||||
|
|
||||||
- name: Compile Cage (XWayland=${{ matrix.xwayland }})
|
- name: Compile Cage (XWayland=${{ matrix.xwayland }})
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -52,7 +55,7 @@ jobs:
|
||||||
pacman-key --init
|
pacman-key --init
|
||||||
pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata
|
pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata
|
||||||
- name: Fetch wlroots as a subproject
|
- name: Fetch wlroots as a subproject
|
||||||
run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.18
|
run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION
|
||||||
- name: Check for formatting changes
|
- name: Check for formatting changes
|
||||||
run: |
|
run: |
|
||||||
meson build-clang-format -Dwlroots:xwayland=enabled
|
meson build-clang-format -Dwlroots:xwayland=enabled
|
||||||
|
|
@ -71,7 +74,7 @@ jobs:
|
||||||
pacman-key --init
|
pacman-key --init
|
||||||
pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata
|
pacman -Syu --noconfirm xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata
|
||||||
- name: Fetch wlroots as a subproject
|
- name: Fetch wlroots as a subproject
|
||||||
run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b 0.18
|
run: git clone https://gitlab.freedesktop.org/wlroots/wlroots.git subprojects/wlroots -b $WLROOTS_VERSION
|
||||||
- name: Run scan-build
|
- name: Run scan-build
|
||||||
run: |
|
run: |
|
||||||
meson build-scan-build -Dwlroots:xwayland=enabled
|
meson build-scan-build -Dwlroots:xwayland=enabled
|
||||||
|
|
|
||||||
2
cage.c
2
cage.c
|
|
@ -454,7 +454,7 @@ main(int argc, char *argv[])
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_presentation *presentation = wlr_presentation_create(server.wl_display, server.backend);
|
struct wlr_presentation *presentation = wlr_presentation_create(server.wl_display, server.backend, 2);
|
||||||
if (!presentation) {
|
if (!presentation) {
|
||||||
wlr_log(WLR_ERROR, "Unable to create the presentation interface");
|
wlr_log(WLR_ERROR, "Unable to create the presentation interface");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ if is_freebsd
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
wlroots = dependency('wlroots-0.18', fallback: ['wlroots', 'wlroots'])
|
wlroots = dependency('wlroots-0.19', fallback: ['wlroots', 'wlroots'])
|
||||||
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
|
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
|
||||||
wayland_server = dependency('wayland-server')
|
wayland_server = dependency('wayland-server')
|
||||||
xkbcommon = dependency('xkbcommon')
|
xkbcommon = dependency('xkbcommon')
|
||||||
|
|
|
||||||
2
seat.c
2
seat.c
|
|
@ -937,7 +937,7 @@ seat_set_focus(struct cg_seat *seat, struct cg_view *view)
|
||||||
#if CAGE_HAS_XWAYLAND
|
#if CAGE_HAS_XWAYLAND
|
||||||
if (view->type == CAGE_XWAYLAND_VIEW) {
|
if (view->type == CAGE_XWAYLAND_VIEW) {
|
||||||
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||||
if (!wlr_xwayland_or_surface_wants_focus(xwayland_view->xwayland_surface)) {
|
if (!wlr_xwayland_surface_override_redirect_wants_focus(xwayland_view->xwayland_surface)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
view.c
23
view.c
|
|
@ -55,17 +55,21 @@ view_activate(struct cg_view *view, bool activate)
|
||||||
static bool
|
static bool
|
||||||
view_extends_output_layout(struct cg_view *view, struct wlr_box *layout_box)
|
view_extends_output_layout(struct cg_view *view, struct wlr_box *layout_box)
|
||||||
{
|
{
|
||||||
int width, height;
|
struct wlr_box view_box;
|
||||||
view->impl->get_geometry(view, &width, &height);
|
view->impl->get_geometry(view, &view_box);
|
||||||
|
|
||||||
return (layout_box->height < height || layout_box->width < width);
|
return (layout_box->height < view_box.height || layout_box->width < view_box.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
view_maximize(struct cg_view *view, struct wlr_box *layout_box)
|
view_maximize(struct cg_view *view, struct wlr_box *layout_box)
|
||||||
{
|
{
|
||||||
view->lx = layout_box->x;
|
struct wlr_box view_box;
|
||||||
view->ly = layout_box->y;
|
view->impl->get_geometry(view, &view_box);
|
||||||
|
|
||||||
|
// Do not forget to adjust position according to top left corner declared in view geometry
|
||||||
|
view->lx = layout_box->x - view_box.x;
|
||||||
|
view->ly = layout_box->y - view_box.y;
|
||||||
|
|
||||||
if (view->scene_tree) {
|
if (view->scene_tree) {
|
||||||
wlr_scene_node_set_position(&view->scene_tree->node, view->lx, view->ly);
|
wlr_scene_node_set_position(&view->scene_tree->node, view->lx, view->ly);
|
||||||
|
|
@ -77,11 +81,12 @@ view_maximize(struct cg_view *view, struct wlr_box *layout_box)
|
||||||
static void
|
static void
|
||||||
view_center(struct cg_view *view, struct wlr_box *layout_box)
|
view_center(struct cg_view *view, struct wlr_box *layout_box)
|
||||||
{
|
{
|
||||||
int width, height;
|
struct wlr_box view_box;
|
||||||
view->impl->get_geometry(view, &width, &height);
|
view->impl->get_geometry(view, &view_box);
|
||||||
|
|
||||||
view->lx = (layout_box->width - width) / 2;
|
// Do not forget to adjust position according to top left corner declared in view geometry
|
||||||
view->ly = (layout_box->height - height) / 2;
|
view->lx = (layout_box->width - view_box.width) / 2 - view_box.x;
|
||||||
|
view->ly = (layout_box->height - view_box.height) / 2 - view_box.y;
|
||||||
|
|
||||||
if (view->scene_tree) {
|
if (view->scene_tree) {
|
||||||
wlr_scene_node_set_position(&view->scene_tree->node, view->lx, view->ly);
|
wlr_scene_node_set_position(&view->scene_tree->node, view->lx, view->ly);
|
||||||
|
|
|
||||||
2
view.h
2
view.h
|
|
@ -36,7 +36,7 @@ struct cg_view {
|
||||||
|
|
||||||
struct cg_view_impl {
|
struct cg_view_impl {
|
||||||
char *(*get_title)(struct cg_view *view);
|
char *(*get_title)(struct cg_view *view);
|
||||||
void (*get_geometry)(struct cg_view *view, int *width_out, int *height_out);
|
void (*get_geometry)(struct cg_view *view, struct wlr_box *view_box);
|
||||||
bool (*is_primary)(struct cg_view *view);
|
bool (*is_primary)(struct cg_view *view);
|
||||||
bool (*is_transient_for)(struct cg_view *child, struct cg_view *parent);
|
bool (*is_transient_for)(struct cg_view *child, struct cg_view *parent);
|
||||||
void (*activate)(struct cg_view *view, bool activate);
|
void (*activate)(struct cg_view *view, bool activate);
|
||||||
|
|
|
||||||
|
|
@ -125,14 +125,12 @@ get_title(struct cg_view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_geometry(struct cg_view *view, int *width_out, int *height_out)
|
get_geometry(struct cg_view *view, struct wlr_box *view_box)
|
||||||
{
|
{
|
||||||
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
|
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
|
||||||
struct wlr_box geom;
|
struct wlr_xdg_surface *xdg_surface = xdg_shell_view->xdg_toplevel->base;
|
||||||
|
|
||||||
wlr_xdg_surface_get_geometry(xdg_shell_view->xdg_toplevel->base, &geom);
|
memcpy(view_box, &xdg_surface->geometry, sizeof(*view_box));
|
||||||
*width_out = geom.width;
|
|
||||||
*height_out = geom.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
16
xwayland.c
16
xwayland.c
|
|
@ -38,18 +38,22 @@ get_title(struct cg_view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_geometry(struct cg_view *view, int *width_out, int *height_out)
|
get_geometry(struct cg_view *view, struct wlr_box *view_box)
|
||||||
{
|
{
|
||||||
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||||
struct wlr_xwayland_surface *xsurface = xwayland_view->xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = xwayland_view->xwayland_surface;
|
||||||
|
|
||||||
|
view_box->x = 0;
|
||||||
|
view_box->y = 0;
|
||||||
|
|
||||||
if (xsurface->surface == NULL) {
|
if (xsurface->surface == NULL) {
|
||||||
*width_out = 0;
|
view_box->width = 0;
|
||||||
*height_out = 0;
|
view_box->height = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*width_out = xsurface->surface->current.width;
|
view_box->width = xsurface->surface->current.width;
|
||||||
*height_out = xsurface->surface->current.height;
|
view_box->height = xsurface->surface->current.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -92,7 +96,7 @@ maximize(struct cg_view *view, int output_width, int output_height)
|
||||||
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||||
wlr_xwayland_surface_configure(xwayland_view->xwayland_surface, view->lx, view->ly, output_width,
|
wlr_xwayland_surface_configure(xwayland_view->xwayland_surface, view->lx, view->ly, output_width,
|
||||||
output_height);
|
output_height);
|
||||||
wlr_xwayland_surface_set_maximized(xwayland_view->xwayland_surface, true);
|
wlr_xwayland_surface_set_maximized(xwayland_view->xwayland_surface, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue