Пример #1
0
static void
cinnamon_embedded_window_hide (GtkWidget *widget)
{
  CinnamonEmbeddedWindow *window = CINNAMON_EMBEDDED_WINDOW (widget);
  if (window->priv->actor)
      clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor));
  GTK_WIDGET_CLASS (cinnamon_embedded_window_parent_class)->hide (widget);
}
Пример #2
0
static void
cinnamon_embedded_window_check_resize (GtkContainer *container)
{
  CinnamonEmbeddedWindow *window = CINNAMON_EMBEDDED_WINDOW (container);

  /* Check resize is called when a resize is queued on something
   * inside the GtkWindow; we need to make sure that in response
   * to this gtk_widget_size_request() and then
   * gtk_widget_size_allocate() are called; we defer to the Clutter
   * logic and assume it will do the right thing.
   */
  if (window->priv->actor)
    clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor));
}
Пример #3
0
static void
on_plug_added (GtkSocket        *socket,
               CinnamonTrayManager *manager)
{
  CinnamonTrayManagerChild *child;

  g_signal_handlers_disconnect_by_func (socket, on_plug_added, manager);

  child = g_hash_table_lookup (manager->priv->icons, socket);

  child->actor = cinnamon_tray_icon_new (CINNAMON_EMBEDDED_WINDOW (child->window));
  g_object_ref_sink (child->actor);

  g_signal_emit (manager, cinnamon_tray_manager_signals[TRAY_ICON_ADDED], 0,
                 child->actor);
}
Пример #4
0
static void
cinnamon_embedded_window_realize (GtkWidget *widget)
{
  CinnamonEmbeddedWindow *window = CINNAMON_EMBEDDED_WINDOW (widget);

  GTK_WIDGET_CLASS (cinnamon_embedded_window_parent_class)->realize (widget);


  /* Using XReparentWindow() is simpler than using gdk_window_reparent(),
   * since it avoids maybe having to create a new foreign GDK window for
   * the stage. However, GDK will be left thinking that the parent of
   * window->window is the root window - it's not immediately clear
   * to me whether that is more or less likely to cause problems than
   * modifying the GDK hierarchy.
   */
  XReparentWindow (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
                   gdk_x11_window_get_xid (gtk_widget_get_window (widget)),
                   window->priv->stage_xwindow,
                   window->priv->position.x, window->priv->position.y);
}
Пример #5
0
/*
 * The normal gtk_window_show() starts all of the complicated asynchronous
 * window resizing code running; we don't want or need any of that.
 * Bypassing the normal code does mean that the extra geometry management
 * available on GtkWindow: gridding, maximum sizes, etc, is ignored; we
 * don't really want that anyways - we just want a way of embedding a
 * GtkWidget into a Clutter stage.
 */
static void
cinnamon_embedded_window_show (GtkWidget *widget)
{
  CinnamonEmbeddedWindow *window = CINNAMON_EMBEDDED_WINDOW (widget);
  GtkWidgetClass *widget_class;

  /* Skip GtkWindow, but run the default GtkWidget handling which
   * marks the widget visible */
  widget_class = g_type_class_peek (GTK_TYPE_WIDGET);
  widget_class->show (widget);

  if (window->priv->actor)
    {
      /* Size is 0x0 if the GtkWindow is not shown */
      clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor));

      if (CLUTTER_ACTOR_IS_REALIZED (window->priv->actor))
        gtk_widget_map (widget);
    }
}
Пример #6
0
static void
cinnamon_embedded_window_set_property (GObject         *object,
                                    guint            prop_id,
                                    const GValue    *value,
                                    GParamSpec      *pspec)
{
  CinnamonEmbeddedWindow *window = CINNAMON_EMBEDDED_WINDOW (object);

  switch (prop_id)
    {
    case PROP_STAGE:
      window->priv->stage_xwindow =
        clutter_x11_get_stage_window (g_value_get_object (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}