tdevdraw: fix OS X resize bug caused by redraw bug fix - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a61c69337c9242fa91c62bf761a03b6af015a4f9
 (DIR) parent 7d419a14214394e2f9523b78d4b9db59d7c9a025
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Sat, 16 Jan 2010 12:23:13 -0800
       
       devdraw: fix OS X resize bug caused by redraw bug fix
       
       R=rsc
       http://codereview.appspot.com/189104
       
       Diffstat:
         M src/cmd/devdraw/osx-screen-carbon.m |      16 +++++++++-------
       
       1 file changed, 9 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/devdraw/osx-screen-carbon.m b/src/cmd/devdraw/osx-screen-carbon.m
       t@@ -279,7 +279,6 @@ enum
        void screeninit(void);
        void _flushmemscreen(Rectangle r);
        
       -
        static void
        InitMultiTouch(void)
        {
       t@@ -522,11 +521,14 @@ eventhandler(EventHandlerCallRef next, EventRef event, void *arg)
                                eresized(1);
                                break;
                        
       -                case kEventWindowDrawContent:;
       -                        // The update says what rectangle needs drawing,
       -                        // but just draw everything.
       -                        Rectangle r = Rect(0, 0, Dx(osx.screenr), Dy(osx.screenr));
       -                        _flushmemscreen(r);
       +                case kEventWindowDrawContent:
       +                        // Tried using just flushmemimage here, but
       +                        // it causes an odd artifact in which making a window
       +                        // bigger in both width and height can then only draw
       +                        // on the new border: it's like the old window is stuck
       +                        // floating on top.  Doing a full "get a new window"
       +                        // seems to solve the problem.
       +                        eresized(1);
                                break;
        
                        case kEventWindowActivated:
       t@@ -793,7 +795,7 @@ eresized(int new)
        
                GetWindowBounds(osx.window, kWindowContentRgn, &or);
                r = Rect(or.left, or.top, or.right, or.bottom);
       -        if(Dx(r) == Dx(osx.screenr) && Dy(r) == Dy(osx.screenr)){
       +        if(Dx(r) == Dx(osx.screenr) && Dy(r) == Dy(osx.screenr) && !new){
                        // No need to make new image.
                        osx.screenr = r;
                        return;