#include "wx/sysopt.h"
#endif
+#ifndef __DARWIN__
#include <ToolUtils.h>
+#endif
//For targeting OSX
#include "wx/mac/private.h"
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// trace mask for activation tracing messages
+static const wxChar *TRACE_ACTIVATE = _T("activation");
+
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
#if SIZEOF_WCHAR_T == 2
uniChar = charBuf[0] ;
#else
- wxMBConvUTF16BE converter ;
+ wxMBConvUTF16 converter ;
converter.MB2WC( &uniChar , (const char*)charBuf , 1 ) ;
#endif
if ( dataSize > 4 )
return wxMacFindSubControl( toplevelWindow , location , rootControl , outPart ) ;
}
+
+#define NEW_CAPTURE_HANDLING 1
+
pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
wxWindow* currentMouseWindow = NULL ;
ControlRef control = NULL ;
+#if NEW_CAPTURE_HANDLING
+ if ( wxApp::s_captureWindow )
+ {
+ window = (WindowRef) wxApp::s_captureWindow->MacGetTopLevelWindowRef() ;
+ windowPart = inContent ;
+ }
+#endif
+
if ( window )
{
QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ;
- if ( wxApp::s_captureWindow && wxApp::s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent )
+ if ( wxApp::s_captureWindow
+#if !NEW_CAPTURE_HANDLING
+ && wxApp::s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent
+#endif
+ )
{
currentMouseWindow = wxApp::s_captureWindow ;
}
// Find an item given the Macintosh Window Reference
-#if KEY_wxList_DEPRECATED
-wxList wxWinMacWindowList(wxKEY_INTEGER);
-wxTopLevelWindowMac *wxFindWinFromMacWindow(WindowRef inWindowRef)
-{
- wxNode *node = wxWinMacWindowList.Find((long)inWindowRef);
- if (!node)
- return NULL;
- return (wxTopLevelWindowMac *)node->GetData();
-}
-
-void wxAssociateWinWithMacWindow(WindowRef inWindowRef, wxTopLevelWindowMac *win) ;
-void wxAssociateWinWithMacWindow(WindowRef inWindowRef, wxTopLevelWindowMac *win)
-{
- // adding NULL WindowRef is (first) surely a result of an error and
- // (secondly) breaks menu command processing
- wxCHECK_RET( inWindowRef != (WindowRef) NULL, wxT("attempt to add a NULL WindowRef to window list") );
-
- if ( !wxWinMacWindowList.Find((long)inWindowRef) )
- wxWinMacWindowList.Append((long)inWindowRef, win);
-}
-
-void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) ;
-void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win)
-{
- wxWinMacWindowList.DeleteObject(win);
-}
-#else
-
WX_DECLARE_HASH_MAP(WindowRef, wxTopLevelWindowMac*, wxPointerHash, wxPointerEqual, MacWindowMap);
static MacWindowMap wxWinMacWindowList;
}
}
}
-#endif // deprecated wxList
// ----------------------------------------------------------------------------
// wxTopLevelWindowMac creation
{
if(s_macDeactivateWindow)
{
- wxLogDebug(wxT("Doing delayed deactivation of %p"),s_macDeactivateWindow);
+ wxLogTrace(TRACE_ACTIVATE,
+ wxT("Doing delayed deactivation of %p"),
+ s_macDeactivateWindow);
s_macDeactivateWindow->MacActivate(timestamp, false);
}
}
void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating )
{
- // wxLogDebug(wxT("TopLevel=%p::MacActivate"),this);
+ wxLogTrace(TRACE_ACTIVATE, wxT("TopLevel=%p::MacActivate"), this);
if(s_macDeactivateWindow==this)
s_macDeactivateWindow=NULL;
{
wxSize sz = GetClientSize();
wxRegion rgn(0, 0, sz.x, sz.y);
- return SetShape(rgn);
+ if ( rgn.IsEmpty() )
+ return false ;
+ else
+ return SetShape(rgn);
}
// Make a copy of the region