Browse Source

Wrap X11 headers in ui/gfx/x/x11.h

https://chromium-review.googlesource.com/756711
Aleksei Kuzmin 7 years ago
parent
commit
82d204e932

+ 3 - 3
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<const unsigned char*>("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
 }

+ 1 - 10
atom/browser/ui/views/global_menu_bar_x11.cc

@@ -4,16 +4,6 @@
 
 #include "atom/browser/ui/views/global_menu_bar_x11.h"
 
-#include <X11/Xlib.h>
-
-// This conflicts with mate::Converter,
-#undef True
-#undef False
-// and V8,
-#undef None
-// and url_request_status.h,
-#undef Status
-
 #include <dlfcn.h>
 #include <glib-object.h>
 
@@ -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;

+ 1 - 2
atom/browser/ui/x/window_state_watcher.cc

@@ -4,9 +4,8 @@
 
 #include "atom/browser/ui/x/window_state_watcher.h"
 
-#include <X11/Xlib.h>
-
 #include "ui/events/platform/platform_event_source.h"
+#include "ui/gfx/x/x11.h"
 #include "ui/gfx/x/x11_atom_cache.h"
 
 namespace atom {

+ 5 - 5
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<unsigned char*>(&window_type), 1);
 }
 

+ 2 - 4
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 <X11/Xlib.h>
-#include <X11/extensions/XInput2.h>
-#include <X11/extensions/Xrandr.h>
-
 #include <string>
 
+#include "ui/gfx/x/x11.h"
+
 namespace atom {
 
 ::Atom GetAtom(const char* name);

+ 2 - 1
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()) {

+ 1 - 1
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 <X11/Xlib.h>
 #include <stdint.h>
 
 #include <set>
@@ -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 {