Commit c0a7f167 authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

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

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

Use a wrapper header ui/gfx/x/x11.h to make our life easier.

Bug: 782184
Change-Id: I88e1093b9e3a8195395a23f0fd8291613586972f
Reviewed-on: https://chromium-review.googlesource.com/809047Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#521759}
parent e62d46f6
......@@ -4,13 +4,11 @@
#include "ui/platform_window/x11/x11_cursor_ozone.h"
#include <X11/Xcursor/Xcursor.h>
#include <X11/Xlib.h>
#include "base/logging.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/x/x11.h"
namespace ui {
......
......@@ -5,13 +5,12 @@
#ifndef UI_PLATFORM_WINDOW_X11_X11_CURSOR_OZONE_H_
#define UI_PLATFORM_WINDOW_X11_X11_CURSOR_OZONE_H_
#include <X11/X.h>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "ui/base/cursor/cursor.h"
#include "ui/gfx/x/x11.h"
#include "ui/platform_window/x11/x11_window_export.h"
class SkBitmap;
......@@ -43,7 +42,7 @@ class X11_WINDOW_EXPORT X11CursorOzone
X11CursorOzone();
~X11CursorOzone();
::Cursor xcursor_ = None;
::Cursor xcursor_ = x11::None;
DISALLOW_COPY_AND_ASSIGN(X11CursorOzone);
};
......
......@@ -4,15 +4,12 @@
#include "ui/platform_window/x11/x11_window.h"
#include <X11/extensions/XInput2.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "ui/events/devices/x11/touch_factory_x11.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/x/x11.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace ui {
......
......@@ -4,11 +4,6 @@
#include "ui/platform_window/x11/x11_window_base.h"
#include <X11/extensions/XInput2.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <string>
#include "base/strings/utf_string_conversions.h"
......@@ -40,7 +35,7 @@ X11WindowBase::X11WindowBase(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds)
: delegate_(delegate),
xdisplay_(gfx::GetXDisplay()),
xwindow_(None),
xwindow_(x11::None),
xroot_window_(DefaultRootWindow(xdisplay_)),
bounds_(bounds) {
DCHECK(delegate_);
......@@ -51,13 +46,13 @@ X11WindowBase::~X11WindowBase() {
}
void X11WindowBase::Destroy() {
if (xwindow_ == None)
if (xwindow_ == x11::None)
return;
// Stop processing events.
XID xwindow = xwindow_;
XDisplay* xdisplay = xdisplay_;
xwindow_ = None;
xwindow_ = x11::None;
delegate_->OnClosed();
// |this| might be deleted because of the above call.
......@@ -69,7 +64,7 @@ void X11WindowBase::Create() {
XSetWindowAttributes swa;
memset(&swa, 0, sizeof(swa));
swa.background_pixmap = None;
swa.background_pixmap = x11::None;
swa.bit_gravity = NorthWestGravity;
swa.override_redirect = UseTestConfigForPlatformWindows();
xwindow_ =
......@@ -146,7 +141,7 @@ void X11WindowBase::Create() {
void X11WindowBase::Show() {
if (window_mapped_)
return;
if (xwindow_ == None)
if (xwindow_ == x11::None)
Create();
XMapWindow(xdisplay_, xwindow_);
......@@ -171,7 +166,7 @@ void X11WindowBase::Close() {
}
void X11WindowBase::SetBounds(const gfx::Rect& bounds) {
if (xwindow_ != None) {
if (xwindow_ != x11::None) {
XWindowChanges changes = {0};
unsigned value_mask = 0;
......@@ -220,7 +215,7 @@ void X11WindowBase::SetTitle(const base::string16& title) {
XTextProperty xtp;
char* c_utf8_str = const_cast<char*>(utf8str.c_str());
if (Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1, XUTF8StringStyle,
&xtp) == Success) {
&xtp) == x11::Success) {
XSetWMName(xdisplay_, xwindow_, &xtp);
XFree(xtp.value);
}
......@@ -239,7 +234,7 @@ void X11WindowBase::Minimize() {}
void X11WindowBase::Restore() {}
void X11WindowBase::MoveCursorTo(const gfx::Point& location) {
XWarpPointer(xdisplay_, None, xroot_window_, 0, 0, 0, 0,
XWarpPointer(xdisplay_, x11::None, xroot_window_, 0, 0, 0, 0,
bounds_.x() + location.x(), bounds_.y() + location.y());
}
......@@ -250,7 +245,7 @@ PlatformImeController* X11WindowBase::GetPlatformImeController() {
}
bool X11WindowBase::IsEventForXWindow(const XEvent& xev) const {
return xwindow_ != None && FindXEventTarget(xev) == xwindow_;
return xwindow_ != x11::None && FindXEventTarget(xev) == xwindow_;
}
void X11WindowBase::ProcessXWindowEvent(XEvent* xev) {
......@@ -298,7 +293,7 @@ void X11WindowBase::ProcessXWindowEvent(XEvent* xev) {
XEvent reply_event = *xev;
reply_event.xclient.window = xroot_window_;
XSendEvent(xdisplay_, reply_event.xclient.window, False,
XSendEvent(xdisplay_, reply_event.xclient.window, x11::False,
SubstructureRedirectMask | SubstructureNotifyMask,
&reply_event);
XFlush(xdisplay_);
......
......@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/x/x11.h"
#include "ui/gfx/x/x11_types.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
......
......@@ -4,13 +4,12 @@
#include "ui/platform_window/x11/x11_window_ozone.h"
#include <X11/Xlib.h>
#include "base/bind.h"
#include "ui/events/event.h"
#include "ui/events/ozone/events_ozone.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/x/x11.h"
#include "ui/platform_window/x11/x11_cursor_ozone.h"
#include "ui/platform_window/x11/x11_window_manager_ozone.h"
......@@ -50,7 +49,7 @@ void X11WindowOzone::SetCursor(PlatformCursor cursor) {
}
void X11WindowOzone::CheckCanDispatchNextPlatformEvent(XEvent* xev) {
handle_next_event_ = xwindow() == None ? false : IsEventForXWindow(*xev);
handle_next_event_ = xwindow() == x11::None ? false : IsEventForXWindow(*xev);
}
void X11WindowOzone::PlatformEventDispatchFinished() {
......
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