Commit 3e42afb9 authored by Igor Britsky's avatar Igor Britsky Committed by Commit Bot

Fix GCC incomplete designated initialization bug

For GCC 8.4.0 is important to get all the first initializer in
designated init-list in case of implicit construction. Correct compile
if use explicit construction.

Error example (GCC 8.4.0):
In file included from ../../ui/gfx/x/event.h:14,
               from ../../ui/events/platform/x11/x11_event_source.h:19,
               from ../../ui/events/platform/x11/x11_event_source.cc:5:
gen/ui/gfx/x/xproto.h:2744:16: note: candidate: 'x11::Future<void>
x11::XProto::CreateWindow(const x11::CreateWindowRequest&)'
gen/ui/gfx/x/xproto.h:2744:16: note:   no known conversion for argument
1 from '<brace-enclosed initializer list>' to 'const x11::
CreateWindowRequest&'
../../ui/events/platform/x11/x11_event_source.cc:201:4: error: no
matching function for call to 'x11::Connection::ChangeProperty(<brace-
enclosed initializer list>)'

Bug: 819294
Change-Id: I604af19e3c441bbb788d0b6094c52f12df49269e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2506431Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822708}
parent 9ab2bb3a
...@@ -161,7 +161,7 @@ x11::Time X11EventSource::GetCurrentServerTime() { ...@@ -161,7 +161,7 @@ x11::Time X11EventSource::GetCurrentServerTime() {
if (!dummy_initialized_) { if (!dummy_initialized_) {
// Create a new Window and Atom that will be used for the property change. // Create a new Window and Atom that will be used for the property change.
dummy_window_ = connection_->GenerateId<x11::Window>(); dummy_window_ = connection_->GenerateId<x11::Window>();
connection_->CreateWindow({ connection_->CreateWindow(x11::CreateWindowRequest{
.wid = dummy_window_, .wid = dummy_window_,
.parent = connection_->default_root(), .parent = connection_->default_root(),
.width = 1, .width = 1,
...@@ -184,7 +184,7 @@ x11::Time X11EventSource::GetCurrentServerTime() { ...@@ -184,7 +184,7 @@ x11::Time X11EventSource::GetCurrentServerTime() {
// Make a no-op property change on |dummy_window_|. // Make a no-op property change on |dummy_window_|.
std::vector<uint8_t> data{0}; std::vector<uint8_t> data{0};
connection_->ChangeProperty({ connection_->ChangeProperty(x11::ChangePropertyRequest{
.window = static_cast<x11::Window>(dummy_window_), .window = static_cast<x11::Window>(dummy_window_),
.property = dummy_atom_, .property = dummy_atom_,
.type = x11::Atom::STRING, .type = x11::Atom::STRING,
......
...@@ -19,9 +19,9 @@ void SetEventMask(x11::Window window, x11::EventMask new_mask) { ...@@ -19,9 +19,9 @@ void SetEventMask(x11::Window window, x11::EventMask new_mask) {
// change_attributes request may give a BadWindow error. In this case, just // change_attributes request may give a BadWindow error. In this case, just
// ignore the error. // ignore the error.
connection connection
->ChangeWindowAttributes( ->ChangeWindowAttributes(x11::ChangeWindowAttributesRequest{
{.window = window, .window = window,
.event_mask = static_cast<x11::EventMask>(new_mask)}) .event_mask = static_cast<x11::EventMask>(new_mask)})
.IgnoreError(); .IgnoreError();
} }
......
...@@ -257,7 +257,8 @@ X11AtomCache::X11AtomCache() : connection_(x11::Connection::Get()) { ...@@ -257,7 +257,8 @@ X11AtomCache::X11AtomCache() : connection_(x11::Connection::Get()) {
std::vector<x11::Future<x11::InternAtomReply>> requests; std::vector<x11::Future<x11::InternAtomReply>> requests;
requests.reserve(kCacheCount); requests.reserve(kCacheCount);
for (const char* name : kAtomsToCache) for (const char* name : kAtomsToCache)
requests.push_back(connection_->InternAtom({.name = name})); requests.push_back(
connection_->InternAtom(x11::InternAtomRequest{.name = name}));
for (size_t i = 0; i < kCacheCount; ++i) { for (size_t i = 0; i < kCacheCount; ++i) {
if (auto response = requests[i].Sync()) if (auto response = requests[i].Sync())
cached_atoms_[kAtomsToCache[i]] = static_cast<x11::Atom>(response->atom); cached_atoms_[kAtomsToCache[i]] = static_cast<x11::Atom>(response->atom);
...@@ -272,7 +273,9 @@ x11::Atom X11AtomCache::GetAtom(const std::string& name) const { ...@@ -272,7 +273,9 @@ x11::Atom X11AtomCache::GetAtom(const std::string& name) const {
return it->second; return it->second;
x11::Atom atom = x11::Atom::None; x11::Atom atom = x11::Atom::None;
if (auto response = connection_->InternAtom({.name = name}).Sync()) { if (auto response =
connection_->InternAtom(x11::InternAtomRequest{.name = name})
.Sync()) {
atom = static_cast<x11::Atom>(response->atom); atom = static_cast<x11::Atom>(response->atom);
cached_atoms_.emplace(name, atom); cached_atoms_.emplace(name, atom);
} else { } else {
......
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