Esempio n. 1
0
static gboolean
bst_canvas_source_build_async (gpointer data)
{
  GnomeCanvasItem *item = GNOME_CANVAS_ITEM (data);
  if (gnome_canvas_item_check_undisposed (item))
    {
      BstCanvasSource *csource = BST_CANVAS_SOURCE (item);
      GnomeCanvasGroup *group = GNOME_CANVAS_GROUP (csource);
      
      /* keep in mind, that creation order affects stacking */

      /* add input and output channel items */
      if (!csource->built_ichannels)
        {
          csource->built_ichannels = TRUE;
          bst_canvas_source_build_channels (csource,
                                            TRUE,               /* input channels */
                                            0xffff00, 0x808000,	/* ichannels */
                                            0x00afff, 0x005880, /* jchannels */
                                            TRUE, FALSE);
          return TRUE;
        }
      if (!csource->built_ochannels)
        {
          csource->built_ochannels = TRUE;
          bst_canvas_source_build_channels (csource,
                                            FALSE,              /* output channels */
                                            0xff0000, 0x800000, /* ochannels */
                                            0, 0,               /* unused */
                                            TRUE, FALSE);
          return TRUE;
        }

      /* add icon to group */
      if (!csource->icon_item)
        {
          csource->icon_item = g_object_connect (gnome_canvas_item_new (group,
                                                                        GNOME_TYPE_CANVAS_PIXBUF,
                                                                        "x", ICON_X (csource),
                                                                        "y", ICON_Y (csource),
                                                                        "width", ICON_WIDTH (csource),
                                                                        "height", ICON_HEIGHT (csource),
                                                                        NULL),
                                                 "signal::destroy", gtk_widget_destroyed, &csource->icon_item,
                                                 "swapped_signal::event", bst_canvas_source_child_event, csource,
                                                 NULL);
          source_icon_changed (csource);
          return TRUE;
        }
      
      if (!csource->text)
        {
          /* add text item, invoke name_changed callback to setup the text value */
          guint ocolor = csource->source && bse_item_internal (csource->source) ? RGBA_INTERNAL : RGBA_BLACK;
          csource->text = gnome_canvas_item_new (group,
                                                 GNOME_TYPE_CANVAS_TEXT,
                                                 "fill_color_rgba", ocolor,
                                                 "anchor", GTK_ANCHOR_NORTH,
                                                 "justification", GTK_JUSTIFY_CENTER,
                                                 "x", TEXT_X (csource),
                                                 "y", TEXT_Y (csource),
                                                 "font", TEXT_FONT,
                                                 NULL);
          g_object_connect (csource->text,
                            "signal::destroy", gtk_widget_destroyed, &csource->text,
                            "swapped_signal::event", bst_canvas_source_child_event, csource,
                            NULL);
          gnome_canvas_text_set_zoom_size (GNOME_CANVAS_TEXT (csource->text), FONT_HEIGHT);
          source_name_changed (csource);
          return TRUE;
        }

      /* add input and output channel hints */
      if (!csource->built_ihints)
        {
          csource->built_ihints = TRUE;
          bst_canvas_source_build_channels (csource,
                                            TRUE,               /* input channels */
                                            0xffff00, 0x808000,	/* ichannels */
                                            0x00afff, 0x005880, /* jchannels */
                                            FALSE, TRUE);
          return TRUE;
        }
      if (!csource->built_ohints)
        {
          csource->built_ohints = TRUE;
          bst_canvas_source_build_channels (csource,
                                            FALSE,              /* output channels */
                                            0xff0000, 0x800000, /* ochannels */
                                            0, 0,               /* unused */
                                            FALSE, TRUE);
          return TRUE;
        }
    }
  GnomeCanvas *canvas = g_object_steal_data (item, "bst-workaround-canvas-ref");
  g_object_unref (item);
  if (canvas)
    g_object_unref (canvas);      /* canvases don't properly protect their items */
  return FALSE;
}
Esempio n. 2
0
void ShowIconForMinimizedClient (WmWorkspaceData *pWS, ClientData *pCD)
{
    WmScreenData *pSD = PSD_FOR_CLIENT(pCD);

    /*
     * Handle auto-placement for root icons (icons not in an icon
     * box).
     */
    if (wmGD.iconAutoPlace && !P_ICON_BOX(pCD))
    {
        if ((ICON_PLACE(pCD) == NO_ICON_PLACE) ||
	    ((pWS->IPData.placeList[ICON_PLACE(pCD)].pCD) &&
	     (pWS->IPData.placeList[ICON_PLACE(pCD)].pCD != pCD)))
        {
            /*
             * Icon place not defined or occupied by another client,
	     * find a free place to put the icon.
             */

	    if ((ICON_PLACE(pCD) = GetNextIconPlace (&pWS->IPData)) 
		== NO_ICON_PLACE)
	    {
	        ICON_PLACE(pCD) = 
		    CvtIconPositionToPlace (&pWS->IPData,
							 pCD->clientX,
			               	                 pCD->clientY);
	    }
	    CvtIconPlaceToPosition (&pWS->IPData, ICON_PLACE(pCD), 
				    &ICON_X(pCD), &ICON_Y(pCD));

#ifndef WSM
	    XMoveWindow (DISPLAY, ICON_FRAME_WIN(pCD), 
		ICON_X(pCD), ICON_Y(pCD));
#endif /* WSM */

        }

        pWS->IPData.placeList[ICON_PLACE(pCD)].pCD = pCD;
    }

#ifdef WSM
    /*
     * If icon on root window and this workspace is active, the
     * make sure it's in the right place.
     */
    if ((pWS == pSD->pActiveWS) && !P_ICON_BOX(pCD))
    {
	XMoveWindow (DISPLAY, ICON_FRAME_WIN(pCD), 
	    ICON_X(pCD), ICON_Y(pCD));
    }
#endif /* WSM */
    if (pCD->iconWindow)
    {
        XMapWindow (DISPLAY, pCD->iconWindow);
    }

    if ((pSD->useIconBox) && P_ICON_BOX(pCD))
    {
        ShowClientIconState (pCD, MINIMIZED_STATE );
    }
    else
    {
	XWindowChanges windowChanges;

	/*
	 * Map the icon on the screen at the appropriate place in the 
	 * window stack.
	 */

	if (wmGD.lowerOnIconify)
	{
	    if ((&pCD->iconEntry != pSD->lastClient) &&
		(pSD->lastClient))
	    {
		if (pSD->lastClient->type == MINIMIZED_STATE)
		{
		    windowChanges.sibling = 
			ICON_FRAME_WIN(pSD->lastClient->pCD);
		}
		else
		{
		    windowChanges.sibling =
			pSD->lastClient->pCD->clientFrameWin;
		}
		windowChanges.stack_mode = Below;
		XConfigureWindow (DISPLAY, ICON_FRAME_WIN(pCD),
		    		  (CWSibling | CWStackMode), &windowChanges);
		MoveEntryInList (pWS, &pCD->iconEntry, 
		    False /*on bottom*/, NULL);
	    }
	}
	else
	{
	    windowChanges.sibling = pCD->clientFrameWin;
	    windowChanges.stack_mode = Below;
	    XConfigureWindow (DISPLAY, ICON_FRAME_WIN(pCD),
	    		      (CWSibling | CWStackMode), &windowChanges);
	    MoveEntryInList (pWS, &pCD->iconEntry, False /*below*/,
			     &pCD->clientEntry);
	}

#ifdef WSM
        if (pWS == pSD->pActiveWS)
	{
	    XMapWindow (DISPLAY, ICON_FRAME_WIN(pCD));
	}
#else /* WSM */
	XMapWindow (DISPLAY, ICON_FRAME_WIN(pCD));
#endif /* WSM */
    }

} /* END OF FUNCTION ShowIconForMinimizedClient */