| 689 | } |
| 690 | |
| 691 | int ToolManager::FilterEvent(wxEvent &event) |
| 692 | { |
| 693 | // Snoop the global event stream for changes of focused window. Remember |
| 694 | // the last one of our own that is not a grabber. |
| 695 | |
| 696 | if (event.GetEventType() == wxEVT_KILL_FOCUS) { |
| 697 | auto &focusEvent = static_cast<wxFocusEvent&>(event); |
| 698 | auto window = focusEvent.GetWindow(); |
| 699 | auto top = wxGetTopLevelParent(window); |
| 700 | if(auto toolFrame = dynamic_cast<ToolFrame*>(top)) |
| 701 | top = toolFrame->GetParent(); |
| 702 | // window is that which will GET the focus |
| 703 | if ( window && |
| 704 | !dynamic_cast<Grabber*>( window ) && |
| 705 | !dynamic_cast<ToolFrame*>( window ) && |
| 706 | top == FindProjectFrame( mParent ) ) |
| 707 | // Note this is a dangle-proof wxWindowRef: |
| 708 | mLastFocus = window; |
| 709 | } |
| 710 | |
| 711 | return Event_Skip; |
| 712 | } |
| 713 | |
| 714 | // |
| 715 | // Read the toolbar states |
nothing calls this directly
no test coverage detected