x window id - Xwindows

This is a discussion on x window id - Xwindows ; Hello, In c or c++, is there a way to get the window id knowing the window name? I am creating a window using the glut library, but it doesn't provide me the x window id. Thanks in advance....

+ Reply to Thread
Results 1 to 6 of 6

Thread: x window id

  1. x window id

    Hello,

    In c or c++, is there a way to get the window id knowing the window name?

    I am creating a window using the glut library, but it doesn't provide me
    the x window id.

    Thanks in advance.

  2. Re: x window id

    In comp.windows.x, anon

    wrote
    on Wed, 04 Jun 2008 18:51:10 +0200
    :
    > Hello,
    >
    > In c or c++, is there a way to get the window id knowing the window name?
    >
    > I am creating a window using the glut library, but it doesn't provide me
    > the x window id.
    >
    > Thanks in advance.


    X windows have no names as such. You might use XQueryTree
    and then pick through the toplevel windows for the one
    with the title you want; bear in mind that the X window
    you'll probably actually want is a child, as most window
    managers reparent. Bear also in mind that such methods
    mean you can't port to Windows later.

    Since you're looking for your *own* window, you
    might also try a different OpenGL access method using
    glXCreateContext().

    If you're looking for the X window ID to handle events
    using select() or pselect() in your own event loop.
    you might want to check out the callback functions,
    including glutTimerFunc() and glutIdleFunc() instead. Of
    course you'll have to completely rewrite your event loop
    in that case -- and in fact glut provides glutMainLoop().

    I'm a little curious as to exactly what you want to do here.

    --
    #191, ewill3@earthlink.net
    Conventional memory has to be one of the most UNconventional
    architectures I've seen in a computer system.
    ** Posted from http://www.teranews.com **

  3. Re: x window id

    On Jun 4, 10:51 am, anon wrote:
    > Hello,
    >
    > In c or c++, is there a way to get the window id knowing the window name?
    >
    > I am creating a window using the glut library, but it doesn't provide me
    > the x window id.


    Try

    glXGetCurrentDrawable()

    -Ed
    --
    (You can't go wrong with psycho-rats.)(http://mi.eng.cam.ac.uk/~er258)

    /d{def}def/f{/Times s selectfont}d/s{11}d/r{roll}d f 2/m{moveto}d -1
    r 230 350 m 0 1 179{ 1 index show 88 rotate 4 mul 0 rmoveto}for/s 12
    d f pop 235 420 translate 0 0 moveto 1 2 scale show showpage



  4. Re: x window id

    The Ghost In The Machine wrote:
    > In comp.windows.x, anon
    >
    > wrote
    > on Wed, 04 Jun 2008 18:51:10 +0200
    > :
    >> Hello,
    >>
    >> In c or c++, is there a way to get the window id knowing the window name?
    >>
    >> I am creating a window using the glut library, but it doesn't provide me
    >> the x window id.
    >>
    >> Thanks in advance.

    >



    Hello. Thanks for fast response.

    > X windows have no names as such. You might use XQueryTree
    > and then pick through the toplevel windows for the one
    > with the title you want; bear in mind that the X window
    > you'll probably actually want is a child, as most window


    I found an example (source code for xwininfo, and they are doing
    something as you suggested.

    > managers reparent. Bear also in mind that such methods
    > mean you can't port to Windows later.


    Porting is not an issue, as I am writing the application for Linux only.

    >
    > Since you're looking for your *own* window, you
    > might also try a different OpenGL access method using
    > glXCreateContext().
    >


    Since we are short with time, I would like to avoid doing anything new
    or changing my code much. My programs are working, and I now have no
    time to try new things

    > If you're looking for the X window ID to handle events
    > using select() or pselect() in your own event loop.
    > you might want to check out the callback functions,
    > including glutTimerFunc() and glutIdleFunc() instead. Of
    > course you'll have to completely rewrite your event loop
    > in that case -- and in fact glut provides glutMainLoop().
    >


    The even loop stays the same, that is, I am going to use glut's event loop.

    > I'm a little curious as to exactly what you want to do here.
    >


    The window I create should be embedded into another window, and I need
    its id.

  5. Re: x window id

    Edward Rosten wrote:
    > On Jun 4, 10:51 am, anon wrote:
    >> Hello,
    >>
    >> In c or c++, is there a way to get the window id knowing the window name?
    >>
    >> I am creating a window using the glut library, but it doesn't provide me
    >> the x window id.

    >
    > Try
    >
    > glXGetCurrentDrawable()
    >


    Great. That solved the problem
    Thank you very much

  6. Re: x window id

    In comp.windows.x, anon

    wrote
    on Thu, 05 Jun 2008 10:16:04 +0200
    :
    > Edward Rosten wrote:
    >> On Jun 4, 10:51 am, anon wrote:
    >>> Hello,
    >>>
    >>> In c or c++, is there a way to get the window id knowing the window name?
    >>>
    >>> I am creating a window using the glut library, but it doesn't provide me
    >>> the x window id.

    >>
    >> Try
    >>
    >> glXGetCurrentDrawable()
    >>

    >
    > Great. That solved the problem
    > Thank you very much


    Ah, I'm embarrassed...but OK, considering your response
    to me, that'll work. ;-)

    --
    #191, ewill3@earthlink.net
    Useless C++ Programming Idea #7878218:
    class C { private: virtual void stupid() = 0; };
    ** Posted from http://www.teranews.com **

+ Reply to Thread