Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3033)

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 2135353002: Linux: Add support for custom cursor themes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix include order and add failchecks Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtk2ui/gtk2_ui.cc
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index c9d25bf01e9e97f73b4168472b4b11f73167003c..b9d22c54df66cab4cc011a046e24e2246264443b 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -6,6 +6,7 @@
#include <math.h>
#include <pango/pango.h>
+#include <X11/Xcursor/Xcursor.h>
#include <set>
#include <utility>
@@ -49,6 +50,7 @@
#include "ui/gfx/image/image_skia_source.h"
#include "ui/gfx/skbitmap_operations.h"
#include "ui/gfx/skia_util.h"
+#include "ui/gfx/x/x11_types.h"
#include "ui/native_theme/native_theme.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/views/controls/button/blue_button.h"
@@ -508,9 +510,10 @@ void Gtk2UI::Initialize() {
G_CALLBACK(OnThemeChanged),
this);
-
LoadGtkValues();
+ LoadCursorTheme();
+
#if defined(ENABLE_BASIC_PRINTING)
printing::PrintingContextLinux::SetCreatePrintDialogFunction(
&PrintDialogGtk2::CreatePrintDialog);
@@ -996,6 +999,24 @@ void Gtk2UI::LoadGtkValues() {
theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberWaitingColor);
}
+void Gtk2UI::LoadCursorTheme() {
+ GtkSettings* settings = gtk_settings_get_default();
+
+ gchar* theme = nullptr;
+ gint size = 0;
+ g_object_get(settings,
+ "gtk-cursor-theme-name", &theme,
+ "gtk-cursor-theme-size", &size,
+ nullptr);
+
+ if (theme)
+ XcursorSetTheme(gfx::GetXDisplay(), theme);
+ if (size)
+ XcursorSetDefaultSize(gfx::GetXDisplay(), size);
+
+ g_free(theme);
+}
+
void Gtk2UI::UpdateMaterialDesignColors() {
// TODO(varkha): This should be merged back into LoadGtkValues() once Material
// Design is on unconditionally.
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698