]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxClipboard.
authorRobert Roebling <robert@roebling.de>
Mon, 14 Jan 2002 20:29:18 +0000 (20:29 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 14 Jan 2002 20:29:18 +0000 (20:29 +0000)
Fix enter and leave events.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/app.cpp
src/mac/carbon/app.cpp
src/mac/carbon/clipbrd.cpp
src/mac/carbon/toplevel.cpp
src/mac/carbon/window.cpp
src/mac/clipbrd.cpp
src/mac/toplevel.cpp
src/mac/window.cpp

index dcd512fa879335634cad43cbebabab8303096708..77da32475c888476782ae3e2d83959158f3790a8 100644 (file)
@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
 
                 wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
                                                  &currentMouseWindow ) ;
 
                 wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
                                                  &currentMouseWindow ) ;
-
                 if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
                 {
                     wxMouseEvent event ;
                 if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
                 {
                     wxMouseEvent event ;
@@ -1695,17 +1694,21 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
                     event.m_y = ev->where.v;
                     event.m_timeStamp = ev->when;
                     event.SetEventObject(this);
                     event.m_y = ev->where.v;
                     event.m_timeStamp = ev->when;
                     event.SetEventObject(this);
-
+                    
                     if ( wxWindow::s_lastMouseWindow )
                     {
                     if ( wxWindow::s_lastMouseWindow )
                     {
-                        wxMouseEvent eventleave(event ) ;
-                        eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
+                        wxMouseEvent eventleave(event);
+                        eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
+                        wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
+                        
                         wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
                     }
                     if ( currentMouseWindow )
                     {
                         wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
                     }
                     if ( currentMouseWindow )
                     {
-                        wxMouseEvent evententer(event ) ;
-                        evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
+                        wxMouseEvent evententer(event);
+                        evententer.SetEventType( wxEVT_ENTER_WINDOW );
+                        currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
+                        
                         currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
                     }
                     wxWindow::s_lastMouseWindow = currentMouseWindow ;
                         currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
                     }
                     wxWindow::s_lastMouseWindow = currentMouseWindow ;
index dcd512fa879335634cad43cbebabab8303096708..77da32475c888476782ae3e2d83959158f3790a8 100644 (file)
@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
 
                 wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
                                                  &currentMouseWindow ) ;
 
                 wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
                                                  &currentMouseWindow ) ;
-
                 if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
                 {
                     wxMouseEvent event ;
                 if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
                 {
                     wxMouseEvent event ;
@@ -1695,17 +1694,21 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
                     event.m_y = ev->where.v;
                     event.m_timeStamp = ev->when;
                     event.SetEventObject(this);
                     event.m_y = ev->where.v;
                     event.m_timeStamp = ev->when;
                     event.SetEventObject(this);
-
+                    
                     if ( wxWindow::s_lastMouseWindow )
                     {
                     if ( wxWindow::s_lastMouseWindow )
                     {
-                        wxMouseEvent eventleave(event ) ;
-                        eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
+                        wxMouseEvent eventleave(event);
+                        eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
+                        wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
+                        
                         wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
                     }
                     if ( currentMouseWindow )
                     {
                         wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
                     }
                     if ( currentMouseWindow )
                     {
-                        wxMouseEvent evententer(event ) ;
-                        evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
+                        wxMouseEvent evententer(event);
+                        evententer.SetEventType( wxEVT_ENTER_WINDOW );
+                        currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
+                        
                         currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
                     }
                     wxWindow::s_lastMouseWindow = currentMouseWindow ;
                         currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
                     }
                     wxWindow::s_lastMouseWindow = currentMouseWindow ;
index 0aa8806e032968e1adb57eee99f46ab964eb70e8..651f6f4722978fd6f08d993808a28ddf29ecf763 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -39,12 +39,12 @@ static const wxChar *TRACE_CLIPBOARD = _T("clipboard");
 void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 {
 #if !TARGET_CARBON
 void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 {
 #if !TARGET_CARBON
-       OSErr err = noErr ;
+    OSErr err = noErr ;
 #else
 #else
-       OSStatus err = noErr ;
+    OSStatus err = noErr ;
 #endif
   void * data = NULL ;
 #endif
   void * data = NULL ;
-       
+    
     switch (dataFormat.GetType())
     {
         case wxDF_OEMTEXT:
     switch (dataFormat.GetType())
     {
         case wxDF_OEMTEXT:
@@ -61,57 +61,57 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     }
 
 #if TARGET_CARBON
     }
 
 #if TARGET_CARBON
-       ScrapRef scrapRef;
-       
-       err = GetCurrentScrap( &scrapRef );
-       if ( err != noTypeErr && err != memFullErr )    
-       {
-               ScrapFlavorFlags        flavorFlags;
-               Size                            byteCount;
-               
-               if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
-               {
-                       if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
-                       {
-                         if ( dataFormat.GetType() == wxDF_TEXT )
-                           byteCount++ ;
-                           
+    ScrapRef scrapRef;
+    
+    err = GetCurrentScrap( &scrapRef );
+    if ( err != noTypeErr && err != memFullErr )    
+    {
+        ScrapFlavorFlags    flavorFlags;
+        Size                byteCount;
+        
+        if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+        {
+            if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+            {
+              if ( dataFormat.GetType() == wxDF_TEXT )
+                byteCount++ ;
+                
           data = new char[ byteCount ] ;
           if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
           {
             *len = byteCount ;
           data = new char[ byteCount ] ;
           if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
           {
             *len = byteCount ;
-                           if ( dataFormat.GetType() == wxDF_TEXT )  
-                       ((char*)data)[byteCount] = 0 ;
+                if ( dataFormat.GetType() == wxDF_TEXT )  
+                ((char*)data)[byteCount] = 0 ;
           }
           else
           {
             delete[] ((char *)data) ;
             data = NULL ;
           }
           }
           else
           {
             delete[] ((char *)data) ;
             data = NULL ;
           }
-                       }
-               }
-       }
-       
+            }
+        }
+    }
+    
 #else
 #else
-       long offset ;
-       Handle datahandle = NewHandle(0) ;
-       HLock( datahandle ) ;
-       GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
-       HUnlock( datahandle ) ;
-       if ( GetHandleSize( datahandle ) > 0 )
-       {
-         long byteCount = GetHandleSize( datahandle ) ;
-         if ( dataFormat.GetType() == wxDF_TEXT )  
-           data = new char[ byteCount + 1] ;
+    long offset ;
+    Handle datahandle = NewHandle(0) ;
+    HLock( datahandle ) ;
+    GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+    HUnlock( datahandle ) ;
+    if ( GetHandleSize( datahandle ) > 0 )
+    {
+      long byteCount = GetHandleSize( datahandle ) ;
+      if ( dataFormat.GetType() == wxDF_TEXT )  
+        data = new char[ byteCount + 1] ;
       else
         data = new char[ byteCount ] ;
 
       else
         data = new char[ byteCount ] ;
 
-         memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
-         if ( dataFormat.GetType() == wxDF_TEXT )  
-                 ((char*)data)[byteCount] = 0 ;
-         * len = byteCount ;
-       }
-       DisposeHandle( datahandle ) ;
+      memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
+      if ( dataFormat.GetType() == wxDF_TEXT )  
+          ((char*)data)[byteCount] = 0 ;
+      * len = byteCount ;
+    }
+    DisposeHandle( datahandle ) ;
 #endif
     if ( err )
     {
 #endif
     if ( err )
     {
@@ -156,16 +156,16 @@ void wxClipboard::Clear()
         m_data = (wxDataObject*) NULL;
     }
 #if TARGET_CARBON
         m_data = (wxDataObject*) NULL;
     }
 #if TARGET_CARBON
-       OSStatus err ;
-       err = ClearCurrentScrap( );
+    OSStatus err ;
+    err = ClearCurrentScrap( );
 #else
 #else
-       OSErr err ;
-       err = ZeroScrap( );
+    OSErr err ;
+    err = ZeroScrap( );
 #endif
 #endif
-       if ( err )
-       {
+    if ( err )
+    {
         wxLogSysError(_("Failed to empty the clipboard."));
         wxLogSysError(_("Failed to empty the clipboard."));
-       }
+    }
 }
 
 bool wxClipboard::Flush()
 }
 
 bool wxClipboard::Flush()
@@ -220,9 +220,9 @@ bool wxClipboard::AddData( wxDataObject *data )
                     array[i].GetId().c_str() );
 
 #if !TARGET_CARBON
                     array[i].GetId().c_str() );
 
 #if !TARGET_CARBON
-             OSErr err = noErr ;
+          OSErr err = noErr ;
 #else
 #else
-             OSStatus err = noErr ;
+          OSStatus err = noErr ;
 #endif
 
        switch ( array[i].GetType() )
 #endif
 
        switch ( array[i].GetType() )
@@ -232,26 +232,27 @@ bool wxClipboard::AddData( wxDataObject *data )
            {
                wxTextDataObject* textDataObject = (wxTextDataObject*) data;
                wxString str(textDataObject->GetText());
            {
                wxTextDataObject* textDataObject = (wxTextDataObject*) data;
                wxString str(textDataObject->GetText());
-               wxString mac ;
-               if ( wxApp::s_macDefaultEncodingIsPC )
-               {
-                       mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
-               }
-               else
-               {
-                       mac = textDataObject->GetText() ;
-               }
+                wxString mac ;
+                if ( wxApp::s_macDefaultEncodingIsPC )
+                {
+                    mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
+                }
+                else
+                {
+                    mac = textDataObject->GetText() ;
+                }
         #if !TARGET_CARBON
         #if !TARGET_CARBON
-                                       err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
+                        err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
         #else
         #else
-                                       ScrapRef        scrap;
-                                       err = GetCurrentScrap (&scrap); 
-                                       if ( !err )
-                                       {
-                                               err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
-                                       }
+                        ScrapRef    scrap;
+                        err = GetCurrentScrap (&scrap); 
+                        if ( !err )
+                        {
+                            err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
+                        }
         #endif
            }
         #endif
            }
+           break;
 
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
 
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
@@ -259,25 +260,26 @@ bool wxClipboard::AddData( wxDataObject *data )
               wxMetafileDataObject* metaFileDataObject =
                 (wxMetafileDataObject*) data;
               wxMetafile metaFile = metaFileDataObject->GetMetafile();
               wxMetafileDataObject* metaFileDataObject =
                 (wxMetafileDataObject*) data;
               wxMetafile metaFile = metaFileDataObject->GetMetafile();
-                               PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
-                               HLock( (Handle) pict ) ;
+                    PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
+                    HLock( (Handle) pict ) ;
       #if !TARGET_CARBON
       #if !TARGET_CARBON
-                               err = PutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                    err = PutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
       #else
       #else
-                               ScrapRef        scrap;
-                               err = GetCurrentScrap (&scrap); 
-                               if ( !err )
-                               {
-                                       err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
-                               }
+                    ScrapRef    scrap;
+                    err = GetCurrentScrap (&scrap); 
+                    if ( !err )
+                    {
+                        err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
+                    }
       #endif
       #endif
-                               HUnlock(  (Handle) pict ) ;
+                    HUnlock(  (Handle) pict ) ;
            }
            }
+           break;
 #endif
            case wxDF_BITMAP:
            case wxDF_DIB:
            default:
 #endif
            case wxDF_BITMAP:
            case wxDF_DIB:
            default:
-                       break ;
+                break ;
        }
 
     }
        }
 
     }
@@ -299,34 +301,34 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
     return m_data->IsSupported( dataFormat ) ;
   }
 #if TARGET_CARBON
     return m_data->IsSupported( dataFormat ) ;
   }
 #if TARGET_CARBON
-       OSStatus err = noErr;
-       ScrapRef scrapRef;
-       
-       err = GetCurrentScrap( &scrapRef );
-       if ( err != noTypeErr && err != memFullErr )    
-       {
-               ScrapFlavorFlags        flavorFlags;
-               Size                            byteCount;
-               
-               if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
-               {
-                       if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
-                       {
-                               return TRUE ;
-                       }
-               }
-       }
-       return FALSE;
-       
+    OSStatus err = noErr;
+    ScrapRef scrapRef;
+    
+    err = GetCurrentScrap( &scrapRef );
+    if ( err != noTypeErr && err != memFullErr )    
+    {
+        ScrapFlavorFlags    flavorFlags;
+        Size                byteCount;
+        
+        if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+        {
+            if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+            {
+                return TRUE ;
+            }
+        }
+    }
+    return FALSE;
+    
 #else
 #else
-       long offset ;
-       Handle datahandle = NewHandle(0) ;
-       HLock( datahandle ) ;
-       GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
-       HUnlock( datahandle ) ;
-       bool hasData = GetHandleSize( datahandle ) > 0 ;
-       DisposeHandle( datahandle ) ;
-       return hasData ;
+    long offset ;
+    Handle datahandle = NewHandle(0) ;
+    HLock( datahandle ) ;
+    GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+    HUnlock( datahandle ) ;
+    bool hasData = GetHandleSize( datahandle ) > 0 ;
+    DisposeHandle( datahandle ) ;
+    return hasData ;
 #endif
 }
 
 #endif
 }
 
index 12f077a7cd047413bd7049b31f99b2df16c909b8..1fc24445ba2974f1916a4b5f0d24f2fcb597e005 100644 (file)
@@ -179,7 +179,7 @@ void wxTopLevelWindowMac::Iconize(bool iconize)
 
 bool wxTopLevelWindowMac::IsIconized() const
 {
 
 bool wxTopLevelWindowMac::IsIconized() const
 {
-       // mac dialogs cannot be iconized
+    // mac dialogs cannot be iconized
     return FALSE;
 }
 
     return FALSE;
 }
 
@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
     event.m_x += m_x;
     event.m_y += m_y;
 
     event.m_x += m_x;
     event.m_y += m_y;
 
-/*
-    wxPoint origin = GetClientAreaOrigin() ;
-
-    event.m_x += origin.x ;
-    event.m_y += origin.y ;
-*/
-    
     event.m_timeStamp = ev->when;
     event.SetEventObject(this);
     if ( wxTheApp->s_captureWindow )
     event.m_timeStamp = ev->when;
     event.SetEventObject(this);
     if ( wxTheApp->s_captureWindow )
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
         event.m_x = x ;
         event.m_y = y ;
         wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
         event.m_x = x ;
         event.m_y = y ;
         wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
+        
         if ( ev->what == mouseUp )
         {
             wxTheApp->s_captureWindow = NULL ;
         if ( ev->what == mouseUp )
         {
             wxTheApp->s_captureWindow = NULL ;
index 7462e3ab8e027d8c0b5006e4524634139c3c5039..834c2cdc04d7a398c00b2923550ec1391f936016 100644 (file)
@@ -352,9 +352,9 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
     
     MacRootWindowToWindow( x , y ) ;
     if ( x )
     
     MacRootWindowToWindow( x , y ) ;
     if ( x )
-                       x -= MacGetLeftBorderSize() ;
+            x -= MacGetLeftBorderSize() ;
     if ( y )
     if ( y )
-                       y -= MacGetTopBorderSize() ;
+            y -= MacGetTopBorderSize() ;
 }
 
 void wxWindowMac::DoClientToScreen(int *x, int *y) const
 }
 
 void wxWindowMac::DoClientToScreen(int *x, int *y) const
@@ -362,10 +362,10 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
     WindowRef window = (WindowRef) MacGetRootWindow() ;
     
     if ( x )
     WindowRef window = (WindowRef) MacGetRootWindow() ;
     
     if ( x )
-                       x += MacGetLeftBorderSize() ;
+            x += MacGetLeftBorderSize() ;
     if ( y )
     if ( y )
-                       y += MacGetTopBorderSize() ;
-                       
+            y += MacGetTopBorderSize() ;
+            
     MacWindowToRootWindow( x , y ) ;
     
     Point       localwhere = { 0,0 };
     MacWindowToRootWindow( x , y ) ;
     
     Point       localwhere = { 0,0 };
@@ -678,12 +678,12 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
 
 void wxWindow::SetTitle(const wxString& title)
 {
 
 void wxWindow::SetTitle(const wxString& title)
 {
-       m_label = title ;
+    m_label = title ;
 }
 
 wxString wxWindow::GetTitle() const
 {
 }
 
 wxString wxWindow::GetTitle() const
 {
-       return m_label ;
+    return m_label ;
 }
 
 bool wxWindowMac::Show(bool show)
 }
 
 bool wxWindowMac::Show(bool show)
@@ -1023,17 +1023,17 @@ void wxWindowMac::MacPaintBorders( int left , int top )
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
     {
 #if wxMAC_USE_THEME_BORDER
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
     {
 #if wxMAC_USE_THEME_BORDER
-                 Rect rect = { top , left , m_height + top , m_width + left } ;
-                 SInt32 border = 0 ;
-                 /*
-                 GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
-                 InsetRect( &rect , border , border );
+          Rect rect = { top , left , m_height + top , m_width + left } ;
+          SInt32 border = 0 ;
+          /*
+          GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+          InsetRect( &rect , border , border );
       DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
       */
         
         DrawThemePrimaryGroup(&rect  ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
 #else
       DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
       */
         
         DrawThemePrimaryGroup(&rect  ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
 #else
-       bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+        bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
         RGBForeColor( &face );
         MoveTo( left + 0 , top + m_height - 2 );
         LineTo( left + 0 , top + 0 );
         RGBForeColor( &face );
         MoveTo( left + 0 , top + m_height - 2 );
         LineTo( left + 0 , top + 0 );
@@ -1066,7 +1066,7 @@ void wxWindowMac::MacPaintBorders( int left , int top )
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
-                   Rect rect = { top , left , m_height + top , m_width + left } ;
+            Rect rect = { top , left , m_height + top , m_width + left } ;
         RGBForeColor( &black ) ;
         FrameRect( &rect ) ;
     }
         RGBForeColor( &black ) ;
         FrameRect( &rect ) ;
     }
@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
 bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin ) 
 {
     WindowRef window ;
 bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin ) 
 {
     WindowRef window ;
+    
     Point pt = { screenpoint.y , screenpoint.x } ;
     if ( ::FindWindow( pt , &window ) == 3 )
     {
     Point pt = { screenpoint.y , screenpoint.x } ;
     if ( ::FindWindow( pt , &window ) == 3 )
     {
-        wxPoint point( screenpoint ) ;
+        
         wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
         if ( win )
         {
         wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
         if ( win )
         {
-            point = win->ScreenToClient( point ) ;
-            point += win->GetClientAreaOrigin() ;
+            // No, this yields the CLIENT are, we need the whole frame. RR.
+            // point = win->ScreenToClient( point ) ;
+            
+            GrafPtr     port;  
+            ::GetPort( &port ) ;
+            ::SetPort( UMAGetWindowPort( window ) ) ;
+            ::GlobalToLocal( &pt ) ;
+            ::SetPort( port ) ;
+
+            wxPoint point( pt.h, pt.v ) ;
+            
             return win->MacGetWindowFromPointSub( point , outWin ) ;
         }
     }
             return win->MacGetWindowFromPointSub( point , outWin ) ;
         }
     }
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
             || event.GetEventType() == wxEVT_LEAVE_WINDOW )
         wxToolTip::RelayEvent( this , event);
 #endif // wxUSE_TOOLTIPS
             || event.GetEventType() == wxEVT_LEAVE_WINDOW )
         wxToolTip::RelayEvent( this , event);
 #endif // wxUSE_TOOLTIPS
+
     GetEventHandler()->ProcessEvent( event ) ;
     GetEventHandler()->ProcessEvent( event ) ;
+
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -1435,11 +1447,11 @@ void wxWindowMac::Update()
     if ( win )
     {
       win->MacUpdate( 0 ) ;
     if ( win )
     {
       win->MacUpdate( 0 ) ;
-           if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
-           {
-                               QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
-           }
-         }
+        if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
+        {
+                QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
+        }
+      }
 }
 
 wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const 
 }
 
 wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const 
@@ -1769,23 +1781,23 @@ long wxWindowMac::MacGetLeftBorderSize( ) const
 
     if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
     {
 
     if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
     {
-               SInt32 border = 3 ;
+        SInt32 border = 3 ;
 #if wxMAC_USE_THEME_BORDER
 #if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON              
-                 GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON       
+          GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
 #endif
 #endif
 #endif
 #endif
-                 return border ;
+          return border ;
     }
     else if (  m_windowStyle &wxDOUBLE_BORDER)
     {
     }
     else if (  m_windowStyle &wxDOUBLE_BORDER)
     {
-                 SInt32 border = 3 ;
+          SInt32 border = 3 ;
 #if wxMAC_USE_THEME_BORDER
 #if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON              
-                 GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON       
+          GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
 #endif
 #endif
 #endif
 #endif
-                 return border ;
+          return border ;
     }
     else if (m_windowStyle &wxSIMPLE_BORDER)
     {
     }
     else if (m_windowStyle &wxSIMPLE_BORDER)
     {
index 0aa8806e032968e1adb57eee99f46ab964eb70e8..651f6f4722978fd6f08d993808a28ddf29ecf763 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -39,12 +39,12 @@ static const wxChar *TRACE_CLIPBOARD = _T("clipboard");
 void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 {
 #if !TARGET_CARBON
 void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 {
 #if !TARGET_CARBON
-       OSErr err = noErr ;
+    OSErr err = noErr ;
 #else
 #else
-       OSStatus err = noErr ;
+    OSStatus err = noErr ;
 #endif
   void * data = NULL ;
 #endif
   void * data = NULL ;
-       
+    
     switch (dataFormat.GetType())
     {
         case wxDF_OEMTEXT:
     switch (dataFormat.GetType())
     {
         case wxDF_OEMTEXT:
@@ -61,57 +61,57 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     }
 
 #if TARGET_CARBON
     }
 
 #if TARGET_CARBON
-       ScrapRef scrapRef;
-       
-       err = GetCurrentScrap( &scrapRef );
-       if ( err != noTypeErr && err != memFullErr )    
-       {
-               ScrapFlavorFlags        flavorFlags;
-               Size                            byteCount;
-               
-               if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
-               {
-                       if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
-                       {
-                         if ( dataFormat.GetType() == wxDF_TEXT )
-                           byteCount++ ;
-                           
+    ScrapRef scrapRef;
+    
+    err = GetCurrentScrap( &scrapRef );
+    if ( err != noTypeErr && err != memFullErr )    
+    {
+        ScrapFlavorFlags    flavorFlags;
+        Size                byteCount;
+        
+        if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+        {
+            if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+            {
+              if ( dataFormat.GetType() == wxDF_TEXT )
+                byteCount++ ;
+                
           data = new char[ byteCount ] ;
           if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
           {
             *len = byteCount ;
           data = new char[ byteCount ] ;
           if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
           {
             *len = byteCount ;
-                           if ( dataFormat.GetType() == wxDF_TEXT )  
-                       ((char*)data)[byteCount] = 0 ;
+                if ( dataFormat.GetType() == wxDF_TEXT )  
+                ((char*)data)[byteCount] = 0 ;
           }
           else
           {
             delete[] ((char *)data) ;
             data = NULL ;
           }
           }
           else
           {
             delete[] ((char *)data) ;
             data = NULL ;
           }
-                       }
-               }
-       }
-       
+            }
+        }
+    }
+    
 #else
 #else
-       long offset ;
-       Handle datahandle = NewHandle(0) ;
-       HLock( datahandle ) ;
-       GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
-       HUnlock( datahandle ) ;
-       if ( GetHandleSize( datahandle ) > 0 )
-       {
-         long byteCount = GetHandleSize( datahandle ) ;
-         if ( dataFormat.GetType() == wxDF_TEXT )  
-           data = new char[ byteCount + 1] ;
+    long offset ;
+    Handle datahandle = NewHandle(0) ;
+    HLock( datahandle ) ;
+    GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+    HUnlock( datahandle ) ;
+    if ( GetHandleSize( datahandle ) > 0 )
+    {
+      long byteCount = GetHandleSize( datahandle ) ;
+      if ( dataFormat.GetType() == wxDF_TEXT )  
+        data = new char[ byteCount + 1] ;
       else
         data = new char[ byteCount ] ;
 
       else
         data = new char[ byteCount ] ;
 
-         memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
-         if ( dataFormat.GetType() == wxDF_TEXT )  
-                 ((char*)data)[byteCount] = 0 ;
-         * len = byteCount ;
-       }
-       DisposeHandle( datahandle ) ;
+      memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
+      if ( dataFormat.GetType() == wxDF_TEXT )  
+          ((char*)data)[byteCount] = 0 ;
+      * len = byteCount ;
+    }
+    DisposeHandle( datahandle ) ;
 #endif
     if ( err )
     {
 #endif
     if ( err )
     {
@@ -156,16 +156,16 @@ void wxClipboard::Clear()
         m_data = (wxDataObject*) NULL;
     }
 #if TARGET_CARBON
         m_data = (wxDataObject*) NULL;
     }
 #if TARGET_CARBON
-       OSStatus err ;
-       err = ClearCurrentScrap( );
+    OSStatus err ;
+    err = ClearCurrentScrap( );
 #else
 #else
-       OSErr err ;
-       err = ZeroScrap( );
+    OSErr err ;
+    err = ZeroScrap( );
 #endif
 #endif
-       if ( err )
-       {
+    if ( err )
+    {
         wxLogSysError(_("Failed to empty the clipboard."));
         wxLogSysError(_("Failed to empty the clipboard."));
-       }
+    }
 }
 
 bool wxClipboard::Flush()
 }
 
 bool wxClipboard::Flush()
@@ -220,9 +220,9 @@ bool wxClipboard::AddData( wxDataObject *data )
                     array[i].GetId().c_str() );
 
 #if !TARGET_CARBON
                     array[i].GetId().c_str() );
 
 #if !TARGET_CARBON
-             OSErr err = noErr ;
+          OSErr err = noErr ;
 #else
 #else
-             OSStatus err = noErr ;
+          OSStatus err = noErr ;
 #endif
 
        switch ( array[i].GetType() )
 #endif
 
        switch ( array[i].GetType() )
@@ -232,26 +232,27 @@ bool wxClipboard::AddData( wxDataObject *data )
            {
                wxTextDataObject* textDataObject = (wxTextDataObject*) data;
                wxString str(textDataObject->GetText());
            {
                wxTextDataObject* textDataObject = (wxTextDataObject*) data;
                wxString str(textDataObject->GetText());
-               wxString mac ;
-               if ( wxApp::s_macDefaultEncodingIsPC )
-               {
-                       mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
-               }
-               else
-               {
-                       mac = textDataObject->GetText() ;
-               }
+                wxString mac ;
+                if ( wxApp::s_macDefaultEncodingIsPC )
+                {
+                    mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
+                }
+                else
+                {
+                    mac = textDataObject->GetText() ;
+                }
         #if !TARGET_CARBON
         #if !TARGET_CARBON
-                                       err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
+                        err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
         #else
         #else
-                                       ScrapRef        scrap;
-                                       err = GetCurrentScrap (&scrap); 
-                                       if ( !err )
-                                       {
-                                               err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
-                                       }
+                        ScrapRef    scrap;
+                        err = GetCurrentScrap (&scrap); 
+                        if ( !err )
+                        {
+                            err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
+                        }
         #endif
            }
         #endif
            }
+           break;
 
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
 
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
@@ -259,25 +260,26 @@ bool wxClipboard::AddData( wxDataObject *data )
               wxMetafileDataObject* metaFileDataObject =
                 (wxMetafileDataObject*) data;
               wxMetafile metaFile = metaFileDataObject->GetMetafile();
               wxMetafileDataObject* metaFileDataObject =
                 (wxMetafileDataObject*) data;
               wxMetafile metaFile = metaFileDataObject->GetMetafile();
-                               PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
-                               HLock( (Handle) pict ) ;
+                    PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
+                    HLock( (Handle) pict ) ;
       #if !TARGET_CARBON
       #if !TARGET_CARBON
-                               err = PutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                    err = PutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
       #else
       #else
-                               ScrapRef        scrap;
-                               err = GetCurrentScrap (&scrap); 
-                               if ( !err )
-                               {
-                                       err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
-                               }
+                    ScrapRef    scrap;
+                    err = GetCurrentScrap (&scrap); 
+                    if ( !err )
+                    {
+                        err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
+                    }
       #endif
       #endif
-                               HUnlock(  (Handle) pict ) ;
+                    HUnlock(  (Handle) pict ) ;
            }
            }
+           break;
 #endif
            case wxDF_BITMAP:
            case wxDF_DIB:
            default:
 #endif
            case wxDF_BITMAP:
            case wxDF_DIB:
            default:
-                       break ;
+                break ;
        }
 
     }
        }
 
     }
@@ -299,34 +301,34 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
     return m_data->IsSupported( dataFormat ) ;
   }
 #if TARGET_CARBON
     return m_data->IsSupported( dataFormat ) ;
   }
 #if TARGET_CARBON
-       OSStatus err = noErr;
-       ScrapRef scrapRef;
-       
-       err = GetCurrentScrap( &scrapRef );
-       if ( err != noTypeErr && err != memFullErr )    
-       {
-               ScrapFlavorFlags        flavorFlags;
-               Size                            byteCount;
-               
-               if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
-               {
-                       if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
-                       {
-                               return TRUE ;
-                       }
-               }
-       }
-       return FALSE;
-       
+    OSStatus err = noErr;
+    ScrapRef scrapRef;
+    
+    err = GetCurrentScrap( &scrapRef );
+    if ( err != noTypeErr && err != memFullErr )    
+    {
+        ScrapFlavorFlags    flavorFlags;
+        Size                byteCount;
+        
+        if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+        {
+            if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+            {
+                return TRUE ;
+            }
+        }
+    }
+    return FALSE;
+    
 #else
 #else
-       long offset ;
-       Handle datahandle = NewHandle(0) ;
-       HLock( datahandle ) ;
-       GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
-       HUnlock( datahandle ) ;
-       bool hasData = GetHandleSize( datahandle ) > 0 ;
-       DisposeHandle( datahandle ) ;
-       return hasData ;
+    long offset ;
+    Handle datahandle = NewHandle(0) ;
+    HLock( datahandle ) ;
+    GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+    HUnlock( datahandle ) ;
+    bool hasData = GetHandleSize( datahandle ) > 0 ;
+    DisposeHandle( datahandle ) ;
+    return hasData ;
 #endif
 }
 
 #endif
 }
 
index 12f077a7cd047413bd7049b31f99b2df16c909b8..1fc24445ba2974f1916a4b5f0d24f2fcb597e005 100644 (file)
@@ -179,7 +179,7 @@ void wxTopLevelWindowMac::Iconize(bool iconize)
 
 bool wxTopLevelWindowMac::IsIconized() const
 {
 
 bool wxTopLevelWindowMac::IsIconized() const
 {
-       // mac dialogs cannot be iconized
+    // mac dialogs cannot be iconized
     return FALSE;
 }
 
     return FALSE;
 }
 
@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
     event.m_x += m_x;
     event.m_y += m_y;
 
     event.m_x += m_x;
     event.m_y += m_y;
 
-/*
-    wxPoint origin = GetClientAreaOrigin() ;
-
-    event.m_x += origin.x ;
-    event.m_y += origin.y ;
-*/
-    
     event.m_timeStamp = ev->when;
     event.SetEventObject(this);
     if ( wxTheApp->s_captureWindow )
     event.m_timeStamp = ev->when;
     event.SetEventObject(this);
     if ( wxTheApp->s_captureWindow )
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
         event.m_x = x ;
         event.m_y = y ;
         wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
         event.m_x = x ;
         event.m_y = y ;
         wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
+        
         if ( ev->what == mouseUp )
         {
             wxTheApp->s_captureWindow = NULL ;
         if ( ev->what == mouseUp )
         {
             wxTheApp->s_captureWindow = NULL ;
index 7462e3ab8e027d8c0b5006e4524634139c3c5039..834c2cdc04d7a398c00b2923550ec1391f936016 100644 (file)
@@ -352,9 +352,9 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
     
     MacRootWindowToWindow( x , y ) ;
     if ( x )
     
     MacRootWindowToWindow( x , y ) ;
     if ( x )
-                       x -= MacGetLeftBorderSize() ;
+            x -= MacGetLeftBorderSize() ;
     if ( y )
     if ( y )
-                       y -= MacGetTopBorderSize() ;
+            y -= MacGetTopBorderSize() ;
 }
 
 void wxWindowMac::DoClientToScreen(int *x, int *y) const
 }
 
 void wxWindowMac::DoClientToScreen(int *x, int *y) const
@@ -362,10 +362,10 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
     WindowRef window = (WindowRef) MacGetRootWindow() ;
     
     if ( x )
     WindowRef window = (WindowRef) MacGetRootWindow() ;
     
     if ( x )
-                       x += MacGetLeftBorderSize() ;
+            x += MacGetLeftBorderSize() ;
     if ( y )
     if ( y )
-                       y += MacGetTopBorderSize() ;
-                       
+            y += MacGetTopBorderSize() ;
+            
     MacWindowToRootWindow( x , y ) ;
     
     Point       localwhere = { 0,0 };
     MacWindowToRootWindow( x , y ) ;
     
     Point       localwhere = { 0,0 };
@@ -678,12 +678,12 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
 
 void wxWindow::SetTitle(const wxString& title)
 {
 
 void wxWindow::SetTitle(const wxString& title)
 {
-       m_label = title ;
+    m_label = title ;
 }
 
 wxString wxWindow::GetTitle() const
 {
 }
 
 wxString wxWindow::GetTitle() const
 {
-       return m_label ;
+    return m_label ;
 }
 
 bool wxWindowMac::Show(bool show)
 }
 
 bool wxWindowMac::Show(bool show)
@@ -1023,17 +1023,17 @@ void wxWindowMac::MacPaintBorders( int left , int top )
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
     {
 #if wxMAC_USE_THEME_BORDER
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
     {
 #if wxMAC_USE_THEME_BORDER
-                 Rect rect = { top , left , m_height + top , m_width + left } ;
-                 SInt32 border = 0 ;
-                 /*
-                 GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
-                 InsetRect( &rect , border , border );
+          Rect rect = { top , left , m_height + top , m_width + left } ;
+          SInt32 border = 0 ;
+          /*
+          GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+          InsetRect( &rect , border , border );
       DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
       */
         
         DrawThemePrimaryGroup(&rect  ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
 #else
       DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
       */
         
         DrawThemePrimaryGroup(&rect  ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
 #else
-       bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+        bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
         RGBForeColor( &face );
         MoveTo( left + 0 , top + m_height - 2 );
         LineTo( left + 0 , top + 0 );
         RGBForeColor( &face );
         MoveTo( left + 0 , top + m_height - 2 );
         LineTo( left + 0 , top + 0 );
@@ -1066,7 +1066,7 @@ void wxWindowMac::MacPaintBorders( int left , int top )
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
-                   Rect rect = { top , left , m_height + top , m_width + left } ;
+            Rect rect = { top , left , m_height + top , m_width + left } ;
         RGBForeColor( &black ) ;
         FrameRect( &rect ) ;
     }
         RGBForeColor( &black ) ;
         FrameRect( &rect ) ;
     }
@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
 bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin ) 
 {
     WindowRef window ;
 bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin ) 
 {
     WindowRef window ;
+    
     Point pt = { screenpoint.y , screenpoint.x } ;
     if ( ::FindWindow( pt , &window ) == 3 )
     {
     Point pt = { screenpoint.y , screenpoint.x } ;
     if ( ::FindWindow( pt , &window ) == 3 )
     {
-        wxPoint point( screenpoint ) ;
+        
         wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
         if ( win )
         {
         wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
         if ( win )
         {
-            point = win->ScreenToClient( point ) ;
-            point += win->GetClientAreaOrigin() ;
+            // No, this yields the CLIENT are, we need the whole frame. RR.
+            // point = win->ScreenToClient( point ) ;
+            
+            GrafPtr     port;  
+            ::GetPort( &port ) ;
+            ::SetPort( UMAGetWindowPort( window ) ) ;
+            ::GlobalToLocal( &pt ) ;
+            ::SetPort( port ) ;
+
+            wxPoint point( pt.h, pt.v ) ;
+            
             return win->MacGetWindowFromPointSub( point , outWin ) ;
         }
     }
             return win->MacGetWindowFromPointSub( point , outWin ) ;
         }
     }
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
             || event.GetEventType() == wxEVT_LEAVE_WINDOW )
         wxToolTip::RelayEvent( this , event);
 #endif // wxUSE_TOOLTIPS
             || event.GetEventType() == wxEVT_LEAVE_WINDOW )
         wxToolTip::RelayEvent( this , event);
 #endif // wxUSE_TOOLTIPS
+
     GetEventHandler()->ProcessEvent( event ) ;
     GetEventHandler()->ProcessEvent( event ) ;
+
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -1435,11 +1447,11 @@ void wxWindowMac::Update()
     if ( win )
     {
       win->MacUpdate( 0 ) ;
     if ( win )
     {
       win->MacUpdate( 0 ) ;
-           if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
-           {
-                               QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
-           }
-         }
+        if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
+        {
+                QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
+        }
+      }
 }
 
 wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const 
 }
 
 wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const 
@@ -1769,23 +1781,23 @@ long wxWindowMac::MacGetLeftBorderSize( ) const
 
     if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
     {
 
     if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
     {
-               SInt32 border = 3 ;
+        SInt32 border = 3 ;
 #if wxMAC_USE_THEME_BORDER
 #if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON              
-                 GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON       
+          GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
 #endif
 #endif
 #endif
 #endif
-                 return border ;
+          return border ;
     }
     else if (  m_windowStyle &wxDOUBLE_BORDER)
     {
     }
     else if (  m_windowStyle &wxDOUBLE_BORDER)
     {
-                 SInt32 border = 3 ;
+          SInt32 border = 3 ;
 #if wxMAC_USE_THEME_BORDER
 #if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON              
-                 GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON       
+          GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
 #endif
 #endif
 #endif
 #endif
-                 return border ;
+          return border ;
     }
     else if (m_windowStyle &wxSIMPLE_BORDER)
     {
     }
     else if (m_windowStyle &wxSIMPLE_BORDER)
     {