Changeset 15385

Show
Ignore:
Timestamp:
12/06/05 18:15:48 (3 years ago)
Author:
axeld
Message:

The resize code now works correctly, finally - it temporarily did harm ;)
The BViews must be resized directly after every change in the window size - we
cannot wait until B_WINDOW_RESIZED, since subsequent calls have wrong view
sizes, then.
B_WINDOW_RESIZED is only really useful for app_server caused window resizing.
Added TODO to SetLook(): it may change the window size as well.

Location:
haiku/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/headers/os/interface/Window.h

    r15087 r15385  
    286286 
    287287                        void            _CreateTopView(); 
     288                        void            _AdoptResize(); 
    288289                        void            _SetFocus(BView *focusView, bool notifyIputServer = false); 
    289290 
  • haiku/trunk/src/kits/interface/Window.cpp

    r15374 r15385  
    738738                                fFrame.bottom = fFrame.top + height; 
    739739 
    740                                 // Resize views according to their resize modes - this 
    741                                 // saves us some server communication, as the server 
    742                                 // does the same with our views on its side. 
    743                                 fTopView->_ResizeBy(width - fTopView->Bounds().Width(), 
    744                                         height - fTopView->Bounds().Height()); 
    745  
     740                                _AdoptResize(); 
    746741                                FrameResized(width, height); 
    747742                        } 
     
    10631058                        fLink->Read<float>(&fMinHeight); 
    10641059                        fLink->Read<float>(&fMaxHeight); 
     1060 
     1061                        _AdoptResize(); 
     1062                                // TODO: the same has to be done for SetLook() (that can alter 
     1063                                //              the size limits, and hence, the size of the window 
    10651064                } 
    10661065                Unlock(); 
     
    16221621        if (fLink->FlushWithReply(status) == B_OK && status == B_OK) 
    16231622                fLook = look; 
     1623 
     1624        // TODO: this could have changed the window size, and thus, we 
     1625        //      need to get it from the server (and call _AdoptResize()). 
    16241626 
    16251627        return status; 
     
    18501852 
    18511853                fFrame.SetRightBottom(fFrame.RightBottom() + BPoint(dx, dy)); 
     1854                _AdoptResize(); 
    18521855        } 
    18531856        Unlock(); 
     
    23692372 
    23702373        STRACE(("BuildTopView ended\n")); 
     2374} 
     2375 
     2376 
     2377/*! 
     2378        Resizes the top view to match the window size. This will also 
     2379        adapt the size of all its child views as needed. 
     2380        This method has to be called whenever the frame of the window 
     2381        changes. 
     2382*/ 
     2383void 
     2384BWindow::_AdoptResize() 
     2385{ 
     2386        // Resize views according to their resize modes - this 
     2387        // saves us some server communication, as the server 
     2388        // does the same with our views on its side. 
     2389 
     2390        int32 deltaWidth = fFrame.Width() - fTopView->Bounds().Width(); 
     2391        int32 deltaHeight = fFrame.Height() - fTopView->Bounds().Height(); 
     2392        if (deltaWidth == 0 && deltaHeight == 0) 
     2393                return; 
     2394 
     2395        fTopView->_ResizeBy(deltaWidth, deltaHeight); 
    23712396} 
    23722397