• proper way to get Shell widget resized calls?

    From Winston@21:1/5 to All on Sun Jul 13 18:07:09 2025
    CoreClassPart contains (XtWidgetProc)resize.

    If I were to create my own widget, I could easily specify a Resize()
    function to call simply by static assignment to the compiled value of my widget's ClassRec.

    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?

    Outright setting (application)ShellClassRec.CoreClassPart.resize looks
    like a bad idea: it's initially non-NULL by the time I'd consider
    setting it and may do useful stuff I wouldn't want to skip by preempting
    it with my Resize function. I haven't investigated what XawVendorShellExtResize does, though (but my application has no vendor extensions of its own). If nothing useful in my specific case, then
    maybe preempting it isn't a problem, but doing so strikes me as very
    likely the wrong answer given the way X normally works. :)

    Thanks in advance,
    -WBE

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Winston on Mon Jul 14 22:08:20 2025
    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 “window” and a “widget”. 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 can’t would be down to limitations of your GUI toolkit, not X11 itself.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Winston@21:1/5 to I originally on Tue Jul 15 00:34:46 2025
    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 <[email protected]d> kindly replied:
    At the lowest level, there is no fundamental distinction in X11 between a ��window�� and a ��widget��. 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 can��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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Winston@21:1/5 to All on Tue Jul 15 02:19:48 2025
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Winston on Wed Jul 16 07:11:07 2025
    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 <[email protected]d> kindly replied:

    At the lowest level, there is no fundamental distinction in X11
    between a “window” and a “widget”. 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 can’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.

    It shouldn’t be up to the window manager to control what happens
    within a window.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Winston@21:1/5 to I originally on Sat Aug 2 10:38:27 2025
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Winston@21:1/5 to I originally on Mon Aug 4 13:09:59 2025
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Winston@21:1/5 to All on Mon Aug 4 15:46:59 2025
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)