Changeset 58231 in webkit
- Timestamp:
- Apr 25, 2010 3:03:59 PM (14 years ago)
- Location:
- trunk/WebKit/wx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/wx/ChangeLog
r57927 r58231 1 2010-04-25 Kevin Watters <kevinwatters@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Update focus handling code to match current approaches used by other platforms, 6 and fix focus handling for corner cases such as when a mouse down pops up a dialog. 7 8 https://bugs.webkit.org/show_bug.cgi?id=38086 9 10 * WebView.cpp: 11 (wxWebView::Create): 12 (wxWebView::OnTLWActivated): 13 (wxWebView::OnPaint): 14 (wxWebView::OnMouseEvents): 15 (wxWebView::OnSetFocus): 16 (wxWebView::OnKillFocus): 17 * WebView.h: 18 1 19 2010-04-20 Adam Barth <abarth@webkit.org> 2 20 -
trunk/WebKit/wx/WebView.cpp
r56825 r58231 341 341 #endif 342 342 343 wxWindow* tlw = wxGetTopLevelParent(this); 344 tlw->Connect(-1, wxEVT_ACTIVATE, wxActivateEventHandler(wxWebView::OnTLWActivated)); 345 343 346 m_isInitialized = true; 344 347 … … 358 361 delete m_impl->page; 359 362 m_impl->page = 0; 363 } 364 365 void wxWebView::OnTLWActivated(wxActivateEvent& event) 366 { 367 if (m_impl && m_impl->page && m_impl->page->focusController()) 368 m_impl->page->focusController()->setActive(event.GetActive()); 369 370 event.Skip(); 371 360 372 } 361 373 … … 529 541 return; 530 542 531 // WebView active state is based on TLW active state.532 wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this));533 if (tlw && tlw->IsActive())534 m_impl->page->focusController()->setActive(true);535 else {536 m_impl->page->focusController()->setActive(false);537 }538 543 WebCore::Frame* frame = m_mainFrame->GetFrame(); 539 544 if (!frame || !frame->view()) … … 621 626 } 622 627 628 // If an event, such as a right-click event, leads to a focus change (e.g. it 629 // raises a dialog), WebKit never gets the mouse up event and never relinquishes 630 // mouse capture. This leads to WebKit handling mouse events, such as modifying 631 // the selection, while other controls or top level windows have the focus. 632 // I'm not sure if this is the right place to handle this, but I can't seem to 633 // find a precedent on how to handle this in other ports. 634 if (wxWindow::FindFocus() != this) { 635 while (HasCapture()) 636 ReleaseMouse(); 637 638 frame->eventHandler()->setMousePressed(false); 639 640 return; 641 } 642 623 643 int clickCount = event.ButtonDClick() ? 2 : 1; 624 644 … … 883 903 void wxWebView::OnSetFocus(wxFocusEvent& event) 884 904 { 885 WebCore::Frame* frame = 0;886 if (m_mainFrame)887 frame = m_mainFrame->GetFrame();888 889 if (frame) {890 frame->selection()->setFocused(true);905 if (m_impl && m_impl->page && m_impl->page->focusController()) { 906 m_impl->page->focusController()->setFocused(true); 907 m_impl->page->focusController()->setActive(true); 908 909 if (!m_impl->page->focusController()->focusedFrame() && m_mainFrame) 910 m_impl->page->focusController()->setFocusedFrame(m_mainFrame->GetFrame()); 891 911 } 892 912 893 913 event.Skip(); 894 914 } … … 896 916 void wxWebView::OnKillFocus(wxFocusEvent& event) 897 917 { 898 WebCore::Frame* frame = 0; 899 if (m_mainFrame) 900 frame = m_mainFrame->GetFrame(); 901 902 if (frame) { 903 frame->selection()->setFocused(false); 918 if (m_impl && m_impl->page && m_impl->page->focusController()) { 919 m_impl->page->focusController()->setFocused(false); 920 921 // We also handle active state in OnTLWActivated, but if a user does not 922 // call event.Skip() in their own EVT_ACTIVATE handler, we won't get those 923 // callbacks. So we handle active state here as well as a fallback. 924 wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this)); 925 if (tlw && tlw->IsActive()) 926 m_impl->page->focusController()->setActive(true); 927 else 928 m_impl->page->focusController()->setActive(false); 904 929 } 930 931 while (HasCapture()) 932 ReleaseMouse(); 933 905 934 event.Skip(); 906 935 } -
trunk/WebKit/wx/WebView.h
r56309 r58231 227 227 void OnSetFocus(wxFocusEvent& event); 228 228 void OnKillFocus(wxFocusEvent& event); 229 void OnTLWActivated(wxActivateEvent& event); 229 230 230 231 private:
Note: See TracChangeset
for help on using the changeset viewer.