/* ** Filter the current selection through shell command "command". The selection ** is removed, and replaced by the output from the command execution. Failed ** command status and output to stderr are presented in dialog form. */ void FilterSelection(WindowInfo *window, const char *command, int fromMacro) { int left, right, textLen; char *text; /* Can't do two shell commands at once in the same window */ if (window->shellCmdData != NULL) { XBell(TheDisplay, 0); return; } /* Get the selection and the range in character positions that it occupies. Beep and return if no selection */ text = BufGetSelectionText(window->buffer); if (*text == '\0') { XtFree(text); XBell(TheDisplay, 0); return; } textLen = strlen(text); BufUnsubstituteNullChars(text, window->buffer); left = window->buffer->primary.start; right = window->buffer->primary.end; /* Issue the command and collect its output */ issueCommand(window, command, text, textLen, ACCUMULATE | ERROR_DIALOGS | REPLACE_SELECTION, window->lastFocus, left, right, fromMacro); }
static int getkey( /* get input key */ register XKeyPressedEvent *ekey ) { int n; char buf[8]; n = XLookupString(ekey, buf, sizeof(buf), NULL, NULL); if (n != 1) return(1); switch (buf[0]) { case 'h': /* turn on height motion lock */ headlocked = 1; break; case 'H': /* turn off height motion lock */ headlocked = 0; break; case 'l': /* retrieve last (premouse) view */ if (lastview.type) { VIEW vtmp; vtmp = thisview; dev_view(&lastview); lastview = vtmp; } else XBell(ourdisplay, 0); break; case 'n': /* move to next standard view */ gotoview(currentview+1); break; case 'p': /* move to last standard view */ gotoview(currentview-1); break; case '+': /* zoom in */ zoomview(100+ZOOMPCT, ekey->x, vres-1-ekey->y); break; case '-': /* zoom out */ zoomview(100-ZOOMPCT, ekey->x, vres-1-ekey->y); break; case 'v': /* spit current view to stdout */ fputs(VIEWSTR, stdout); fprintview(&thisview, stdout); fputc('\n', stdout); break; case 'V': /* append view to rad file */ appendview(NULL, &thisview); break; case 'q': /* quit the program */ return(0); default: XBell(ourdisplay, 0); break; } return(1); }
void beep(void) { #if 0 XKeyboardControl kb_state; XGetKeyboardControl(dpy, &kb_state); XBell(dpy, kb_state->bell_percent); #endif if (noscreen) (void)putc(BEL, stderr); else XBell(dpy, 0); }
//---------------------------------------------------- void reloadXimConfig() { if (ChildPid > 0) { kill(ChildPid, SIGUSR1); XBell(display, 0); } }
static void do_kill(Widget w, pid_t pid, signal_t signal_value) { if (base.debugging & DBG_MENU) printf("kill %ld %d\n", (long int) pid, signal_value); #ifdef RUN_SUID_ROOT seteuid(real_uid); #endif if (kill(pid, signal_value) == -1) { /* beep if we can't deliver signal to process */ XBell(XtDisplay(w),0); { #ifdef HAVE_STRERROR char buf[300]; sprintf(buf, "kill signal error:\n%s", strerror(errno)); ShowDialog(w, XmDIALOG_ERROR, buf); #else ShowDialog(w, XmDIALOG_ERROR, "kill signal error."); #endif /*HAVE_STRERROR*/ } } #ifdef RUN_SUID_ROOT seteuid(0); #endif }
void KBellConfig::ringBell() { if (!m_useBell->isChecked()) { KNotifyClient::beep(); return; } // store the old state XKeyboardState old_state; XGetKeyboardControl(kapp->getDisplay(), &old_state); // switch to the test state XKeyboardControl kbd; kbd.bell_percent = m_volume->value(); kbd.bell_pitch = m_pitch->value(); if (m_volume->value() > 0) kbd.bell_duration = m_duration->value(); else kbd.bell_duration = 0; XChangeKeyboardControl(kapp->getDisplay(), KBBellPercent | KBBellPitch | KBBellDuration, &kbd); // ring bell XBell(kapp->getDisplay(),0); // restore old state kbd.bell_percent = old_state.bell_percent; kbd.bell_pitch = old_state.bell_pitch; kbd.bell_duration = old_state.bell_duration; XChangeKeyboardControl(kapp->getDisplay(), KBBellPercent | KBBellPitch | KBBellDuration, &kbd); }
/****************************************************** alBeep ******************************************************/ void alBeep(Display *displayBB) { int percent; percent = 100; if (audioSetup.port==AUDIO_INTERNAL_SPEAKER){ XBell(displayBB,percent); /*MessageBeep(-1);*/ } else { if (alAudioBeep()){ XBell(displayBB,percent); /*MessageBeep(-1);*/ } } }
/* Procedure associated with the ok button. */ void ok_sigmabutton_callback(Widget w, XtPointer client_data, XmSelectionBoxCallbackStruct *call_data){ float sigma; char *value; /* Get sigma value from user's selection */ XmStringGetLtoR(call_data->value, XmSTRING_DEFAULT_CHARSET, &value); sigma = atof(value); if ( atoi(value) < 0.5 || atoi(value) > 20 ) XBell(XtDisplay(w),100); else switch (filter) { case f1: gaussian_filter(sigma); break; case f2: dgaussian_filter(sigma); break; case f3: d2gaussian_filter(sigma); break; case f4: dgaux_gauy_filter(sigma); break; case f5: dgauy_gaux_filter(sigma); break; case f6: total_gradient_filter(sigma); break; case f7: gradient_x_y_filter(sigma); break; default: break; } action=SELECT; refresh_action(); }
/* ARGSUSED */ static int BeepCmd( ClientData clientData, /* Main window associated with interpreter.*/ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { int percent; if (objc > 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_GetString(objv[0]), " ?volumePercent?\"", (char *)NULL); return TCL_ERROR; } percent = 50; /* Default setting */ if (objc == 2) { if (Tcl_GetIntFromObj(interp, objv[1], &percent) != TCL_OK) { return TCL_ERROR; } if (percent < -100) { percent = -100; } else if (percent > 100) { percent = 100; } } XBell(Tk_Display(Tk_MainWindow(interp)), percent); return TCL_OK; }
/** * exec() ourself to restart. */ void DoRestart(Time t) { // Don't try to do any further animating StopAnimation(); XSync(dpy, 0); // Replace all the windows/colormaps as if we were going away. 'cuz // we are. RestoreForShutdown(t); XSync(dpy, 0); // Shut down session management connection cleanly. if(smcConn) { SmcCloseConnection(smcConn, 0, NULL); } // Re-run ourself fprintf(stderr, "%s: restarting: %s\n", ProgramName, *Argv); execvp(*Argv, Argv); // Uh oh, we shouldn't get here... fprintf(stderr, "%s: unable to restart: %s\n", ProgramName, *Argv); // We should probably un-RestoreForShutdown() etc. If that exec // fails, we're in a really weird state... XBell(dpy, 0); }
void SelectNumberedLine(WindowInfo *window, int lineNum) { int i, lineStart = 0, lineEnd; /* count lines to find the start and end positions for the selection */ if (lineNum < 1) lineNum = 1; lineEnd = -1; for (i=1; i<=lineNum && lineEnd<window->buffer->length; i++) { lineStart = lineEnd + 1; lineEnd = BufEndOfLine(window->buffer, lineStart); } /* highlight the line */ if (i>lineNum) { /* Line was found */ if (lineEnd < window->buffer->length) { BufSelect(window->buffer, lineStart, lineEnd+1); } else { /* Don't select past the end of the buffer ! */ BufSelect(window->buffer, lineStart, window->buffer->length); } } else { /* Line was not found -> position the selection & cursor at the end without making a real selection and beep */ lineStart = window->buffer->length; BufSelect(window->buffer, lineStart, lineStart); XBell(TheDisplay, 0); } MakeSelectionVisible(window, window->lastFocus); TextSetCursorPos(window->lastFocus, lineStart); }
/****************************************************** alBeep ******************************************************/ int alBeep(Display *displayBB) { pthread_once(&beep_setup, &setup); if(!psetup.beepCmd) { XBell(displayBB,0); return 0; } else { LOCK(); /* wakeup for new command. * also if still waiting for wakeup * if beeper didn't start fast enough * on the previous call. */ if(beeping==0 || beeping==2) { beeping=2; pthread_cond_broadcast(&beep_wake); } UNLOCK(); return 0; } }
void add_plane(void) { int i; for (i = 0; i < MAX_PLANES; i++) if (planes[i].speed == 0) { #define SET_COLOR(r,g,b) \ planes[i].red=r; planes[i].green=g; planes[i].blue=b; break; switch (random() % 6) { case 0: SET_COLOR(1.0, 0.0, 0.0); /* red */ case 1: SET_COLOR(1.0, 1.0, 1.0); /* white */ case 2: SET_COLOR(0.0, 1.0, 0.0); /* green */ case 3: SET_COLOR(1.0, 0.0, 1.0); /* magenta */ case 4: SET_COLOR(1.0, 1.0, 0.0); /* yellow */ case 5: SET_COLOR(0.0, 1.0, 1.0); /* cyan */ } planes[i].speed = (random() % 20) * 0.001 + 0.02; if (random() & 0x1) planes[i].speed *= -1; planes[i].theta = ((float) (random() % 257)) * 0.1111; tick_per_plane(i); if (!moving) draw(glxarea); return; } XBell(dpy, 100); /* can't add any more planes */ }
/* * Make a simple beep */ static errr Metadpy_do_beep(void) { /* Make a simple beep */ XBell(Metadpy->dpy, 100); return (0); }
void ring_bell (void) { #ifdef VISUAL_BELL GC lgc; XGCValues gcv; XWindowAttributes attr; rp_screen *s = current_screen (); XGetWindowAttributes (dpy, s->input_window, &attr); gcv.function = GXxor; gcv.foreground = s->fg_color ^ s->bg_color; lgc = XCreateGC (dpy, s->input_window, GCFunction | GCForeground, &gcv); XFillRectangle (dpy, s->input_window, lgc, 0, 0, attr.width, attr.height); XFlush (dpy); usleep (15000); XFillRectangle (dpy, s->input_window, lgc, 0, 0, attr.width, attr.height); XFlush (dpy); XFreeGC (dpy, lgc); #else XBell (dpy, 0); #endif }
static void NewCurrentClipContents(char *data, int len) { XawTextBlock textBlock; SaveClip (text, currentClip); /* append new clips at the end */ while (currentClip && currentClip->next) currentClip = currentClip->next; /* any trailing clips with no text get overwritten */ if (strlen (currentClip->clip) != 0) currentClip = NewClip (text, currentClip); textBlock.ptr = data; textBlock.firstPos = 0; textBlock.length = len; textBlock.format = FMT8BIT; if (XawTextReplace(text, 0, TextLength (text), &textBlock)) { #ifdef XKB XkbStdBell(XtDisplay(text), XtWindow(text), 0, XkbBI_Info); #else XBell( XtDisplay(text), 0); #endif } set_button_state (); }
void handleKeyEvent(Display * dpy, MouseEvent *pEvent) { unsigned int keycode = pEvent->value & 0xff; int keysym; switch (keycode) { case kKeycodeLeft: keysym = XK_Left; break; case kKeycodeRight: keysym = XK_Right; break; case kKeycodeDown: keysym = XK_Down; break; case kKeycodeUp: keysym = XK_Up; break; case kKeycodeBackSpace: keysym = XK_BackSpace; break; case kKeycodeReturn: keysym = XK_Return; break; default: XBell(dpy, 100); return; break; } KeyCode x11Keycode = XKeysymToKeycode(dpy, keysym); if (x11Keycode != 0) { XTestFakeKeyEvent(dpy, x11Keycode, pEvent->type == EVENT_KEY_DOWN, 0); } }
/************************************************************************** ... **************************************************************************/ void enable_turn_done_button(void) { XtSetSensitive(turn_done_button, TRUE); if(sound_bell_at_new_turn) XBell(display, 100); }
/* * Function: * _XawTextInsertFile * * Parameters: * w - text widget * event - X Event (used to get x and y location) * params - parameter list * num_params - "" * * Description: * Action routine that can be bound to the text widget * it will popup the insert file dialog box. * * Note: * The parameter list may contain one entry * * Entry: * This entry is optional and contains the value of the default * file to insert */ void _XawTextInsertFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { TextWidget ctx = (TextWidget)w; char *ptr; XawTextEditType edit_mode; Arg args[1]; XtSetArg(args[0], XtNeditType, &edit_mode); XtGetValues(ctx->text.source, args, 1); if (edit_mode != XawtextEdit) { XBell(XtDisplay(w), 0); return; } if (*num_params == 0) ptr = ""; else ptr = params[0]; if (!ctx->text.file_insert) { ctx->text.file_insert = CreateDialog(w, ptr, "insertFile", AddInsertFileChildren); XtRealizeWidget(ctx->text.file_insert); SetWMProtocolTranslations(ctx->text.file_insert); } CenterWidgetOnPoint(ctx->text.file_insert, event); XtPopup(ctx->text.file_insert, XtGrabNone); }
/* ARGSUSED */ static void ActionMove(Widget gw, XEvent *event, String *params, Cardinal *num_params) { XmPannerWidget pw = (XmPannerWidget) gw; int x, y; if (!XmPanner_tmp(pw).doing) return; if (!GetEventXY (pw, event, &x, &y)) { XBell (XtDisplay(gw), 0); /* should do error message */ return; } if (XmPanner_rubber_band(pw)) UNDRAW_TMP (pw); XmPanner_tmp(pw).x = ((Position) x) - XmPanner_tmp(pw).dx; XmPanner_tmp(pw).y = ((Position) y) - XmPanner_tmp(pw).dy; if (!XmPanner_rubber_band(pw)) { ActionNotify (gw, event, params, num_params); /* does a check */ } else { CheckKnob (pw, FALSE); DRAW_TMP (pw); } }
LispObj * Lisp_XBell(LispBuiltin *builtin) /* x-bell &optional percent */ { Display *display; int percent; LispObj *odisplay, *opercent; opercent = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (opercent == UNSPEC) percent = 0; else { CHECK_FIXNUM(opercent); percent = FIXNUM_VALUE(opercent); } if (percent < -100 || percent > 100) LispDestroy("%s: percent value %d out of range -100 to 100", STRFUN(builtin), percent); XBell(display, percent); return (odisplay); }
void Feep(int type, int volume, Window win) { #ifdef XKB XkbStdBell(theDisplay, win, volume, type); #else XBell(theDisplay, volume); #endif }
extern void bell_ringer(XtPointer client_data, XtIntervalId *interval_id) { Calendar *c = (Calendar *)client_data; XBell(c->xcontext->display, 50); c->view->rings -= 1; if (c->view->rings != 0) XtAppAddTimeOut(c->xcontext->app, 250, bell_ringer, c); }
void start_merge(Widget w, XtPointer client_data, XmSelectionBoxCallbackStruct *call_data) { short i,j,condition; char *cond; /* Get threshold value from user's selection */ XmStringGetLtoR(call_data->value, XmSTRING_DEFAULT_CHARSET, &cond); condition = atoi(cond); if (!(condition>=0 && condition<=512) ) { XBell(XtDisplay(w),100); return; } /* Clear the drawing window so the image is displayed again */ XClearArea(XtDisplay(draw_1),XtWindow(draw_2),0,0,0,0,True); /* Associate the watch cursor with the main window */ XDefineCursor(XtDisplay(draw_1), XtWindow(main_window), theCursor); /* Flush the request buffer and wait for all events */ /* and errors to be processed by the server. */ XSync(XtDisplay(draw_1), False); /* Free the memory used for giving room to the structure */ /* that represents the merged regions if any */ if (merged_region_list!=NULL) free_merge(&merged_region_list); num_reg_after=0; /* Compute merge procedure */ merged_region_list = merge(root,condition); fprintf (stderr,"\n ------------- MERGE ------------\n"); fprintf (stderr," Standard deviation %i\n", condition); fprintf (stderr," Number of regions %i\n", num_reg_after); /* Fill in the image with background color */ for(i=0; i<IMAGE_WIDTH; i++) for(j=0; j<IMAGE_HEIGHT; j++) XPutPixel(theXImage_2,i,j,XGetPixel(theXImage_1,i,j)); display_contour(merged_region_list); /* Clear the drawing window so the image is displayed again */ XClearArea(XtDisplay(draw_1),XtWindow(draw_1),0,0,0,0,True); /* Disassociate the watch cursor from the main window */ XUndefineCursor(XtDisplay(draw_1), XtWindow(main_window)); /* Copy image into pixmap */ XPutImage(XtDisplay(draw_2), thePixmap_2, image_gc_2, theXImage_2, 0, 0, 0, 0, theXImage_2->width, theXImage_2->height); /* Clear the drawing window so the image is displayed again */ XClearArea(XtDisplay(draw_1),XtWindow(draw_2),0,0,0,0,True); }
void erasePassphrase(AppInfo *app) { if (0 >= app->bufIndex) { XBell(app->dpy, 0); return; } updateIndicators(app, 0); app->bufIndex = 0; }
void backspacePassphrase(AppInfo *app) { if (0 >= app->bufIndex) { XBell(app->dpy, 0); return; } (app->bufIndex)--; updateIndicators(app, -1); }
NS_METHOD nsSound::Beep() { #ifdef DEBUG_faulkner fprintf(stderr, "\n////////// nsSound::Beep() in xlib called //////////\n"); #endif /* DEBUG_faulkner */ XBell(nsAppShell::mDisplay, 80); return NS_OK; }
bool WPintr() /* wp:s interrupt-rutin. Anropas med j�mna mellanrum * av alla rutiner som kan ta l�ng tid p� sig. Sk�ter * uppdatering av v�nta-meddelandet om v�nta �r p� samt * pollar event-k�n efter <CTRL>c. * * In: Inget. * * Ut: Inget. * * FV: TRUE = V3 skall avbrytas. * FALSE = Forts�tt exekveringen. * * (C)microform ab 17/1/95 J. Kjellander * * 1998-02-26 event, J.Kjellander * *******************************************************!*/ { XEvent event; XKeyEvent *keyev = (XKeyEvent *) &event; char tknbuf[11]; KeySym keysym; XComposeStatus costat; /* ***Om n_larm > 0 �r v�nta-hanteringen p�slagen och det har ***g�tt tillr�ckligt med tid sen vi sist uppdaterade v�nta- ***meddelandet. Allts� uppdaterar vi igen. Om n_larm == 0 ***har det antingen inte g�tt tillr�ckligt l�ng tid eller ***ocks� �r inte v�nta-hanteringen p�slagen �verhuvudtaget. */ if ( n_larm > 0 ) { drwait(TRUE); --n_larm; /* ***Samtidigt som vi uppdaterar v�nta-meddelandet passar vi ***p� att polla eventk�n efter <CTRL>c. */ while ( XCheckMaskEvent(xdisp,KeyPressMask,&event) ) { if ( keyev->state & ControlMask && XLookupString(keyev,tknbuf,10,&keysym,&costat) == 1 && tknbuf[0] == *smbind[11].str ) { XBell(xdisp,100); XFlush(xdisp); return(TRUE); } } } return(FALSE); }
static void quit (Widget w, XEvent *event, String *params, Cardinal *num_params) { if (event->type == ClientMessage && event->xclient.data.l[0] != wm_delete_window) { XBell (XtDisplay(w), 0); return; } XCloseDisplay (XtDisplay(w)); exit (0); }
Imlib_Image scrot_grab_shot(void) { Imlib_Image im; XBell(disp, 0); im = gib_imlib_create_image_from_drawable(root, 0, 0, 0, scr->width, scr->height, 1); return im; }