예제 #1
0
/*************************************<->*************************************
 *
 *  unsigned int TitleTextHeight (pcd)
 *
 *
 *  Description:
 *  -----------
 *  Returns the height of the title text plus padding
 *
 *  Inputs:
 *  ------
 *  pcd			- pointer to client data record
 * 
 *  Outputs:
 *  -------
 *  TitleTextHeight	-  Height of title text plus padding
 *
 *  Comments:
 *  --------
 * 
 *************************************<->***********************************/
unsigned int TitleTextHeight (ClientData *pcd)
{
    unsigned int ttextheight;

#ifndef NO_MULTIBYTE
    if (DECOUPLE_TITLE_APPEARANCE(pcd))
    {
	ttextheight = CLIENT_TITLE_APPEARANCE(pcd).titleHeight;
    }
    else
    {
	ttextheight = CLIENT_APPEARANCE(pcd).titleHeight;
    }
#else

    XFontStruct	*font;

    if (DECOUPLE_TITLE_APPEARANCE(pcd))
    {
	font = CLIENT_TITLE_APPEARANCE(pcd).font;
    }
    else 
    {
	font = CLIENT_APPEARANCE(pcd).font;
    }

    if (font)
    {
	ttextheight = TEXT_HEIGHT(font) + WM_TITLE_BAR_PADDING;
    }
    else
    {
	/* 
	 * Failed to load any font! (probably due to error in 
	 * font path, toolkit, or resource converter. Set to
	 * arbitrary value for robustness.
	 *
	 */
	ttextheight = 16; 
    }
#endif
    return (ttextheight);
}
예제 #2
0
/*************************************<->*************************************
 *
 *  wspSetPosition (pPres)
 *
 *
 *  Description:
 *  -----------
 *  Sets the position of the workspace presence dialog
 *
 *  Inputs:
 *  ------
 *  pPres = pointer to workspace presence data
 *
 *  Outputs:
 *  --------
 * 
 ******************************<->***********************************/
static void 
wspSetPosition(
        PtrWsPresenceData pPres )
{
    WmScreenData *pSD = pPres->pCDforClient->pSD;
    Arg args[10];
    int n;
    XFontStruct *font;
    Dimension height;
    int x, y;

    /*
     * Get size of this dialog
     */
    n = 0;
    XtSetArg (args[n], XmNheight, &height);		n++;
    XtGetValues (pPres->shellW, args, n);

    if (wmGD.positionIsFrame)
    {
	if (pSD->decoupleTitleAppearance)
	{
	    font = pSD->clientTitleAppearance.font;
	}
	else
	{
	    font = pSD->clientAppearance.font;
	}

	height += TEXT_HEIGHT(font) + (2 * pSD->frameBorderWidth);
    }


    /* 
     * set position of dialog relative to client window 
     * (use system menu position)
     * set this dialog to be transient for the client
     * for which it is posted.
     */
    GetSystemMenuPosition (pPres->pCDforClient, 
    		 	    &x, &y, height,
			    pPres->contextForClient);

    n = 0;
    XtSetArg (args[n], XmNx, x);				n++;
    XtSetArg (args[n], XmNy, y);				n++;
    XtSetArg (args[n], XmNtransientFor, NULL);			n++;
    if (pPres->contextForClient != F_CONTEXT_ICON)
    {
	XtSetArg (args[n], XmNwindowGroup, pPres->pCDforClient->client); n++;
    }
    else if (pSD->useIconBox && P_ICON_BOX(pPres->pCDforClient))
    {
	XtSetArg (args[n], XmNwindowGroup, 
		  P_ICON_BOX(pPres->pCDforClient)->pCD_iconBox->client); n++;
    }
    else
    {
	XtSetArg (args[n], XmNwindowGroup, 0); n++;
    }
    XtSetArg (args[n], XmNwaitForWm, False);			n++;

    XtSetValues (pPres->shellW, args, n);

} /* END OF FUNCTION wspSetPosition */