diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/ui/gtk | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/gtk')
-rw-r--r-- | chromium/ui/gtk/BUILD.gn | 10 | ||||
-rw-r--r-- | chromium/ui/gtk/gtk_ui.cc | 6 | ||||
-rw-r--r-- | chromium/ui/gtk/printing/OWNERS | 3 | ||||
-rw-r--r-- | chromium/ui/gtk/printing/print_dialog_gtk.cc (renamed from chromium/ui/gtk/print_dialog_gtk.cc) | 26 | ||||
-rw-r--r-- | chromium/ui/gtk/printing/print_dialog_gtk.h (renamed from chromium/ui/gtk/print_dialog_gtk.h) | 9 | ||||
-rw-r--r-- | chromium/ui/gtk/printing/printing_gtk_util.cc (renamed from chromium/ui/gtk/printing_gtk_util.cc) | 2 | ||||
-rw-r--r-- | chromium/ui/gtk/printing/printing_gtk_util.h (renamed from chromium/ui/gtk/printing_gtk_util.h) | 6 | ||||
-rw-r--r-- | chromium/ui/gtk/select_file_dialog_impl_kde.cc | 73 | ||||
-rw-r--r-- | chromium/ui/gtk/x/gtk_event_loop_x11.cc | 47 | ||||
-rw-r--r-- | chromium/ui/gtk/x/gtk_ui_delegate_x11.cc | 9 |
10 files changed, 111 insertions, 80 deletions
diff --git a/chromium/ui/gtk/BUILD.gn b/chromium/ui/gtk/BUILD.gn index 99d97e9c145..02e12b9db88 100644 --- a/chromium/ui/gtk/BUILD.gn +++ b/chromium/ui/gtk/BUILD.gn @@ -35,10 +35,10 @@ jumbo_component("gtk") { "native_theme_gtk.h", "nav_button_provider_gtk.cc", "nav_button_provider_gtk.h", - "print_dialog_gtk.cc", - "print_dialog_gtk.h", - "printing_gtk_util.cc", - "printing_gtk_util.h", + "printing/print_dialog_gtk.cc", + "printing/print_dialog_gtk.h", + "printing/printing_gtk_util.cc", + "printing/printing_gtk_util.h", "select_file_dialog_impl.cc", "select_file_dialog_impl.h", "select_file_dialog_impl_gtk.cc", @@ -76,6 +76,7 @@ jumbo_component("gtk") { "//ui/aura", "//ui/base", "//ui/base:buildflags", + "//ui/base/cursor:theme_manager", "//ui/base/ime", "//ui/base/ime/linux", "//ui/display", @@ -85,7 +86,6 @@ jumbo_component("gtk") { "//ui/gfx", "//ui/gfx:native_widget_types", "//ui/gfx/geometry", - "//ui/gfx/x", "//ui/native_theme", "//ui/shell_dialogs", "//ui/strings", diff --git a/chromium/ui/gtk/gtk_ui.cc b/chromium/ui/gtk/gtk_ui.cc index 77d2c7633af..69d7afecc3a 100644 --- a/chromium/ui/gtk/gtk_ui.cc +++ b/chromium/ui/gtk/gtk_ui.cc @@ -29,7 +29,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkShader.h" -#include "ui/base/cursor/cursor_theme_manager_linux_observer.h" +#include "ui/base/cursor/cursor_theme_manager_observer.h" #include "ui/base/ime/linux/fake_input_method_context.h" #include "ui/base/ime/linux/linux_input_method_context.h" #include "ui/base/ime/linux/linux_input_method_context_factory.h" @@ -51,8 +51,8 @@ #include "ui/gtk/input_method_context_impl_gtk.h" #include "ui/gtk/native_theme_gtk.h" #include "ui/gtk/nav_button_provider_gtk.h" -#include "ui/gtk/print_dialog_gtk.h" -#include "ui/gtk/printing_gtk_util.h" +#include "ui/gtk/printing/print_dialog_gtk.h" +#include "ui/gtk/printing/printing_gtk_util.h" #include "ui/gtk/select_file_dialog_impl.h" #include "ui/gtk/settings_provider_gtk.h" #include "ui/native_theme/native_theme.h" diff --git a/chromium/ui/gtk/printing/OWNERS b/chromium/ui/gtk/printing/OWNERS new file mode 100644 index 00000000000..d50bb849014 --- /dev/null +++ b/chromium/ui/gtk/printing/OWNERS @@ -0,0 +1,3 @@ +file://printing/OWNERS + +# COMPONENT: Internals>Printing diff --git a/chromium/ui/gtk/print_dialog_gtk.cc b/chromium/ui/gtk/printing/print_dialog_gtk.cc index 7368b297a54..57900d2854d 100644 --- a/chromium/ui/gtk/print_dialog_gtk.cc +++ b/chromium/ui/gtk/printing/print_dialog_gtk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gtk/print_dialog_gtk.h" +#include "ui/gtk/printing/print_dialog_gtk.h" #include <gtk/gtkunixprint.h> @@ -31,7 +31,7 @@ #include "ui/gtk/gtk_ui.h" #include "ui/gtk/gtk_ui_delegate.h" #include "ui/gtk/gtk_util.h" -#include "ui/gtk/printing_gtk_util.h" +#include "ui/gtk/printing/printing_gtk_util.h" #if defined(USE_CUPS) #include "printing/mojom/print.mojom.h" @@ -184,7 +184,7 @@ PrintDialogGtk::PrintDialogGtk(PrintingContextLinux* context) context_(context) {} PrintDialogGtk::~PrintDialogGtk() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(owning_task_runner()->RunsTasksInCurrentSequence()); if (dialog_) { aura::Window* parent = gtk::GetAuraTransientParent(dialog_); @@ -241,6 +241,17 @@ void PrintDialogGtk::UpdateSettings( gtk_print_settings_set_collate(gtk_settings_, settings->collate()); #if defined(USE_CUPS) + // Set advanced settings first so they can be overridden by user applied + // settings. + for (const auto& pair : settings->advanced_settings()) { + if (!pair.second.is_string()) + continue; + static constexpr char kSettingNamePrefix[] = "cups-"; + const std::string setting_name = kSettingNamePrefix + pair.first; + gtk_print_settings_set(gtk_settings_, setting_name.c_str(), + pair.second.GetString().c_str()); + } + std::string color_value; std::string color_setting_name; printing::GetColorModelForMode(settings->color(), &color_setting_name, @@ -363,7 +374,7 @@ void PrintDialogGtk::ShowDialog( void PrintDialogGtk::PrintDocument(const printing::MetafilePlayer& metafile, const base::string16& document_name) { // This runs on the print worker thread, does not block the UI thread. - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(!owning_task_runner()->RunsTasksInCurrentSequence()); // The document printing tasks can outlive the PrintingContext that created // this dialog. @@ -389,7 +400,7 @@ void PrintDialogGtk::PrintDocument(const printing::MetafilePlayer& metafile, } // No errors, continue printing. - base::SequencedTaskRunnerHandle::Get()->PostTask( + owning_task_runner()->PostTask( FROM_HERE, base::BindOnce(&PrintDialogGtk::SendDocumentToPrinter, this, document_name)); } @@ -487,7 +498,7 @@ static void OnJobCompletedThunk(GtkPrintJob* print_job, } void PrintDialogGtk::SendDocumentToPrinter( const base::string16& document_name) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(owning_task_runner()->RunsTasksInCurrentSequence()); // If |printer_| is nullptr then somehow the GTK printer list changed out // under us. In which case, just bail out. @@ -519,8 +530,7 @@ void PrintDialogGtk::OnJobCompleted(GtkPrintJob* print_job, FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::BLOCK_SHUTDOWN}, - base::BindOnce(base::IgnoreResult(&base::DeleteFile), path_to_pdf_, - false)); + base::BindOnce(base::GetDeleteFileCallback(), path_to_pdf_)); // Printing finished. Matches AddRef() in PrintDocument(); Release(); } diff --git a/chromium/ui/gtk/print_dialog_gtk.h b/chromium/ui/gtk/printing/print_dialog_gtk.h index b7874e587f5..f065848a163 100644 --- a/chromium/ui/gtk/print_dialog_gtk.h +++ b/chromium/ui/gtk/printing/print_dialog_gtk.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GTK_PRINT_DIALOG_GTK_H_ -#define UI_GTK_PRINT_DIALOG_GTK_H_ +#ifndef UI_GTK_PRINTING_PRINT_DIALOG_GTK_H_ +#define UI_GTK_PRINTING_PRINT_DIALOG_GTK_H_ #include <gtk/gtk.h> #include <gtk/gtkunixprint.h> @@ -13,7 +13,6 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted_delete_on_sequence.h" -#include "base/sequenced_task_runner_helpers.h" #include "printing/print_dialog_gtk_interface.h" #include "printing/printing_context_linux.h" #include "ui/aura/window_observer.h" @@ -84,9 +83,7 @@ class PrintDialogGtk : public printing::PrintDialogGtkInterface, base::FilePath path_to_pdf_; - SEQUENCE_CHECKER(sequence_checker_); - DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); }; -#endif // UI_GTK_PRINT_DIALOG_GTK_H_ +#endif // UI_GTK_PRINTING_PRINT_DIALOG_GTK_H_ diff --git a/chromium/ui/gtk/printing_gtk_util.cc b/chromium/ui/gtk/printing/printing_gtk_util.cc index efacf89c209..fe3771f808b 100644 --- a/chromium/ui/gtk/printing_gtk_util.cc +++ b/chromium/ui/gtk/printing/printing_gtk_util.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gtk/printing_gtk_util.h" +#include "ui/gtk/printing/printing_gtk_util.h" #include <gtk/gtk.h> #include <gtk/gtkunixprint.h> diff --git a/chromium/ui/gtk/printing_gtk_util.h b/chromium/ui/gtk/printing/printing_gtk_util.h index 4dce6f8613f..7b41010d94a 100644 --- a/chromium/ui/gtk/printing_gtk_util.h +++ b/chromium/ui/gtk/printing/printing_gtk_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GTK_PRINTING_GTK_UTIL_H_ -#define UI_GTK_PRINTING_GTK_UTIL_H_ +#ifndef UI_GTK_PRINTING_PRINTING_GTK_UTIL_H_ +#define UI_GTK_PRINTING_PRINTING_GTK_UTIL_H_ #include "ui/gfx/geometry/size.h" @@ -24,4 +24,4 @@ void InitPrintSettingsGtk(GtkPrintSettings* settings, GtkPageSetup* page_setup, printing::PrintSettings* print_settings); -#endif // UI_GTK_PRINTING_GTK_UTIL_H_ +#endif // UI_GTK_PRINTING_PRINTING_GTK_UTIL_H_ diff --git a/chromium/ui/gtk/select_file_dialog_impl_kde.cc b/chromium/ui/gtk/select_file_dialog_impl_kde.cc index f09501d6cd8..4eba97d573d 100644 --- a/chromium/ui/gtk/select_file_dialog_impl_kde.cc +++ b/chromium/ui/gtk/select_file_dialog_impl_kde.cc @@ -75,7 +75,7 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { KDialogParams(const std::string& type, const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, bool file_operation, bool multiple_selection) : type(type), @@ -88,7 +88,7 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { std::string type; std::string title; base::FilePath default_path; - XID parent; + gfx::AcceleratedWidget parent; bool file_operation; bool multiple_selection; }; @@ -106,7 +106,7 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { void GetKDialogCommandLine(const std::string& type, const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, bool file_operation, bool multiple_selection, base::CommandLine* command_line); @@ -130,22 +130,22 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { void CreateSelectFolderDialog(Type type, const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params); void CreateFileOpenDialog(const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params); void CreateMultiFileOpenDialog(const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params); void CreateSaveAsDialog(const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params); // Common function for OnSelectSingleFileDialogResponse and @@ -155,15 +155,15 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { std::unique_ptr<KDialogOutputParams> results); void OnSelectSingleFileDialogResponse( - XID parent, + gfx::AcceleratedWidget parent, void* params, std::unique_ptr<KDialogOutputParams> results); void OnSelectMultiFileDialogResponse( - XID parent, + gfx::AcceleratedWidget parent, void* params, std::unique_ptr<KDialogOutputParams> results); void OnSelectSingleFolderDialogResponse( - XID parent, + gfx::AcceleratedWidget parent, void* params, std::unique_ptr<KDialogOutputParams> results); @@ -172,7 +172,7 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { // The set of all parent windows for which we are currently running // dialogs. This should only be accessed on the UI thread. - std::set<XID> parents_; + std::set<gfx::AcceleratedWidget> parents_; // A task runner for blocking pipe reads. scoped_refptr<base::SequencedTaskRunner> pipe_task_runner_; @@ -218,13 +218,13 @@ SelectFileDialogImplKDE::SelectFileDialogImplKDE( desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE5); } -SelectFileDialogImplKDE::~SelectFileDialogImplKDE() {} +SelectFileDialogImplKDE::~SelectFileDialogImplKDE() = default; bool SelectFileDialogImplKDE::IsRunning(gfx::NativeWindow parent_window) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (parent_window && parent_window->GetHost()) { - XID xid = parent_window->GetHost()->GetAcceleratedWidget(); - return parents_.find(xid) != parents_.end(); + auto window = parent_window->GetHost()->GetAcceleratedWidget(); + return parents_.find(window) != parents_.end(); } return false; @@ -243,13 +243,13 @@ void SelectFileDialogImplKDE::SelectFileImpl( DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); type_ = type; - XID window_xid = x11::None; + gfx::AcceleratedWidget window = gfx::kNullAcceleratedWidget; if (owning_window && owning_window->GetHost()) { // |owning_window| can be null when user right-clicks on a downloadable item // and chooses 'Open Link in New Tab' when 'Ask where to save each file // before downloading.' preference is turned on. (http://crbug.com/29213) - window_xid = owning_window->GetHost()->GetAcceleratedWidget(); - parents_.insert(window_xid); + window = owning_window->GetHost()->GetAcceleratedWidget(); + parents_.insert(window); } std::string title_string = base::UTF16ToUTF8(title); @@ -264,17 +264,17 @@ void SelectFileDialogImplKDE::SelectFileImpl( case SELECT_FOLDER: case SELECT_UPLOAD_FOLDER: case SELECT_EXISTING_FOLDER: - CreateSelectFolderDialog(type, title_string, default_path, window_xid, + CreateSelectFolderDialog(type, title_string, default_path, window, params); return; case SELECT_OPEN_FILE: - CreateFileOpenDialog(title_string, default_path, window_xid, params); + CreateFileOpenDialog(title_string, default_path, window, params); return; case SELECT_OPEN_MULTI_FILE: - CreateMultiFileOpenDialog(title_string, default_path, window_xid, params); + CreateMultiFileOpenDialog(title_string, default_path, window, params); return; case SELECT_SAVEAS_FILE: - CreateSaveAsDialog(title_string, default_path, window_xid, params); + CreateSaveAsDialog(title_string, default_path, window, params); return; case SELECT_NONE: NOTREACHED(); @@ -290,12 +290,11 @@ std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() { DCHECK(pipe_task_runner_->RunsTasksInCurrentSequence()); // We need a filter set because the same mime type can appear multiple times. std::set<std::string> filter_set; - for (size_t i = 0; i < file_types_.extensions.size(); ++i) { - for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) { - if (!file_types_.extensions[i][j].empty()) { - std::string mime_type = - base::nix::GetFileMimeType(base::FilePath("name").ReplaceExtension( - file_types_.extensions[i][j])); + for (auto& extensions : file_types_.extensions) { + for (auto& extension : extensions) { + if (!extension.empty()) { + std::string mime_type = base::nix::GetFileMimeType( + base::FilePath("name").ReplaceExtension(extension)); filter_set.insert(mime_type); } } @@ -335,18 +334,18 @@ void SelectFileDialogImplKDE::GetKDialogCommandLine( const std::string& type, const std::string& title, const base::FilePath& path, - XID parent, + gfx::AcceleratedWidget parent, bool file_operation, bool multiple_selection, base::CommandLine* command_line) { CHECK(command_line); // Attach to the current Chrome window. - if (parent != x11::None) { + if (parent != gfx::kNullAcceleratedWidget) { command_line->AppendSwitchNative( desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE3 ? "--embed" : "--attach", - base::NumberToString(parent)); + base::NumberToString(static_cast<uint32_t>(parent))); } // Set the correct title for the dialog. @@ -404,7 +403,7 @@ void SelectFileDialogImplKDE::CreateSelectFolderDialog( Type type, const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params) { int title_message_id = (type == SELECT_UPLOAD_FOLDER) ? IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE @@ -425,7 +424,7 @@ void SelectFileDialogImplKDE::CreateSelectFolderDialog( void SelectFileDialogImplKDE::CreateFileOpenDialog( const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params) { pipe_task_runner_->PostTaskAndReplyWithResult( FROM_HERE, @@ -442,7 +441,7 @@ void SelectFileDialogImplKDE::CreateFileOpenDialog( void SelectFileDialogImplKDE::CreateMultiFileOpenDialog( const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params) { pipe_task_runner_->PostTaskAndReplyWithResult( FROM_HERE, @@ -459,7 +458,7 @@ void SelectFileDialogImplKDE::CreateMultiFileOpenDialog( void SelectFileDialogImplKDE::CreateSaveAsDialog( const std::string& title, const base::FilePath& default_path, - XID parent, + gfx::AcceleratedWidget parent, void* params) { pipe_task_runner_->PostTaskAndReplyWithResult( FROM_HERE, @@ -496,7 +495,7 @@ void SelectFileDialogImplKDE::SelectSingleFileHelper( } void SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse( - XID parent, + gfx::AcceleratedWidget parent, void* params, std::unique_ptr<KDialogOutputParams> results) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -505,7 +504,7 @@ void SelectFileDialogImplKDE::OnSelectSingleFileDialogResponse( } void SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse( - XID parent, + gfx::AcceleratedWidget parent, void* params, std::unique_ptr<KDialogOutputParams> results) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -514,7 +513,7 @@ void SelectFileDialogImplKDE::OnSelectSingleFolderDialogResponse( } void SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse( - XID parent, + gfx::AcceleratedWidget parent, void* params, std::unique_ptr<KDialogOutputParams> results) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); diff --git a/chromium/ui/gtk/x/gtk_event_loop_x11.cc b/chromium/ui/gtk/x/gtk_event_loop_x11.cc index aab1a9c3581..abda48cbf04 100644 --- a/chromium/ui/gtk/x/gtk_event_loop_x11.cc +++ b/chromium/ui/gtk/x/gtk_event_loop_x11.cc @@ -7,9 +7,12 @@ #include <gdk/gdk.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> +#include <xcb/xcb.h> +#include <xcb/xproto.h> #include "base/memory/singleton.h" #include "ui/events/platform/x11/x11_event_source.h" +#include "ui/gfx/x/event.h" #include "ui/gfx/x/x11.h" namespace ui { @@ -66,26 +69,42 @@ void GtkEventLoopX11::ProcessGdkEventKey(const GdkEventKey& gdk_event_key) { // corresponding key event in the X event queue. So we have to handle this // case. ibus-gtk is used through gtk-immodule to support IMEs. - XEvent x_event; - x_event.xkey = {}; - x_event.xkey.type = - gdk_event_key.type == GDK_KEY_PRESS ? KeyPress : KeyRelease; - x_event.xkey.send_event = gdk_event_key.send_event; - x_event.xkey.display = gfx::GetXDisplay(); - x_event.xkey.window = GDK_WINDOW_XID(gdk_event_key.window); - x_event.xkey.root = DefaultRootWindow(x_event.xkey.display); - x_event.xkey.time = gdk_event_key.time; - x_event.xkey.keycode = gdk_event_key.hardware_keycode; - x_event.xkey.same_screen = true; - x_event.xkey.state = + auto* conn = x11::Connection::Get(); + XDisplay* display = conn->display(); + + xcb_generic_event_t generic_event; + memset(&generic_event, 0, sizeof(generic_event)); + auto* key_event = reinterpret_cast<xcb_key_press_event_t*>(&generic_event); + key_event->response_type = gdk_event_key.type == GDK_KEY_PRESS + ? x11::KeyEvent::Press + : x11::KeyEvent::Release; + if (gdk_event_key.send_event) + key_event->response_type |= x11::kSendEventMask; + key_event->event = GDK_WINDOW_XID(gdk_event_key.window); + key_event->root = DefaultRootWindow(display); + key_event->time = gdk_event_key.time; + key_event->detail = gdk_event_key.hardware_keycode; + key_event->same_screen = true; + + x11::Event event(&generic_event, conn, false); + + // The key state is 16 bits on the wire, but ibus-gtk adds additional flags + // that may be outside this range, so set the state after conversion from + // the wire format. + // TODO(https://crbug.com/1066670): Add a test to ensure this subtle logic + // doesn't regress after all X11 event code is refactored from using Xlib to + // XProto. + int state = BuildXkbStateFromGdkEvent(gdk_event_key.state, gdk_event_key.group); + event.xlib_event().xkey.state = state; + event.As<x11::KeyEvent>()->state = static_cast<x11::KeyButMask>(state); // We want to process the gtk event; mapped to an X11 event immediately // otherwise if we put it back on the queue we may get items out of order. if (ui::X11EventSource* x11_source = ui::X11EventSource::GetInstance()) - x11_source->DispatchXEventNow(&x_event); + x11_source->DispatchXEvent(&event); else - XPutBackEvent(x_event.xkey.display, &x_event); + conn->events().push_front(std::move(event)); } } // namespace ui diff --git a/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc b/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc index 8967d4af8ac..8ae0f44fe54 100644 --- a/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc +++ b/chromium/ui/gtk/x/gtk_ui_delegate_x11.cc @@ -33,17 +33,20 @@ GdkKeymap* GtkUiDelegateX11::GetGdkKeymap() { GdkWindow* GtkUiDelegateX11::GetGdkWindow(gfx::AcceleratedWidget window_id) { GdkDisplay* display = GetGdkDisplay(); - GdkWindow* gdk_window = gdk_x11_window_lookup_for_display(display, window_id); + GdkWindow* gdk_window = gdk_x11_window_lookup_for_display( + display, static_cast<uint32_t>(window_id)); if (gdk_window) g_object_ref(gdk_window); else - gdk_window = gdk_x11_window_foreign_new_for_display(display, window_id); + gdk_window = gdk_x11_window_foreign_new_for_display( + display, static_cast<uint32_t>(window_id)); return gdk_window; } bool GtkUiDelegateX11::SetGdkWindowTransientFor(GdkWindow* window, gfx::AcceleratedWidget parent) { - XSetTransientForHint(xdisplay_, GDK_WINDOW_XID(window), parent); + XSetTransientForHint(xdisplay_, GDK_WINDOW_XID(window), + static_cast<uint32_t>(parent)); return true; } |