void
_clutter_backend_gdk_update_setting (ClutterBackendGdk *backend_gdk,
				     const gchar       *setting_name)
{
  ClutterSettings *settings = clutter_settings_get_default ();
  int i;

  for (i = 0; i < G_N_ELEMENTS (_clutter_settings_map); i++)
    {
      if (g_strcmp0 (CLUTTER_SETTING_GDK_NAME (i), setting_name) == 0)
	{
	  GValue val = G_VALUE_INIT;

	  g_value_init (&val, CLUTTER_SETTING_TYPE (i));
	  gdk_screen_get_setting (backend_gdk->screen,
				  CLUTTER_SETTING_GDK_NAME (i),
				  &val);
	  g_object_set_property (G_OBJECT (settings),
				 CLUTTER_SETTING_PROPERTY (i),
				 &val);
	  g_value_unset (&val);

	  break;
	}
    }
}
static void
clutter_backend_gdk_init_settings (ClutterBackendGdk *backend_gdk)
{
  ClutterSettings *settings = clutter_settings_get_default ();
  int i;

  for (i = 0; i < G_N_ELEMENTS (_clutter_settings_map); i++)
    {
      GValue val = G_VALUE_INIT;

      g_value_init (&val, CLUTTER_SETTING_TYPE(i));
      gdk_screen_get_setting (backend_gdk->screen,
			      CLUTTER_SETTING_GDK_NAME(i),
			      &val);
      g_object_set_property (G_OBJECT (settings),
			     CLUTTER_SETTING_PROPERTY(i),
			     &val);
      g_value_unset (&val);
    }
}
Пример #3
0
static void
clutter_backend_x11_xsettings_notify (const char       *name,
                                      XSettingsAction   action,
                                      XSettingsSetting *setting,
                                      void             *cb_data)
{
  ClutterSettings *settings = clutter_settings_get_default ();
  gint i;

  if (name == NULL || *name == '\0')
    return;

  if (setting == NULL)
    return;

  g_object_freeze_notify (G_OBJECT (settings));

  for (i = 0; i < _n_clutter_settings_map; i++)
    {
      if (g_strcmp0 (name, CLUTTER_SETTING_X11_NAME (i)) == 0)
        {
          GValue value = G_VALUE_INIT;

          switch (setting->type)
            {
            case XSETTINGS_TYPE_INT:
              g_value_init (&value, G_TYPE_INT);
              g_value_set_int (&value, setting->data.v_int);
              break;

            case XSETTINGS_TYPE_STRING:
              g_value_init (&value, G_TYPE_STRING);
              g_value_set_string (&value, setting->data.v_string);
              break;

            case XSETTINGS_TYPE_COLOR:
              {
                ClutterColor color;

                color.red   = (guint8) ((float) setting->data.v_color.red
                            / 65535.0 * 255);
                color.green = (guint8) ((float) setting->data.v_color.green
                            / 65535.0 * 255);
                color.blue  = (guint8) ((float) setting->data.v_color.blue
                            / 65535.0 * 255);
                color.alpha = (guint8) ((float) setting->data.v_color.alpha
                            / 65535.0 * 255);

                g_value_init (&value, G_TYPE_BOXED);
                clutter_value_set_color (&value, &color);
              }
              break;
            }

          CLUTTER_NOTE (BACKEND,
                        "Mapping XSETTING '%s' to 'ClutterSettings:%s'",
                        CLUTTER_SETTING_X11_NAME (i),
                        CLUTTER_SETTING_PROPERTY (i));

          clutter_settings_set_property_internal (settings,
                                                  CLUTTER_SETTING_PROPERTY (i),
                                                  &value);

          g_value_unset (&value);

          break;
        }
    }

  g_object_thaw_notify (G_OBJECT (settings));
}