Skip to content

Commit

Permalink
Merge pull request #133 from francma/dev
Browse files Browse the repository at this point in the history
Implement per output configuration & fractional scaling
  • Loading branch information
francma authored Feb 15, 2025
2 parents 729e5c6 + 04cd51d commit 2e72845
Show file tree
Hide file tree
Showing 16 changed files with 749 additions and 352 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ trim_trailing_whitespace = true

[*.{c,h,txt}]
indent_style = tab
indent_size = 4

[*.{xml,yml}]
indent_style = space
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ on:
jobs:
test:
runs-on: ubuntu-latest
container: alpine:3.17
container: alpine:3.18
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: apk update && apk add meson wayland-dev musl-dev wayland-protocols gcc inih-dev pixman-dev cmocka-dev
run: apk update && apk add meson wayland-dev musl-dev wayland-protocols gcc inih-dev cmocka-dev
- name: Run tests
run: meson setup test && ninja -C test test

analyze:
runs-on: ubuntu-latest
container: alpine:3.17
container: alpine:3.18
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: apk update && apk add meson wayland-dev musl-dev wayland-protocols gcc inih-dev pixman-dev cmocka-dev clang15 clang15-extra-tools clang15-analyzer
run: apk update && apk add meson wayland-dev musl-dev wayland-protocols gcc inih-dev cmocka-dev clang16 clang16-extra-tools clang16-analyzer
- name: Run clang-analyzer
if: success() || failure()
run: scan-build meson setup clang-analyzer && scan-build --status-bugs ninja -C clang-analyzer
Expand All @@ -33,10 +33,10 @@ jobs:

format:
runs-on: ubuntu-latest
container: alpine:3.17
container: alpine:3.18
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: apk update && apk add clang15-extra-tools
run: apk update && apk add clang16-extra-tools
- name: Run clang-format
run: clang-format -Werror --dry-run src/* test/*
49 changes: 24 additions & 25 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ project(

cc = meson.get_compiler('c')

wayland_protos = dependency('wayland-protocols', version: '>=1.13')
# minimal version with fractional scaling protocol
wayland_protos = dependency('wayland-protocols', version: '>=1.31')
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
wayland_scanner = find_program('wayland-scanner')
wayland_client = dependency('wayland-client')
rt = cc.find_library('rt')
libm = cc.find_library('m')
seccomp = dependency('libseccomp', required: get_option('seccomp'))
inih = dependency('inih')

Expand All @@ -32,34 +34,31 @@ wayland_scanner_client = generator(
arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
)

client_protocols = [
[wl_protocol_dir + '/stable/xdg-shell', 'xdg-shell.xml'],
[meson.project_source_root() + '/protocols', 'wlr-layer-shell-unstable-v1.xml'],
wl_proto_xml = [
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'stable/viewporter/viewporter.xml',
'protocols/wlr-layer-shell-unstable-v1.xml',
wl_protocol_dir / 'staging/fractional-scale/fractional-scale-v1.xml',
]

foreach p : client_protocols
xml = join_paths(p)
src = wayland_scanner_code.process(xml)
header = wayland_scanner_client.process(xml)

name = p[1].split('.')[0].underscorify()

lib = static_library(
name,
[src, header],
dependencies: [wayland_client],
)

dep = declare_dependency(
link_with: lib,
sources: header,
)

set_variable(name, dep)
wl_proto_headers = []
wl_proto_src = []
foreach proto : wl_proto_xml
wl_proto_headers += custom_target(
proto.underscorify() + '_client_header',
output: '@[email protected]',
input: proto,
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'])

wl_proto_src += custom_target(
proto.underscorify() + '_private_code',
output: '@[email protected]',
input: proto,
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'])
endforeach

wob_sources = ['src/main.c', 'src/image.c', 'src/log.c', 'src/color.c', 'src/config.c', 'src/wob.c']
wob_dependencies = [wayland_client, wlr_layer_shell_unstable_v1, xdg_shell, rt, inih]
wob_sources = ['src/main.c', 'src/image.c', 'src/log.c', 'src/color.c', 'src/config.c', 'src/wob.c', 'src/shm.c', wl_proto_src, wl_proto_headers]
wob_dependencies = [wayland_client, rt, inih, libm]
if seccomp.found()
wob_dependencies += seccomp
wob_sources += 'src/pledge_seccomp.c'
Expand Down
18 changes: 9 additions & 9 deletions protocols/wlr-layer-shell-unstable-v1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<description summary="create surfaces that are layers of the desktop">
Clients can use this interface to assign the surface_layer role to
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
rendered with a defined z-depth respective to each other. They may also be
surface with a defined z-depth respective to each other. They may also be
anchored to the edges and corners of a screen and specify input handling
semantics. This interface should be suitable for the implementation of
many desktop shell components, and a broad number of other applications
Expand All @@ -42,9 +42,9 @@
layer_surface, or raises a protocol error if another role is already
assigned.

Creating a layer surface from a wl_surface which has a buffer attached
Creating a layer surface from a wl_surface which has a shm_data attached
or committed is a client error, and any attempts by a client to attach
or manipulate a buffer prior to the first layer_surface.configure call
or manipulate a shm_data prior to the first layer_surface.configure call
must also be treated as errors.

You may pass NULL for output to allow the compositor to decide which
Expand All @@ -64,15 +64,15 @@
<enum name="error">
<entry name="role" value="0" summary="wl_surface has another role"/>
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
<entry name="already_constructed" value="2" summary="wl_surface has a shm_data attached or committed"/>
</enum>

<enum name="layer">
<description summary="available layers for surfaces">
These values indicate which layers a surface can be rendered in. They
These values indicate which layers a surface can be surface in. They
are ordered by z depth, bottom-most first. Traditional shell surfaces
will typically be rendered between the bottom and top layers.
Fullscreen shell surfaces are typically rendered at the top layer.
will typically be surface between the bottom and top layers.
Fullscreen shell surfaces are typically surface at the top layer.
Multiple surfaces can share a single layer, and ordering within a
single layer is undefined.
</description>
Expand All @@ -87,7 +87,7 @@
<interface name="zwlr_layer_surface_v1" version="2">
<description summary="layer metadata interface">
An interface that may be implemented by a wl_surface, for surfaces that
are designed to be rendered as a layer of a stacked desktop-like
are designed to be surface as a layer of a stacked desktop-like
environment.

Layer surface state (layer, size, anchor, exclusive zone,
Expand Down Expand Up @@ -291,7 +291,7 @@

<request name="set_layer" since="2">
<description summary="change the layer of the surface">
Change the layer that the surface is rendered on.
Change the layer that the surface is surface on.

Layer is double-buffered, see wl_surface.commit.
</description>
Expand Down
1 change: 1 addition & 0 deletions src/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ wob_color_from_rgba_string(const char *str, struct wob_color *color)
switch (length) {
case 8:
parts[3] = hex_to_int(str[6]) * 16 + hex_to_int(str[7]);
// fallthrough
case 6:
parts[0] = hex_to_int(str[0]) * 16 + hex_to_int(str[1]);
parts[1] = hex_to_int(str[2]) * 16 + hex_to_int(str[3]);
Expand Down
Loading

0 comments on commit 2e72845

Please sign in to comment.