Make example program work with newest interation.

This commit is contained in:
Vidar Hokstad 2023-12-16 14:46:16 +00:00
parent 4ad8687a0a
commit 370ac3e367

View file

@ -13,37 +13,37 @@ require 'X11'
dpy = display = X11::Display.new dpy = display = X11::Display.new
screen = dpy.screens.first screen = dpy.screens.first
root = screen.root root = screen.root
wid = display.new_id
dpy.create_window( wid = dpy.create_window(
screen.root_depth, wid, root,
0, 0, # x,y 0, 0, # x,y
1000, 600, # w,h 1000, 600, # w,h
0, # FIXME: WTH isn't depth: 32 working here?
X11::Form::InputOutput, depth: 24,
X11::Form::CopyFromParent, values: {
X11::Form::CWBackPixel | X11::Form::CWBackPixel => 0x0,
X11::Form::CWEventMask, X11::Form::CWEventMask =>
[0x0, # RGB background (X11::Form::SubstructureNotifyMask |
X11::Form::SubstructureNotifyMask | X11::Form::StructureNotifyMask | ## Move
X11::Form::StructureNotifyMask | ## Move X11::Form::ExposureMask |
X11::Form::ExposureMask | X11::Form::KeyPressMask |
X11::Form::KeyPressMask | X11::Form::ButtonPressMask)
X11::Form::ButtonPressMask }
]
) )
#dpy.next_packet
#exit(0)
def set_window_opacity(dpy, wid, opacity) def set_window_opacity(dpy, wid, opacity)
dpy.change_property( dpy.change_property(
X11::Form::Replace, :replace,
wid, dpy.atom(:_NET_WM_WINDOW_OPACITY), wid, "_NET_WM_WINDOW_OPACITY",
X11::Form::CardinalAtom, 32, :cardinal, 32,
[(0xffffffff * opacity).to_i].pack("N").split(//).map(&:ord) [(0xffffffff * opacity).to_i].pack("V").unpack("C*")
) )
end end
set_window_opacity(dpy, wid, 0.8) set_window_opacity(dpy, wid, 0.8)
#p dpy.display_info #p dpy.display_info
#reply = dpy.query_extension("XKEYBOARD") #reply = dpy.query_extension("XKEYBOARD")