mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-06 10:21:57 +08:00
cleanup: remove _LITE_VERSION and _STAND_ALONE macros
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
Version 4.0.4 (2019/12/24)
|
||||
Version 4.1.0 (2019/01/22)
|
||||
|
||||
This release needs the following packages:
|
||||
This is a developing version, an unstable version.
|
||||
It needs the following packages:
|
||||
|
||||
- The resource package: `minigui-res-4.0.0.tar.gz`
|
||||
- The sample package: `mg-samples-4.0.1.tar.gz`
|
||||
- The test cases package: `mg-tests-4.0.4.tar.gz`
|
||||
- The test cases package: `mg-tests-4.1.0.tar.gz`
|
||||
- The sample package: `mg-samples-4.1.0.tar.gz`
|
||||
|
||||
|
||||
12
configure.ac
12
configure.ac
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT(libminigui, 4.0.4)
|
||||
AC_INIT(libminigui, 4.1.0)
|
||||
AC_CONFIG_SRCDIR(src/main/main.c)
|
||||
|
||||
dnl Set various version strings - taken gratefully from the SDL sources
|
||||
@@ -15,8 +15,8 @@ dnl Set various version strings - taken gratefully from the SDL sources
|
||||
# set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0.
|
||||
#
|
||||
MINIGUI_MAJOR_VERSION=4
|
||||
MINIGUI_MINOR_VERSION=0
|
||||
MINIGUI_MICRO_VERSION=4
|
||||
MINIGUI_MINOR_VERSION=1
|
||||
MINIGUI_MICRO_VERSION=0
|
||||
MINIGUI_INTERFACE_AGE=0
|
||||
MINIGUI_BINARY_AGE=0
|
||||
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
||||
@@ -1707,10 +1707,6 @@ case "$runtime_mode" in
|
||||
sa)
|
||||
AC_DEFINE(_MGRM_STANDALONE, 1,
|
||||
[Define if build MiniGUI-Standalone])
|
||||
AC_DEFINE(_STAND_ALONE, 1,
|
||||
[Define if build MiniGUI-Standalone (back-compatibility definition)])
|
||||
AC_DEFINE(_LITE_VERSION, 1,
|
||||
[Define if build MiniGUI-Standalone (back-compatibility definition)])
|
||||
MINIGUI_RUNMODE="sa"
|
||||
;;
|
||||
ths)
|
||||
@@ -1722,8 +1718,6 @@ case "$runtime_mode" in
|
||||
*)
|
||||
AC_DEFINE(_MGRM_PROCESSES, 1,
|
||||
[Define if build MiniGUI-Processes])
|
||||
AC_DEFINE(_LITE_VERSION, 1,
|
||||
[Define if build MiniGUI-Processes (back-compatibility definition)])
|
||||
MINIGUI_RUNMODE="procs"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -111,13 +111,8 @@ static int mouse_getbutton(void)
|
||||
return ts_event.pressure;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -130,29 +125,23 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
int rs;
|
||||
int rs;
|
||||
FD_CLR (ts, in);
|
||||
ts_event.x=0;
|
||||
ts_event.y=0;
|
||||
|
||||
printf ("begin to read\n");
|
||||
rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
printf ("rs = %d\n", rs);
|
||||
if (rs != sizeof(TS_EVENT))
|
||||
return -1;
|
||||
|
||||
rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
printf ("rs = %d\n", rs);
|
||||
if (rs != sizeof(TS_EVENT))
|
||||
return -1;
|
||||
|
||||
if (ts_event.pressure > 0) {
|
||||
mousex = ts_event.x;
|
||||
mousey = ts_event.y;
|
||||
@@ -167,7 +156,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -196,14 +185,14 @@ BOOL Init2410Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
ts_event.x = ts_event.y = ts_event.pressure = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Term2410Input(void)
|
||||
void Term2410Input(void)
|
||||
{
|
||||
if (ts >= 0)
|
||||
close(ts);
|
||||
close(ts);
|
||||
}
|
||||
|
||||
#endif /* _SMDK2410_IAL */
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -110,13 +110,8 @@ static int mouse_getbutton(void)
|
||||
return ts_event.pressure;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -129,28 +124,21 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
int rs;
|
||||
int rs;
|
||||
FD_CLR (ts, in);
|
||||
ts_event.x=0;
|
||||
ts_event.y=0;
|
||||
|
||||
rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
//rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
if (rs != sizeof(TS_EVENT))
|
||||
return -1;
|
||||
|
||||
rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
if (rs != sizeof(TS_EVENT))
|
||||
return -1;
|
||||
|
||||
if (ts_event.pressure > 0) {
|
||||
mousex = ts_event.x;
|
||||
mousey = ts_event.y;
|
||||
@@ -164,7 +152,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -191,14 +179,14 @@ BOOL Init2440Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
ts_event.x = ts_event.y = ts_event.pressure = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Term2440Input(void)
|
||||
void Term2440Input(void)
|
||||
{
|
||||
if (ts >= 0)
|
||||
close(ts);
|
||||
close(ts);
|
||||
}
|
||||
|
||||
#endif /* _SMDK2410_IAL */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** abssig.c: Low Level Input Engine for frv-uclinux ABSSIG.
|
||||
**
|
||||
**
|
||||
** Created by Peng Ke, 2004/12/20
|
||||
*/
|
||||
|
||||
@@ -257,15 +257,9 @@ keyboard_getstate(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int
|
||||
wait_event(int which, int maxfd, fd_set * in, fd_set * out, fd_set * except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int
|
||||
wait_event(int which, fd_set * in, fd_set * out, fd_set * except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -280,18 +274,11 @@ wait_event(int which, fd_set * in, fd_set * out, fd_set * except,
|
||||
if ((which & IAL_KEYEVENT) && asi.dev_fd >= 0)
|
||||
{
|
||||
FD_SET(asi.dev_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (asi.dev_fd > maxfd)
|
||||
maxfd = asi.dev_fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select(maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
e = select(FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
|
||||
if (cur_ir_scancode != -1)
|
||||
{
|
||||
retvalue |= IAL_KEYEVENT;
|
||||
@@ -316,11 +303,12 @@ wait_event(int which, fd_set * in, fd_set * out, fd_set * except,
|
||||
return retvalue;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
get_mouse_xy(int *x, int *y)
|
||||
{
|
||||
}
|
||||
int
|
||||
|
||||
static int
|
||||
get_mouse_button(void)
|
||||
{
|
||||
return 0;
|
||||
|
||||
112
src/ial/ads.c
112
src/ial/ads.c
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** ads.c: Low Level Input Engine for ADS Graphics Client.
|
||||
**
|
||||
**
|
||||
** Created by Wei Yongming, 2000/08/24
|
||||
**
|
||||
** After some hard work, this engine now runs well.
|
||||
@@ -81,89 +81,89 @@ static POS pos;
|
||||
*/
|
||||
static int mouse_update(void)
|
||||
{
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void mouse_getxy(int* x, int* y)
|
||||
{
|
||||
*x = mousex;
|
||||
*y = mousey;
|
||||
*x = mousex;
|
||||
*y = mousey;
|
||||
}
|
||||
|
||||
static int mouse_getbutton(void)
|
||||
{
|
||||
return pos.b;
|
||||
return pos.b;
|
||||
}
|
||||
|
||||
static int keyboard_update(void)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char * keyboard_getstate(void)
|
||||
{
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
fd_set rfds;
|
||||
int e;
|
||||
fd_set rfds;
|
||||
int e;
|
||||
|
||||
if (!in) {
|
||||
in = &rfds;
|
||||
FD_ZERO (in);
|
||||
}
|
||||
|
||||
if (which & IAL_MOUSEEVENT) {
|
||||
FD_SET (ts, in);
|
||||
if (which & IAL_MOUSEEVENT) {
|
||||
FD_SET (ts, in);
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
}
|
||||
}
|
||||
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in))
|
||||
{
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in))
|
||||
{
|
||||
FD_CLR (ts, in);
|
||||
read (ts, &pos, sizeof (POS));
|
||||
if ( pos.x !=-1 && pos.y !=-1) {
|
||||
mousex = pos.x;
|
||||
mousey = pos.y;
|
||||
}
|
||||
pos.b = ( pos.b > 0 ? IAL_MOUSE_LEFTBUTTON:0);
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
read (ts, &pos, sizeof (POS));
|
||||
if ( pos.x !=-1 && pos.y !=-1) {
|
||||
mousex = pos.x;
|
||||
mousey = pos.y;
|
||||
}
|
||||
pos.b = ( pos.b > 0 ? IAL_MOUSE_LEFTBUTTON:0);
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
|
||||
} else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
} else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
#if 0
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
struct pollfd ufd;
|
||||
if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT)
|
||||
{
|
||||
ufd.fd = ts;
|
||||
ufd.events = POLLIN;
|
||||
if ( poll (&ufd, 1, timeout->tv_usec) > 0)
|
||||
{
|
||||
read (ts, &pos, sizeof(POS));
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
struct pollfd ufd;
|
||||
if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT)
|
||||
{
|
||||
ufd.fd = ts;
|
||||
ufd.events = POLLIN;
|
||||
if ( poll (&ufd, 1, timeout->tv_usec) > 0)
|
||||
{
|
||||
read (ts, &pos, sizeof(POS));
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL InitADSInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
{
|
||||
ts = open ("/dev/ts", O_RDONLY);
|
||||
ts = open ("/dev/ts", O_RDONLY);
|
||||
if ( ts < 0 ) {
|
||||
fprintf (stderr, "IAL: Can not open touch screen!\n");
|
||||
return FALSE;
|
||||
@@ -180,15 +180,15 @@ BOOL InitADSInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
input->set_leds = NULL;
|
||||
|
||||
input->wait_event = wait_event;
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermADSInput (void)
|
||||
{
|
||||
if ( ts >= 0 )
|
||||
close(ts);
|
||||
if ( ts >= 0 )
|
||||
close(ts);
|
||||
}
|
||||
|
||||
#endif /* _ADS_IAL */
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** ads7846.c: Low Level Input Engine for Arca Tpanel Ads7846.
|
||||
**
|
||||
**
|
||||
** Created by Peng Ke, 2004/05/217
|
||||
*/
|
||||
|
||||
@@ -91,13 +91,8 @@ static int mouse_getbutton(void)
|
||||
return mouse_button;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -109,17 +104,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && tpfd >= 0) {
|
||||
FD_SET (tpfd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (tpfd > maxfd) maxfd = tpfd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
if ( select (maxfd + 1, in, out, except, timeout) < 0 )
|
||||
#else
|
||||
if ( select (FD_SETSIZE, in, out, except, timeout) < 0 )
|
||||
#endif
|
||||
return -1;
|
||||
if (select (maxfd + 1, in, out, except, timeout) < 0)
|
||||
return -1;
|
||||
|
||||
if (tpfd >= 0 && FD_ISSET (tpfd, in))
|
||||
{
|
||||
@@ -147,8 +136,8 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
}
|
||||
else {
|
||||
fprintf (stderr, "read pos data error!\n");
|
||||
return -1;
|
||||
fprintf (stderr, "read pos data error!\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,8 +152,8 @@ BOOL InitAds7846Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
return FALSE;
|
||||
}
|
||||
ioctl(tpfd, 14, 0, 0);
|
||||
|
||||
input->update_mouse = mouse_update;
|
||||
|
||||
input->update_mouse = mouse_update;
|
||||
input->get_mouse_xy = mouse_getxy;
|
||||
input->set_mouse_xy = NULL;
|
||||
input->get_mouse_button = mouse_getbutton;
|
||||
@@ -176,7 +165,7 @@ BOOL InitAds7846Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
|
||||
input->wait_event = wait_event;
|
||||
mousex = mousey = mouse_button = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** arm3000.c: Low Level Input Engine for UP-NETARM3000
|
||||
**
|
||||
**
|
||||
** Created by Yao Yunyuan, 2004/08/20
|
||||
*/
|
||||
|
||||
@@ -185,13 +185,8 @@ static const char* keyboard_getstate(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -204,24 +199,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
if ((which & IAL_KEYEVENT) && btn_fd >= 0){
|
||||
FD_SET (btn_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if(btn_fd > maxfd) maxfd = btn_fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
short data [4];
|
||||
|
||||
@@ -289,7 +275,7 @@ BOOL InitARM3000Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
pos.x = pos.y = pos.b = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** auto.c: Automatic Input Engine
|
||||
**
|
||||
**
|
||||
** Created by Wei Yongming, 2004/01/29
|
||||
*/
|
||||
|
||||
@@ -152,16 +152,16 @@ static int get_auto_event(void)
|
||||
int n_read = read (fd_script, &event, sizeof (event));
|
||||
|
||||
if (n_read != sizeof (event)) {
|
||||
|
||||
|
||||
if (errno != EAGAIN) {
|
||||
/* reach EOF */
|
||||
|
||||
|
||||
char* loop = getenv ("MG_ENV_IAL_AUTO_REPLAY");
|
||||
|
||||
if (loop) { /* try to replay */
|
||||
time_started = 0; /* reset time_started */
|
||||
lseek (fd_script, 0, SEEK_SET);
|
||||
|
||||
|
||||
n_read = read (fd_script, &event, sizeof(event));
|
||||
if (n_read == sizeof (event) ) {
|
||||
goto got;
|
||||
@@ -230,7 +230,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
if (timeout == NULL) {
|
||||
/* modify timeout value */
|
||||
mytimeout.tv_sec = (time_t)(steptime / 1000);
|
||||
mytimeout.tv_usec =
|
||||
mytimeout.tv_usec =
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
(suseconds_t)
|
||||
#endif
|
||||
@@ -241,7 +241,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
if (steptime < (timeout->tv_sec * 1000 + timeout->tv_usec / 1000)) {
|
||||
/* modify timeout value */
|
||||
timeout->tv_sec = (time_t)(steptime / 1000);
|
||||
timeout->tv_usec =
|
||||
timeout->tv_usec =
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
(suseconds_t)
|
||||
#endif
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -69,12 +69,12 @@
|
||||
|
||||
/* for data reading from /dev/ts */
|
||||
typedef struct {
|
||||
int x,y;
|
||||
int dx,dy;
|
||||
int event;
|
||||
int pressure;
|
||||
int ev_no;
|
||||
unsigned long ev_time;
|
||||
int x,y;
|
||||
int dx,dy;
|
||||
int event;
|
||||
int pressure;
|
||||
int ev_no;
|
||||
unsigned long ev_time;
|
||||
}TS_EVENT;
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
int e;
|
||||
int bytes_read=0;
|
||||
int bytes_read=0;
|
||||
if (!in) {
|
||||
in = &rfds;
|
||||
FD_ZERO (in);
|
||||
@@ -134,31 +134,31 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
|
||||
if (e > 0)
|
||||
{
|
||||
if (ts >= 0 && FD_ISSET (ts, in))
|
||||
{
|
||||
if (e > 0)
|
||||
{
|
||||
if (ts >= 0 && FD_ISSET (ts, in))
|
||||
{
|
||||
FD_CLR (ts, in);
|
||||
//usleep(1);
|
||||
//usleep(1);
|
||||
ts_event.x=0;
|
||||
ts_event.y=0;
|
||||
|
||||
bytes_read = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
bytes_read = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
while(bytes_read<sizeof(TS_EVENT))
|
||||
bytes_read+=read(ts,(char *)&ts_event + bytes_read,sizeof(TS_EVENT) - bytes_read);
|
||||
bytes_read+=read(ts,(char *)&ts_event + bytes_read,sizeof(TS_EVENT) - bytes_read);
|
||||
|
||||
|
||||
|
||||
mousex = ts_event.x;
|
||||
mousey = ts_event.y;
|
||||
|
||||
mousex = ts_event.x;
|
||||
mousey = ts_event.y;
|
||||
|
||||
// printf ("mouse down: ts_event.x = %d, ts_event.y = %d\n", ts_event.x, ts_event.y);
|
||||
|
||||
ts_event.pressure = ( ts_event.pressure == 0 ? IAL_MOUSE_LEFTBUTTON:0);
|
||||
|
||||
ts_event.pressure = ( ts_event.pressure == 0 ? IAL_MOUSE_LEFTBUTTON:0);
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -184,15 +184,15 @@ BOOL InitC33L05Input(INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
ts_event.x = ts_event.y = 0;
|
||||
ts_event.pressure &= 0;
|
||||
|
||||
ts_event.pressure &= 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermC33L05Input(void)
|
||||
{
|
||||
if (ts >= 0)
|
||||
close(ts);
|
||||
close(ts);
|
||||
}
|
||||
|
||||
#endif /* __TARGET_C33L05__ */
|
||||
|
||||
172
src/ial/calib.c
172
src/ial/calib.c
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -55,104 +55,104 @@
|
||||
#define MAXY 7
|
||||
#define NOISX 900
|
||||
#define NOISY 1900
|
||||
#define DEVICE "/dev/ts"
|
||||
#define DEVICE "/dev/ts"
|
||||
|
||||
struct point {
|
||||
int x;
|
||||
int y;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
main()
|
||||
{
|
||||
struct point array[MAXX][MAXY];
|
||||
int fd,size,i,j;
|
||||
struct point temp,temp1;
|
||||
fd_set rset;
|
||||
char nouse[10];
|
||||
struct point array[MAXX][MAXY];
|
||||
int fd,size,i,j;
|
||||
struct point temp,temp1;
|
||||
fd_set rset;
|
||||
char nouse[10];
|
||||
|
||||
i=j=0;
|
||||
if((fd=open(DEVICE,O_RDONLY)) == -1)
|
||||
{
|
||||
perror("open1");
|
||||
exit(1);
|
||||
}
|
||||
i=j=0;
|
||||
if((fd=open(DEVICE,O_RDONLY)) == -1)
|
||||
{
|
||||
perror("open1");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
temp1.x=NOISX;
|
||||
temp1.y=NOISY;
|
||||
ioctl(fd, TSTHRESHOLD, &temp1);
|
||||
temp1.x=NOISX;
|
||||
temp1.y=NOISY;
|
||||
ioctl(fd, TSTHRESHOLD, &temp1);
|
||||
|
||||
|
||||
for( i = 0 ; i < MAXX; i++ )
|
||||
{
|
||||
for(j = 0 ; j < MAXY; j ++)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
FD_ZERO(&rset);
|
||||
FD_SET(fd,&rset);
|
||||
FD_SET(STDIN_FILENO,&rset);
|
||||
select(fd+1,&rset,NULL,NULL,0);
|
||||
for( i = 0 ; i < MAXX; i++ )
|
||||
{
|
||||
for(j = 0 ; j < MAXY; j ++)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
FD_ZERO(&rset);
|
||||
FD_SET(fd,&rset);
|
||||
FD_SET(STDIN_FILENO,&rset);
|
||||
select(fd+1,&rset,NULL,NULL,0);
|
||||
|
||||
if(FD_ISSET(fd,&rset))
|
||||
{
|
||||
if((size = read(fd,&temp,sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
if(temp.x != 0 && temp.y!= 0)
|
||||
temp1=temp;
|
||||
if(FD_ISSET(fd,&rset))
|
||||
{
|
||||
if((size = read(fd,&temp,sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
if(temp.x != 0 && temp.y!= 0)
|
||||
temp1=temp;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"%d,%d",temp.x,temp.y);
|
||||
#endif
|
||||
}
|
||||
if(FD_ISSET(STDIN_FILENO, &rset))
|
||||
{
|
||||
gets(nouse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(FD_ISSET(STDIN_FILENO, &rset))
|
||||
{
|
||||
gets(nouse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
array[i][j] = temp1;
|
||||
array[i][j] = temp1;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"%d,%d\n",temp1.x,temp1.y);
|
||||
fprintf(stderr,"%d,%d\n",temp1.x,temp1.y);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* while(1)
|
||||
{
|
||||
if((size = read(fd,&temp,sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
/* while(1)
|
||||
{
|
||||
if((size = read(fd,&temp,sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
array[i][j] = temp;
|
||||
array[i][j] = temp;
|
||||
|
||||
if(j == MAXY-1)
|
||||
{
|
||||
j=0;
|
||||
i++;
|
||||
if(i == MAXX)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
*/ close(fd);
|
||||
if(j == MAXY-1)
|
||||
{
|
||||
j=0;
|
||||
i++;
|
||||
if(i == MAXX)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
*/ close(fd);
|
||||
|
||||
if((fd = open("data.conf",O_CREAT|O_WRONLY,0666)) == -1)
|
||||
{
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
if((fd = open("data.conf",O_CREAT|O_WRONLY,0666)) == -1)
|
||||
{
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if((size=write(fd, &array,MAXX*MAXY*sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("write error");
|
||||
exit(1);
|
||||
}
|
||||
close(fd);
|
||||
if((size=write(fd, &array,MAXX*MAXY*sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("write error");
|
||||
exit(1);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
#define dbg() printf("%s %d\n", __FUNCTION__, __LINE__)
|
||||
|
||||
/*
|
||||
** cisco_touchpad.c: Input Engine for Cisco touchpad
|
||||
** cisco_touchpad.c: Input Engine for Cisco touchpad
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@@ -54,16 +54,16 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include "mgsock.h"
|
||||
#include "minigui.h"
|
||||
#include "ial.h"
|
||||
#include "ial.h"
|
||||
#include "native/native.h"
|
||||
#include "cisco_touchpad.h"
|
||||
#include "window.h"
|
||||
@@ -92,8 +92,8 @@ static KBDDEVICE * kbddev = &kbddev_event;
|
||||
static MOUSEDEVICE * mousedev = &mousedev_IMPS2;
|
||||
static int scale; /* acceleration scale factor */
|
||||
static int thresh; /* acceleration threshhold */
|
||||
static int buttons = 0;
|
||||
static int s_current_mode = -1;
|
||||
static int buttons = 0;
|
||||
static int s_current_mode = -1;
|
||||
static int s_expect_mode = MICE_MODE;
|
||||
static int kbd_fd = -1;
|
||||
static int mouse_fd = -1;
|
||||
@@ -102,7 +102,7 @@ static char state[NR_KEYS];
|
||||
static int s_enable_appmode;
|
||||
|
||||
void mg_ial_ioctl(unsigned int cmd, unsigned int value)
|
||||
{
|
||||
{
|
||||
if (s_enable_appmode) {
|
||||
if (cmd == CMD_SET_MODE) {
|
||||
switch (value) {
|
||||
@@ -122,7 +122,7 @@ void mg_ial_ioctl(unsigned int cmd, unsigned int value)
|
||||
|
||||
static int touchpad_set_mode(int mode) {
|
||||
int ret = 0;
|
||||
unsigned char packet[] = { 0x00, 0x04,0x81,0x00 };
|
||||
unsigned char packet[] = { 0x00, 0x04,0x81,0x00 };
|
||||
if(mode == MICE_MODE) {
|
||||
packet[sizeof(packet)-1] = 0x00;
|
||||
ret = write(app_fd, packet, sizeof(packet));
|
||||
@@ -130,7 +130,7 @@ static int touchpad_set_mode(int mode) {
|
||||
memset(state, 0, NR_KEYS);
|
||||
packet[sizeof(packet)-1] = 0x03;
|
||||
ret = write(app_fd, packet, sizeof(packet));
|
||||
}
|
||||
}
|
||||
if (ret < 0) {
|
||||
perror("write()");
|
||||
}
|
||||
@@ -138,8 +138,8 @@ static int touchpad_set_mode(int mode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************ Low Level Input Operations **********************/
|
||||
/* * Mouse operations -- Event */
|
||||
/************************ Low Level Input Operations **********************/
|
||||
/* * Mouse operations -- Event */
|
||||
static int mouse_update (void)
|
||||
{
|
||||
if(MICE_MODE == s_current_mode) {
|
||||
@@ -246,13 +246,13 @@ static int mouse_resume(void)
|
||||
static int keyboard_update (void)
|
||||
{
|
||||
int retvalue = 0;
|
||||
if(MICE_MODE == s_current_mode) {
|
||||
if(MICE_MODE == s_current_mode) {
|
||||
unsigned char buf;
|
||||
int modifier;
|
||||
int ch;
|
||||
int is_pressed;
|
||||
|
||||
retvalue = kbddev->Read (&buf, &modifier);
|
||||
retvalue = kbddev->Read (&buf, &modifier);
|
||||
if ((retvalue == -1) || (retvalue == 0)) {
|
||||
return 0;
|
||||
} else { /* retvalue > 0 */
|
||||
@@ -265,7 +265,7 @@ static int keyboard_update (void)
|
||||
state[ch] = 0;
|
||||
}
|
||||
// printf("is_pressed=%d, ch=%d, state[%d]=%d\n", is_pressed, ch, ch, state[ch]);
|
||||
}
|
||||
}
|
||||
return NR_KEYS;
|
||||
} else if(APP_MODE == s_current_mode) {
|
||||
unsigned char buf[16];
|
||||
@@ -305,7 +305,7 @@ static int keyboard_update (void)
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static const char* keyboard_getstate (void)
|
||||
{
|
||||
@@ -349,7 +349,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
}
|
||||
}
|
||||
|
||||
if( MICE_MODE == s_current_mode) {
|
||||
if( MICE_MODE == s_current_mode) {
|
||||
if (which & IAL_MOUSEEVENT && mouse_fd >= 0) {
|
||||
fd = mouse_fd;
|
||||
mg_fd_set (fd, in);
|
||||
@@ -376,12 +376,12 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
if (fd >= 0 && FD_ISSET (fd, in)) {
|
||||
FD_CLR (fd, in);
|
||||
retvalue |= IAL_KEYEVENT;
|
||||
}
|
||||
} else if (e < 0) {
|
||||
}
|
||||
} else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
return retvalue;
|
||||
} else {
|
||||
} else {
|
||||
static int s_app_key;
|
||||
static int s_app_key_status = -1; /* -1: empty, 0:up, but not send to app yet, 1:down */
|
||||
unsigned char buf[16];
|
||||
@@ -423,7 +423,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if (e < 0) {
|
||||
}else if (e < 0) {
|
||||
return -1;
|
||||
}else{ /* timedout */
|
||||
if (s_app_key_status == 0) {
|
||||
@@ -432,12 +432,12 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void keyboard_suspend(void)
|
||||
{
|
||||
kbddev->Suspend();
|
||||
kbddev->Suspend();
|
||||
kbd_fd = -1;
|
||||
}
|
||||
|
||||
@@ -492,14 +492,14 @@ BOOL InitCiscoTouchpadInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
system("mknod "KBD" c 13 64 > /dev/null 2>&1");
|
||||
kbd_fd = keyboard_open(keyboard_device);
|
||||
if (kbd_fd < 0) {
|
||||
fprintf (stderr, "[WARNING] IAL Native Engine: Can not init keyboard right now, %s(%s).\nPlease plug in the KEYBOARD!\n",
|
||||
fprintf (stderr, "[WARNING] IAL Native Engine: Can not init keyboard right now, %s(%s).\nPlease plug in the KEYBOARD!\n",
|
||||
strerror(errno), keyboard_device);
|
||||
}
|
||||
}
|
||||
|
||||
mouse_fd = mouse_open(mdev);
|
||||
if (mouse_fd <0) {
|
||||
fprintf (stderr, "[WARNING] IAL Native Engine: Can not init mouse right now, %s(%s).\nPlease plug in the MOUSE!\n",
|
||||
fprintf (stderr, "[WARNING] IAL Native Engine: Can not init mouse right now, %s(%s).\nPlease plug in the MOUSE!\n",
|
||||
strerror(errno), mdev);
|
||||
}
|
||||
|
||||
@@ -547,12 +547,12 @@ BOOL InitCiscoTouchpadInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
input->resume_keyboard = keyboard_resume;
|
||||
input->set_leds = NULL;
|
||||
|
||||
input->wait_event = wait_event;
|
||||
input->wait_event = wait_event;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermCiscoTouchpadInput (void)
|
||||
{
|
||||
{
|
||||
if (mousedev)
|
||||
mousedev->Close();
|
||||
|
||||
@@ -565,3 +565,4 @@ void TermCiscoTouchpadInput (void)
|
||||
}
|
||||
}
|
||||
#endif // _MGIAL_CISCO_TOUCHPAD
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT NOTICE
|
||||
//
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -98,9 +98,9 @@ typedef struct {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int pressure;
|
||||
int x;
|
||||
int y;
|
||||
int pressure;
|
||||
}MOUSE_EVENT;
|
||||
|
||||
#define IAL_MOUSE_LEFTBUTTON 1
|
||||
@@ -134,15 +134,15 @@ static int mouse_update(void)
|
||||
static void mouse_getxy(int *x, int* y)
|
||||
{
|
||||
#if 0
|
||||
if (mousex < 0)
|
||||
mousex = 0;
|
||||
if (mousex > 720)
|
||||
mousex = 720;
|
||||
if (mousex < 0)
|
||||
mousex = 0;
|
||||
if (mousex > 720)
|
||||
mousex = 720;
|
||||
|
||||
if (mousey < 0)
|
||||
mousey = 0;
|
||||
if (mousey > 576)
|
||||
mousey = 576;
|
||||
if (mousey < 0)
|
||||
mousey = 0;
|
||||
if (mousey > 576)
|
||||
mousey = 576;
|
||||
#endif
|
||||
*x = mousex;
|
||||
*y = mousey;
|
||||
@@ -180,8 +180,8 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0)
|
||||
{
|
||||
if (e > 0)
|
||||
{
|
||||
if (FD_ISSET (mouse_fd, in))
|
||||
{
|
||||
n = read (mouse_fd, buf, 4);
|
||||
@@ -212,40 +212,40 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL InitDavinci6446Input(INPUT* input, const char* mdev, const char* mtype)
|
||||
{
|
||||
mouse_fd = open (mdev, O_RDWR | O_NONBLOCK);
|
||||
if (mouse_fd < 0)
|
||||
{
|
||||
printf ("Can not open mouse !\n");
|
||||
if (mouse_fd < 0)
|
||||
{
|
||||
printf ("Can not open mouse !\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
input->update_mouse = mouse_update;
|
||||
input->get_mouse_xy = mouse_getxy;
|
||||
input->set_mouse_xy = NULL;
|
||||
input->get_mouse_button = mouse_getbutton;
|
||||
input->set_mouse_range = NULL;
|
||||
|
||||
input->update_keyboard = NULL;
|
||||
|
||||
input->update_keyboard = NULL;
|
||||
input->get_keyboard_state = NULL;
|
||||
|
||||
input->wait_event = wait_event;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermDavinci6446Input(void)
|
||||
{
|
||||
if (mouse_fd >= 0)
|
||||
close(mouse_fd);
|
||||
close(mouse_fd);
|
||||
}
|
||||
|
||||
#endif /* _MGIAL_DAVINCI6446 */
|
||||
|
||||
227
src/ial/dfb.c
227
src/ial/dfb.c
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** dfb.c: Low Level Input Engine for DirectFB.
|
||||
**
|
||||
**
|
||||
** Created by Xiaogang Du, 2005/12/15
|
||||
*/
|
||||
|
||||
@@ -70,12 +70,12 @@
|
||||
extern IDirectFB *__mg_dfb;
|
||||
extern IDirectFBSurface *pFrameBuffer;
|
||||
|
||||
typedef struct _DeviceInfo DeviceInfo;
|
||||
|
||||
struct _DeviceInfo {
|
||||
DFBInputDeviceID device_id;
|
||||
DFBInputDeviceDescription desc;
|
||||
DeviceInfo *next;
|
||||
typedef struct _DeviceInfo DeviceInfo;
|
||||
|
||||
struct _DeviceInfo {
|
||||
DFBInputDeviceID device_id;
|
||||
DFBInputDeviceDescription desc;
|
||||
DeviceInfo *next;
|
||||
};
|
||||
|
||||
static int screen_height = 0;
|
||||
@@ -91,21 +91,21 @@ static int dev_fd;
|
||||
static int mouse_x = 0;
|
||||
static int mouse_y = 0;
|
||||
static int mouse_button = 0;
|
||||
|
||||
|
||||
static void mouse_update(void)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mouse_getxy (int* x, int* y)
|
||||
{
|
||||
*x = mouse_x;
|
||||
*x = mouse_x;
|
||||
*y = mouse_y;
|
||||
}
|
||||
|
||||
static int mouse_getbutton(void)
|
||||
{
|
||||
return mouse_button;
|
||||
return mouse_button;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,9 +227,9 @@ static unsigned int keycode_to_scancode (unsigned int keycode)
|
||||
return SCANCODE_CURSORBLOCKLEFT;
|
||||
case 61441:
|
||||
return SCANCODE_CURSORBLOCKRIGHT;
|
||||
case 61442:
|
||||
case 61442:
|
||||
return SCANCODE_CURSORBLOCKUP;
|
||||
case 61443:
|
||||
case 61443:
|
||||
return SCANCODE_CURSORBLOCKDOWN;
|
||||
case 61445:
|
||||
return SCANCODE_HOME;
|
||||
@@ -263,38 +263,33 @@ static const char *keyboard_get_state(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
int retvalue = 0;
|
||||
//DFBEvent evt;
|
||||
DFBInputEvent evt;
|
||||
DFBInputEvent evt;
|
||||
|
||||
if (evtbuf->WaitForEventWithTimeout( evtbuf, 10, 0 ) == DFB_TIMEOUT)
|
||||
{
|
||||
return 0;
|
||||
//sleep( 1 );
|
||||
if (evtbuf->WaitForEventWithTimeout( evtbuf, 10, 0 ) == DFB_TIMEOUT)
|
||||
{
|
||||
return 0;
|
||||
//sleep( 1 );
|
||||
}
|
||||
else{
|
||||
else{
|
||||
/* TODO: support mouse right button */
|
||||
DFBInputDeviceButtonMask mouse_mask = 0;
|
||||
int res = evtbuf->GetEvent(evtbuf, DFB_EVENT(&evt));
|
||||
if(res == DFB_OK)
|
||||
{
|
||||
//fprintf(stderr, "**********evt.axis=%d********\n", evt.axis);
|
||||
}
|
||||
|
||||
if (mouse_device != NULL)
|
||||
int res = evtbuf->GetEvent(evtbuf, DFB_EVENT(&evt));
|
||||
if(res == DFB_OK)
|
||||
{
|
||||
//fprintf(stderr, "**********evt.axis=%d********\n", evt.axis);
|
||||
}
|
||||
|
||||
if (mouse_device != NULL)
|
||||
mouse_device->GetButtons(mouse_device, &mouse_mask);
|
||||
|
||||
//FD_CLR (dev_fd, in);
|
||||
switch (evt.type) {
|
||||
case DIET_KEYPRESS:
|
||||
//FD_CLR (dev_fd, in);
|
||||
switch (evt.type) {
|
||||
case DIET_KEYPRESS:
|
||||
{
|
||||
curkey = evt.key_symbol;
|
||||
int pckey = keycode_to_scancode(curkey);
|
||||
@@ -303,8 +298,8 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
retvalue |= IAL_KEYEVENT;
|
||||
}
|
||||
break;
|
||||
case DIET_KEYRELEASE:
|
||||
break;
|
||||
case DIET_KEYRELEASE:
|
||||
{
|
||||
curkey = evt.key_symbol;
|
||||
int pckey = keycode_to_scancode(curkey);
|
||||
@@ -314,84 +309,84 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
retvalue |= IAL_KEYEVENT;
|
||||
}
|
||||
break;
|
||||
case DIET_AXISMOTION:
|
||||
case DIET_BUTTONPRESS:
|
||||
case DIET_BUTTONRELEASE:
|
||||
if (evt.flags & DIEF_AXISABS) {
|
||||
switch (evt.axis) {
|
||||
case DIAI_X:
|
||||
mouse_x = evt.axisabs;
|
||||
break;
|
||||
case DIAI_Y:
|
||||
mouse_y = evt.axisabs;
|
||||
break;
|
||||
case DIAI_Z:
|
||||
fprintf (stderr, "Z axis (abs): %d", evt.axisabs);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Axis %d (abs): %d", evt.axis, evt.axisabs);
|
||||
break;
|
||||
}
|
||||
} else if (evt.flags & DIEF_AXISREL) {
|
||||
switch (evt.axis) {
|
||||
case DIAI_X:
|
||||
mouse_x += evt.axisrel;
|
||||
if(mouse_x > screen_width)
|
||||
mouse_x = screen_width;
|
||||
if(mouse_x < 0)
|
||||
mouse_x = 0;
|
||||
break;
|
||||
case DIAI_Y:
|
||||
mouse_y += evt.axisrel;
|
||||
if(mouse_y > screen_height)
|
||||
mouse_y = screen_height;
|
||||
if(mouse_y < 0)
|
||||
mouse_y = 0;
|
||||
break;
|
||||
case DIAI_Z:
|
||||
fprintf (stderr, "Z axis (rel): %d", evt.axisrel);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Axis %d (rel): %d", evt.axis, evt.axisrel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((DIET_BUTTONPRESS == evt.type) || (DIET_BUTTONRELEASE == evt.type))
|
||||
{
|
||||
break;
|
||||
case DIET_AXISMOTION:
|
||||
case DIET_BUTTONPRESS:
|
||||
case DIET_BUTTONRELEASE:
|
||||
if (evt.flags & DIEF_AXISABS) {
|
||||
switch (evt.axis) {
|
||||
case DIAI_X:
|
||||
mouse_x = evt.axisabs;
|
||||
break;
|
||||
case DIAI_Y:
|
||||
mouse_y = evt.axisabs;
|
||||
break;
|
||||
case DIAI_Z:
|
||||
fprintf (stderr, "Z axis (abs): %d", evt.axisabs);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Axis %d (abs): %d", evt.axis, evt.axisabs);
|
||||
break;
|
||||
}
|
||||
} else if (evt.flags & DIEF_AXISREL) {
|
||||
switch (evt.axis) {
|
||||
case DIAI_X:
|
||||
mouse_x += evt.axisrel;
|
||||
if(mouse_x > screen_width)
|
||||
mouse_x = screen_width;
|
||||
if(mouse_x < 0)
|
||||
mouse_x = 0;
|
||||
break;
|
||||
case DIAI_Y:
|
||||
mouse_y += evt.axisrel;
|
||||
if(mouse_y > screen_height)
|
||||
mouse_y = screen_height;
|
||||
if(mouse_y < 0)
|
||||
mouse_y = 0;
|
||||
break;
|
||||
case DIAI_Z:
|
||||
fprintf (stderr, "Z axis (rel): %d", evt.axisrel);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Axis %d (rel): %d", evt.axis, evt.axisrel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((DIET_BUTTONPRESS == evt.type) || (DIET_BUTTONRELEASE == evt.type))
|
||||
{
|
||||
#if 0
|
||||
if((IAL_MOUSE_LEFTBUTTON | IAL_MOUSE_RIGHTBUTTON) == mouse_button) {
|
||||
mouse_button = 0;
|
||||
if((IAL_MOUSE_LEFTBUTTON | IAL_MOUSE_RIGHTBUTTON) == mouse_button) {
|
||||
mouse_button = 0;
|
||||
} else {
|
||||
if (mouse_mask == DIBM_RIGHT)
|
||||
mouse_button = IAL_MOUSE_RIGHTBUTTON;
|
||||
mouse_button = IAL_MOUSE_RIGHTBUTTON;
|
||||
else
|
||||
mouse_button = IAL_MOUSE_LEFTBUTTON;
|
||||
mouse_button = IAL_MOUSE_LEFTBUTTON;
|
||||
}
|
||||
#endif
|
||||
if(IAL_MOUSE_LEFTBUTTON == mouse_button)
|
||||
mouse_button = 0;
|
||||
else
|
||||
mouse_button = IAL_MOUSE_LEFTBUTTON;
|
||||
}
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return retvalue;
|
||||
}
|
||||
static DFBEnumerationResult
|
||||
enum_input_device( DFBInputDeviceID device_id, DFBInputDeviceDescription desc, void *data )
|
||||
{
|
||||
DeviceInfo **devices = data;
|
||||
DeviceInfo *device;
|
||||
device = malloc( sizeof(DeviceInfo) );
|
||||
device->device_id = device_id;
|
||||
device->desc = desc;
|
||||
device->next = *devices;
|
||||
*devices = device;
|
||||
return DFENUM_OK;
|
||||
DeviceInfo **devices = data;
|
||||
DeviceInfo *device;
|
||||
device = malloc( sizeof(DeviceInfo) );
|
||||
device->device_id = device_id;
|
||||
device->desc = desc;
|
||||
device->next = *devices;
|
||||
*devices = device;
|
||||
return DFENUM_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -401,27 +396,27 @@ BOOL InitDFBInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
DFBResult ret;
|
||||
DeviceInfo *device = NULL;
|
||||
|
||||
//DeviceInfo *devices = NULL;
|
||||
//__mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices );
|
||||
__mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices_info );
|
||||
ret = __mg_dfb->CreateInputEventBuffer(__mg_dfb, DICAPS_ALL, DFB_FALSE, &evtbuf);
|
||||
//DeviceInfo *devices = NULL;
|
||||
//__mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices );
|
||||
__mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices_info );
|
||||
ret = __mg_dfb->CreateInputEventBuffer(__mg_dfb, DICAPS_ALL, DFB_FALSE, &evtbuf);
|
||||
if (ret) {
|
||||
fprintf(stderr, "CreateInputEventBuffer error\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* get dfb mouse device */
|
||||
device = devices_info;
|
||||
device = devices_info;
|
||||
while (device != NULL) {
|
||||
if (device->desc.type == DIDTF_MOUSE) {
|
||||
__mg_dfb->GetInputDevice(__mg_dfb, device->device_id, mouse_device);
|
||||
break;
|
||||
}
|
||||
|
||||
device = device->next;
|
||||
device = device->next;
|
||||
}
|
||||
|
||||
pFrameBuffer->GetSize(pFrameBuffer, &screen_width, &screen_height);
|
||||
pFrameBuffer->GetSize(pFrameBuffer, &screen_width, &screen_height);
|
||||
|
||||
memset (state, 0, sizeof (state));
|
||||
|
||||
@@ -442,10 +437,10 @@ BOOL InitDFBInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
|
||||
void TermDFBInput (void)
|
||||
{
|
||||
DeviceInfo *device = devices_info;
|
||||
DeviceInfo *device = devices_info;
|
||||
while (devices_info != NULL) {
|
||||
device = devices_info;
|
||||
devices_info = devices_info->next;
|
||||
devices_info = devices_info->next;
|
||||
free(device);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** dm270.c: Low Level Input Engine for DigiPro DM270.
|
||||
**
|
||||
**
|
||||
** Created by Yao Yunyuan, 2004/08/20
|
||||
*/
|
||||
|
||||
@@ -138,13 +138,8 @@ static const char* keyboard_getstate(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -158,17 +153,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_KEYEVENT) && btn_fd >= 0){
|
||||
FD_SET (btn_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if(btn_fd > maxfd) maxfd = btn_fd;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
if (e > 0) {
|
||||
if (btn_fd >= 0 && FD_ISSET(btn_fd, in)) {
|
||||
FD_CLR(btn_fd, in);
|
||||
read(btn_fd, &readkey, sizeof(readkey));
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** dmg-stb.c: IAL Engine for Intel DMG GEN10 STB.
|
||||
**
|
||||
**
|
||||
** Author: Wei Yongming (2003/12/14)
|
||||
*/
|
||||
|
||||
@@ -89,7 +89,7 @@ static int mouse_getbutton(void)
|
||||
static unsigned int cur_key;
|
||||
static unsigned char state [NR_KEYS];
|
||||
|
||||
static unsigned char ir2kbd_map_b1 [] =
|
||||
static unsigned char ir2kbd_map_b1 [] =
|
||||
{
|
||||
0, // 0
|
||||
0, // 1
|
||||
@@ -98,7 +98,7 @@ static unsigned char ir2kbd_map_b1 [] =
|
||||
DMG_KB_BACK, // 4
|
||||
};
|
||||
|
||||
static unsigned char ir2kbd_map_b2 [] =
|
||||
static unsigned char ir2kbd_map_b2 [] =
|
||||
{
|
||||
0, // 0
|
||||
DMG_KB_UP, // 1
|
||||
@@ -111,14 +111,14 @@ static unsigned char ir2kbd_map_b2 [] =
|
||||
DMG_KB_RIGHT, // 8
|
||||
};
|
||||
|
||||
static unsigned char ir2kbd_map_b3 [] =
|
||||
static unsigned char ir2kbd_map_b3 [] =
|
||||
{
|
||||
0, // 0
|
||||
DMG_KB_PLAY, // 1
|
||||
DMG_KB_STOP, // 2
|
||||
};
|
||||
|
||||
static unsigned char ir2kbd_map_b4 [] =
|
||||
static unsigned char ir2kbd_map_b4 [] =
|
||||
{
|
||||
0, // 0
|
||||
0, // 1
|
||||
@@ -155,13 +155,8 @@ static const char * keyboard_get_state(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int e;
|
||||
@@ -173,18 +168,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_KEYEVENT) && ir_fd >= 0) {
|
||||
FD_SET (ir_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ir_fd > maxfd) maxfd = ir_fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e < 0)
|
||||
if (e < 0)
|
||||
return -1;
|
||||
|
||||
if (ir_fd >= 0 && FD_ISSET (ir_fd, in)) {
|
||||
|
||||
270
src/ial/em85.c
270
src/ial/em85.c
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -112,118 +112,118 @@ static struct _ir2key {
|
||||
} ir_pckey_map [] =
|
||||
{
|
||||
#if 0
|
||||
{NETSETUP_SCANCODE, SCANCODE_F6},
|
||||
{POWER_SCANCODE, SCANCODE_F9},
|
||||
{ONE_SCANCODE, SCANCODE_1},
|
||||
{TWO_SCANCODE, SCANCODE_2},
|
||||
{THREE_SCANCODE, SCANCODE_3},
|
||||
{FOUR_SCANCODE, SCANCODE_4},
|
||||
{FIVE_SCANCODE, SCANCODE_5},
|
||||
{SIX_SCANCODE, SCANCODE_6},
|
||||
{SEVEN_SCANCODE, SCANCODE_7},
|
||||
{EIGHT_SCANCODE, SCANCODE_8},
|
||||
{NINE_SCANCODE, SCANCODE_9},
|
||||
{DOT_SCANCODE, SCANCODE_PERIOD},
|
||||
{THERO_SCANCODE, SCANCODE_0},
|
||||
{BS_SCANCODE, SCANCODE_BACKSPACE}, //SCANCODE_REMOVE},
|
||||
{PAGEUP_SCANCODE, SCANCODE_F3},
|
||||
{PAGEDN_SCANCODE, SCANCODE_F4},
|
||||
{LEFT_SCANCODE, SCANCODE_CURSORBLOCKLEFT},
|
||||
{UP_SCANCODE, SCANCODE_CURSORBLOCKUP},
|
||||
{RIGHT_SCANCODE, SCANCODE_CURSORBLOCKRIGHT},
|
||||
{DOWN_SCANCODE, SCANCODE_CURSORBLOCKDOWN},
|
||||
{ENTER_SCANCODE, SCANCODE_ENTER},
|
||||
{VOLDN_SCANCODE, SCANCODE_MINUS},
|
||||
{VOLUP_SCANCODE, SCANCODE_EQUAL},
|
||||
{FRW_SCANCODE, SCANCODE_B},
|
||||
{PLAY_SCANCODE, SCANCODE_SPACE},
|
||||
{FFW_SCANCODE, SCANCODE_F},
|
||||
{PAUSE_SCANCODE, SCANCODE_P},
|
||||
{STOP_SCANCODE, SCANCODE_S},
|
||||
{MUTE_SCANCODE, SCANCODE_M},
|
||||
{REFRESH_SCANCODE, SCANCODE_F5},
|
||||
{HOME_SCANCODE, SCANCODE_F1},
|
||||
{TRACK_SCANCODE, SCANCODE_C},
|
||||
{WEB_SCANCODE, SCANCODE_F2},
|
||||
{VK_SCANCODE, SCANCODE_LEFTWIN}, //SCANCODE_F7},
|
||||
{OPTION_SCANCODE, SCANCODE_F7},
|
||||
{NETSETUP_SCANCODE, SCANCODE_F6},
|
||||
{POWER_SCANCODE, SCANCODE_F9},
|
||||
{ONE_SCANCODE, SCANCODE_1},
|
||||
{TWO_SCANCODE, SCANCODE_2},
|
||||
{THREE_SCANCODE, SCANCODE_3},
|
||||
{FOUR_SCANCODE, SCANCODE_4},
|
||||
{FIVE_SCANCODE, SCANCODE_5},
|
||||
{SIX_SCANCODE, SCANCODE_6},
|
||||
{SEVEN_SCANCODE, SCANCODE_7},
|
||||
{EIGHT_SCANCODE, SCANCODE_8},
|
||||
{NINE_SCANCODE, SCANCODE_9},
|
||||
{DOT_SCANCODE, SCANCODE_PERIOD},
|
||||
{THERO_SCANCODE, SCANCODE_0},
|
||||
{BS_SCANCODE, SCANCODE_BACKSPACE}, //SCANCODE_REMOVE},
|
||||
{PAGEUP_SCANCODE, SCANCODE_F3},
|
||||
{PAGEDN_SCANCODE, SCANCODE_F4},
|
||||
{LEFT_SCANCODE, SCANCODE_CURSORBLOCKLEFT},
|
||||
{UP_SCANCODE, SCANCODE_CURSORBLOCKUP},
|
||||
{RIGHT_SCANCODE, SCANCODE_CURSORBLOCKRIGHT},
|
||||
{DOWN_SCANCODE, SCANCODE_CURSORBLOCKDOWN},
|
||||
{ENTER_SCANCODE, SCANCODE_ENTER},
|
||||
{VOLDN_SCANCODE, SCANCODE_MINUS},
|
||||
{VOLUP_SCANCODE, SCANCODE_EQUAL},
|
||||
{FRW_SCANCODE, SCANCODE_B},
|
||||
{PLAY_SCANCODE, SCANCODE_SPACE},
|
||||
{FFW_SCANCODE, SCANCODE_F},
|
||||
{PAUSE_SCANCODE, SCANCODE_P},
|
||||
{STOP_SCANCODE, SCANCODE_S},
|
||||
{MUTE_SCANCODE, SCANCODE_M},
|
||||
{REFRESH_SCANCODE, SCANCODE_F5},
|
||||
{HOME_SCANCODE, SCANCODE_F1},
|
||||
{TRACK_SCANCODE, SCANCODE_C},
|
||||
{WEB_SCANCODE, SCANCODE_F2},
|
||||
{VK_SCANCODE, SCANCODE_LEFTWIN}, //SCANCODE_F7},
|
||||
{OPTION_SCANCODE, SCANCODE_F7},
|
||||
#endif
|
||||
//VCOM IR KEYBOARD
|
||||
{VCOM_IRKB_Esc, SCANCODE_ESCAPE},
|
||||
{VCOM_IRKB_1, SCANCODE_1},
|
||||
{VCOM_IRKB_2, SCANCODE_2},
|
||||
{VCOM_IRKB_3, SCANCODE_3},
|
||||
{VCOM_IRKB_4, SCANCODE_4},
|
||||
{VCOM_IRKB_5, SCANCODE_5},
|
||||
{VCOM_IRKB_6, SCANCODE_6},
|
||||
{VCOM_IRKB_7, SCANCODE_7},
|
||||
{VCOM_IRKB_8, SCANCODE_8},
|
||||
{VCOM_IRKB_9, SCANCODE_9},
|
||||
{VCOM_IRKB_0, SCANCODE_0},
|
||||
{VCOM_IRKB_MINUS, SCANCODE_MINUS},
|
||||
{VCOM_IRKB_EQUAL, SCANCODE_EQUAL},
|
||||
{VCOM_IRKB_Backspace, SCANCODE_BACKSPACE},
|
||||
{VCOM_IRKB_Esc, SCANCODE_ESCAPE},
|
||||
{VCOM_IRKB_1, SCANCODE_1},
|
||||
{VCOM_IRKB_2, SCANCODE_2},
|
||||
{VCOM_IRKB_3, SCANCODE_3},
|
||||
{VCOM_IRKB_4, SCANCODE_4},
|
||||
{VCOM_IRKB_5, SCANCODE_5},
|
||||
{VCOM_IRKB_6, SCANCODE_6},
|
||||
{VCOM_IRKB_7, SCANCODE_7},
|
||||
{VCOM_IRKB_8, SCANCODE_8},
|
||||
{VCOM_IRKB_9, SCANCODE_9},
|
||||
{VCOM_IRKB_0, SCANCODE_0},
|
||||
{VCOM_IRKB_MINUS, SCANCODE_MINUS},
|
||||
{VCOM_IRKB_EQUAL, SCANCODE_EQUAL},
|
||||
{VCOM_IRKB_Backspace, SCANCODE_BACKSPACE},
|
||||
|
||||
{VCOM_IRKB_Tab, SCANCODE_TAB},
|
||||
{VCOM_IRKB_Q, SCANCODE_Q},
|
||||
{VCOM_IRKB_W, SCANCODE_W},
|
||||
{VCOM_IRKB_E, SCANCODE_E},
|
||||
{VCOM_IRKB_R, SCANCODE_R},
|
||||
{VCOM_IRKB_T, SCANCODE_T},
|
||||
{VCOM_IRKB_Y, SCANCODE_Y},
|
||||
{VCOM_IRKB_U, SCANCODE_U},
|
||||
{VCOM_IRKB_I, SCANCODE_I},
|
||||
{VCOM_IRKB_O, SCANCODE_O},
|
||||
{VCOM_IRKB_P, SCANCODE_P},
|
||||
{VCOM_IRKB_Tab, SCANCODE_TAB},
|
||||
{VCOM_IRKB_Q, SCANCODE_Q},
|
||||
{VCOM_IRKB_W, SCANCODE_W},
|
||||
{VCOM_IRKB_E, SCANCODE_E},
|
||||
{VCOM_IRKB_R, SCANCODE_R},
|
||||
{VCOM_IRKB_T, SCANCODE_T},
|
||||
{VCOM_IRKB_Y, SCANCODE_Y},
|
||||
{VCOM_IRKB_U, SCANCODE_U},
|
||||
{VCOM_IRKB_I, SCANCODE_I},
|
||||
{VCOM_IRKB_O, SCANCODE_O},
|
||||
{VCOM_IRKB_P, SCANCODE_P},
|
||||
|
||||
{VCOM_IRKB_Caps, SCANCODE_CAPSLOCK},
|
||||
{VCOM_IRKB_A, SCANCODE_A},
|
||||
{VCOM_IRKB_S, SCANCODE_S},
|
||||
{VCOM_IRKB_D, SCANCODE_D},
|
||||
{VCOM_IRKB_F, SCANCODE_F},
|
||||
{VCOM_IRKB_G, SCANCODE_G},
|
||||
{VCOM_IRKB_H, SCANCODE_H},
|
||||
{VCOM_IRKB_J, SCANCODE_J},
|
||||
{VCOM_IRKB_K, SCANCODE_K},
|
||||
{VCOM_IRKB_L, SCANCODE_L},
|
||||
{VCOM_IRKB_SEMICOLON, SCANCODE_SEMICOLON},
|
||||
{VCOM_IRKB_Enter, SCANCODE_ENTER},
|
||||
{VCOM_IRKB_Caps, SCANCODE_CAPSLOCK},
|
||||
{VCOM_IRKB_A, SCANCODE_A},
|
||||
{VCOM_IRKB_S, SCANCODE_S},
|
||||
{VCOM_IRKB_D, SCANCODE_D},
|
||||
{VCOM_IRKB_F, SCANCODE_F},
|
||||
{VCOM_IRKB_G, SCANCODE_G},
|
||||
{VCOM_IRKB_H, SCANCODE_H},
|
||||
{VCOM_IRKB_J, SCANCODE_J},
|
||||
{VCOM_IRKB_K, SCANCODE_K},
|
||||
{VCOM_IRKB_L, SCANCODE_L},
|
||||
{VCOM_IRKB_SEMICOLON, SCANCODE_SEMICOLON},
|
||||
{VCOM_IRKB_Enter, SCANCODE_ENTER},
|
||||
|
||||
{VCOM_IRKB_Z, SCANCODE_Z},
|
||||
{VCOM_IRKB_X, SCANCODE_X},
|
||||
{VCOM_IRKB_C, SCANCODE_C},
|
||||
{VCOM_IRKB_V, SCANCODE_V},
|
||||
{VCOM_IRKB_B, SCANCODE_B},
|
||||
{VCOM_IRKB_N, SCANCODE_N},
|
||||
{VCOM_IRKB_M, SCANCODE_M},
|
||||
{VCOM_IRKB_COMMA, SCANCODE_COMMA},
|
||||
{VCOM_IRKB_PERIOD, SCANCODE_PERIOD},
|
||||
{VCOM_IRKB_SLASH, SCANCODE_SLASH},
|
||||
{VCOM_IRKB_Z, SCANCODE_Z},
|
||||
{VCOM_IRKB_X, SCANCODE_X},
|
||||
{VCOM_IRKB_C, SCANCODE_C},
|
||||
{VCOM_IRKB_V, SCANCODE_V},
|
||||
{VCOM_IRKB_B, SCANCODE_B},
|
||||
{VCOM_IRKB_N, SCANCODE_N},
|
||||
{VCOM_IRKB_M, SCANCODE_M},
|
||||
{VCOM_IRKB_COMMA, SCANCODE_COMMA},
|
||||
{VCOM_IRKB_PERIOD, SCANCODE_PERIOD},
|
||||
{VCOM_IRKB_SLASH, SCANCODE_SLASH},
|
||||
|
||||
{VCOM_IRKB_shift, SCANCODE_LEFTWIN}, // vkb //SCANCODE_LEFTSHIFT},
|
||||
{VCOM_IRKB_ctrl, SCANCODE_RIGHTWIN}, // ime //SCANCODE_LEFTCONTROL},
|
||||
{VCOM_IRKB_alt, SCANCODE_MENU}, // status bar //SCANCODE_LEFTALT},
|
||||
{VCOM_IRKB_shift, SCANCODE_LEFTWIN}, // vkb //SCANCODE_LEFTSHIFT},
|
||||
{VCOM_IRKB_ctrl, SCANCODE_RIGHTWIN}, // ime //SCANCODE_LEFTCONTROL},
|
||||
{VCOM_IRKB_alt, SCANCODE_MENU}, // status bar //SCANCODE_LEFTALT},
|
||||
|
||||
{VCOM_IRKB_Space, SCANCODE_SPACE},
|
||||
{VCOM_IRKB_Del, SCANCODE_REMOVE},
|
||||
{VCOM_IRKB_Up, SCANCODE_CURSORBLOCKUP},
|
||||
{VCOM_IRKB_Down, SCANCODE_CURSORBLOCKDOWN},
|
||||
{VCOM_IRKB_Pgup, SCANCODE_PAGEUP},
|
||||
{VCOM_IRKB_Pgdn, SCANCODE_PAGEDOWN},
|
||||
{VCOM_IRKB_Right, SCANCODE_CURSORBLOCKRIGHT},
|
||||
{VCOM_IRKB_Left, SCANCODE_CURSORBLOCKLEFT},
|
||||
{VCOM_IRKB_Space, SCANCODE_SPACE},
|
||||
{VCOM_IRKB_Del, SCANCODE_REMOVE},
|
||||
{VCOM_IRKB_Up, SCANCODE_CURSORBLOCKUP},
|
||||
{VCOM_IRKB_Down, SCANCODE_CURSORBLOCKDOWN},
|
||||
{VCOM_IRKB_Pgup, SCANCODE_PAGEUP},
|
||||
{VCOM_IRKB_Pgdn, SCANCODE_PAGEDOWN},
|
||||
{VCOM_IRKB_Right, SCANCODE_CURSORBLOCKRIGHT},
|
||||
{VCOM_IRKB_Left, SCANCODE_CURSORBLOCKLEFT},
|
||||
|
||||
{VCOM_IRKB_F1, SCANCODE_F1},
|
||||
{VCOM_IRKB_F2, SCANCODE_F2},
|
||||
{VCOM_IRKB_F3, SCANCODE_F3},
|
||||
{VCOM_IRKB_F4, SCANCODE_F4},
|
||||
{VCOM_IRKB_F5, SCANCODE_F5},
|
||||
{VCOM_IRKB_F6, SCANCODE_F6},
|
||||
{VCOM_IRKB_F7, SCANCODE_F7},
|
||||
{VCOM_IRKB_F8, SCANCODE_F8},
|
||||
{VCOM_IRKB_F9, SCANCODE_F9},
|
||||
{VCOM_IRKB_F10, SCANCODE_F10},
|
||||
{VCOM_IRKB_F11, SCANCODE_F11},
|
||||
{VCOM_IRKB_F1, SCANCODE_F1},
|
||||
{VCOM_IRKB_F2, SCANCODE_F2},
|
||||
{VCOM_IRKB_F3, SCANCODE_F3},
|
||||
{VCOM_IRKB_F4, SCANCODE_F4},
|
||||
{VCOM_IRKB_F5, SCANCODE_F5},
|
||||
{VCOM_IRKB_F6, SCANCODE_F6},
|
||||
{VCOM_IRKB_F7, SCANCODE_F7},
|
||||
{VCOM_IRKB_F8, SCANCODE_F8},
|
||||
{VCOM_IRKB_F9, SCANCODE_F9},
|
||||
{VCOM_IRKB_F10, SCANCODE_F10},
|
||||
{VCOM_IRKB_F11, SCANCODE_F11},
|
||||
};
|
||||
|
||||
static int
|
||||
@@ -279,13 +279,8 @@ static int gettime_ms (void)
|
||||
static unsigned long g_last_key_time = 0;
|
||||
#endif
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
unsigned int key = 0;
|
||||
int e = 0;
|
||||
@@ -296,11 +291,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
usleep(20000);
|
||||
|
||||
if (cur_key || button) {
|
||||
#ifdef _LITE_VERSION
|
||||
select(maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
select(FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
if (cur_key) {
|
||||
cur_key = 0;
|
||||
e = IAL_KEYEVENT;
|
||||
@@ -320,35 +311,28 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
FD_SET(fip_fd, in);
|
||||
|
||||
#if 1
|
||||
#ifdef _LITE_VERSION
|
||||
if (fip_fd > maxfd)
|
||||
maxfd = fip_fd;
|
||||
|
||||
e = select (maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
#else
|
||||
e = select(fip_fd + 1, in, NULL, NULL, timeout);
|
||||
#endif
|
||||
|
||||
if (e > 0 && fip_fd >= 0 && FD_ISSET (fip_fd, in)) {
|
||||
FD_CLR (fip_fd, in);
|
||||
|
||||
ioctl(fip_fd, IR_IOCTL_READ_KEY, &key);
|
||||
//read(fip_fd, &key, 4);
|
||||
//printf("got a key under minigui:%d\n", key);
|
||||
//printf("got a key under minigui:%d\n", key);
|
||||
}
|
||||
|
||||
if (key == NEC_REPEAT_CODE || key == 0)
|
||||
return -1;
|
||||
return -1;
|
||||
/* else
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
if (!key)
|
||||
return -1;
|
||||
if (!key)
|
||||
return -1;
|
||||
|
||||
printf("..........key: %x\n", key);
|
||||
printf("..........key: %x\n", key);
|
||||
|
||||
if (key == OPENCLOSE_SCANCODE) {
|
||||
chmousestatus();
|
||||
@@ -388,15 +372,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
}
|
||||
if (key && key != 0xffffffff) {
|
||||
//限制按键频率在300毫秒以上
|
||||
//限制按键频率在300毫秒以上
|
||||
#if LIMI_KEYSTROKE
|
||||
if (g_last_key_time && ((unsigned long)gettime_ms() - g_last_key_time) <= 300){
|
||||
printf("minigui lib:key press too quick, ignore\n");
|
||||
return -1;
|
||||
}
|
||||
g_last_key_time = gettime_ms();
|
||||
if (g_last_key_time && ((unsigned long)gettime_ms() - g_last_key_time) <= 300){
|
||||
printf("minigui lib:key press too quick, ignore\n");
|
||||
return -1;
|
||||
}
|
||||
g_last_key_time = gettime_ms();
|
||||
#endif
|
||||
cur_key = key;
|
||||
cur_key = key;
|
||||
return IAL_KEYEVENT;
|
||||
}
|
||||
|
||||
|
||||
269
src/ial/em86.c
269
src/ial/em86.c
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -102,14 +102,14 @@ static inline void chmousestatus (void)
|
||||
{
|
||||
mousestatus ^= 1;
|
||||
|
||||
if(mousestatus)
|
||||
if(mousestatus)
|
||||
{
|
||||
printf("+++++++++++++ MiniGUI:Swtich to MOUSE Mode ++++++++++++++\n");
|
||||
printf("+++++++++++++ MiniGUI:Swtich to MOUSE Mode ++++++++++++++\n");
|
||||
ShowCursor(TRUE);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
printf("+++++++++++++ MiniGUI:Back to KEYBOARD Mode ++++++++++++++\n");
|
||||
printf("+++++++++++++ MiniGUI:Back to KEYBOARD Mode ++++++++++++++\n");
|
||||
ShowCursor(FALSE);
|
||||
}
|
||||
}
|
||||
@@ -130,79 +130,79 @@ static struct _ir2key {
|
||||
{KEY_0, SCANCODE_0},
|
||||
{KEY_1, SCANCODE_1},
|
||||
{KEY_2, SCANCODE_2},
|
||||
{KEY_3, SCANCODE_3},
|
||||
{KEY_3, SCANCODE_3},
|
||||
{KEY_4, SCANCODE_4},
|
||||
{KEY_5, SCANCODE_5},
|
||||
{KEY_6, SCANCODE_6},
|
||||
{KEY_7, SCANCODE_7},
|
||||
{KEY_8, SCANCODE_8},
|
||||
{KEY_7, SCANCODE_7},
|
||||
{KEY_8, SCANCODE_8},
|
||||
{KEY_9, SCANCODE_9},
|
||||
|
||||
{KEY_UP, SCANCODE_CURSORBLOCKUP},
|
||||
{KEY_DOWN, SCANCODE_CURSORBLOCKDOWN},
|
||||
{KEY_LEFT, SCANCODE_CURSORBLOCKLEFT},
|
||||
{KEY_DOWN, SCANCODE_CURSORBLOCKDOWN},
|
||||
{KEY_LEFT, SCANCODE_CURSORBLOCKLEFT},
|
||||
{KEY_RIGHT, SCANCODE_CURSORBLOCKRIGHT},
|
||||
|
||||
{KEY_PGUP, SCANCODE_PAGEUP},
|
||||
{KEY_PGDN, SCANCODE_PAGEDOWN},
|
||||
{KEY_PGUP, SCANCODE_PAGEUP},
|
||||
{KEY_PGDN, SCANCODE_PAGEDOWN},
|
||||
|
||||
{KEY_VOLINC, SCANCODE_EQUAL},
|
||||
{KEY_VOLDEC, SCANCODE_MINUS},
|
||||
|
||||
{KEY_CAPS, SCANCODE_CAPSLOCK},
|
||||
{KEY_CAPS, SCANCODE_CAPSLOCK},
|
||||
{KEY_TAB, SCANCODE_TAB},
|
||||
{KEY_REFRESH, SCANCODE_F5},
|
||||
{KEY_BACK, SCANCODE_BACKSPACE},
|
||||
{KEY_REFRESH, SCANCODE_F5},
|
||||
{KEY_BACK, SCANCODE_BACKSPACE},
|
||||
|
||||
{KEY_OK, SCANCODE_ENTER},
|
||||
{KEY_CANCEL, SCANCODE_ESCAPE},
|
||||
{KEY_CANCEL, SCANCODE_ESCAPE},
|
||||
|
||||
{KEY_MOUSE, SCANCODE_F8},
|
||||
{KEY_MOUSE, SCANCODE_F8},
|
||||
|
||||
{KEY_RED, SCANCODE_F9},
|
||||
{KEY_GREEN, SCANCODE_F10},
|
||||
{KEY_YELLOW, SCANCODE_F11},
|
||||
{KEY_BLUE, SCANCODE_F12}
|
||||
{KEY_RED, SCANCODE_F9},
|
||||
{KEY_GREEN, SCANCODE_F10},
|
||||
{KEY_YELLOW, SCANCODE_F11},
|
||||
{KEY_BLUE, SCANCODE_F12}
|
||||
};
|
||||
|
||||
static KeyReg_t RegKeys[] =
|
||||
{
|
||||
{KEY_0, RC},
|
||||
{KEY_1, RC},
|
||||
{KEY_2, RC},
|
||||
{KEY_3, RC},
|
||||
{KEY_4, RC},
|
||||
{KEY_5, RC},
|
||||
{KEY_6, RC},
|
||||
{KEY_7, RC},
|
||||
{KEY_8, RC},
|
||||
{KEY_9, RC},
|
||||
|
||||
{KEY_0, RC},
|
||||
{KEY_1, RC},
|
||||
{KEY_2, RC},
|
||||
{KEY_3, RC},
|
||||
{KEY_4, RC},
|
||||
{KEY_5, RC},
|
||||
{KEY_6, RC},
|
||||
{KEY_7, RC},
|
||||
{KEY_8, RC},
|
||||
{KEY_9, RC},
|
||||
|
||||
{KEY_UP, RC},
|
||||
{KEY_DOWN, RC},
|
||||
{KEY_LEFT, RC},
|
||||
{KEY_DOWN, RC},
|
||||
{KEY_LEFT, RC},
|
||||
{KEY_RIGHT, RC},
|
||||
|
||||
{KEY_PGUP, RC},
|
||||
{KEY_PGDN, RC},
|
||||
|
||||
{KEY_VOLINC, RC},
|
||||
|
||||
{KEY_PGUP, RC},
|
||||
{KEY_PGDN, RC},
|
||||
|
||||
{KEY_VOLINC, RC},
|
||||
{KEY_VOLDEC, RC},
|
||||
|
||||
{KEY_CAPS, RC},
|
||||
{KEY_CAPS, RC},
|
||||
{KEY_TAB, RC},
|
||||
{KEY_REFRESH, RC},
|
||||
{KEY_BACK, RC},
|
||||
|
||||
{KEY_OK, RC},
|
||||
{KEY_CANCEL, RC},
|
||||
|
||||
{KEY_RED, RC},
|
||||
{KEY_GREEN, RC},
|
||||
{KEY_YELLOW, RC},
|
||||
{KEY_BLUE, RC},
|
||||
{KEY_REFRESH, RC},
|
||||
{KEY_BACK, RC},
|
||||
|
||||
{KEY_MOUSE, RC},
|
||||
{KEY_OK, RC},
|
||||
{KEY_CANCEL, RC},
|
||||
|
||||
{KEY_RED, RC},
|
||||
{KEY_GREEN, RC},
|
||||
{KEY_YELLOW, RC},
|
||||
{KEY_BLUE, RC},
|
||||
|
||||
{KEY_MOUSE, RC},
|
||||
|
||||
{KEY_UP, PN},
|
||||
{KEY_DOWN, PN},
|
||||
@@ -215,7 +215,7 @@ static KeyReg_t RegKeys[] =
|
||||
|
||||
};
|
||||
|
||||
static int
|
||||
static int
|
||||
find_ir_key(unsigned long key)
|
||||
{
|
||||
int i;
|
||||
@@ -248,7 +248,7 @@ static int keyboard_update (void)
|
||||
return NR_KEYS;
|
||||
}
|
||||
|
||||
static const char *
|
||||
static const char *
|
||||
keyboard_get_state(void)
|
||||
{
|
||||
return (char *)state;
|
||||
@@ -269,42 +269,37 @@ static int looprcvMsg(Msg_t *pMsg, struct timeval *timeout)
|
||||
while (interval < (timeout->tv_sec*1000000 + timeout->tv_usec)) {
|
||||
ret = rcvMcMsgNoWait(pMsg);
|
||||
if (ret > 0) {
|
||||
printf("+++++++++++++++ MiniGUI:recieved Message ++++++++++++++++\n");
|
||||
printf("+++++++++++++++ MiniGUI:recieved Message ++++++++++++++++\n");
|
||||
return ret;
|
||||
}
|
||||
else if (ret < 0) /* error */
|
||||
return ret;
|
||||
}
|
||||
else if (ret < 0) /* error */
|
||||
return ret;
|
||||
|
||||
usleep(10000);
|
||||
gettimeofday(&curt, NULL);
|
||||
interval =
|
||||
(curt.tv_sec - startt.tv_sec)*1000000 + (curt.tv_usec - startt.tv_usec);
|
||||
}
|
||||
(curt.tv_sec - startt.tv_sec)*1000000 + (curt.tv_usec - startt.tv_usec);
|
||||
}
|
||||
|
||||
return 0; /* time out */
|
||||
return 0; /* time out */
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
unsigned int ret;
|
||||
unsigned int ret;
|
||||
unsigned int key;
|
||||
int e;
|
||||
unsigned long usec;
|
||||
int msgtype;
|
||||
Msg_t msg;
|
||||
unsigned char *url;
|
||||
int e;
|
||||
unsigned long usec;
|
||||
int msgtype;
|
||||
Msg_t msg;
|
||||
unsigned char *url;
|
||||
int number = 0;
|
||||
|
||||
usec = timeout->tv_sec*1000000+timeout->tv_usec;
|
||||
|
||||
usec = timeout->tv_sec*1000000+timeout->tv_usec;
|
||||
|
||||
if (cur_key || button) {
|
||||
usleep(usec);
|
||||
usleep(usec);
|
||||
|
||||
if (cur_key) {
|
||||
cur_key = 0;
|
||||
@@ -319,50 +314,50 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
return e;
|
||||
}
|
||||
|
||||
if (!MCIsInit)
|
||||
{
|
||||
if (initMsgQueue(ST_BrowserControl) < 0) {
|
||||
fprintf(stderr, "Cannot Init MC MsgQueue\n");
|
||||
return -1;
|
||||
}
|
||||
if (!MCIsInit)
|
||||
{
|
||||
if (initMsgQueue(ST_BrowserControl) < 0) {
|
||||
fprintf(stderr, "Cannot Init MC MsgQueue\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (requestKeys(__mg_with_panel ? TABLESIZE(RegKeys):(TABLESIZE(RegKeys) - 8), RegKeys) < 0) {
|
||||
fprintf(stderr, "Request Keys Error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
MCIsInit = 1;
|
||||
}
|
||||
|
||||
ret = looprcvMsg(&msg, timeout);
|
||||
if (ret > 0) { /* have msg */
|
||||
msgtype = getMsgId(&msg);
|
||||
MCIsInit = 1;
|
||||
}
|
||||
|
||||
printf("@@@@@@@@@@@@@@@ MiniGUI:KEY Message msgtype (%d) \n", msgtype);
|
||||
switch(msgtype) {
|
||||
case MSG_KEY:
|
||||
printf("+++++++++++++++ MiniGUI:KEY Message +++++++++++++++++\n");
|
||||
key = *(unsigned int*)getMsgContent(&msg);
|
||||
break;
|
||||
case MSG_CMD_ACTIVATE:
|
||||
printf("MiniGUI:Receive the MSG_CMD_ACTIVATE Message =================\n");
|
||||
ActiveApp();
|
||||
acknowledgeCmd(MSG_APP_STATUS_ACTIVE);
|
||||
printf("MiniGUI:have sent the MSG_APP_STATUS_ACTIVE Message =================\n");
|
||||
return 0;
|
||||
case MSG_CMD_DEACTIVATE:
|
||||
printf("MiniGUI:Receive the MSG_CMD_DEACTIVATE Message =================\n");
|
||||
DeActiveApp();
|
||||
acknowledgeCmd(MSG_APP_STATUS_STANDBY);
|
||||
printf("MiniGUI:have sent the MSG_APP_STATUS_STANDBY Message =================\n");
|
||||
return 0;
|
||||
ret = looprcvMsg(&msg, timeout);
|
||||
if (ret > 0) { /* have msg */
|
||||
msgtype = getMsgId(&msg);
|
||||
|
||||
case MSG_CMD_UNLOAD:
|
||||
printf("MiniGUI:Receive the MSG_CMD_UNLOAD Message =================\n");
|
||||
acknowledgeCmd(MSG_APP_STATUS_UNLOAD);
|
||||
UnLoadApp();
|
||||
printf("MiniGUI:have sent the MSG_APP_STATUS_UNLOAD Message =================\n");
|
||||
return 0;
|
||||
printf("@@@@@@@@@@@@@@@ MiniGUI:KEY Message msgtype (%d) \n", msgtype);
|
||||
switch(msgtype) {
|
||||
case MSG_KEY:
|
||||
printf("+++++++++++++++ MiniGUI:KEY Message +++++++++++++++++\n");
|
||||
key = *(unsigned int*)getMsgContent(&msg);
|
||||
break;
|
||||
case MSG_CMD_ACTIVATE:
|
||||
printf("MiniGUI:Receive the MSG_CMD_ACTIVATE Message =================\n");
|
||||
ActiveApp();
|
||||
acknowledgeCmd(MSG_APP_STATUS_ACTIVE);
|
||||
printf("MiniGUI:have sent the MSG_APP_STATUS_ACTIVE Message =================\n");
|
||||
return 0;
|
||||
case MSG_CMD_DEACTIVATE:
|
||||
printf("MiniGUI:Receive the MSG_CMD_DEACTIVATE Message =================\n");
|
||||
DeActiveApp();
|
||||
acknowledgeCmd(MSG_APP_STATUS_STANDBY);
|
||||
printf("MiniGUI:have sent the MSG_APP_STATUS_STANDBY Message =================\n");
|
||||
return 0;
|
||||
|
||||
case MSG_CMD_UNLOAD:
|
||||
printf("MiniGUI:Receive the MSG_CMD_UNLOAD Message =================\n");
|
||||
acknowledgeCmd(MSG_APP_STATUS_UNLOAD);
|
||||
UnLoadApp();
|
||||
printf("MiniGUI:have sent the MSG_APP_STATUS_UNLOAD Message =================\n");
|
||||
return 0;
|
||||
|
||||
case MSG_CMD_URL:
|
||||
url = (unsigned char*)getMsgContent(&msg);
|
||||
@@ -370,20 +365,20 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
OpenUrl(url);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
printf("MiniGUI:the Message type not found!&&&&&&&&&&&&&&&\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (ret = 0) /* timeout */
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else /* error */
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
default:
|
||||
printf("MiniGUI:the Message type not found!&&&&&&&&&&&&&&&\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (ret = 0) /* timeout */
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else /* error */
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (key == KEY_MOUSE) {
|
||||
printf("helloworld change the mouse and keyboard mode -====================================\n");
|
||||
chmousestatus();
|
||||
@@ -394,7 +389,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
switch (key) {
|
||||
#if 1
|
||||
case KEY_LEFT:
|
||||
printf("+++++++++++++ MiniGUI: LEFT Message ++++++++++++++\n");
|
||||
printf("+++++++++++++ MiniGUI: LEFT Message ++++++++++++++\n");
|
||||
mousex -= MOUSE_MOVE_PIXEL;
|
||||
if (mousex < 0)
|
||||
mousex = 0;
|
||||
@@ -402,28 +397,28 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
#endif
|
||||
|
||||
case KEY_RIGHT:
|
||||
printf("+++++++++++++ MiniGUI: RIGHT Message ++++++++++++++\n");
|
||||
printf("+++++++++++++ MiniGUI: RIGHT Message ++++++++++++++\n");
|
||||
mousex += MOUSE_MOVE_PIXEL_F;
|
||||
if (mousex > MOUSE_MAX_X)
|
||||
mousex = MOUSE_MAX_X;
|
||||
return IAL_MOUSEEVENT;
|
||||
|
||||
case KEY_UP:
|
||||
printf("+++++++++++++ MiniGUI: UP Message ++++++++++++++\n");
|
||||
printf("+++++++++++++ MiniGUI: UP Message ++++++++++++++\n");
|
||||
mousey -= MOUSE_MOVE_PIXEL;
|
||||
if (mousey < 0)
|
||||
mousey = 0;
|
||||
return IAL_MOUSEEVENT;
|
||||
|
||||
case KEY_DOWN:
|
||||
printf("+++++++++++++ MiniGUI: DOWN Message ++++++++++++++\n");
|
||||
printf("+++++++++++++ MiniGUI: DOWN Message ++++++++++++++\n");
|
||||
mousey += MOUSE_MOVE_PIXEL_F;
|
||||
if (mousey > MOUSE_MAX_Y)
|
||||
mousey = MOUSE_MAX_Y;
|
||||
return IAL_MOUSEEVENT;
|
||||
|
||||
case KEY_OK:
|
||||
printf("+++++++++++++ MiniGUI: OK Message ++++++++++++++\n");
|
||||
printf("+++++++++++++ MiniGUI: OK Message ++++++++++++++\n");
|
||||
button = IAL_MOUSE_LEFTBUTTON;
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
|
||||
306
src/ial/em8620.c
306
src/ial/em8620.c
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** em8620.c: IAL Engine for EM8620L
|
||||
**
|
||||
** em8620.c: IAL Engine for EM8620L
|
||||
**
|
||||
** Author: Zhang Xinhua (2005/10/xx)
|
||||
*/
|
||||
|
||||
@@ -155,7 +155,7 @@ static void init_keymap(void)
|
||||
ir_pckey_map[RM_HW_ENT] = -1;
|
||||
ir_pckey_map[RM_HW_SETUP] = -1;
|
||||
ir_pckey_map[RM_HW_CLEAR] = -1;
|
||||
ir_pckey_map[RM_HW_TVMODE] = -1;
|
||||
ir_pckey_map[RM_HW_TVMODE] = -1;
|
||||
ir_pckey_map[RM_HW_PBC] = -1;
|
||||
ir_pckey_map[RM_HW_RETURN] = -1;
|
||||
ir_pckey_map[RM_HW_SHUFFLE] = -1;
|
||||
@@ -167,192 +167,192 @@ static int irvalue_key(unsigned int ir)
|
||||
{
|
||||
switch (ir) {
|
||||
case 0xea15e608:
|
||||
return RM_ENTER;
|
||||
return RM_ENTER;
|
||||
|
||||
case 0xbc43e608:
|
||||
case 0xED12FF00:
|
||||
return RM_HW_ON_OFF;
|
||||
case 0xbc43e608:
|
||||
case 0xED12FF00:
|
||||
return RM_HW_ON_OFF;
|
||||
|
||||
case 0xa15ee608:
|
||||
case 0xB649FF00:
|
||||
return RM_HW_PROGRAM;
|
||||
case 0xa15ee608:
|
||||
case 0xB649FF00:
|
||||
return RM_HW_PROGRAM;
|
||||
|
||||
case 0xeb14e608:
|
||||
case 0xFE01FF00:
|
||||
return RM_HW_UP;
|
||||
case 0xeb14e608:
|
||||
case 0xFE01FF00:
|
||||
return RM_HW_UP;
|
||||
|
||||
case 0xe916e608:
|
||||
case 0xF609FF00:
|
||||
return RM_HW_DOWN;
|
||||
case 0xe916e608:
|
||||
case 0xF609FF00:
|
||||
return RM_HW_DOWN;
|
||||
|
||||
case 0xe21de608:
|
||||
case 0xE619FF00:
|
||||
return RM_HW_LEFT;
|
||||
case 0xe21de608:
|
||||
case 0xE619FF00:
|
||||
return RM_HW_LEFT;
|
||||
|
||||
case 0xee11e608:
|
||||
case 0xEE11FF00:
|
||||
return RM_HW_RIGHT;
|
||||
case 0xee11e608:
|
||||
case 0xEE11FF00:
|
||||
return RM_HW_RIGHT;
|
||||
|
||||
//case 0xea15e608:
|
||||
case 0xBF40FF00:
|
||||
return RM_HW_SELECT;
|
||||
//case 0xea15e608:
|
||||
case 0xBF40FF00:
|
||||
return RM_HW_SELECT;
|
||||
|
||||
case 0xed12e608:
|
||||
case 0xE01FFF00:
|
||||
return RM_HW_MENU;
|
||||
case 0xed12e608:
|
||||
case 0xE01FFF00:
|
||||
return RM_HW_MENU;
|
||||
|
||||
case 0xa55ae608:
|
||||
case 0xE11EFF00:
|
||||
return RM_HW_TITLE;
|
||||
case 0xa55ae608:
|
||||
case 0xE11EFF00:
|
||||
return RM_HW_TITLE;
|
||||
|
||||
case 0xa25de608:
|
||||
case 0xE718FF00:
|
||||
return RM_HW_OSD;
|
||||
case 0xa25de608:
|
||||
case 0xE718FF00:
|
||||
return RM_HW_OSD;
|
||||
|
||||
case 0xad52e608:
|
||||
case 0xFC03FF00:
|
||||
return RM_HW_LANGUAGE;
|
||||
case 0xad52e608:
|
||||
case 0xFC03FF00:
|
||||
return RM_HW_LANGUAGE;
|
||||
|
||||
case 0xa45be608:
|
||||
case 0xEB14FF00:
|
||||
return RM_HW_ANGLE;
|
||||
case 0xa45be608:
|
||||
case 0xEB14FF00:
|
||||
return RM_HW_ANGLE;
|
||||
|
||||
case 0xa956e608:
|
||||
case 0xE21DFF00:
|
||||
return RM_HW_SUB_TITLE;
|
||||
case 0xa956e608:
|
||||
case 0xE21DFF00:
|
||||
return RM_HW_SUB_TITLE;
|
||||
|
||||
case 0xe817e608:
|
||||
case 0xE817FF00:
|
||||
return RM_HW_PAUSE;
|
||||
case 0xe817e608:
|
||||
case 0xE817FF00:
|
||||
return RM_HW_PAUSE;
|
||||
|
||||
case 0xab54e608:
|
||||
case 0xFB04FF00:
|
||||
return RM_HW_STOP;
|
||||
case 0xab54e608:
|
||||
case 0xFB04FF00:
|
||||
return RM_HW_STOP;
|
||||
|
||||
case 0xaa55e608:
|
||||
case 0xF807FF00:
|
||||
return RM_HW_PAUSE_PLAY;
|
||||
case 0xaa55e608:
|
||||
case 0xF807FF00:
|
||||
return RM_HW_PAUSE_PLAY;
|
||||
|
||||
case 0xb847e608:
|
||||
case 0xE916FF00:
|
||||
return RM_HW_EJECT;
|
||||
case 0xb847e608:
|
||||
case 0xE916FF00:
|
||||
return RM_HW_EJECT;
|
||||
|
||||
case 0xa758e608:
|
||||
case 0xF00FFF00:
|
||||
return RM_HW_FAST_REWIND;
|
||||
case 0xa758e608:
|
||||
case 0xF00FFF00:
|
||||
return RM_HW_FAST_REWIND;
|
||||
|
||||
case 0xaf50e608:
|
||||
case 0xF10EFF00:
|
||||
return RM_HW_FAST_FORWARD;
|
||||
case 0xaf50e608:
|
||||
case 0xF10EFF00:
|
||||
return RM_HW_FAST_FORWARD;
|
||||
|
||||
case 0xa659e608:
|
||||
return RM_HW_SLOW_REVERSE;
|
||||
case 0xa659e608:
|
||||
return RM_HW_SLOW_REVERSE;
|
||||
|
||||
case 0xae51e608:
|
||||
return RM_HW_SLOW_FORWARD;
|
||||
case 0xae51e608:
|
||||
return RM_HW_SLOW_FORWARD;
|
||||
|
||||
case 0xa35ce608:
|
||||
return RM_HW_REPEAT;
|
||||
case 0xa35ce608:
|
||||
return RM_HW_REPEAT;
|
||||
|
||||
case 0xe01fe608:
|
||||
return RM_HW_AB_REPEAT;
|
||||
case 0xe01fe608:
|
||||
return RM_HW_AB_REPEAT;
|
||||
|
||||
case 0xe41be608:
|
||||
case 0xFD02FF00:
|
||||
return RM_HW_PREV_TRACK;
|
||||
case 0xe41be608:
|
||||
case 0xFD02FF00:
|
||||
return RM_HW_PREV_TRACK;
|
||||
|
||||
case 0xec13e608:
|
||||
case 0xF50AFF00:
|
||||
return RM_HW_NEXT_TRACK;
|
||||
case 0xec13e608:
|
||||
case 0xF50AFF00:
|
||||
return RM_HW_NEXT_TRACK;
|
||||
|
||||
case 0xe718e608:
|
||||
case 0xF20DFF00:
|
||||
return RM_HW_VOL_PLUS;
|
||||
case 0xe718e608:
|
||||
case 0xF20DFF00:
|
||||
return RM_HW_VOL_PLUS;
|
||||
|
||||
case 0xef10e608:
|
||||
case 0xEC13FF00:
|
||||
return RM_HW_VOL_MINUS;
|
||||
case 0xef10e608:
|
||||
case 0xEC13FF00:
|
||||
return RM_HW_VOL_MINUS;
|
||||
|
||||
case 0xe619e608:
|
||||
case 0xE31CFF00:
|
||||
return RM_HW_MUTE;
|
||||
case 0xe619e608:
|
||||
case 0xE31CFF00:
|
||||
return RM_HW_MUTE;
|
||||
|
||||
case 0xbd42e608:
|
||||
case 0xBE41FF00:
|
||||
return RM_HW_KEY_1;
|
||||
case 0xbd42e608:
|
||||
case 0xBE41FF00:
|
||||
return RM_HW_KEY_1;
|
||||
|
||||
case 0xbe41e608:
|
||||
case 0xB24DFF00:
|
||||
return RM_HW_KEY_2;
|
||||
case 0xbe41e608:
|
||||
case 0xB24DFF00:
|
||||
return RM_HW_KEY_2;
|
||||
|
||||
case 0xbf40e608:
|
||||
case 0xBA45FF00:
|
||||
return RM_HW_KEY_3;
|
||||
case 0xbf40e608:
|
||||
case 0xBA45FF00:
|
||||
return RM_HW_KEY_3;
|
||||
|
||||
case 0xb946e608:
|
||||
case 0xBD42FF00:
|
||||
return RM_HW_KEY_4;
|
||||
case 0xb946e608:
|
||||
case 0xBD42FF00:
|
||||
return RM_HW_KEY_4;
|
||||
|
||||
case 0xba45e608:
|
||||
case 0xB14EFF00:
|
||||
return RM_HW_KEY_5;
|
||||
case 0xba45e608:
|
||||
case 0xB14EFF00:
|
||||
return RM_HW_KEY_5;
|
||||
|
||||
case 0xbb44e608:
|
||||
case 0xB946FF00:
|
||||
return RM_HW_KEY_6;
|
||||
case 0xbb44e608:
|
||||
case 0xB946FF00:
|
||||
return RM_HW_KEY_6;
|
||||
|
||||
case 0xb54ae608:
|
||||
case 0xBC43FF00:
|
||||
return RM_HW_KEY_7;
|
||||
case 0xb54ae608:
|
||||
case 0xBC43FF00:
|
||||
return RM_HW_KEY_7;
|
||||
|
||||
case 0xb649e608:
|
||||
case 0xB04FFF00:
|
||||
return RM_HW_KEY_8;
|
||||
case 0xb649e608:
|
||||
case 0xB04FFF00:
|
||||
return RM_HW_KEY_8;
|
||||
|
||||
case 0xb748e608:
|
||||
case 0xB847FF00:
|
||||
return RM_HW_KEY_9;
|
||||
case 0xb748e608:
|
||||
case 0xB847FF00:
|
||||
return RM_HW_KEY_9;
|
||||
|
||||
case 0xb24de608:
|
||||
case 0xFF00FF00:
|
||||
return RM_HW_KEY_0;
|
||||
case 0xb24de608:
|
||||
case 0xFF00FF00:
|
||||
return RM_HW_KEY_0;
|
||||
|
||||
case 0xb34ce608:
|
||||
case 0xF30CFF00:
|
||||
return RM_HW_ENT;
|
||||
case 0xb34ce608:
|
||||
case 0xF30CFF00:
|
||||
return RM_HW_ENT;
|
||||
|
||||
case 0xe51ae608:
|
||||
return RM_HW_SETUP;
|
||||
case 0xe51ae608:
|
||||
return RM_HW_SETUP;
|
||||
|
||||
case 0xb14ee608:
|
||||
return RM_HW_CLEAR;
|
||||
case 0xb14ee608:
|
||||
return RM_HW_CLEAR;
|
||||
|
||||
case 0xb44be608:
|
||||
return RM_HW_TVMODE;
|
||||
case 0xb44be608:
|
||||
return RM_HW_TVMODE;
|
||||
|
||||
case 0xe31ce608:
|
||||
return RM_HW_PBC;
|
||||
case 0xe31ce608:
|
||||
return RM_HW_PBC;
|
||||
|
||||
case 0xe11ee608:
|
||||
return RM_HW_RETURN;
|
||||
case 0xe11ee608:
|
||||
return RM_HW_RETURN;
|
||||
|
||||
case 0xa05fe608:
|
||||
return RM_HW_SHUFFLE;
|
||||
case 0xa05fe608:
|
||||
return RM_HW_SHUFFLE;
|
||||
|
||||
case 0xa857e608:
|
||||
return RM_HW_SEARCH;
|
||||
case 0xa857e608:
|
||||
return RM_HW_SEARCH;
|
||||
|
||||
case 0xac53e608:
|
||||
return RM_HW_ZOOM;
|
||||
case 0xac53e608:
|
||||
return RM_HW_ZOOM;
|
||||
|
||||
case 0x0:
|
||||
case 0x10:
|
||||
case NEC_REPEAT_CODE:
|
||||
return -1;
|
||||
|
||||
default:
|
||||
return RM_HW_TIMEOUT;
|
||||
}
|
||||
default:
|
||||
return RM_HW_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
static int keyboard_update(void)
|
||||
@@ -370,24 +370,15 @@ static const char * keyboard_get_state(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
unsigned int fkey;
|
||||
int key, e = 0;
|
||||
fd_set rfds;
|
||||
|
||||
if (cur_key >= 0 || button) {
|
||||
#ifdef _LITE_VERSION
|
||||
select(maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
select(FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
if (cur_key >= 0) {
|
||||
cur_key = -1;
|
||||
e = IAL_KEYEVENT;
|
||||
@@ -407,15 +398,10 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
FD_SET(fip_fd, in);
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
if (fip_fd > maxfd)
|
||||
maxfd = fip_fd;
|
||||
|
||||
e = select (maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
|
||||
if (e > 0 && fip_fd >= 0 && FD_ISSET(fip_fd, in)) {
|
||||
FD_CLR (fip_fd, in);
|
||||
read(fip_fd, &fkey, 4);
|
||||
@@ -502,7 +488,7 @@ BOOL InitEm8620Input(INPUT * input, const char * mdev, const char * mtype)
|
||||
(g_rcScr.top + g_rcScr.bottom) / 2);
|
||||
|
||||
init_keymap();
|
||||
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** embest2410.c: Low Level Input Engine for EMBEST ARM2410
|
||||
**
|
||||
**
|
||||
** Created by Cheng Jiangang, 2004/09/22
|
||||
*/
|
||||
|
||||
@@ -111,13 +111,8 @@ static int mouse_getbutton(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -130,18 +125,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
short data [4];
|
||||
|
||||
@@ -190,7 +178,7 @@ BOOL InitEMBEST2410Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
pos.x = pos.y = pos.b = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** hh44b0.c: Low Level Input Engine for Embest ARM44B0
|
||||
**
|
||||
**
|
||||
** Created by Zhang Xinhua, 2005/06/xx.
|
||||
*/
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
#include "ial.h"
|
||||
#include "hh44b0.h"
|
||||
|
||||
#define I2C_SET_DATA_ADDR 0x0601
|
||||
#define I2C_SET_BUS_CLOCK 0x0602
|
||||
#define I2C_SET_DATA_ADDR 0x0601
|
||||
#define I2C_SET_BUS_CLOCK 0x0602
|
||||
|
||||
/* for data reading from /dev/keyboard/0raw */
|
||||
static int btn_fd = -1;
|
||||
@@ -143,13 +143,8 @@ static const char* keyboard_getstate(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -164,16 +159,10 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_KEYEVENT) && btn_fd >= 0) {
|
||||
FD_SET (btn_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if(btn_fd > maxfd) maxfd = btn_fd;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
if (e > 0) {
|
||||
if (btn_fd >= 0 && FD_ISSET(btn_fd, in)) {
|
||||
FD_CLR(btn_fd, in);
|
||||
|
||||
139
src/ial/ep7211.c
139
src/ial/ep7211.c
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** ep7211.c: Low Level Input Engine for EP7211.
|
||||
**
|
||||
**
|
||||
** Created by Wei Yongming, 2000/08/24
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
#include "ial.h"
|
||||
#include "ep7211.h"
|
||||
|
||||
#define TSTHRESHOLD 0x545e
|
||||
#define TSTHRESHOLD 0x545e
|
||||
|
||||
static int ts;
|
||||
static int mousex = 0;
|
||||
@@ -84,62 +84,61 @@ static TSP tsp;
|
||||
void convert(POS * tempos)
|
||||
{
|
||||
int x0, y0;
|
||||
tempos->x -= tsp.xbase;
|
||||
tempos->x -= tsp.xbase;
|
||||
tempos->y -= tsp.ybase;
|
||||
x0 = tempos->x;
|
||||
x0 = tempos->x;
|
||||
y0 = tempos->y;
|
||||
tempos->x -= y0 * (tsp.xdlt + x0 * tsp.xdlt2 / tsp.xsize) / tsp.ysize;
|
||||
tempos->y -= x0 * (tsp.ydlt + y0 * tsp.ydlt2 / tsp.ysize) / tsp.xsize;
|
||||
tempos->x = tempos->x*320/tsp.xsize;
|
||||
tempos->x = tempos->x*320/tsp.xsize;
|
||||
tempos->y = tempos->y*240/tsp.ysize;
|
||||
}
|
||||
|
||||
static int mouse_update(void)
|
||||
{
|
||||
if ( (pos.x + pos.y) != 0 )
|
||||
convert(&pos);
|
||||
if ( pos.x < 0 || pos.y < 0 )
|
||||
return 0;
|
||||
if ( (pos.x + pos.y) != 0 )
|
||||
convert(&pos);
|
||||
if ( pos.x < 0 || pos.y < 0 )
|
||||
return 0;
|
||||
|
||||
truepos.x = pos.x;
|
||||
truepos.y = pos.y;
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void mouse_getxy(int* x, int* y)
|
||||
{
|
||||
*x = truepos.x;
|
||||
*y = truepos.x;
|
||||
*x = truepos.x;
|
||||
*y = truepos.x;
|
||||
}
|
||||
|
||||
static int mouse_getbutton(void)
|
||||
{
|
||||
if ( (truepos.x + truepos.y) != 0 && (mousex + mousey) == 0 )
|
||||
{
|
||||
mousex = truepos.x;
|
||||
mousey = truepos.y;
|
||||
return IAL_MOUSE_LEFTBUTTON;
|
||||
}
|
||||
else if ( (truepos.x + truepos.y) == 0 && (mousex + mousey) != 0 )
|
||||
{
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
if ( (truepos.x + truepos.y) != 0 && (mousex + mousey) == 0 )
|
||||
{
|
||||
mousex = truepos.x;
|
||||
mousey = truepos.y;
|
||||
return IAL_MOUSE_LEFTBUTTON;
|
||||
}
|
||||
else if ( (truepos.x + truepos.y) == 0 && (mousex + mousey) != 0 )
|
||||
{
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int keyboard_update(void)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* keyboard_getstate(void)
|
||||
{
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
@@ -153,9 +152,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
|
||||
if (which & IAL_MOUSEEVENT) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
|
||||
e = select (maxfd+1, in, out, except, timeout);
|
||||
@@ -164,7 +161,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
/* If data is present on the touchsreen fd, service it: */
|
||||
if (FD_ISSET (ts, in))
|
||||
{
|
||||
read (ts, &pos, sizeof(POS));
|
||||
read (ts, &pos, sizeof(POS));
|
||||
FD_CLR (ts, in);
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
@@ -176,55 +173,55 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#if 0
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
int timeout_ms;
|
||||
struct pollfd ufd;
|
||||
struct pollfd ufd;
|
||||
|
||||
if (timeout)
|
||||
timeout_ms = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
|
||||
else
|
||||
timeout_ms = -1;
|
||||
|
||||
if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT)
|
||||
{
|
||||
ufd.fd = ts;
|
||||
ufd.events = POLLIN;
|
||||
if ( poll (&ufd, 1, timeout_ms) > 0)
|
||||
{
|
||||
read (ts, &pos, sizeof(POS));
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT)
|
||||
{
|
||||
ufd.fd = ts;
|
||||
ufd.events = POLLIN;
|
||||
if ( poll (&ufd, 1, timeout_ms) > 0)
|
||||
{
|
||||
read (ts, &pos, sizeof(POS));
|
||||
return IAL_MOUSEEVENT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL InitEP7211Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
{
|
||||
int fs_data;
|
||||
THRESHOLD threshold;
|
||||
int fs_data;
|
||||
THRESHOLD threshold;
|
||||
if(!access("/etc/ts.conf",R_OK))
|
||||
{
|
||||
read(fs_data=open("/etc/ts.conf",0),&tsp,sizeof(tsp));
|
||||
close(fs_data);
|
||||
threshold.x = tsp.xthrsd;
|
||||
threshold.y = tsp.ythrsd;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"IAL: Can not set touch screet threshold!\n");
|
||||
return FALSE;
|
||||
}
|
||||
ts = open ("/dev/ts",O_RDONLY);
|
||||
{
|
||||
read(fs_data=open("/etc/ts.conf",0),&tsp,sizeof(tsp));
|
||||
close(fs_data);
|
||||
threshold.x = tsp.xthrsd;
|
||||
threshold.y = tsp.ythrsd;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"IAL: Can not set touch screet threshold!\n");
|
||||
return FALSE;
|
||||
}
|
||||
ts = open ("/dev/ts",O_RDONLY);
|
||||
if ( ts < 0 ) {
|
||||
fprintf (stderr, "IAL: Can not open touch screen!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ioctl(ts,TSTHRESHOLD,&threshold);
|
||||
ioctl(ts,TSTHRESHOLD,&threshold);
|
||||
|
||||
input->update_mouse = mouse_update;
|
||||
input->get_mouse_xy = mouse_getxy;
|
||||
@@ -237,14 +234,14 @@ BOOL InitEP7211Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
input->set_leds = NULL;
|
||||
|
||||
input->wait_event = wait_event;
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermEP7211Input (void)
|
||||
{
|
||||
close(ts);
|
||||
close(ts);
|
||||
}
|
||||
|
||||
#endif /* _EP7211_IAL */
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** evmv10e.c: Low Level Input Engine for DigiPro xScale EVMV 1.0.
|
||||
**
|
||||
**
|
||||
** Created by Yao Yunyuan, 2004/08/20
|
||||
*/
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#include <termios.h>
|
||||
|
||||
#include "ial.h"
|
||||
#include "evmv10.h"
|
||||
#include "evmv10.h"
|
||||
|
||||
#define _DEBUG_EVMV10 0
|
||||
|
||||
@@ -111,7 +111,7 @@ static void mouse_getxy(int *x, int* y)
|
||||
{
|
||||
*x = pos.x;
|
||||
*y = pos.y;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static int mouse_getbutton(void)
|
||||
@@ -148,13 +148,8 @@ static const char* keyboard_getstate(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -166,26 +161,17 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
if ((which & IAL_KEYEVENT) && kb_fd >= 0){
|
||||
FD_SET (kb_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if(kb_fd > maxfd) maxfd = kb_fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
if ( select (maxfd + 1, in, out, except, timeout) < 0 )
|
||||
#else
|
||||
if ( select (FD_SETSIZE, in, out, except, timeout) < 0 )
|
||||
#endif
|
||||
return -1;
|
||||
|
||||
if (ts >= 0 && FD_ISSET (ts, in))
|
||||
{
|
||||
return -1;
|
||||
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
FD_CLR (ts, in);
|
||||
if ( read (ts, &pos, sizeof (POS)) == sizeof(POS) ) {
|
||||
pos.header = ( pos.header > 0 ? IAL_MOUSE_LEFTBUTTON:0 );
|
||||
@@ -196,7 +182,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (kb_fd >= 0 && FD_ISSET(kb_fd, in))
|
||||
{
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** fft7202.c: Low Level Input Engine for FFT 7202
|
||||
**
|
||||
**
|
||||
** The device driver of fft 7202 touch screen is compliant to
|
||||
** the Specification for Generic Touch Screen Driver.
|
||||
** Please see the file: spec_general_ts_drv.html in this directory.
|
||||
@@ -117,13 +117,8 @@ static int mouse_getbutton(void)
|
||||
return pos.b;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -136,18 +131,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
short data [4];
|
||||
|
||||
@@ -191,7 +179,7 @@ BOOL InitFFTInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
pos.x = pos.y = pos.b = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** figueroa.c: Low Level Input Engine for D2 FiguaOA
|
||||
** This driver can run on Linux.
|
||||
**
|
||||
**
|
||||
** Created by Libo Jiao, 2001/08/20
|
||||
*/
|
||||
|
||||
@@ -80,57 +80,57 @@ static int key, old_key = -1;
|
||||
|
||||
#ifdef QEMU
|
||||
static int key_mapper[][2] = {
|
||||
{2,SCANCODE_1},
|
||||
{3,SCANCODE_2},
|
||||
{4,SCANCODE_3},
|
||||
{5,SCANCODE_4},
|
||||
{6,SCANCODE_5},
|
||||
{7,SCANCODE_6},
|
||||
{8,SCANCODE_7},
|
||||
{9,SCANCODE_8},
|
||||
{10,SCANCODE_9},
|
||||
{11,SCANCODE_0},
|
||||
{59,SCANCODE_F1},
|
||||
{60,SCANCODE_F2},
|
||||
{61,SCANCODE_F3},
|
||||
{62,SCANCODE_F4},
|
||||
{63,SCANCODE_F5},
|
||||
{64,SCANCODE_F6},
|
||||
{65,SCANCODE_F7},
|
||||
{66,SCANCODE_F8},
|
||||
{67,SCANCODE_F9},
|
||||
{68,SCANCODE_F10},
|
||||
{103,SCANCODE_CURSORBLOCKUP},
|
||||
{105,SCANCODE_CURSORBLOCKLEFT},
|
||||
{106,SCANCODE_CURSORBLOCKRIGHT},
|
||||
{108,SCANCODE_CURSORBLOCKDOWN}
|
||||
{2,SCANCODE_1},
|
||||
{3,SCANCODE_2},
|
||||
{4,SCANCODE_3},
|
||||
{5,SCANCODE_4},
|
||||
{6,SCANCODE_5},
|
||||
{7,SCANCODE_6},
|
||||
{8,SCANCODE_7},
|
||||
{9,SCANCODE_8},
|
||||
{10,SCANCODE_9},
|
||||
{11,SCANCODE_0},
|
||||
{59,SCANCODE_F1},
|
||||
{60,SCANCODE_F2},
|
||||
{61,SCANCODE_F3},
|
||||
{62,SCANCODE_F4},
|
||||
{63,SCANCODE_F5},
|
||||
{64,SCANCODE_F6},
|
||||
{65,SCANCODE_F7},
|
||||
{66,SCANCODE_F8},
|
||||
{67,SCANCODE_F9},
|
||||
{68,SCANCODE_F10},
|
||||
{103,SCANCODE_CURSORBLOCKUP},
|
||||
{105,SCANCODE_CURSORBLOCKLEFT},
|
||||
{106,SCANCODE_CURSORBLOCKRIGHT},
|
||||
{108,SCANCODE_CURSORBLOCKDOWN}
|
||||
};
|
||||
#else
|
||||
static int key_mapper[][2] = {
|
||||
{1,SCANCODE_1},
|
||||
{2,SCANCODE_2},
|
||||
{3,SCANCODE_3},
|
||||
{4,SCANCODE_4},
|
||||
{5,SCANCODE_5},
|
||||
{6,SCANCODE_6},
|
||||
{7,SCANCODE_7},
|
||||
{8,SCANCODE_8},
|
||||
{9,SCANCODE_9},
|
||||
{10,SCANCODE_0},
|
||||
{11,SCANCODE_F1},
|
||||
{12,SCANCODE_F2},
|
||||
{17,SCANCODE_CURSORBLOCKUP},
|
||||
{18,SCANCODE_CURSORBLOCKDOWN},
|
||||
{19,SCANCODE_CURSORBLOCKLEFT},
|
||||
{20,SCANCODE_CURSORBLOCKRIGHT},
|
||||
{33,SCANCODE_F3},
|
||||
{34,SCANCODE_F4},
|
||||
{35,SCANCODE_F5},
|
||||
{36,SCANCODE_F6},
|
||||
{37,SCANCODE_F7},
|
||||
{39,SCANCODE_F8},
|
||||
{40,SCANCODE_F9},
|
||||
{41,SCANCODE_F10}
|
||||
{1,SCANCODE_1},
|
||||
{2,SCANCODE_2},
|
||||
{3,SCANCODE_3},
|
||||
{4,SCANCODE_4},
|
||||
{5,SCANCODE_5},
|
||||
{6,SCANCODE_6},
|
||||
{7,SCANCODE_7},
|
||||
{8,SCANCODE_8},
|
||||
{9,SCANCODE_9},
|
||||
{10,SCANCODE_0},
|
||||
{11,SCANCODE_F1},
|
||||
{12,SCANCODE_F2},
|
||||
{17,SCANCODE_CURSORBLOCKUP},
|
||||
{18,SCANCODE_CURSORBLOCKDOWN},
|
||||
{19,SCANCODE_CURSORBLOCKLEFT},
|
||||
{20,SCANCODE_CURSORBLOCKRIGHT},
|
||||
{33,SCANCODE_F3},
|
||||
{34,SCANCODE_F4},
|
||||
{35,SCANCODE_F5},
|
||||
{36,SCANCODE_F6},
|
||||
{37,SCANCODE_F7},
|
||||
{39,SCANCODE_F8},
|
||||
{40,SCANCODE_F9},
|
||||
{41,SCANCODE_F10}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -151,31 +151,31 @@ static int keyboard_update(void)
|
||||
status = (key == old_key)? 0 : 1;
|
||||
if (status == 0)
|
||||
old_key = -1;
|
||||
else
|
||||
else
|
||||
old_key = key;
|
||||
m = 0;
|
||||
n = sizeof(key_mapper)/sizeof(int*)-1;
|
||||
m = 0;
|
||||
n = sizeof(key_mapper)/sizeof(int*)-1;
|
||||
|
||||
while(m<n){
|
||||
int half = (m+n)/2;
|
||||
if(key==key_mapper[half][0])
|
||||
{
|
||||
// printf("%d:getKey=%d\n",__LINE__,key);
|
||||
state[key_mapper[half][1]] = status;
|
||||
return NR_KEYS;
|
||||
}
|
||||
else if(key>key_mapper[half][0]){
|
||||
if(m==half) m++ ; else m = half;}
|
||||
else
|
||||
n = half;
|
||||
}
|
||||
if(m==n && key==key_mapper[m][0]){
|
||||
// printf("%d:getKey=%d\n",__LINE__,key);
|
||||
state[key_mapper[m][1]] = status;
|
||||
}
|
||||
else
|
||||
printf("undefined state\n");
|
||||
return NR_KEYS;
|
||||
while(m<n){
|
||||
int half = (m+n)/2;
|
||||
if(key==key_mapper[half][0])
|
||||
{
|
||||
// printf("%d:getKey=%d\n",__LINE__,key);
|
||||
state[key_mapper[half][1]] = status;
|
||||
return NR_KEYS;
|
||||
}
|
||||
else if(key>key_mapper[half][0]){
|
||||
if(m==half) m++ ; else m = half;}
|
||||
else
|
||||
n = half;
|
||||
}
|
||||
if(m==n && key==key_mapper[m][0]){
|
||||
// printf("%d:getKey=%d\n",__LINE__,key);
|
||||
state[key_mapper[m][1]] = status;
|
||||
}
|
||||
else
|
||||
printf("undefined state\n");
|
||||
return NR_KEYS;
|
||||
}
|
||||
|
||||
static const char* keyboard_getstate(void)
|
||||
@@ -183,13 +183,8 @@ static const char* keyboard_getstate(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -203,21 +198,12 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_KEYEVENT) && btn_fd >= 0){
|
||||
FD_SET (btn_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if(btn_fd > maxfd) maxfd = btn_fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0)
|
||||
{
|
||||
if (e > 0) {
|
||||
if (btn_fd >= 0 && FD_ISSET(btn_fd, in))
|
||||
{
|
||||
FD_CLR(btn_fd, in);
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** fip.c: IAL Engine for EM85xx Front Panel and Remote Controller
|
||||
** This IAL engine is made for PLAYER_NEXTBASE.
|
||||
**
|
||||
**
|
||||
** Author: Wei Yongming (2003/12/28)
|
||||
*/
|
||||
|
||||
@@ -231,24 +231,15 @@ static const char * keyboard_get_state(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
unsigned int key;
|
||||
|
||||
if (cur_key || button) {
|
||||
int e = 0;
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
select (maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
select (FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
if (cur_key) {
|
||||
cur_key = 0;
|
||||
e = IAL_KEYEVENT;
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** fxrm9200.c: Low Level Input Engine for fuxu rm9200.
|
||||
** This engine runs on uClinux.
|
||||
**
|
||||
**
|
||||
** Created by pan weiguo, 2004/07/20
|
||||
*/
|
||||
|
||||
@@ -110,7 +110,7 @@ static unsigned char cur_scancode;
|
||||
static unsigned char simulate_up;
|
||||
static unsigned char keystate [NR_KEYS];
|
||||
|
||||
#define MIN_KPD_SCANCODE 0
|
||||
#define MIN_KPD_SCANCODE 0
|
||||
#define MAX_KPD_SCANCODE 15
|
||||
|
||||
static unsigned char keypd2pc_map [MAX_KPD_SCANCODE - MIN_KPD_SCANCODE + 1] =
|
||||
@@ -143,13 +143,8 @@ static const char* keyboard_getspdtate(void)
|
||||
return (char *)keystate;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -158,12 +153,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
/* simulate the release of the key */
|
||||
if (cur_scancode) {
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
select (maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
select (FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
|
||||
if (cur_scancode) {
|
||||
keystate [cur_scancode] = 0;
|
||||
cur_scancode = 0;
|
||||
@@ -185,24 +175,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && tspd >= 0) {
|
||||
FD_SET (tspd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (tspd > maxfd) maxfd = tspd;
|
||||
#endif
|
||||
}
|
||||
if ((which & IAL_KEYEVENT) && keypd >= 0){
|
||||
FD_SET (keypd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (keypd > maxfd) maxfd = keypd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (tspd >= 0 && FD_ISSET (tspd, in)) {
|
||||
TOUCHINFO touch_info;
|
||||
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -112,13 +112,8 @@ static int mouse_getbutton(void)
|
||||
return ts_event.pressure;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -131,30 +126,24 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
int rs;
|
||||
int rs;
|
||||
FD_CLR (ts, in);
|
||||
ts_event.x=0;
|
||||
ts_event.y=0;
|
||||
|
||||
printf ("begin to read\n");
|
||||
rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
//rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
printf ("rs = %d\n", rs);
|
||||
if (rs != sizeof(TS_EVENT))
|
||||
return -1;
|
||||
|
||||
rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
//rs = read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
printf ("rs = %d\n", rs);
|
||||
if (rs != sizeof(TS_EVENT))
|
||||
return -1;
|
||||
|
||||
if (ts_event.pressure > 0) {
|
||||
mousex = ts_event.x;
|
||||
mousey = ts_event.y;
|
||||
@@ -169,7 +158,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -198,14 +187,14 @@ BOOL InitCustomInput (INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
ts_event.x = ts_event.y = ts_event.pressure = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermCustomInput(void)
|
||||
void TermCustomInput(void)
|
||||
{
|
||||
if (ts >= 0)
|
||||
close(ts);
|
||||
close(ts);
|
||||
}
|
||||
|
||||
#endif /* _SMDK2410_IAL */
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** helio.c: Low Level Input Engine for Helio Touch Panel
|
||||
**
|
||||
**
|
||||
** Created by Wei YongMing, 2001/01/17
|
||||
*/
|
||||
|
||||
@@ -100,7 +100,7 @@ typedef struct
|
||||
*/
|
||||
|
||||
int a, b, c, d, e, f, s;
|
||||
} TRANSF_COEF;
|
||||
} TRANSF_COEF;
|
||||
|
||||
static TRANSF_COEF tc;
|
||||
|
||||
@@ -120,7 +120,7 @@ static int GetPointerCalibrationData(void)
|
||||
if ( f == NULL ) {
|
||||
/* now if we can't open /etc/pointercal, we should launch an application
|
||||
* to calibrate touch panel. so we should disable enable_coor_transf
|
||||
* so that the application could get raw data from touch panel
|
||||
* so that the application could get raw data from touch panel
|
||||
*/
|
||||
enable_coor_transf = 0;
|
||||
return 0;
|
||||
@@ -129,7 +129,7 @@ static int GetPointerCalibrationData(void)
|
||||
items = fscanf(f, "%d %d %d %d %d %d %d",
|
||||
&tc.a, &tc.b, &tc.c, &tc.d, &tc.e, &tc.f, &tc.s);
|
||||
if ( items != 7 ) {
|
||||
fprintf(stderr, "Improperly formatted pointer calibration file %s.\n", cal_filename);
|
||||
fprintf(stderr, "Improperly formatted pointer calibration file %s.\n", cal_filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ static int PD_Open(void)
|
||||
|
||||
tp_fd = open(TPH_DEV_FILE, O_RDONLY);
|
||||
if (tp_fd < 0) {
|
||||
fprintf(stderr, "Error %d opening touch panel\n", errno);
|
||||
fprintf(stderr, "Error %d opening touch panel\n", errno);
|
||||
return -1;
|
||||
}
|
||||
#ifdef _TP_TSBREF
|
||||
@@ -207,10 +207,10 @@ static int PD_Open(void)
|
||||
s.settletime = settle_upper_limit * 50 / 100;
|
||||
result = ioctl(tp_fd, TPSETSCANPARM, &s);
|
||||
if ( result < 0 )
|
||||
fprintf(stderr, "Error %d, result %d setting scan parameters.\n", result, errno);
|
||||
fprintf(stderr, "Error %d, result %d setting scan parameters.\n", result, errno);
|
||||
#endif
|
||||
|
||||
if (enable_coor_transf) {
|
||||
if (enable_coor_transf) {
|
||||
if (GetPointerCalibrationData() < 0) {
|
||||
close (tp_fd);
|
||||
return -1;
|
||||
@@ -510,13 +510,8 @@ static const char* keyboard_getstate(void)
|
||||
return (char *)state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int e;
|
||||
@@ -530,32 +525,23 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if (which & IAL_MOUSEEVENT) {
|
||||
FD_SET (tp_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (tp_fd > maxfd) maxfd = tp_fd;
|
||||
#endif
|
||||
}
|
||||
#ifdef _HELIO_BUTTONS
|
||||
if (which & IAL_KEYEVENT){
|
||||
FD_SET (btn_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if(btn_fd > maxfd) maxfd = btn_fd;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (tp_fd >= 0 && FD_ISSET (tp_fd, in))
|
||||
{
|
||||
FD_CLR (tp_fd, in);
|
||||
result = PD_Read(&tp_px, &tp_py, &tp_pz, &tp_pb);
|
||||
if (result > 0) {
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
}
|
||||
}
|
||||
#ifdef _HELIO_BUTTONS
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -111,13 +111,8 @@ static int mouse_getbutton(void)
|
||||
return ts_event.pressure;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -130,27 +125,19 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0)
|
||||
{
|
||||
if (ts >= 0 && FD_ISSET (ts, in))
|
||||
{
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
FD_CLR (ts, in);
|
||||
//usleep(1);
|
||||
//usleep(1);
|
||||
ts_event.x=0;
|
||||
ts_event.y=0;
|
||||
|
||||
read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
|
||||
read (ts, &ts_event, sizeof (TS_EVENT));
|
||||
|
||||
if (ts_event.pressure > 0) {
|
||||
mousex = ts_event.x;
|
||||
mousey = ts_event.y;
|
||||
@@ -164,8 +151,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
ts_event.pressure = ( ts_event.pressure > 0 ? IAL_MOUSE_LEFTBUTTON:0);
|
||||
retvalue |= IAL_MOUSEEVENT;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -191,14 +177,14 @@ BOOL InitHH2410R3Input(INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
ts_event.x = ts_event.y = ts_event.pressure = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermHH2410R3Input(void)
|
||||
{
|
||||
if (ts >= 0)
|
||||
close(ts);
|
||||
close(ts);
|
||||
}
|
||||
|
||||
#endif /* _HH2410R3_IAL */
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -115,14 +115,14 @@ static void mouse_getxy (int *x, int* y)
|
||||
for (i = 1; i < nr_events; i++) {
|
||||
|
||||
if (ts_events [i].x > max_x) {
|
||||
max_x = ts_events [i].x;
|
||||
max_x = ts_events [i].x;
|
||||
max_event = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (ts_events [i].x < min_x) {
|
||||
min_x = ts_events [i].x;
|
||||
min_x = ts_events [i].x;
|
||||
min_event = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nr_events; i++) {
|
||||
@@ -132,14 +132,14 @@ static void mouse_getxy (int *x, int* y)
|
||||
}
|
||||
}
|
||||
|
||||
if (max_event == min_event ) {
|
||||
*x = sum_x / (nr_events - 1);
|
||||
*y = sum_y / (nr_events - 1);
|
||||
}
|
||||
else {
|
||||
*x = sum_x / (nr_events - 2);
|
||||
*y = sum_y / (nr_events - 2);
|
||||
}
|
||||
if (max_event == min_event ) {
|
||||
*x = sum_x / (nr_events - 1);
|
||||
*y = sum_y / (nr_events - 1);
|
||||
}
|
||||
else {
|
||||
*x = sum_x / (nr_events - 2);
|
||||
*y = sum_y / (nr_events - 2);
|
||||
}
|
||||
|
||||
if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10) {
|
||||
mousex = *x;
|
||||
@@ -164,13 +164,8 @@ static int mouse_getbutton (void)
|
||||
return button;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -183,18 +178,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
TS_EVENT ts_event;
|
||||
|
||||
@@ -242,11 +230,11 @@ BOOL InitHH2440Input(INPUT* input, const char* mdev, const char* mtype)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TermHH2440Input (void)
|
||||
void TermHH2440Input (void)
|
||||
{
|
||||
|
||||
if (ts >= 0)
|
||||
close (ts);
|
||||
close (ts);
|
||||
}
|
||||
|
||||
#endif /* _HH2440_IAL */
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** hh5249kbdir.c: IAL Engine for HH5249 PS/2 keyboard and IrDA.
|
||||
**
|
||||
**
|
||||
** Author: Wei Yongming (2004/05/19)
|
||||
*/
|
||||
|
||||
@@ -121,39 +121,39 @@ static struct _irkey_scancode_map {
|
||||
{IRKEY_LH_INC, SCANCODE_USER+21},
|
||||
{IRKEY_LH_DEC, SCANCODE_USER+22},
|
||||
#else
|
||||
{IRKEY_1, SCANCODE_ESCAPE},
|
||||
{IRKEY_2, SCANCODE_1},
|
||||
{IRKEY_3, SCANCODE_2},
|
||||
{IRKEY_4, SCANCODE_3},
|
||||
{IRKEY_5, SCANCODE_4},
|
||||
{IRKEY_6, SCANCODE_5},
|
||||
{IRKEY_7, SCANCODE_6},
|
||||
{IRKEY_8, SCANCODE_7},
|
||||
{IRKEY_9, SCANCODE_8},
|
||||
{IRKEY_10, SCANCODE_9},
|
||||
{IRKEY_11, SCANCODE_0},
|
||||
{IRKEY_12, SCANCODE_USER+2},
|
||||
{IRKEY_13, SCANCODE_USER+3},
|
||||
{IRKEY_14, SCANCODE_USER+4},
|
||||
{IRKEY_15, SCANCODE_USER+5},
|
||||
{IRKEY_16, SCANCODE_USER+6},
|
||||
{IRKEY_17, SCANCODE_TAB},
|
||||
{IRKEY_18, SCANCODE_USER+8},
|
||||
{IRKEY_19, SCANCODE_ENTER},
|
||||
{IRKEY_20, SCANCODE_USER+10},
|
||||
{IRKEY_21, SCANCODE_USER+11},
|
||||
{IRKEY_22, SCANCODE_BACKSPACE},
|
||||
{IRKEY_23, SCANCODE_USER+9},
|
||||
{IRKEY_24, SCANCODE_USER+14},
|
||||
{IRKEY_25, SCANCODE_USER+15},
|
||||
{IRKEY_26, SCANCODE_USER+16},
|
||||
{IRKEY_27, SCANCODE_USER+17},
|
||||
{IRKEY_28, SCANCODE_USER+18},
|
||||
{IRKEY_29, SCANCODE_USER+19},
|
||||
{IRKEY_30, SCANCODE_USER+20},
|
||||
{IRKEY_31, SCANCODE_USER+21},
|
||||
{IRKEY_32, SCANCODE_USER+22},
|
||||
{IRKEY_33, SCANCODE_USER+23},
|
||||
{IRKEY_1, SCANCODE_ESCAPE},
|
||||
{IRKEY_2, SCANCODE_1},
|
||||
{IRKEY_3, SCANCODE_2},
|
||||
{IRKEY_4, SCANCODE_3},
|
||||
{IRKEY_5, SCANCODE_4},
|
||||
{IRKEY_6, SCANCODE_5},
|
||||
{IRKEY_7, SCANCODE_6},
|
||||
{IRKEY_8, SCANCODE_7},
|
||||
{IRKEY_9, SCANCODE_8},
|
||||
{IRKEY_10, SCANCODE_9},
|
||||
{IRKEY_11, SCANCODE_0},
|
||||
{IRKEY_12, SCANCODE_USER+2},
|
||||
{IRKEY_13, SCANCODE_USER+3},
|
||||
{IRKEY_14, SCANCODE_USER+4},
|
||||
{IRKEY_15, SCANCODE_USER+5},
|
||||
{IRKEY_16, SCANCODE_USER+6},
|
||||
{IRKEY_17, SCANCODE_TAB},
|
||||
{IRKEY_18, SCANCODE_USER+8},
|
||||
{IRKEY_19, SCANCODE_ENTER},
|
||||
{IRKEY_20, SCANCODE_USER+10},
|
||||
{IRKEY_21, SCANCODE_USER+11},
|
||||
{IRKEY_22, SCANCODE_BACKSPACE},
|
||||
{IRKEY_23, SCANCODE_USER+9},
|
||||
{IRKEY_24, SCANCODE_USER+14},
|
||||
{IRKEY_25, SCANCODE_USER+15},
|
||||
{IRKEY_26, SCANCODE_USER+16},
|
||||
{IRKEY_27, SCANCODE_USER+17},
|
||||
{IRKEY_28, SCANCODE_USER+18},
|
||||
{IRKEY_29, SCANCODE_USER+19},
|
||||
{IRKEY_30, SCANCODE_USER+20},
|
||||
{IRKEY_31, SCANCODE_USER+21},
|
||||
{IRKEY_32, SCANCODE_USER+22},
|
||||
{IRKEY_33, SCANCODE_USER+23},
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -182,13 +182,8 @@ static const char * keyboard_get_state(void)
|
||||
return (char *)key_state;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -197,11 +192,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
if (cur_ir_scancode) {
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
select (maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
select (FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
if (cur_ir_scancode) {
|
||||
key_state [cur_ir_scancode] = 0;
|
||||
cur_ir_scancode = 0;
|
||||
@@ -221,18 +212,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
FD_SET (ps2kbd_fd, in);
|
||||
if (irkbd_fd >= 0)
|
||||
FD_SET (irkbd_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (MAX (ps2kbd_fd, irkbd_fd) > maxfd) maxfd = MAX (ps2kbd_fd, irkbd_fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ps2kbd_fd >= 0 && FD_ISSET (ps2kbd_fd, in)) {
|
||||
unsigned char scancode;
|
||||
|
||||
|
||||
213
src/ial/hi3510.c
213
src/ial/hi3510.c
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -114,7 +114,7 @@ static int mouse_buttons;
|
||||
static struct SimKeyData kbd_data = { 0 };
|
||||
static unsigned char kbd_state [MGUI_NR_KEYS + 1] = { 0 };
|
||||
|
||||
/*custom keys difined below are used for STB,
|
||||
/*custom keys difined below are used for STB,
|
||||
those macros will put in common.h*/
|
||||
/*power*/
|
||||
#define SCANCODE_V_POWER (SCANCODE_USER)
|
||||
@@ -245,9 +245,9 @@ those macros will put in common.h*/
|
||||
#define SCANCODE_V_INFO (SCANCODE_USER + 27)
|
||||
|
||||
/* key map table*/
|
||||
static MAPITEM gs_stKeyMapTable [] =
|
||||
{
|
||||
{0x0001, SCANCODE_SPACE , 0}, // Key_Space
|
||||
static MAPITEM gs_stKeyMapTable [] =
|
||||
{
|
||||
{0x0001, SCANCODE_SPACE , 0}, // Key_Space
|
||||
{0x0002, SCANCODE_APOSTROPHE , 0}, // Key_Apostrophe
|
||||
{0x0003, SCANCODE_COMMA , 0}, // Key_Comma
|
||||
{0x0005, SCANCODE_MINUS , 0}, // Key_Minus
|
||||
@@ -256,9 +256,9 @@ static MAPITEM gs_stKeyMapTable [] =
|
||||
{0x0008, SCANCODE_SEMICOLON , 0}, // Key_Semicolon
|
||||
{0x0009, SCANCODE_EQUAL , 0}, // Key_Equal
|
||||
{0x000A, SCANCODE_BACKSLASH , 0}, // Key_BracketLeft
|
||||
{0x000B, SCANCODE_GRAVE , 0}, // Key_Backslash
|
||||
{0x000C, SCANCODE_BRACKET_LEFT , 0}, // Key_BracketRight
|
||||
{0x000D, SCANCODE_BRACKET_RIGHT , 0}, // Key_QuoteLeft = 0x60
|
||||
{0x000B, SCANCODE_GRAVE , 0}, // Key_Backslash
|
||||
{0x000C, SCANCODE_BRACKET_LEFT , 0}, // Key_BracketRight
|
||||
{0x000D, SCANCODE_BRACKET_RIGHT , 0}, // Key_QuoteLeft = 0x60
|
||||
{0x000E, SCANCODE_0 , 0}, // Key_0
|
||||
{0x000F, SCANCODE_1 , 0}, // Key_1
|
||||
{0x0010, SCANCODE_2 , 0}, // Key_2
|
||||
@@ -297,12 +297,12 @@ static MAPITEM gs_stKeyMapTable [] =
|
||||
{0x0031, SCANCODE_Z , 0}, // Key_Z
|
||||
{0x1001, SCANCODE_ESCAPE , 0}, // Key_Escape
|
||||
{0x1002, SCANCODE_TAB , 0}, // Key_Tab
|
||||
{0x1003, SCANCODE_BACKSPACE , 0}, // Key_Backspace
|
||||
{0x1004, SCANCODE_ENTER , 0}, // Key_Return
|
||||
{0x1003, SCANCODE_BACKSPACE , 0}, // Key_Backspace
|
||||
{0x1004, SCANCODE_ENTER , 0}, // Key_Return
|
||||
{0x1005, SCANCODE_INSERT , 0}, // Key_Insert
|
||||
{0x1006, SCANCODE_REMOVE , 0}, // Key_Delete
|
||||
{0x1007, SCANCODE_PAUSE , 0}, // Key_Pause
|
||||
{0x1008, SCANCODE_PRINTSCREEN , 0}, // Key_Print
|
||||
{0x1008, SCANCODE_PRINTSCREEN , 0}, // Key_Print
|
||||
{0x1009, SCANCODE_HOME , 0}, // Key_Home
|
||||
{0x100A, SCANCODE_END , 0}, // Key_End
|
||||
{0x100B, SCANCODE_CURSORBLOCKLEFT , 0}, // Key_Left
|
||||
@@ -312,7 +312,7 @@ static MAPITEM gs_stKeyMapTable [] =
|
||||
{0x100F, SCANCODE_PAGEUP , 0}, // Key_PageUp
|
||||
{0x1010, SCANCODE_PAGEDOWN , 0}, // Key_PageDown
|
||||
{0x1011, SCANCODE_LEFTSHIFT , 0}, // Key_Shift
|
||||
{0x1012, SCANCODE_LEFTCONTROL , 0}, // Key_Control
|
||||
{0x1012, SCANCODE_LEFTCONTROL , 0}, // Key_Control
|
||||
{0x1013, SCANCODE_LEFTALT , 0}, // Key_Alt
|
||||
{0x1014, SCANCODE_CAPSLOCK , 0}, // Key_CapsLock
|
||||
{0x1015, SCANCODE_NUMLOCK , 0}, // Key_NumLock
|
||||
@@ -328,58 +328,58 @@ static MAPITEM gs_stKeyMapTable [] =
|
||||
{0x101F, SCANCODE_F9 , 0}, // Key_F9
|
||||
{0x1020, SCANCODE_F10 , 0}, // Key_F10
|
||||
{0x1021, SCANCODE_F11 , 0}, // Key_F11
|
||||
{0x1022, SCANCODE_F12 , 0}, // Key_F12
|
||||
{0x1023, SCANCODE_MENU , 0}, // Key_Menu
|
||||
{0x1101, SCANCODE_V_POWER , 0}, //
|
||||
{0x1102, SCANCODE_V_MUTE , 0}, //
|
||||
{0x1103, SCANCODE_V_NUM_1 , 0}, //
|
||||
{0x1104, SCANCODE_V_NUM_2 , 0}, //
|
||||
{0x1022, SCANCODE_F12 , 0}, // Key_F12
|
||||
{0x1023, SCANCODE_MENU , 0}, // Key_Menu
|
||||
{0x1101, SCANCODE_V_POWER , 0}, //
|
||||
{0x1102, SCANCODE_V_MUTE , 0}, //
|
||||
{0x1103, SCANCODE_V_NUM_1 , 0}, //
|
||||
{0x1104, SCANCODE_V_NUM_2 , 0}, //
|
||||
{0x1105, SCANCODE_V_NUM_3 , 0}, //
|
||||
{0x1106, SCANCODE_V_NUM_4 , 0}, //
|
||||
{0x1107, SCANCODE_V_NUM_5 , 0}, //
|
||||
{0x1108, SCANCODE_V_NUM_6 , 0}, //
|
||||
{0x1109, SCANCODE_V_NUM_7 , 0}, //
|
||||
{0x1110, SCANCODE_V_NUM_8 , 0}, //
|
||||
{0x1106, SCANCODE_V_NUM_4 , 0}, //
|
||||
{0x1107, SCANCODE_V_NUM_5 , 0}, //
|
||||
{0x1108, SCANCODE_V_NUM_6 , 0}, //
|
||||
{0x1109, SCANCODE_V_NUM_7 , 0}, //
|
||||
{0x1110, SCANCODE_V_NUM_8 , 0}, //
|
||||
{0x1111, SCANCODE_V_NUM_9 , 0}, //
|
||||
{0x1112, SCANCODE_V_NUM_0 , 0}, //
|
||||
{0x1113, SCANCODE_V_SWITCH , 0}, //
|
||||
{0x1114, SCANCODE_V_BACKSPACE , 0}, //
|
||||
{0x1115, SCANCODE_V_CHANNEL , 0}, //
|
||||
{0x1116, SCANCODE_V_MENU , 0}, //
|
||||
{0x1113, SCANCODE_V_SWITCH , 0}, //
|
||||
{0x1114, SCANCODE_V_BACKSPACE , 0}, //
|
||||
{0x1115, SCANCODE_V_CHANNEL , 0}, //
|
||||
{0x1116, SCANCODE_V_MENU , 0}, //
|
||||
{0x1117, SCANCODE_V_LEFT , 0}, //
|
||||
{0x1118, SCANCODE_V_RIGHT , 0}, //
|
||||
{0x1119, SCANCODE_V_UP , 0}, //
|
||||
{0x1120, SCANCODE_V_DOWN , 0}, //
|
||||
{0x1121, SCANCODE_V_CONFIRM , 0}, //
|
||||
{0x1122, SCANCODE_V_F1 , 0}, //
|
||||
{0x1119, SCANCODE_V_UP , 0}, //
|
||||
{0x1120, SCANCODE_V_DOWN , 0}, //
|
||||
{0x1121, SCANCODE_V_CONFIRM , 0}, //
|
||||
{0x1122, SCANCODE_V_F1 , 0}, //
|
||||
{0x1123, SCANCODE_V_F2 , 0}, //
|
||||
{0x1124, SCANCODE_V_F3 , 0}, //
|
||||
{0x1125, SCANCODE_V_F4 , 0}, //
|
||||
{0x1126, SCANCODE_V_GO_BACK , 0}, //
|
||||
{0x1127, SCANCODE_V_FAVORITE , 0}, //
|
||||
{0x1128, SCANCODE_V_IME , 0}, //
|
||||
{0x1125, SCANCODE_V_F4 , 0}, //
|
||||
{0x1126, SCANCODE_V_GO_BACK , 0}, //
|
||||
{0x1127, SCANCODE_V_FAVORITE , 0}, //
|
||||
{0x1128, SCANCODE_V_IME , 0}, //
|
||||
{0x1129, SCANCODE_V_ESCAPE , 0}, //
|
||||
{0x1130, SCANCODE_V_PLAY , 0}, //
|
||||
{0x1131, SCANCODE_V_PAUSE , 0}, //
|
||||
{0x1132, SCANCODE_V_STOP , 0}, //
|
||||
{0x1133, SCANCODE_V_BACKWARD , 0}, //
|
||||
{0x1134, SCANCODE_V_FORWARD , 0}, //
|
||||
{0x1131, SCANCODE_V_PAUSE , 0}, //
|
||||
{0x1132, SCANCODE_V_STOP , 0}, //
|
||||
{0x1133, SCANCODE_V_BACKWARD , 0}, //
|
||||
{0x1134, SCANCODE_V_FORWARD , 0}, //
|
||||
{0x1135, SCANCODE_V_LOCATE , 0}, //
|
||||
{0x1136, SCANCODE_V_VOLUME_UP , 0}, //
|
||||
{0x1137, SCANCODE_V_VOLUME_DOWN , 0}, //
|
||||
{0x1138, SCANCODE_V_SYSTEM , 0}, //
|
||||
{0x1139, SCANCODE_V_CONFIG , 0}, //
|
||||
{0x1140, SCANCODE_V_TRACK , 0}, //
|
||||
{0x1141, SCANCODE_V_INFO , 0} //
|
||||
{0x1137, SCANCODE_V_VOLUME_DOWN , 0}, //
|
||||
{0x1138, SCANCODE_V_SYSTEM , 0}, //
|
||||
{0x1139, SCANCODE_V_CONFIG , 0}, //
|
||||
{0x1140, SCANCODE_V_TRACK , 0}, //
|
||||
{0x1141, SCANCODE_V_INFO , 0} //
|
||||
};
|
||||
|
||||
static int gs_iCurPanelKeys = sizeof (gs_stKeyMapTable) / sizeof (MAPITEM);
|
||||
|
||||
/*maxium scan code value of current mapping keys.*/
|
||||
static int gs_iMaxScanCode = 0;
|
||||
|
||||
|
||||
/*number of mapping keys's events to be fetched by up UI.*/
|
||||
static int gs_iVKeysToBeHandled = 0;
|
||||
static int gs_iVKeysToBeHandled = 0;
|
||||
|
||||
/*store last key map item.*/
|
||||
static MAPITEM gs_stMapItem = {0xffff, 0, 0};
|
||||
@@ -390,7 +390,7 @@ static LPMAPITEM GetMapItem (int wIndex)
|
||||
int hig = gs_iCurPanelKeys - 1;
|
||||
int mid;
|
||||
|
||||
/* half-way finding.*/
|
||||
/* half-way finding.*/
|
||||
while (low <= hig)
|
||||
{
|
||||
mid = (low + hig) / 2;
|
||||
@@ -412,10 +412,10 @@ static LPMAPITEM GetMapItem (int wIndex)
|
||||
}
|
||||
|
||||
static void init_code_map (void)
|
||||
{
|
||||
{
|
||||
int i,j;
|
||||
MAPITEM stItem;
|
||||
|
||||
|
||||
gs_iMaxScanCode = 0;
|
||||
|
||||
for (i = 0; i < gs_iCurPanelKeys; ++i)
|
||||
@@ -424,7 +424,7 @@ static void init_code_map (void)
|
||||
{
|
||||
gs_iMaxScanCode = gs_stKeyMapTable[i].btVirtualKey1;
|
||||
}
|
||||
|
||||
|
||||
if (gs_iMaxScanCode < gs_stKeyMapTable[i].btVirtualKey2)
|
||||
{
|
||||
gs_iMaxScanCode = gs_stKeyMapTable[i].btVirtualKey2;
|
||||
@@ -446,9 +446,9 @@ static void init_code_map (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*maxium of scan code must greater than all keys' scan code*/
|
||||
gs_iMaxScanCode += 1;
|
||||
gs_iMaxScanCode += 1;
|
||||
}
|
||||
|
||||
/************************ Low Level Input Operations **********************/
|
||||
@@ -475,9 +475,9 @@ static int mouse_update (void)
|
||||
{
|
||||
if( SIM_INPUT_TYPE_MOUSE == struSimInputData.ulInputType )
|
||||
{
|
||||
mouse_pt.x = (struSimInputData.ucContent[0] << 8)
|
||||
mouse_pt.x = (struSimInputData.ucContent[0] << 8)
|
||||
| struSimInputData.ucContent[1];
|
||||
mouse_pt.y = (struSimInputData.ucContent[2] << 8)
|
||||
mouse_pt.y = (struSimInputData.ucContent[2] << 8)
|
||||
| struSimInputData.ucContent[3];
|
||||
mouse_buttons = struSimInputData.ucContent[4];
|
||||
#ifdef _DEBUG
|
||||
@@ -531,7 +531,7 @@ static int keyboard_update (void)
|
||||
static BYTE s_btShiftState = 0; // up
|
||||
SIM_INPUT_MSG_S struSimInputData;
|
||||
int ret;
|
||||
LPMAPITEM pItem;
|
||||
LPMAPITEM pItem;
|
||||
int wKeyCode;
|
||||
struct sockaddr_in from;
|
||||
socklen_t fromsize;
|
||||
@@ -578,14 +578,14 @@ static int keyboard_update (void)
|
||||
}
|
||||
|
||||
if (kbd_data.repeat)
|
||||
{
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
vlog( "IAL::keyboard_update:receiv key code %x\n", kbd_data.keycode);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
|
||||
wKeyCode = kbd_data.keycode;
|
||||
|
||||
if((pItem = GetMapItem(wKeyCode)) == NULL)
|
||||
@@ -595,16 +595,16 @@ static int keyboard_update (void)
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gs_stMapItem = *pItem;
|
||||
|
||||
if (gs_stMapItem.btVirtualKey1)
|
||||
{
|
||||
++gs_iVKeysToBeHandled;
|
||||
{
|
||||
++gs_iVKeysToBeHandled;
|
||||
}
|
||||
if (gs_stMapItem.btVirtualKey2)
|
||||
{
|
||||
++gs_iVKeysToBeHandled;
|
||||
{
|
||||
++gs_iVKeysToBeHandled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,18 +616,18 @@ static int keyboard_update (void)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
vlog("map virtual key(%u) down message.\n",gs_stMapItem.btVirtualKey2);
|
||||
#endif /* _DEBUG */
|
||||
#endif /* _DEBUG */
|
||||
if (gs_stMapItem.btVirtualKey2 == SCANCODE_LEFTSHIFT)
|
||||
{
|
||||
s_btShiftState = kbd_data.press;
|
||||
}
|
||||
kbd_state [gs_stMapItem.btVirtualKey2] = 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
vlog("map virtual key(%u) down message.\n",gs_stMapItem.btVirtualKey1);
|
||||
#endif /* _DEBUG */
|
||||
#endif /* _DEBUG */
|
||||
if (gs_stMapItem.btVirtualKey1 == SCANCODE_LEFTSHIFT)
|
||||
{
|
||||
s_btShiftState = kbd_data.press;
|
||||
@@ -639,7 +639,7 @@ static int keyboard_update (void)
|
||||
{
|
||||
if (gs_iVKeysToBeHandled == 2)
|
||||
{
|
||||
if (gs_stMapItem.btVirtualKey2 == SCANCODE_LEFTSHIFT)
|
||||
if (gs_stMapItem.btVirtualKey2 == SCANCODE_LEFTSHIFT)
|
||||
{
|
||||
if (s_btShiftState)
|
||||
{
|
||||
@@ -651,14 +651,14 @@ static int keyboard_update (void)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
vlog("map virtual key(%u) up message.\n",gs_stMapItem.btVirtualKey2);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
#endif /* _DEBUG */
|
||||
|
||||
kbd_state [gs_stMapItem.btVirtualKey2] = 0;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (gs_stMapItem.btVirtualKey1 == SCANCODE_LEFTSHIFT)
|
||||
{
|
||||
@@ -674,12 +674,12 @@ static int keyboard_update (void)
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
vlog( "map virtual key(%u) up message.\n",gs_stMapItem.btVirtualKey1);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
#endif /* _DEBUG */
|
||||
|
||||
kbd_state [gs_stMapItem.btVirtualKey1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
--gs_iVKeysToBeHandled;
|
||||
return gs_iMaxScanCode;
|
||||
}
|
||||
@@ -689,7 +689,7 @@ static int keyboard_update (void)
|
||||
vlog( "keyboard_update:no message to be update\n");
|
||||
#endif /* _DEBUG */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char* keyboard_getstate (void)
|
||||
@@ -701,13 +701,8 @@ static const char* keyboard_getstate (void)
|
||||
}
|
||||
|
||||
/* NOTE by weiym: Do not ignore the fd_set in, out, and except */
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif /* _LITE_VERSION */
|
||||
{
|
||||
fd_set rfds;
|
||||
int retvalue = 0;
|
||||
@@ -721,22 +716,22 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
if (which & IAL_KEYEVENT && (kbd_fd >= 0) )
|
||||
{
|
||||
if (gs_iVKeysToBeHandled > 0)
|
||||
{
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
vlog( "There are still some mapping virtual key "
|
||||
"to be handled, return immediately\n");
|
||||
#endif /* _DEBUG */
|
||||
#endif /* _DEBUG */
|
||||
|
||||
if (in)
|
||||
{
|
||||
FD_ZERO (in);
|
||||
}
|
||||
|
||||
|
||||
if (out)
|
||||
{
|
||||
FD_ZERO (out);
|
||||
}
|
||||
|
||||
|
||||
retvalue |= IAL_KEYEVENT;
|
||||
return retvalue;
|
||||
}
|
||||
@@ -745,27 +740,17 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
{
|
||||
fd = kbd_fd;
|
||||
FD_SET (kbd_fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (which & IAL_MOUSEEVENT && mouse_fd >= 0) {
|
||||
fd = mouse_fd;
|
||||
FD_SET (fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: pass the real set size */
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
fd = mouse_fd;
|
||||
/* If data is present on the mouse fd, service it: */
|
||||
@@ -782,8 +767,8 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
FD_CLR (fd, in);
|
||||
retvalue |= IAL_KEYEVENT;
|
||||
key_flag |= KEYBOARD_NETWORK;
|
||||
}
|
||||
} else if (e < 0) {
|
||||
}
|
||||
} else if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -797,15 +782,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
|
||||
BOOL InitHI3510Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr_in addr;
|
||||
int iRes;
|
||||
|
||||
kbd_fd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
|
||||
|
||||
if (kbd_fd < 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bzero(&addr, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
@@ -819,15 +804,15 @@ BOOL InitHI3510Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
close(kbd_fd);
|
||||
fprintf (stderr, "Simulate Key Input Engine: Can not bind socket.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
mouse_fd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
|
||||
|
||||
if (mouse_fd < 0)
|
||||
{
|
||||
close(kbd_fd);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bzero(&addr, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
@@ -842,7 +827,7 @@ BOOL InitHI3510Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
close(mouse_fd);
|
||||
fprintf (stderr, "Simulate Key Input Engine: Can not bind socket.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
input->update_mouse = mouse_update;
|
||||
|
||||
@@ -194,7 +194,7 @@ static INPUT inputs [] =
|
||||
{"tslib", InitTSLibInput, TermTSLibInput},
|
||||
#endif
|
||||
#ifdef _MGIAL_NEXUS
|
||||
{"nexus", InitNexusInput, TermNexusInput},
|
||||
{"nexus", InitNexusInput, TermNexusInput},
|
||||
#endif
|
||||
#ifdef _MGIAL_DAVINCI6446
|
||||
{"davinci6446", InitDavinci6446Input, TermDavinci6446Input},
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -56,14 +56,14 @@
|
||||
#include<sys/stat.h>
|
||||
|
||||
#define MAXX 9
|
||||
#define MAXY 7
|
||||
#define MAXY 7
|
||||
#define NOISX 900
|
||||
#define NOISY 1900
|
||||
#define CON 40
|
||||
|
||||
struct point {
|
||||
int x;
|
||||
int y;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct point array[MAXX][MAXY];
|
||||
@@ -79,21 +79,21 @@ int change_to_logic(struct point *temp);
|
||||
*/
|
||||
int init_ts()
|
||||
{
|
||||
int fd,size;
|
||||
int fd,size;
|
||||
|
||||
if((fd=open("data.conf",O_RDONLY)) == -1)
|
||||
{
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
if((fd=open("data.conf",O_RDONLY)) == -1)
|
||||
{
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if((size=read(fd, array,MAXX*MAXY*sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read error");
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
if((size=read(fd, array,MAXX*MAXY*sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read error");
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -102,76 +102,76 @@ int init_ts()
|
||||
*/
|
||||
int MapCoords(struct point *temp)
|
||||
{
|
||||
int i,j;
|
||||
float x,y;
|
||||
int i,j;
|
||||
float x,y;
|
||||
|
||||
i=j=0;
|
||||
i=j=0;
|
||||
/*
|
||||
temp1.x=NOISX;
|
||||
temp1.y=NOISY;
|
||||
ioctl(fd, TSTHRESHOLD, &temp1);
|
||||
temp1.x=NOISX;
|
||||
temp1.y=NOISY;
|
||||
ioctl(fd, TSTHRESHOLD, &temp1);
|
||||
|
||||
if((size=read(fd, &temp,sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read error");
|
||||
exit(1);
|
||||
}
|
||||
close(fd);
|
||||
if((size=read(fd, &temp,sizeof(struct point))) == -1)
|
||||
{
|
||||
perror("read error");
|
||||
exit(1);
|
||||
}
|
||||
close(fd);
|
||||
*/
|
||||
get_up_point(&i,&j,*temp);
|
||||
x = caculate_x(i,j,*temp);
|
||||
y = caculate_y(i,j,*temp);
|
||||
temp->x = CON*x;
|
||||
temp->y = CON*y;
|
||||
return 1;
|
||||
get_up_point(&i,&j,*temp);
|
||||
x = caculate_x(i,j,*temp);
|
||||
y = caculate_y(i,j,*temp);
|
||||
temp->x = CON*x;
|
||||
temp->y = CON*y;
|
||||
return 1;
|
||||
#ifdef DEBUG
|
||||
printf("%f,%f\n",CON*x,CON*y);
|
||||
printf("%f,%f\n",CON*x,CON*y);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* this function is used to determine the left up point
|
||||
* argument real_point is the point which was read from
|
||||
* this function is used to determine the left up point
|
||||
* argument real_point is the point which was read from
|
||||
* device.
|
||||
*/
|
||||
int get_up_point(int *p, int *q, struct point real_point)
|
||||
{
|
||||
int average_x[MAXX];
|
||||
int average_y[MAXY];
|
||||
int i ,j,total;
|
||||
int average_x[MAXX];
|
||||
int average_y[MAXY];
|
||||
int i ,j,total;
|
||||
|
||||
for(i=0;i<MAXX;i++)
|
||||
{
|
||||
for(j=0,total=0;j<MAXY;j++)
|
||||
{
|
||||
total+=array[i][j].x;
|
||||
}
|
||||
average_x[i]=total/MAXY;
|
||||
}
|
||||
|
||||
for(i=0;i<MAXY;i++)
|
||||
{
|
||||
for(j=0,total=0;j<MAXX;j++)
|
||||
{
|
||||
total+=array[j][i].y;
|
||||
}
|
||||
average_y[i]=total/MAXX;
|
||||
}
|
||||
|
||||
for(i = 0; i < MAXX; i ++)
|
||||
{
|
||||
if(real_point.x > average_x[i])
|
||||
*p = i - 1;
|
||||
break;
|
||||
}
|
||||
for(i=0;i<MAXX;i++)
|
||||
{
|
||||
for(j=0,total=0;j<MAXY;j++)
|
||||
{
|
||||
total+=array[i][j].x;
|
||||
}
|
||||
average_x[i]=total/MAXY;
|
||||
}
|
||||
|
||||
for(i = 0; i < MAXY; i ++)
|
||||
{
|
||||
if(real_point.y > average_y[i])
|
||||
*q = i - 1;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
for(i=0;i<MAXY;i++)
|
||||
{
|
||||
for(j=0,total=0;j<MAXX;j++)
|
||||
{
|
||||
total+=array[j][i].y;
|
||||
}
|
||||
average_y[i]=total/MAXX;
|
||||
}
|
||||
|
||||
for(i = 0; i < MAXX; i ++)
|
||||
{
|
||||
if(real_point.x > average_x[i])
|
||||
*p = i - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
for(i = 0; i < MAXY; i ++)
|
||||
{
|
||||
if(real_point.y > average_y[i])
|
||||
*q = i - 1;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -179,8 +179,8 @@ int get_up_point(int *p, int *q, struct point real_point)
|
||||
*/
|
||||
float caculate_x(int i,int j,struct point real_point)
|
||||
{
|
||||
float t = (float)(real_point.x - array[i][j].x)/(array[i+1][j].x - array[i][j].x);
|
||||
return i + t;
|
||||
float t = (float)(real_point.x - array[i][j].x)/(array[i+1][j].x - array[i][j].x);
|
||||
return i + t;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -188,6 +188,6 @@ float caculate_x(int i,int j,struct point real_point)
|
||||
*/
|
||||
float caculate_y(int i,int j,struct point real_point)
|
||||
{
|
||||
float t = (float)(real_point.y - array[i][j].y)/(array[i][j+1].y - array[i][j].y);
|
||||
return j + t;
|
||||
float t = (float)(real_point.y - array[i][j].y)/(array[i][j+1].y - array[i][j].y);
|
||||
return j + t;
|
||||
}
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** ipaq-h3600.c: Low Level Input Engine for iPAQ H3600/H3800
|
||||
** This driver can run on eCos and Linux.
|
||||
**
|
||||
**
|
||||
** The device driver of iPAQ H3600 touch screen is compliant to
|
||||
** the Specification for Generic Touch Screen Driver.
|
||||
** Please see the file: spec_general_ts_drv.html in this directory.
|
||||
@@ -149,16 +149,16 @@ static int keyboard_update(void)
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case 1:
|
||||
case 1:
|
||||
state[SCANCODE_LEFTSHIFT] = status;
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
state[H3600_SCANCODE_CALENDAR] = status;
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
state[H3600_SCANCODE_CONTACTS] = status;
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
state[H3600_SCANCODE_Q] = status;
|
||||
break;
|
||||
case 5:
|
||||
@@ -206,24 +206,15 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
|
||||
FD_SET (ts, in);
|
||||
#ifndef _MGRM_THREADS
|
||||
if (ts > maxfd) maxfd = ts;
|
||||
#endif
|
||||
}
|
||||
if ((which & IAL_KEYEVENT) && btn_fd >= 0){
|
||||
FD_SET (btn_fd, in);
|
||||
#ifndef _MGRM_THREADS
|
||||
if(btn_fd > maxfd) maxfd = btn_fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _MGRM_THREADS
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
if (ts >= 0 && FD_ISSET (ts, in)) {
|
||||
short data [4];
|
||||
|
||||
@@ -287,7 +278,7 @@ BOOL InitIPAQH3600Input (INPUT* input, const char* mdev, const char* mtype)
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
pos.x = pos.y = pos.b = 0;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,41 +11,41 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** ipaq-h5400.c: Low Level Input Engine for iPAQ H5400.
|
||||
**
|
||||
**
|
||||
** Created by Wei Yongming, 2001/08/20
|
||||
*/
|
||||
|
||||
@@ -122,7 +122,7 @@ static int TTY_Open (void)
|
||||
* scancode sequences (e.g. E0 XX) onto single keycodes.
|
||||
*/
|
||||
ioctl (kbd_fd, KDGKBMODE, &startup_kbdmode);
|
||||
if (ioctl(kbd_fd, KDSKBMODE, K_MEDIUMRAW) < 0)
|
||||
if (ioctl(kbd_fd, KDSKBMODE, K_MEDIUMRAW) < 0)
|
||||
goto err;
|
||||
return kbd_fd;
|
||||
|
||||
@@ -174,7 +174,7 @@ static int keyboard_update(void)
|
||||
int is_pressed;
|
||||
int retvalue;
|
||||
|
||||
retvalue = TTY_Read (&buf, &modifier);
|
||||
retvalue = TTY_Read (&buf, &modifier);
|
||||
|
||||
if ((retvalue == -1) || (retvalue == 0))
|
||||
return 0;
|
||||
@@ -183,7 +183,7 @@ static int keyboard_update(void)
|
||||
is_pressed = !(buf & 0x80);
|
||||
ch = buf & 0x7f;
|
||||
switch (ch) {
|
||||
//navigation mid
|
||||
//navigation mid
|
||||
case 96:
|
||||
state[SCANCODE_ENTER] = is_pressed;
|
||||
break;
|
||||
@@ -193,33 +193,33 @@ static int keyboard_update(void)
|
||||
state[SCANCODE_CURSORBLOCKUP] = is_pressed;
|
||||
break;
|
||||
|
||||
//navigation left
|
||||
//navigation left
|
||||
case 105:
|
||||
state[SCANCODE_CURSORBLOCKLEFT] = is_pressed;
|
||||
break;
|
||||
|
||||
//navigation right
|
||||
//navigation right
|
||||
case 106:
|
||||
state[SCANCODE_CURSORBLOCKRIGHT] = is_pressed;
|
||||
break;
|
||||
|
||||
//navigation down
|
||||
//navigation down
|
||||
case 108:
|
||||
state[SCANCODE_CURSORBLOCKDOWN] = is_pressed;
|
||||
break;
|
||||
|
||||
//left 2
|
||||
case 122:
|
||||
case 122:
|
||||
state[SCANCODE_F3] = is_pressed;
|
||||
break;
|
||||
|
||||
//left 1
|
||||
case 123:
|
||||
case 123:
|
||||
state[SCANCODE_F1] = is_pressed;
|
||||
break;
|
||||
|
||||
//right 1
|
||||
case 124:
|
||||
case 124:
|
||||
state[SCANCODE_F2] = is_pressed;
|
||||
break;
|
||||
|
||||
@@ -335,24 +335,15 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
||||
|
||||
if ((which & IAL_MOUSEEVENT) && ts_fd >= 0) {
|
||||
FD_SET (ts_fd, in);
|
||||
#ifndef _MGRM_THREADS
|
||||
if (ts_fd > maxfd) maxfd = ts_fd;
|
||||
#endif
|
||||
}
|
||||
if ((which & IAL_KEYEVENT) && kbd_fd >= 0){
|
||||
FD_SET (kbd_fd, in);
|
||||
#ifndef _MGRM_THREADS
|
||||
if(kbd_fd > maxfd) maxfd = kbd_fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _MGRM_THREADS
|
||||
e = select (maxfd + 1, in, out, except, timeout);
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout);
|
||||
#endif
|
||||
|
||||
if (e > 0) {
|
||||
if (e > 0) {
|
||||
/* If data is present on the mouse fd, service it: */
|
||||
if (ts_fd >= 0 && FD_ISSET (ts_fd, in)) {
|
||||
short data [4];
|
||||
|
||||
143
src/ial/jz4740.c
143
src/ial/jz4740.c
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -87,9 +87,9 @@
|
||||
#define TS_DEVICE "/dev/ts"
|
||||
/* for data reading from /dev/ts */
|
||||
typedef struct {
|
||||
struct timeval time;
|
||||
unsigned short type;
|
||||
unsigned short code;
|
||||
struct timeval time;
|
||||
unsigned short type;
|
||||
unsigned short code;
|
||||
unsigned int value;
|
||||
} KBD_EVENT;
|
||||
|
||||
@@ -123,11 +123,11 @@ static int mouse_update(void)
|
||||
}
|
||||
|
||||
struct jz_ts_event {
|
||||
unsigned short status;
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short pressure;
|
||||
unsigned short pad;
|
||||
unsigned short status;
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short pressure;
|
||||
unsigned short pad;
|
||||
};
|
||||
|
||||
struct jz_ts_event ts_events[DIS_NUM];
|
||||
@@ -156,31 +156,31 @@ static void mouse_getxy(int *x, int* y)
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "nr_events%d\n", nr_events);
|
||||
#endif
|
||||
for (i = 0; i < nr_events; i++) {
|
||||
for (i = 0; i < nr_events; i++) {
|
||||
tempx = (ts_events [i].x - MINX)*SCREEN_WIDTH/(MAXX-MINX);
|
||||
tempy = (ts_events [i].y - MINY)*SCREEN_HEIGHT/(MAXY-MINY);
|
||||
|
||||
if (tempx < 0) tempx = 0;
|
||||
if (tempy < 0) tempy = 0;
|
||||
|
||||
ts_events [i].x = tempx;
|
||||
ts_events [i].y = tempy;
|
||||
if (tempx < 0) tempx = 0;
|
||||
if (tempy < 0) tempy = 0;
|
||||
|
||||
if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1;
|
||||
ts_events [i].x = tempx;
|
||||
ts_events [i].y = tempy;
|
||||
|
||||
//if (ts_events [i].y < 0) ts_events [i].y = 0;
|
||||
if (ts_events [i].y > SCREEN_HEIGHT-1) ts_events [i].y = SCREEN_HEIGHT;
|
||||
if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1;
|
||||
|
||||
if (ts_events [i].x > max_x) {
|
||||
max_x = ts_events [i].x;
|
||||
max_event = i;
|
||||
}
|
||||
//if (ts_events [i].y < 0) ts_events [i].y = 0;
|
||||
if (ts_events [i].y > SCREEN_HEIGHT-1) ts_events [i].y = SCREEN_HEIGHT;
|
||||
|
||||
if (ts_events [i].x < min_x) {
|
||||
min_x = ts_events [i].x;
|
||||
min_event = i;
|
||||
}
|
||||
}
|
||||
if (ts_events [i].x > max_x) {
|
||||
max_x = ts_events [i].x;
|
||||
max_event = i;
|
||||
}
|
||||
|
||||
if (ts_events [i].x < min_x) {
|
||||
min_x = ts_events [i].x;
|
||||
min_event = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nr_events; i++) {
|
||||
if (i != max_event && i != min_event) {
|
||||
@@ -191,15 +191,15 @@ static void mouse_getxy(int *x, int* y)
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "max_event %d, min_event %d, minx=%d, miny=%d\n", max_event, min_event, ts_events[min_event].x, ts_events[min_event].y);
|
||||
#endif
|
||||
if (max_event == min_event ) {
|
||||
*x = sum_x / (nr_events - 1);
|
||||
*y = sum_y / (nr_events - 1);
|
||||
}
|
||||
else {
|
||||
*x = sum_x / (nr_events - 2);
|
||||
*y = sum_y / (nr_events - 2);
|
||||
}
|
||||
if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10)
|
||||
if (max_event == min_event ) {
|
||||
*x = sum_x / (nr_events - 1);
|
||||
*y = sum_y / (nr_events - 1);
|
||||
}
|
||||
else {
|
||||
*x = sum_x / (nr_events - 2);
|
||||
*y = sum_y / (nr_events - 2);
|
||||
}
|
||||
if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10)
|
||||
{
|
||||
mousex = *x;
|
||||
mousey = *y;
|
||||
@@ -218,20 +218,15 @@ static int mouse_getbutton(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int fd;
|
||||
int retvalue = 0;
|
||||
int ret = 0;
|
||||
int e;
|
||||
struct jz_ts_event jz_evt;
|
||||
struct jz_ts_event jz_evt;
|
||||
|
||||
if (!in) {
|
||||
in = &rfds;
|
||||
@@ -242,46 +237,37 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
if ((which & IAL_MOUSEEVENT) && touch_fd >= 0) {
|
||||
fd = touch_fd;
|
||||
FD_SET (fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
#endif
|
||||
}
|
||||
if (which & IAL_KEYEVENT && btn_fd >= 0){
|
||||
fd = btn_fd; /* FIXME: keyboard fd may be changed in vt switch! */
|
||||
fd = btn_fd;
|
||||
FD_SET (fd, in);
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0 )
|
||||
{
|
||||
fd = touch_fd;
|
||||
if (fd >= 0 && FD_ISSET (fd, in))
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
}
|
||||
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
if (e > 0 ) {
|
||||
fd = touch_fd;
|
||||
if (fd >= 0 && FD_ISSET (fd, in))
|
||||
{
|
||||
FD_CLR (fd, in);
|
||||
|
||||
retvalue = read(fd, &jz_evt, sizeof(jz_evt));
|
||||
|
||||
|
||||
retvalue = read(fd, &jz_evt, sizeof(jz_evt));
|
||||
|
||||
if (retvalue > 0) {
|
||||
if (jz_evt.pressure > 0)
|
||||
{
|
||||
ts_events [nr_events] = jz_evt;
|
||||
nr_events ++;
|
||||
if (nr_events >= DIS_NUM)
|
||||
if (nr_events >= DIS_NUM)
|
||||
{
|
||||
button = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nr_events = 0;
|
||||
nr_events = 0;
|
||||
button = 0;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
@@ -290,7 +276,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
#endif
|
||||
ret |= IAL_MOUSEEVENT;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,7 +302,7 @@ static void keycodetoscancode(void)
|
||||
keycode_scancode[KEY_5] = SCANCODE_HOME + 4;
|
||||
keycode_scancode[KEY_6] = SCANCODE_HOME + 5;
|
||||
keycode_scancode[KEY_7] = SCANCODE_HOME + 6;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -346,15 +332,14 @@ void rkbd(int sig)
|
||||
BOOL InitJZ4740Input(INPUT* input, const char* mdev, const char* mtype)
|
||||
{
|
||||
btn_fd = -1;
|
||||
|
||||
|
||||
touch_fd = open (TS_DEVICE, O_NONBLOCK);
|
||||
|
||||
if (!touch_fd) {
|
||||
_WRN_PRINTF ("IAL>TSLib: can not open ts device\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
input->update_mouse = mouse_update;
|
||||
input->get_mouse_xy = mouse_getxy;
|
||||
input->set_mouse_xy = NULL;
|
||||
@@ -373,7 +358,7 @@ void TermJZ4740Input(void)
|
||||
if (touch_fd >= 0)
|
||||
close(touch_fd);
|
||||
if (btn_fd >= 0)
|
||||
close(btn_fd);
|
||||
close(btn_fd);
|
||||
}
|
||||
|
||||
#endif /* _JZ4740_IAL */
|
||||
#endif /* _JZ4740_IAL */
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** l7200.c: Low Level Input Engine for LinkUp System L7200 SDB
|
||||
** This driver can run on Linux.
|
||||
**
|
||||
**
|
||||
** Created by Yao Yunyuan, 2004/06/20
|
||||
*/
|
||||
|
||||
@@ -149,13 +149,8 @@ static int mouse_getbutton(void)
|
||||
return stylus ? IAL_MOUSE_LEFTBUTTON : 0;
|
||||
}
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
int retvalue = 0;
|
||||
int e;
|
||||
@@ -164,12 +159,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
stimeout.tv_usec = 10;
|
||||
stimeout.tv_sec = 0;
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, &stimeout);
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, &stimeout);
|
||||
#endif
|
||||
|
||||
if (e < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
147
src/ial/lide.c
147
src/ial/lide.c
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -85,9 +85,9 @@ static POINT dst_pts[5]={{100,60},{699,60},{699,419},{100,419},{400,240}};
|
||||
#define TS_DEVICE "/dev/ts"
|
||||
/* for data reading from /dev/ts */
|
||||
typedef struct {
|
||||
struct timeval time;
|
||||
unsigned short type;
|
||||
unsigned short code;
|
||||
struct timeval time;
|
||||
unsigned short type;
|
||||
unsigned short code;
|
||||
unsigned int value;
|
||||
} KBD_EVENT;
|
||||
|
||||
@@ -121,12 +121,12 @@ static int mouse_update(void)
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
unsigned short status;
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short pressure;
|
||||
unsigned short pad;
|
||||
} jz_ts_event;
|
||||
unsigned short status;
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short pressure;
|
||||
unsigned short pad;
|
||||
} jz_ts_event;
|
||||
|
||||
static jz_ts_event ts_events[DIS_NUM];
|
||||
static jz_ts_event ts_event;
|
||||
@@ -159,31 +159,31 @@ static void mouse_getxy(int *y, int* x)
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "nr_events%d\n", nr_events);
|
||||
#endif
|
||||
for (i = 0; i < nr_events; i++)
|
||||
for (i = 0; i < nr_events; i++)
|
||||
{
|
||||
tempx = (ts_events [i].x - MINX)*SCREEN_WIDTH/(MAXX-MINX);
|
||||
tempy = (ts_events [i].y - MINY)*SCREEN_HEIGHT/(MAXY-MINY);
|
||||
|
||||
if (tempx < 0) tempx = 0;
|
||||
if (tempy < 0) tempy = 0;
|
||||
|
||||
ts_events [i].x = tempx;
|
||||
ts_events [i].y = tempy;
|
||||
if (tempx < 0) tempx = 0;
|
||||
if (tempy < 0) tempy = 0;
|
||||
|
||||
ts_events [i].x = tempx;
|
||||
ts_events [i].y = tempy;
|
||||
|
||||
if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1;
|
||||
|
||||
if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1;
|
||||
|
||||
if (ts_events [i].y > SCREEN_HEIGHT-1) ts_events [i].y = SCREEN_HEIGHT;
|
||||
|
||||
if (ts_events [i].x > max_x) {
|
||||
max_x = ts_events [i].x;
|
||||
max_event = i;
|
||||
}
|
||||
if (ts_events [i].x > max_x) {
|
||||
max_x = ts_events [i].x;
|
||||
max_event = i;
|
||||
}
|
||||
|
||||
if (ts_events [i].x < min_x) {
|
||||
min_x = ts_events [i].x;
|
||||
min_event = i;
|
||||
}
|
||||
}
|
||||
if (ts_events [i].x < min_x) {
|
||||
min_x = ts_events [i].x;
|
||||
min_event = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nr_events; i++) {
|
||||
if (i != max_event && i != min_event) {
|
||||
@@ -194,15 +194,15 @@ static void mouse_getxy(int *y, int* x)
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "max_event %d, min_event %d, minx=%d, miny=%d\n", max_event, min_event, ts_events[min_event].x, ts_events[min_event].y);
|
||||
#endif
|
||||
if (max_event == min_event ) {
|
||||
*x = sum_x / (nr_events - 1);
|
||||
*y = sum_y / (nr_events - 1);
|
||||
}
|
||||
else {
|
||||
*x = sum_x / (nr_events - 2);
|
||||
*y = sum_y / (nr_events - 2);
|
||||
}
|
||||
if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10)
|
||||
if (max_event == min_event ) {
|
||||
*x = sum_x / (nr_events - 1);
|
||||
*y = sum_y / (nr_events - 1);
|
||||
}
|
||||
else {
|
||||
*x = sum_x / (nr_events - 2);
|
||||
*y = sum_y / (nr_events - 2);
|
||||
}
|
||||
if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10)
|
||||
{
|
||||
mousex = *x;
|
||||
mousey = *y;
|
||||
@@ -221,20 +221,15 @@ static int mouse_getbutton(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
fd_set rfds;
|
||||
int fd;
|
||||
int retvalue = 0;
|
||||
int ret = 0;
|
||||
int e;
|
||||
static jz_ts_event jz_evt;
|
||||
static jz_ts_event jz_evt;
|
||||
|
||||
if (!in) {
|
||||
in = &rfds;
|
||||
@@ -245,46 +240,38 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
if ((which & IAL_MOUSEEVENT) && touch_fd >= 0) {
|
||||
fd = touch_fd;
|
||||
FD_SET (fd, in);
|
||||
#ifdef _LITE_VERSION
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
#endif
|
||||
}
|
||||
if (which & IAL_KEYEVENT && btn_fd >= 0){
|
||||
fd = btn_fd; /* FIXME: keyboard fd may be changed in vt switch! */
|
||||
fd = btn_fd;
|
||||
FD_SET (fd, in);
|
||||
|
||||
#ifdef _LITE_VERSION
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
#endif
|
||||
}
|
||||
#ifdef _LITE_VERSION
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
#else
|
||||
e = select (FD_SETSIZE, in, out, except, timeout) ;
|
||||
#endif
|
||||
|
||||
if (e > 0 )
|
||||
{
|
||||
fd = touch_fd;
|
||||
if (fd >= 0 && FD_ISSET (fd, in))
|
||||
if (fd > maxfd) maxfd = fd;
|
||||
}
|
||||
|
||||
e = select (maxfd + 1, in, out, except, timeout) ;
|
||||
if (e > 0 )
|
||||
{
|
||||
fd = touch_fd;
|
||||
if (fd >= 0 && FD_ISSET (fd, in))
|
||||
{
|
||||
FD_CLR (fd, in);
|
||||
|
||||
retvalue = read(fd, &jz_evt, sizeof(jz_evt));
|
||||
|
||||
|
||||
retvalue = read(fd, &jz_evt, sizeof(jz_evt));
|
||||
|
||||
if (retvalue > 0) {
|
||||
if (jz_evt.pressure > 0)
|
||||
{
|
||||
ts_events [nr_events] = jz_evt;
|
||||
nr_events ++;
|
||||
if (nr_events >= DIS_NUM)
|
||||
if (nr_events >= DIS_NUM)
|
||||
{
|
||||
button = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nr_events = 0;
|
||||
nr_events = 0;
|
||||
button = 0;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
@@ -293,7 +280,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
|
||||
}
|
||||
#endif
|
||||
ret |= IAL_MOUSEEVENT;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,7 +306,7 @@ static void keycodetoscancode(void)
|
||||
keycode_scancode[KEY_5] = SCANCODE_HOME + 4;
|
||||
keycode_scancode[KEY_6] = SCANCODE_HOME + 5;
|
||||
keycode_scancode[KEY_7] = SCANCODE_HOME + 6;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -349,15 +336,15 @@ void rkbd(int sig)
|
||||
BOOL InitlideInput(INPUT* input, const char* mdev, const char* mtype)
|
||||
{
|
||||
btn_fd = -1;
|
||||
|
||||
|
||||
touch_fd = open (TS_DEVICE, O_NONBLOCK);
|
||||
|
||||
if (!touch_fd) {
|
||||
_WRN_PRINTF ("IAL>TSLib: can not open ts device\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
input->update_mouse = mouse_update;
|
||||
input->get_mouse_xy = mouse_getxy;
|
||||
input->set_mouse_xy = NULL;
|
||||
@@ -367,7 +354,7 @@ BOOL InitlideInput(INPUT* input, const char* mdev, const char* mtype)
|
||||
input->wait_event = wait_event;
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
|
||||
|
||||
ts_event.x = ts_event.y = ts_event.pressure =0;
|
||||
SetMouseCalibrationParameters (src_pts, dst_pts);
|
||||
|
||||
@@ -379,7 +366,7 @@ void TermlideInput(void)
|
||||
if (touch_fd >= 0)
|
||||
close(touch_fd);
|
||||
if (btn_fd >= 0)
|
||||
close(btn_fd);
|
||||
close(btn_fd);
|
||||
}
|
||||
|
||||
#endif /* _JZ4740_IAL */
|
||||
#endif /* _JZ4740_IAL */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user