X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cde%2Fprograms%2Fdtwm%2FWmResource.c;h=8a03160f4455f9e22fc8f8d4b0885a6298f3fe5b;hb=01d6c363fa5c1bc1ce72e90d4e7daca74bd3175e;hp=af86d8cf0f83a7ca7bb85caaa90e9ea43cc6a184;hpb=a26b73a1a64caadf029473342b7d42a7158b7461;p=oweals%2Fcde.git diff --git a/cde/programs/dtwm/WmResource.c b/cde/programs/dtwm/WmResource.c index af86d8cf..8a03160f 100644 --- a/cde/programs/dtwm/WmResource.c +++ b/cde/programs/dtwm/WmResource.c @@ -852,7 +852,11 @@ XtResource wmGlobalResources[] = sizeof (int), XtOffsetOf(WmGlobalData, keyboardFocusPolicy), XtRImmediate, +#if defined(sun) + (XtPointer)KEYBOARD_FOCUS_POINTER +#else (XtPointer)KEYBOARD_FOCUS_EXPLICIT +#endif }, { @@ -2811,7 +2815,6 @@ _WmBackdropBgDefault (Widget widget, int offset, XrmValue *value) { static Pixel pixValue; unsigned int colorSetId = (unsigned int) pResWS->backdrop.colorSet; - WmScreenData *pSD; if (wmGD.statusColorServer == CSERVE_NORMAL) { @@ -2857,7 +2860,6 @@ _WmBackdropFgDefault (Widget widget, int offset, XrmValue *value) { static Pixel pixValue; unsigned int colorSetId = (unsigned int) pResWS->backdrop.colorSet; - WmScreenData *pSD; if (wmGD.statusColorServer == CSERVE_NORMAL) { @@ -3468,7 +3470,7 @@ WriteOutXrmColors (WmScreenData *pSD) XrmDatabase db; XrmValue value; int thisScreen = pSD->screen; - XmPixelSet *tpixset, *ppixset; + XmPixelSet *tpixset; XmPixelSet *spixset; char *res_class; @@ -4393,6 +4395,70 @@ ProcessAppearanceResources (WmScreenData *pSD) } /* END OF FUNCTION ProcessAppearanceResources */ + + +/*************************************<->************************************* + * + * FallbackMakeTitleHeight (pAData) + * + * + * Description: + * ----------- + * This function makes title hight for AppearanceData + * (using XExtentsOfFontSet on pAData->fontList) + * + * Inputs: + * ------ + * + * pAData = pointer to appearance data structure containing resource info + * + * + * Outputs: + * ------- + * *pAData - pAData->titleHeight is updated + * return = 1 on success, 0 on failure (pAData->titleHeight is intact) + * + *************************************<->***********************************/ + +int +FallbackMakeTitleHeight (AppearanceData *pAData) { + XmFontContext fc; + XmFontType type; + XmFontListEntry entry; + XtPointer pFont; + XFontSetExtents *pExtents; + int result = 0; + + XmFontListInitFontContext ( &fc, pAData->fontList); + pAData->titleHeight = 0; + entry = XmFontListNextEntry (fc); + while (entry) + { + pFont = XmFontListEntryGetFont (entry, &type); + switch (type) + { + case XmFONT_IS_FONT: + /* does not really happen since XmeRenderTableGetDefaultFont + seems to fail only on fontsets */ + break; + case XmFONT_IS_FONTSET: + if (!(pExtents = XExtentsOfFontSet ((XFontSet) pFont))) { + break; + } + if (WM_TITLE_BAR_PADDING + pExtents->max_logical_extent.height > pAData->titleHeight) { + pAData->titleHeight = WM_TITLE_BAR_PADDING + pExtents->max_logical_extent.height; + result = 1; + } + break; + default: + break; + } + entry = XmFontListNextEntry (fc); + } + XmFontListFreeFontContext (fc); + return result; +} + /*************************************<->************************************* * @@ -4435,24 +4501,35 @@ MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean make Warning((char *)wmGD.tmpBuffer); #if defined(CSRG_BASED) || defined(linux) /* HACK to try get _some_ font anyway (fontList seems to end up as an empty list on - * some modern systems; investigate) */ - pAData->font = XLoadQueryFont(wmGD.display, "fixed"); - if (pAData->font == NULL) { - ExitWM(WM_ERROR_EXIT_VALUE); + * some modern systems; investigate) */ + pAData->font = XLoadQueryFont(wmGD.display, "fixed"); + if (pAData->font == NULL) + { + ExitWM(WM_ERROR_EXIT_VALUE); + } + /* try to get right title hight using XExtentsOfFontSet: on UTF-8 + * locales XmeRenderTableGetDefaultFont does not return anything + * when font is a compound fontset*/ + if (!FallbackMakeTitleHeight(pAData)) + { + /* failed to get height from fontList - falling back to fixed */ + pAData->titleHeight = (pAData->font)->ascent + (pAData->font)->descent + + WM_TITLE_BAR_PADDING; } #else ExitWM(WM_ERROR_EXIT_VALUE); #endif - - } - + } else { + /* got default font successfully, hack was not needed */ #ifndef NO_MULTIBYTE - /* - * Calculate title bar's height and store it in pAData. - */ - pAData->titleHeight = (pAData->font)->ascent + (pAData->font)->descent - + WM_TITLE_BAR_PADDING; + /* + * Calculate title bar's height (using selected font) and store it in pAData. + */ + pAData->titleHeight = (pAData->font)->ascent + (pAData->font)->descent + + WM_TITLE_BAR_PADDING; #endif + } + /* @@ -5304,7 +5381,7 @@ ProcessWorkspaceResources (WmWorkspaceData *pWS) WmNbackdrop, WmCBackdrop, wmBackdropResources, XtNumber (wmBackdropResources), NULL, 0); - ProcessBackdropResources (pWS, NULL); + ProcessBackdropResources (pWS, 0); #endif /* WSM */ } /* END OF FUNCTION ProcessWorkspaceResources */