Window resizing event

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Window resizing event

peprio
I'm trying to capture the resize event of a XUL window... the problem
is that I've no idea of what event should I capture in order to know
what's the current window size while resizing. I'm already using the
"resize" event, but it's only fired when the user has finished resizing
the window, not while it's resizing it. I tried to capture the
"DOMAttrModified" event on the window element, to see if I can get a
modification of the "width" and "height" attributes, but doesn't seems
to work either...

Is there any way of getting the XUL window width and height while being
resized?

Thanks!
Josep del Rio

_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Window resizing event

Boris Zbarsky
[hidden email] wrote:
> I'm trying to capture the resize event of a XUL window... the problem
> is that I've no idea of what event should I capture in order to know
> what's the current window size while resizing.

There are no events fired until the resize is finished.

> Is there any way of getting the XUL window width and height while being
> resized?

Not really, as far as I know.

-Boris
_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Window resizing event

peprio
Thanks for the answer... anyways, I see the content of the browser
window dinamically resized... this is because the XUL widgets handle
the resizing themselves without firing any events?

_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Window resizing event

Boris Zbarsky
[hidden email] wrote:
> Thanks for the answer... anyways, I see the content of the browser
> window dinamically resized... this is because the XUL widgets handle
> the resizing themselves without firing any events?

Correct -- reflows just happen.

-Boris
_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Window resizing event

mig@songbirdnest.com
Speaking of, I'll bet you a dime and a half that the reason pep wants
events during window resizing is because the Win32 resizer elements
don't respect the min-width and min-height values on a window element.
And if the box model wants to make a reflow "just happen" that causes
the min-width to grow larger than the current window size, the internal
box just happily grows itself to be larger than the OS window and a
bunch of my UI gets clipped off the left hand side.

So, is there any way to prevent the kind of "it just happens" that just
happens to mess up the user experience at the same time?  In win32
land, these constraints are usually implemented by responding to the
WM_GETMINMAXINFO message that the OS sends right before a window's size
changes.

Either that, or I missed an extra magic attribute somewhere that tells
the OS and the top box they need to stay in sync with each other's
min/max values.

mig

_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Window resizing event

harry-6
In reply to this post by peprio
[hidden email] wrote:

> I'm trying to capture the resize event of a XUL window... the problem
> is that I've no idea of what event should I capture in order to know
> what's the current window size while resizing. I'm already using the
> "resize" event, but it's only fired when the user has finished resizing
> the window, not while it's resizing it. I tried to capture the
> "DOMAttrModified" event on the window element, to see if I can get a
> modification of the "width" and "height" attributes, but doesn't seems
> to work either...
>
> Is there any way of getting the XUL window width and height while being
> resized?
>
> Thanks!
> Josep del Rio
>

Well, try setInterval or setTimeout and check these:
innerWidth, outerWidth, innerHeight, outerHeight

Just an idea. Works with the 'top' window... good luck.

If mousedown/up/move events are raised during move that would be an
improvement.

Harry
_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Window resizing event

Thomas Fischer
In reply to this post by mig@songbirdnest.com
[hidden email] wrote:
> So, is there any way to prevent the kind of "it just happens" that
> just happens to mess up the user experience at the same time?  In
> win32 land, these constraints are usually implemented by responding
> to the WM_GETMINMAXINFO message that the OS sends right before a
> window's size changes.

polling workarround:

watchWinSize = function(){
 this.lastWinSize = this.lastWinSize || {
  outerWidth : this.outerWidth,
  outerHeight : this.outerHeight
 };
 if(
  this.lastWinSize.outerWidth != this.outerWidth
  ||
  this.lastWinSize.outerHeight != this.outerHeight
 ) {
  this.lastWinSize = {
   outerWidth : this.outerWidth,
   outerHeight : this.outerHeight
  };
  // call here your onresizeHandler
  document.getElementById("DUMP").value += "r "
  ;
 }
 setTimeout(arguments.callee, 0);
};
window.onresize = function(){
 document.getElementById("DUMP").value += "R ";
};
watchWinSize();

salute
Thomas


_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout
Reply | Threaded
Open this post in threaded view
|

Re: Window resizing event

mig@songbirdnest.com
Yah, if I'm going to write that, I might as well write C++ that finds
and superclasses the HWND and handles WM_GETMINMAXINFO myself.

And that's probably how we're solving the problem for Songbird.
Assuming I don't get a more salient response than "poll it."

mig

_______________________________________________
mozilla-layout mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-layout