Method: WindowGeometry::X::Window#query_tree

Defined in:
lib/window_geometry/x.rb

#query_treeObject



306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/window_geometry/x.rb', line 306

def query_tree
  root = ' '*8
  parent = ' '*8
  nchildren = X11::Int.malloc(Fiddle::RUBY_FREE)
  children_p = X11::Pointer.malloc(Fiddle::RUBY_FREE)
  ret = X11::XQueryTree(@display, @window, root, parent, children_p, nchildren)
  return if ret == 0

  nchildren.n.times.map do |i|
    win = children_p.ptr[X11::Window.size * i, X11::Window.size].unpack1('L!')
    Window.new(@display, win)
  end
end