Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.windows.x > #593 > unrolled thread

proper way to get Shell widget resized calls?

Started byWinston <wbe@UBEBLOCK.psr.com.invalid>
First post2025-07-13 18:07 -0400
Last post2025-08-04 15:46 -0400
Articles 8 — 2 participants

Back to article view | Back to comp.windows.x


Contents

  proper way to get Shell widget resized calls? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2025-07-13 18:07 -0400
    Re: proper way to get Shell widget resized calls? Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-14 22:08 +0000
      Re: proper way to get Shell widget resized calls? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2025-07-15 00:34 -0400
        Re: proper way to get Shell widget resized calls? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2025-07-15 02:19 -0400
        Re: proper way to get Shell widget resized calls? Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-16 07:11 +0000
    Re: proper way to get Shell widget resized calls? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2025-08-02 10:38 -0400
      Re: proper way to get Shell widget resized calls? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2025-08-04 13:09 -0400
        Re: proper way to get Shell widget resized calls? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2025-08-04 15:46 -0400

#593 — proper way to get Shell widget resized calls?

FromWinston <wbe@UBEBLOCK.psr.com.invalid>
Date2025-07-13 18:07 -0400
Subjectproper way to get Shell widget resized calls?
Message-ID<yd8qkrwxrm.fsf@UBEblock.psr.com>
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

[toc] | [next] | [standalone]


#594

FromLawrence D'Oliveiro <ldo@nz.invalid>
Date2025-07-14 22:08 +0000
Message-ID<1053v4k$3kipi$7@dont-email.me>
In reply to#593
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.

[toc] | [prev] | [next] | [standalone]


#595

FromWinston <wbe@UBEBLOCK.psr.com.invalid>
Date2025-07-15 00:34 -0400
Message-ID<yd4ivevzq1.fsf@UBEblock.psr.com>
In reply to#594
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 
> “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

[toc] | [prev] | [next] | [standalone]


#596

FromWinston <wbe@UBEBLOCK.psr.com.invalid>
Date2025-07-15 02:19 -0400
Message-ID<ydzfd6ugaj.fsf@UBEblock.psr.com>
In reply to#595
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

[toc] | [prev] | [next] | [standalone]


#597

FromLawrence D'Oliveiro <ldo@nz.invalid>
Date2025-07-16 07:11 +0000
Message-ID<1057jab$jsvg$2@dont-email.me>
In reply to#595
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 “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.

[toc] | [prev] | [next] | [standalone]


#598

FromWinston <wbe@UBEBLOCK.psr.com.invalid>
Date2025-08-02 10:38 -0400
Message-ID<ydqzxtvlek.fsf@UBEblock.psr.com>
In reply to#593
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

[toc] | [prev] | [next] | [standalone]


#599

FromWinston <wbe@UBEBLOCK.psr.com.invalid>
Date2025-08-04 13:09 -0400
Message-ID<ydms8fui6w.fsf@UBEblock.psr.com>
In reply to#598
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

[toc] | [prev] | [next] | [standalone]


#600

FromWinston <wbe@UBEBLOCK.psr.com.invalid>
Date2025-08-04 15:46 -0400
Message-ID<ydikj2vpho.fsf@UBEblock.psr.com>
In reply to#599
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.windows.x


csiph-web