571 lines
14 KiB
Diff
571 lines
14 KiB
Diff
diff -upr compiz-0.8.8-orig/gtk/window-decorator/gtk-window-decorator.c compiz-0.8.8/gtk/window-decorator/gtk-window-decorator.c
|
|
--- compiz-0.8.8-orig/gtk/window-decorator/gtk-window-decorator.c 2013-05-25 13:46:27.717322000 +0200
|
|
+++ compiz-0.8.8/gtk/window-decorator/gtk-window-decorator.c 2013-05-25 13:53:44.084731952 +0200
|
|
@@ -5607,82 +5607,6 @@ get_titlebar_font (void)
|
|
return titlebar_font;
|
|
}
|
|
|
|
-#ifdef USE_MATECONF
|
|
-static void
|
|
-titlebar_font_changed (MateConfClient *client)
|
|
-{
|
|
- gchar *str;
|
|
-
|
|
- str = mateconf_client_get_string (client,
|
|
- COMPIZ_TITLEBAR_FONT_KEY,
|
|
- NULL);
|
|
- if (!str)
|
|
- str = g_strdup ("Sans Bold 12");
|
|
-
|
|
- if (titlebar_font)
|
|
- pango_font_description_free (titlebar_font);
|
|
-
|
|
- titlebar_font = pango_font_description_from_string (str);
|
|
-
|
|
- g_free (str);
|
|
-}
|
|
-
|
|
-static void
|
|
-titlebar_click_action_changed (MateConfClient *client,
|
|
- const gchar *key,
|
|
- int *action_value,
|
|
- int default_value)
|
|
-{
|
|
- gchar *action;
|
|
-
|
|
- *action_value = default_value;
|
|
-
|
|
- action = mateconf_client_get_string (client, key, NULL);
|
|
- if (action)
|
|
- {
|
|
- if (strcmp (action, "toggle_shade") == 0)
|
|
- *action_value = CLICK_ACTION_SHADE;
|
|
- else if (strcmp (action, "toggle_maximize") == 0)
|
|
- *action_value = CLICK_ACTION_MAXIMIZE;
|
|
- else if (strcmp (action, "toggle_maximize_horizontally") == 0)
|
|
- *action_value = CLICK_ACTION_MAXIMIZE_HORZ;
|
|
- else if (strcmp (action, "toggle_maximize_vertically") == 0)
|
|
- *action_value = CLICK_ACTION_MAXIMIZE_VERT;
|
|
- else if (strcmp (action, "minimize") == 0)
|
|
- *action_value = CLICK_ACTION_MINIMIZE;
|
|
- else if (strcmp (action, "raise") == 0)
|
|
- *action_value = CLICK_ACTION_RAISE;
|
|
- else if (strcmp (action, "lower") == 0)
|
|
- *action_value = CLICK_ACTION_LOWER;
|
|
- else if (strcmp (action, "menu") == 0)
|
|
- *action_value = CLICK_ACTION_MENU;
|
|
- else if (strcmp (action, "none") == 0)
|
|
- *action_value = CLICK_ACTION_NONE;
|
|
-
|
|
- g_free (action);
|
|
- }
|
|
-}
|
|
-
|
|
-static void
|
|
-wheel_action_changed (MateConfClient *client)
|
|
-{
|
|
- gchar *action;
|
|
-
|
|
- wheel_action = WHEEL_ACTION_DEFAULT;
|
|
-
|
|
- action = mateconf_client_get_string (client, WHEEL_ACTION_KEY, NULL);
|
|
- if (action)
|
|
- {
|
|
- if (strcmp (action, "shade") == 0)
|
|
- wheel_action = WHEEL_ACTION_SHADE;
|
|
- else if (strcmp (action, "none") == 0)
|
|
- wheel_action = WHEEL_ACTION_NONE;
|
|
-
|
|
- g_free (action);
|
|
- }
|
|
-}
|
|
-#endif
|
|
-
|
|
#ifdef USE_MARCO
|
|
static MetaButtonFunction
|
|
meta_button_function_from_string (const char *str)
|
|
@@ -6039,401 +5963,6 @@ style_changed (GtkWidget *widget)
|
|
decorations_changed (screen);
|
|
}
|
|
|
|
-#ifdef USE_MATECONF
|
|
-static gboolean
|
|
-shadow_settings_changed (MateConfClient *client)
|
|
-{
|
|
- double radius, opacity;
|
|
- int offset;
|
|
- gchar *color;
|
|
- gboolean changed = FALSE;
|
|
-
|
|
- radius = mateconf_client_get_float (client,
|
|
- COMPIZ_SHADOW_RADIUS_KEY,
|
|
- NULL);
|
|
- radius = MAX (0.0, MIN (radius, 48.0));
|
|
- if (shadow_radius != radius)
|
|
- {
|
|
- shadow_radius = radius;
|
|
- changed = TRUE;
|
|
- }
|
|
-
|
|
- opacity = mateconf_client_get_float (client,
|
|
- COMPIZ_SHADOW_OPACITY_KEY,
|
|
- NULL);
|
|
- opacity = MAX (0.0, MIN (opacity, 6.0));
|
|
- if (shadow_opacity != opacity)
|
|
- {
|
|
- shadow_opacity = opacity;
|
|
- changed = TRUE;
|
|
- }
|
|
-
|
|
- color = mateconf_client_get_string (client,
|
|
- COMPIZ_SHADOW_COLOR_KEY,
|
|
- NULL);
|
|
- if (color)
|
|
- {
|
|
- int c[4];
|
|
-
|
|
- if (sscanf (color, "#%2x%2x%2x%2x", &c[0], &c[1], &c[2], &c[3]) == 4)
|
|
- {
|
|
- shadow_color[0] = c[0] << 8 | c[0];
|
|
- shadow_color[1] = c[1] << 8 | c[1];
|
|
- shadow_color[2] = c[2] << 8 | c[2];
|
|
- changed = TRUE;
|
|
- }
|
|
-
|
|
- g_free (color);
|
|
- }
|
|
-
|
|
- offset = mateconf_client_get_int (client,
|
|
- COMPIZ_SHADOW_OFFSET_X_KEY,
|
|
- NULL);
|
|
- offset = MAX (-16, MIN (offset, 16));
|
|
- if (shadow_offset_x != offset)
|
|
- {
|
|
- shadow_offset_x = offset;
|
|
- changed = TRUE;
|
|
- }
|
|
-
|
|
- offset = mateconf_client_get_int (client,
|
|
- COMPIZ_SHADOW_OFFSET_Y_KEY,
|
|
- NULL);
|
|
- offset = MAX (-16, MIN (offset, 16));
|
|
- if (shadow_offset_y != offset)
|
|
- {
|
|
- shadow_offset_y = offset;
|
|
- changed = TRUE;
|
|
- }
|
|
-
|
|
- return changed;
|
|
-}
|
|
-
|
|
-static gboolean
|
|
-blur_settings_changed (MateConfClient *client)
|
|
-{
|
|
- gchar *type;
|
|
- int new_type = blur_type;
|
|
-
|
|
- if (cmdline_options & CMDLINE_BLUR)
|
|
- return FALSE;
|
|
-
|
|
- type = mateconf_client_get_string (client,
|
|
- BLUR_TYPE_KEY,
|
|
- NULL);
|
|
-
|
|
- if (type)
|
|
- {
|
|
- if (strcmp (type, "titlebar") == 0)
|
|
- new_type = BLUR_TYPE_TITLEBAR;
|
|
- else if (strcmp (type, "all") == 0)
|
|
- new_type = BLUR_TYPE_ALL;
|
|
- else if (strcmp (type, "none") == 0)
|
|
- new_type = BLUR_TYPE_NONE;
|
|
-
|
|
- g_free (type);
|
|
- }
|
|
-
|
|
- if (new_type != blur_type)
|
|
- {
|
|
- blur_type = new_type;
|
|
- return TRUE;
|
|
- }
|
|
-
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-static gboolean
|
|
-theme_changed (MateConfClient *client)
|
|
-{
|
|
-
|
|
-#ifdef USE_MARCO
|
|
- gboolean use_meta_theme;
|
|
-
|
|
- if (cmdline_options & CMDLINE_THEME)
|
|
- return FALSE;
|
|
-
|
|
- use_meta_theme = mateconf_client_get_bool (client,
|
|
- USE_META_THEME_KEY,
|
|
- NULL);
|
|
-
|
|
- if (use_meta_theme)
|
|
- {
|
|
- gchar *theme;
|
|
-
|
|
- theme = mateconf_client_get_string (client,
|
|
- META_THEME_KEY,
|
|
- NULL);
|
|
-
|
|
- if (theme)
|
|
- {
|
|
- meta_theme_set_current (theme, TRUE);
|
|
- if (!meta_theme_get_current ())
|
|
- use_meta_theme = FALSE;
|
|
-
|
|
- g_free (theme);
|
|
- }
|
|
- else
|
|
- {
|
|
- use_meta_theme = FALSE;
|
|
- }
|
|
- }
|
|
-
|
|
- if (use_meta_theme)
|
|
- {
|
|
- theme_draw_window_decoration = meta_draw_window_decoration;
|
|
- theme_calc_decoration_size = meta_calc_decoration_size;
|
|
- theme_update_border_extents = meta_update_border_extents;
|
|
- theme_get_event_window_position = meta_get_event_window_position;
|
|
- theme_get_button_position = meta_get_button_position;
|
|
- }
|
|
- else
|
|
- {
|
|
- theme_draw_window_decoration = draw_window_decoration;
|
|
- theme_calc_decoration_size = calc_decoration_size;
|
|
- theme_update_border_extents = update_border_extents;
|
|
- theme_get_event_window_position = get_event_window_position;
|
|
- theme_get_button_position = get_button_position;
|
|
- }
|
|
-
|
|
- return TRUE;
|
|
-#else
|
|
- theme_draw_window_decoration = draw_window_decoration;
|
|
- theme_calc_decoration_size = calc_decoration_size;
|
|
- theme_update_border_extents = update_border_extents;
|
|
- theme_get_event_window_position = get_event_window_position;
|
|
- theme_get_button_position = get_button_position;
|
|
-
|
|
- return FALSE;
|
|
-#endif
|
|
-
|
|
-}
|
|
-
|
|
-static gboolean
|
|
-theme_opacity_changed (MateConfClient *client)
|
|
-{
|
|
-
|
|
-#ifdef USE_MARCO
|
|
- gboolean shade_opacity, changed = FALSE;
|
|
- gdouble opacity;
|
|
-
|
|
- opacity = mateconf_client_get_float (client,
|
|
- META_THEME_OPACITY_KEY,
|
|
- NULL);
|
|
-
|
|
- if (!(cmdline_options & CMDLINE_OPACITY) &&
|
|
- opacity != meta_opacity)
|
|
- {
|
|
- meta_opacity = opacity;
|
|
- changed = TRUE;
|
|
- }
|
|
-
|
|
- if (opacity < 1.0)
|
|
- {
|
|
- shade_opacity = mateconf_client_get_bool (client,
|
|
- META_THEME_SHADE_OPACITY_KEY,
|
|
- NULL);
|
|
-
|
|
- if (!(cmdline_options & CMDLINE_OPACITY_SHADE) &&
|
|
- shade_opacity != meta_shade_opacity)
|
|
- {
|
|
- meta_shade_opacity = shade_opacity;
|
|
- changed = TRUE;
|
|
- }
|
|
- }
|
|
-
|
|
- opacity = mateconf_client_get_float (client,
|
|
- META_THEME_ACTIVE_OPACITY_KEY,
|
|
- NULL);
|
|
-
|
|
- if (!(cmdline_options & CMDLINE_ACTIVE_OPACITY) &&
|
|
- opacity != meta_active_opacity)
|
|
- {
|
|
- meta_active_opacity = opacity;
|
|
- changed = TRUE;
|
|
- }
|
|
-
|
|
- if (opacity < 1.0)
|
|
- {
|
|
- shade_opacity =
|
|
- mateconf_client_get_bool (client,
|
|
- META_THEME_ACTIVE_SHADE_OPACITY_KEY,
|
|
- NULL);
|
|
-
|
|
- if (!(cmdline_options & CMDLINE_ACTIVE_OPACITY_SHADE) &&
|
|
- shade_opacity != meta_active_shade_opacity)
|
|
- {
|
|
- meta_active_shade_opacity = shade_opacity;
|
|
- changed = TRUE;
|
|
- }
|
|
- }
|
|
-
|
|
- return changed;
|
|
-#else
|
|
- return FALSE;
|
|
-#endif
|
|
-
|
|
-}
|
|
-
|
|
-static gboolean
|
|
-button_layout_changed (MateConfClient *client)
|
|
-{
|
|
-
|
|
-#ifdef USE_MARCO
|
|
- gchar *button_layout;
|
|
-
|
|
- button_layout = mateconf_client_get_string (client,
|
|
- META_BUTTON_LAYOUT_KEY,
|
|
- NULL);
|
|
-
|
|
- if (button_layout)
|
|
- {
|
|
- meta_update_button_layout (button_layout);
|
|
-
|
|
- meta_button_layout_set = TRUE;
|
|
-
|
|
- g_free (button_layout);
|
|
-
|
|
- return TRUE;
|
|
- }
|
|
-
|
|
- if (meta_button_layout_set)
|
|
- {
|
|
- meta_button_layout_set = FALSE;
|
|
- return TRUE;
|
|
- }
|
|
-#endif
|
|
-
|
|
- return FALSE;
|
|
-}
|
|
-
|
|
-static void
|
|
-cursor_theme_changed (MateConfClient *client)
|
|
-{
|
|
- gchar *theme;
|
|
- gint size;
|
|
-
|
|
- theme = mateconf_client_get_string(client, MATE_CURSOR_THEME_KEY, NULL);
|
|
- size = mateconf_client_get_int(client, MATE_CURSOR_SIZE_KEY, NULL);
|
|
-
|
|
- mateconf_client_set_string(client, COMPIZ_CURSOR_THEME_KEY, theme, NULL);
|
|
-
|
|
- mateconf_client_set_int(client, COMPIZ_CURSOR_SIZE_KEY, size, NULL);
|
|
-
|
|
- if (theme && strlen(theme))
|
|
- {
|
|
- gint i, j;
|
|
- GdkDisplay *gdkdisplay = gdk_display_get_default ();
|
|
- Display *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay);
|
|
-
|
|
-
|
|
- XcursorSetTheme (xdisplay, theme);
|
|
- XcursorSetDefaultSize (xdisplay, size);
|
|
-
|
|
- for (i = 0; i < 3; i++)
|
|
- {
|
|
- for (j = 0; j < 3; j++)
|
|
- {
|
|
- if (cursor[i][j].shape != XC_left_ptr)
|
|
- {
|
|
- XFreeCursor (xdisplay, cursor[i][j].cursor);
|
|
- cursor[i][j].cursor =
|
|
- XCreateFontCursor (xdisplay, cursor[i][j].shape);
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-}
|
|
-
|
|
-static void
|
|
-value_changed (MateConfClient *client,
|
|
- const gchar *key,
|
|
- MateConfValue *value,
|
|
- void *data)
|
|
-{
|
|
- gboolean changed = FALSE;
|
|
-
|
|
- if (strcmp (key, COMPIZ_USE_SYSTEM_FONT_KEY) == 0)
|
|
- {
|
|
- if (mateconf_client_get_bool (client,
|
|
- COMPIZ_USE_SYSTEM_FONT_KEY,
|
|
- NULL) != use_system_font)
|
|
- {
|
|
- use_system_font = !use_system_font;
|
|
- changed = TRUE;
|
|
- }
|
|
- }
|
|
- else if (strcmp (key, COMPIZ_TITLEBAR_FONT_KEY) == 0)
|
|
- {
|
|
- titlebar_font_changed (client);
|
|
- changed = !use_system_font;
|
|
- }
|
|
- else if (strcmp (key, COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY) == 0)
|
|
- {
|
|
- titlebar_click_action_changed (client, key,
|
|
- &double_click_action,
|
|
- DOUBLE_CLICK_ACTION_DEFAULT);
|
|
- }
|
|
- else if (strcmp (key, COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY) == 0)
|
|
- {
|
|
- titlebar_click_action_changed (client, key,
|
|
- &middle_click_action,
|
|
- MIDDLE_CLICK_ACTION_DEFAULT);
|
|
- }
|
|
- else if (strcmp (key, COMPIZ_RIGHT_CLICK_TITLEBAR_KEY) == 0)
|
|
- {
|
|
- titlebar_click_action_changed (client, key,
|
|
- &right_click_action,
|
|
- RIGHT_CLICK_ACTION_DEFAULT);
|
|
- }
|
|
- else if (strcmp (key, WHEEL_ACTION_KEY) == 0)
|
|
- {
|
|
- wheel_action_changed (client);
|
|
- }
|
|
- else if (strcmp (key, COMPIZ_SHADOW_RADIUS_KEY) == 0 ||
|
|
- strcmp (key, COMPIZ_SHADOW_OPACITY_KEY) == 0 ||
|
|
- strcmp (key, COMPIZ_SHADOW_OFFSET_X_KEY) == 0 ||
|
|
- strcmp (key, COMPIZ_SHADOW_OFFSET_Y_KEY) == 0 ||
|
|
- strcmp (key, COMPIZ_SHADOW_COLOR_KEY) == 0)
|
|
- {
|
|
- if (shadow_settings_changed (client))
|
|
- changed = TRUE;
|
|
- }
|
|
- else if (strcmp (key, BLUR_TYPE_KEY) == 0)
|
|
- {
|
|
- if (blur_settings_changed (client))
|
|
- changed = TRUE;
|
|
- }
|
|
- else if (strcmp (key, USE_META_THEME_KEY) == 0 ||
|
|
- strcmp (key, META_THEME_KEY) == 0)
|
|
- {
|
|
- if (theme_changed (client))
|
|
- changed = TRUE;
|
|
- }
|
|
- else if (strcmp (key, META_BUTTON_LAYOUT_KEY) == 0)
|
|
- {
|
|
- if (button_layout_changed (client))
|
|
- changed = TRUE;
|
|
- }
|
|
- else if (strcmp (key, META_THEME_OPACITY_KEY) == 0 ||
|
|
- strcmp (key, META_THEME_SHADE_OPACITY_KEY) == 0 ||
|
|
- strcmp (key, META_THEME_ACTIVE_OPACITY_KEY) == 0 ||
|
|
- strcmp (key, META_THEME_ACTIVE_SHADE_OPACITY_KEY) == 0)
|
|
- {
|
|
- if (theme_opacity_changed (client))
|
|
- changed = TRUE;
|
|
- }
|
|
- else if (strcmp (key, MATE_CURSOR_THEME_KEY) == 0 ||
|
|
- strcmp (key, MATE_CURSOR_SIZE_KEY) == 0)
|
|
- {
|
|
- cursor_theme_changed (client);
|
|
- }
|
|
-
|
|
- if (changed)
|
|
- decorations_changed (data);
|
|
-}
|
|
-#endif
|
|
-
|
|
static gboolean
|
|
init_settings (MatewnckScreen *screen)
|
|
{
|
|
@@ -6442,39 +5971,6 @@ init_settings (MatewnckScreen *screen)
|
|
GdkColormap *colormap;
|
|
AtkObject *switcher_label_obj;
|
|
|
|
-#ifdef USE_MATECONF
|
|
- MateConfClient *mateconf;
|
|
-
|
|
- mateconf = mateconf_client_get_default ();
|
|
-
|
|
- mateconf_client_add_dir (mateconf,
|
|
- MATECONF_DIR,
|
|
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
|
|
- NULL);
|
|
-
|
|
- mateconf_client_add_dir (mateconf,
|
|
- MARCO_MATECONF_DIR,
|
|
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
|
|
- NULL);
|
|
-
|
|
- mateconf_client_add_dir (mateconf,
|
|
- MATE_MOUSE_DIR,
|
|
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
|
|
- NULL);
|
|
-
|
|
- mateconf_client_add_dir (mateconf,
|
|
- COMPIZ_MATECONF_DIR1,
|
|
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
|
|
- NULL);
|
|
-
|
|
- g_signal_connect (G_OBJECT (mateconf),
|
|
- "value_changed",
|
|
- G_CALLBACK (value_changed),
|
|
- screen);
|
|
-
|
|
- cursor_theme_changed(mateconf);
|
|
-#endif
|
|
-
|
|
style_window = gtk_window_new (GTK_WINDOW_POPUP);
|
|
|
|
gdkscreen = gdk_display_get_default_screen (gdk_display_get_default ());
|
|
@@ -6504,41 +6000,10 @@ init_settings (MatewnckScreen *screen)
|
|
|
|
pango_context = gtk_widget_create_pango_context (style_window);
|
|
|
|
-#ifdef USE_MATECONF
|
|
- use_system_font = mateconf_client_get_bool (mateconf,
|
|
- COMPIZ_USE_SYSTEM_FONT_KEY,
|
|
- NULL);
|
|
- theme_changed (mateconf);
|
|
- theme_opacity_changed (mateconf);
|
|
- button_layout_changed (mateconf);
|
|
-#endif
|
|
-
|
|
update_style (style_window);
|
|
|
|
-#ifdef USE_MATECONF
|
|
- titlebar_font_changed (mateconf);
|
|
-#endif
|
|
-
|
|
update_titlebar_font ();
|
|
|
|
-#ifdef USE_MATECONF
|
|
- titlebar_click_action_changed (mateconf,
|
|
- COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY,
|
|
- &double_click_action,
|
|
- DOUBLE_CLICK_ACTION_DEFAULT);
|
|
- titlebar_click_action_changed (mateconf,
|
|
- COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY,
|
|
- &middle_click_action,
|
|
- MIDDLE_CLICK_ACTION_DEFAULT);
|
|
- titlebar_click_action_changed (mateconf,
|
|
- COMPIZ_RIGHT_CLICK_TITLEBAR_KEY,
|
|
- &right_click_action,
|
|
- RIGHT_CLICK_ACTION_DEFAULT);
|
|
- wheel_action_changed (mateconf);
|
|
- shadow_settings_changed (mateconf);
|
|
- blur_settings_changed (mateconf);
|
|
-#endif
|
|
-
|
|
(*theme_update_border_extents) (text_height);
|
|
|
|
update_shadow ();
|