[XProto] Remove usage of all Xlib headers

This CL removes <X11/Xlib.h> from //ui/gfx/x/x11.h.  What was provided
by Xlib.h is now provided with inline declarations.  The intent is
that I'll incrementally remove declarations from x11.h until there's
nothing left, at which point the dependency on Xlib will be removed and
therefore x11.h can be removed.  Doing it this way will ensure no
additional usages of Xlib are introduced, and it gives a nice way of
tracking progress as usages are removed.

* All Xlib macros are now gone, so it's safe to remove the XProto
  "undef" files.
* For some usages of Xlib (events in particular), it's easier to port
  to XProto now rather than add declarations to x11.h.
* ui/gfx/x/keysyms/keysyms.h is added in its own directory because
  it's needed by xkbcommon code, which is also built on ChromeOS, but
  ui/gfx/x/BUIDL.gn asserts that the platform is desktop Linux.

BUG=1066670
R=sky

Change-Id: If8679721548d45bdea48bcd8a898191b3f87eb10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392140
Auto-Submit: Thomas Anderson <[email protected]>
Commit-Queue: Scott Violet <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Nick Yamane <[email protected]>
Reviewed-by: Zhenyao Mo <[email protected]>
Cr-Commit-Position: refs/heads/master@{#805533}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 92ad822..2676d9c 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -456,43 +456,6 @@
       (),
     ),
     (
-      r'/XSelectInput|CWEventMask|XCB_CW_EVENT_MASK',
-      (
-       'Chrome clients wishing to select events on X windows should use',
-       'ui::XScopedEventSelector.  It is safe to ignore this warning only if',
-       'you are selecting events from the GPU process, or if you are using',
-       'an XDisplay other than gfx::GetXDisplay().',
-      ),
-      True,
-      (
-        r"^ui[\\/]events[\\/]x[\\/].*\.cc$",
-        r"^ui[\\/]gl[\\/].*\.cc$",
-        r"^media[\\/]gpu[\\/].*\.cc$",
-        r"^gpu[\\/].*\.cc$",
-        r"^ui[\\/]base[\\/]x[\\/]xwmstartupcheck[\\/]xwmstartupcheck\.cc$",
-        ),
-    ),
-    (
-      r'/\WX?(((Width|Height)(MM)?OfScreen)|(Display(Width|Height)))\(',
-      (
-       'Use the corresponding fields in x11::Screen instead.',
-      ),
-      True,
-      (),
-    ),
-    (
-      r'/XInternAtom|xcb_intern_atom',
-      (
-       'Use gfx::GetAtom() instead of interning atoms directly.',
-      ),
-      True,
-      (
-        r"^gpu[\\/]ipc[\\/]service[\\/]gpu_watchdog_thread\.cc$",
-        r"^remoting[\\/]host[\\/]linux[\\/]x_server_clipboard\.cc$",
-        r"^ui[\\/]gfx[\\/]x[\\/]x11_atom_cache\.cc$",
-      ),
-    ),
-    (
       'setMatrixClip',
       (
         'Overriding setMatrixClip() is prohibited; ',
@@ -846,6 +809,14 @@
       [_THIRD_PARTY_EXCEPT_BLINK],  # Not an error in third_party folders.
     ),
     (
+      r'/\b#include <X11/',
+      (
+        'Do not use Xlib. Use xproto (from //ui/gfx/x:xproto) instead.',
+      ),
+      True,
+      [_THIRD_PARTY_EXCEPT_BLINK],  # Not an error in third_party folders.
+    ),
+    (
       r'/\bstd::ratio\b',
       (
         'std::ratio is banned by the Google Style Guide.',