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

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: 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..898c88350adf90f51030499f2e7503ba94a0fb6b 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -8,6 +8,7 @@
#include <pango/pango.h>
#include <set>
#include <utility>
+#include <X11/Xcursor/Xcursor.h>
Lei Zhang 2016/07/11 22:34:56 nit: C headers above C++ headers.
Tom (Use chromium acct) 2016/07/11 22:56:29 Done.
#include "base/command_line.h"
#include "base/debug/leak_annotations.h"
@@ -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,19 @@ 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);
+ XcursorSetTheme(gfx::GetXDisplay(), theme);
+ XcursorSetDefaultSize(gfx::GetXDisplay(), size);
+}
+
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