diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-07-03 00:07:42 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-07-03 00:07:42 +0200 |
| commit | a6e9cd2aef129e71479800a8dfaec05b3d38d20e (patch) | |
| tree | 57b63239d0c6d6a579d5089eaee9b14e23354f79 /src/main/java/moe/nea/mossbar/concepts/Bar.java | |
| parent | 1eae252f41eab7612864fb479263dc93310d8930 (diff) | |
| download | mossbar-a6e9cd2aef129e71479800a8dfaec05b3d38d20e.tar.gz mossbar-a6e9cd2aef129e71479800a8dfaec05b3d38d20e.tar.bz2 mossbar-a6e9cd2aef129e71479800a8dfaec05b3d38d20e.zip | |
feat: Adjust to screen size
Diffstat (limited to 'src/main/java/moe/nea/mossbar/concepts/Bar.java')
| -rw-r--r-- | src/main/java/moe/nea/mossbar/concepts/Bar.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/moe/nea/mossbar/concepts/Bar.java b/src/main/java/moe/nea/mossbar/concepts/Bar.java index 891b28a..7ce6591 100644 --- a/src/main/java/moe/nea/mossbar/concepts/Bar.java +++ b/src/main/java/moe/nea/mossbar/concepts/Bar.java @@ -17,8 +17,7 @@ public class Bar extends Scope { private final ShmBufferPool bufferPool; private WlCallbackProxy callbackProxy; - - public Bar(Display display, WlOutputProxy output) { + public Bar(Display display, Output output) { this.display = display; this.surface = display.compositorProxy.createSurface(new WlSurfaceEventsV6() { @Override @@ -53,12 +52,15 @@ public class Bar extends Scope { public void closed(ZwlrLayerSurfaceV1Proxy emitter) { System.out.println("layer closed"); } - }, this.surface, output, ZwlrLayerShellV1Layer.OVERLAY.getValue(), "mossbar") + }, this.surface, output.proxy, ZwlrLayerShellV1Layer.OVERLAY.getValue(), "mossbar") .bindTo(this); - int width = 1920; + if (output.width <= 0) + throw new IllegalStateException("Monitor with 0 sized output"); + int width = output.width; int height = 30; layer.setSize(width, height); // TODO??? this should really not be a hardcoded width layer.setAnchor(EnumUtil.encode(EnumSet.of(ZwlrLayerSurfaceV1Anchor.TOP, ZwlrLayerSurfaceV1Anchor.RIGHT, ZwlrLayerSurfaceV1Anchor.LEFT))); + layer.setExclusiveZone(height); surface.commit(); try { bufferPool = ShmBufferPool.newARGBPool(display, width, height, 2); @@ -69,7 +71,6 @@ public class Bar extends Scope { } public void renderOnce() { - System.out.println("Rendering"); var nextBuffer = bufferPool.poll(); assert nextBuffer != null; var pixels = nextBuffer.getByteBuffer().asIntBuffer(); @@ -78,7 +79,6 @@ public class Bar extends Scope { surface.damage(0, 0, nextBuffer.width, nextBuffer.height); queueNextFrame(); surface.commit(); - System.out.println("surface committed"); } private void queueNextFrame() { |
