Replaced obviously incorrect code for SetFocus and DoFindFocus.
Effectively reverts revision 1.53. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -25,6 +25,8 @@
|
|||||||
#import <AppKit/NSColor.h>
|
#import <AppKit/NSColor.h>
|
||||||
#import <AppKit/NSClipView.h>
|
#import <AppKit/NSClipView.h>
|
||||||
#import <Foundation/NSException.h>
|
#import <Foundation/NSException.h>
|
||||||
|
#import <AppKit/NSApplication.h>
|
||||||
|
#import <AppKit/NSWindow.h>
|
||||||
|
|
||||||
// Turn this on to paint green over the dummy views for debugging
|
// Turn this on to paint green over the dummy views for debugging
|
||||||
#undef WXCOCOA_FILL_DUMMY_VIEW
|
#undef WXCOCOA_FILL_DUMMY_VIEW
|
||||||
@@ -706,14 +708,8 @@ void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
|
|||||||
|
|
||||||
void wxWindow::SetFocus()
|
void wxWindow::SetFocus()
|
||||||
{
|
{
|
||||||
#ifdef __WXDEBUG__
|
if([GetNSView() acceptsFirstResponder])
|
||||||
bool bOK =
|
[[GetNSView() window] makeFirstResponder: GetNSView()];
|
||||||
#endif
|
|
||||||
[GetNSView() lockFocusIfCanDraw];
|
|
||||||
|
|
||||||
//Note that the normal lockFocus works on hidden and minimized windows
|
|
||||||
//and has no return value - which probably isn't what we want
|
|
||||||
wxASSERT(bOK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::DoCaptureMouse()
|
void wxWindow::DoCaptureMouse()
|
||||||
@@ -894,12 +890,30 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
|
|||||||
// Get the window with the focus
|
// Get the window with the focus
|
||||||
wxWindow *wxWindowBase::DoFindFocus()
|
wxWindow *wxWindowBase::DoFindFocus()
|
||||||
{
|
{
|
||||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa([NSView focusView]);
|
// Basically we are somewhat emulating the responder chain here except
|
||||||
|
// we are only loking for the first responder in the key window or
|
||||||
|
// upon failing to find one if the main window is different we look
|
||||||
|
// for the first responder in the main window.
|
||||||
|
|
||||||
if (!win)
|
// Note that the firstResponder doesn't necessarily have to be an
|
||||||
return NULL;
|
// NSView but wxCocoaNSView::GetFromCocoa() will simply return
|
||||||
|
// NULL unless it finds its argument in its hash map.
|
||||||
|
|
||||||
|
wxCocoaNSView *win;
|
||||||
|
|
||||||
|
NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow];
|
||||||
|
win = wxCocoaNSView::GetFromCocoa([keyWindow firstResponder]);
|
||||||
|
if(win)
|
||||||
return win->GetWxWindow();
|
return win->GetWxWindow();
|
||||||
|
|
||||||
|
NSWindow *mainWindow = [[NSApplication sharedApplication] keyWindow];
|
||||||
|
if(mainWindow == keyWindow)
|
||||||
|
return NULL;
|
||||||
|
win = wxCocoaNSView::GetFromCocoa([mainWindow firstResponder]);
|
||||||
|
if(win)
|
||||||
|
return win->GetWxWindow();
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ wxWindow *wxWindowBase::GetCapture()
|
/* static */ wxWindow *wxWindowBase::GetCapture()
|
||||||
|
Reference in New Issue
Block a user