DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ C T c ┃
Length: 9687 (0x25d7) Types: TextFile Names: »C_FUNCTIONS_C«, »c_functions.c«
└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13 └─ ⟦124ff5788⟧ »DATA« └─⟦this⟧ └─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧ └─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16 └─ ⟦6f12a12be⟧ »DATA« └─⟦this⟧ └─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04 └─ ⟦d65440be7⟧ »DATA« └─⟦this⟧ └─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13 └─ ⟦124ff5788⟧ »DATA« └─⟦f2882457c⟧ └─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦f2882457c⟧ └─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16 └─ ⟦6f12a12be⟧ »DATA« └─⟦f2882457c⟧ └─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04 └─ ⟦d65440be7⟧ »DATA« └─⟦f2882457c⟧ └─ ⟦this⟧ »C/c_functions.c«
static char rcsid_c_functions_c[] = "$Id"; /****************************************************************************** ******************************************************************************* * * (c) Copyright 1990, Non Standard Logics S.A. * ALL RIGHTS RESERVED * * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED * AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND * WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR * ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE * AVAILABLE TO ANY OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE * SOFTWARE IS HEREBY TRANSFERRED. * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT * NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY * Non Standard Logics S.A. OR ITS THIRD PARTY SUPPLIERS. * * Non Standard Logics S.A. AND ITS THIRD PARTY SUPPLIERS, * ASSUME NO RESPONSIBILITY FOR THE USE OR INABILITY TO USE ANY OF ITS * SOFTWARE . Non Standard Logics S.A SOFTWARE IS PROVIDED "AS IS" * WITHOUT WARRANTY OF ANY KIND, AND OSF EXPRESSLY DISCLAIMS ALL * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * (c) Copyright 1990, Non Standard Logics S.A. Unpublished - all * rights reserved under the Copyright laws of France * * Non Standard Logics S.A. * 57-59 rue Lhomond, * 75005 Paris. * France. * * XFaceMaker is a registered trademark of Non Standard Logics S.A. * ******************************************************************************* ******************************************************************************/ #include <X11/Intrinsic.h> #include <X11/IntrinsicP.h> #include <X11/Shell.h> #include <Xm/Xm.h> #include <Xm/XmP.h> #undef XtDisplay #undef XtScreen #undef XtWindow #undef XtClass #undef XtSuperClass #undef XtIsManaged #undef XtIsRealized #undef XtIsSensitive #include "ver.h" extern Widget FmToplevel(); static Boolean is_popup(w) Widget w; { Widget parent = XtParent(w); int i; if(parent == 0) return False; for (i = 0; i < parent->core.num_popups; i++) if(parent->core.popup_list[i] == w) return True; return False; } void FmHideWidget(widget) Widget widget; { if(is_popup(widget)){ XtPopdown(widget); } else if(XtIsApplicationShell(widget)) { if(XtIsRealized(widget)) XtUnmapWidget(widget); } else { XtUnmanageChild(widget); } } void FmConfigureShell(shell, x, y, width, height) Widget shell; int x, y, width, height; { FmSetHints(shell, x, y, width, height); } void FmShowWidget(widget) Widget widget; { #ifdef SETHINTS if(XtIsShell(widget) && !XtIsRealized(widget)){ XtSetMappedWhenManaged(widget, False); XtRealizeWidget(widget); FmSetHints(widget, widget->core.x, widget->core.y, widget->core.width, widget->core.height); XtSetMappedWhenManaged(widget, True); } #endif if(is_popup(widget)) { XtPopup(widget, XtGrabNone); } else if(XtIsApplicationShell(widget)){ XtMapWidget(widget); } else { XtManageChild(widget); } } void FmShow(widget) Widget widget; { FmShowWidget(widget); } void FmHide(widget) Widget widget; { FmHideWidget(widget); } void FmShowPopup(ev, widget) XButtonEvent *ev; Widget widget; { XmMenuPosition(widget, ev); XtManageChild(widget); } void FmBeep() { XBell(XtDisplay(FmToplevel()), 100); } void FmProcessAllEvents(){ XEvent ev; Display *dpy = XtDisplay(FmToplevel()); XSync(dpy, False); while (XPending(dpy)){ XtNextEvent(&ev); XtDispatchEvent(&ev); } } static Window FindWindow(w) Widget w; { Window win = 0; Widget ww = w; while (ww){ win = XtWindow(ww); if(win) break; ww = XtParent(ww); } return win; } static void MakeButtonEvent(widget, event_type, event) int event_type; Widget widget; XButtonEvent *event; { Window win; int x, y; Display *dpy; Window root, wraf; if(!widget) return; win = FindWindow(widget); if(win == 0) return; dpy = XtDisplay(FmToplevel()); root = DefaultRootWindow(dpy); event->type = event_type; event->window = win; event->root = root; event->x = widget -> core.width / 2; event->y = widget -> core.height / 2; XTranslateCoordinates(dpy, win, root, event->x, event->y, &x, &y, &wraf); event->x_root = x; event->y_root = y; event->state = (event_type == ButtonRelease ? Button1Mask : 0); event->button = Button1; event->same_screen = True; } static void SendButtonEvent(widget, event_type) Widget widget; int event_type; { XButtonEvent ev; Window win; Display *dpy; if(!widget) return; win = FindWindow(widget); if(win == 0) return; dpy = XtDisplay(FmToplevel()); MakeButtonEvent(widget, event_type, &ev); XSendEvent(dpy, win, False, 0, &ev); } void FmSendClick(widget) Widget widget; { if(!widget) return; SendButtonEvent(widget, ButtonPress); FmProcessAllEvents(); SendButtonEvent(widget, ButtonRelease); } /* FmSendMessageToWindow : send a client message. * * Return non-zero on success, 0 on failure. */ int FmSendMessageToWindow(dpy, win, type, format, data, size) Display *dpy; Window win; /* May be a Window ID, PointerWindow or InputFocus */ char *type; int format; /* 8, 16 or 32 */ caddr_t data; int size; /* in bytes */ { XClientMessageEvent e; if(!dpy || !type || !data) return(0); e.type = ClientMessage; e.display = dpy; e.window = win; e.message_type = XInternAtom(dpy, type, False); e.format = format; if(size > sizeof(e.data)) size = sizeof(e.data); bcopy(data, &e.data, size); return(XSendEvent(dpy, win, False, 0, &e)); } int FmSendMessage(w, type, data) Widget w; char *type, *data; { Window win; if(!w || !type || !data) return(0); win = FindWindow(w); if(win) return(FmSendMessageToWindow(XtDisplay(w), win, type, 8, data, strlen(data)+1)); else return 0; } void FmReturn(w, value) Widget w; unsigned long value; { Window win; if(w == 0) return; win = FindWindow(w); if(win) FmSendMessageToWindow(XtDisplay(w), win, "Return", 32, &value, sizeof(value)); } static int WaitMessage(type) char *type; { Atom atype; XEvent ev; Display *dpy = XtDisplay(FmToplevel()); atype = XInternAtom(dpy, type, False); for (;;){ XtNextEvent(&ev); if(ev.type == ClientMessage){ if(ev.xclient.message_type == atype){ return ev.xclient.data.l[0]; } else { XtDispatchEvent(&ev); } } else XtDispatchEvent(&ev); } } int FmWaitForReturn() { return(WaitMessage("Return")); } int FmPopupAndWait(widget) Widget widget; { if(is_popup(widget)){ XtPopup(widget, XtGrabExclusive); } else { FmShowWidget(widget); } return(FmWaitForReturn()); } XmString FmCreateXmString(s) String s; { if(!s) s = ""; return XmStringCreateLtoR (s, XmSTRING_DEFAULT_CHARSET); } char *FmGetString(s) XmString s; { char *ret; if(!s) return (XtNewString("")); if(XmStringGetLtoR(s, XmSTRING_DEFAULT_CHARSET, &ret) == False) return (XtNewString("")); return XtNewString(ret); } void WarpPointer(w) Widget w; { Display *dpy; if(w == 0) return; dpy = XtDisplay(w); XWarpPointer(dpy, None, XtWindow(w), 0, 0, 0, 0, w -> core.width/2, w -> core.height/2); } void FmWarpPointer(w) Widget w; { WarpPointer(w); } char *FmGetVersionString() { return VER; } void FmEnableTraversal(w, highlight_thickness) Widget w; int highlight_thickness; { Arg args[2]; int nargs; int i; if(XmIsManager(w)){ XmAddTabGroup(w); for(i = 0; i < ((CompositeWidget)w)->composite.num_children; i++){ nargs = 0; XtSetArg(args[nargs], XmNtraversalOn, True); nargs++; XtSetArg(args[nargs], XmNhighlightThickness, highlight_thickness); nargs++; XtSetValues(((CompositeWidget)w)->composite.children[i], args, nargs); } } else if(XmIsPrimitive(w) || XmIsGadget(w)){ nargs = 0; XtSetArg(args[nargs], XmNtraversalOn, True); nargs++; XtSetArg(args[nargs], XmNhighlightThickness, highlight_thickness); nargs++; XtSetValues(w, args, nargs); } } void FmDisableTraversal(w) Widget w; { Arg args[2]; int nargs; int i; if(XmIsManager(w)){ XmRemoveTabGroup(w); for(i = 0; i < ((CompositeWidget)w)->composite.num_children; i++){ nargs = 0; XtSetArg(args[nargs], XmNtraversalOn, False); nargs++; XtSetArg(args[nargs], XmNhighlightThickness, 0); nargs++; XtSetValues(((CompositeWidget)w)->composite.children[i], args, nargs); } } else if(XmIsPrimitive(w) || XmIsGadget(w)){ nargs = 0; XtSetArg(args[nargs], XmNtraversalOn, False); nargs++; XtSetArg(args[nargs], XmNhighlightThickness, 0); nargs++; XtSetValues(w, args, nargs); } } /* A convenience function for setting the items of an XmList. */ Boolean FmListSetItems(l, items_string) Widget l; String items_string; { XrmValue from, to; XmString *items, *p; int item_count; Arg arg[2]; /* First, convert the String to an XmString array. */ from.addr = items_string; from.size = strlen(items_string)+1; to.addr = 0; to.size = 0; XtConvert(l, XmRString, &from, XmRXmStringTable, &to); if(!to.addr) return(False); items = *(XmString **)to.addr; /* Then, count the items (the converter NULL-terminates the array. */ for(p = items, item_count = 0; *p; p++, item_count++) ; /* Ok, Set Values. */ XtSetArg(arg[0], XmNitems, items); XtSetArg(arg[1], XmNitemCount, item_count); XtSetValues(l, arg, 2); return(True); } void FmRaiseWidget(w) Widget w; { XRaiseWindow(XtDisplay(w), XtWindow(w)); } void FmLowerWidget(w) Widget w; { XLowerWindow(XtDisplay(w), XtWindow(w)); } void FmCallResizeProc(w) Widget w; { if(!w) return; w -> core.widget_class -> core_class.resize(w); } char *FmWidgetName(w) Widget w; { return(XrmQuarkToString(w->core.xrm_name)); }