MaxOS 10.7 full-screen animation corrupts my UI --- how to avoid?

  • Hello everyone.

    My main window restricts the user to a range of window sizes, using

    [myWindow setContentsMaxSize:maxSize]
    [myWindow setContentsMinSize:minSize]

    The minimum size prevents corruption of some complicated views loaded from several nib files.

    When the user presses "fullscreen" button, Lion starts an animation that will

    1. shrink the window below its current size,
    2. in several steps, increase its size until it reaches the full-screen representation size.

    If the window started in its minimal size, this animation will SHRINK IT BELOW THE MINIMAL size and will corrupt my UI beyond repair. My views are receiving setFrameSize: with unsupported size.

    Can this be considered a Cocoa bug?
    Am I doing something wrong?
    Can I somehow prevent the corruption, without replacing the OS standard animation for full-screen?
    Why doesn't the animation base on a "snapshot" of the window contents, instead of live-resizing of the whole view-hierarchy  throughout the animation?
    Can someone "spare" a few lines of code that will do a simple linear resizing animation that will NOT go below minimum?

    Any advice will be greatly appreciated.
    Thanks.

    Motti Shneor
    ---------------------------------------------------------
    Ceterum censeo Microsoftinem delendam esse
  • On Jul 10, 2012, at 10:39 AM, Motti Shneor wrote:
    > If the window started in its minimal size, this animation will SHRINK IT BELOW THE MINIMAL size and will corrupt my UI beyond repair. My views are receiving setFrameSize: with unsupported size.

    Not sure about prevention, but can't you put a check here?
    If (sizeRequested < minSize)
      sizeRequested = minSize

    Just disregard the invalid requests?

    ----------------------------------------------------------------
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    www.Culverson.com                    (toll free) 1-877-676-8175
  • Hi Steve

    How can a view disregard resizing request? It is simply resized....

    The window cannot reject its resizing. Or actually, it DOES reject, by stating its min-size to cocoa. The window IS RESIZED.

    The content view of a window has no way to prevent its resizing. It is by definition covering its windows content area. As far as I know, there is no (BOOL)shouldResize: method I can override for an NSView or a NSWindow, in which It can refuse a new size.

    A possible solution would be to have sub-view not-resize as their super-view, and be cut when the superview goes below their minimum.
    That implies pretty much coding to let subviews do resize with superview when possible and don't do it otherwise. Also, revealing sub-view contents that has been cut calls for more re-drawing and synchronization mechanism.

    On 19 ביול 2012, at 13:56, Steve Bird wrote:

    >
    > On Jul 10, 2012, at 10:39 AM, Motti Shneor wrote:
    >> If the window started in its minimal size, this animation will SHRINK IT BELOW THE MINIMAL size and will corrupt my UI beyond repair. My views are receiving setFrameSize: with unsupported size.
    >
    > Not sure about prevention, but can't you put a check here?
    > If (sizeRequested < minSize)
    > sizeRequested = minSize
    >
    > Just disregard the invalid requests?
    > ----------------------------------------------------------------
    > Steve Bird
    > Culverson Software - Elegant software that is a pleasure to use.
    > www.Culverson.com                    (toll free) 1-877-676-8175
    >
    >

    Motti Shneor
  • On Jul 19, 2012, at 5:17 AM, Motti Shneor <sumac...> wrote:

    > Hi Steve
    >
    > How can a view disregard resizing request? It is simply resized....

    Try -[<NSWindowDelegate> windowWillResize:toSize:].

    --Kyle Sluder
  • Hi, the header-file  documentation for the suggested delegate method tells the following:
    ---------------
    1.  windowWillResize:toSize: Tells the delegate that the window is being resized (whether by the user or through one of the setFrame... methods other than setFrame:display:).

    2. The frameSize contains the size (in screen coordinates) sender will be resized to. To resize to a different size, simply return the desired size from this method; to avoid resizing, return the current size. sender’s minimum and maximum size constraints have already been applied when this method is invoked.

    While the user is resizing a window, the delegate is sent a series of windowWillResize:toSize: messages as the window’s outline is dragged. The window’s outline is displayed at the constrained size as set by this method.
    --------------

    Maybe I don't understand the docs right --- but my understanding is that minimum and maximum sizes are already constrained by this method --- which means there is no reason for me to implement it in my delegate, as my implementation won't do anything different than the standard implementation.

    I'll give it a try, but obviously something is wrong either in the documentation, my understanding of it, or Cocoa full-screen animation implementation.

    On 19 ביול 2012, at 18:09, Kyle Sluder wrote:

    > On Jul 19, 2012, at 5:17 AM, Motti Shneor <sumac...> wrote:
    >
    >> Hi Steve
    >>
    >> How can a view disregard resizing request? It is simply resized....
    >
    > Try -[<NSWindowDelegate> windowWillResize:toSize:].
    >
    > --Kyle Sluder

    Motti Shneor
    e-mail: <motti.shneor...>
    phone: +972-8-9267730
    mobile: +972-54-3136621
    ----------------------------------------
    Ceterum censeo Microsoftinem delendam esse
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today