From: cedlemo <ce...@gm...> - 2017-02-25 09:24:50
|
Why not trying to define the window as a dock like this : require "gtk3" win = Gtk::Window.new button = Gtk::Button.new(:label => "quit") button.signal_connect "clicked" do Gtk.main_quit end win.add(button) win.show_all win.window.type_hint = :dock Gtk.main Since Gtk support Xlib, Xcb and wayland, the api tend to be more generic. cedlemo On 24/02/2017 16:38, John Lane wrote: > On 24/02/17 13:44, cedlemo wrote: >> Jhon, >> >> after looking at the documentation >> https://developer.gnome.org/gdk3/stable/gdk3-X-Window-System-Interaction.html >> and at the Gdk code : >> https://github.com/GNOME/gtk/blob/master/gdk/x11/gdkwindow-x11.c >> it seems that Gdk does not provide the api you want. >> >> Can I ask you what do you want to do ? why do you want to set the window >> manager hints ? Do you really need them ? >> Could you not do what you want with the available api without settings >> the window manager hints ? >> > I'm trying to write a dock-like app that puts a bar across the top of > the screen and I want to reserve space for it so that it isn't obscured > by maximised windows. > > I have two ways to achieve what I want but I had hoped to be able to use > the Gtk bindings because it would be neater. I also evaluated the Python > Gtk2 bindings (property_change[1]) and that does support this. > > Here's what I can do in Ruby: > > There is an Xlib API (require 'xlib-objects' [2]) that allows you to do > this: > > topw = XlibObj::Window.new(XlibObj::Display.new(':0') > ,toplevel.window.xid) > XlibObj::Window::Property.new(topw, '_NET_WM_STRUT').set( > [0, 0, self.height, 0 ], > :CARDINAL) > XlibObj::Window::Property.new(topw, '_NET_WM_STRUT_PARTIAL').set( > [0, 0, self.height, 0, 0, 0, 0, 0, x, x+width-1, 0, 0], > :CARDINAL) > > The other way is to run xbind[3] in a subshell: > > xid = toplevel.window.xid > system %Q{xprop -id #{xid} -format _NET_WM_STRUT 32c \ > -set _NET_WM_STRUT \ > "0, 0, #{self.height}, 0"} > system %Q{xprop -id #{xid} -format _NET_WM_STRUT_PARTIAL 32c \ > -set _NET_WM_STRUT_PARTIAL \ > "0, 0, #{self.height}, 0, 0, 0, 0, 0, #{x}, #{x+width-1}, > 0, 0"} > > So I have solutions that work. Thanks for taking the time to look into > it for me. > > John > > > [1] > http://pygtk.org/pygtk2reference/class-gdkwindow.html#method-gdkwindow--property-change > [2] https://rubygems.org/gems/xlib-objects > [3] https://www.x.org/archive/X11R7.5/doc/man/man1/xprop.1.html > > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > ruby-gnome2-devel-en mailing list > rub...@li... > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en |