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

📄 fg.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 5 页
字号:
 */		    if (fgflags.curs_acc > ACC_OFF) {			if (new_rep->dx >= fgflags.curs_thr)			    new_rep->dx +=				(new_rep->dx - fgflags.curs_thr) * fgflags.curs_acc;			if (new_rep->dy >= fgflags.curs_thr)			    new_rep->dy +=				(new_rep->dy - fgflags.curs_thr) * fgflags.curs_acc;		    }/* * update mouse position */		    if( new_rep->state & X_SIGN) {			eqh->curs_pos.x += new_rep->dx;			if( eqh->curs_pos.x > MAX_CUR_X )			    eqh->curs_pos.x = MAX_CUR_X;		    }		    else {			eqh->curs_pos.x -= new_rep->dx;			if( eqh->curs_pos.x < -15 )			    eqh->curs_pos.x = -15;		    }		    fgcurstab.x = eqh->curs_pos.x;		    if( new_rep->state & Y_SIGN) {			eqh->curs_pos.y -= new_rep->dy;			if( eqh->curs_pos.y < -15 )			    eqh->curs_pos.y = -15;		    }		    else {			eqh->curs_pos.y += new_rep->dy;			if( eqh->curs_pos.y > MAX_CUR_Y )			    eqh->curs_pos.y = MAX_CUR_Y;		    }		    fgcurstab.y = eqh->curs_pos.y;		    if( tp->t_state & TS_ISOPEN ) {/* Should modify this for Firefox cursor			sgcursor = (struct color_cursor *) sgmap.cur;			sgcursor->xpos = CURS_MIN_X + eqh->curs_pos.x;			sgcursor->ypos = CURS_MIN_Y + eqh->curs_pos.y;*/		    }		    fgcurstab.XY.coords.pat_x =			fgcurstab.x - fgcurstab.hot_x + fg_wc_offset;		    fgcurstab.XY.coords.pat_y = fgcurstab.y - fgcurstab.hot_y;/* load new cursor position */		    fg_comm_area->XY_position = fgcurstab.XY.position;/* request position update */		    fg_comm_area->Lego.XY_position = 1;/* request cursor update */		    fg_comm_area->HG_flags.cursor_update = 1;		    if (eqh->curs_pos.y <= eqh->curs_box.bottom &&			eqh->curs_pos.y >=  eqh->curs_box.top &&			eqh->curs_pos.x <= eqh->curs_box.right &&			eqh->curs_pos.x >=  eqh->curs_box.left) goto mbuttons;		    vep = PUTBEGIN(eqh);		    PUTEND(eqh);		    ++wakeup_flag;	/* request a select wakeup call *//* * Put event into queue and do select */		    vep->vse_x = eqh->curs_pos.x;		    vep->vse_y = eqh->curs_pos.y;		    vep->vse_device = VSE_MOUSE;	/* mouse */		    vep->vse_type = VSE_MMOTION;	/* position changed */		    vep->vse_time = TOY;		/* time stamp */		    vep->vse_direction = 0;		    vep->vse_key = 0;		}/* * See if mouse buttons have changed. */mbuttons:		new_switch = new_rep->state & 0x07;		old_switch = last_rep.state & 0x07;		temp = old_switch ^ new_switch;		if( temp ) {		    for (j = 1; j < 8; j <<= 1) {/* check each button */			if (!(j & temp))  /* did this button change? */			    continue;/* event queue full? */			if (ISFULL(eqh) == TRUE) {/*		    	    mprintf("\nfg0: fgiint: event queue overflow");*/		    	    return(0);			}			vep = PUTBEGIN(eqh);	/* get new event */			PUTEND(eqh);			++wakeup_flag;      /* request a select wakeup call *//* put event into queue */			switch (j) {			case RIGHT_BUTTON:					vep->vse_key = VSE_RIGHT_BUTTON;					break;			case MIDDLE_BUTTON:					vep->vse_key = VSE_MIDDLE_BUTTON;					break;			case LEFT_BUTTON:					vep->vse_key = VSE_LEFT_BUTTON;					break;			}			if (new_switch & j)				vep->vse_direction = VSE_KBTDOWN;			else				vep->vse_direction = VSE_KBTUP;			vep->vse_type = VSE_BUTTON;			vep->vse_device = VSE_MOUSE;	/* mouse */			vep->vse_time = TOY;		    	vep->vse_x = eqh->curs_pos.x;		    	vep->vse_y = eqh->curs_pos.y;		    }/* update the last report */		    last_rep = current_rep;		}	    } /* Pick up mouse input */	    else if ((unit == 1) && (sm_pointer_id == TABLET_ID)) {/* event queue full? */		    if (ISFULL(eqh) == TRUE) {/*		    	mprintf("\nfg0: fgiint: event queue overflow");*/		    	return(0);		    }/* update cursor position coordinates */		    new_rep->dx /= fgflags.tab_res;		    new_rep->dy = (2200 - new_rep->dy) / fgflags.tab_res;		    if( new_rep->dx > MAX_CUR_X )			new_rep->dx = MAX_CUR_X;		    if( new_rep->dy > MAX_CUR_Y )			new_rep->dy = MAX_CUR_Y;/* * see if the puck/stylus has moved */		    if( eqh->curs_pos.x != new_rep->dx ||			eqh->curs_pos.y != new_rep->dy) {/* * update cursor position */		 	eqh->curs_pos.x = new_rep->dx;		 	eqh->curs_pos.y = new_rep->dy;			fgcurstab.x = eqh->curs_pos.x;			fgcurstab.y = eqh->curs_pos.y;		    	if( tp->t_state & TS_ISOPEN ) {/* Should modify this for Firefox cursor			    sgcursor = (struct color_cursor *) sgmap.cur;			    sgcursor->xpos = CURS_MIN_X + eqh->curs_pos.x;			    sgcursor->ypos = CURS_MIN_Y + eqh->curs_pos.y;*/			}		    	if (eqh->curs_pos.y < eqh->curs_box.bottom &&			    eqh->curs_pos.y >=  eqh->curs_box.top &&			    eqh->curs_pos.x < eqh->curs_box.right &&			    eqh->curs_pos.x >=  eqh->curs_box.left) goto tbuttons;			vep = PUTBEGIN(eqh);			PUTEND(eqh);			++wakeup_flag;	/* request a select wakeup call *//* Put event into queue *//* * The type should be "VSE_TMOTION" but,  X doesn't know this type, therefore * until X is fixed, we fake it to be "VSE_MMOTION". * */		    	vep->vse_type = VSE_MMOTION;		    	vep->vse_device = VSE_TABLET;	/* tablet */			vep->vse_direction = 0;		    	vep->vse_x = eqh->curs_pos.x;		    	vep->vse_y = eqh->curs_pos.y;			vep->vse_key = 0;		    	vep->vse_time = TOY;		    }/* * See if tablet buttons have changed. */tbuttons:		new_switch = new_rep->state & 0x1e;		old_switch = last_rep.state & 0x1e;		temp = old_switch ^ new_switch;		if( temp ) {/* event queue full? */		    if (ISFULL(eqh) == TRUE) {/*		    	mprintf("\nfg0: fgiint: event queue overflow");*/		    	return(0);		    }		    vep = PUTBEGIN(eqh);		    PUTEND(eqh);		    ++wakeup_flag;	/* request a select wakeup call *//* put event into queue */		    vep->vse_device = VSE_TABLET;	/* tablet */		    vep->vse_type = VSE_BUTTON;		    vep->vse_x = eqh->curs_pos.x;		    vep->vse_y = eqh->curs_pos.y;		    vep->vse_time = TOY;/* define the changed button and if up or down */		    for (j = 1; j <= 0x10; j <<= 1) {/* check each button */			if (!(j & temp))  /* did this button change? */			    continue;			switch (j) {			case T_RIGHT_BUTTON:					vep->vse_key = VSE_T_RIGHT_BUTTON;					break;			case T_FRONT_BUTTON:					vep->vse_key = VSE_T_FRONT_BUTTON;					break;			case T_BACK_BUTTON:					vep->vse_key = VSE_T_BACK_BUTTON;					break;			case T_LEFT_BUTTON:					vep->vse_key = VSE_T_LEFT_BUTTON;					break;			}		    	if (new_switch & j)			    vep->vse_direction = VSE_KBTDOWN;		    	else			    vep->vse_direction = VSE_KBTUP;		    }/* update the last report */		    last_rep = current_rep;		}	    } /* Pick up tablet input */	} /* While input available *//* * If we have proc waiting, and event has happened, wake him up */	if(rsel && wakeup_flag && fgflags.selmask & SEL_READ) {	    selwakeup(rsel,0);	    rsel = 0;	    fgflags.selmask &= ~SEL_READ;	    wakeup_flag = 0;	}   }/* * If the graphic device is not turned on, this is console input */   else {/* * Get a character from the keyboard. */	if (ch & 0100000) {	    data = ch & 0xff;/* * Check for various keyboard errors */	    if( data == LK_POWER_ERROR || data == LK_KDOWN_ERROR ||		data == LK_INPUT_ERROR || data == LK_OUTPUT_ERROR) {			mprintf("fg0: fgiint: Keyboard error, code = %x\n",data);			return(0);	    }	    if( data < LK_LOWEST ) return(0);/* * See if its a state change key */	    switch ( data ) {	    case LOCK:			fg_keyboard.lock ^= 0xffff;	/* toggle */			if( fg_keyboard.lock )				fg_key_out( LK_LED_ENABLE );			else				fg_key_out( LK_LED_DISABLE );			fg_key_out( LED_3 );			return;	    case SHIFT:			fg_keyboard.shift ^= 0xffff;			return;		    case CNTRL:			fg_keyboard.cntrl ^= 0xffff;			return;	    case ALLUP:			fg_keyboard.cntrl = fg_keyboard.shift = 0;			return;	    case REPEAT:			c = fg_keyboard.last;			break;	    case HOLD:/* * "Hold Screen" key was pressed, we treat it as if ^s or ^q was typed. */			if (fg_keyboard.hold == 0) {			    if((tp->t_state & TS_TTSTOP) == 0) {			    	c = q_key[CHAR_S];			    	fg_key_out( LK_LED_ENABLE );			    	fg_key_out( LED_4 );				fg_keyboard.hold = 1;			    } else				c = q_key[CHAR_Q];			}			else {			    c = q_key[CHAR_Q];			    fg_key_out( LK_LED_DISABLE );			    fg_key_out( LED_4 );			    fg_keyboard.hold = 0;			}			if( c >= ' ' && c <= '~' )			    c &= 0x1f;		    	(*linesw[tp->t_line].l_rint)(c, tp);			return;	    default:/* * Test for control characters. If set, see if the character * is elligible to become a control character. */			if( fg_keyboard.cntrl ) {			    c = q_key[ data ];			    if( c >= ' ' && c <= '~' )				c &= 0x1f;			    else if (c >= 0xA1 && c <= 0xFE)			        c &= 0x9F;			} else if( fg_keyboard.lock || fg_keyboard.shift )				    c = q_shift_key[ data ];				else				    c = q_key[ data ];			break;		    }	    fg_keyboard.last = c;/* * Check for special function keys */	    if( c & 0x100 ) {		register char *string;		string = q_special[ c & 0x7f ];		while( *string )		    (*linesw[tp->t_line].l_rint)(*string++, tp);	    } else		    (*linesw[tp->t_line].l_rint)(c, tp);	    if (fg_keyboard.hold &&((tp->t_state & TS_TTSTOP) == 0)) {		    fg_key_out( LK_LED_DISABLE );		    fg_key_out( LED_4 );		    fg_keyboard.hold = 0;	    }	}   }	return(0);}/****************************************************************** **                                                              ** ** Routine to start transmission.                               ** **                                                              ** ******************************************************************/fgstart(tp)	register struct tty *tp;{        register int unit, c;        register struct tty *tp0;        int s;        unit = minor(tp->t_dev);        tp0 = &sm_tty;        unit &= 03;        s = spl6();/* * If it's currently active, or delaying, no need to do anything. */        if (tp->t_state&(TS_TIMEOUT|TS_BUSY|TS_TTSTOP))            goto out;/* * Display chars until the queue is empty, if the second subchannel is open * direct them there. Drop characters from any lines other than 0 on the floor. * TANDEM is set on second subchannel for flow control. */        while( tp->t_outq.c_cc ) {            if (unit == 0) {            /* console device */                if (tp0->t_state & TS_ISOPEN) {                    if (tp0->t_state & TS_TBLOCK)                        goto out;                    c = getc(&tp->t_outq);                    (*linesw[tp0->t_line].l_rint)(c, tp0);                } else {                    c = getc(&tp->t_outq);                    fg_blitc((char)(c & 0xff));                }            } else if (unit == 2) {     /* sgscreen, do flow control */                    c = getc(&tp->t_outq);                    if ((tp0->t_state&TS_TBLOCK) == 0) {                        tp = &fc_tty[0];                        unit = minor(tp->t_dev);                        unit &= 3;                        continue;                    } else                        goto out;            } else                c = getc(&tp->t_outq);        }/* * If there are sleepers, and output has drained below low * water mark, wake up the sleepers. */        if ( tp->t_outq.c_cc<=TTLOWAT(tp) )            if (tp->t_state&TS_ASLEEP){                tp->t_state &= ~TS_ASLEEP;                wakeup((caddr_t)&tp->t_outq);            }        tp->t_state &= ~TS_BUSY;out:        splx(s);}/****************************************************************** **                                                              ** ** Routine to stop output on the graphic device, e.g. for ^S/^Q ** ** or output flush.                                             ** **                                                              ** ******************************************************************//*ARGSUSED*/

⌨️ 快捷键说明

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