亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sdl_gsevents.c

?? Simple DirectMedia Layer - Simple DirectMedia Layer 是一個跨平臺的多媒體庫設計用來提供快速圖形framebuffer和音頻驅動。應用MPEG為軟件
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*	SDL - Simple DirectMedia Layer	Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga	This library is free software; you can redistribute it and/or	modify it under the terms of the GNU Library General Public	License as published by the Free Software Foundation; either	version 2 of the License, or (at your option) any later version.	This library is distributed in the hope that it will be useful,	but WITHOUT ANY WARRANTY; without even the implied warranty of	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU	Library General Public License for more details.	You should have received a copy of the GNU Library General Public	License along with this library; if not, write to the Free	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA	Sam Lantinga	slouken@libsdl.org*/#ifdef SAVE_RCSIDstatic char rcsid = "@(#) $Id: SDL_gsevents.c,v 1.4 2002/03/06 11:23:06 slouken Exp $";#endif/* Handle the event stream, converting console events into SDL events */#include <sys/types.h>#include <sys/time.h>#include <sys/ioctl.h>#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <string.h>#include <errno.h>#include <limits.h>/* For parsing /proc */#include <dirent.h>#include <ctype.h>#include <linux/vt.h>#include <linux/kd.h>#include <linux/keyboard.h>#include "SDL.h"#include "SDL_mutex.h"#include "SDL_sysevents.h"#include "SDL_sysvideo.h"#include "SDL_events_c.h"#include "SDL_gsvideo.h"#include "SDL_gsevents_c.h"#include "SDL_gskeys.h"#ifndef GPM_NODE_FIFO#define GPM_NODE_FIFO	"/dev/gpmdata"#endif/* The translation tables from a console scancode to a SDL keysym */#define NUM_VGAKEYMAPS	(1<<KG_CAPSSHIFT)static Uint16 vga_keymap[NUM_VGAKEYMAPS][NR_KEYS];static SDLKey keymap[128];static Uint16 keymap_temp[128]; /* only used at startup */static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym);/* Ugh, we have to duplicate the kernel's keysym mapping code...   Oh, it's not so bad. :-)   FIXME: Add keyboard LED handling code */static void GS_vgainitkeymaps(int fd){	struct kbentry entry;	int map, i;	/* Don't do anything if we are passed a closed keyboard */	if ( fd < 0 ) {		return;	}	/* Load all the keysym mappings */	for ( map=0; map<NUM_VGAKEYMAPS; ++map ) {		memset(vga_keymap[map], 0, NR_KEYS*sizeof(Uint16));		for ( i=0; i<NR_KEYS; ++i ) {			entry.kb_table = map;			entry.kb_index = i;			if ( ioctl(fd, KDGKBENT, &entry) == 0 ) {				/* fill keytemp. This replaces SDL_fbkeys.h */				if ( (map == 0) && (i<128) ) {					keymap_temp[i] = entry.kb_value;				}				/* The "Enter" key is a special case */				if ( entry.kb_value == K_ENTER ) {					entry.kb_value = K(KT_ASCII,13);				}				/* Handle numpad specially as well */				if ( KTYP(entry.kb_value) == KT_PAD ) {					switch ( entry.kb_value ) {					case K_P0:					case K_P1:					case K_P2:					case K_P3:					case K_P4:					case K_P5:					case K_P6:					case K_P7:					case K_P8:					case K_P9:						vga_keymap[map][i]=entry.kb_value;						vga_keymap[map][i]+= '0';						break;										case K_PPLUS:						vga_keymap[map][i]=K(KT_ASCII,'+');						break;										case K_PMINUS:						vga_keymap[map][i]=K(KT_ASCII,'-');						break;										case K_PSTAR:						vga_keymap[map][i]=K(KT_ASCII,'*');						break;										case K_PSLASH:						vga_keymap[map][i]=K(KT_ASCII,'/');						break;										case K_PENTER:						vga_keymap[map][i]=K(KT_ASCII,'\r');						break;										case K_PCOMMA:						vga_keymap[map][i]=K(KT_ASCII,',');						break;										case K_PDOT:						vga_keymap[map][i]=K(KT_ASCII,'.');						break;					default:						break;					}				}				/* Do the normal key translation */				if ( (KTYP(entry.kb_value) == KT_LATIN) ||					 (KTYP(entry.kb_value) == KT_ASCII) ||					 (KTYP(entry.kb_value) == KT_LETTER) ) {					vga_keymap[map][i] = entry.kb_value;				}			}		}	}}int GS_InGraphicsMode(_THIS){	return((keyboard_fd >= 0) && (saved_kbd_mode >= 0));}int GS_EnterGraphicsMode(_THIS){	struct termios keyboard_termios;	/* Set medium-raw keyboard mode */	if ( (keyboard_fd >= 0) && !GS_InGraphicsMode(this) ) {		/* Switch to the correct virtual terminal */		if ( current_vt > 0 ) {			struct vt_stat vtstate;			if ( ioctl(keyboard_fd, VT_GETSTATE, &vtstate) == 0 ) {				saved_vt = vtstate.v_active;			}			if ( ioctl(keyboard_fd, VT_ACTIVATE, current_vt) == 0 ) {				ioctl(keyboard_fd, VT_WAITACTIVE, current_vt);			}		}		/* Set the terminal input mode */		if ( tcgetattr(keyboard_fd, &saved_kbd_termios) < 0 ) {			SDL_SetError("Unable to get terminal attributes");			if ( keyboard_fd > 0 ) {				close(keyboard_fd);			}			keyboard_fd = -1;			return(-1);		}		if ( ioctl(keyboard_fd, KDGKBMODE, &saved_kbd_mode) < 0 ) {			SDL_SetError("Unable to get current keyboard mode");			if ( keyboard_fd > 0 ) {				close(keyboard_fd);			}			keyboard_fd = -1;			return(-1);		}		keyboard_termios = saved_kbd_termios;		keyboard_termios.c_lflag &= ~(ICANON | ECHO | ISIG);		keyboard_termios.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);		keyboard_termios.c_cc[VMIN] = 0;		keyboard_termios.c_cc[VTIME] = 0;		if (tcsetattr(keyboard_fd, TCSAFLUSH, &keyboard_termios) < 0) {			GS_CloseKeyboard(this);			SDL_SetError("Unable to set terminal attributes");			return(-1);		}		/* This will fail if we aren't root or this isn't our tty */		if ( ioctl(keyboard_fd, KDSKBMODE, K_MEDIUMRAW) < 0 ) {			GS_CloseKeyboard(this);			SDL_SetError("Unable to set keyboard in raw mode");			return(-1);		}		if ( ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS) < 0 ) {			GS_CloseKeyboard(this);			SDL_SetError("Unable to set keyboard in graphics mode");			return(-1);		}	}	return(keyboard_fd);}void GS_LeaveGraphicsMode(_THIS){	if ( GS_InGraphicsMode(this) ) {		ioctl(keyboard_fd, KDSETMODE, KD_TEXT);		ioctl(keyboard_fd, KDSKBMODE, saved_kbd_mode);		tcsetattr(keyboard_fd, TCSAFLUSH, &saved_kbd_termios);		saved_kbd_mode = -1;		/* Head back over to the original virtual terminal */		if ( saved_vt > 0 ) {			ioctl(keyboard_fd, VT_ACTIVATE, saved_vt);		}	}}void GS_CloseKeyboard(_THIS){	if ( keyboard_fd >= 0 ) {		GS_LeaveGraphicsMode(this);		if ( keyboard_fd > 0 ) {			close(keyboard_fd);		}	}	keyboard_fd = -1;}int GS_OpenKeyboard(_THIS){	/* Open only if not already opened */ 	if ( keyboard_fd < 0 ) {		char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };		char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };		int i, tty0_fd;		/* Try to query for a free virtual terminal */		tty0_fd = -1;		for ( i=0; tty0[i] && (tty0_fd < 0); ++i ) {			tty0_fd = open(tty0[i], O_WRONLY, 0);		}		if ( tty0_fd < 0 ) {			tty0_fd = dup(0); /* Maybe stdin is a VT? */		}		ioctl(tty0_fd, VT_OPENQRY, &current_vt);		close(tty0_fd);		if ( (geteuid() == 0) && (current_vt > 0) ) {			for ( i=0; vcs[i] && (keyboard_fd < 0); ++i ) {				char vtpath[12];				sprintf(vtpath, vcs[i], current_vt);				keyboard_fd = open(vtpath, O_RDWR, 0);#ifdef DEBUG_KEYBOARD				fprintf(stderr, "vtpath = %s, fd = %d\n",					vtpath, keyboard_fd);#endif /* DEBUG_KEYBOARD */				/* This needs to be our controlling tty				   so that the kernel ioctl() calls work				*/				if ( keyboard_fd >= 0 ) {					tty0_fd = open("/dev/tty", O_RDWR, 0);					if ( tty0_fd >= 0 ) {						ioctl(tty0_fd, TIOCNOTTY, 0);						close(tty0_fd);					}				}			}		} 		if ( keyboard_fd < 0 ) {			/* Last resort, maybe our tty is a usable VT */			current_vt = 0;			keyboard_fd = open("/dev/tty", O_RDWR); 		}#ifdef DEBUG_KEYBOARD		fprintf(stderr, "Current VT: %d\n", current_vt);#endif 		saved_kbd_mode = -1;		/* Make sure that our input is a console terminal */		{ int dummy;		  if ( ioctl(keyboard_fd, KDGKBMODE, &dummy) < 0 ) {			close(keyboard_fd);			keyboard_fd = -1;			SDL_SetError("Unable to open a console terminal");		  }		}		/* Set up keymap */		GS_vgainitkeymaps(keyboard_fd); 	} 	return(keyboard_fd);}static enum {	MOUSE_NONE = -1,	MOUSE_GPM,	/* Note: GPM uses the MSC protocol */	MOUSE_PS2,	MOUSE_IMPS2,	MOUSE_MS,	MOUSE_BM,	NUM_MOUSE_DRVS} mouse_drv = MOUSE_NONE;void GS_CloseMouse(_THIS){	if ( mouse_fd > 0 ) {		close(mouse_fd);	}	mouse_fd = -1;}/* Returns processes listed in /proc with the desired name */static int find_pid(DIR *proc, const char *wanted_name){	struct dirent *entry;	int pid;	/* First scan proc for the gpm process */	pid = 0;	while ( (pid == 0) && ((entry=readdir(proc)) != NULL) ) {		if ( isdigit(entry->d_name[0]) ) {			FILE *status;			char path[PATH_MAX];			char name[PATH_MAX];			sprintf(path, "/proc/%s/status", entry->d_name);			status=fopen(path, "r");			if ( status ) {				name[0] = '\0';				fscanf(status, "Name: %s", name);				if ( strcmp(name, wanted_name) == 0 ) {					pid = atoi(entry->d_name);				}				fclose(status);			}		}	}	return pid;}/* Returns true if /dev/gpmdata is being written to by gpm */static int gpm_available(void){	int available;	DIR *proc;	int pid;	int cmdline, len, arglen;	char path[PATH_MAX];	char args[PATH_MAX], *arg;	/* Don't bother looking if the fifo isn't there */	if ( access(GPM_NODE_FIFO, F_OK) < 0 ) {		return(0);	}	available = 0;	proc = opendir("/proc");	if ( proc ) {		while ( (pid=find_pid(proc, "gpm")) > 0 ) {			sprintf(path, "/proc/%d/cmdline", pid);			cmdline = open(path, O_RDONLY, 0);			if ( cmdline >= 0 ) {				len = read(cmdline, args, sizeof(args));				arg = args;				while ( len > 0 ) {					if ( strcmp(arg, "-R") == 0 ) {						available = 1;					}					arglen = strlen(arg)+1;					len -= arglen;					arg += arglen;				}				close(cmdline);			}		}		closedir(proc);	}	return available;}/* rcg06112001 Set up IMPS/2 mode, if possible. This gives *  us access to the mousewheel, etc. Returns zero if *  writes to device failed, but you still need to query the *  device to see which mode it's actually in. */static int set_imps2_mode(int fd){	/* If you wanted to control the mouse mode (and we do :)  ) ...		Set IMPS/2 protocol:			{0xf3,200,0xf3,100,0xf3,80}		Reset mouse device:			{0xFF}	*/	Uint8 set_imps2[] = {0xf3, 200, 0xf3, 100, 0xf3, 80};	Uint8 reset = 0xff;	fd_set fdset;	struct timeval tv;	int retval = 0;	if ( write(fd, &set_imps2, sizeof(set_imps2)) == sizeof(set_imps2) ) {		if (write(fd, &reset, sizeof (reset)) == sizeof (reset) ) {			retval = 1;		}	}	/* Get rid of any chatter from the above */	FD_ZERO(&fdset);	FD_SET(fd, &fdset);	tv.tv_sec = 0;	tv.tv_usec = 0;	while ( select(fd+1, &fdset, 0, 0, &tv) > 0 ) {		char temp[32];		read(fd, temp, sizeof(temp));	}	return retval;}/* Returns true if the mouse uses the IMPS/2 protocol */static int detect_imps2(int fd){	int imps2;	imps2 = 0;	if ( getenv("SDL_MOUSEDEV_IMPS2") ) {		imps2 = 1;	}	if ( ! imps2 ) {		Uint8 query_ps2 = 0xF2;		fd_set fdset;		struct timeval tv;		/* Get rid of any mouse motion noise */		FD_ZERO(&fdset);		FD_SET(fd, &fdset);		tv.tv_sec = 0;		tv.tv_usec = 0;		while ( select(fd+1, &fdset, 0, 0, &tv) > 0 ) {			char temp[32];			read(fd, temp, sizeof(temp));		}   		/* Query for the type of mouse protocol */   		if ( write(fd, &query_ps2, sizeof (query_ps2)) == sizeof (query_ps2)) {   			Uint8 ch = 0;			/* Get the mouse protocol response */			do {				FD_ZERO(&fdset);				FD_SET(fd, &fdset);				tv.tv_sec = 1;				tv.tv_usec = 0;				if ( select(fd+1, &fdset, 0, 0, &tv) < 1 ) {					break;				}			} while ( (read(fd, &ch, sizeof (ch)) == sizeof (ch)) &&			          ((ch == 0xFA) || (ch == 0xAA)) );			/* Experimental values (Logitech wheelmouse) */#ifdef DEBUG_MOUSEfprintf(stderr, "Last mouse mode: 0x%x\n", ch);#endif			if ( ch == 3 ) {				imps2 = 1;			}		}	}	return imps2;}int GS_OpenMouse(_THIS){	int i;	const char *mousedev;	const char *mousedrv;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩av电影免费观看高清完整版| av中文字幕一区| 国产a级毛片一区| 6080亚洲精品一区二区| 久久久电影一区二区三区| 亚洲狠狠爱一区二区三区| 国产成人av福利| 日韩亚洲电影在线| 亚洲动漫第一页| 99免费精品在线观看| 精品捆绑美女sm三区| 亚洲成人自拍网| 99国产精品99久久久久久| 久久精品水蜜桃av综合天堂| 日韩不卡在线观看日韩不卡视频| 色综合网色综合| 中文字幕日韩一区| 国产精品99久久久久久久vr| 日韩三级精品电影久久久| 性欧美疯狂xxxxbbbb| 91成人免费在线| 日韩理论片一区二区| 成人视屏免费看| 国产三级久久久| 激情久久五月天| 精品美女被调教视频大全网站| 日韩高清不卡一区二区三区| 欧美日韩精品欧美日韩精品| 亚洲午夜一区二区| 欧美色图一区二区三区| 亚洲一二三专区| 欧美日韩视频不卡| 偷偷要91色婷婷| 欧美一区二区三区婷婷月色 | 青草国产精品久久久久久| 色狠狠色噜噜噜综合网| 亚洲自拍偷拍图区| 制服丝袜国产精品| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美美女一区二区在线观看| 日韩激情中文字幕| 精品日本一线二线三线不卡| 久久 天天综合| 国产欧美一区视频| 99精品视频中文字幕| 亚洲综合视频在线| 7777精品伊人久久久大香线蕉经典版下载 | 国产九色精品成人porny| 国产亚洲成av人在线观看导航| 成人精品gif动图一区| 国产精品萝li| 欧美日韩精品专区| 激情图片小说一区| 日韩一区欧美小说| 欧美精品一二三区| 国产一区二区三区香蕉| 亚洲欧美日韩在线播放| 欧美日韩久久久一区| 久久99国产精品麻豆| 国产精品久久久久影视| 欧美日韩亚洲综合| 激情综合五月婷婷| ...xxx性欧美| 日韩一区二区三区av| 国产成人综合在线观看| 亚洲综合丁香婷婷六月香| 欧美xxxxx裸体时装秀| av中文字幕一区| 久久国产精品免费| 亚洲另类在线视频| 久久久久国色av免费看影院| 色噜噜狠狠色综合中国| 九色|91porny| 洋洋av久久久久久久一区| 26uuuu精品一区二区| 91福利国产成人精品照片| 国产精品一二三在| 肉色丝袜一区二区| 中文字幕一区二区三区在线观看 | 色噜噜狠狠成人中文综合| 精品一区精品二区高清| 亚洲综合成人在线视频| 国产午夜精品久久久久久久| 7777精品伊人久久久大香线蕉的| 成人国产一区二区三区精品| 蜜臀av一区二区三区| 一区二区三区波多野结衣在线观看| 2023国产精华国产精品| 欧美伦理电影网| 色综合天天综合网国产成人综合天| 精品制服美女丁香| 午夜精品久久一牛影视| 亚洲欧洲韩国日本视频| 国产日产亚洲精品系列| 欧美大片在线观看一区二区| 欧美日韩精品一区二区天天拍小说 | 久久av中文字幕片| 首页国产欧美久久| 亚洲国产精品一区二区www在线| 国产精品另类一区| 国产欧美日韩视频一区二区 | 国产在线精品一区二区不卡了 | 亚洲免费资源在线播放| 国产欧美一区二区三区鸳鸯浴 | 日韩一区有码在线| 日本一区二区三区久久久久久久久不 | 久久99九九99精品| 免费在线观看一区二区三区| 午夜影院久久久| 亚洲一区二区五区| 亚洲一区在线观看视频| 一区二区三区欧美激情| 亚洲精品自拍动漫在线| 一区二区三区四区高清精品免费观看| 日韩理论在线观看| 一区二区三区中文在线| 亚洲亚洲精品在线观看| 五月婷婷欧美视频| 日韩黄色免费电影| 蜜臀久久99精品久久久久久9| 婷婷丁香久久五月婷婷| 日本伊人精品一区二区三区观看方式| 三级久久三级久久久| 天堂精品中文字幕在线| 免费观看在线综合色| 久久66热re国产| 粉嫩av一区二区三区在线播放| a在线欧美一区| 91久久国产最好的精华液| 欧美日韩大陆一区二区| 日韩欧美一级二级三级久久久| 日韩久久免费av| 国产精品久久久久影院色老大| 亚洲美女视频在线观看| 亚洲电影一级片| 久久国产精品免费| www.日韩大片| 欧美日韩电影一区| 久久久久9999亚洲精品| 亚洲私人黄色宅男| 天堂va蜜桃一区二区三区漫画版| 久久99精品国产91久久来源| 国产黄色成人av| 91高清视频免费看| 日韩精品一区二区三区在线播放 | wwww国产精品欧美| 亚洲欧洲av在线| 蜜臀久久99精品久久久久久9| 国产成人免费在线观看不卡| 色婷婷精品久久二区二区蜜臀av | 欧美日韩亚洲综合一区二区三区| 精品久久久久99| 夜夜嗨av一区二区三区中文字幕 | 亚欧色一区w666天堂| 国产在线精品一区二区不卡了| 色综合天天综合色综合av| 欧美一区二区三区小说| 中文字幕永久在线不卡| 久久99久久精品| 欧美日韩中文另类| 国产婷婷色一区二区三区四区| 午夜精品久久久久久不卡8050| 成人综合婷婷国产精品久久蜜臀| 911精品产国品一二三产区| 中文字幕不卡的av| 激情综合五月天| 欧美日韩一区成人| 最新高清无码专区| 国产精品中文字幕一区二区三区| 欧美在线你懂的| 成人欧美一区二区三区视频网页| 激情综合色播激情啊| 欧美午夜不卡在线观看免费| 国产精品免费观看视频| 国模娜娜一区二区三区| 欧美二区三区91| 亚洲高清三级视频| 日韩欧美国产麻豆| 一区二区日韩电影| av激情成人网| 久久精品视频在线免费观看 | 日韩精品一区在线| 亚洲成a人片综合在线| 色偷偷一区二区三区| 中国色在线观看另类| 国产一区激情在线| 欧美成人性福生活免费看| 天堂蜜桃一区二区三区| 欧美午夜片在线看| 亚洲午夜久久久久| 91视频免费看| 亚洲手机成人高清视频| 成人性色生活片| 国产精品视频九色porn| 成人动漫视频在线| 国产精品女上位| 99久久免费精品| 亚洲欧美另类图片小说| 91在线看国产| 亚洲精品自拍动漫在线|