Re: [opencoffee-devel] Window on bottom - Skip taskbar entry using _NET_WM_STATE

[ Thread Index | Date Index | More lists.tuxfamily.org/opencoffee-devel Archives ]


Gustavo A. Díaz escribió:
Chicos, a ver si me dan una mano con esto:

Yo he implementado un código en python (usando las funciones de xlib, con python-xlib) que debería resolver el problema de poner la ventana de la aplicación cliente por debajo de las demás y a su vez ocultar la entrada de la barra de tareas. El mismo, no tiene efecto por eso implementé el código en c++ usando un wrapper para python, el cual funciona perfectamente. Ahora esto, es una solución temporal.. ya que no es ideal mezclar lenguajes al menos que sea estrictamente necesario. Por lo tanto, había posteado en la lista de correo de la gente de python-xlib el cual me respondieron lo sgte.:

------------------------------------------------------------------------

    Hi Gustavo,

    I had a play with your sample code and, after a bunch of
    struggling around, managed to get somewhere.  It looks like the
    problem is that you're sending the _NET_WM_STATE messages before
    the window is mapped. If you instead split the program into two -
    one that brings up your GUI, then a separate test one that sets
    the _NET_WM_STATE for your window, it works (for me anyway).

To be more explicit, I ran your existing program and left it up. Then I used xwininfo to get the window id and added it to this
    little program (basically a hacked up version of what you had):

    -------------------------------------
    #!/usr/bin/env python

    import sys
    from Xlib import X, display, protocol

    def _change_state(window):
        disp  = display.Display()
        rootw = disp.screen().root
        ctype = disp.intern_atom("_NET_WM_STATE")
        state = disp.intern_atom("_NET_WM_STATE_SKIP_TASKBAR")
        data = [1, state] + [0] * 3
        ev = protocol.event.ClientMessage(client_type = ctype, window
    = window, data = (32, data))
        mask = X.SubstructureRedirectMask | X.SubstructureNotifyMask
        print "sending", ev, mask, "for", window
        rootw.send_event(ev, event_mask = mask)
        disp.flush()  # need this or the program terminates too fast

    if __name__ == "__main__":
          # change this id!
        _change_state(0x3a0001b)
    -------------------------------------

    When I ran this it made my opencoffee client window disappear from
    the taskbar, as one would expect.

    I also found it useful to poke around a bit with xprop, but the
    thing that really helped me find this was to run "xev -id <root
    window id>", add a few sleeps to your program and see what
    happened - you can clearly see the _NET_WM_STATE message is sent
    before the window is mapped. Here's a snippet from an earlier test:

    -------------------------
    sending Xlib.protocol.event.ClientMessage(data = (32, [1, 308, 0,
    0, 0]), window = 94371867L, client_type = 249, type = 33,
    sequence_number = 0) 1572864 for 94371867

    ClientMessage event, serial 18, synthetic YES, window 0x5a0001b,
        message_type 0xf9 (_NET_WM_STATE), format 32
    ConfigureNotify event, serial 18, synthetic NO, window 0x13a,
        event 0x13a, window 0x5a0001b, (460,392), width 360, height 240,
        border_width 0, above 0x134dd32, override NO
    PropertyNotify event, serial 18, synthetic NO, window 0x13a,
        atom 0x132 (_NET_CLIENT_LIST), time 381617232, state
    PropertyNewValue
    PropertyNotify event, serial 18, synthetic NO, window 0x13a,
        atom 0x133 (_NET_CLIENT_LIST_STACKING), time 381617232, state
    PropertyNewValue
    MapNotify event, serial 18, synthetic NO, window 0x13a,
        event 0x13a, window 0x5a0001b, override NO
    PropertyNotify event, serial 18, synthetic NO, window 0x13a,
        atom 0x132 (_NET_CLIENT_LIST), time 381617234, state
    PropertyNewValue
    ...
    -------------------------

    So, in short, I figure if you do the send event after you've done
    app.exec_() (probably as a startup event handler of some kind?),
    it should be ok.

    Hope this helps :)

    Cheers,

    Mike.


------------------------------------------------------------------------

A ver si alguien de uds chicos me ayuda a solucionarlo. El código original que yo he escrito está en OpenCoffee_client.py. Eso si, obvien la parte de la importación del código en C++. Exactamente dicho código de xlib está a partir de la línea 40 a 55, y luego dentro del la función principal se hace la llamada al mismo. Habría que interpretar bien la solución que este muchacho agradablemente me ha otorgado. Luego lo leo bien, ahora ando medio con poco tiempo... así de paso repartimos un poco la tarea...

Voy a revisarlo, a ver si puedo hacer algo.
--
/Gustavo A. Díaz/
*GDNet Projects*
www.gdnet.com.ar <http://www.gdnet.com.ar>
Gustavo A. Díaz


---
Lista de correo de desarrollo de OpenCoffee - The coffee that smells like Freedom...


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/