123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968 |
- /*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them under the terms of the GNU
- * Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * These libraries and programs are distributed in the hope that
- * they will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
- /*
- * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
- * ALL RIGHTS RESERVED
- */
- /*
- * Motif Release 1.2.3
- */
- /*
- * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
- /*
- * Included Files:
- */
- #include "WmGlobal.h"
- #include "WmResNames.h"
- #include "WmError.h"
- #include <Xm/Xm.h>
- #include <X11/Shell.h>
- #include <Xm/Label.h>
- #include <Xm/DialogS.h>
- #include <Xm/BulletinB.h>
- #include <Xm/MessageB.h>
- #include <Dt/HourGlass.h>
- #define MOVE_OUTLINE_WIDTH 2
- #define FEEDBACK_BEVEL 2
- #define DEFAULT_POSITION_STRING "(0000x0000)"
- #define CB_HIGHLIGHT_THICKNESS 3
- /*
- * include extern functions
- */
- #include "WmFeedback.h"
- #include "WmFunction.h"
- #include "WmGraphics.h"
- #include "WmPanelP.h" /* for typedef in WmManage.h */
- #include "WmManage.h"
- #include "WmColormap.h"
- #include "stdio.h"
- /*
- * Global Variables:
- */
- static Cursor waitCursor = (Cursor)0L;
- /* see WmGlobal.h for index defines: */
- #ifndef NO_MESSAGE_CATALOG
- static char *confirm_mesg[4] = {"Switch to Default Behavior?",
- "Switch to Custom Behavior?",
- "Restart Mwm?",
- "QUIT Mwm?"};
- void
- initMesg(void)
- {
- char * tmpString;
- /*
- * catgets returns a pointer to an area that is over written
- * on each call to catgets.
- */
- tmpString = ((char *)GETMESSAGE(22, 12, "Switch to Default Behavior?"));
- if ((confirm_mesg[0] =
- (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
- {
- Warning (((char *)GETMESSAGE(22, 2, "Insufficient memory for local message string")));
- confirm_mesg[0] = "Switch to Default Behavior?";
- }
- else
- {
- strcpy(confirm_mesg[0], tmpString);
- }
- tmpString = ((char *)GETMESSAGE(22, 13, "Switch to Custom Behavior?"));
- if ((confirm_mesg[1] =
- (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
- {
- Warning (((char *)GETMESSAGE(22, 2, "Insufficient memory for local message string")));
- confirm_mesg[1] = "Switch to Custom Behavior?";
- }
- else
- {
- strcpy(confirm_mesg[1], tmpString);
- }
- if (MwmBehavior)
- {
- tmpString = ((char *)GETMESSAGE(22, 3, "Restart Mwm?"));
- }
- else
- {
- tmpString = ((char *)GETMESSAGE(22, 10, "Restart Workspace Manager?"));
- }
- if ((confirm_mesg[2] =
- (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
- {
- Warning (((char *)GETMESSAGE(22, 5, "Insufficient memory for local message string")));
- if (MwmBehavior)
- {
- confirm_mesg[2] = "Restart Mwm?";
- }
- else
- {
- confirm_mesg[2] = "Restart Workspace Manager?";
- }
- }
- else
- {
- strcpy(confirm_mesg[2], tmpString);
- }
- if (MwmBehavior)
- {
- tmpString = ((char *)GETMESSAGE(22, 6, "QUIT Mwm?"));
- }
- else
- {
- if (wmGD.dtLite)
- {
- tmpString = ((char *)GETMESSAGE(22, 9, "Log out?"));
- }
- else
- {
- tmpString = ((char *)GETMESSAGE(22, 11, "QUIT Workspace Manager?"));
- }
- }
-
- if ((confirm_mesg[3] =
- (char *)XtMalloc ((unsigned int) (strlen(tmpString) + 1))) == NULL)
- {
- Warning (((char *)GETMESSAGE(22, 8, "Insufficient memory for local message string")));
- if (MwmBehavior)
- {
- confirm_mesg[3] = "QUIT Mwm?";
- }
- else
- if (wmGD.dtLite)
- {
- confirm_mesg[3] = "Log out?";
- }
- else
- {
- confirm_mesg[3] = "QUIT Workspace Manager?";
- }
- }
- else
- {
- strcpy(confirm_mesg[3], tmpString);
- }
- }
- #else
- static char *confirm_mesg[4] = {"Toggle to Default Behavior?",
- "Toggle to Custom Behavior?",
- "Restart Mwm?",
- "QUIT Mwm?"};
- #endif
- static char *confirm_widget[4] = {"confirmDefaultBehavior",
- "confirmCustomBehavior",
- "confirmRestart",
- "confirmQuit"};
- typedef void (*ConfirmFunc)(Boolean);
- static ConfirmFunc confirm_func[4] = {Do_Set_Behavior,
- Do_Set_Behavior,
- Do_Restart,
- Do_Quit_Mwm};
- /*************************************<->*************************************
- *
- * ShowFeedbackWindow(pSD, x, y, width, height, style)
- *
- *
- * Description:
- * -----------
- * Pop up the window for moving and sizing feedback
- *
- *
- * Inputs:
- * ------
- * pSD - pointer to screen data
- * x - initial x-value
- * y - initial y-value
- * width - initial width value
- * height - initial height value
- * style - show size, position, or both
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- *************************************<->***********************************/
- void ShowFeedbackWindow (WmScreenData *pSD, int x, int y, unsigned int width, unsigned int height, unsigned long style)
- {
- unsigned long mask = 0;
- XSetWindowAttributes win_attribs;
- XWindowChanges win_changes;
- int direction, ascent, descent;
- XCharStruct xcsLocation;
- int winX, winY;
- int tmpX, tmpY;
- if ( (pSD->fbStyle = style) == FB_OFF)
- return;
- pSD->fbLastX = x;
- pSD->fbLastY = y;
- pSD->fbLastWidth = width;
- pSD->fbLastHeight = height;
- /*
- * Derive the size and position of the window from the text extents
- * Set starting position of each string
- */
- XTextExtents(pSD->feedbackAppearance.font, DEFAULT_POSITION_STRING,
- strlen(DEFAULT_POSITION_STRING), &direction, &ascent,
- &descent, &xcsLocation);
-
- pSD->fbWinWidth = xcsLocation.width + 4*FEEDBACK_BEVEL;
- switch (pSD->fbStyle)
- {
- case FB_SIZE:
- pSD->fbSizeY = 2*FEEDBACK_BEVEL + ascent;
- pSD->fbWinHeight = (ascent + descent) + 4*FEEDBACK_BEVEL;
- break;
- case FB_POSITION:
- pSD->fbLocY = 2*FEEDBACK_BEVEL + ascent;
- pSD->fbWinHeight = (ascent + descent) + 4*FEEDBACK_BEVEL;
- break;
- default:
- case (FB_SIZE | FB_POSITION):
- pSD->fbLocY = 2*FEEDBACK_BEVEL + ascent;
- pSD->fbSizeY = pSD->fbLocY + ascent + descent;
- pSD->fbWinHeight = 2*(ascent + descent) + 4*FEEDBACK_BEVEL;
- break;
- }
- if (pSD->feedbackGeometry) /* set by user */
- {
- unsigned int junkWidth, junkHeight;
- mask = XParseGeometry(pSD->feedbackGeometry, &tmpX, &tmpY,
- &junkWidth, &junkHeight);
- }
- if (mask & (XValue|YValue))
- {
- winX = (mask & XNegative) ?
- DisplayWidth(DISPLAY, pSD->screen) + tmpX - pSD->fbWinWidth : tmpX;
- winY = (mask & YNegative) ?
- DisplayHeight(DISPLAY, pSD->screen) + tmpY -pSD->fbWinHeight : tmpY;
- }
- else
- {
- winX = (DisplayWidth(DISPLAY, pSD->screen) - pSD->fbWinWidth)/2;
- winY = (DisplayHeight(DISPLAY, pSD->screen) -pSD->fbWinHeight)/2;
- }
- /*
- * Put new text into the feedback strings
- */
- UpdateFeedbackText (pSD, x, y, width, height);
- /*
- * bevel the window border for a 3-D look
- */
- if ( (pSD->fbTop && pSD->fbBottom) ||
- ((pSD->fbTop = AllocateRList((unsigned)2*FEEDBACK_BEVEL)) &&
- (pSD->fbBottom = AllocateRList((unsigned)2*FEEDBACK_BEVEL))) )
- {
- pSD->fbTop->used = 0;
- pSD->fbBottom->used = 0;
- BevelRectangle (pSD->fbTop,
- pSD->fbBottom,
- 0, 0,
- pSD->fbWinWidth, pSD->fbWinHeight,
- FEEDBACK_BEVEL, FEEDBACK_BEVEL,
- FEEDBACK_BEVEL, FEEDBACK_BEVEL);
- }
- /*
- * Create window if not yet created, otherwise fix size and position
- */
- if (!pSD->feedbackWin)
- {
- /*
- * Create the window
- */
- mask = CWEventMask | CWOverrideRedirect | CWSaveUnder;
- win_attribs.event_mask = ExposureMask;
- win_attribs.override_redirect = TRUE;
- win_attribs.save_under = TRUE;
- /*
- * Use background pixmap if one is specified, otherwise set the
- * appropriate background color.
- */
- if (pSD->feedbackAppearance.backgroundPixmap)
- {
- mask |= CWBackPixmap;
- win_attribs.background_pixmap =
- pSD->feedbackAppearance.backgroundPixmap;
- }
- else
- {
- mask |= CWBackPixel;
- win_attribs.background_pixel =
- pSD->feedbackAppearance.background;
- }
- pSD->feedbackWin = XCreateWindow (DISPLAY, pSD->rootWindow,
- winX, winY,
- pSD->fbWinWidth,
- pSD->fbWinHeight,
- 0, CopyFromParent,
- InputOutput, CopyFromParent,
- mask, &win_attribs);
- }
- else
- {
- win_changes.x = winX;
- win_changes.y = winY;
- win_changes.width = pSD->fbWinWidth;
- win_changes.height = pSD->fbWinHeight;
- win_changes.stack_mode = Above;
- mask = CWX | CWY | CWWidth | CWHeight | CWStackMode;
- XConfigureWindow(DISPLAY, pSD->feedbackWin, (unsigned int) mask,
- &win_changes);
- }
- /*
- * Make the feedback window visible (map it)
- */
- if (pSD && pSD->feedbackWin)
- {
- /* Make sure the feedback window doesn't get buried */
- XRaiseWindow(DISPLAY, pSD->feedbackWin);
- XMapWindow (DISPLAY, pSD->feedbackWin);
- PaintFeedbackWindow(pSD);
- }
- } /* END OF FUNCTION ShowFeedbackWindow */
- /*************************************<->*************************************
- *
- * PaintFeedbackWindow(pSD)
- *
- *
- * Description:
- * -----------
- * Repaints the feedback window in response to exposure events
- *
- *
- * Inputs:
- * ------
- * pSD - pointer to screen data
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- *************************************<->***********************************/
- void PaintFeedbackWindow (WmScreenData *pSD)
- {
- if (pSD->feedbackWin)
- {
- /*
- * draw beveling
- */
- if (pSD->fbTop && pSD->fbTop->used > 0)
- {
- XFillRectangles (DISPLAY, pSD->feedbackWin,
- pSD->feedbackAppearance.inactiveTopShadowGC,
- pSD->fbTop->prect, pSD->fbTop->used);
- }
- if (pSD->fbBottom && pSD->fbBottom->used > 0)
- {
- XFillRectangles (DISPLAY, pSD->feedbackWin,
- pSD->feedbackAppearance.inactiveBottomShadowGC,
- pSD->fbBottom->prect,
- pSD->fbBottom->used);
- }
- /*
- * clear old text
- */
- XClearArea (DISPLAY, pSD->feedbackWin,
- FEEDBACK_BEVEL, FEEDBACK_BEVEL,
- pSD->fbWinWidth-2*FEEDBACK_BEVEL,
- pSD->fbWinHeight-2*FEEDBACK_BEVEL,
- FALSE);
- /*
- * put up new text
- */
- if (pSD->fbStyle & FB_POSITION)
- {
- WmDrawString (DISPLAY, pSD->feedbackWin,
- pSD->feedbackAppearance.inactiveGC,
- pSD->fbLocX, pSD->fbLocY,
- pSD->fbLocation, strlen(pSD->fbLocation));
- }
- if (pSD->fbStyle & FB_SIZE)
- {
- WmDrawString (DISPLAY, pSD->feedbackWin,
- pSD->feedbackAppearance.inactiveGC,
- pSD->fbSizeX, pSD->fbSizeY,
- pSD->fbSize, strlen(pSD->fbSize));
- }
- }
- }
- /*************************************<->*************************************
- *
- * HideFeedbackWindow (pSD)
- *
- *
- * Description:
- * -----------
- * Hide the feedback window
- *
- *
- * Inputs:
- * ------
- * pDS - pointer to screen data
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- void HideFeedbackWindow (WmScreenData *pSD)
- {
- if (pSD->feedbackWin)
- {
- XUnmapWindow (DISPLAY, pSD->feedbackWin);
- ForceColormapFocus (ACTIVE_PSD, ACTIVE_PSD->colormapFocus);
- }
- pSD->fbStyle = FB_OFF;
- }
- /*************************************<->*************************************
- *
- * UpdateFeedbackInfo (pSD, x, y, width, height)
- *
- *
- * Description:
- * -----------
- * Update the information in the feedback window
- *
- *
- * Inputs:
- * ------
- * pSD - pointer to screen info
- * x - x-value
- * y - y-value
- * width - width value
- * height - height value
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- void UpdateFeedbackInfo (WmScreenData *pSD, int x, int y, unsigned int width, unsigned int height)
- {
- /*
- * Currently the feedback window must always be redrawn to (potentially)
- * repair damage done by moving the configuration outline. The feedback
- * repainting generally only needs to be done when the information
- * changes or the feedback window is actually overwritten by the
- * configuration outline.
- */
- pSD->fbLastX = x;
- pSD->fbLastY = y;
- pSD->fbLastWidth = width;
- pSD->fbLastHeight = height;
- UpdateFeedbackText (pSD, x, y, width, height);
- PaintFeedbackWindow(pSD);
- }
- /*************************************<->*************************************
- *
- * UpdateFeedbackText (pSD, x, y, width, height)
- *
- *
- * Description:
- * -----------
- * Update the information in the feedback strings
- *
- *
- * Inputs:
- * ------
- * pSD - pointer to screen data
- * x - x-value
- * y - y-value
- * width - width value
- * height - height value
- *
- *
- * Outputs:
- * -------
- *
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- void UpdateFeedbackText (WmScreenData *pSD, int x, int y, unsigned int width, unsigned int height)
- {
- int direction, ascent, descent;
- XCharStruct xcs;
- if (pSD->fbStyle & FB_POSITION)
- {
- sprintf (pSD->fbLocation, "(%4d,%-4d)", x, y);
- XTextExtents(pSD->feedbackAppearance.font, pSD->fbLocation,
- strlen(pSD->fbLocation), &direction, &ascent,
- &descent, &xcs);
- pSD->fbLocX = (pSD->fbWinWidth - xcs.width)/2;
- }
- if (pSD->fbStyle & FB_SIZE)
- {
- sprintf (pSD->fbSize, "%4dx%-4d", width, height);
- XTextExtents(pSD->feedbackAppearance.font, pSD->fbSize,
- strlen(pSD->fbSize), &direction, &ascent,
- &descent, &xcs);
- pSD->fbSizeX = (pSD->fbWinWidth - xcs.width)/2;
- }
- }
- /*************************************<->*************************************
- *
- * static void
- * OkCB (w, client_data, call_data)
- *
- *
- * Description:
- * -----------
- * QuestionBox Ok callback.
- *
- *
- * Inputs:
- * ------
- * None.
- *
- *
- * Outputs:
- * -------
- * None.
- *
- *
- * Comments:
- * --------
- * None.
- *
- *************************************<->***********************************/
- static void OkCB (Widget w, caddr_t client_data, caddr_t call_data)
- {
- WithdrawDialog (w);
- confirm_func[((WmScreenData *)client_data)->actionNbr] (False);
- wmGD.confirmDialogMapped = False;
- } /* END OF FUNCTION OkCB */
- /*************************************<->*************************************
- *
- * static void
- * CancelCB (w, client_data, call_data)
- *
- *
- * Description:
- * -----------
- * QuestionBox Cancel callback.
- *
- *
- * Inputs:
- * ------
- * None.
- *
- *
- * Outputs:
- * -------
- * None.
- *
- *
- * Comments:
- * --------
- * None.
- *
- *************************************<->***********************************/
- static void CancelCB (Widget w, caddr_t client_data, caddr_t call_data)
- {
- WithdrawDialog (w);
- wmGD.confirmDialogMapped = False;
- } /* END OF FUNCTION CancelCB */
- /*************************************<->*************************************
- *
- * void
- * ConfirmAction (pSD,nbr)
- *
- *
- * Description:
- * -----------
- * Post a QuestionBox and ask for confirmation. If so, executes the
- * appropriate action.
- *
- *
- * Inputs:
- * ------
- * nbr = action number
- * pSD->screen
- * pSD->screenTopLevel
- *
- *
- * Outputs:
- * -------
- * actionNbr = current QuestionBox widget index.
- * confirmW[actionNbr] = QuestionBox widget.
- *
- *
- * Comments:
- * --------
- *
- *************************************<->***********************************/
- void ConfirmAction (WmScreenData *pSD, int nbr)
- {
- Arg args[8];
- int n;
- int x, y;
- Dimension width, height;
- Widget dialogShellW = NULL;
- XmString messageString;
- static XmString defaultMessageString = NULL;
- /*
- * If there is a system modal window, don't post another
- * one. We need to think about a way to let a new system
- * modal window be posted, and when unposted, restore the
- * modal state of the current system modal window.
- */
- if(wmGD.systemModalActive)
- {
- return ;
- }
- if (pSD->confirmboxW[nbr] == NULL)
- /* First time for this one */
- {
- #ifndef NO_MESSAGE_CATALOG
- /*
- * Initialize messages
- */
- initMesg();
- #endif
- /*
- * Create a dialog popup shell with explicit keyboard policy.
- */
- n = 0;
- XtSetArg(args[n], XmNx, (XtArgVal)
- (DisplayWidth (DISPLAY, pSD->screen)/2)); n++;
- XtSetArg(args[n], XmNy, (XtArgVal)
- (DisplayHeight (DISPLAY, pSD->screen)/2)); n++;
- XtSetArg(args[n], XtNallowShellResize, (XtArgVal) TRUE); n++;
- XtSetArg(args[n], XtNkeyboardFocusPolicy, (XtArgVal) XmEXPLICIT); n++;
- XtSetArg(args[n], XtNdepth,
- (XtArgVal) DefaultDepth(DISPLAY, pSD->screen)); n++;
- XtSetArg(args[n], XtNscreen,
- (XtArgVal) ScreenOfDisplay(DISPLAY, pSD->screen)); n++;
- dialogShellW =
- XtCreatePopupShell ((String) WmNfeedback,
- transientShellWidgetClass,
- pSD->screenTopLevelW, args, n);
- /*
- * Create a QuestionBox as a child of the popup shell.
- * Set traversalOn and add callbacks for the OK and CANCEL buttons.
- * Unmanage the HELP button.
- */
- n = 0;
- XtSetArg(args[n], XmNdialogType, (XtArgVal) XmDIALOG_QUESTION); n++;
- XtSetArg(args[n], XmNmessageAlignment, (XtArgVal) XmALIGNMENT_CENTER);
- n++;
- XtSetArg(args[n], XmNtraversalOn, (XtArgVal) TRUE); n++;
- /*
- * In 1.2 confirmbox's widget name changed from the generic
- * WmNconfirmbox (ie. 'confirmbox') to a more descriptive name
- * so that each confirm dialog can be customized separately (e.g.
- * "Mwm*confirmRestart*messageString: restart it?").
- */
- pSD->confirmboxW[nbr] =
- XtCreateManagedWidget (confirm_widget[nbr], xmMessageBoxWidgetClass,
- dialogShellW, args, n);
- n = 0;
- XtSetArg(args[n], XmNmessageString, &messageString); n++;
- XtGetValues(pSD->confirmboxW[nbr], (ArgList) args, n);
- if (defaultMessageString == NULL)
- {
- defaultMessageString = XmStringCreateLocalized ("");
- }
- n = 0;
- /*
- * If the message string is the default, then put something
- * 'reasonable' in instead.
- */
- if (XmStringCompare( messageString, defaultMessageString ))
- {
- messageString = XmStringCreateLocalized(confirm_mesg[nbr]);
- XtSetArg(args[n], XmNmessageString, (XtArgVal) messageString); n++;
- XtSetValues(pSD->confirmboxW[nbr], (ArgList) args, n);
- XmStringFree(messageString);
- }
- n = 0;
- XtSetArg (args[n], XmNtraversalOn, (XtArgVal) TRUE); n++;
- XtSetArg (args[n], XmNhighlightThickness,
- (XtArgVal) CB_HIGHLIGHT_THICKNESS); n++;
- #ifndef NO_MESSAGE_CATALOG
- XtSetArg(args[n], XmNlabelString, wmGD.okLabel); n++;
- #endif
- XtSetValues ( XmMessageBoxGetChild (pSD->confirmboxW[nbr],
- XmDIALOG_OK_BUTTON), args, n);
- #ifndef NO_MESSAGE_CATALOG
- n--;
- XtSetArg(args[n], XmNlabelString, wmGD.cancelLabel); n++;
- #endif
- XtSetValues ( XmMessageBoxGetChild (pSD->confirmboxW[nbr],
- XmDIALOG_CANCEL_BUTTON), args, n);
- XtAddCallback (pSD->confirmboxW[nbr], XmNokCallback,
- (XtCallbackProc)OkCB, (XtPointer)pSD);
- XtAddCallback (pSD->confirmboxW[nbr], XmNcancelCallback,
- (XtCallbackProc)CancelCB, (XtPointer)NULL);
- XtUnmanageChild
- (XmMessageBoxGetChild (pSD->confirmboxW[nbr],
- XmDIALOG_HELP_BUTTON));
- XtRealizeWidget (dialogShellW);
- /*
- * Center the DialogShell in the display.
- */
- n = 0;
- XtSetArg(args[n], XmNheight, &height); n++;
- XtSetArg(args[n], XmNwidth, &width); n++;
- XtGetValues (dialogShellW, (ArgList) args, n);
- x = (DisplayWidth (DISPLAY, pSD->screen) - ((int) width))/2;
- y = (DisplayHeight (DISPLAY, pSD->screen) - ((int) height))/2;
- n = 0;
- XtSetArg(args[n], XmNx, (XtArgVal) x); n++;
- XtSetArg(args[n], XmNy, (XtArgVal) y); n++;
- XtSetValues (dialogShellW, (ArgList) args, n);
- ManageWindow (pSD, XtWindow(dialogShellW), MANAGEW_CONFIRM_BOX);
- }
- else
- {
- ReManageDialog (pSD, pSD->confirmboxW[nbr]);
- }
- pSD->actionNbr = nbr;
- XFlush(DISPLAY);
- wmGD.confirmDialogMapped = True;
- } /* END OF FUNCTION ConfirmAction */
- /*************************************<->*************************************
- *
- * ShowWaitState (flag)
- *
- *
- * Description:
- * -----------
- * Enter/Leave the wait state.
- *
- *
- * Inputs:
- * ------
- * flag = TRUE for Enter, FALSE for Leave.
- *
- *
- * Outputs:
- * -------
- * None.
- *
- *
- * Comments:
- * --------
- * None.
- *
- *************************************<->***********************************/
- void ShowWaitState (Boolean flag)
- {
- unsigned int width;
- unsigned int height;
- unsigned int xHotspot;
- unsigned int yHotspot;
- Pixmap pixmap;
- Pixmap maskPixmap;
- XColor xcolors[2];
- _DtGetHourGlassCursor(DISPLAY);
- if (flag)
- {
- XGrabPointer (DISPLAY, DefaultRootWindow(DISPLAY), FALSE,
- 0, GrabModeAsync, GrabModeAsync, None,
- waitCursor, CurrentTime);
- XGrabKeyboard (DISPLAY, DefaultRootWindow(DISPLAY), FALSE,
- GrabModeAsync, GrabModeAsync, CurrentTime);
- }
- else
- {
- XUngrabPointer (DISPLAY, CurrentTime);
- XUngrabKeyboard (DISPLAY, CurrentTime);
- }
- } /* END OF FUNCTION ShowWaitState */
- /*************************************<->*************************************
- *
- * InitCursorInfo ()
- *
- *
- * Description:
- * -----------
- * This function determines whether a server supports large cursors. It it
- * does large feedback cursors are used in some cases (wait state and
- * system modal state); otherwise smaller (16x16) standard cursors are used.
- *
- * Outputs:
- * -------
- * wmGD.useLargeCusors = set to True if larger cursors are supported.
- *
- *************************************<->***********************************/
- void InitCursorInfo (void)
- {
- unsigned int cWidth;
- unsigned int cHeight;
- wmGD.useLargeCursors = False;
- if (XQueryBestCursor (DISPLAY, DefaultRootWindow(DISPLAY),
- 32, 32, &cWidth, &cHeight))
- {
- if ((cWidth >= 32) && (cHeight >= 32))
- {
- wmGD.useLargeCursors = True;
- }
- }
- } /* END OF FUNCTION InitCursorInfo */
|