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

📄 mouse.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
#include "u.h"#include "../port/lib.h"#include "mem.h"#include "dat.h"#include "fns.h"#include "../port/error.h"#include "io.h"#define	Image	IMAGE#include <draw.h>#include <memdraw.h>#include <cursor.h>#include "screen.h"enum {	Button1 = 0x1;	Button2 = 0x2;	Button3 = 0x4;};int		buttons;Point	position;static voidmousevent(void) {	static int		curbuttons;	static Point	curposition;	if (buttons == curbuttons && eqpt(position, curposition))		return;	/* generate a mouse event */	curbuttons = buttons;	curposition = position;}voidbuttonevent(int event) {	switch (event) {	case 0x02:		/* Button 2 down */		buttons |= Button2;		mousevent();		break;	case 0x82:		/* Button 2 up */		buttons &= ~Button2;		mousevent();		break;	case 0x03:		/* Button 3 down */		buttons |= Button3;		mousevent();		break;	case 0x83:		/* Button 3 up */		buttons &= ~Button3;		mousevent();		break;	default:		/* other buttons */	}}

⌨️ 快捷键说明

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