Commit 295be7be authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Fix cursor theme support on Aura/X11

After https://crrev.com/c/2260642, Aura/X11 was ported to the Ozone
infraestructure for cursor loading. That meant removing CursorLoaderX11,
which implemented cursor theme changes.

In Ozone, cursor theme support was explicitly initialized after LinuxUI
was built. This CL enables the same code path for Aura/X11.

Additionally, add a DCHECK to make sure CursorThemeManager is always
initialized in X11 builds.

Bug: 1126830
Change-Id: Ia9e9bbbd9d277df2a432f3cb344d3b30b9551f30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401621Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#806154}
parent d6c97ad2
......@@ -7,7 +7,6 @@
#include "chrome/browser/themes/theme_service_aura_linux.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/theme_profile_key.h"
#include "ui/base/ui_base_features.h"
#include "ui/display/screen.h"
#include "ui/views/linux_ui/linux_ui.h"
......@@ -23,6 +22,7 @@
#if defined(USE_X11)
#include "ui/gfx/x/connection.h" // nogncheck
#if BUILDFLAG(USE_GTK)
#include "ui/base/ui_base_features.h"
#include "ui/gtk/x/gtk_ui_delegate_x11.h" // nogncheck
#endif // BUILDFLAG(USE_GTK)
#endif // defined(USE_X11)
......@@ -86,10 +86,9 @@ void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() {
views::LinuxUI::SetInstance(linux_ui);
linux_ui->Initialize();
#if defined(USE_OZONE)
if (features::IsUsingOzonePlatform())
ui::CursorFactory::GetInstance()->ObserveThemeChanges();
#endif
// Cursor theme changes are tracked by LinuxUI (via a CursorThemeManager
// implementation). Start observing them once it's initialized.
ui::CursorFactory::GetInstance()->ObserveThemeChanges();
DCHECK(ui::LinuxInputMethodContextFactory::instance())
<< "LinuxUI must set LinuxInputMethodContextFactory instance.";
......
......@@ -203,8 +203,8 @@ void X11CursorFactory::UnrefImageCursor(PlatformCursor cursor) {
void X11CursorFactory::ObserveThemeChanges() {
auto* cursor_theme_manager = CursorThemeManager::GetInstance();
if (cursor_theme_manager)
cursor_theme_observer_.Add(cursor_theme_manager);
DCHECK(cursor_theme_manager);
cursor_theme_observer_.Add(cursor_theme_manager);
}
void X11CursorFactory::OnCursorThemeNameChanged(
......
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