Hi all.
I have troubles with getting window state.
Here is the example code:
#### start of code
#!/usr/bin/env python
import gtk
def window_state_callback(widget, event):
print event.new_window_state
def get_window_state(widget):
print widget.get_toplevel().window.get_state()
if __name__ == '__main__':
W = gtk.Window()
W.connect('destroy', gtk.main_quit)
W.connect('window-state-event', window_state_callback)
B = gtk.Button('Get window state')
B.connect('clicked', get_window_state)
W.add(B)
W.show_all()
gtk.main()
#### end of code
It just should display window state whenever it changes or when you
press a button.
When window gets iconified, maximized or fullscreen (and back to
normal), it works as I expect, and the output is like this:
<flags GDK_WINDOW_STATE_ICONIFIED of type GdkWindowState>
<flags 0 of type GdkWindowState>
<flags GDK_WINDOW_STATE_MAXIMIZED of type GdkWindowState>
<flags 0 of type GdkWindowState>
<flags GDK_WINDOW_STATE_FULLSCREEN of type GdkWindowState>
<flags 0 of type GdkWindowState>
However, when I make the window sticky (via window manager menu) two
lines are displayed, which means that window state event was triggered
2 times
<flags GDK_WINDOW_STATE_STICKY of type GdkWindowState>
<flags 0 of type GdkWindowState>
and getting window state always returns <flags 0 of type GdkWindowState>.
Making the window "Above All" or "Below All" has no effect at all.
So, my questions are:
1. Am I doing something wrong or it's a bug in pygtk or gtk?
2. How can I get correct window state? I'm mostly interested in
"sticky" and "below all" states.
I'm running GTK 2.18.6, pygtk 2.16.0. I tested the code above with
Xfwm4 and Metacity with the same results
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/