• XSendEvent of mouse button events

    From Noel Hunt@noel.hunt@gmail.com to comp.windows.x on Thu May 18 15:33:39 2017
    From Newsgroup: comp.windows.x

    I have a particular terminal program which has a button 2
    menu, but when button 3 is pressed in this client, I would
    like to pass this event on to the window manager, so that
    it can post its own button 3 menu.

    The current implementation of the terminal has the following
    code (not directly, through a library) which it calls when
    it receives a button 3 event:

    XUngrabPointer(_x.display, m->msec);
    XSendEvent(_x.display, e.root, True, ButtonPressMask, (XEvent*)&e);

    Neglecting the data structures, the intent is to send the
    event back to the root window.

    After button 3 is pressed once in the client, the window manager
    button 3 menu is posted; after dismissing the menu, the next
    pointer movement immediately posts this menu again. That is,
    the loop in the client that waits on mouse events, is getting
    a ButtonPress event. While the window manager menu is posted,
    if the pointer is moved outside the client and the menu is
    unposted, the next pointer motion into the client window causes
    the window manager menu to be posted again, and so on.

    Any help would be appreciated.

    Regards,
    Noel Hunt



    --- Synchronet 3.21d-Linux NewsLink 1.2