static ClutterActor*
create_clutter_texture(EmpathyVideoWidget *object)
{
  EmpathyVideoWidgetPriv *priv = GET_PRIV (object);
  ClutterActor           *texture, *stage, *box;
  ClutterLayoutManager   *layout;

  stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (object));
  g_assert (stage != NULL);
  clutter_stage_set_color (CLUTTER_STAGE(stage), CLUTTER_COLOR_Black);


  layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
    CLUTTER_BIN_ALIGNMENT_CENTER);
  g_assert (layout != NULL);
  box = clutter_box_new (layout);
  g_assert (box != NULL);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
  priv->notify_allocation_id = g_signal_connect (stage, "notify::allocation",
    G_CALLBACK(on_stage_allocation_changed), box);


  texture = clutter_texture_new ();
  g_assert (texture != NULL);

  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE);
  g_object_ref (G_OBJECT (texture));
  clutter_box_pack (CLUTTER_BOX (box), texture, NULL, NULL);

  return texture;
}
Example #2
0
static ClutterActor *
window_backed_app_get_icon (CinnamonApp *app,
                            int       size)
{
  MetaWindow *window;
  ClutterActor *actor;
  gint scale;
  CinnamonGlobal *global;
  StThemeContext *context;

  global = cinnamon_global_get ();
  context = st_theme_context_get_for_stage (cinnamon_global_get_stage (global));
  g_object_get (context, "scale-factor", &scale, NULL);

  size *= scale;

  /* During a state transition from running to not-running for
   * window-backend apps, it's possible we get a request for the icon.
   * Avoid asserting here and just return an empty image.
   */
  if (app->running_state == NULL)
    {
      actor = clutter_texture_new ();
      g_object_set (actor, "opacity", 0, "width", (float) size, "height", (float) size, NULL);
      return actor;
    }

  window = window_backed_app_get_window (app);
  actor = st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
                                                               G_OBJECT (window),
                                                               "icon");
  g_object_set (actor, "width", (float) size, "height", (float) size, NULL);
  return actor;
}
/**
 * shell_app_info_create_icon_texture:
 *
 * Look up the icon for this application, and create a #ClutterTexture
 * for it at the given size.
 *
 * Return value: (transfer none): A floating #ClutterActor
 */
ClutterActor *
shell_app_info_create_icon_texture (ShellAppInfo *info, float size)
{
  GIcon *icon;
  ClutterActor *ret;

  if (info->type == SHELL_APP_INFO_TYPE_WINDOW)
    {
      return st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
                                                    G_OBJECT (info->window),
                                                    "icon");
    }

  icon = shell_app_info_get_icon (info);
  if (icon == NULL)
    {
      ret = clutter_texture_new ();
      g_object_set (ret, "opacity", 0, "width", size, "height", size, NULL);
    }
  else
    {
      ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), icon, (int)size);
      g_object_unref (icon);
    }

  return ret;
}
/**
 * st_texture_cache_bind_cairo_surface_property:
 * @cache:
 * @object: A #GObject with a property @property_name of type #GdkPixbuf
 * @property_name: Name of a property
 *
 * Create a #ClutterTexture which tracks the #cairo_surface_t value of a GObject property
 * named by @property_name.  Unlike other methods in StTextureCache, the underlying
 * #CoglTexture is not shared by default with other invocations to this method.
 *
 * If the source object is destroyed, the texture will continue to show the last
 * value of the property.
 *
 * Return value: (transfer none): A new #ClutterActor
 */
ClutterActor *
st_texture_cache_bind_cairo_surface_property (StTextureCache    *cache,
                                              GObject           *object,
                                              const char        *property_name)
{
  ClutterTexture *texture;
  gchar *notify_key;
  StTextureCachePropertyBind *bind;

  texture = CLUTTER_TEXTURE (clutter_texture_new ());

  bind = g_new0 (StTextureCachePropertyBind, 1);
  bind->cache = cache;
  bind->texture = texture;
  bind->source = object;
  g_object_weak_ref (G_OBJECT (texture), st_texture_cache_bind_weak_notify, bind);
  bind->weakref_active = TRUE;

  st_texture_cache_reset_texture (bind, property_name);

  notify_key = g_strdup_printf ("notify::%s", property_name);
  bind->notify_signal_id = g_signal_connect_data (object, notify_key, G_CALLBACK(st_texture_cache_on_pixbuf_notify),
                                                  bind, (GClosureNotify)st_texture_cache_free_bind, 0);
  g_free (notify_key);

  return CLUTTER_ACTOR(texture);
}
Example #5
0
static void
shell_status_menu_init (ShellStatusMenu *status)
{
  ShellStatusMenuPrivate *priv;

  status->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (status, SHELL_TYPE_STATUS_MENU,
                                                     ShellStatusMenuPrivate);

  g_object_set (G_OBJECT (status),
                "orientation", BIG_BOX_ORIENTATION_HORIZONTAL,
                NULL);
  priv->client = gconf_client_get_default ();

  priv->user_icon = CLUTTER_TEXTURE (clutter_texture_new ());
  big_box_append (BIG_BOX (status), CLUTTER_ACTOR (status->priv->user_icon), 0);

  priv->name_box = BIG_BOX (big_box_new (BIG_BOX_ORIENTATION_VERTICAL));
  g_object_set (G_OBJECT (priv->name_box), "y-align", BIG_BOX_ALIGNMENT_CENTER, NULL);
  big_box_append (BIG_BOX (status), CLUTTER_ACTOR (priv->name_box), BIG_BOX_PACK_EXPAND);
  priv->name = CLUTTER_TEXT (clutter_text_new ());
  big_box_append (BIG_BOX (priv->name_box), CLUTTER_ACTOR (priv->name), BIG_BOX_PACK_EXPAND);

  priv->manager = gdm_user_manager_ref_default ();
  setup_current_user (status);

  create_sub_menu (status);
}
/* We want to preserve the aspect ratio by default, also the default
 * pipeline for an empty texture is full opacity white, which we
 * definitely don't want.  Skip that by setting 0 opacity.
 */
static ClutterTexture *
create_default_texture (void)
{
  ClutterTexture * texture = CLUTTER_TEXTURE (clutter_texture_new ());
  g_object_set (texture, "keep-aspect-ratio", TRUE, "opacity", 0, NULL);
  return texture;
}
/**
 * shell_startup_sequence_create_icon:
 * @sequence:
 * @size: Size in pixels of icon
 *
 * Returns: (transfer none): A new #ClutterTexture containing an icon for the sequence
 */
ClutterActor *
shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size)
{
  GIcon *themed;
  const char *icon_name;
  ClutterActor *texture;
  gint scale;
  ShellGlobal *global;
  StThemeContext *context;

  global = shell_global_get ();
  context = st_theme_context_get_for_stage (shell_global_get_stage (global));
  g_object_get (context, "scale-factor", &scale, NULL);

  icon_name = sn_startup_sequence_get_icon_name ((SnStartupSequence*)sequence);
  if (!icon_name)
    {
      texture = clutter_texture_new ();
      clutter_actor_set_size (texture, size * scale, size * scale);
      return texture;
    }

  themed = g_themed_icon_new (icon_name);
  texture = st_texture_cache_load_gicon (st_texture_cache_get_default (),
                                         NULL, themed, size, scale);
  g_object_unref (G_OBJECT (themed));
  return texture;
}
static void
mex_telepathy_channel_create_incoming_video (MexTelepathyChannel *self)
{
  MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv;

  ClutterActor *video_incoming_area;

  /* Setup the incoming surface to draw to */
  priv->incoming_texture = clutter_texture_new ();
  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->incoming_texture),
                                         TRUE);

  video_incoming_area = mx_stack_new ();

  clutter_container_add (CLUTTER_CONTAINER (video_incoming_area),
                         mex_telepathy_channel_create_static_image(),
                         priv->incoming_texture,
                         NULL);

  /* Create a frame for it with a styled border */
  priv->full_frame = mx_frame_new();
  clutter_actor_set_name (priv->full_frame, "Incoming Frame");
  mx_bin_set_fill (MX_BIN (priv->full_frame), TRUE, TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (priv->full_frame),
                               "CallWindow");
  clutter_actor_add_effect (priv->full_frame,
                            CLUTTER_EFFECT (
                              mex_telepathy_channel_create_shadow ()));
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->full_frame),
                               video_incoming_area);

  priv->incoming_sink =
    clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->incoming_texture));
}
Example #9
0
/**
 * st_texture_cache_load_file_simple:
 * @cache: A #StTextureCache
 * @file_path: Filesystem path
 *
 * Synchronously load an image into a texture.  The texture will be cached
 * indefinitely.  On error, this function returns an empty texture and prints a warning.
 *
 * Returns: (transfer none): A new #ClutterTexture
 */
ClutterActor *
st_texture_cache_load_file_simple (StTextureCache *cache,
                                   const gchar    *file_path)
{
  GFile *file;
  char *uri;
  ClutterActor *texture;
  GError *error = NULL;

  file = g_file_new_for_path (file_path);
  uri = g_file_get_uri (file);

  texture = st_texture_cache_load_uri_sync (cache, ST_TEXTURE_CACHE_POLICY_FOREVER,
                                            uri, -1, -1, &error);
  g_object_unref (file);
  free (uri);
  if (texture == NULL)
    {
      if (error)
        {
          g_warning ("Failed to load %s: %s", file_path, error->message);
          g_clear_error (&error);
        }
      else
        g_warning ("Failed to load %s", file_path);
      texture = clutter_texture_new ();
    }
  return texture;
}
/**
 * cinnamon_startup_sequence_create_icon:
 * @sequence:
 * @size: Size in pixels of icon
 *
 * Returns: (transfer none): A new #ClutterTexture containing an icon for the sequence
 */
ClutterActor *
cinnamon_startup_sequence_create_icon (CinnamonStartupSequence *sequence, guint size)
{
  GIcon *themed;
  const char *icon_name;
  ClutterActor *texture;

  icon_name = sn_startup_sequence_get_icon_name ((SnStartupSequence*)sequence);
  if (!icon_name)
    {
      gint scale;
      CinnamonGlobal *global;
      StThemeContext *context;

      texture = clutter_texture_new ();

      global = cinnamon_global_get ();
      context = st_theme_context_get_for_stage (cinnamon_global_get_stage (global));
      g_object_get (context, "scale-factor", &scale, NULL);

      clutter_actor_set_size (texture, size * scale, size * scale);
      return texture;
    }

  themed = g_themed_icon_new (icon_name);
  texture = g_object_new (ST_TYPE_ICON, "gicon", themed, "icon-size", size, NULL);
  g_object_unref (G_OBJECT (themed));
  return texture;
}
static void
mex_telepathy_channel_create_preview (MexTelepathyChannel *self)
{
  MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv;

  ClutterActor *video_preview_area;

  priv->video_outgoing = clutter_texture_new ();
  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->video_outgoing),
                                         TRUE);

  priv->outgoing_sink =
    clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->video_outgoing));

  video_preview_area = mx_stack_new ();

  clutter_container_add (CLUTTER_CONTAINER (video_preview_area),
                         mex_telepathy_channel_create_static_image(),
                         priv->video_outgoing,
                         NULL);

  mx_stylable_set_style_class (MX_STYLABLE (video_preview_area),
                               "PreviewStack");

  clutter_actor_set_height (video_preview_area, 150.0);
  clutter_actor_add_effect (video_preview_area,
                            CLUTTER_EFFECT (
                              mex_telepathy_channel_create_shadow ()));

  priv->preview_area = mx_frame_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->preview_area),
                               "PreviewPadding");
  mx_bin_set_child (MX_BIN (priv->preview_area), video_preview_area);
}
Example #12
0
/**
 * cinnamon_app_get_faded_icon:
 * @app: A #CinnamonApp
 * @size: Size in pixels
 *
 * Return an actor with a horizontally faded look.
 *
 * Return value: (transfer none): A floating #ClutterActor, or %NULL if no icon
 */
ClutterActor *
cinnamon_app_get_faded_icon (CinnamonApp *app, int size)
{
  CoglHandle texture;
  ClutterActor *result;
  char *cache_key;
  CreateFadedIconData data;
  gint scale;
  CinnamonGlobal *global;
  StThemeContext *context;

  /* Don't fade for window backed apps for now...easier to reuse the
   * property tracking bits, and this helps us visually distinguish
   * app-tracked from not.
   */
  if (!app->entry)
    return window_backed_app_get_icon (app, size);

  global = cinnamon_global_get ();
  context = st_theme_context_get_for_stage (cinnamon_global_get_stage (global));
  g_object_get (context, "scale-factor", &scale, NULL);

  cache_key = g_strdup_printf ("faded-icon:%s,size=%d,scale=%d", cinnamon_app_get_id (app), size, scale);
  data.app = app;
  data.size = size;
  data.scale = scale;
  texture = st_texture_cache_load (st_texture_cache_get_default (),
                                   cache_key,
                                   ST_TEXTURE_CACHE_POLICY_FOREVER,
                                   cinnamon_app_create_faded_icon_cpu,
                                   &data,
                                   NULL);
  g_free (cache_key);

  if (texture != COGL_INVALID_HANDLE)
    {
      result = clutter_texture_new ();
      clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (result), texture);
    }
  else
    {
      result = clutter_texture_new ();
      g_object_set (result, "opacity", 0, "width", (float) size * scale, "height", (float) size * scale, NULL);

    }
  return result;
}
Example #13
0
int
main (int argc, char **argv)
{
  ClutterActor *stage, *image, *sub_image;
  CoglHandle texture, sub_texture;
  gfloat image_width, image_height;

  /* Initialize Clutter */
  if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
    return 1;

  /* Get the default stage */
  stage = clutter_stage_get_default ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Sub-texture");

  /* Create a new ClutterTexture that shows smiley.png */
  image = clutter_texture_new_from_file ("smiley.png", NULL);
  clutter_actor_get_size (image, &image_width, &image_height);
  clutter_actor_set_size (stage,
                          image_width * 3 / 2 + 30,
                          image_height + 20);

  /* Grab the CoglHandle of the underlying Cogl texture */
  texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (image));

  /* Create a new Cogl texture from the handle above. That new texture is a
   * rectangular region from image, more precisely the north ouest corner
   * of the image */
  sub_texture = cogl_texture_new_from_sub_texture (texture,
                                                   0, 0,
                                                   image_width / 2,
                                                   image_height / 2);

  /* Finally, use the newly created Cogl texture to feed a new ClutterTexture
   * and thus create a new actor that displays sub_texture */
   sub_image = clutter_texture_new ();
   clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (sub_image), sub_texture);

  /*
   * You could have used the more straightforward g_object_new() function that
   * can create an object and set some properties on it at the same time:
   * sub_image = g_object_new (CLUTTER_TYPE_TEXTURE,
   *                           "cogl-texture", sub_texture,
   *                           NULL);
   */

  /* Put the original image at (10,10) and the new sub image next to it */
  clutter_actor_set_position (image, 10, 10);
  clutter_actor_set_position (sub_image, 20 + image_width, 10);

  /* Add both ClutterTexture to the stage */
  clutter_container_add (CLUTTER_CONTAINER (stage), image, sub_image, NULL);

  clutter_actor_show_all (stage);

  clutter_main ();

  return 0;
}
static void
impl_constructed (GObject *object)
{
    RBVisualizerPage *page;
    ClutterInitError err;
    GstElement *colorspace;
    GstElement *realsink;
    GstElement *capsfilter;
    GstCaps *caps;
    GstPad *pad;

    RB_CHAIN_GOBJECT_METHOD (rb_visualizer_page_parent_class, constructed, object);
    page = RB_VISUALIZER_PAGE (object);

    err = gtk_clutter_init (NULL, NULL);
    if (err != CLUTTER_INIT_SUCCESS) {
        /* maybe do something more sensible here.  not sure if there are any user-recoverable
         * conditions that would cause clutter init to fail, though, so it may not be worth it.
         * as it is, we just won't add the page to the page tree.
         */
        g_warning ("Unable to display visual effects due to Clutter init failure");
        return;
    }

    page->texture = clutter_texture_new ();
    clutter_texture_set_sync_size (CLUTTER_TEXTURE (page->texture), TRUE);
    clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (page->texture), TRUE);

    page->sink = gst_bin_new (NULL);
    g_object_ref (page->sink);

    /* actual sink */
    realsink = gst_element_factory_make ("cluttersink", NULL);
    g_object_set (realsink, "texture", page->texture, NULL);

    colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
    /* capsfilter to force rgb format (without this we end up using ayuv) */
    capsfilter = gst_element_factory_make ("capsfilter", NULL);
    caps = gst_caps_from_string ("video/x-raw-rgb,bpp=(int)24,depth=(int)24,"
                                 "endianness=(int)4321,red_mask=(int)16711680,"
                                 "green_mask=(int)65280,blue_mask=(int)255");
    g_object_set (capsfilter, "caps", caps, NULL);
    gst_caps_unref (caps);

    gst_bin_add_many (GST_BIN (page->sink), colorspace, capsfilter, realsink, NULL);
    gst_element_link (colorspace, capsfilter);
    gst_element_link (capsfilter, realsink);

    pad = gst_element_get_static_pad (colorspace, "sink");
    gst_element_add_pad (page->sink, gst_ghost_pad_new ("sink", pad));
    gst_object_unref (pad);

    g_signal_connect_object (page->fullscreen_action,
                             "toggled",
                             G_CALLBACK (toggle_fullscreen_cb),
                             page, 0);
}
Example #15
0
static void
cheese_widget_init (CheeseWidget *widget)
{
  CheeseWidgetPrivate *priv = CHEESE_WIDGET_GET_PRIVATE (widget);
  GtkWidget           *box;
  ClutterActor        *stage, *frame;
  ClutterConstraint   *constraint;
  ClutterColor black = { 0x00, 0x00, 0x00, 0xff };

  priv->state = CHEESE_WIDGET_STATE_NONE;
  priv->error = NULL;

  /* XXX
   * remove this line if you want to debug */
  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
  gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);

  /* Spinner page */
  priv->spinner = gtk_spinner_new ();
  box           = gtk_event_box_new ();
  gtk_container_add (GTK_CONTAINER (box), priv->spinner);
  cheese_widget_spinner_invert (priv->spinner, box);
  gtk_widget_show_all (box);

  gtk_notebook_append_page (GTK_NOTEBOOK (widget),
                            box, gtk_label_new ("spinner"));

  /* Webcam page */
  priv->screen = gtk_clutter_embed_new ();
  stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->screen));
  clutter_stage_set_color (CLUTTER_STAGE (stage), &black);
  frame = cheese_aspect_frame_new ();

  priv->texture = clutter_texture_new ();
  clutter_actor_set_size (priv->texture, 400, 300);
  mx_bin_set_child (MX_BIN (frame), priv->texture);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), frame);
  constraint = clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0);
  clutter_actor_add_constraint_with_name (frame, "size", constraint);

  gtk_widget_show (priv->screen);
  clutter_actor_show (priv->texture);
  gtk_notebook_append_page (GTK_NOTEBOOK (widget),
                            priv->screen, gtk_label_new ("webcam"));

  /* Problem page */
  priv->problem = gtk_drawing_area_new ();
  gtk_widget_show (priv->problem);
  gtk_notebook_append_page (GTK_NOTEBOOK (widget),
                            priv->problem,
                            gtk_label_new ("got problems"));

  priv->settings = g_settings_new ("org.gnome.Cheese");
}
Example #16
0
int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *screen;
  CheeseCamera *camera;
  ClutterActor *stage;
  ClutterActor *texture;

  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return EXIT_FAILURE;

  if (!cheese_init (&argc, &argv))
    return EXIT_FAILURE;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
  g_signal_connect (G_OBJECT (window), "delete-event",
                    G_CALLBACK (delete_callback), NULL);

  screen = gtk_clutter_embed_new ();
  stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (screen));
  texture = clutter_texture_new ();

  clutter_actor_set_size (texture, 400, 300);
  clutter_actor_add_child (stage, texture);

  gtk_widget_show (screen);
  clutter_actor_show (texture);

  camera = cheese_camera_new (CLUTTER_TEXTURE (texture), NULL, 640, 480);

  cheese_camera_setup (camera, NULL, NULL);

  gtk_container_add (GTK_CONTAINER (window), screen);

  gtk_widget_show_all (window);

  cheese_camera_play (camera);

  g_timeout_add_seconds (5, (GSourceFunc) (time_cb), camera);

  gtk_main ();

  return EXIT_SUCCESS;
}
Example #17
0
static void bar_pane_gps_thumb_done_cb(ThumbLoader *tl, gpointer data)
{
	FileData *fd;
	ClutterActor *marker;
	ClutterActor *actor;

	marker = CLUTTER_ACTOR(data);
	fd = g_object_get_data(G_OBJECT(marker), "file_fd");
	if (fd->thumb_pixbuf != NULL)
		{
		actor = clutter_texture_new();
		gtk_clutter_texture_set_from_pixbuf(CLUTTER_TEXTURE(actor), fd->thumb_pixbuf, NULL);
		champlain_marker_set_image(CHAMPLAIN_MARKER(marker), actor);
		}
	thumb_loader_free(tl);
}
Example #18
0
static void
fluttr_viewer_init (FluttrViewer *self)
{
	FluttrViewerPrivate *priv;
	gint width, height;
	ClutterActor *message;
	
	priv = FLUTTR_VIEWER_GET_PRIVATE (self);
	
	priv->mini_token = NULL;
	priv->popping = FALSE;

	width = CLUTTER_STAGE_WIDTH ();
	height = CLUTTER_STAGE_HEIGHT ();
		
	/* message box */
	message = clutter_texture_new ();
	priv->texture = message;
	clutter_group_add (CLUTTER_GROUP (self),message); 
	clutter_actor_set_size (message, width, height);
	clutter_actor_set_position (message, -(width/2),-(height/2));
	
	/* Spinner */
	priv->spinner = fluttr_spinner_new ();
	clutter_group_add (CLUTTER_GROUP (self),priv->spinner); 
	clutter_actor_set_size (priv->spinner, (height/6)-11, (height/6)-11);
	clutter_actor_set_position (priv->spinner, width-(height/6),height-(height/6));	
				    
	/* Setup the pixbuf swap */
	priv->pixbuf = NULL;
	priv->swap_time = clutter_timeline_new (40, 40);
	priv->swap_alpha = clutter_alpha_new_full (priv->swap_time,
					           alpha_linear_inc_func,
					           NULL, NULL);
	priv->swap_behave = fluttr_behave_new (priv->swap_alpha,
					       fluttr_viewer_swap_alpha_func,
					       (gpointer)self);
					  				    
	priv->timeline = clutter_timeline_new (40, 80);
	priv->alpha = clutter_alpha_new_full (priv->timeline,
					      alpha_sine_inc_func,
					      NULL, NULL);
	priv->behave = fluttr_behave_new (priv->alpha,
					  fluttr_viewer_alpha_func,
					  (gpointer)self);
		
}
Example #19
0
/**
 * st_texture_cache_load_recent_thumbnail:
 * @cache:
 * @size: Size in pixels to use for thumbnail
 * @info: Recent item info
 *
 * Asynchronously load a thumbnail image of a #GtkRecentInfo into a texture.  The
 * returned texture object will be a new instance; however, its texture data
 * may be shared with other objects.  This implies the texture data is cached.
 *
 * The current caching policy is permanent; to uncache, you must explicitly
 * call st_texture_cache_unref_recent_thumbnail().
 *
 * Returns: (transfer none): A new #ClutterActor
 */
ClutterActor *
st_texture_cache_load_recent_thumbnail (StTextureCache    *cache,
                                        int                size,
                                        GtkRecentInfo     *info)
{
  ClutterTexture *texture;
  AsyncTextureLoadData *data;
  char *key;
  CoglHandle texdata;
  const char *uri;

  uri = gtk_recent_info_get_uri (info);

  /* Don't attempt to load thumbnails for non-local URIs */
  if (!g_str_has_prefix (uri, "file://"))
    {
      GIcon *icon = icon_for_recent (info);
      return st_texture_cache_load_gicon (cache, icon, size);
    }

  texture = CLUTTER_TEXTURE (clutter_texture_new ());
  clutter_actor_set_size (CLUTTER_ACTOR (texture), size, size);

  key = g_strdup_printf (CACHE_PREFIX_THUMBNAIL_URI "uri=%s,size=%d", uri, size);

  texdata = g_hash_table_lookup (cache->priv->keyed_cache, key);
  if (!texdata)
    {
      data = g_new0 (AsyncTextureLoadData, 1);
      data->key = g_strdup (key);
      data->policy = ST_TEXTURE_CACHE_POLICY_FOREVER;
      data->thumbnail = TRUE;
      data->recent_info = gtk_recent_info_ref (info);
      data->width = size;
      data->height = size;
      data->textures = g_slist_prepend (data->textures, g_object_ref (texture));
      load_recent_thumbnail_async (cache, info, size, NULL, on_pixbuf_loaded, data);
    }
  else
    {
      set_texture_cogl_texture (texture, texdata);
    }

  g_free (key);
  return CLUTTER_ACTOR (texture);
}
Example #20
0
static void
penge_app_tile_init (PengeAppTile *self)
{
  PengeAppTilePrivate *priv = GET_PRIVATE_REAL (self);

  self->priv = priv;

  priv->tex = clutter_texture_new ();
  clutter_actor_set_size (priv->tex, ICON_SIZE, ICON_SIZE);

  mx_bin_set_child (MX_BIN (self),
                    priv->tex);
  g_signal_connect (self,
                    "clicked",
                    (GCallback)_button_clicked_cb,
                    self);
}
Example #21
0
G_MODULE_EXPORT int
test_texture_material_main (int argc, char *argv[])
{
  ClutterActor *stage, *box;
  ClutterLayoutManager *manager;
  int i;

  g_thread_init (NULL);
  clutter_threads_init ();
  clutter_init (&argc, &argv);

  stage = clutter_stage_new ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Texture Material");
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
  box = clutter_box_new (manager);
  clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -25.0));
  clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -25.0));
  clutter_actor_set_position (box, 25.0, 25.0);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

  for (i = 0; i < 48; i++)
    {
      ClutterActor *texture = clutter_texture_new ();

      clutter_texture_set_load_data_async (CLUTTER_TEXTURE (texture), TRUE);
      clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE);
      clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
                                     TESTS_DATADIR "/redhand.png",
                                     NULL);
      clutter_actor_set_width (texture, 96);

      clutter_container_add_actor (CLUTTER_CONTAINER (box), texture);
    }

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
Example #22
0
void show_image(XImage *img)
{
	ClutterActor *stage, *actor;
	
	// init stage
	clutter_init(0, NULL);
	stage = clutter_stage_get_default(); // XX TODO: use root window?
	
	// init actor
	actor = clutter_texture_new();
	clutter_texture_set_from_rgb_data(CLUTTER_TEXTURE(actor), img->data, False, img->width, img->height, img->bytes_per_line, 4, (ClutterTextureFlags)0, NULL);
	clutter_container_add(CLUTTER_CONTAINER(stage), actor, NULL);
  clutter_actor_set_position(actor, 10, 10);
  
  g_signal_connect(stage, "button-press-event", clutter_main_quit, NULL);
  
  // show and wait for exit
  clutter_actor_show(stage);
  clutter_main();
}
Example #23
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *texture;
  GError *error = NULL;
  ClutterActor *clone;
  gfloat y_offset;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Reflection");
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  texture = clutter_texture_new ();
  clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
                                 "redhand.png",
                                 &error);
  clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
  clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.2));

  y_offset = clutter_actor_get_height (texture) + V_PADDING;

  clone = clutter_clone_new (texture);
  clutter_actor_add_constraint (clone, clutter_bind_constraint_new (texture, CLUTTER_BIND_X, 0.0));
  clutter_actor_add_constraint (clone, clutter_bind_constraint_new (texture, CLUTTER_BIND_Y, y_offset));
  g_signal_connect (clone,
                    "paint",
                    G_CALLBACK (_clone_paint_cb),
                    NULL);

  clutter_container_add (CLUTTER_CONTAINER (stage), texture, clone, NULL);

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
/**
 * shell_startup_sequence_create_icon:
 * @sequence:
 * @size: Size in pixels of icon
 *
 * Returns: (transfer none): A new #ClutterTexture containing an icon for the sequence
 */
ClutterActor *
shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size)
{
  GIcon *themed;
  const char *icon_name;
  ClutterActor *texture;

  icon_name = sn_startup_sequence_get_icon_name ((SnStartupSequence*)sequence);
  if (!icon_name)
    {
      texture = clutter_texture_new ();
      clutter_actor_set_size (texture, size, size);
      return texture;
    }

  themed = g_themed_icon_new (icon_name);
  texture = st_texture_cache_load_gicon (st_texture_cache_get_default (),
                                         themed, size);
  g_object_unref (G_OBJECT (themed));
  return texture;
}
Example #25
0
void Platform::init(int* argc, char*** argv)
{
    if(m_initialized)
        return;

    m_initialized = true;

    if (!g_thread_supported ())
        g_thread_init (NULL);

    clutter_gst_init (argc, argv);

    m_stage = clutter_stage_get_default();
    clutter_actor_set_size(m_stage, (gfloat)960, (gfloat)540);

    m_videoTexture = clutter_texture_new ();
    GstPlaybin::getInstance().init(m_videoTexture);
    clutter_container_add_actor (CLUTTER_CONTAINER (m_stage), m_videoTexture);
    g_signal_connect (CLUTTER_STAGE (m_stage), "fullscreen", G_CALLBACK (Platform::windowSizeChanged), this);
    g_signal_connect (CLUTTER_STAGE (m_stage), "unfullscreen", G_CALLBACK (Platform::windowSizeChanged), this);
//	g_signal_connect (CLUTTER_STAGE (m_stage), "event", G_CALLBACK (Platform::stageEvent), this);
}
Example #26
0
static void
mpd_folder_button_init (MpdFolderButton *self)
{
  MpdFolderButtonPrivate *priv = GET_PRIVATE (self);
  ClutterActor  *vbox;
  ClutterText   *text;

  /* Box */
  vbox = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL);
  mx_bin_set_child (MX_BIN (self), vbox);

  /* Icon */
  priv->icon = clutter_texture_new ();
  clutter_texture_set_sync_size (CLUTTER_TEXTURE (priv->icon), true);
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), priv->icon);
  clutter_container_child_set (CLUTTER_CONTAINER (vbox), priv->icon,
                               "expand", false,
                               "x-align", MX_ALIGN_MIDDLE,
                               "x-fill", false,
                               "y-align", MX_ALIGN_START,
                               "y-fill", false,
                               NULL);

  /* Label */
  priv->label = mx_label_new ();
  text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label));
  clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD_CHAR);
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), priv->label);
  clutter_container_child_set (CLUTTER_CONTAINER (vbox), priv->label,
                               "expand", false,
                               "x-align", MX_ALIGN_MIDDLE,
                               "x-fill", false,
                               "y-align", MX_ALIGN_START,
                               "y-fill", false,
                               NULL);
}
Example #27
0
/* clutter scene */
ClutterActor *
setup_stage (ClutterStage * stage)
{
  ClutterTimeline *timeline = NULL;
  ClutterActor *texture_actor = NULL;
  ClutterColor rect_color = { 125, 50, 200, 255 };
  ClutterActor *rect_actor = NULL;

  /* texture actor */

  texture_actor = clutter_texture_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture_actor);
  clutter_actor_set_position (texture_actor, 300, 170);
  clutter_actor_set_scale (texture_actor, 0.6, 0.6);
  clutter_actor_show (texture_actor);
  g_object_set_data (G_OBJECT (texture_actor), "stage", stage);

  /* rectangle actor */

  rect_actor = clutter_rectangle_new_with_color (&rect_color);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect_actor);
  clutter_actor_set_size (rect_actor, 50, 50);
  clutter_actor_set_position (rect_actor, 300, 300);
  clutter_actor_show (rect_actor);

  /* timeline */

  timeline = clutter_timeline_new (360, 60);
  g_object_set_data (G_OBJECT (timeline), "texture_actor", texture_actor);
  clutter_timeline_set_loop (timeline, TRUE);
  clutter_timeline_start (timeline);
  g_signal_connect (timeline, "new-frame", G_CALLBACK (on_new_frame),
      rect_actor);

  return texture_actor;
}
Example #28
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *texture;
  ClutterState *transitions;
  GError *error = NULL;
  gfloat texture_width, texture_height;

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  texture = clutter_texture_new ();
  clutter_actor_add_constraint (texture,
                                clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
  clutter_actor_add_constraint (texture,
                                clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
  clutter_texture_set_sync_size (CLUTTER_TEXTURE (texture), TRUE);
  clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
                                 TESTS_DATA_DIR "/redhand.png",
                                 &error);

  if (error != NULL)
    {
      g_error ("Problem loading image into texture - %s", error->message);
      g_error_free (error);
      return 1;
    }

  clutter_actor_get_size (texture, &texture_width, &texture_height);
  clutter_actor_set_size (stage, texture_width * 2, texture_height * 2);

  /* set all centres of rotation to the centre of the texture */
  clutter_actor_set_rotation (texture,
                              CLUTTER_X_AXIS,
                              0.0,
                              texture_width * 0.5,
                              texture_height * 0.5,
                              0.0);
  clutter_actor_set_rotation (texture,
                              CLUTTER_Y_AXIS,
                              0.0,
                              texture_width * 0.5,
                              texture_height * 0.5,
                              0.0);
  clutter_actor_set_z_rotation_from_gravity (texture, 0.0, CLUTTER_GRAVITY_CENTER);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture);

  /* set up the animations */
  transitions = clutter_state_new ();

  clutter_state_set (transitions, NULL, "start",
                     texture, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
                     texture, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
                     texture, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
                     NULL);
  clutter_state_set (transitions, NULL, "x-cw",
                     texture, "rotation-angle-x", CLUTTER_LINEAR, ROTATION_ANGLE,
                     NULL);
  clutter_state_set (transitions, NULL, "x-ccw",
                     texture, "rotation-angle-x", CLUTTER_LINEAR, -ROTATION_ANGLE,
                     NULL);
  clutter_state_set (transitions, NULL, "x-after",
                     texture, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
                     NULL);
  clutter_state_set (transitions, NULL, "y-cw",
                     texture, "rotation-angle-y", CLUTTER_LINEAR, ROTATION_ANGLE,
                     NULL);
  clutter_state_set (transitions, NULL, "y-ccw",
                     texture, "rotation-angle-y", CLUTTER_LINEAR, -ROTATION_ANGLE,
                     NULL);
  clutter_state_set (transitions, NULL, "y-after",
                     texture, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
                     NULL);
  clutter_state_set (transitions, NULL, "z-cw",
                     texture, "rotation-angle-z", CLUTTER_LINEAR, ROTATION_ANGLE,
                     NULL);
  clutter_state_set (transitions, NULL, "z-ccw",
                     texture, "rotation-angle-z", CLUTTER_LINEAR, -ROTATION_ANGLE,
                     NULL);
  clutter_state_set_duration (transitions, NULL, NULL, DURATION);
  clutter_state_set_duration (transitions, "start", NULL, DURATION * 0.5);
  clutter_state_set_duration (transitions, NULL, "start", DURATION * 0.5);
  clutter_state_set_duration (transitions, NULL, "x-after", DURATION * 0.5);
  clutter_state_set_duration (transitions, NULL, "y-after", DURATION * 0.5);

  clutter_state_warp_to_state (transitions, "start");

  g_signal_connect (transitions,
                    "completed",
                    G_CALLBACK (_set_next_state),
                    NULL);

  clutter_state_set_state (transitions, "x-cw");

  clutter_actor_show (stage);

  clutter_main ();

  return 0;
}
static void
penge_interesting_tile_init (PengeInterestingTile *self)
{
    PengeInterestingTilePrivate *priv = GET_PRIVATE_REAL (self);
    ClutterActor *tmp_text;
    ClutterActor *icon;

    self->priv = priv;

    priv->inner_table = mx_table_new ();
    mx_bin_set_child (MX_BIN (self),
                      priv->inner_table);
    mx_bin_set_fill (MX_BIN (self), TRUE, TRUE);

    priv->primary_text = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->primary_text),
                                 "PengeInterestingTilePrimaryLabel");
    tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->primary_text));
    clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text),
                                     PANGO_ALIGN_LEFT);
    clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                                PANGO_ELLIPSIZE_END);
    g_signal_connect (priv->primary_text,
                      "notify::allocation",
                      (GCallback)_label_notify_allocation_cb,
                      self);

    priv->secondary_text = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->secondary_text),
                                 "PengeInterestingTileSecondaryLabel");
    tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->secondary_text));
    clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text),
                                     PANGO_ALIGN_LEFT);
    clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                                PANGO_ELLIPSIZE_END);
    g_signal_connect (priv->secondary_text,
                      "notify::allocation",
                      (GCallback)_label_notify_allocation_cb,
                      self);

    priv->icon = clutter_texture_new ();
    clutter_actor_set_size (priv->icon, 28, 28);
    clutter_actor_hide (priv->icon);

    /* This gets added to ourself table after our body because of ordering */
    priv->details_overlay = mx_table_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->details_overlay),
                                 "PengeInterestingTileDetails");

    mx_table_add_actor (MX_TABLE (priv->inner_table),
                        priv->details_overlay,
                        1,
                        0);

    clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table),
                                 (ClutterActor *)priv->details_overlay,
                                 "x-expand", TRUE,
                                 "y-expand", FALSE,
                                 "y-fill", FALSE,
                                 "y-align", MX_ALIGN_END,
                                 NULL);

    mx_table_add_actor (MX_TABLE (priv->details_overlay),
                        priv->primary_text,
                        0,
                        1);

    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 (ClutterActor *)priv->primary_text,
                                 "x-expand",
                                 TRUE,
                                 "y-expand",
                                 FALSE,
                                 NULL);

    mx_table_add_actor (MX_TABLE (priv->details_overlay),
                        priv->secondary_text,
                        1,
                        1);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 (ClutterActor *)priv->secondary_text,
                                 "x-expand",
                                 TRUE,
                                 "y-expand",
                                 FALSE,
                                 NULL);

    mx_table_add_actor (MX_TABLE (priv->details_overlay),
                        priv->icon,
                        0,
                        0);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 priv->icon,
                                 "row-span", 2,
                                 "y-expand", FALSE,
                                 "x-expand", FALSE,
                                 "y-fill", FALSE,
                                 "x-fill", FALSE,
                                 NULL);

    priv->remove_button = mx_button_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->remove_button),
                                 "PengeInterestingTileRemoveButton");
    icon = (ClutterActor *)mx_icon_new ();
    mx_stylable_set_style_class (MX_STYLABLE (icon),
                                 "PengeInterestingTileIcon");
    mx_bin_set_child (MX_BIN (priv->remove_button),
                      (ClutterActor *)icon);
    mx_table_add_actor_with_properties (MX_TABLE (priv->details_overlay),
                                        priv->remove_button,
                                        0, 2,
                                        "row-span", 2,
                                        "x-expand", TRUE,
                                        "y-expand", TRUE,
                                        "x-fill", FALSE,
                                        "y-fill", FALSE,
                                        "x-align", MX_ALIGN_END,
                                        "y-align", MX_ALIGN_MIDDLE,
                                        NULL);

    g_signal_connect (priv->remove_button,
                      "clicked",
                      (GCallback)_remove_button_clicked,
                      self);

    mx_table_set_column_spacing (MX_TABLE (priv->details_overlay), 4);

    clutter_actor_set_reactive ((ClutterActor *) self, TRUE);

    clutter_actor_hide (priv->icon);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 priv->primary_text,
                                 "column", 0,
                                 NULL);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 priv->secondary_text,
                                 "column", 0,
                                 NULL);
}
Example #30
0
static void
ntf_libnotify_update (NtfNotification *ntf, Notification *details)
{
  ClutterActor *icon = NULL;

  g_return_if_fail (store && ntf && details);

  if (details->summary)
    ntf_notification_set_summary (ntf, details->summary);

  if (details->body)
    ntf_notification_set_body (ntf, details->body);

  if (details->icon_pixbuf)
    {
      GdkPixbuf *pixbuf = details->icon_pixbuf;

      icon = clutter_texture_new ();

      clutter_texture_set_from_rgb_data (CLUTTER_TEXTURE (icon),
                                         gdk_pixbuf_get_pixels (pixbuf),
                                         gdk_pixbuf_get_has_alpha (pixbuf),
                                         gdk_pixbuf_get_width (pixbuf),
                                         gdk_pixbuf_get_height (pixbuf),
                                         gdk_pixbuf_get_rowstride (pixbuf),
                                         gdk_pixbuf_get_has_alpha (pixbuf) ?
                                         4 : 3,
                                         0, NULL);
    }
  else if (details->icon_name)
    {
      GtkIconTheme *theme;
      GtkIconInfo  *info;

      theme = gtk_icon_theme_get_default ();
      info = gtk_icon_theme_lookup_icon (theme, details->icon_name, 24, 0);

      if (info)
        {
          icon = clutter_texture_new ();

          clutter_texture_set_from_file (CLUTTER_TEXTURE(icon),
                                         gtk_icon_info_get_filename (info),
                                         NULL);
          gtk_icon_info_free (info);
        }
    }

  if (icon)
    clutter_actor_set_size (icon, 24.0, 24.0);
  ntf_notification_set_icon (ntf, icon);

  if (details->actions)
    {
      GList *action;
      gchar *key, *value;

      ntf_notification_remove_all_buttons (ntf);

      for (action = details->actions; action;)
        {
          /*
           * The action list length is
           * guaranteed to be % 2 and > 0
           */
          key = action->data;
          action = g_list_next (action);
          value = action->data;
          action = g_list_next (action);

          if (strcasecmp(key, "default") != 0)
            {
              ActionData   *data;
              ClutterActor *button;
              KeySym        keysym = 0;

              data = g_slice_new0 (ActionData);
              data->notification = ntf;
              data->action       = g_strdup (key);
              data->id           = details->id;
              data->store        = store;

              button = mx_button_new ();

              mx_button_set_label (MX_BUTTON (button), value);

              g_signal_connect_data (button, "clicked",
                                     G_CALLBACK (ntf_libnotify_action_cb),
                                     data,
                                     (GClosureNotify) free_action_data,
                                     0);

              /*
               * Handle the dawati key shortcut protocol
               */
              if (!strncmp (key, DAWATI_KEY_PREFIX, strlen (DAWATI_KEY_PREFIX)))
                {
                  const char *k = key + strlen (DAWATI_KEY_PREFIX);
                  const char *pfx = strstr (k, "XK_");
                  char       *name;

                  if (pfx)
                    {
                      if (k == pfx)
                        {
                          name = g_strdup (k + 3);
                        }
                      else
                        {
                          name = g_strdup (k);

                          name [pfx - k] = 0;
                          strcat (name, pfx + 3);
                        }

                      keysym = XStringToKeysym (name);

                      if (!keysym)
                        g_warning (G_STRLOC ": no keysym found for %s (%s)",
                                   key, name);

                      g_free (name);

                    }
                  else
                    {
                      g_warning (G_STRLOC ": invalid key %s", key);
                    }
                }

              ntf_notification_add_button (ntf, button, key, keysym);
              mx_stylable_set_style_class (MX_STYLABLE (button),
                                           "Primary");
            }
        }
    }

  ntf_notification_set_urgent (ntf, details->is_urgent);

  ntf_notification_set_timeout (ntf, details->timeout_ms);
}