From 82d204e932c3d94dc4e2195bae1a6c79a045e899 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Wed, 18 Apr 2018 18:52:58 +0200 Subject: [PATCH] Wrap X11 headers in ui/gfx/x/x11.h https://chromium-review.googlesource.com/756711 --- atom/browser/native_window_views.cc | 6 +++--- atom/browser/ui/views/global_menu_bar_x11.cc | 11 +---------- atom/browser/ui/x/window_state_watcher.cc | 3 +-- atom/browser/ui/x/x_window_utils.cc | 10 +++++----- atom/browser/ui/x/x_window_utils.h | 6 ++---- .../extensions/global_shortcut_listener_x11.cc | 3 ++- .../browser/extensions/global_shortcut_listener_x11.h | 2 +- 7 files changed, 15 insertions(+), 26 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 697b849557d5..e174c362af66 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -192,8 +192,8 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options, if (options.Get(options::kDarkTheme, &use_dark_theme) && use_dark_theme) { XDisplay* xdisplay = gfx::GetXDisplay(); XChangeProperty(xdisplay, GetAcceleratedWidget(), - XInternAtom(xdisplay, "_GTK_THEME_VARIANT", False), - XInternAtom(xdisplay, "UTF8_STRING", False), 8, + XInternAtom(xdisplay, "_GTK_THEME_VARIANT", x11::False), + XInternAtom(xdisplay, "UTF8_STRING", x11::False), 8, PropModeReplace, reinterpret_cast("dark"), 4); } @@ -843,7 +843,7 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) { ShapeInput, 0, 0, &r, 1, ShapeSet, YXBanded); } else { XShapeCombineMask(gfx::GetXDisplay(), GetAcceleratedWidget(), ShapeInput, 0, - 0, None, ShapeSet); + 0, x11::None, ShapeSet); } #endif } diff --git a/atom/browser/ui/views/global_menu_bar_x11.cc b/atom/browser/ui/views/global_menu_bar_x11.cc index 155714c73f99..656bd8f991f8 100644 --- a/atom/browser/ui/views/global_menu_bar_x11.cc +++ b/atom/browser/ui/views/global_menu_bar_x11.cc @@ -4,16 +4,6 @@ #include "atom/browser/ui/views/global_menu_bar_x11.h" -#include - -// This conflicts with mate::Converter, -#undef True -#undef False -// and V8, -#undef None -// and url_request_status.h, -#undef Status - #include #include @@ -27,6 +17,7 @@ #include "ui/aura/window_tree_host.h" #include "ui/base/accelerators/menu_label_accelerator_util_linux.h" #include "ui/events/keycodes/keyboard_code_conversion_x.h" +#include "ui/gfx/x/x11.h" // libdbusmenu-glib types typedef struct _DbusmenuMenuitem DbusmenuMenuitem; diff --git a/atom/browser/ui/x/window_state_watcher.cc b/atom/browser/ui/x/window_state_watcher.cc index fa9dddac36e0..9eebc361d7d0 100644 --- a/atom/browser/ui/x/window_state_watcher.cc +++ b/atom/browser/ui/x/window_state_watcher.cc @@ -4,9 +4,8 @@ #include "atom/browser/ui/x/window_state_watcher.h" -#include - #include "ui/events/platform/platform_event_source.h" +#include "ui/gfx/x/x11.h" #include "ui/gfx/x/x11_atom_cache.h" namespace atom { diff --git a/atom/browser/ui/x/x_window_utils.cc b/atom/browser/ui/x/x_window_utils.cc index 0703e6ac2f3e..ecc2f906e584 100644 --- a/atom/browser/ui/x/x_window_utils.cc +++ b/atom/browser/ui/x/x_window_utils.cc @@ -29,12 +29,12 @@ void SetWMSpecState(::Window xwindow, bool enabled, ::Atom state) { xclient.xclient.format = 32; xclient.xclient.data.l[0] = enabled ? 1 : 0; xclient.xclient.data.l[1] = state; - xclient.xclient.data.l[2] = None; + xclient.xclient.data.l[2] = x11::None; xclient.xclient.data.l[3] = 1; xclient.xclient.data.l[4] = 0; XDisplay* xdisplay = gfx::GetXDisplay(); - XSendEvent(xdisplay, DefaultRootWindow(xdisplay), False, + XSendEvent(xdisplay, DefaultRootWindow(xdisplay), x11::False, SubstructureRedirectMask | SubstructureNotifyMask, &xclient); } @@ -42,10 +42,10 @@ void SetWindowType(::Window xwindow, const std::string& type) { XDisplay* xdisplay = gfx::GetXDisplay(); std::string type_prefix = "_NET_WM_WINDOW_TYPE_"; ::Atom window_type = XInternAtom( - xdisplay, (type_prefix + base::ToUpperASCII(type)).c_str(), False); + xdisplay, (type_prefix + base::ToUpperASCII(type)).c_str(), x11::False); XChangeProperty(xdisplay, xwindow, - XInternAtom(xdisplay, "_NET_WM_WINDOW_TYPE", False), XA_ATOM, - 32, PropModeReplace, + XInternAtom(xdisplay, "_NET_WM_WINDOW_TYPE", x11::False), + XA_ATOM, 32, PropModeReplace, reinterpret_cast(&window_type), 1); } diff --git a/atom/browser/ui/x/x_window_utils.h b/atom/browser/ui/x/x_window_utils.h index 78279c667fa5..5888a2b25663 100644 --- a/atom/browser/ui/x/x_window_utils.h +++ b/atom/browser/ui/x/x_window_utils.h @@ -5,12 +5,10 @@ #ifndef ATOM_BROWSER_UI_X_X_WINDOW_UTILS_H_ #define ATOM_BROWSER_UI_X_X_WINDOW_UTILS_H_ -#include -#include -#include - #include +#include "ui/gfx/x/x11.h" + namespace atom { ::Atom GetAtom(const char* name); diff --git a/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.cc b/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.cc index b73fe094f9c0..98f1108d56f1 100644 --- a/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.cc +++ b/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.cc @@ -11,6 +11,7 @@ #include "ui/base/accelerators/accelerator.h" #include "ui/events/keycodes/keyboard_code_conversion_x.h" #include "ui/events/platform/platform_event_source.h" +#include "ui/gfx/x/x11.h" #include "ui/gfx/x/x11_error_tracker.h" #include "ui/gfx/x/x11_types.h" @@ -111,7 +112,7 @@ bool GlobalShortcutListenerX11::RegisterAcceleratorImpl( // Caps lock, Scroll lock. See comment about |kModifiersMasks|. for (size_t i = 0; i < arraysize(kModifiersMasks); ++i) { XGrabKey(x_display_, keycode, modifiers | kModifiersMasks[i], - x_root_window_, False, GrabModeAsync, GrabModeAsync); + x_root_window_, x11::False, GrabModeAsync, GrabModeAsync); } if (err_tracker.FoundNewError()) { diff --git a/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.h b/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.h index 99f31d7f54ed..32953c4e166f 100644 --- a/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.h +++ b/chromium_src/chrome/browser/extensions/global_shortcut_listener_x11.h @@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ #define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_ -#include #include #include @@ -13,6 +12,7 @@ #include "base/macros.h" #include "chrome/browser/extensions/global_shortcut_listener.h" #include "ui/events/platform/platform_event_dispatcher.h" +#include "ui/gfx/x/x11.h" namespace extensions {