summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmate-desktop/mate-bg.c22
-rw-r--r--libmate-desktop/mate-colorsel.c34
-rw-r--r--schemas/org.mate.interface.gschema.xml5
3 files changed, 55 insertions, 6 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 2c44b9e..8587dd4 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -2135,9 +2135,27 @@ scale_thumbnail (MateBGPlacement placement,
if (get_thumb_annotations (thumb, &o_width, &o_height) ||
(filename && get_original_size (filename, &o_width, &o_height))) {
+ GdkDisplay *display;
+ int scr_height;
+ int scr_width;
- int scr_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
- int scr_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
+ display = gdk_screen_get_display (screen);
+
+ /*Since we can use this in wayland, only use x11 specific code when in x11*/
+ if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
+ {
+ scr_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+ scr_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
+ }
+ else
+ {
+ GdkRectangle geometry = {0};
+ GdkMonitor *monitor;
+ monitor = gdk_display_get_monitor (display, 0);
+ gdk_monitor_get_geometry (monitor, &geometry);
+ scr_height = geometry.width;
+ scr_width = geometry.height;
+ }
int thumb_width = gdk_pixbuf_get_width (thumb);
int thumb_height = gdk_pixbuf_get_height (thumb);
double screen_to_dest = fit_factor (scr_width, scr_height,
diff --git a/libmate-desktop/mate-colorsel.c b/libmate-desktop/mate-colorsel.c
index deb969c..58f94a6 100644
--- a/libmate-desktop/mate-colorsel.c
+++ b/libmate-desktop/mate-colorsel.c
@@ -43,6 +43,8 @@
#define GTK_CUSTOM_PALETTE_WIDTH 9
#define GTK_CUSTOM_PALETTE_HEIGHT 4
+#define SIZE_OF_COLOR_PALETTE (GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT * 8)
+
#define CUSTOM_PALETTE_ENTRY_WIDTH 20
#define CUSTOM_PALETTE_ENTRY_HEIGHT 20
@@ -206,6 +208,8 @@ static guint color_selection_signals[LAST_SIGNAL] = { 0 };
static MateColorSelectionChangePaletteFunc noscreen_change_palette_hook = default_noscreen_change_palette_func;
static MateColorSelectionChangePaletteWithScreenFunc change_palette_hook = default_change_palette_func;
+static gchar color_palette[SIZE_OF_COLOR_PALETTE] = { 0 };
+
static const guchar dropper_bits[] = {
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@@ -1147,9 +1151,25 @@ static GdkRGBA *
get_current_colors (MateColorSelection *colorsel)
{
GdkRGBA *colors = NULL;
+ GSettings *settings;
+ gchar *str = NULL;
gint n_colors = 0;
- mate_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
+ if (!*color_palette)
+ {
+ settings = g_settings_new ("org.mate.interface");
+ str = g_settings_get_string (settings, "gtk-color-palette");
+ g_object_unref (settings);
+
+ if (str && *str)
+ g_strlcpy(color_palette, str, SIZE_OF_COLOR_PALETTE);
+ else
+ g_strlcpy(color_palette, DEFAULT_COLOR_PALETTE, SIZE_OF_COLOR_PALETTE);
+
+ g_free (str);
+ }
+
+ mate_color_selection_palette_from_string (color_palette,
&colors,
&n_colors);
@@ -2198,16 +2218,22 @@ default_change_palette_func (GdkScreen *screen,
const GdkRGBA *colors,
gint n_colors)
{
+ GSettings *settings;
gchar *str;
str = mate_color_selection_palette_to_string (colors, n_colors);
+ g_strlcpy(color_palette, str, SIZE_OF_COLOR_PALETTE);
+ settings = g_settings_new ("org.mate.interface");
+ g_settings_set_string (settings, "gtk-color-palette", str);
+
g_object_set (G_OBJECT (gtk_settings_get_for_screen (screen)),
"gtk-color-palette",
str,
NULL);
g_free (str);
+ g_object_unref (settings);
}
/**
@@ -2779,9 +2805,9 @@ mate_color_selection_palette_to_string (const GdkRGBA *colors,
strs[i] =
g_strdup_printf ("#%2X%2X%2X",
- (unsigned int)colors[i].red * 255,
- (unsigned int)colors[i].green * 255,
- (unsigned int)colors[i].blue * 255);
+ (guint) scale_round (colors[i].red, 255),
+ (guint) scale_round (colors[i].green, 255),
+ (guint) scale_round (colors[i].blue, 255));
for (ptr = strs[i]; *ptr; ptr++)
if (*ptr == ' ')
diff --git a/schemas/org.mate.interface.gschema.xml b/schemas/org.mate.interface.gschema.xml
index d30be52..2f67043 100644
--- a/schemas/org.mate.interface.gschema.xml
+++ b/schemas/org.mate.interface.gschema.xml
@@ -75,6 +75,11 @@
<summary>List of symbolic names and color equivalents</summary>
<description>A '\n' separated list of "name:color" as defined by the 'gtk-color-scheme' setting</description>
</key>
+ <key name="gtk-color-palette" type="s">
+ <default>'#ef2929:#fcaf3e:#fce94f:#8ae234:#729fcf:#ad7fa8:#e9b96e:#888a85:#eeeeec:#cc0000:#f57900:#edd400:#73d216:#3465a4:#75507b:#c17d11:#555753:#d3d7cf:#a40000:#ce5c00:#c4a000:#4e9a06:#204a87:#5c3566:#8f5902:#2e3436:#babdb6:#000000:#2e3436:#555753:#888a85:#babdb6:#d3d7cf:#eeeeec:#f3f3f3:#ffffff'</default>
+ <summary>GTK color palette</summary>
+ <description>Default color palette for MATE Color Selection</description>
+ </key>
<key name="font-name" type="s">
<default>'Sans 10'</default>
<summary>Default font</summary>