2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /************************************<+>*************************************
24 ****************************************************************************
30 ** Description: Controls the Dtstyle Font dialog
33 ** (c) Copyright Hewlett-Packard Company, 1990.
37 ****************************************************************************
38 ************************************<+>*************************************/
39 /* $XConsortium: Font.c /main/7 1996/10/30 11:14:15 drk $ */
41 /*+++++++++++++++++++++++++++++++++++++++*/
43 /*+++++++++++++++++++++++++++++++++++++++*/
46 #include <Xm/MwmUtil.h>
50 #include <Xm/MessageB.h>
53 #include <Xm/LabelG.h>
58 #include <Xm/VendorSEP.h>
60 #include <Dt/DialogBox.h>
62 #include <Dt/TitleBox.h>
64 #include <Dt/Message.h>
65 #include <Dt/SessionM.h>
66 #include <Dt/HourGlass.h>
71 #include "SaveRestore.h"
73 /*+++++++++++++++++++++++++++++++++++++++*/
75 /*+++++++++++++++++++++++++++++++++++++++*/
77 #define FONT_MSG ((char *)GETMESSAGE(5, 23, "Style Manager - Font"))
78 #define PREVIEW ((char *)GETMESSAGE(5, 17, "Preview"))
79 #define IMMEDIATE ((char *)GETMESSAGE(5, 18, "The changes to fonts will show up in some\napplications the next time they are started.\nOther applications, such as file manager and\napplication manager, will not show the font\nchanges until you Exit the desktop and then log\nback in."))
80 #define LATER ((char *)GETMESSAGE(5, 19, "The selected font will be used when\n you restart this session."))
81 #define INFO_MSG ((char *)GETMESSAGE(5, 24, "The font that is currently used for your desktop is not\navailable in the Size list. If a new font is selected and\napplied, you will not be able to return to the current font\nusing the Style Manager - Font dialog."))
82 #define SYSTEM_MSG ((char *)GETMESSAGE(5, 20, "AaBbCcDdEeFfGg0123456789"))
83 #define USER_MSG ((char *)GETMESSAGE(5, 21, "AaBbCcDdEeFfGg0123456789"))
85 #define SIZE ((char *)GETMESSAGE(5, 22, "Size"))
88 /*+++++++++++++++++++++++++++++++++++++++*/
89 /* Internal Variables */
90 /*+++++++++++++++++++++++++++++++++++++++*/
101 int originalFontIndex;
102 int selectedFontIndex;
103 String selectedFontStr;
104 Boolean userTextChanged;
106 static FontData font;
108 static saveRestore save = {FALSE, 0, };
110 /*+++++++++++++++++++++++++++++++++++++++*/
111 /* Internal Functions */
112 /*+++++++++++++++++++++++++++++++++++++++*/
115 static void CreateFontDlg(
117 static void _DtmapCB_fontBB(
119 XtPointer client_data,
120 XtPointer call_data) ;
121 static void ButtonCB(
123 XtPointer client_data,
124 XtPointer call_data) ;
125 static void changeSampleFontCB(
127 XtPointer client_data,
128 XtPointer call_data) ;
129 static void valueChangedCB(
131 XtPointer client_data,
132 XtPointer call_data) ;
135 /*+++++++++++++++++++++++++++++++++++++++*/
137 /*+++++++++++++++++++++++++++++++++++++++*/
142 if (style.fontDialog == NULL) {
143 _DtTurnOnHourGlass(shell);
144 CreateFontDlg(shell);
145 XtManageChild(style.fontDialog);
146 _DtTurnOffHourGlass(shell);
148 XtManageChild(style.fontDialog);
149 raiseWindow(XtWindow(XtParent(style.fontDialog)));
152 /* If no font is found to match current Desktop
153 font, pop up informative message */
154 if (font.selectedFontIndex < 0)
155 InfoDialog(INFO_MSG, style.shell, False);
158 /*+++++++++++++++++++++++++++++++++++++++*/
160 /*+++++++++++++++++++++++++++++++++++++++*/
171 XmString button_string[NUM_LABELS];
174 Widget widget_list[6];
176 XmStringTable selectedSize;
178 Dimension fontheight;
181 font.selectedFontStr = style.xrdb.systemFontStr;
183 /* Assume nothing is selected */
184 font.selectedFontIndex = -1;
187 * The following flag is used to determine if the user has
188 * entered anything into the sample user font field. If
189 * he does, than when the font selection is changed, the
190 * default message "aAbBcC..." won't be displayed overwriting
191 * the user's text, only the fontlist will be changed.
192 * This flag will be set in the valueChanged callback for the
193 * font.sizeList widget.
195 font.userTextChanged = FALSE;
198 * Look for the selectedFont in the fontChoice array and set
199 * selectedFontIndex to that entry
201 for (i=0; i<style.xrdb.numFonts; i++)
202 if (strcmp (font.selectedFontStr,
203 style.xrdb.fontChoice[i].sysStr) == 0)
205 font.selectedFontIndex = i;
206 if (!style.xrdb.fontChoice[i].userFont)
207 GetUserFontResource(i);
208 if (!style.xrdb.fontChoice[i].sysFont)
209 GetSysFontResource(i);
214 * Save the index of the originally selected font. If no
215 * font is selected, this value will remain -1.
217 font.originalFontIndex = font.selectedFontIndex;
219 /* Set up button labels. */
220 button_string[0] = CMPSTR(_DtOkString);
221 button_string[1] = CMPSTR(_DtCancelString);
222 button_string[2] = CMPSTR(_DtHelpString);
224 /* Create toplevel DialogBox */
226 * Note that save.poscnt has been initialized elsewhere.
227 * save.posArgs may contain information from restoreFont().
230 XtSetArg(save.posArgs[save.poscnt], XmNallowOverlap, False); save.poscnt++;
231 XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
233 XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);
235 XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);
238 __DtCreateDialogBoxDialog(parent, "Fonts", save.posArgs, save.poscnt);
239 XtAddCallback(style.fontDialog, XmNcallback, ButtonCB, NULL);
240 XtAddCallback(style.fontDialog, XmNmapCallback, _DtmapCB_fontBB,
242 XtAddCallback(style.fontDialog, XmNhelpCallback,
243 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FONT_DIALOG);
245 XmStringFree(button_string[0]);
246 XmStringFree(button_string[1]);
247 XmStringFree(button_string[2]);
249 widget_list[0] = _DtDialogBoxGetButton(style.fontDialog,2);
251 XtSetArg(args[n], XmNautoUnmanage, False); n++;
252 XtSetArg(args[n], XmNcancelButton, widget_list[0]); n++;
253 XtSetValues (style.fontDialog, args, n);
256 XtSetArg(args[n], XmNtitle, FONT_MSG); n++;
257 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
258 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
259 XtSetValues (XtParent(style.fontDialog), args, n);
262 XtSetArg (args[n], XmNchildType, XmWORK_AREA); n++;
263 XtSetArg(args[n], XmNhorizontalSpacing, style.horizontalSpacing); n++;
264 XtSetArg(args[n], XmNverticalSpacing, style.verticalSpacing); n++;
265 XtSetArg(args[n], XmNallowOverlap, False); n++;
266 font.fontWkarea = XmCreateForm(style.fontDialog, "fontWorkArea", args, n);
269 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
270 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
271 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
273 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
274 XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
275 XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
276 XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
277 XtSetArg(args[n], XmNstring, NULL); n++;
278 XtSetArg(args[n], XmNshadowThickness, 0); n++;
279 XtSetArg(args[n], XmNimageName, FONT_ICON); n++;
280 XtSetArg(args[n], XmNtraversalOn, False); n++;
281 widget_list[count++] = font.fontpictLabel =
282 _DtCreateIcon(font.fontWkarea, "fontpictLabel", args, n);
284 /* Create a TitleBox and Scale/List to choose the font size */
287 string = CMPSTR(SIZE);
288 XtSetArg(args[n], XmNtitleString, string); n++;
289 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
290 XtSetArg(args[n], XmNtopWidget, font.fontpictLabel); n++;
291 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing+5); n++;
292 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
293 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
294 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
295 widget_list[count++] = font.sizeTB =
296 _DtCreateTitleBox(font.fontWkarea, "sizeTB", args, n);
297 XmStringFree(string);
299 /* calculate size for each of the fonts based on system font size */
301 sizeItems = (XmString *) XtMalloc(sizeof(XmString) * style.xrdb.numFonts);
302 for (n=0; n<style.xrdb.numFonts; n++)
304 sprintf(sizeStr, "%d", (int)(n+1));
305 sizeItems[n] = CMPSTR(sizeStr);
306 style.xrdb.fontChoice[n].pointSize = CMPSTR(sizeStr);
311 XtSetArg (args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
312 XtSetArg (args[n], XmNautomaticSelection, True); n++;
313 XtSetArg (args[n], XmNvisibleItemCount, 7); n++;
314 XtSetArg (args[n], XmNitemCount, style.xrdb.numFonts); n++;
315 XtSetArg (args[n], XmNitems, sizeItems); n++;
318 * If matching font was found for current selection,
319 * display it as selected. Otherwise, don't select
322 if (font.selectedFontIndex >=0) {
323 selectedSize = &(style.xrdb.fontChoice[font.selectedFontIndex].pointSize);
324 XtSetArg (args[n], XmNselectedItems, selectedSize); n++;
325 XtSetArg (args[n], XmNselectedItemCount, 1); n++;
327 font.sizeList = XmCreateScrolledList(font.sizeTB,"sizeList",args,n);
328 XtAddCallback(font.sizeList, XmNbrowseSelectionCallback,
329 changeSampleFontCB, NULL);
331 /* If a font match was found and selected, then set it's point size. */
332 if (font.selectedFontIndex >=0)
333 XmListSetItem(font.sizeList,
334 style.xrdb.fontChoice[font.selectedFontIndex].pointSize);
335 XtFree((char *)sizeItems);
337 /* preview TitleBox */
339 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
340 XtSetArg(args[n], XmNtopWidget, font.fontpictLabel); n++;
341 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing+5); n++;
342 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
343 XtSetArg(args[n], XmNleftWidget, font.sizeTB); n++;
344 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
345 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
346 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
347 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
348 string = CMPSTR(PREVIEW);
349 XtSetArg(args[n], XmNtitleString, string); n++;
350 widget_list[count++] = font.previewTB =
351 _DtCreateTitleBox(font.fontWkarea, "systemSample", args, n);
352 XmStringFree(string);
354 /*form to contain preview font area*/
357 XmCreateForm(font.previewTB, "previewForm", args, n);
359 /* sample system font */
363 * If a font match was found and selected, then set the fontlist
364 * and the sample string. Otherwise, output a blank message.
366 if (font.selectedFontIndex >=0) {
367 XtSetArg (args[n], XmNfontList,
368 style.xrdb.fontChoice[font.selectedFontIndex].sysFont); n++;
369 string = CMPSTR(SYSTEM_MSG);
371 string = CMPSTR(BLANK_MSG);
373 XtSetArg (args[n], XmNlabelString, string); n++;
374 XtSetArg (args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
375 XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
376 XtSetArg (args[n], XmNtopOffset, 2 * style.verticalSpacing); n++;
377 XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
378 XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
379 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
381 XmCreateLabelGadget(font.previewForm, "systemSample", args, n);
382 XmStringFree(string);
384 /* sample user font */
387 * If a font match was found and selected, then set the fontlist
388 * and the sample string. Otherwise output a blank message.
390 if (font.selectedFontIndex >=0) {
391 XtSetArg (args[n], XmNfontList,
392 style.xrdb.fontChoice[font.selectedFontIndex].userFont); n++;
393 XtSetArg (args[n], XmNvalue, USER_MSG); n++;
395 XtSetArg (args[n], XmNvalue, NULL); n++;
398 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
399 XtSetArg (args[n], XmNtopWidget, font.systemLabel); n++;
400 XtSetArg (args[n], XmNtopOffset, 2 * style.verticalSpacing); n++;
401 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
402 XtSetArg (args[n], XmNleftWidget, font.systemLabel); n++;
403 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
404 XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
405 XtSetArg (args[n], XmNrightWidget, font.systemLabel); n++;
407 XmCreateText(font.previewForm, "userText", args, n);
408 /* Add callback to determine if user changes text in sample field */
409 XtAddCallback(font.userText, XmNvalueChangedCallback, valueChangedCB, NULL);
411 XtManageChild(font.systemLabel);
412 XtManageChild(font.userText);
413 XtManageChild(font.previewForm);
414 XtManageChild(font.sizeList);
415 XtManageChildren(widget_list,count);
416 XtManageChild(font.fontWkarea);
421 /*+++++++++++++++++++++++++++++++++++++++*/
422 /* _DtmapCB_fontBB */
423 /*+++++++++++++++++++++++++++++++++++++++*/
427 XtPointer client_data,
428 XtPointer call_data )
431 DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
433 if (!save.restoreFlag)
434 putDialog ((Widget)client_data, w);
436 XmTextShowPosition(font.userText, 0);
438 XtRemoveCallback(style.fontDialog, XmNmapCallback, _DtmapCB_fontBB, NULL);
443 /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
445 /* Process callback from PushButtons in DialogBox. */
446 /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
450 XtPointer client_data,
451 XtPointer call_data )
453 DtDialogBoxCallbackStruct *cb
454 = (DtDialogBoxCallbackStruct *) call_data;
456 char *str, *fntstr, *fntsetstr;
460 switch (cb->button_position)
462 /* Set the xrdb or pass to dtsession and close the window */
465 * Need to test for the case where the Font dialog maps without
466 * any fonts selected, and the user presses OK. Do this by
467 * checking for number of items selected before changing
470 XtVaGetValues (font.sizeList, XmNselectedItemCount, &items, NULL);
472 /* Post an info dialog explaining when the new fonts will appear */
473 if ((font.selectedFontIndex != font.originalFontIndex) && (items > 0))
475 XtUnmanageChild(style.fontDialog);
477 if(style.xrdb.writeXrdbImmediate)
479 InfoDialog(IMMEDIATE, style.shell, False);
483 InfoDialog(LATER, style.shell, False);
487 for *FontSet resource: find first font entry delimited by a ":"
490 len =strcspn(style.xrdb.fontChoice[font.selectedFontIndex].userStr,
492 fntsetstr = (char *) XtCalloc(1, len + 1);
494 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
498 Since the *Font and *FontSet resources may be used by old
499 X applications, a fontlist of multiple fonts must be converted
500 to Xt font set format (';'s converted to ','s since many old X
501 apps don't understand ';' syntax.)
503 str = strstr(fntsetstr,";");
506 str = strstr(str,";");
510 for *Font resource: find first font entry delimited by a comma,
513 len = strcspn(fntsetstr,",:=");
514 fntstr = (char *) XtCalloc(1, len + 1);
516 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
520 for *FontSet resource: if we got a font (instead of a font set)
521 from the first entry, then wildcard its charset fields
523 len = strlen(fntsetstr);
524 if (style.xrdb.fontChoice[font.selectedFontIndex].userStr[len]
526 str = strchr(fntsetstr, '-');
527 for (n = 1; n < 13 && str; n++)
528 str = strchr(str + 1, '-');
530 strcpy(str + 1, "*-*");
533 /* create the font resource specs with the selected font for xrdb */
535 "*systemFont: %s\n*userFont: %s\n*FontList: %s\n*buttonFontList: %s\n*labelFontList: %s\n*textFontList: %s\n*XmText*FontList: %s\n*XmTextField*FontList: %s\n*DtEditor*textFontList: %s\n*Font: %s\n*FontSet: %s\n",
536 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
537 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
538 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
539 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
540 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
541 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
542 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
543 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
544 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
550 /* if writeXrdbImmediate true write to Xrdb else send to session mgr */
551 if(style.xrdb.writeXrdbImmediate)
552 _DtAddToResource(style.display,fontres);
554 SmNewFontSettings(fontres);
556 font.originalFontIndex = font.selectedFontIndex;
557 style.xrdb.systemFontStr = font.selectedFontStr;
561 XtUnmanageChild(style.fontDialog);
567 /* reset preview area fonts to original and close the window*/
569 XtUnmanageChild(style.fontDialog);
571 if (font.originalFontIndex >= 0)
572 XmListSelectPos(font.sizeList, font.originalFontIndex+1, True);
575 * if no font was originally selected, need to undo any results
576 * from selections that were made by user before pressing Cancel.
578 XtVaSetValues (font.sizeList, XmNselectedItemCount, 0, NULL);
579 XtVaSetValues (font.userText,
581 XmNfontList, style.xrdb.userFont,
583 XtVaSetValues (font.systemLabel,
584 XmNlabelString, CMPSTR(BLANK_MSG),
585 XmNfontList, style.xrdb.systemFont,
587 font.userTextChanged = FALSE;
588 font.selectedFontIndex = -1;
593 XtCallCallbacks(style.fontDialog, XmNhelpCallback, (XtPointer)NULL);
602 /*+++++++++++++++++++++++++++++++++++++++*/
603 /* changSampleFontCB */
604 /* Change the font in the sample areas */
605 /*+++++++++++++++++++++++++++++++++++++++*/
609 XtPointer client_data,
610 XtPointer call_data )
616 XmListCallbackStruct *cb = (XmListCallbackStruct *) call_data;
618 pos = cb->item_position-1;
620 font.selectedFontIndex = pos;
621 font.selectedFontStr = style.xrdb.fontChoice[pos].sysStr;
623 hourGlassOn = !style.xrdb.fontChoice[pos].userFont ||
624 !style.xrdb.fontChoice[pos].sysFont;
627 _DtTurnOnHourGlass(style.fontDialog);
629 if (!style.xrdb.fontChoice[pos].userFont)
630 GetUserFontResource(pos);
631 if (!style.xrdb.fontChoice[pos].sysFont)
632 GetSysFontResource(pos);
635 _DtTurnOffHourGlass(style.fontDialog);
637 /* Set the sample System Font string to different Font */
639 XtSetArg(args[n], XmNfontList, style.xrdb.fontChoice[pos].sysFont); n++;
640 /* string_val = CMPSTR(SYSTEM_MSG);*/
641 XtSetArg (args[n], XmNlabelString, CMPSTR(SYSTEM_MSG)); n++;
642 XtSetValues (font.systemLabel, args, n);
645 * If the user didn't change the text field, output standard user
649 if (!font.userTextChanged)
650 XtSetArg (args[n], XmNvalue, USER_MSG); n++;
651 XtSetArg(args[n], XmNfontList, style.xrdb.fontChoice[pos].userFont); n++;
652 XtSetValues (font.userText, args, n);
653 XmTextShowPosition(font.userText, 0);
656 /*+++++++++++++++++++++++++++++++++++++++*/
658 /* Set flag indicating that the user */
659 /* text field has been modified. */
660 /*+++++++++++++++++++++++++++++++++++++++*/
664 XtPointer client_data,
665 XtPointer call_data )
668 font.userTextChanged = TRUE;
671 /************************************************************************
674 * restore any state information saved with saveFonts.
675 * This is called from restoreSession with the application
676 * shell and the special xrm database retrieved for restore.
677 ************************************************************************/
684 XrmRepresentation rep_type;
687 xrm_name [0] = XrmStringToQuark ("Fonts");
691 xrm_name [1] = XrmStringToQuark ("x");
692 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
693 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr));
695 save.restoreFlag = True;
699 xrm_name [1] = XrmStringToQuark ("y");
700 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
701 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr));
705 xrm_name [1] = XrmStringToQuark ("ismapped");
706 XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
707 /* Are we supposed to be mapped? */
708 if (strcmp(value.addr, "True") == 0)
712 /************************************************************************
715 * This routine will write out to the passed file descriptor any state
716 * information this dialog needs. It is called from saveSessionCB with the
717 * file already opened.
718 * All information is saved in xrm format. There is no restriction
719 * on what can be saved. It doesn't have to be defined or be part of any
720 * widget or Xt definition. Just name and save it here and recover it in
721 * restoreFonts. The suggested minimum is whether you are mapped, and your
723 ************************************************************************/
729 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
730 XmVendorShellExtObject vendorExt;
731 XmWidgetExtData extData;
733 if (style.fontDialog != NULL) {
734 if (XtIsManaged(style.fontDialog))
735 sprintf(bufr, "*Fonts.ismapped: True\n");
737 sprintf(bufr, "*Fonts.ismapped: False\n");
739 /* Get and write out the geometry info for our Window */
741 x = XtX(XtParent(style.fontDialog));
742 y = XtY(XtParent(style.fontDialog));
744 /* Modify x & y to take into account window mgr frames
745 * This is pretty bogus, but I don't know a better way to do it.
747 extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
748 vendorExt = (XmVendorShellExtObject)extData->widget;
749 x -= vendorExt->vendor.xOffset;
750 y -= vendorExt->vendor.yOffset;
752 sprintf(bufr, "%s*Fonts.x: %d\n", bufr, x);
753 sprintf(bufr, "%s*Fonts.y: %d\n", bufr, y);
755 write (fd, bufr, strlen(bufr));