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

https://chromium-review.googlesource.com/756711
This commit is contained in:
Aleksei Kuzmin 2018-04-18 18:52:58 +02:00 committed by Samuel Attard
parent 97414cc931
commit 82d204e932
7 changed files with 15 additions and 26 deletions

View file

@ -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
}

View file

@ -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;

View file

@ -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 {

View file

@ -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);
}

View file

@ -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);

View file

@ -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()) {

View file

@ -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 {