kbd_win32--.c
来自「使用miniGUI模拟器的简单开发例子(值得参考)」· C语言 代码 · 共 122 行
C
122 行
/*
* Copyright (c) 2005, Wilson Loi wlsloi@msn.com
* WIN32 screen driver for Microwindows
*/
#include <string.h>
#include <stdio.h>
//#include <windows.h>
//#include "device.h"
#include "common.h"
#include "ial.h"
#include "gal.h"
#include "Native.h"
//extern HWND rootWindow;
static int Kbd__Open(KBDDEVICE *pkd);
static void Kbd__Close(void);
static void Kbd__GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
static int Kbd__Read(MWKEY *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
static int Kbd__Poll(void);
extern MSG *winMsg;
KBDDEVICE kbddev = {
Kbd__Open,
Kbd__Close,
Kbd__GetModifierInfo,
Kbd__Read,
Kbd__Poll
};
/*
* Poll for keyboard events
*/
static int
Kbd__Poll(void)
{
return 1;
}
/*
* Open the keyboard.
*/
static int
Kbd__Open(KBDDEVICE *pkd)
{
return 1;
}
/*
* Close the keyboard.
*/
static void
Kbd__Close(void)
{
}
/*
* Return the possible modifiers for the keyboard.
*/
static void
Kbd__GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers)
{
if (modifiers)
*modifiers = 0; /* no modifiers available */
if (curmodifiers)
*curmodifiers = 0;
}
/*
* This reads one keystroke from the keyboard, and the current state of
* the modifier keys (ALT, SHIFT, etc). Returns -1 on error, 0 if no data
* is ready, 1 on a keypress, and 2 on keyrelease.
* This is a non-blocking call.
*/
static int
Kbd__Read(MWKEY *mwkey, MWKEYMOD *modifiers, MWSCANCODE *scancode)
{
int keystatus = -1;
// MWKEY mwkey = msg->wParam; // virtual-key code
// MWKEYMOD modifiers = 0;
// unsigned char scanCode;
int repeat, extended, context, previous;
if (winMsg){
repeat = winMsg->lParam & 0xffff;
// scancode = (winMsg->lParam >> 16) & 0xffff;
extended = winMsg->lParam & 1000000;
context = winMsg->lParam & 20000000;
previous = winMsg->lParam & 40000000;
// read keyboard shift status
*modifiers = 0;
// read keyboard character
*mwkey = winMsg->wParam;
*scancode = (winMsg->lParam >> 16) & 0xffff;
if (extended){
}
return 1;
}
return 0;
}
/* 2006-11-19 3:43:56
static int
KBD_Read(MWUCHAR *buf, int *modifiers)
{
// wait until a char is ready
if(!bioskey(1))
return 0;
// read keyboard shift status
*modifiers = bioskey(2);
// read keyboard character
*buf = bioskey(0);
if(*buf == 0x1b)
return -2;
return 1;
}*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?