From cad8eed6e47fc302eb25f8611690c00d42025c7b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 5 Apr 2018 21:39:53 -0500 Subject: [PATCH] Use ui:view's Activate() on Linux (#12539) In NativeWindowViews, we started rolling our own _NET_ACTIVE_WINDOW event in June 2016 to raise windows because Chromium's implementation wasn't working as expected. (See commit 32b692b6) I'm not seeing this behavior in our current version of libcc, so I wonder if this workaround is still needed? --- atom/browser/native_window_views.cc | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index b97601a7d6f..b1f7c3ee106 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -98,21 +98,6 @@ bool IsAltModifier(const content::NativeWebKeyboardEvent& event) { (modifiers == (Modifiers::kAltKey | Modifiers::kIsRight)); } -#if defined(USE_X11) -int SendClientEvent(XDisplay* display, ::Window window, const char* msg) { - XEvent event = {}; - event.xclient.type = ClientMessage; - event.xclient.send_event = True; - event.xclient.message_type = XInternAtom(display, msg, False); - event.xclient.window = window; - event.xclient.format = 32; - XSendEvent(display, DefaultRootWindow(display), False, - SubstructureRedirectMask | SubstructureNotifyMask, &event); - XFlush(display); - return True; -} -#endif - class NativeWindowClientView : public views::ClientView { public: NativeWindowClientView(views::Widget* widget, @@ -365,15 +350,7 @@ void NativeWindowViews::Focus(bool focus) { return; if (focus) { -#if defined(OS_WIN) window_->Activate(); -#elif defined(USE_X11) - // The "Activate" implementation of Chromium is not reliable on Linux. - ::Window window = GetAcceleratedWidget(); - XDisplay* xdisplay = gfx::GetXDisplay(); - SendClientEvent(xdisplay, window, "_NET_ACTIVE_WINDOW"); - XMapRaised(xdisplay, window); -#endif } else { window_->Deactivate(); }