mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-16 20:20:51 +01:00
Add |has_external_parent| flag in Chromium patches to avoid behavior changes
when the widget is not parented to an external window (issue #1749).
This commit is contained in:
parent
1f86d24d48
commit
e0974ea64d
@ -2676,6 +2676,11 @@ void CefBrowserHostImpl::RenderViewCreated(
|
||||
registrar_->Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host));
|
||||
}
|
||||
|
||||
// Indicate that the view has an external parent (namely us). This changes the
|
||||
// default view behavior in some cases (e.g. focus handling on Linux).
|
||||
if (render_view_host->GetView())
|
||||
render_view_host->GetView()->SetHasExternalParent(true);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderViewDeleted(
|
||||
|
@ -51,16 +51,11 @@ patches = [
|
||||
{
|
||||
# Allow specification of a parent window handle for Widget creation.
|
||||
# https://code.google.com/p/chromiumembedded/issues/detail?id=180
|
||||
# Fix focus/activation handling and keyboard input on Windows.
|
||||
# Fix focus/activation handling and keyboard input on Windows and Linux.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1677
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1679
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1700
|
||||
'name': 'views_widget_180_1677',
|
||||
'path': '../ui/views/widget/',
|
||||
},
|
||||
{
|
||||
# Fix focus/activation handling and keyboard input on Linux.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1679
|
||||
'name': 'x11_desktop_handler_focus',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
|
@ -1,7 +1,86 @@
|
||||
diff --git desktop_aura/desktop_screen_win.cc desktop_aura/desktop_screen_win.cc
|
||||
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
index c7aac43..ae08073 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
@@ -758,6 +758,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
|
||||
::SetFocus(host->GetAcceleratedWidget());
|
||||
}
|
||||
#endif
|
||||
+#if defined(OS_LINUX)
|
||||
+ if (has_external_parent_ && CanFocus()) {
|
||||
+ aura::WindowTreeHost* host = window_->GetHost();
|
||||
+ if (host)
|
||||
+ host->Show();
|
||||
+ }
|
||||
+#endif
|
||||
if (host_ && set_focus_on_mouse_down_) {
|
||||
set_focus_on_mouse_down_ = false;
|
||||
host_->Focus();
|
||||
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
|
||||
index 1b40705..52599e5 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_base.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_view_base.cc
|
||||
@@ -374,6 +374,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase()
|
||||
current_device_scale_factor_(0),
|
||||
current_display_rotation_(gfx::Display::ROTATE_0),
|
||||
pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
|
||||
+ has_external_parent_(false),
|
||||
renderer_frame_number_(0),
|
||||
weak_factory_(this) {
|
||||
}
|
||||
@@ -568,6 +569,10 @@ void RenderWidgetHostViewBase::EndFrameSubscription() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
+void RenderWidgetHostViewBase::SetHasExternalParent(bool val) {
|
||||
+ has_external_parent_ = val;
|
||||
+}
|
||||
+
|
||||
uint32 RenderWidgetHostViewBase::RendererFrameNumber() {
|
||||
return renderer_frame_number_;
|
||||
}
|
||||
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
|
||||
index 2fbfb1e..33aa009 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_base.h
|
||||
+++ content/browser/renderer_host/render_widget_host_view_base.h
|
||||
@@ -78,6 +78,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
void BeginFrameSubscription(
|
||||
scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
|
||||
void EndFrameSubscription() override;
|
||||
+ void SetHasExternalParent(bool val) override;
|
||||
|
||||
// IPC::Listener implementation:
|
||||
bool OnMessageReceived(const IPC::Message& msg) override;
|
||||
@@ -416,6 +417,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
// renderer.
|
||||
bool pinch_zoom_enabled_;
|
||||
|
||||
+ // True if the widget has a external parent view/window outside of the
|
||||
+ // Chromium-controlled view/window hierarchy.
|
||||
+ bool has_external_parent_;
|
||||
+
|
||||
private:
|
||||
void FlushInput();
|
||||
|
||||
diff --git content/public/browser/render_widget_host_view.h content/public/browser/render_widget_host_view.h
|
||||
index d503fa9..5a7ea6c 100644
|
||||
--- content/public/browser/render_widget_host_view.h
|
||||
+++ content/public/browser/render_widget_host_view.h
|
||||
@@ -146,6 +146,10 @@ class CONTENT_EXPORT RenderWidgetHostView {
|
||||
// deleted after this call.
|
||||
virtual void EndFrameSubscription() = 0;
|
||||
|
||||
+ // Set whether the widget has a external parent view/window outside of the
|
||||
+ // Chromium-controlled view/window hierarchy.
|
||||
+ virtual void SetHasExternalParent(bool val) = 0;
|
||||
+
|
||||
#if defined(OS_MACOSX)
|
||||
// Set the view's active state (i.e., tint state of controls).
|
||||
virtual void SetActive(bool active) = 0;
|
||||
diff --git ui/views/widget/desktop_aura/desktop_screen_win.cc ui/views/widget/desktop_aura/desktop_screen_win.cc
|
||||
index a8e088c..838b6a0 100644
|
||||
--- desktop_aura/desktop_screen_win.cc
|
||||
+++ desktop_aura/desktop_screen_win.cc
|
||||
--- ui/views/widget/desktop_aura/desktop_screen_win.cc
|
||||
+++ ui/views/widget/desktop_aura/desktop_screen_win.cc
|
||||
@@ -32,6 +32,8 @@ gfx::Display DesktopScreenWin::GetDisplayMatching(
|
||||
}
|
||||
|
||||
@ -11,44 +90,78 @@ index a8e088c..838b6a0 100644
|
||||
aura::WindowTreeHost* host = window->GetHost();
|
||||
return host ? host->GetAcceleratedWidget() : NULL;
|
||||
}
|
||||
diff --git desktop_aura/desktop_window_tree_host_win.cc desktop_aura/desktop_window_tree_host_win.cc
|
||||
index 270bd54..72748cf 100644
|
||||
--- desktop_aura/desktop_window_tree_host_win.cc
|
||||
+++ desktop_aura/desktop_window_tree_host_win.cc
|
||||
@@ -131,7 +131,9 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
index 270bd54..53d979b 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
@@ -85,6 +85,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
|
||||
should_animate_window_close_(false),
|
||||
pending_close_(false),
|
||||
has_non_client_view_(false),
|
||||
+ has_external_parent_(false),
|
||||
tooltip_(NULL) {
|
||||
}
|
||||
|
||||
@@ -131,8 +132,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
|
||||
native_widget_delegate_);
|
||||
|
||||
HWND parent_hwnd = NULL;
|
||||
- if (params.parent && params.parent->GetHost())
|
||||
+ if (params.parent_widget)
|
||||
+ if (params.parent_widget) {
|
||||
+ parent_hwnd = params.parent_widget;
|
||||
+ else if (params.parent && params.parent->GetHost())
|
||||
+ has_external_parent_ = true;
|
||||
+ } else if (params.parent && params.parent->GetHost()) {
|
||||
parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget();
|
||||
+ }
|
||||
|
||||
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
|
||||
@@ -793,11 +795,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
|
||||
|
||||
@@ -793,11 +798,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
|
||||
}
|
||||
|
||||
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
|
||||
- // TODO(beng): inform the native_widget_delegate_.
|
||||
+ // See comments in CefBrowserHostImpl::PlatformSetFocus.
|
||||
+ if (CanActivate())
|
||||
+ if (has_external_parent_ && CanActivate())
|
||||
+ HandleActivationChanged(true);
|
||||
}
|
||||
|
||||
void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) {
|
||||
- // TODO(beng): inform the native_widget_delegate_.
|
||||
+ // See comments in CefBrowserHostImpl::PlatformSetFocus.
|
||||
+ if (CanActivate())
|
||||
+ if (has_external_parent_ && CanActivate())
|
||||
+ HandleActivationChanged(false);
|
||||
}
|
||||
|
||||
bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
|
||||
diff --git desktop_aura/desktop_window_tree_host_x11.cc desktop_aura/desktop_window_tree_host_x11.cc
|
||||
index ed0cb1d..62e3872 100644
|
||||
--- desktop_aura/desktop_window_tree_host_x11.cc
|
||||
+++ desktop_aura/desktop_window_tree_host_x11.cc
|
||||
@@ -172,7 +172,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
||||
index 363c019..97ada1d 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
|
||||
@@ -242,6 +242,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
|
||||
// Init time, before the Widget has created the NonClientView.
|
||||
bool has_non_client_view_;
|
||||
|
||||
+ // True if the widget has a external parent view/window outside of the
|
||||
+ // Chromium-controlled view/window hierarchy.
|
||||
+ bool has_external_parent_;
|
||||
+
|
||||
// Owned by TooltipController, but we need to forward events to it so we keep
|
||||
// a reference.
|
||||
corewm::TooltipWin* tooltip_;
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
index ed0cb1d..d4a2221 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
@@ -165,6 +165,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
||||
use_native_frame_(false),
|
||||
should_maximize_after_map_(false),
|
||||
use_argb_visual_(false),
|
||||
+ has_external_parent_(false),
|
||||
drag_drop_client_(NULL),
|
||||
native_widget_delegate_(native_widget_delegate),
|
||||
desktop_native_widget_aura_(desktop_native_widget_aura),
|
||||
@@ -172,7 +173,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
||||
window_parent_(NULL),
|
||||
custom_window_shape_(false),
|
||||
urgency_hint_set_(false),
|
||||
@ -58,7 +171,7 @@ index ed0cb1d..62e3872 100644
|
||||
}
|
||||
|
||||
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
|
||||
@@ -382,7 +383,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
||||
@@ -382,7 +384,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
||||
// Actually free our native resources.
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
||||
@ -68,7 +181,7 @@ index ed0cb1d..62e3872 100644
|
||||
xwindow_ = None;
|
||||
|
||||
desktop_native_widget_aura_->OnHostClosed();
|
||||
@@ -526,6 +528,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
|
||||
@@ -526,6 +529,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
|
||||
}
|
||||
|
||||
gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const {
|
||||
@ -77,7 +190,7 @@ index ed0cb1d..62e3872 100644
|
||||
return ToDIPRect(bounds_in_pixels_);
|
||||
}
|
||||
|
||||
@@ -963,6 +967,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
|
||||
@@ -963,6 +968,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
|
||||
}
|
||||
|
||||
gfx::Rect DesktopWindowTreeHostX11::GetBounds() const {
|
||||
@ -86,7 +199,7 @@ index ed0cb1d..62e3872 100644
|
||||
return bounds_in_pixels_;
|
||||
}
|
||||
|
||||
@@ -1020,6 +1026,8 @@ void DesktopWindowTreeHostX11::SetBounds(
|
||||
@@ -1020,6 +1027,8 @@ void DesktopWindowTreeHostX11::SetBounds(
|
||||
}
|
||||
|
||||
gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const {
|
||||
@ -95,13 +208,15 @@ index ed0cb1d..62e3872 100644
|
||||
return bounds_in_pixels_.origin();
|
||||
}
|
||||
|
||||
@@ -1133,9 +1141,13 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
||||
@@ -1133,9 +1142,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
||||
}
|
||||
}
|
||||
|
||||
+ gfx::AcceleratedWidget parent_widget = params.parent_widget;
|
||||
+ if (parent_widget == gfx::kNullAcceleratedWidget)
|
||||
+ parent_widget = x_root_window_;
|
||||
+ else
|
||||
+ has_external_parent_ = true;
|
||||
+
|
||||
bounds_in_pixels_ = ToPixelRect(params.bounds);
|
||||
bounds_in_pixels_.set_size(AdjustSize(bounds_in_pixels_.size()));
|
||||
@ -110,7 +225,7 @@ index ed0cb1d..62e3872 100644
|
||||
bounds_in_pixels_.y(), bounds_in_pixels_.width(),
|
||||
bounds_in_pixels_.height(),
|
||||
0, // border width
|
||||
@@ -1789,6 +1801,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
||||
@@ -1789,6 +1804,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -121,20 +236,24 @@ index ed0cb1d..62e3872 100644
|
||||
case FocusOut:
|
||||
if (xev->xfocus.mode != NotifyGrab) {
|
||||
ReleaseCapture();
|
||||
diff --git desktop_aura/desktop_window_tree_host_x11.h desktop_aura/desktop_window_tree_host_x11.h
|
||||
index 73e9e3e6..deb2cef 100644
|
||||
--- desktop_aura/desktop_window_tree_host_x11.h
|
||||
+++ desktop_aura/desktop_window_tree_host_x11.h
|
||||
@@ -85,6 +85,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
||||
index 73e9e3e6..8c2f0f7 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
||||
@@ -85,6 +85,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
// internal list of open windows.
|
||||
static void CleanUpWindowList(void (*func)(aura::Window* window));
|
||||
|
||||
+ void set_screen_bounds(const gfx::Rect& bounds) { screen_bounds_ = bounds; }
|
||||
+
|
||||
+ // Returns true if the widget has a external parent view/window outside of the
|
||||
+ // Chromium-controlled view/window hierarchy.
|
||||
+ bool has_external_parent() const { return has_external_parent_; }
|
||||
+
|
||||
protected:
|
||||
// Overridden from DesktopWindowTreeHost:
|
||||
void Init(aura::Window* content_window,
|
||||
@@ -265,6 +267,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
@@ -265,6 +271,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
// The bounds of |xwindow_|.
|
||||
gfx::Rect bounds_in_pixels_;
|
||||
|
||||
@ -144,7 +263,18 @@ index 73e9e3e6..deb2cef 100644
|
||||
// Whenever the bounds are set, we keep the previous set of bounds around so
|
||||
// we can have a better chance of getting the real
|
||||
// |restored_bounds_in_pixels_|. Window managers tend to send a Configure
|
||||
@@ -351,6 +356,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
@@ -301,6 +310,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
// Whether we used an ARGB visual for our window.
|
||||
bool use_argb_visual_;
|
||||
|
||||
+ // True if the widget has a external parent view/window outside of the
|
||||
+ // Chromium-controlled view/window hierarchy.
|
||||
+ bool has_external_parent_;
|
||||
+
|
||||
DesktopDragDropClientAuraX11* drag_drop_client_;
|
||||
|
||||
scoped_ptr<ui::EventHandler> x11_non_client_event_filter_;
|
||||
@@ -351,6 +364,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
|
||||
base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_;
|
||||
|
||||
@ -154,10 +284,71 @@ index 73e9e3e6..deb2cef 100644
|
||||
DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11);
|
||||
};
|
||||
|
||||
diff --git widget.cc widget.cc
|
||||
diff --git ui/views/widget/desktop_aura/x11_desktop_handler.cc ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
||||
index 5ab84f9..c4095fa 100644
|
||||
--- ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
||||
+++ ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
||||
@@ -31,6 +31,30 @@ views::X11DesktopHandler* g_handler = NULL;
|
||||
|
||||
namespace views {
|
||||
|
||||
+namespace {
|
||||
+
|
||||
+bool IsParentOfWindow(XDisplay* xdisplay,
|
||||
+ ::Window potential_parent,
|
||||
+ ::Window window) {
|
||||
+ ::Window parent_win, root_win;
|
||||
+ Window* child_windows;
|
||||
+ unsigned int num_child_windows;
|
||||
+ while (window) {
|
||||
+ if (!XQueryTree(xdisplay, window, &root_win, &parent_win,
|
||||
+ &child_windows, &num_child_windows)) {
|
||||
+ break;
|
||||
+ }
|
||||
+ if(child_windows)
|
||||
+ XFree(child_windows);
|
||||
+ if (parent_win == potential_parent)
|
||||
+ return true;
|
||||
+ window = parent_win;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
// static
|
||||
X11DesktopHandler* X11DesktopHandler::get() {
|
||||
if (!g_handler)
|
||||
@@ -86,7 +110,11 @@ void X11DesktopHandler::ActivateWindow(::Window window) {
|
||||
// in an active X window.
|
||||
}
|
||||
|
||||
- if (wm_supports_active_window_) {
|
||||
+ DesktopWindowTreeHostX11* host =
|
||||
+ DesktopWindowTreeHostX11::GetHostForXID(window);
|
||||
+ const bool has_external_parent = host && host->has_external_parent();
|
||||
+
|
||||
+ if (wm_supports_active_window_ && !has_external_parent) {
|
||||
DCHECK_EQ(gfx::GetXDisplay(), xdisplay_);
|
||||
|
||||
// If the window is not already active, send a hint to activate it
|
||||
@@ -175,8 +203,10 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
::Window window;
|
||||
if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) &&
|
||||
window) {
|
||||
- x_active_window_ = window;
|
||||
- OnActiveWindowChanged(window, ACTIVE);
|
||||
+ if (!IsParentOfWindow(xdisplay_, window, current_window_)) {
|
||||
+ x_active_window_ = window;
|
||||
+ OnActiveWindowChanged(window, ACTIVE);
|
||||
+ }
|
||||
} else {
|
||||
x_active_window_ = None;
|
||||
}
|
||||
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
||||
index 154d107..cf276b1 100644
|
||||
--- widget.cc
|
||||
+++ widget.cc
|
||||
--- ui/views/widget/widget.cc
|
||||
+++ ui/views/widget/widget.cc
|
||||
@@ -119,6 +119,7 @@ Widget::InitParams::InitParams()
|
||||
use_system_default_icon(false),
|
||||
show_state(ui::SHOW_STATE_DEFAULT),
|
||||
@ -197,10 +388,10 @@ index 154d107..cf276b1 100644
|
||||
}
|
||||
// This must come after SetContentsView() or it might not be able to find
|
||||
// the correct NativeTheme (on Linux). See http://crbug.com/384492
|
||||
diff --git widget.h widget.h
|
||||
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
||||
index 1342625..7fbc24c 100644
|
||||
--- widget.h
|
||||
+++ widget.h
|
||||
--- ui/views/widget/widget.h
|
||||
+++ ui/views/widget/widget.h
|
||||
@@ -232,6 +232,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
||||
// Whether the widget should be maximized or minimized.
|
||||
ui::WindowShowState show_state;
|
||||
|
@ -1,82 +0,0 @@
|
||||
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
index c7aac43..89817b7 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
@@ -758,6 +758,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
|
||||
::SetFocus(host->GetAcceleratedWidget());
|
||||
}
|
||||
#endif
|
||||
+#if defined(OS_LINUX)
|
||||
+ if (CanFocus()) {
|
||||
+ aura::WindowTreeHost* host = window_->GetHost();
|
||||
+ if (host)
|
||||
+ host->Show();
|
||||
+ }
|
||||
+#endif
|
||||
if (host_ && set_focus_on_mouse_down_) {
|
||||
set_focus_on_mouse_down_ = false;
|
||||
host_->Focus();
|
||||
diff --git ui/views/widget/desktop_aura/x11_desktop_handler.cc ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
||||
index 5ab84f9..1052e2c 100644
|
||||
--- ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
||||
+++ ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
||||
@@ -31,6 +31,30 @@ views::X11DesktopHandler* g_handler = NULL;
|
||||
|
||||
namespace views {
|
||||
|
||||
+namespace {
|
||||
+
|
||||
+bool IsParentOfWindow(XDisplay* xdisplay,
|
||||
+ ::Window potential_parent,
|
||||
+ ::Window window) {
|
||||
+ ::Window parent_win, root_win;
|
||||
+ Window* child_windows;
|
||||
+ unsigned int num_child_windows;
|
||||
+ while (window) {
|
||||
+ if (!XQueryTree(xdisplay, window, &root_win, &parent_win,
|
||||
+ &child_windows, &num_child_windows)) {
|
||||
+ break;
|
||||
+ }
|
||||
+ if(child_windows)
|
||||
+ XFree(child_windows);
|
||||
+ if (parent_win == potential_parent)
|
||||
+ return true;
|
||||
+ window = parent_win;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
// static
|
||||
X11DesktopHandler* X11DesktopHandler::get() {
|
||||
if (!g_handler)
|
||||
@@ -58,14 +82,7 @@ X11DesktopHandler::X11DesktopHandler()
|
||||
attr.your_event_mask | PropertyChangeMask |
|
||||
StructureNotifyMask | SubstructureNotifyMask);
|
||||
|
||||
- if (ui::GuessWindowManager() == ui::WM_WMII) {
|
||||
- // wmii says that it supports _NET_ACTIVE_WINDOW but does not.
|
||||
- // https://code.google.com/p/wmii/issues/detail?id=266
|
||||
- wm_supports_active_window_ = false;
|
||||
- } else {
|
||||
- wm_supports_active_window_ =
|
||||
- ui::WmSupportsHint(atom_cache_.GetAtom("_NET_ACTIVE_WINDOW"));
|
||||
- }
|
||||
+ wm_supports_active_window_ = false;
|
||||
}
|
||||
|
||||
X11DesktopHandler::~X11DesktopHandler() {
|
||||
@@ -175,8 +192,10 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
::Window window;
|
||||
if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) &&
|
||||
window) {
|
||||
- x_active_window_ = window;
|
||||
- OnActiveWindowChanged(window, ACTIVE);
|
||||
+ if (!IsParentOfWindow(xdisplay_, window, current_window_)) {
|
||||
+ x_active_window_ = window;
|
||||
+ OnActiveWindowChanged(window, ACTIVE);
|
||||
+ }
|
||||
} else {
|
||||
x_active_window_ = None;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user