Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 1233913009: Make File-Picker modal on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not feed key events to the input method when the window lost focus Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 94a1cc2c8bce20bbdc56a50ca37debbb241b9249..bf6699c959ffdd5c350511231f3542db231e2333 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"
@@ -172,6 +173,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
window_parent_(NULL),
custom_window_shape_(false),
urgency_hint_set_(false),
+ modal_dialog_xid_(0),
close_widget_factory_(this) {
}
@@ -1520,7 +1522,9 @@ void DesktopWindowTreeHostX11::DispatchTouchEvent(ui::TouchEvent* event) {
}
void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) {
- GetInputMethod()->DispatchKeyEvent(event);
+ views::Widget* widget = native_widget_delegate_->AsWidget();
msw 2015/09/16 23:10:04 nit: inline this in the if statement below.
joone 2015/09/16 23:40:31 Done.
+ if (widget->IsActive())
+ GetInputMethod()->DispatchKeyEvent(event);
joone 2015/09/16 22:42:55 We don't need to feed key events to the input meth
msw 2015/09/16 23:10:04 This seems reasonable, but other reviewers on the
joone 2015/09/16 23:40:31 Acknowledged.
}
void DesktopWindowTreeHostX11::ConvertEventToDifferentHost(
@@ -2039,6 +2043,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:
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | ui/views/widget/desktop_aura/x11_desktop_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698