• Re: proper way to get Shell widget resized calls?

    From Lawrence D'Oliveiro@ldo@nz.invalid to comp.windows.x on Mon Jul 14 22:08:20 2025
    From Newsgroup: comp.windows.x

    On Sun, 13 Jul 2025 18:07:09 -0400, Winston wrote:

    However, I'd like to have a Resize function that gets called when the application window resizes, without having to create a widget just to
    have Resize() called.

    At the lowest level, there is no fundamental distinction in X11 between a rCLwindowrCY and a rCLwidgetrCY. So if you can attach a handler for a particular
    message to one, you should be able to do the same to the other. Any reason
    why you canrCOt would be down to limitations of your GUI toolkit, not X11 itself.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Winston@wbe@UBEBLOCK.psr.com.invalid to comp.windows.x on Tue Jul 15 00:34:46 2025
    From Newsgroup: comp.windows.x

    I originally asked:
    However, I'd like to have a Resize function that gets called when the
    application window resizes, without having to create a widget just to
    have Resize() called.

    to which Lawrence D'Oliveiro <ldo@nz.invalid> kindly replied:
    At the lowest level, there is no fundamental distinction in X11 between a i#windowi# and a i#widgeti#. So if you can attach a handler for a particular message to one, you should be able to do the same to the other. Any reason why you cani>t would be down to limitations of your GUI toolkit, not X11 itself.

    Ah, I wasn't careful enough in my wording: I was using "window" in the
    window manager sense, not in the X11 Widget+Window object sense.

    Again, I'd like to get notifications (in the generic sense, not
    necessarily the strict X11 sense) of resize changes to the application's
    Shell widget without having to create another widget just to have a ClassRec->resize function that I can set. ISTM that something akin to

    XtAddCallback (shellwidget, XtNresize, myfunc, cldata)

    [but it's not clear that would work: myfunc would need to be an
    (XtCallbackProc), not an (XtWidgetProc) which the resize function
    normally is; I can adapt myfunc easily enough, but the X11 code that
    calls the resize function expects an (XtWidgetProc) [1 argument] and
    might not like an (XtCallbackProc) [3 arguments]]

    or that adding myfunc to some *_hook list would be the "X11 way" rather
    than just setting

    applicationShellClassRec.CoreClassPart.resize = myfunction

    eliminating the function call that's already there.

    Or I may be confused ...
    -WBE
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Winston@wbe@UBEBLOCK.psr.com.invalid to comp.windows.x on Tue Jul 15 02:19:48 2025
    From Newsgroup: comp.windows.x

    I previously posted:
    XtAddCallback (shellwidget, XtNresize, myfunc, cldata)

    Just for the heck of it, I tried this. Unsurprisingly, it didn't work.
    The XtAddCallback issued a warning printf of the form: couldn't find
    named callback list. [I didn't save the exact message.]
    -WBE
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.windows.x on Wed Jul 16 07:11:07 2025
    From Newsgroup: comp.windows.x

    On Tue, 15 Jul 2025 00:34:46 -0400, Winston wrote:

    I originally asked:

    However, I'd like to have a Resize function that gets called when
    the application window resizes, without having to create a widget
    just to have Resize() called.

    to which Lawrence D'Oliveiro <ldo@nz.invalid> kindly replied:

    At the lowest level, there is no fundamental distinction in X11
    between a rCLwindowrCY and a rCLwidgetrCY. So if you can attach a handler
    for a particular message to one, you should be able to do the same
    to the other. Any reason why you canrCOt would be down to limitations
    of your GUI toolkit, not X11 itself.

    Ah, I wasn't careful enough in my wording: I was using "window" in
    the window manager sense, not in the X11 Widget+Window object sense.

    It shouldnrCOt be up to the window manager to control what happens
    within a window.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Winston@wbe@UBEBLOCK.psr.com.invalid to comp.windows.x on Sat Aug 2 10:38:27 2025
    From Newsgroup: comp.windows.x

    I originally asked (in part):
    However, I'd like to have a Resize function that gets called when the application window resizes, without having to create a widget just to
    have Resize() called.

    What's a proper way to do that?

    Found it: one good way is by adding a "<ResizeRequest>: action()" X11 translation. The XtActionProc is passed the (XResizeRequestEvent*) with
    the new width and height as the (XEvent*) argument.
    -WBE
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Winston@wbe@UBEBLOCK.psr.com.invalid to comp.windows.x on Mon Aug 4 13:09:59 2025
    From Newsgroup: comp.windows.x

    I originally asked (in part):
    However, I'd like to have a Resize function that gets called when the
    application window resizes, without having to create a widget just to
    have Resize() called.

    What's a proper way to do that?

    A bit later, I answered:
    Found it: one good way is by adding a "<ResizeRequest>: action()" X11 translation. The XtActionProc is passed the (XResizeRequestEvent*) with
    the new width and height as the (XEvent*) argument.

    A better way is to use <ConfigureNotify> instead of <ResizeRequest>.

    ResizeRequest appears to be *instead of* the regular resize action.
    Also, the ResizeRequest action observably gets called when the window is
    merely moved on the desktop, even when the window's size hasn't changed.

    By contrast, with ConfigureNotify the regular resize code is still run
    and the translation action is called when the width or height changes,
    but not when the window is just moved.
    -WBE
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Winston@wbe@UBEBLOCK.psr.com.invalid to comp.windows.x on Mon Aug 4 15:46:59 2025
    From Newsgroup: comp.windows.x

    A few minutes ago, I posted:
    By contrast, with ConfigureNotify the regular resize code is still run
    and the translation action is called when the width or height changes,
    but not when the window is just moved.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Oops. That last part is incorrect. My initial testing wasn't testing
    what I thought it was. ConfigureNotify does, indeed, call the action
    proc when the window is just moved. My apologies for the error.
    -WBE
    --- Synchronet 3.21a-Linux NewsLink 1.2