Using XCreateSimpleWindow() to make a window that is positioned by the WM - Xwindows

This is a discussion on Using XCreateSimpleWindow() to make a window that is positioned by the WM - Xwindows ; This NG has been great and very helpful! Thanks for all the help everyone. Now I have another question. I'm using XCreateSimpleWindow() to make the main window for my app. I want this window's placement to be decided by the ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Using XCreateSimpleWindow() to make a window that is positioned by the WM

  1. Using XCreateSimpleWindow() to make a window that is positioned by the WM

    This NG has been great and very helpful! Thanks for all the help everyone.

    Now I have another question. I'm using XCreateSimpleWindow() to make the
    main window for my app. I want this window's placement to be decided by
    the window manager. No matter what values I choose for x and y I can't
    find any that mean "ignore the program defined placement values and let
    the window manager decide where to place the window". I hope that makes
    sense. My call to XCreateSimpleWindow() looks like this:

    XCreateSimpleWindow (display, RootWindow (display, screen_num), x, y,
    terminal->data->width, terminal->data->height,
    terminal->data->borderwidth, border_pixel,
    background_pixel);

    I looked over XConfigureWindow and XSetWindowAttributes but didn't find
    anything that looked like it did what I need.

    While I'm on the subject, I need to create a popup menu that pops up
    wherever the right mouse button is clicked. This is what I have:

    windowattribs.save_under = True;

    XCreateWindow (display, terminal->data->win, 0, 0, dialogwidth,
    (menuitemheight * MENUITEMS) + menuitemheight,
    terminal->data->borderwidth, CopyFromParent,
    CopyFromParent, CopyFromParent,
    CWBackPixel | CWBorderPixel | CWSaveUnder, &windowattribs);

    Which works great when combined with XMoveWindow to get it to pop in the
    right spot. But I need this window to be able to show outside the borders
    of the parent it, for example, the user clicks near the edge of the
    parent, part of this popup menu will be outside the parent (very much like
    the popup menu in xterm). How do I get this to work?

    jimi

    Vs lbh cynl n Zvpebfsg PQ onpxjneqf, lbh pna urne fngnavp zrffntrf. Ohg
    rira jbefr, vs lbh cynl vg sbejneq, vg vafgnyyf gurve fbsgjner!
    -- Fcbgvphf ba /.


  2. Re: Using XCreateSimpleWindow() to make a window that is positioned by the WM

    jimi wrote:

    > Now I have another question. I'm using XCreateSimpleWindow() to make the
    > main window for my app. I want this window's placement to be decided by
    > the window manager. No matter what values I choose for x and y I can't
    > find any that mean "ignore the program defined placement values and let
    > the window manager decide where to place the window". I hope that makes


    There is no such value. Placement is always a matter of the WM, see
    XSetWMNormalHints(3x). Maybe your WM honours x and y.

    > While I'm on the subject, I need to create a popup menu that pops up
    > wherever the right mouse button is clicked. This is what I have:
    >
    > windowattribs.save_under = True;
    >
    > XCreateWindow (display, terminal->data->win, 0, 0, dialogwidth,
    > (menuitemheight * MENUITEMS) + menuitemheight,
    > terminal->data->borderwidth, CopyFromParent,
    > CopyFromParent, CopyFromParent,
    > CWBackPixel | CWBorderPixel | CWSaveUnder, &windowattribs);
    >
    > Which works great when combined with XMoveWindow to get it to pop in the
    > right spot. But I need this window to be able to show outside the borders
    > of the parent it, for example, the user clicks near the edge of the
    > parent, part of this popup menu will be outside the parent (very much like
    > the popup menu in xterm). How do I get this to work?


    Popups are usually toplevel windows, so they can overlap adjacent windows.
    To avoid WM treatment (framing, placement) , you can set the
    override_redirect window attribute, see XWindowAttributes(3x).

    Regards,
    Daniel

  3. Re: Using XCreateSimpleWindow() to make a window that is positioned by the WM

    In article ,
    Daniel Rakel wrote:
    >jimi wrote:
    >
    >> Now I have another question. I'm using XCreateSimpleWindow() to make the
    >> main window for my app. I want this window's placement to be decided by
    >> the window manager. No matter what values I choose for x and y I can't
    >> find any that mean "ignore the program defined placement values and let
    >> the window manager decide where to place the window". I hope that makes

    >
    >There is no such value. Placement is always a matter of the WM, see
    >XSetWMNormalHints(3x). Maybe your WM honours x and y.
    >
    >> While I'm on the subject, I need to create a popup menu that pops up
    >> wherever the right mouse button is clicked. This is what I have:
    >>
    >> windowattribs.save_under = True;
    >>
    >> XCreateWindow (display, terminal->data->win, 0, 0, dialogwidth,
    >> (menuitemheight * MENUITEMS) + menuitemheight,
    >> terminal->data->borderwidth, CopyFromParent,
    >> CopyFromParent, CopyFromParent,
    >> CWBackPixel | CWBorderPixel | CWSaveUnder, &windowattribs);
    >>
    >> Which works great when combined with XMoveWindow to get it to pop in the
    >> right spot. But I need this window to be able to show outside the borders
    >> of the parent it, for example, the user clicks near the edge of the
    >> parent, part of this popup menu will be outside the parent (very much like
    >> the popup menu in xterm). How do I get this to work?

    >
    >Popups are usually toplevel windows, so they can overlap adjacent windows.
    >To avoid WM treatment (framing, placement) , you can set the
    >override_redirect window attribute, see XWindowAttributes(3x).
    >
    >Regards,
    >Daniel


    Also, it gets clipped to the parent so it needs to be a child of the root
    window: change terminal->data->win to DefaultRootWindow(display).

    Gary Baumgartner



  4. Re: Using XCreateSimpleWindow() to make a window that is positioned by the WM

    Gary Baumgartner wrote:

    > In article ,
    > Daniel Rakel wrote:
    >>jimi wrote:
    >>> Which works great when combined with XMoveWindow to get it to pop in the
    >>> right spot. But I need this window to be able to show outside the borders
    >>> of the parent it, for example, the user clicks near the edge of the
    >>> parent, part of this popup menu will be outside the parent (very much like
    >>> the popup menu in xterm). How do I get this to work?

    >>
    >>Popups are usually toplevel windows, so they can overlap adjacent windows.
    >>To avoid WM treatment (framing, placement) , you can set the
    >>override_redirect window attribute, see XWindowAttributes(3x).

    >
    > Also, it gets clipped to the parent so it needs to be a child of the root


    This is not necessarily true: it needs to be a child of the window, which
    contains all the windows, the popup wants to overlap. In the special case,
    the mentioned parent is the application's toplevel window, you statement
    is right, But then, where are your news (hint: overlapping adjacent
    windows is not possible when the windows is clipped at one of the
    adajacent windows borders)?

    Regards,
    Daniel

  5. Re: Using XCreateSimpleWindow() to make a window that is positioned by the WM

    In article ,
    Daniel Rakel wrote:
    >Gary Baumgartner wrote:
    >
    >> In article ,
    >> Daniel Rakel wrote:
    >>>jimi wrote:
    >>>> Which works great when combined with XMoveWindow to get it to pop in the
    >>>> right spot. But I need this window to be able to show outside the borders
    >>>> of the parent it, for example, the user clicks near the edge of the
    >>>> parent, part of this popup menu will be outside the parent (very much like
    >>>> the popup menu in xterm). How do I get this to work?
    >>>
    >>>Popups are usually toplevel windows, so they can overlap adjacent windows.
    >>>To avoid WM treatment (framing, placement) , you can set the
    >>>override_redirect window attribute, see XWindowAttributes(3x).

    >>
    >> Also, it gets clipped to the parent so it needs to be a child of the root

    >
    >This is not necessarily true: it needs to be a child of the window, which
    >contains all the windows, the popup wants to overlap. In the special case,
    >the mentioned parent is the application's toplevel window, you statement
    >is right,


    The main problem was that I misread your original response, somehow
    missing that you mentioned both toplevel and override_redirect. So the
    "Also" shouldn't be there. However, I don't quite understand this response.
    Aren't we saying the same thing in different ways?

    > But then, where are your news (hint: overlapping adjacent
    >windows is not possible when the windows is clipped at one of the
    >adajacent windows borders)?


    I can't quite make out what you're saying here: what do you mean by "news",
    and which window is which (the singular-plural disagreement is making
    it difficult for me as well).

    Gary Baumgartner



  6. Re: Using XCreateSimpleWindow() to make a window that is positioned by the WM

    Gary Baumgartner wrote:

    > In article ,
    > Daniel Rakel wrote:
    >>Gary Baumgartner wrote:
    >>>>Popups are usually toplevel windows, so they can overlap adjacent windows.
    >>>>To avoid WM treatment (framing, placement) , you can set the
    >>>>override_redirect window attribute, see XWindowAttributes(3x).
    >>>
    >>> Also, it gets clipped to the parent so it needs to be a child of the root

    >>
    >>This is not necessarily true: it needs to be a child of the window, which
    >>contains all the windows, the popup wants to overlap. In the special case,
    >>the mentioned parent is the application's toplevel window, you statement
    >>is right,

    >
    > The main problem was that I misread your original response, somehow
    > missing that you mentioned both toplevel and override_redirect. So the
    > "Also" shouldn't be there. However, I don't quite understand this response.
    > Aren't we saying the same thing in different ways?


    Mostly, I think so.

    >> But then, where are your news (hint: overlapping adjacent
    >>windows is not possible when the windows is clipped at one of the
    >>adajacent windows borders)?

    >
    > I can't quite make out what you're saying here: what do you mean by "news",


    This is usenet, post news ;-)

    > and which window is which (the singular-plural disagreement is making
    > it difficult for me as well).


    Sorry, typo and bad phrased: "Overlapping adjacent windows is not possible
    when the popup window is clipped at one of the adajacent windows borders."
    I only wanted to point out that "using toplevel windows as popups to
    achieve overlapping adjacent windows" [me] and "using root child windows
    as popups to avoid clipping at parent borders" [you] is much the same
    thing.

    Regards,
    Daniel

+ Reply to Thread