Ai
15 Star 151 Fork 23

Open-SkyEye/open-skyeye

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
keycode-array.c 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
xiaoqiao 提交于 2012-02-22 16:41 +08:00 . Transplant android source code from google.
/* Copyright (C) 2010 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program 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 General Public License for more details.
*/
#include <stdio.h>
#include "android/utils/debug.h"
#include "android/keycode-array.h"
#include "user-events.h"
void
android_keycodes_add_key_event( AKeycodeBuffer* keycodes,
unsigned code,
unsigned down )
{
if (code != 0 && keycodes->keycode_count < MAX_KEYCODES) {
keycodes->keycodes[(int)keycodes->keycode_count++] =
( (code & 0x1ff) | (down ? 0x200 : 0) );
}
}
void
android_keycodes_flush(AKeycodeBuffer* keycodes)
{
if (keycodes->keycode_count > 0) {
if (VERBOSE_CHECK(keys)) {
int nn;
printf(">> KEY" );
for (nn = 0; nn < keycodes->keycode_count; nn++) {
int code = keycodes->keycodes[nn];
printf(" [0x%03x,%s]", (code & 0x1ff), (code & 0x200) ? "down" : " up " );
}
printf( "\n" );
}
user_event_keycodes(keycodes->keycodes, keycodes->keycode_count);
keycodes->keycode_count = 0;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/open-skyeye/code.git
git@gitee.com:open-skyeye/code.git
open-skyeye
code
open-skyeye
master

搜索帮助