diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-14 15:50:13 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-14 15:50:13 -0400 |
commit | 019cfe87355df593355a37f53e768d8ccdf06eb0 (patch) | |
tree | bfc56e1ccea55f0404350fdb978117f2fcf25c96 /src | |
parent | 43f01d164ecdc5d5efe62a5fb82a4d22aa62b0e0 (diff) |
indent'd like "x-indent.sh", but with a more complete set of typedefs - see
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/Popup.c | 169 |
1 files changed, 84 insertions, 85 deletions
diff --git a/src/Popup.c b/src/Popup.c index 3c5aa7d..61be512 100644 --- a/src/Popup.c +++ b/src/Popup.c @@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. - Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved @@ -51,78 +50,79 @@ SOFTWARE. #include "IntrinsicI.h" #include "ShellP.h" -void _XtPopup( - Widget widget, - XtGrabKind grab_kind, - _XtBoolean spring_loaded) +void +_XtPopup(Widget widget, XtGrabKind grab_kind, _XtBoolean spring_loaded) { register ShellWidget shell_widget = (ShellWidget) widget; - if (! XtIsShell(widget)) { - XtAppErrorMsg(XtWidgetToApplicationContext(widget), - "invalidClass","xtPopup",XtCXtToolkitError, - "XtPopup requires a subclass of shellWidgetClass", - NULL, NULL); + if (!XtIsShell(widget)) { + XtAppErrorMsg(XtWidgetToApplicationContext(widget), + "invalidClass", "xtPopup", XtCXtToolkitError, + "XtPopup requires a subclass of shellWidgetClass", + NULL, NULL); + } + + if (!shell_widget->shell.popped_up) { + XtGrabKind call_data = grab_kind; + + XtCallCallbacks(widget, XtNpopupCallback, (XtPointer) & call_data); + shell_widget->shell.popped_up = TRUE; + shell_widget->shell.grab_kind = grab_kind; + shell_widget->shell.spring_loaded = (Boolean) spring_loaded; + if (shell_widget->shell.create_popup_child_proc != NULL) { + (*(shell_widget->shell.create_popup_child_proc)) (widget); + } + if (grab_kind == XtGrabExclusive) { + XtAddGrab(widget, TRUE, spring_loaded); + } + else if (grab_kind == XtGrabNonexclusive) { + XtAddGrab(widget, FALSE, spring_loaded); + } + XtRealizeWidget(widget); + XMapRaised(XtDisplay(widget), XtWindow(widget)); } + else + XRaiseWindow(XtDisplay(widget), XtWindow(widget)); + +} /* _XtPopup */ - if (! shell_widget->shell.popped_up) { - XtGrabKind call_data = grab_kind; - XtCallCallbacks(widget, XtNpopupCallback, (XtPointer)&call_data); - shell_widget->shell.popped_up = TRUE; - shell_widget->shell.grab_kind = grab_kind; - shell_widget->shell.spring_loaded = (Boolean) spring_loaded; - if (shell_widget->shell.create_popup_child_proc != NULL) { - (*(shell_widget->shell.create_popup_child_proc))(widget); - } - if (grab_kind == XtGrabExclusive) { - XtAddGrab(widget, TRUE, spring_loaded); - } else if (grab_kind == XtGrabNonexclusive) { - XtAddGrab(widget, FALSE, spring_loaded); - } - XtRealizeWidget(widget); - XMapRaised(XtDisplay(widget), XtWindow(widget)); - } else - XRaiseWindow(XtDisplay(widget), XtWindow(widget)); - -} /* _XtPopup */ - -void XtPopup (Widget widget, XtGrabKind grab_kind) +void +XtPopup(Widget widget, XtGrabKind grab_kind) { Widget hookobj; switch (grab_kind) { - case XtGrabNone: - case XtGrabExclusive: - case XtGrabNonexclusive: - break; - - default: - XtAppWarningMsg( - XtWidgetToApplicationContext(widget), - "invalidGrabKind","xtPopup",XtCXtToolkitError, - "grab kind argument has invalid value; XtGrabNone assumed", - NULL, NULL); - grab_kind = XtGrabNone; + case XtGrabNone: + case XtGrabExclusive: + case XtGrabNonexclusive: + break; + + default: + XtAppWarningMsg(XtWidgetToApplicationContext(widget), + "invalidGrabKind", "xtPopup", XtCXtToolkitError, + "grab kind argument has invalid value; XtGrabNone assumed", + NULL, NULL); + grab_kind = XtGrabNone; } _XtPopup(widget, grab_kind, FALSE); hookobj = XtHooksOfDisplay(XtDisplay(widget)); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { - XtChangeHookDataRec call_data; - - call_data.type = XtHpopup; - call_data.widget = widget; - call_data.event_data = (XtPointer)grab_kind; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, - (XtPointer)&call_data); + XtChangeHookDataRec call_data; + + call_data.type = XtHpopup; + call_data.widget = widget; + call_data.event_data = (XtPointer) grab_kind; + XtCallCallbackList(hookobj, + ((HookObject) hookobj)->hooks.changehook_callbacks, + (XtPointer) & call_data); } -} /* XtPopup */ +} /* XtPopup */ -void XtPopupSpringLoaded ( - Widget widget) +void +XtPopupSpringLoaded(Widget widget) { Widget hookobj; @@ -130,29 +130,29 @@ void XtPopupSpringLoaded ( hookobj = XtHooksOfDisplay(XtDisplay(widget)); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { - XtChangeHookDataRec call_data; + XtChangeHookDataRec call_data; - call_data.type = XtHpopupSpringLoaded; - call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, - (XtPointer)&call_data); + call_data.type = XtHpopupSpringLoaded; + call_data.widget = widget; + XtCallCallbackList(hookobj, + ((HookObject) hookobj)->hooks.changehook_callbacks, + (XtPointer) & call_data); } } -void XtPopdown( - Widget widget) +void +XtPopdown(Widget widget) { /* Unmap a shell widget if it is mapped, and remove from grab list */ Widget hookobj; ShellWidget shell_widget = (ShellWidget) widget; XtGrabKind grab_kind; - if (! XtIsShell(widget)) { - XtAppErrorMsg(XtWidgetToApplicationContext(widget), - "invalidClass","xtPopdown",XtCXtToolkitError, - "XtPopdown requires a subclass of shellWidgetClass", - NULL, NULL); + if (!XtIsShell(widget)) { + XtAppErrorMsg(XtWidgetToApplicationContext(widget), + "invalidClass", "xtPopdown", XtCXtToolkitError, + "XtPopdown requires a subclass of shellWidgetClass", + NULL, NULL); } #ifndef X_NO_XT_POPDOWN_CONFORMANCE @@ -162,34 +162,33 @@ void XtPopdown( grab_kind = shell_widget->shell.grab_kind; XWithdrawWindow(XtDisplay(widget), XtWindow(widget), - XScreenNumberOfScreen(XtScreen(widget))); + XScreenNumberOfScreen(XtScreen(widget))); if (grab_kind != XtGrabNone) - XtRemoveGrab(widget); + XtRemoveGrab(widget); shell_widget->shell.popped_up = FALSE; - XtCallCallbacks(widget, XtNpopdownCallback, (XtPointer)&grab_kind); + XtCallCallbacks(widget, XtNpopdownCallback, (XtPointer) & grab_kind); hookobj = XtHooksOfDisplay(XtDisplay(widget)); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { - XtChangeHookDataRec call_data; + XtChangeHookDataRec call_data; - call_data.type = XtHpopdown; - call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, - (XtPointer)&call_data); + call_data.type = XtHpopdown; + call_data.widget = widget; + XtCallCallbackList(hookobj, + ((HookObject) hookobj)->hooks.changehook_callbacks, + (XtPointer) & call_data); } -} /* XtPopdown */ +} /* XtPopdown */ -/* ARGSUSED */ -void XtCallbackPopdown( - Widget widget _X_UNUSED, - XtPointer closure, - XtPointer call_data _X_UNUSED) +void +XtCallbackPopdown(Widget widget _X_UNUSED, + XtPointer closure, + XtPointer call_data _X_UNUSED) { register XtPopdownID id = (XtPopdownID) closure; XtPopdown(id->shell_widget); if (id->enable_widget != NULL) { - XtSetSensitive(id->enable_widget, TRUE); + XtSetSensitive(id->enable_widget, TRUE); } -} /* XtCallbackPopdown */ +} /* XtCallbackPopdown */ |