Commit 89ce5e63 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Replace X11 includes in //gpu with ui/gfx/x/x11.h

X11 header files are infamous for creating macros with common
names such as None, True, False, Status, Bool, ...

To save oursaves the mess that creates, they are now wrapped
in a header, ui/gfx/x/x11.h, which puts those symbols in the
x11 namespace and removes the global macros.

Bug: 782184
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I10a9acecb8e7adacd170d1080a411bc9d1e49f79
Reviewed-on: https://chromium-review.googlesource.com/806275Reviewed-by: default avatarVictor Miura <vmiura@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#521659}
parent 812775b6
......@@ -29,8 +29,7 @@
#endif
#if defined(USE_X11)
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include "ui/gfx/x/x11.h"
#endif
namespace gpu {
......@@ -70,7 +69,7 @@ GpuWatchdogThread::GpuWatchdogThread()
#if defined(USE_X11)
display_(NULL),
window_(0),
atom_(None),
atom_(x11::None),
host_tty_(-1),
#endif
weak_factory_(this) {
......@@ -428,7 +427,7 @@ void GpuWatchdogThread::SetupXServer() {
display_ = XOpenDisplay(NULL);
window_ = XCreateWindow(display_, DefaultRootWindow(display_), 0, 0, 1, 1, 0,
CopyFromParent, InputOutput, CopyFromParent, 0, NULL);
atom_ = XInternAtom(display_, "CHECK", False);
atom_ = XInternAtom(display_, "CHECK", x11::False);
host_tty_ = GetActiveTTY();
}
......
......@@ -4,9 +4,8 @@
#include "gpu/vulkan/tests/native_window.h"
#include <X11/Xlib.h>
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/x/x11.h"
#include "ui/gfx/x/x11_types.h"
namespace gpu {
......@@ -15,7 +14,7 @@ gfx::AcceleratedWidget CreateNativeWindow(const gfx::Rect& bounds) {
XDisplay* display = gfx::GetXDisplay();
XSetWindowAttributes swa;
swa.event_mask = StructureNotifyMask | ExposureMask;
swa.override_redirect = True;
swa.override_redirect = x11::True;
XID window = XCreateWindow(
display, RootWindow(display, DefaultScreen(display)), // parent
bounds.x(), bounds.y(), bounds.width(), bounds.height(),
......
......@@ -21,10 +21,11 @@ extern "C" {
#define VK_USE_PLATFORM_ANDROID_KHR
#endif
// This section below is taken from <vulkan/vulkan.h>
// This section below is taken from <vulkan/vulkan.h>, with an include
// of <X11/Xlib.h> replaced with an include of "ui/gfx/x/x11.h"
#ifdef VK_USE_PLATFORM_XLIB_KHR
#define VK_KHR_xlib_surface 1
#include <X11/Xlib.h>
#include "ui/gfx/x/x11.h"
#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment