Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
index d02dede8a7569828789be42e5724717dd6c3940d..b717445ddfe8b51a8a54ef66bf3fb62aec68a819 100644 |
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
@@ -29,6 +29,7 @@ |
#include "ui/events/devices/x11/device_list_cache_x11.h" |
#include "ui/events/devices/x11/touch_factory_x11.h" |
#include "ui/events/event_utils.h" |
+#include "ui/events/null_event_targeter.h" |
#include "ui/events/platform/platform_event_source.h" |
#include "ui/events/platform/x11/x11_event_source.h" |
#include "ui/gfx/display.h" |
@@ -173,6 +174,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( |
custom_window_shape_(false), |
urgency_hint_set_(false), |
activatable_(true), |
+ modal_dialog_xid_(0), |
close_widget_factory_(this) { |
} |
@@ -1529,7 +1531,8 @@ void DesktopWindowTreeHostX11::DispatchTouchEvent(ui::TouchEvent* event) { |
} |
void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) { |
- GetInputMethod()->DispatchKeyEvent(event); |
+ if (native_widget_delegate_->AsWidget()->IsActive()) |
+ GetInputMethod()->DispatchKeyEvent(event); |
} |
void DesktopWindowTreeHostX11::ConvertEventToDifferentHost( |
@@ -2049,6 +2052,26 @@ gfx::Rect DesktopWindowTreeHostX11::ToPixelRect( |
return gfx::ToEnclosingRect(rect_in_pixels); |
} |
+const XID DesktopWindowTreeHostX11::GetModalDialog() { |
+ return modal_dialog_xid_; |
+} |
+ |
+void DesktopWindowTreeHostX11::DisableEventListening(XID dialog) { |
+ DCHECK(dialog); |
+ DCHECK(!modal_dialog_xid_); |
+ modal_dialog_xid_ = dialog; |
+ // ScopedWindowTargeter is used to temporarily replace the event-targeter |
+ // with NullEventTargeter to make |dialog| modal. |
+ targeter_for_modal_.reset(new aura::ScopedWindowTargeter(window(), |
+ scoped_ptr<ui::EventTargeter>(new ui::NullEventTargeter))); |
+} |
+ |
+void DesktopWindowTreeHostX11::EnableEventListening() { |
+ DCHECK(modal_dialog_xid_); |
+ modal_dialog_xid_ = 0; |
+ targeter_for_modal_.reset(); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// DesktopWindowTreeHost, public: |