+bool wxWindowDC::CocoaLockFocusOnNSView(WX_NSView nsview)
+{
+ if([nsview lockFocusIfCanDraw])
+ {
+ sm_cocoaDCStack.Insert(this);
+ m_cocoaFlipped = [nsview isFlipped];
+ m_cocoaHeight = [nsview bounds].size.height;
+ CocoaApplyTransformations();
+ m_lockedNSView = nsview;
+ return true;
+ }
+ wxLogDebug("focus lock failed!");
+ return false;
+}
+
+bool wxWindowDC::CocoaUnlockFocusOnNSView()
+{
+ [[m_lockedNSView window] flushWindow];
+ [m_lockedNSView unlockFocus];
+ m_lockedNSView = NULL;
+ return true;
+}
+
+bool wxWindowDC::CocoaLockFocus()
+{
+ wxLogDebug("Locking focus on wxWindowDC=%p, NSView=%p",this, m_window->GetNonClientNSView());
+ return CocoaLockFocusOnNSView(m_window->GetNonClientNSView());
+}
+
+bool wxWindowDC::CocoaUnlockFocus()
+{
+ wxLogDebug("Unlocking focus on wxWindowDC=%p, NSView=%p",this, m_window->GetNonClientNSView());
+ return CocoaUnlockFocusOnNSView();
+}
+