⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 command.c

📁 rxvt经典的linux下的终端.小巧实用
💻 C
📖 第 1 页 / 共 5 页
字号:
	break;    case ButtonRelease:	rxvt_button_release(r, (XButtonEvent *)ev);	break;    case ClientMessage:	if (ev->xclient.format == 32	    && (Atom)ev->xclient.data.l[0] == h->xa[XA_WMDELETEWINDOW])	    exit(EXIT_SUCCESS);#ifdef OFFIX_DND    /* OffiX Dnd (drag 'n' drop) protocol */	if (ev->xclient.message_type == h->xa[XA_DNDPROTOCOL]	    && (ev->xclient.data.l[0] == DndFile		|| ev->xclient.data.l[0] == DndDir		|| ev->xclient.data.l[0] == DndLink)) {	/* Get Dnd data */	    Atom            ActualType;	    int             ActualFormat;	    unsigned char  *data;	    unsigned long   Size, RemainingBytes;	    XGetWindowProperty(r->Xdisplay, Xroot,			       r->h->xa[XA_DNDSELECTION],			       0L, 1000000L,			       False, AnyPropertyType,			       &ActualType, &ActualFormat,			       &Size, &RemainingBytes,			       &data);	    XChangeProperty(r->Xdisplay, Xroot,			    XA_CUT_BUFFER0, XA_STRING,			    8, PropModeReplace,			    data, STRLEN(data));	    rxvt_selection_paste(r, Xroot, XA_CUT_BUFFER0, True);	    XSetInputFocus(r->Xdisplay, Xroot, RevertToNone, CurrentTime);	}#endif				/* OFFIX_DND */	break;    case MappingNotify:	XRefreshKeyboardMapping(&(ev->xmapping));	break;    /*     * XXX: this is not the _current_ arrangement     * Here's my conclusion:     * If the window is completely unobscured, use bitblt's     * to scroll. Even then, they're only used when doing partial     * screen scrolling. When partially obscured, we have to fill     * in the GraphicsExpose parts, which means that after each refresh,     * we need to wait for the graphics expose or Noexpose events,     * which ought to make things real slow!     */    case VisibilityNotify:	switch (ev->xvisibility.state) {	case VisibilityUnobscured:	    h->refresh_type = FAST_REFRESH;	    break;	case VisibilityPartiallyObscured:	    h->refresh_type = SLOW_REFRESH;	    break;	default:	    h->refresh_type = NO_REFRESH;	    break;	}	break;    case FocusIn:	if (!r->TermWin.focus) {	    r->TermWin.focus = 1;	    h->want_refresh = 1;#ifdef USE_XIM	    if (h->Input_Context != NULL)		XSetICFocus(h->Input_Context);#endif	}	break;    case FocusOut:	if (r->TermWin.focus) {	    r->TermWin.focus = 0;	    h->want_refresh = 1;#ifdef USE_XIM	    if (h->Input_Context != NULL)		XUnsetICFocus(h->Input_Context);#endif	}	break;    case ConfigureNotify:	if (ev->xconfigure.window == r->TermWin.parent[0]) {	    int             height, width;	    do {	/* Wrap lots of configures into one */		width = ev->xconfigure.width;		height = ev->xconfigure.height;	    } while (XCheckTypedWindowEvent(r->Xdisplay, ev->xconfigure.window,					    ConfigureNotify, ev));	    if (r->szHint.width != width || r->szHint.height != height)		rxvt_resize_all_windows(r, (unsigned int)width,					(unsigned int)height, 1);#ifdef TRANSPARENT		/* XXX: maybe not needed - leave in for now */	    if (r->Options & Opt_transparent) {		rxvt_check_our_parents(r);		if (h->am_transparent)		    h->want_full_refresh = 1;	    }#endif	}	break;    case SelectionClear:	rxvt_selection_clear(r);	break;    case SelectionNotify:	if (h->selection_wait == Sel_normal)	    rxvt_selection_paste(r, ev->xselection.requestor,				 ev->xselection.property, True);	break;    case SelectionRequest:	rxvt_selection_send(r, &(ev->xselectionrequest));	break;    case UnmapNotify:	r->TermWin.mapped = 0;	break;    case MapNotify:	r->TermWin.mapped = 1;	break;    case PropertyNotify:	if (ev->xproperty.atom == h->xa[XA_VT_SELECTION]) {	    if (ev->xproperty.state == PropertyNewValue)		rxvt_selection_property(r, ev->xproperty.window,					ev->xproperty.atom);	    break;	}#ifdef TRANSPARENT    /*     * if user used some Esetroot compatible prog to set the root bg,     * use the property to determine the pixmap.  We use it later on.     */	if (h->xa[XA_XROOTPMAPID] == 0)	    h->xa[XA_XROOTPMAPID] = XInternAtom(r->Xdisplay,					       "_XROOTPMAP_ID", False);	if (ev->xproperty.atom != h->xa[XA_XROOTPMAPID])	    break;    /* FALLTHROUGH */    case ReparentNotify:	if ((r->Options & Opt_transparent) && rxvt_check_our_parents(r)) {	    if (h->am_transparent)		h->want_full_refresh = 1;	}#endif				/* TRANSPARENT */	break;    case GraphicsExpose:    case Expose:	if (ev->xany.window == r->TermWin.vt) {#ifdef NO_SLOW_LINK_SUPPORT	    rxvt_scr_expose(r, ev->xexpose.x, ev->xexpose.y,			    ev->xexpose.width, ev->xexpose.height, False);#else	    rxvt_scr_expose(r, ev->xexpose.x, 0,			    ev->xexpose.width, r->TermWin.height, False);#endif	    h->want_refresh = 1;	} else {	    XEvent          unused_xevent;	    while (XCheckTypedWindowEvent(r->Xdisplay, ev->xany.window,					  Expose,					  &unused_xevent)) ;	    while (XCheckTypedWindowEvent(r->Xdisplay, ev->xany.window,					  GraphicsExpose,					  &unused_xevent)) ;	    if (isScrollbarWindow(ev->xany.window)) {		scrollbar_setIdle();		rxvt_scrollbar_show(r, 0);	    }	    if (menubar_visible(r) && isMenuBarWindow(ev->xany.window))		rxvt_menubar_expose(r);	    rxvt_Gr_expose(r, ev->xany.window);	}	break;    case MotionNotify:	if (isMenuBarWindow(ev->xany.window)) {	    rxvt_menubar_control(r, &(ev->xbutton));	    break;	}	if ((h->PrivateModes & PrivMode_mouse_report) && !(h->bypass_keystate))	    break;	if (ev->xany.window == r->TermWin.vt) {	    if ((ev->xbutton.state & (Button1Mask | Button3Mask))) {		while (XCheckTypedWindowEvent(r->Xdisplay, r->TermWin.vt,					      MotionNotify, ev)) ;		XQueryPointer(r->Xdisplay, r->TermWin.vt,			      &unused_root, &unused_child,			      &unused_root_x, &unused_root_y,			      &(ev->xbutton.x), &(ev->xbutton.y),			      &unused_mask);#ifdef MOUSE_THRESHOLD	    /* deal with a `jumpy' mouse */		if ((ev->xmotion.time - h->MEvent.time) > MOUSE_THRESHOLD)#endif		    rxvt_selection_extend(r, (ev->xbutton.x), (ev->xbutton.y),				  (ev->xbutton.state & Button3Mask) ? 2 : 0);	    }	} else if (isScrollbarWindow(ev->xany.window) && scrollbar_isMotion()) {	    while (XCheckTypedWindowEvent(r->Xdisplay, r->scrollBar.win,					  MotionNotify, ev)) ;	    XQueryPointer(r->Xdisplay, r->scrollBar.win,			  &unused_root, &unused_child,			  &unused_root_x, &unused_root_y,			  &(ev->xbutton.x), &(ev->xbutton.y),			  &unused_mask);	    rxvt_scr_move_to(r, scrollbar_position(ev->xbutton.y) - h->csrO,			     scrollbar_size());	    rxvt_scr_refresh(r, h->refresh_type);	    h->refresh_limit = 0;	    rxvt_scrollbar_show(r, 1);	}	break;    }}/* INTPROTO */voidrxvt_button_press(rxvt_t *r, XButtonEvent *ev){    int             reportmode = 0, clickintime;    struct rxvt_hidden *h = r->h;    h->bypass_keystate = ev->state & (h->ModMetaMask | ShiftMask);    if (!h->bypass_keystate)	reportmode = !!(h->PrivateModes & PrivMode_mouse_report);/* * VT window processing of button press */    if (ev->window == r->TermWin.vt) {	if (ev->subwindow != None)	    rxvt_Gr_ButtonPress(ev->x, ev->y);	else {	    clickintime = ev->time - h->MEvent.time < MULTICLICK_TIME;	    if (reportmode) {		/* mouse report from vt window */		/* save the xbutton state (for ButtonRelease) */		h->MEvent.state = ev->state;#ifdef MOUSE_REPORT_DOUBLECLICK		if (ev->button == h->MEvent.button && clickintime) {		    /* same button, within alloted time */		    h->MEvent.clicks++;		    if (h->MEvent.clicks > 1) {			/* only report double clicks */			h->MEvent.clicks = 2;			rxvt_mouse_report(r, ev);			/* don't report the release */			h->MEvent.clicks = 0;			h->MEvent.button = AnyButton;		    }		} else {		    /* different button, or time expired */		    h->MEvent.clicks = 1;		    h->MEvent.button = ev->button;		    rxvt_mouse_report(r, ev);		}#else		h->MEvent.button = ev->button;		rxvt_mouse_report(r, ev);#endif				/* MOUSE_REPORT_DOUBLECLICK */	    } else {		if (ev->button != h->MEvent.button)		    h->MEvent.clicks = 0;		switch (ev->button) {		case Button1:		    if (h->MEvent.button == Button1 && clickintime)			h->MEvent.clicks++;		    else			h->MEvent.clicks = 1;		    rxvt_selection_click(r, h->MEvent.clicks, ev->x, ev->y);		    h->MEvent.button = Button1;		    break;		case Button3:		    if (h->MEvent.button == Button3 && clickintime)			rxvt_selection_rotate(r, ev->x, ev->y);		    else			rxvt_selection_extend(r, ev->x, ev->y, 1);		    h->MEvent.button = Button3;		    break;		}	    }	    h->MEvent.time = ev->time;	    return;	}    }/* * Scrollbar window processing of button press */    if (isScrollbarWindow(ev->window)) {	scrollbar_setIdle();	/*	 * Rxvt-style scrollbar:	 * move up if mouse is above slider	 * move dn if mouse is below slider	 *	 * XTerm-style scrollbar:	 * Move display proportional to pointer location	 * pointer near top -> scroll one line	 * pointer near bot -> scroll full page	 */#ifndef NO_SCROLLBAR_REPORT	if (reportmode) {	    /*	     * Mouse report disabled scrollbar:	     * arrow buttons - send up/down	     * click on scrollbar - send pageup/down	     */	    if ((r->scrollBar.style == R_SB_NEXT		 && scrollbarnext_upButton(ev->y))		|| (r->scrollBar.style == R_SB_RXVT		    && scrollbarrxvt_upButton(ev->y)))		rxvt_tt_printf(r, "\033[A");	    else if ((r->scrollBar.style == R_SB_NEXT		      && scrollbarnext_dnButton(ev->y))		     || (r->scrollBar.style == R_SB_RXVT			 && scrollbarrxvt_dnButton(ev->y)))		rxvt_tt_printf(r, "\033[B");	    else		switch (ev->button) {		case Button2:		    rxvt_tt_printf(r, "\014");		    break;		case Button1:		    rxvt_tt_printf(r, "\033[6~");		    break;		case Button3:		    rxvt_tt_printf(r, "\033[5~");		    break;		}	} else#endif				/* NO_SCROLLBAR_REPORT */	{	    char            upordown = 0;	    if (r->scrollBar.style == R_SB_NEXT) {		if (scrollbarnext_upButton(ev->y))		    upordown = -1;	/* up */		else if (scrollbarnext_dnButton(ev->y))		    upordown = 1;	/* down */	    } else if (r->scrollBar.style == R_SB_RXVT) {		if (scrollbarrxvt_upButton(ev->y))		    upordown = -1;	/* up */		else if (scrollbarrxvt_dnButton(ev->y))		    upordown = 1;	/* down */	    }	    if (upordown) { #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING		h->scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY;#endif		if (rxvt_scr_page(r, upordown < 0 ? UP : DN, 1)) {		    if (upordown < 0)			scrollbar_setUp();		    else			scrollbar_setDn();		}	    } else		switch (ev->button) {		case Button2:		    switch (h->scrollbar_align) {		    case R_SB_ALIGN_TOP:			h->csrO = 0;			break;		    case R_SB_ALIGN_CENTRE:			h->csrO = (r->scrollBar.bot - r->scrollBar.top) / 2;			break;		    case R_SB_ALIGN_BOTTOM:			h->csrO = r->scrollBar.bot - r->scrollBar.top;			break;		    }		    if (r->scrollBar.style == R_SB_XTERM			|| scrollbar_above_slider(ev->y)			|| scrollbar_below_slider(ev->y))			rxvt_scr_move_to(r,					 scrollbar_position(ev->y) - h->csrO,					 scrollbar_size());		    scrollbar_setMotion();		    break;		case Button1:		    if (h->scrollbar_align == R_SB_ALIGN_CENTRE)			h->csrO = ev->y - r->scrollBar.top;		    /* FALLTHROUGH */		case Button3:		    if (r->scrollBar.style != R_SB_XTERM) {			if (scrollbar_above_slider(ev->y))# ifdef RXVT_SCROLL_FULL			    rxvt_scr_page(r, UP, r->TermWin.nrow - 1);# else			    rxvt_scr_page(r, UP, r->TermWin.nrow / 4);# endif			else if (scrollbar_below_slider(ev->y))# ifdef RXVT_SCROLL_FULL			    rxvt_scr_page(r, DN, r->TermWin.nrow - 1);# else			    rxvt_scr_page(r, DN, r->TermWin.nrow / 4);# endif			else			    scrollbar_setMotion();		    } else {			rxvt_scr_page(r, (ev->button == Button1 ? DN : UP),				      (r->TermWin.nrow				       * scrollbar_position(ev->y)				       / scrollbar_size()));		    }		    break;		}	}	return;    }/* * Menubar window processing of button press */    if (isMenuBarWindow(ev->window))	rxvt_menubar_control(r, ev);}/* INTPROTO */voidrxvt_button_release(rxvt_t *r, XButtonEvent *ev){    int             reportmode = 0;    r->h->csrO = 0;		/* reset csr Offset */    if (!r->h->bypass_keystate)	reportmode = !!(r->h->PrivateModes & PrivMode_mouse_report);    if (scrollbar_isUpDn()) {	scrollbar_setIdle();	rxvt_scrollbar_show(r, 0);#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING	r->h->refresh_type &= ~SMOOTH_REFRESH;#endif    }    if (ev->window == r->TermWin.vt) {	if (ev->subwindow != None)	    rxvt_Gr_ButtonRelease(ev->x, ev->y);	else {	    if (reportmode) {		/* mouse report from vt window */		/* don't report release of wheel "buttons" */		if (ev->button >= 4)		    return;#ifdef MOUSE_REPORT_DOUBLECLICK		/* only report the release of 'slow' single clicks */		if (r->h->MEvent.button != AnyButton		    && (ev->button != r->h->MEvent.button			|| (ev->time - r->h->MEvent.time			    > MULTICLICK_TIME / 2))) {		    r->h->MEvent.clicks = 0;		    r->h->MEvent.button = AnyButton;		    rxvt_mouse_report(r, ev);		}#else				/* MOUSE_REPORT_DOUBLECLICK */		r->h->MEvent.button = AnyButton;		rxvt_mouse_report(r, ev);#endif				/* MOUSE_REPORT_DOUBLECLICK */		return;	    }	    /*	     * dumb hack to compensate for the failure of click-and-drag	     * when overriding mouse reporting	     */	    if (r->h->PrivateModes & PrivMode_mouse_report		&& r->h->bypass_keystate		&& ev->button == Button1 && r->h->MEvent.clicks <= 1)		rxvt_selection_extend(r, ev->x, ev->y, 0);	    switch (ev->button) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -