From 370ac3e36713ae7816736c86d060b8b3cbe6c2bb Mon Sep 17 00:00:00 2001 From: Vidar Hokstad Date: Sat, 16 Dec 2023 14:46:16 +0000 Subject: [PATCH] Make example program work with newest interation. --- example/test.rb | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/example/test.rb b/example/test.rb index f10dc6b..45f542b 100644 --- a/example/test.rb +++ b/example/test.rb @@ -13,37 +13,37 @@ require 'X11' dpy = display = X11::Display.new screen = dpy.screens.first root = screen.root -wid = display.new_id -dpy.create_window( - screen.root_depth, wid, root, +wid = dpy.create_window( 0, 0, # x,y 1000, 600, # w,h - 0, - X11::Form::InputOutput, - X11::Form::CopyFromParent, - X11::Form::CWBackPixel | - X11::Form::CWEventMask, - [0x0, # RGB background - X11::Form::SubstructureNotifyMask | - X11::Form::StructureNotifyMask | ## Move - X11::Form::ExposureMask | - X11::Form::KeyPressMask | - X11::Form::ButtonPressMask - ] + # FIXME: WTH isn't depth: 32 working here? + depth: 24, + values: { + X11::Form::CWBackPixel => 0x0, + X11::Form::CWEventMask => + (X11::Form::SubstructureNotifyMask | + X11::Form::StructureNotifyMask | ## Move + X11::Form::ExposureMask | + X11::Form::KeyPressMask | + X11::Form::ButtonPressMask) + } ) +#dpy.next_packet +#exit(0) def set_window_opacity(dpy, wid, opacity) dpy.change_property( - X11::Form::Replace, - wid, dpy.atom(:_NET_WM_WINDOW_OPACITY), - X11::Form::CardinalAtom, 32, - [(0xffffffff * opacity).to_i].pack("N").split(//).map(&:ord) + :replace, + wid, "_NET_WM_WINDOW_OPACITY", + :cardinal, 32, + [(0xffffffff * opacity).to_i].pack("V").unpack("C*") ) end set_window_opacity(dpy, wid, 0.8) + #p dpy.display_info #reply = dpy.query_extension("XKEYBOARD")