void
LauncherApplication::setIconGeometry(int x, int y, int width, int height, uint xid)
{
    if (m_application == NULL) {
        return;
    }

    QScopedPointer<BamfUintList> xids;
    if (xid == 0) {
        xids.reset(m_application->xids());
    } else {
        QList<uint> list;
        list.append(xid);
        xids.reset(new BamfUintList(list));
    }
    int size = xids->size();
    if (size < 1) {
        return;
    }

    WnckScreen* screen = wnck_screen_get_default();
    wnck_screen_force_update(screen);

    for (int i = 0; i < size; ++i) {
        WnckWindow* window = wnck_window_get(xids->at(i));
        wnck_window_set_icon_geometry(window, x, y, width, height);
    }
}
Beispiel #2
0
static void
update_hints (TaskItem *item)
{
  GtkWidget *parent;
  GtkWidget *widget;
  GtkAllocation *allocation;
  WnckWindow *window;
  GdkWindow *gdkwindow;
  gint x, y, x1, y1;

  widget = GTK_WIDGET (item);
  window = item->priv->window;
  /* Skip problems */
  if (!WNCK_IS_WINDOW (window)) return;
  if (!GTK_IS_WIDGET (widget)) return;

  /* Skip invisible windows */
  if (!gtk_widget_get_visible (widget)) return;

  x = y = 0;

  /* Recursively compute the button's coordinates */
  for (parent = widget; parent; parent = gtk_widget_get_parent (parent))
  {
    if (gtk_widget_get_parent (parent))
    {
      gtk_widget_get_allocation (parent, allocation);
      x += allocation->x;
      y += allocation->y;
    }
    else
    {
      x1 = y1 = 0;
      gdkwindow = gtk_widget_get_window (parent);
#if !GTK_CHECK_VERSION (3, 0, 0)
      if (GDK_IS_WINDOW (gdkwindow))
#endif
        gdk_window_get_origin (gdkwindow, &x1, &y1);
      x += x1; y += y1;
      break;
    }
  }
    
  /* Set the minimize hint for the window */
  gtk_widget_get_allocation (widget, allocation);
  if (allocation) {	
  	wnck_window_set_icon_geometry (window, x, y,
                                 allocation->width,
                                 allocation->height);
  }
}