/*----------------------------------------------------------------------*/ /* extern */ Boolean XfeIsOpenLookRunning(Widget w) { Widget app_shell = XfeAncestorFindApplicationShell(w); Display * dpy = XtDisplay(app_shell); int result; Atom actual_type = 0; int actual_format = 0; unsigned long nitems = 0; unsigned long bytes_after = 0; unsigned char * data = 0; Atom proto_atom = XInternAtom(dpy, "_SUN_WM_PROTOCOLS", True); /* If the atom isn't interned, OLWM can't be running. */ if (proto_atom == None) { return False; } result=XGetWindowProperty(dpy, RootWindowOfScreen(DefaultScreenOfDisplay(dpy)), proto_atom, 0, 0, /* read 0 bytes */ False, /* don't delete */ AnyPropertyType, /* type expected */ &actual_type, /* returned values */ &actual_format, &nitems, &bytes_after, &data); /* At most, this will be 1 allocated byte. */ if (data) { XtFree(data); } /* If any of these are true, then OLWM isn't running. */ if (result != Success || /* no such property */ actual_type != XA_ATOM || /* didn't contain type Atom */ bytes_after <= 0) /* zero length */ { return False; } /* * Otherwise, it sure looks like OLWM is running. If it's not, * then it's some other program that is imitating it well. */ return True; }
/*----------------------------------------------------------------------*/ static Widget create_frame_shell(Widget parent,String name) { Widget frame; Widget form; Widget docked_task_bar; Widget dash_board; static Widget floating_shell = NULL; static Boolean first_instance = True; frame = XtVaCreatePopupShell(name, xfeFrameShellWidgetClass, parent, NULL); XfeAddEditresSupport(frame); form = XtVaCreateManagedWidget("Form", xmFormWidgetClass, frame, NULL); if (first_instance) { int mask; int func; Widget floating_task_bar; first_instance = False; mask = MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU; func = MWM_FUNC_CLOSE | MWM_FUNC_MOVE; floating_shell = XtVaCreatePopupShell("FloatingShell", xmDialogShellWidgetClass, XfeAncestorFindApplicationShell(parent), XmNvisual, XfeVisual(parent), XmNcolormap, XfeColormap(parent), XmNdepth, XfeDepth(parent), XmNmwmDecorations, mask, XmNmwmFunctions, func, XmNallowShellResize, True, XmNdeleteResponse, XmDO_NOTHING, NULL); floating_task_bar = XfeCreateLoadedTaskBar(floating_shell, "FloatingTaskBar", True, "Task_", NULL, 4, NULL); } dash_board = XtVaCreateManagedWidget("DashBoard", xfeDashBoardWidgetClass, form, NULL); XtAddCallback(dash_board,XmNdockCallback,XfeDockCallback,NULL); XtAddCallback(dash_board,XmNundockCallback,XfeUndockCallback,NULL); XtVaSetValues(dash_board, XmNfloatingShell, floating_shell, NULL); /* Create the progress bar */ XtVaCreateManagedWidget("ProgressBar", xfeProgressBarWidgetClass, dash_board, XmNusePreferredHeight, True, XmNusePreferredWidth, True, XmNshadowThickness, 1, XmNshadowType, XmSHADOW_IN, XmNhighlightThickness, 0, XmNtraversalOn, False, NULL); /* Create the status bar */ XtVaCreateWidget("StatusBar", xfeLabelWidgetClass, dash_board, XmNusePreferredHeight, False, XmNusePreferredWidth, True, XmNshadowThickness, 2, XmNshadowType, XmSHADOW_IN, XmNhighlightThickness, 0, XmNtraversalOn, False, NULL); /* Create the task bar */ docked_task_bar = XfeCreateLoadedTaskBar(dash_board, "DockedTaskBar", False, "T", NULL, 4, NULL); XtVaSetValues(docked_task_bar, XmNorientation, XmHORIZONTAL, XmNusePreferredWidth, True, XmNusePreferredHeight, True, XmNhighlightThickness, 0, XmNshadowThickness, 0, XmNtraversalOn, False, NULL); return frame; }