Enlarging a window produces clipping - Xwindows

This is a discussion on Enlarging a window produces clipping - Xwindows ; Hello, I am studying X, and confused some problems. If I enlarge the window, the drawing is clipped to the size of the window before enlarging. there is a test program #include #include int main() { // Open the display ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Enlarging a window produces clipping

  1. Enlarging a window produces clipping

    Hello,
    I am studying X, and confused some problems. If I enlarge the
    window, the drawing is clipped to the size of the window before
    enlarging. there is a test program

    #include
    #include

    int main()
    {
    // Open the display
    Display *dpy = XOpenDisplay(NIL);
    Window desktop = DefaultRootWindow(dpy);

    // Get some colors
    int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));

    // Create the window
    hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    10, 10, 300, 200, 0,0,
    whiteColor);

    XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    ExposureMask| ResizeRedirectMask); //POINT A

    XMapWindow(dpy, wnd);

    XFlush(dpy);

    XEvent event;
    while(true)
    {
    XNextEvent(dpy, &event);
    switch(event.type)
    {
    case ButtonPress:
    std::cout<<"button clicked"< }
    }
    }

    the code shows when a mouse clicked on the window, it prints "button
    clicked" in terminal. but after enlarging the window, the event just
    effects the original rectangle before enlarging, if a mouse clicked on
    the new rectangle, "button clicked" is not printed in terminal.

    at the comment POINT A, if i modify the line to
    XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    ExposureMask);
    the window is allright. please show me a solution on the problem.

    thanks in advance


  2. Re: Enlarging a window produces clipping


    "Jinhao" wrote in message
    news:1156161243.017188.33340@i42g2000cwa.googlegro ups.com...
    > Hello,
    > I am studying X, and confused some problems. If I enlarge the
    > window, the drawing is clipped to the size of the window before
    > enlarging. there is a test program
    >
    > #include
    > #include
    >
    > int main()
    > {
    > // Open the display
    > Display *dpy = XOpenDisplay(NIL);
    > Window desktop = DefaultRootWindow(dpy);
    >
    > // Get some colors
    > int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
    >
    > // Create the window
    > hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    > 10, 10, 300, 200, 0,0,
    > whiteColor);
    >
    > XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    > ExposureMask| ResizeRedirectMask); //POINT A
    >
    > XMapWindow(dpy, wnd);
    >
    > XFlush(dpy);
    >
    > XEvent event;
    > while(true)
    > {
    > XNextEvent(dpy, &event);
    > switch(event.type)
    > {
    > case ButtonPress:
    > std::cout<<"button clicked"< > }
    > }
    > }
    >
    > the code shows when a mouse clicked on the window, it prints "button
    > clicked" in terminal. but after enlarging the window, the event just
    > effects the original rectangle before enlarging, if a mouse clicked on
    > the new rectangle, "button clicked" is not printed in terminal.
    >
    > at the comment POINT A, if i modify the line to
    > XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    > ExposureMask);
    > the window is allright. please show me a solution on the problem.
    >
    > thanks in advance
    >


    I do not understand what the problem is. It sounds like you already
    solved it by removing the ResizeRedirectMask.

    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project



  3. Re: Enlarging a window produces clipping


    > I do not understand what the problem is. It sounds like you already
    > solved it by removing the ResizeRedirectMask.


    If I remove the ResizeRedirectMask, I would not get the resize event
    from ::XNextEvent anymore. I want to process the Resize event, and the
    window does not to be clipped..


  4. Re: Enlarging a window produces clipping

    Please do not remove the context of the thread when replying.
    I have replaced it...

    "Jinhao" wrote in message
    news:1156176344.673353.286720@m79g2000cwm.googlegr oups.com...
    > Hello,
    > I am studying X, and confused some problems. If I enlarge the
    > window, the drawing is clipped to the size of the window before
    > enlarging. there is a test program
    >
    > #include
    > #include
    >
    > int main()
    > {
    > // Open the display
    > Display *dpy = XOpenDisplay(NIL);
    > Window desktop = DefaultRootWindow(dpy);
    >
    > // Get some colors
    > int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
    >
    > // Create the window
    > hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    > 10, 10, 300, 200, 0,0,
    > whiteColor);
    >
    > XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    > ExposureMask| ResizeRedirectMask); //POINT A
    >
    > XMapWindow(dpy, wnd);
    >
    > XFlush(dpy);
    >
    > XEvent event;
    > while(true)
    > {
    > XNextEvent(dpy, &event);
    > switch(event.type)
    > {
    > case ButtonPress:
    > std::cout<<"button clicked"< > }
    > }
    > }
    >
    > the code shows when a mouse clicked on the window, it prints "button
    > clicked" in terminal. but after enlarging the window, the event just
    > effects the original rectangle before enlarging, if a mouse clicked on
    > the new rectangle, "button clicked" is not printed in terminal.
    >
    > at the comment POINT A, if i modify the line to
    > XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    > ExposureMask);
    > the window is allright. please show me a solution on the problem.
    >
    > thanks in advance
    >
    >> I do not understand what the problem is. It sounds like you already
    >> solved it by removing the ResizeRedirectMask.
    >> FLK

    >
    > If I remove the ResizeRedirectMask, I would not get the resize event
    > from ::XNextEvent anymore. I want to process the Resize event, and the
    > window does not to be clipped..
    >


    If you WANT the window to be resized when the user drags a corner,
    do NOT select on ResizeRedirectMask; select on SubstructureNotifyMask
    instead.
    (You don't have to do anything for the events it generates).

    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project




  5. Re: Enlarging a window produces clipping

    In comp.windows.x, Fred Kleinschmidt

    wrote
    on Mon, 21 Aug 2006 18:53:51 GMT
    :
    > Please do not remove the context of the thread when replying.
    > I have replaced it...
    >
    > "Jinhao" wrote in message
    > news:1156176344.673353.286720@m79g2000cwm.googlegr oups.com...
    >> Hello,
    >> I am studying X, and confused some problems. If I enlarge the
    >> window, the drawing is clipped to the size of the window before
    >> enlarging. there is a test program
    >>
    >> #include
    >> #include
    >>
    >> int main()
    >> {
    >> // Open the display
    >> Display *dpy = XOpenDisplay(NIL);
    >> Window desktop = DefaultRootWindow(dpy);
    >>
    >> // Get some colors
    >> int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
    >>
    >> // Create the window
    >> hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    >> 10, 10, 300, 200, 0,0,
    >> whiteColor);
    >>
    >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >> ExposureMask| ResizeRedirectMask); //POINT A
    >>
    >> XMapWindow(dpy, wnd);
    >>
    >> XFlush(dpy);
    >>
    >> XEvent event;
    >> while(true)
    >> {
    >> XNextEvent(dpy, &event);
    >> switch(event.type)
    >> {
    >> case ButtonPress:
    >> std::cout<<"button clicked"< >> }
    >> }
    >> }
    >>
    >> the code shows when a mouse clicked on the window, it prints "button
    >> clicked" in terminal. but after enlarging the window, the event just
    >> effects the original rectangle before enlarging, if a mouse clicked on
    >> the new rectangle, "button clicked" is not printed in terminal.
    >>
    >> at the comment POINT A, if i modify the line to
    >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >> ExposureMask);
    >> the window is allright. please show me a solution on the problem.
    >>
    >> thanks in advance
    >>
    >>> I do not understand what the problem is. It sounds like you already
    >>> solved it by removing the ResizeRedirectMask.
    >>> FLK

    >>
    >> If I remove the ResizeRedirectMask, I would not get the resize event
    >> from ::XNextEvent anymore. I want to process the Resize event, and the
    >> window does not to be clipped..
    >>

    >
    > If you WANT the window to be resized when the user drags a corner,
    > do NOT select on ResizeRedirectMask; select on SubstructureNotifyMask
    > instead.
    > (You don't have to do anything for the events it generates).
    >


    Even that is unnecessary; the window will resize regardless. Of
    course one might not know the size thereof.

    A more relevant mask is probably StructureNotifyMask;
    SubstructureNotifyMask gives information regarding the
    structure (resizing, mostly) of a window's *children*,
    and possibly the window as well, but it's overkill
    AFAICT. (The .window field of the XConfigureEvent
    (ev.xconfigure) is set to the resized window in the case
    of a StructureNotifyMask, and its parent if one uses
    SubstructureNotifyMask.)

    --
    #191, ewill3@earthlink.net
    Windows Vista. Because it's time to refresh your hardware. Trust us.

  6. Re: Enlarging a window produces clipping


    The Ghost In The Machine wrote:
    > In comp.windows.x, Fred Kleinschmidt
    >
    > wrote
    > on Mon, 21 Aug 2006 18:53:51 GMT
    > :
    > > Please do not remove the context of the thread when replying.
    > > I have replaced it...
    > >
    > > "Jinhao" wrote in message
    > > news:1156176344.673353.286720@m79g2000cwm.googlegr oups.com...
    > >> Hello,
    > >> I am studying X, and confused some problems. If I enlarge the
    > >> window, the drawing is clipped to the size of the window before
    > >> enlarging. there is a test program
    > >>
    > >> #include
    > >> #include
    > >>
    > >> int main()
    > >> {
    > >> // Open the display
    > >> Display *dpy = XOpenDisplay(NIL);
    > >> Window desktop = DefaultRootWindow(dpy);
    > >>
    > >> // Get some colors
    > >> int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
    > >>
    > >> // Create the window
    > >> hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    > >> 10, 10, 300, 200, 0,0,
    > >> whiteColor);
    > >>
    > >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    > >> ExposureMask| ResizeRedirectMask); //POINT A
    > >>
    > >> XMapWindow(dpy, wnd);
    > >>
    > >> XFlush(dpy);
    > >>
    > >> XEvent event;
    > >> while(true)
    > >> {
    > >> XNextEvent(dpy, &event);
    > >> switch(event.type)
    > >> {
    > >> case ButtonPress:
    > >> std::cout<<"button clicked"< > >> }
    > >> }
    > >> }
    > >>
    > >> the code shows when a mouse clicked on the window, it prints "button
    > >> clicked" in terminal. but after enlarging the window, the event just
    > >> effects the original rectangle before enlarging, if a mouse clicked on
    > >> the new rectangle, "button clicked" is not printed in terminal.
    > >>
    > >> at the comment POINT A, if i modify the line to
    > >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    > >> ExposureMask);
    > >> the window is allright. please show me a solution on the problem.
    > >>
    > >> thanks in advance
    > >>
    > >>> I do not understand what the problem is. It sounds like you already
    > >>> solved it by removing the ResizeRedirectMask.
    > >>> FLK
    > >>
    > >> If I remove the ResizeRedirectMask, I would not get the resize event
    > >> from ::XNextEvent anymore. I want to process the Resize event, and the
    > >> window does not to be clipped..
    > >>

    > >
    > > If you WANT the window to be resized when the user drags a corner,
    > > do NOT select on ResizeRedirectMask; select on SubstructureNotifyMask
    > > instead.
    > > (You don't have to do anything for the events it generates).
    > >

    >
    > Even that is unnecessary; the window will resize regardless. Of
    > course one might not know the size thereof.
    >
    > A more relevant mask is probably StructureNotifyMask;
    > SubstructureNotifyMask gives information regarding the
    > structure (resizing, mostly) of a window's *children*,
    > and possibly the window as well, but it's overkill
    > AFAICT. (The .window field of the XConfigureEvent
    > (ev.xconfigure) is set to the resized window in the case
    > of a StructureNotifyMask, and its parent if one uses
    > SubstructureNotifyMask.)
    >
    > --
    > #191, ewill3@earthlink.net
    > Windows Vista. Because it's time to refresh your hardware. Trust us.


    please, could you show some codes to explain this?


  7. Re: Enlarging a window produces clipping


    "The Ghost In The Machine" wrote in message
    news:ckbqr3-s07.ln1@sirius.tg00suus7038.net...
    > In comp.windows.x, Fred Kleinschmidt
    >
    > wrote
    > on Mon, 21 Aug 2006 18:53:51 GMT
    > :
    >> Please do not remove the context of the thread when replying.
    >> I have replaced it...
    >>
    >> "Jinhao" wrote in message
    >> news:1156176344.673353.286720@m79g2000cwm.googlegr oups.com...
    >>> Hello,
    >>> I am studying X, and confused some problems. If I enlarge the
    >>> window, the drawing is clipped to the size of the window before
    >>> enlarging. there is a test program
    >>>
    >>> #include
    >>> #include
    >>>
    >>> int main()
    >>> {
    >>> // Open the display
    >>> Display *dpy = XOpenDisplay(NIL);
    >>> Window desktop = DefaultRootWindow(dpy);
    >>>
    >>> // Get some colors
    >>> int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
    >>>
    >>> // Create the window
    >>> hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    >>> 10, 10, 300, 200, 0,0,
    >>> whiteColor);
    >>>
    >>> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >>> ExposureMask| ResizeRedirectMask); //POINT A
    >>>
    >>> XMapWindow(dpy, wnd);
    >>>
    >>> XFlush(dpy);
    >>>
    >>> XEvent event;
    >>> while(true)
    >>> {
    >>> XNextEvent(dpy, &event);
    >>> switch(event.type)
    >>> {
    >>> case ButtonPress:
    >>> std::cout<<"button clicked"< >>> }
    >>> }
    >>> }
    >>>
    >>> the code shows when a mouse clicked on the window, it prints "button
    >>> clicked" in terminal. but after enlarging the window, the event just
    >>> effects the original rectangle before enlarging, if a mouse clicked on
    >>> the new rectangle, "button clicked" is not printed in terminal.
    >>>
    >>> at the comment POINT A, if i modify the line to
    >>> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >>> ExposureMask);
    >>> the window is allright. please show me a solution on the problem.
    >>>
    >>> thanks in advance
    >>>
    >>>> I do not understand what the problem is. It sounds like you already
    >>>> solved it by removing the ResizeRedirectMask.
    >>>> FLK
    >>>
    >>> If I remove the ResizeRedirectMask, I would not get the resize event
    >>> from ::XNextEvent anymore. I want to process the Resize event, and the
    >>> window does not to be clipped..
    >>>

    >>
    >> If you WANT the window to be resized when the user drags a corner,
    >> do NOT select on ResizeRedirectMask; select on SubstructureNotifyMask
    >> instead.
    >> (You don't have to do anything for the events it generates).
    >>

    >
    > Even that is unnecessary; the window will resize regardless. Of
    > course one might not know the size thereof.
    >
    > A more relevant mask is probably StructureNotifyMask;
    > SubstructureNotifyMask gives information regarding the
    > structure (resizing, mostly) of a window's *children*,
    > and possibly the window as well, but it's overkill
    > AFAICT. (The .window field of the XConfigureEvent
    > (ev.xconfigure) is set to the resized window in the case
    > of a StructureNotifyMask, and its parent if one uses
    > SubstructureNotifyMask.)
    >
    > --
    > #191, ewill3@earthlink.net
    > Windows Vista. Because it's time to refresh your hardware. Trust us.


    The OP did originally include StructureNotifyMask.

    He wants to be notified when the wiondow changes size.
    He should not include a ResizeRedirectmask to do this.
    He should instead monitor ConfigureNotify and/or Expose events.
    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project



  8. Re: Enlarging a window produces clipping


    "Jinhao" wrote in message
    news:1156258846.769197.142410@i3g2000cwc.googlegro ups.com...
    >
    > The Ghost In The Machine wrote:
    >> In comp.windows.x, Fred Kleinschmidt
    >>
    >> wrote
    >> on Mon, 21 Aug 2006 18:53:51 GMT
    >> :
    >> > Please do not remove the context of the thread when replying.
    >> > I have replaced it...
    >> >
    >> > "Jinhao" wrote in message
    >> > news:1156176344.673353.286720@m79g2000cwm.googlegr oups.com...
    >> >> Hello,
    >> >> I am studying X, and confused some problems. If I enlarge the
    >> >> window, the drawing is clipped to the size of the window before
    >> >> enlarging. there is a test program
    >> >>
    >> >> #include
    >> >> #include
    >> >>
    >> >> int main()
    >> >> {
    >> >> // Open the display
    >> >> Display *dpy = XOpenDisplay(NIL);
    >> >> Window desktop = DefaultRootWindow(dpy);
    >> >>
    >> >> // Get some colors
    >> >> int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
    >> >>
    >> >> // Create the window
    >> >> hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    >> >> 10, 10, 300, 200, 0,0,
    >> >> whiteColor);
    >> >>
    >> >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >> >> ExposureMask| ResizeRedirectMask); //POINT A
    >> >>
    >> >> XMapWindow(dpy, wnd);
    >> >>
    >> >> XFlush(dpy);
    >> >>
    >> >> XEvent event;
    >> >> while(true)
    >> >> {
    >> >> XNextEvent(dpy, &event);
    >> >> switch(event.type)
    >> >> {
    >> >> case ButtonPress:
    >> >> std::cout<<"button clicked"< >> >> }
    >> >> }
    >> >> }
    >> >>
    >> >> the code shows when a mouse clicked on the window, it prints "button
    >> >> clicked" in terminal. but after enlarging the window, the event just
    >> >> effects the original rectangle before enlarging, if a mouse clicked on
    >> >> the new rectangle, "button clicked" is not printed in terminal.
    >> >>
    >> >> at the comment POINT A, if i modify the line to
    >> >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >> >> ExposureMask);
    >> >> the window is allright. please show me a solution on the problem.
    >> >>
    >> >> thanks in advance
    >> >>
    >> >>> I do not understand what the problem is. It sounds like you already
    >> >>> solved it by removing the ResizeRedirectMask.
    >> >>> FLK
    >> >>
    >> >> If I remove the ResizeRedirectMask, I would not get the resize event
    >> >> from ::XNextEvent anymore. I want to process the Resize event, and the
    >> >> window does not to be clipped..
    >> >>
    >> >
    >> > If you WANT the window to be resized when the user drags a corner,
    >> > do NOT select on ResizeRedirectMask; select on SubstructureNotifyMask
    >> > instead.
    >> > (You don't have to do anything for the events it generates).
    >> >

    >>
    >> Even that is unnecessary; the window will resize regardless. Of
    >> course one might not know the size thereof.
    >>
    >> A more relevant mask is probably StructureNotifyMask;
    >> SubstructureNotifyMask gives information regarding the
    >> structure (resizing, mostly) of a window's *children*,
    >> and possibly the window as well, but it's overkill
    >> AFAICT. (The .window field of the XConfigureEvent
    >> (ev.xconfigure) is set to the resized window in the case
    >> of a StructureNotifyMask, and its parent if one uses
    >> SubstructureNotifyMask.)
    >>
    >> --
    >> #191, ewill3@earthlink.net
    >> Windows Vista. Because it's time to refresh your hardware. Trust us.

    >
    > please, could you show some codes to explain this?
    >


    Look at the values of event.xexpose.width and event.xexpose.height
    when the event type is Expose.
    Also check event.xconfigure.width (and height) for ConfigureNotify events.
    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project



  9. Re: Enlarging a window produces clipping

    In comp.windows.x, Jinhao

    wrote
    on 22 Aug 2006 08:00:46 -0700
    <1156258846.769197.142410@i3g2000cwc.googlegroups.c om>:
    >
    > The Ghost In The Machine wrote:
    >> In comp.windows.x, Fred Kleinschmidt
    >>
    >> wrote
    >> on Mon, 21 Aug 2006 18:53:51 GMT
    >> :
    >> > Please do not remove the context of the thread when replying.
    >> > I have replaced it...
    >> >
    >> > "Jinhao" wrote in message
    >> > news:1156176344.673353.286720@m79g2000cwm.googlegr oups.com...
    >> >> Hello,
    >> >> I am studying X, and confused some problems. If I enlarge the
    >> >> window, the drawing is clipped to the size of the window before
    >> >> enlarging. there is a test program
    >> >>
    >> >> #include
    >> >> #include
    >> >>
    >> >> int main()
    >> >> {
    >> >> // Open the display
    >> >> Display *dpy = XOpenDisplay(NIL);
    >> >> Window desktop = DefaultRootWindow(dpy);
    >> >>
    >> >> // Get some colors
    >> >> int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
    >> >>
    >> >> // Create the window
    >> >> hwnd_t wnd = XCreateSimpleWindow(dpy, desktop,
    >> >> 10, 10, 300, 200, 0,0,
    >> >> whiteColor);
    >> >>
    >> >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >> >> ExposureMask| ResizeRedirectMask); //POINT A
    >> >>
    >> >> XMapWindow(dpy, wnd);
    >> >>
    >> >> XFlush(dpy);
    >> >>
    >> >> XEvent event;
    >> >> while(true)
    >> >> {
    >> >> XNextEvent(dpy, &event);
    >> >> switch(event.type)
    >> >> {
    >> >> case ButtonPress:
    >> >> std::cout<<"button clicked"< >> >> }
    >> >> }
    >> >> }
    >> >>
    >> >> the code shows when a mouse clicked on the window, it prints "button
    >> >> clicked" in terminal. but after enlarging the window, the event just
    >> >> effects the original rectangle before enlarging, if a mouse clicked on
    >> >> the new rectangle, "button clicked" is not printed in terminal.
    >> >>
    >> >> at the comment POINT A, if i modify the line to
    >> >> XSelectInput(dpy, wnd, StructureNotifyMask | ButtonPressMask |
    >> >> ExposureMask);
    >> >> the window is allright. please show me a solution on the problem.
    >> >>
    >> >> thanks in advance
    >> >>
    >> >>> I do not understand what the problem is. It sounds like you already
    >> >>> solved it by removing the ResizeRedirectMask.
    >> >>> FLK
    >> >>
    >> >> If I remove the ResizeRedirectMask, I would not get the resize event
    >> >> from ::XNextEvent anymore. I want to process the Resize event, and the
    >> >> window does not to be clipped..
    >> >>
    >> >
    >> > If you WANT the window to be resized when the user drags a corner,
    >> > do NOT select on ResizeRedirectMask; select on SubstructureNotifyMask
    >> > instead.
    >> > (You don't have to do anything for the events it generates).
    >> >

    >>
    >> Even that is unnecessary; the window will resize regardless. Of
    >> course one might not know the size thereof.
    >>
    >> A more relevant mask is probably StructureNotifyMask;
    >> SubstructureNotifyMask gives information regarding the
    >> structure (resizing, mostly) of a window's *children*,
    >> and possibly the window as well, but it's overkill
    >> AFAICT. (The .window field of the XConfigureEvent
    >> (ev.xconfigure) is set to the resized window in the case
    >> of a StructureNotifyMask, and its parent if one uses
    >> SubstructureNotifyMask.)
    >>
    >> --
    >> #191, ewill3@earthlink.net
    >> Windows Vista. Because it's time to refresh your hardware. Trust us.

    >
    > please, could you show some codes to explain this?
    >


    Hm. I'll have to get back to you on that; ideally I'd
    create a test client with two or three windows and allow
    for moving/resizing. The best I can do is some windows
    with text, at this level (at a widget level it gets a
    little nicer).

    I can write a program but it's already 270 lines,
    so I'll have to post it on my Website or something.
    I can, however, show part of its output, which might
    be of some help to understanding:

    created and mapped window 0x3200001
    ev(0x3200001): configure (0x3200001,0,0,800,800)
    ev(0x3200001): unknown21
    ev(0x3200001): configure (0x3200001,5,24,800,800)
    ev(0x3200001): map (0x3200001)
    ev(0x3200001): expose (0x3200001,0,0,800,800) 0

    The ev(0x3200001) is a hex printout of ev.xany.window.
    It turns out 21 is ReparentNotify and is an artifact of my
    window manager; many window managers "decorate" windows
    by slipping a window between the original window and the
    root in the hierarchy, and then drawing to that window.
    (One can use XQueryTree if one wants to see this but the
    output could get a little voluminous.)

    I now press 'c', to create a new subwindow, and get:

    ev(0x3200001): key (0x3200001,600,373) 99
    ev(0x3200001): create (0x3200004)
    ev(0x3200004): map (0x3200004)
    ev(0x3200001): map (0x3200004)
    ev(0x3200004): expose (0x3200004,0,0,200,200) 0

    Notice the two map events. The first is on the window
    itself, and tells the event loop somebody mapped it.
    (This shouldn't surprise anybody, since my creation code
    also maps the window using XMapWindow(). Otherwise,
    the window is effectively invisible.)

    This event is because of the StructureNotifyMask in XSelectInput().

    Note that only the parent gets a create event(); sending
    a create event to a window whose handle one already has
    (it's returned by XCreateWindow() or XCreateSimpleWindow())
    is slightly redundant.

    The *second* one is slightly different. The parent window
    is receiving the event on behalf of the child. That's because
    of the SubstructureNotifyMask. A bit subtle but can be
    useful for those widgets which need to keep track of their kids.

    Destroying a window is similar.

    ev(0x3200004): key (0x3200004,112,117) 100
    ev(0x3200004): map (0x3200004)
    ev(0x3200001): map (0x3200004)
    ev(0x3200001): expose (0x3200001,100,100,202,202) 0
    ev(0x3200004): destroy (0x3200004)
    ev(0x3200001): destroy (0x3200004)

    I'm a little puzzled as to the map events (I just destroy
    the window) but the destroy is showing clearly that both
    child window and parent window are receiving notification
    that a window is now no more.

    Notice also the expose event to the big window. Obviously
    it has to redraw that part which is now visible; since
    the window had a border of 1 (so that one can actually see
    the border) its width is 2 bigger than originally specified.

    HTH

    --
    #191, ewill3@earthlink.net
    Windows Vista. Because it's time to refresh your hardware. Trust us.

+ Reply to Thread