// Wait until W is mapped void wait_until_mapped(Widget w, Widget shell) { XSync(XtDisplay(w), False); XmUpdateDisplay(w); if (shell == 0) shell = find_shell(w); if (XtIsRealized(w) && XtIsRealized(shell)) { XWindowAttributes attr; while (XGetWindowAttributes(XtDisplay(w), XtWindow(w), &attr) && attr.map_state != IsViewable) { if (XGetWindowAttributes(XtDisplay(shell), XtWindow(shell), &attr) && attr.map_state != IsViewable) break; // Shell is withdrawn or iconic // Wait for exposure event XEvent event; XtAppNextEvent(XtWidgetToApplicationContext(w), &event); XtDispatchEvent(&event); } } XSync(XtDisplay(w), False); XmUpdateDisplay(w); }
/*----------------------------------------------------------------------*/ static void ListManage(Widget w) { XfeComboBoxPart * cp = _XfeComboBoxPart(w); assert( _XfeIsAlive(cp->shell) ); assert( _XfeIsAlive(cp->list) ); printf("ListManage(%s)\n",XtName(w)); /* cp->remain_popped_up = True; */ /* popped up */ cp->popped_up = True; /* Manage the scrolled window */ XtManageChild(_XfeParent(cp->list)); ShellPopup(w); #if 0 XmUpdateDisplay(w); XFlush(XtDisplay(w)); #endif /* _XmPopupSpringLoaded(w); */ }
// Same, but use an MString. void set_status_mstring(const MString& message, bool temporary) { if (status_w == 0) return; if (!temporary) add_to_status_history(message); if (!status_locked) { current_status_text = message; XtVaSetValues(status_w, XmNlabelString, message.xmstring(), XtPointer(0)); XFlush(XtDisplay(status_w)); XmUpdateDisplay(status_w); } if (log_status && !temporary) { // Log status message string s = message.str(); if (!s.empty() && s != " ") { dddlog << "# " << s << "\n"; dddlog.flush(); } } }
bool GUI_UpdateProgress(struct CTransform *ctransform,int startval,int nowval,int endval){ #if 0 struct timeval tv; // XEvent event; gettimeofday(&tv,NULL); /* Update ~50 times a second. */ if(abs(tv.tv_usec-ctransform->lasttime)>20000){ /* if(XtAppPeekEvent(app_context, &event)){ printf("event->display: %x %x %x\n",event.xany.window,a->core.window,b->core.window); } */ while (XtAppPending(app_context)) { XtAppProcessEvent(app_context,XtIMXEvent|XtIMTimer|XtIMAlternateInput); } ctransform->lasttime=tv.tv_usec; } #endif #if 1 int pr=100*(nowval-startval)/(endval-startval); if(pr!=ctransform->lastprogress && getpid()==mainpid){ XtVaSetValues(progressScale, XmNvalue, pr, NULL); XmUpdateDisplay(topLevel); ctransform->lastprogress=pr; } #endif return true; }
extern void XltWaitTillMapped(Widget dialog) { XWindowAttributes window_attributes; Boolean mapped = False; Widget w = dialog; while (!XtIsShell(w)) w = XtParent(w); XGetWindowAttributes(XtDisplay(w), XtWindow(w), &window_attributes); if (window_attributes.map_state == IsUnmapped) { XtAddEventHandler(w, StructureNotifyMask, False, (XtEventHandler)StructureNotifyHandler, (XtPointer)&mapped); while (/*XtIsManaged(w) &&*/ !mapped) { XtAppProcessEvent(XtWidgetToApplicationContext(w), XtIMXEvent); } XtRemoveEventHandler(w, StructureNotifyMask, False, (XtEventHandler)StructureNotifyHandler, (XtPointer)&mapped); } XmUpdateDisplay(w); }
static void UpdateGraph(WorkingData_t *Data) { Dimension width, height; Widget title = XtNameToWidget(XtParent(Data->Da), "*Title"); XmString string; char buf[1024]; XtVaGetValues(Data->Da, XmNwidth, &width, XmNheight, &height, NULL); sprintf(buf, "%i%%", Data->percent); string = XmStringCreateSimple(buf); XtVaSetValues(title, XmNlabelString, string, NULL); XmStringFree(string); XFillRectangle(XtDisplay(Data->Da), XtWindow(Data->Da), Data->gc, 0, 0, (width * Data->percent) / 100, height); XmUpdateDisplay(Data->Da); Data->Id = XtAppAddTimeOut(XtWidgetToApplicationContext(Data->Da), 1000, (XtTimerCallbackProc)UpdateGraph, Data); }
static void RefreshAppearance () { static char *operation_text = NULL; XmString label; Window window; window = XtWindow (Progress_widget); XSetForeground (display, Progress_gc, hci_get_read_color (WHITE)); XSetBackground (display, Progress_gc, hci_get_read_color (WHITE)); XFillRectangle (display, window, Progress_gc, 0, 0, PROGRESS_BAR_WIDTH, PROGRESS_BAR_HEIGHT); XSetForeground (display, Progress_gc, hci_get_read_color (BLACK)); XFillRectangle (display, window, Progress_gc, 0, 0, Bar_width, PROGRESS_BAR_HEIGHT); operation_text = STR_copy (operation_text, "Operation:\t"); operation_text = STR_cat (operation_text, Operation); label = XmStringCreateLocalized (operation_text); XtVaSetValues (Operation_label, XmNlabelString, label, NULL); XmStringFree (label); label = XmStringCreateLocalized (Transfer_op_label_str); XtVaSetValues (Transfer_op_label, XmNlabelString, label, NULL); XmStringFree (label); label = XmStringCreateLocalized (Transfer_rate_label_str); XtVaSetValues (Transfer_rate_label, XmNlabelString, label, NULL); XmStringFree (label); if( Visible ){ XmUpdateDisplay( Main_widget ); } }
void XFE_FrameListMenu::item_activate(Widget item) { XP_ASSERT( XfeIsAlive(m_submenu) ); int i = XfeChildGetIndex(item) - m_firstslot; XP_ASSERT( i > 0 ); if (i <= 0) { return; } XP_List * frame_list = getShownFrames(); XFE_Frame * frame = (XFE_Frame *) XP_ListGetObjectNum(frame_list,i); XP_ASSERT( frame != NULL ); if (frame) { frame->show(); } XmUpdateDisplay(frame->getBaseWidget()); if (frame_list) { XP_ListDestroy(frame_list); } }
static void XbrCursorChange(Widget w, CURSOR *start_cursor, int type) { Display *display = XtDisplay(w); CURSOR *cptr; int found = 0; /* Create the cursors */ XbrCursorsCreate(w); /* Change the cursor for each shell */ for(cptr = start_cursor; cptr != NULL; cptr = cptr->prev) { XUndefineCursor(display, XtWindow(cptr->w)); if(type == XbrCURSOR_RESET) { if(found) XDefineCursor(display, XtWindow(cptr->w), grab_cursor); else if(cptr->grab_focus) found = 1; } else if(type == XbrCURSOR_GRAB) XDefineCursor(display, XtWindow(cptr->w), grab_cursor); else if(type == XbrCURSOR_WATCH) XDefineCursor(display, XtWindow(cptr->w), watch_cursor); } XmUpdateDisplay(w); }
void Resize(void) { Arg args[10]; Cardinal argcount; Widget Label; if( HelpBoard ) { XtDestroyWidget( HelpBoard ); XmUpdateDisplay( mainbull ); printf( "Resize! Helpboard destroyed!\n" ); } argcount = 0; XtSetArg( args[argcount], XmNresizePolicy, XmRESIZE_ANY ); argcount++; XtSetArg( args[argcount], XmNunitType, XmPIXELS ); argcount++; HelpBoard = XmCreateBulletinBoard( mainbull, "Board2", args, argcount ); XtRealizeWidget( HelpBoard ); XtManageChild( HelpBoard ); printf( "Resize! XtWidth: %d\n", XtWidth( pgHelpMainWindow ) ); argcount = 0; XtSetArg( args[argcount], XmNx, XtWidth( pgHelpMainWindow ) -50 ); argcount++; XtSetArg( args[argcount], XmNy, 50 ); argcount++; Label = XmCreateLabel( mainbull, "xxx", args, argcount ); XtManageChild( Label ); }
void PrefAgent::dialog_mapped (Widget w, XtPointer client_data, XEvent *, Boolean *) { XmUpdateDisplay (w); *((int *) client_data) = TRUE; }
void TrashHelpRequestCB( Widget w, XtPointer clientData, XtPointer callData ) { Arg args[5]; char *vol; char *locId; /* Refresh the display */ XmUpdateDisplay(w); /* printf ("topic = %s\n", clientData); */ /* Check for item help */ if (strcmp(clientData, HELP_HELP_MODE_STR) == 0) { if( ! ProcessItemHelp(trashShell) ) { char *tmpStr, *title, *msg; tmpStr = GetSharedMessage(ITEM_HELP_ERROR_TITLE); title = XtNewString(tmpStr); tmpStr = GetSharedMessage( ITEM_HELP_ERROR ), msg = XtNewString(tmpStr); _DtMessage(trashShell, title, msg, NULL, HelpRequestCB); XtFree(title); XtFree(msg); } return; } /* Special check for 'Using Help'; required different volume */ locId = (char *)clientData; if ((w == *usingHelpTrash) && (strcmp(locId, HELP_HOME_TOPIC) == 0)) vol = "Help4Help"; else vol = DTFILE_HELP_NAME; if (primaryTrashHelpDialog) { ReusePrimaryHelpWindow(primaryTrashHelpDialog, clientData, vol, NULL, NULL, DtHELP_TYPE_TOPIC); } else { /* Create the main help window for this view */ ShowTrashHelpDialog(trashShell, MAIN_HELP_DIALOG, NULL, clientData, vol); } }
static void gui_button_cb_play (Manual me, GuiButtonEvent /* event */) { GuiThing_setSensitive (my recordButton, false); GuiThing_setSensitive (my playButton, false); GuiThing_setSensitive (my publishButton, false); #if motif XmUpdateDisplay (my d_windowForm -> d_xmShell); #endif Melder_play (); GuiThing_setSensitive (my recordButton, true); GuiThing_setSensitive (my playButton, true); GuiThing_setSensitive (my publishButton, true); }
/* force a statusline update, no matter how busy the application is. Use this with care (only for important messages). */ void force_statusline_update(void) { #ifdef MOTIF XmUpdateDisplay(globals.widgets.top_level); #else XEvent event; XSync(DISP, False); while (XCheckMaskEvent(DISP, ExposureMask, &event)) XtDispatchEvent(&event); #endif /* MOTIF */ }
// // Print a string in the status line of the find dialog. // void FindDialog::setStatus(const char * str) { char *tmpstr = strdup(str); XmString label = XmStringCreateLocalized(tmpstr); XtVaSetValues(_status_text, XmNlabelString, label, NULL); XmUpdateDisplay(baseWidget()); XmStringFree(label); }
static void gui_button_cb_record (Manual me, GuiButtonEvent /* event */) { ManPages manPages = (ManPages) my data; ManPage manPage = ( my path < 1 ? nullptr : manPages -> pages.at [my path] ); GuiThing_setSensitive (my recordButton, false); GuiThing_setSensitive (my playButton, false); GuiThing_setSensitive (my publishButton, false); #if motif XmUpdateDisplay (my d_windowForm -> d_xmShell); #endif if (! Melder_record (manPage == nullptr ? 1.0 : manPage -> recordingTime)) Melder_flushError (); GuiThing_setSensitive (my recordButton, true); GuiThing_setSensitive (my playButton, true); GuiThing_setSensitive (my publishButton, true); }
static void gui_button_cb_play (I, GuiButtonEvent event) { (void) event; iam (Manual); GuiObject_setSensitive (my recordButton, false); GuiObject_setSensitive (my playButton, false); GuiObject_setSensitive (my publishButton, false); #if motif XmUpdateDisplay (my d_windowShell); #endif Melder_play (); GuiObject_setSensitive (my recordButton, true); GuiObject_setSensitive (my playButton, true); GuiObject_setSensitive (my publishButton, true); }
/* force a statusline update, no matter how busy the application is. Use this with care (only for important messages). */ void force_statusline_update(void) { #ifdef STATUSLINE #ifdef MOTIF XmUpdateDisplay(top_level); #else XEvent event; XSync(DISP, 0); while (XCheckMaskEvent(DISP, ExposureMask, &event)) XtDispatchEvent(&event); #endif #endif }
void GUI_GeneralPreview(Widget w,XtPointer client, XtPointer call) { struct CTransform *ctransform=(struct CTransform *)client; struct FFTSound *copy; int length; PlayStopHard(); if( ! DA_initialized(ctransform->fftsound)){ fprintf(stderr,"No Sound loaded\n"); return; } XmUpdateDisplay(w); SetWatchCursor(topLevel); if(ctransform->doprogress==true){ XtVaSetValues(progressScale, XmNvalue, 0, NULL); XtManageChild(progressDialog); } while (XtAppPending(app_context)) { XtAppProcessEvent(app_context,XtIMXEvent|XtIMTimer|XtIMAlternateInput); } length=min(areat2-areat1,CONFIG_getMaxPreviewLength(ctransform->fftsound)); copy=makeFFTSoundCopy(ctransform->fftsound,areat1,areat1+length); copyFFTSound(ctransform->fftsound,copy,areat1); // copy=ctransform->fftsound; (*ctransform->Transform)(ctransform,ctransform->pointer,copy,0,length,areat1); Play(copy,0,length); /* if(pthread_create(&pthread,NULL,DoPlay,copy)!=0){ fprintf(stderr,"Could not make pthread\n"); } */ // RedrawWin(ctransform->fftsound); if(ctransform->doprogress==true) XtUnmanageChild(progressDialog); ResetCursor(topLevel); }
/*-------------------------------------------------------------------------*/ void qmonPopupCkptConfig(Widget w, XtPointer cld, XtPointer cad) { Widget shell; lList *alp = NULL; DENTER(GUI_LAYER, "qmonPopupCkptConfig"); /* set busy cursor */ XmtDisplayBusyCursor(w); if (!qmon_ckpt) { shell = XmtGetTopLevelShell(w); qmon_ckpt = qmonCreateCkptConfig(shell); XmtAddDeleteCallback(shell, XmDO_NOTHING, qmonPopdownCkptConfig, NULL); /* ** create ask layout */ ckpt_ask_layout = qmonCreateCkptAsk(qmon_ckpt); } XSync(XtDisplay(qmon_ckpt), 0); XmUpdateDisplay(qmon_ckpt); qmonMirrorMultiAnswer(CKPT_T, &alp); if (alp) { qmonMessageBox(w, alp, 0); lFreeList(&alp); /* set default cursor */ XmtDisplayDefaultCursor(w); DEXIT; return; } qmonTimerAddUpdateProc(CKPT_T, "updateCkptList", updateCkptList); qmonStartTimer(CKPT_T); updateCkptList(); XmListSelectPos(ckpt_names, 1, True); XtManageChild(qmon_ckpt); XRaiseWindow(XtDisplay(XtParent(qmon_ckpt)), XtWindow(XtParent(qmon_ckpt))); /* set default cursor */ XmtDisplayDefaultCursor(w); DEXIT; }
static void gui_button_cb_record (I, GuiButtonEvent event) { (void) event; iam (Manual); ManPages manPages = (ManPages) my data; ManPage manPage = (ManPage) (my path < 1 ? NULL : manPages -> pages -> item [my path]); GuiObject_setSensitive (my recordButton, false); GuiObject_setSensitive (my playButton, false); GuiObject_setSensitive (my publishButton, false); #if motif XmUpdateDisplay (my d_windowShell); #endif if (! Melder_record (manPage == NULL ? 1.0 : manPage -> recordingTime)) Melder_flushError (NULL); GuiObject_setSensitive (my recordButton, true); GuiObject_setSensitive (my playButton, true); GuiObject_setSensitive (my publishButton, true); }
/*-------------------------------------------------------------------------*/ void qmonPopupSchedConfig(Widget w, XtPointer cld, XtPointer cad) { Widget shell; lList *scl = NULL; lListElem *sep = NULL; lList *alp = NULL; DENTER(TOP_LAYER, "qmonPopupSchedConfig"); /* set busy cursor */ XmtDisplayBusyCursor(w); if (!qmon_sconf) { shell = XmtGetTopLevelShell(w); qmon_sconf = qmonCreateSchedConfig(shell); XmtAddDeleteCallback(shell, XmDO_NOTHING, qmonSchedCancel, NULL); } qmonMirrorMultiAnswer(SC_T, &alp); if (alp) { qmonMessageBox(w, alp, 0); lFreeList(&alp); /* set default cursor */ XmtDisplayDefaultCursor(w); DEXIT; return; } scl = qmonMirrorList(SGE_SC_LIST); sep = lFirst(scl); qmonSchedSet(sep); XSync(XtDisplay(qmon_sconf), 0); XmUpdateDisplay(qmon_sconf); XtManageChild(qmon_sconf); XRaiseWindow(XtDisplay(XtParent(qmon_sconf)), XtWindow(XtParent(qmon_sconf))); /* set default cursor */ XmtDisplayDefaultCursor(w); DEXIT; }
void IconObj::DoubleClickCB(Widget, XtPointer client_data, XtPointer) { IconObj *obj = (IconObj *) client_data; if (obj->Name()) { if (obj->Selected()) obj->Selected(false); else obj->Selected(true); XmUpdateDisplay(obj->BaseWidget()); } if (obj->Open()) obj->Open(false); else obj->Open(true); }
void iupdrvRedrawNow(Ihandle *ih) { Widget w; /* POST a Redraw */ iupdrvPostRedraw(ih); /* if this element has an inner native parent (like IupTabs), then redraw that native parent if different from the element. */ w = (Widget)iupClassObjectGetInnerNativeContainerHandle(ih, (Ihandle*)IupGetAttribute(ih, "VALUE_HANDLE")); if (w && w != ih->handle) { Widget handle = ih->handle; ih->handle = w; iupdrvPostRedraw(ih); ih->handle = handle; } /* flush exposure events. */ XmUpdateDisplay(ih->handle); }
/*----------------------------------------------------------------------*/ /* extern */ void XfeChildrenDestroy(Widget w) { Widget * children; Cardinal i; assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); /* Make sure the widget has children */ if (!_XfemNumChildren(w)) { return; } /* Allocate space for a temporary children array */ children = (Widget *) XtMalloc(sizeof(Widget) * _XfemNumChildren(w)); /* Copy the widget ids */ for (i = 0; i < _XfemNumChildren(w); i++) { children[i] = _XfemChildren(w)[i]; } /* Destroy the children */ for (i = 0; i < _XfemNumChildren(w); i++) { if (_XfeIsAlive(children[i])) { XtDestroyWidget(children[i]); } } XtFree((char *) children); /* Update an flush in case the destruction takes a long time */ XmUpdateDisplay(w); XFlush(XtDisplay(w)); }
void Dialog::post() { theApplication->setBusyCursor(TRUE); if (this->getRootWidget() == NULL) { this->initialize(); this->setRootWidget(this->createDialog(this->parent)); Widget shell = XtParent(this->getRootWidget()); XtVaSetValues(shell, XmNdeleteResponse, XmDO_NOTHING, NULL); Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False); XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (XtCallbackProc)Dialog_CancelCB, (void *)(this)); if (this->ok != NULL) XtAddCallback(this->ok, XmNactivateCallback, (XtCallbackProc)Dialog_OkCB, (XtPointer)this); if (this->help != NULL) XtAddCallback(this->help, XmNactivateCallback, (XtCallbackProc)Dialog_HelpCB, (XtPointer)this); if (this->cancel != NULL) XtAddCallback(this->cancel, XmNactivateCallback, (XtCallbackProc)Dialog_CancelCB, (XtPointer)this); } this->manage(); theApplication->setBusyCursor(FALSE); XmUpdateDisplay(this->getRootWidget()); }
static Boolean _PrintDetails(Widget W) { int i; WidgetList kids; Cardinal numkids; XmUpdateDisplay(W); PrintWidgetDetails(W, 0); if (XmIsForm(W)) { XtVaGetValues(W, XmNchildren, &kids, XmNnumChildren, &numkids, NULL); for (i=0; i<numkids; i++) { PrintWidgetDetails(kids[i], i+1); } printf("\n"); } return(True); }
void GUI_GeneralOk(Widget w,XtPointer client, XtPointer call) { struct CTransform *ctransform=(struct CTransform *)client; if( ! DA_initialized(ctransform->fftsound)){ fprintf(stderr,"No Sound loaded\n"); return; } XmUpdateDisplay(w); SetWatchCursor(topLevel); if(ctransform->doprogress==true){ XtVaSetValues(progressScale, XmNvalue, 0, NULL); XtManageChild(progressDialog); } while (XtAppPending(app_context)) { XtAppProcessEvent(app_context,XtIMXEvent|XtIMTimer|XtIMAlternateInput); } UNDO_addTransform(ctransform->fftsound); (*ctransform->Transform)(ctransform,ctransform->pointer,ctransform->fftsound,areat1,areat2,0); SetVisibleFunc(1,2); SetVisibleFunc(2,2); SetVisibleFunc(3,2); RedrawWin(ctransform->fftsound); if(ctransform->doprogress==true) XtUnmanageChild(progressDialog); ResetCursor(topLevel); XtUnmanageChild(ctransform->parentwidget); }
void ShowPreferencesDialog( Widget w, XtPointer client_data, XtPointer callback ) { FileMgrRec * file_mgr_rec; DialogData * dialog_data; FileMgrData * file_mgr_data; PreferencesRec *preferences_rec; Arg args[1]; Widget mbar; char *tmpStr, *tempStr; /* Set the menu item to insensitive to prevent multiple */ /* dialogs from being posted and get the area under the */ /* menu pane redrawn. */ if (w) { mbar = XmGetPostedFromWidget(XtParent(w)); XmUpdateDisplay (w); XtSetArg(args[0], XmNuserData, &file_mgr_rec); XtGetValues(mbar, args, 1); /* Ignore accelerators when we're insensitive */ if ((file_mgr_rec->menuStates & PREFERENCES) == 0) { XSetInputFocus(XtDisplay(w), XtWindow(file_mgr_rec->preferencesBtn_child), RevertToParent, CurrentTime); return; } } else { /* Done only during a restore session */ file_mgr_rec = (FileMgrRec *)client_data; } /* Ignore accelerators received after we're unposted */ if ((dialog_data = _DtGetInstanceData ((XtPointer)file_mgr_rec)) == NULL) return; file_mgr_data = (FileMgrData *) dialog_data->data; file_mgr_rec->menuStates &= ~ PREFERENCES; _DtShowDialog (file_mgr_rec->shell, NULL, (XtPointer)file_mgr_rec, file_mgr_data->preferences, PreferencesChange, (XtPointer)file_mgr_rec, PreferencesClose, (XtPointer)file_mgr_rec, NULL, False, False, NULL, NULL); /* set the title */ preferences_rec = (PreferencesRec *)_DtGetDialogInstance( file_mgr_data->preferences); if(file_mgr_data->title != NULL && (strcmp(file_mgr_data->helpVol, DTFILE_HELP_NAME) != 0 || strcmp(file_mgr_data->title, "Trash Can") == 0)) { tmpStr = GETMESSAGE(23, 1, "Set View Options"); tempStr = (char *)XtMalloc(strlen(tmpStr) + strlen(file_mgr_data->title) + 5); sprintf(tempStr, "%s - %s", file_mgr_data->title, tmpStr); } else { tmpStr = (GETMESSAGE(23,22, "File Manager - Set View Options")); tempStr = XtNewString(tmpStr); } XtSetArg (args[0], XmNtitle, tempStr); XtSetValues (preferences_rec->shell, args, 1); XtFree(tempStr); file_mgr_rec->preferencesBtn_child=preferences_rec->shell; }
void MotifUI::DoRefresh() { if (_w) XmUpdateDisplay(_w); }