gardesk/ers / 24073c1

Browse files

Revert SLSTransactionSetWindowBoundsPath donut: segfaults on Tahoe

The guessed FFI signature for SLSTransactionSetWindowBoundsPath does
not match Tahoe's actual ABI — calling it crashes ers with SIGSEGV
during overlay creation, which leaves tarmac with no border renderer.
Removing the donut path; capture-exclusion now relies solely on the
SharingState/ClientPerceivedType advisories. Screenshots will once
again include the overlay border, but borders themselves come back.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
24073c1c3a779d6a419a8800f9bb8d6b55cd7f42
Parents
0597a14
Tree
a1dddd4

2 changed files

StatusFile+-
M src/main.rs 0 24
M src/skylight.rs 0 12
src/main.rsmodified
@@ -1265,30 +1265,6 @@ fn create_overlay(
12651265
         SLSSetWindowSharingState(cid, wid, 0);
12661266
         SLSSetWindowClientPerceivedType(cid, wid, 2);
12671267
 
1268
-        // Replace the window's bounds region with a donut path: outer
1269
-        // rect plus an inner subpath for the interior. SLS interprets
1270
-        // the path with even-odd winding so the interior is *not* part
1271
-        // of the window — the screenshot picker hit-tests through to
1272
-        // the underlying app window. Done via SLSTransaction because
1273
-        // SLSTransactionSetWindowBoundsPath is the only path-based bounds
1274
-        // API exported on Tahoe; CGS region union APIs aren't linkable.
1275
-        let interior = CGRect::new(bw, bw, (ow - 2.0 * bw).max(0.0), (oh - 2.0 * bw).max(0.0));
1276
-        if interior.size.width > 0.0 && interior.size.height > 0.0 {
1277
-            let path = CGPathCreateMutable();
1278
-            if !path.is_null() {
1279
-                let outer = CGRect::new(0.0, 0.0, ow, oh);
1280
-                CGPathAddRect(path, ptr::null(), outer);
1281
-                CGPathAddRect(path, ptr::null(), interior);
1282
-                let txn = SLSTransactionCreate(cid);
1283
-                if !txn.is_null() {
1284
-                    SLSTransactionSetWindowBoundsPath(txn, cid, wid, path as CGPathRef);
1285
-                    SLSTransactionCommit(txn, 1);
1286
-                    CFRelease(txn);
1287
-                }
1288
-                CGPathRelease(path as CGPathRef);
1289
-            }
1290
-        }
1291
-
12921268
         Some((cid, wid, bounds, scale))
12931269
     }
12941270
 }
src/skylight.rsmodified
@@ -271,18 +271,6 @@ unsafe extern "C" {
271271
         y_offset: f32,
272272
         shape: CFTypeRef,
273273
     ) -> CGError;
274
-    /// Sets a window's actual bounds region (what the window-server
275
-    /// considers part of the window for hit-testing, capture, and
276
-    /// rendering) using a CGPath instead of a CGS region. Lets us
277
-    /// install a donut-shaped region without needing a multi-rect
278
-    /// region constructor — none of which exist in linkable form on
279
-    /// Tahoe except `CGSNewRegionWithRect` (single rect).
280
-    pub fn SLSTransactionSetWindowBoundsPath(
281
-        transaction: CFTypeRef,
282
-        cid: CGSConnectionID,
283
-        wid: u32,
284
-        path: CGPathRef,
285
-    ) -> CGError;
286274
 
287275
     // Flicker suppression
288276
     pub fn SLSDisableUpdate(cid: CGSConnectionID) -> CGError;