Re: [pygtk] reserve screen space / prevent overlapping




On 27 May 2011 01:28, John Stowers <john stowers lists gmail com> wrote:
On Wed, 2011-05-25 at 22:50 +0200, Benjamin Trias wrote:
> Hi list,
>
> I am trying to port from Gtk+2 to Gtk+3 using Python (PyGobject Introspection)
>
> I am trying to find the equivalent of:
> gtk.Window.get_toplevel().window.property_change("_NET_WM_STRUT",
> "CARDINAL", 32, gtk.gdk.PROP_MODE_REPLACE, [0,0,24,0])
>
> which i used to reserve screen space (24 pix at bottom of screen).
>
> In Gtk+3 the Gtk.Window() does not have a "window" attribute and
> nowhere do i find the gdk_property_change() method equivalent in the
> Gdk modules (which i would expect to be Gdk.property_change(), in fact
> the property_delete() and property_get() are listed).
>
> How to change the Gdk window properties with PyGI to reserve screen space?
> Could a binding be missing? Or do i miss some library?
> Anyone has an idea?

PyGI has removed .attributes, so the replacement to get the GdkWindow)
would be get_widget_get_window() or Gtk.Widget.get_window() from g-i.

However, property_change is annotated with (skip) in the bindings
because of the nature of the data argument - unsigned char * + length
but callers should explicitly cast other property types (that are
greater than sizeof(char)).

Its a bit of an ugly C-api, and I played with the annotations a bit. The
best g-i could do was only accept n-values between 0 - 255 and format=8.

Based on the large amount of c-code in the pygtk override for this
function, I think it might be easier to just add multiple functions to
gdk3 to replace this one

property_change_8(... const guint8 *data ...)
property_change_16(... const guint16 *data ...)
property_change_32(... const guint32 *data ...)

I suggest filing a bug with gtk.

John

> Thanks.
> Benjamin
> _______________________________________________
> pygtk mailing list   pygtk daa com au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/


Hi John,

Thanks. I can't follow all of what you said, but i get the idea.
Is there any way to achieve my purpose without the property_change() method?
The Gtk.Window().get_window() returns an object of type gi.types.gtk.gdk.X11window. Can i do something with that?
I tried to get_properties() on it, but i had to pass an argument and could not introspect to find out which, and i don't know if the set_property() method would help.

Or is there a non-Gtk way to address X and reserve screen space?

Thanks
Benjamin


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]