sidorares / node-x11

X11 node.js network protocol client
MIT License
518 stars 72 forks source link

No SetWindowShapeRegion in XFixes #200

Open Heath123 opened 3 years ago

Heath123 commented 3 years ago

I'm trying to do https://stackoverflow.com/questions/16400937/click-through-transparent-xlib-windows?rq=1 in nodejs, but the SetWindowShapeRegion function doesn't seem to exist in https://github.com/sidorares/node-x11/blob/master/lib/ext/fixes.js (seems similar to #184)

Heath123 commented 3 years ago

I'll see if I can add it maybe

Heath123 commented 3 years ago

I tried doing

ext.SetWindowShapeRegion = function(wid, destKind, xOffset, yOffset, region) {
    X.seq_num ++;
    X.pack_stream.pack('CCSLCxxxssL', [ ext.majorOpcode, 21, 5, wid, destKind, xOffset, yOffset, region ])
    X.pack_stream.flush();
}

(not sure if that's right) and

const regionID = X.AllocID()
fixes.CreateRegion(regionID, [{ width: 0, height: 0, x: 0, y: 0 }])
console.log('regionID', regionID)

fixes.SetWindowShapeRegion(wid, 0, 0, 0, regionID) // TODO: what should destKind be?

with different numbers for the second argument but I still can't click through

Heath123 commented 3 years ago

https://root.cern.ch/doc/master/shapeconst_8h_source.html#l00048 So apparently ShapeInput = 2? This code:

const regionID = X.AllocID()
fixes.CreateRegion(regionID, [{ width: 0, height: 0, x: 0, y: 0 }])
console.log('regionID', regionID)

fixes.SetWindowShapeRegion(wid, 2, 0, 0, regionID)

fixes.DestroyRegion(regionID)

still won't work, no errors but I can't click through

Heath123 commented 3 years ago

Well this seems useful https://stackoverflow.com/a/35929697/4012708 Edit: But I don't know how to draw on the overlay window