TouchScreen.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:207k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * TouchScreen.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * Low-level Touch Screen API - interface between driver or PC simulator
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #include "MMI_features.h"
- /* Save stroke data in filesystem for analysis of recognition rate */
- #undef MMI_PEN_SAVE_STROKE_IN_FILE
- /*****************************************************************************
- * In case that handwriting area is overlapped with an editor, we need to
- * define a way to move cursor inside the editor.
- *
- * Three approaches are supported:
- *
- * 1. !defined(MMI_PEN_SUPPORT_STROKE_LONGTAP) and single-block --> (MMI_PEN_STROKE_MIN_OFFSET > 0)
- *
- * In the first stroke (after mmi_pen_begin_strokes_of_character()),
- * stroke down in handwriting area is translated to Pen Down event first until pen is
- * moved across predefined distance MMI_PEN_STROKE_MIN_OFFSET.
- *
- * For example, driver events are converted to MMI events in the first stroke like:
- *
- * STROKE_DOWN, STROKE_UP --> MMI_PEN_EVENT_DOWN, MMI_PEN_EVENT_UP
- * (stroke buffer is empty, handwriting area is reset to default)
- *
- * STROKE_DOWN, STROKE_MOVE (< MMI_PEN_STROKE_MIN_OFFSET), STROKE_UP -->
- * MMI_PEN_EVENT_DOWN, MMI_PEN_EVENT_UP
- * (the STROKE_MOVE before STROKE_UP is dropped,
- * stroke buffer is empty, handwriting area is reset to default)
- *
- * STROKE_DOWN, STROKE_MOVE (> MMI_PEN_STROKE_MIN_OFFSET), STROKE_UP -->
- * MMI_PEN_EVENT_DOWN, MMI_PEN_EVENT_ABORT, MMI_PEN_STROKE_DOWN,
- * MMI_PEN_STROKE_MOVE, MMI_PEN_STROKE_UP
- * (The original Pen Down event is aborted, and the first stroke is created)
- *
- * 2. !defined(MMI_PEN_SUPPORT_STROKE_LONGTAP) and multi-block -->
- *
- * Handwriting area and non-handwriting area are not overlapped. This is the simplest case.
- *
- * Unnecessary to translate driver pen events.
- *
- * 3. defined(MMI_PEN_SUPPORT_STROKE_LONGTAP) --> (MMI_PEN_STROKE_MIN_OFFSET == 0)
- *
- * In the first stroke (after mmi_pen_begin_strokes_of_character()),
- * stroke down are translated to Stroke Down event directly. However, when pen stays at the
- * pen down position within MMI_PEN_SKIP_STROKE_LONGTAP_OFFSET after MMI_PEN_STROKE_LONGTAP_TIME,
- * Stroke LongTap event is generated. Editor will interpret the subsequent
- * Stroke Move events as editor cursor control commands.
- *
- * For example, driver events are converted to MMI events in the first stroke like:
- *
- * STROKE_DOWN, STROKE_UP --> MMI_PEN_STROKE_DOWN, MMI_PEN_STROKE_UP
- * (The first stroke is created, and stroke buffer is not empty.)
- *
- * STROKE_DOWN, STROKE_MOVE, STROKE_UP -->
- * MMI_PEN_STROKE_DOWN, MMI_PEN_STROKE_MOVE, MMI_PEN_STROKE_UP
- * (The first stroke is created, and stroke buffer is not empty.)
- *
- * STROKE_DOWN, STROKE_MOVE (1st), STROKE_LONGTAP, STROKE_MOVE (2nd), STROKE_UP -->
- * MMI_PEN_STROKE_DOWN, MMI_PEN_STROKE_MOVE (1st), MMI_PEN_STROKE_LONGTAP,
- * MMI_PEN_STROKE_MOVE (2nd), MMI_PEN_STROKE_UP
- * (The first stroke is aborted, handwriting area is reset to default,
- * Stroke buffer is cleared.)
- * (NOTE: after STROKE_LONGTAP, we decrease the sampling rate to MMI_PEN_SAMPLING_PERIOD_1)
- *
- * Note that after the first stroke is created, STROKE_LONGTAP events generated by driver are ignored.
- *
- ****************************************************************************/
- #if ( defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)) && !defined(__MTK_TARGET__)
- /*****************************************************************************
- *
- * WIN32 integration
- * PC Simulator & MODIS
- *
- ****************************************************************************/
- #include "stdC.h"
- #include "PixtelDataTypes.h"
- #include "TimerEvents.h"
- #include "KeyBrd.h"
- #include "FrameworkStruct.h"
- #include "EventsGprot.h"
- #include "EventsDcl.h"
- #include "EventsDef.h"
- #include "gui_data_types.h"
- #include "gui.h"
- #include "IdleAppProt.h"
- #include "kal_non_specific_general_types.h"
- #include "TouchScreenGprot.h"
- #include "DebugInitDef.h"
- #include "lcd_sw_rnd.h" /* LCD width/height */
- #include "time.h" /* time() */
- #include "gdi_include.h"
- #include "ScreenRotationGprot.h"
- #include "touch_panel_custom.h" /* get handwriting pad setting */
- #if !defined(MMI_ON_WIN32)
- static void mmi_pen_MODIS_start_timer(void);
- static void mmi_pen_MODIS_flush_queue(void);
- #endif /* !defined(MMI_ON_WIN32) */
- /*****************************************************************************
- * Define
- *****************************************************************************/
- #define MMI_PEN_MAX_HANDWRITING_REGION (3)
- #undef MMI_PEN_UNIT_TEST
- /*****************************************************************************
- * Typedef
- *****************************************************************************/
- typedef struct
- {
- /* mmi_pen_block() & mmi_pen_unblock() */
- U32 is_blocked:1;
- /* mmi_pen_enable() & mmi_pen_disable() */
- U32 is_enabled:1;
- /* mmi_pen_reset() set 'is_pen_down' to 0 */
- U32 is_pen_down:1;
- /* The current pen down/move/up is a stroke */
- U32 is_stroke_event:1;
- /* Checking offset with g_pen_stroke_min_offset */
- U32 is_pending_stroke_event:1;
- /* A first stroke is created. This flag is cleared in mmi_pen_begin_strokes_of_character() */
- U32 is_stroke_created:1;
- /* Stroke LongTap event is generated. */
- U32 is_stroke_longtap_event_generated:1;
- /* Set in mmi_pen_end_strokes_of_character(),
- do not enqueue incoming strokes until mmi_pen_begin_strokes_of_character() is invoked again */
- U32 is_all_stroke_finished:1;
- /* wait for 1: pen long-tap 0: pen repeat (event-based) */
- U32 is_waiting_long_tap_event:1;
- /*
- * Set by mmi_pen_change_handwriting_area() and mmi_pen_stop_capture_strokes().
- * Close stroke and reset touch screen when pen is up.
- */
- U32 reset_stroke_on_pen_up:1;
- /* The position where pen is tapped down */
- mmi_pen_point_struct pen_down_pos;
- /* Block index of handwriting area */
- S32 stroke_down_block_index;
- /* The current pen position */
- mmi_pen_point_struct pen_current_pos;
- /* For Pen Repeat */
- mmi_pen_point_struct pen_repeat_origin_pos;
- /* For stroke */
- S32 num_points_queued;
- } mmi_pen_context_struct;
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- static mmi_pen_context_struct g_pen_cntx;
- static mmi_pen_hdlr g_pen_event_table[MMI_PEN_EVENT_TYPE_MAX];
- static mmi_pen_hdlr g_pen_stroke_table[MMI_PEN_STROKE_TYPE_MAX];
- static void (*g_pen_stroke_pre_move) (void);
- static void (*g_pen_stroke_post_move) (void);
- static int g_pen_num_stroke_area; /* 0 if stroke area is not enabled */
- static mmi_pen_handwriting_area_struct g_pen_stroke_areas[MMI_PEN_MAX_HANDWRITING_REGION];
- static mmi_pen_handwriting_area_struct g_pen_ext_stroke_area;
- static int g_pen_stroke_min_offset;
- static S32 g_pen_stroke_max_points;
- static mmi_pen_point_struct *g_pen_stroke_points;
- /*****************************************************************************
- * Local Function
- *****************************************************************************/
- static void mmi_pen_MODIS_tp_ind(void *);
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_fix_point_bound
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN/OUT]
- * y [INT/OUT]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_simulator_fix_point_bound(S16 *x, S16 *y, MMI_BOOL check_multi_block)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_pen_handwriting_area_struct *block;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (*x < 0)
- {
- *x = 0;
- }
- else if (*x >= UI_device_width)
- {
- *x = UI_device_width - 1;
- }
- if (*y < 0)
- {
- *y = 0;
- }
- else if (*y >= UI_device_height)
- {
- *y = UI_device_height - 1;
- }
- if (check_multi_block)
- {
- MMI_ASSERT(g_pen_cntx.stroke_down_block_index >= 0 &&
- g_pen_cntx.stroke_down_block_index < g_pen_num_stroke_area);
- block = &g_pen_stroke_areas[g_pen_cntx.stroke_down_block_index];
- if (*x < block->x1)
- {
- *x = block->x1;
- }
- else if (*x > block->x2)
- {
- *x = block->x2;
- }
- if (*y < block->y1)
- {
- *y = block->y1;
- }
- else if (*y > block->y2)
- {
- *y = block->y2;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_pixel_diff
- * DESCRIPTION
- *
- * PARAMETERS
- * pos1 [IN]
- * pos2 [IN]
- * RETURNS
- *
- *****************************************************************************/
- static S16 mmi_pen_simulator_pixel_diff(mmi_pen_point_struct pos1, mmi_pen_point_struct pos2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 diff_x = pos1.x - pos2.x;
- S16 diff_y = pos1.y - pos2.y;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (diff_x < 0)
- {
- diff_x = -diff_x;
- }
- if (diff_y < 0)
- {
- diff_y = -diff_y;
- }
- return diff_x + diff_y;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_in_stroke_area
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * The index of block. 0 for block-0 or extended area, -1 if not found.
- *****************************************************************************/
- static S32 mmi_pen_simulator_in_stroke_area(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.is_stroke_created &&
- (g_pen_ext_stroke_area.x2 >= 0) && /* Test if the extended handwriting area is enabled */
- x >= g_pen_ext_stroke_area.x1 && x <= g_pen_ext_stroke_area.x2 &&
- y >= g_pen_ext_stroke_area.y1 && y <= g_pen_ext_stroke_area.y2)
- {
- return 0;
- }
- for (i = 0; i < g_pen_num_stroke_area; i++)
- {
- if (x >= g_pen_stroke_areas[i].x1 && x <= g_pen_stroke_areas[i].x2 &&
- y >= g_pen_stroke_areas[i].y1 && y <= g_pen_stroke_areas[i].y2)
- {
- return i;
- }
- }
- return -1;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_push_stroke_point
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_simulator_push_stroke_point(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.num_points_queued >= g_pen_stroke_max_points - 2)
- {
- return;
- }
- g_pen_stroke_points[g_pen_cntx.num_points_queued].x = x;
- g_pen_stroke_points[g_pen_cntx.num_points_queued].y = y;
- g_pen_cntx.num_points_queued++;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_push_stroke_end
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_simulator_push_stroke_end(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.num_points_queued >= g_pen_stroke_max_points - 1)
- {
- MMI_ASSERT(0); /* queue full */
- return;
- }
- #if defined(__MMI_HANWANG__)
- g_pen_stroke_points[g_pen_cntx.num_points_queued].x = -1;
- g_pen_stroke_points[g_pen_cntx.num_points_queued].y = 0;
- #elif defined(__MMI_PENPOWER__)
- g_pen_stroke_points[g_pen_cntx.num_points_queued].x = -1;
- g_pen_stroke_points[g_pen_cntx.num_points_queued].y = -1;
- #else
- g_pen_stroke_points[g_pen_cntx.num_points_queued].x = -1;
- g_pen_stroke_points[g_pen_cntx.num_points_queued].y = 0;
- #endif
- g_pen_cntx.num_points_queued++;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_push_char_end
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_simulator_push_char_end(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.num_points_queued >= g_pen_stroke_max_points)
- {
- MMI_ASSERT(0); /* queue full */
- return;
- }
- #if defined(__MMI_HANWANG__)
- g_pen_stroke_points[g_pen_cntx.num_points_queued].x = -1;
- g_pen_stroke_points[g_pen_cntx.num_points_queued].y = -1;
- #elif defined(__MMI_PENPOWER__)
- g_pen_stroke_points[g_pen_cntx.num_points_queued].x = -1;
- g_pen_stroke_points[g_pen_cntx.num_points_queued].y = 0;
- #else
- g_pen_stroke_points[g_pen_cntx.num_points_queued].x = -1;
- g_pen_stroke_points[g_pen_cntx.num_points_queued].y = -1;
- #endif
- g_pen_cntx.num_points_queued++;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_repeat_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_simulator_repeat_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(g_pen_cntx.is_enabled && g_pen_cntx.is_pen_down);
- if (g_pen_cntx.is_waiting_long_tap_event)
- {
- if (g_pen_event_table[MMI_PEN_EVENT_LONG_TAP])
- {
- (g_pen_event_table[MMI_PEN_EVENT_LONG_TAP]) (g_pen_cntx.pen_down_pos);
- }
- g_pen_cntx.is_waiting_long_tap_event = 0;
- }
- else
- {
- if (g_pen_event_table[MMI_PEN_EVENT_REPEAT])
- {
- (g_pen_event_table[MMI_PEN_EVENT_REPEAT]) (g_pen_cntx.pen_repeat_origin_pos);
- }
- }
- /* touch screen might be disabled/reset inside pen handler */
- if (g_pen_cntx.is_enabled && g_pen_cntx.is_pen_down)
- {
- gui_start_timer(MMI_PEN_REPEAT_TIME * 10, mmi_pen_simulator_repeat_hdlr);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_stroke_longtap_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_simulator_stroke_longtap_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(g_pen_cntx.is_enabled && g_pen_cntx.is_pen_down && g_pen_cntx.is_stroke_event);
- g_pen_cntx.is_stroke_longtap_event_generated = 1;
- if (g_pen_stroke_table[MMI_PEN_STROKE_LONGTAP])
- {
- (g_pen_stroke_table[MMI_PEN_STROKE_LONGTAP]) (g_pen_cntx.pen_current_pos);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_button_down_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_simulator_button_down_hdlr(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_pen_point_struct pos;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_pen_cntx.is_enabled || g_pen_cntx.is_all_stroke_finished)
- {
- return;
- }
- MMI_DBG_ASSERT(!g_pen_cntx.is_pen_down);
- mmi_pen_simulator_fix_point_bound(&x, &y, MMI_FALSE);
- pos.x = x;
- pos.y = y;
- g_pen_cntx.pen_down_pos = g_pen_cntx.pen_current_pos = g_pen_cntx.pen_repeat_origin_pos = pos;
- g_pen_cntx.is_pen_down = 1;
- g_pen_cntx.is_stroke_event = 0;
- g_pen_cntx.is_pending_stroke_event = 0;
- g_pen_cntx.is_stroke_longtap_event_generated = 0;
- /* Not reset is_stroke_created */
- g_pen_cntx.is_waiting_long_tap_event = 0;
- if ((g_pen_cntx.stroke_down_block_index = mmi_pen_simulator_in_stroke_area(x, y)) >= 0)
- {
- if (!g_pen_cntx.is_stroke_created && g_pen_stroke_min_offset > 0)
- {
- g_pen_cntx.is_pending_stroke_event = 1;
- /* Fire pen down event. For example, it will display key down on virtual keyboard */
- if (g_pen_event_table[MMI_PEN_EVENT_DOWN])
- {
- (g_pen_event_table[MMI_PEN_EVENT_DOWN]) (pos);
- }
- }
- else
- {
- if (!g_pen_cntx.is_stroke_created) /* StrokeLongTap is used in the first stroke only */
- {
- gui_start_timer(MMI_PEN_STROKE_LONGTAP_TIME * 10, mmi_pen_simulator_stroke_longtap_hdlr);
- }
- g_pen_cntx.is_stroke_event = 1;
- g_pen_cntx.is_stroke_created = 1;
- if (g_pen_stroke_table[MMI_PEN_STROKE_DOWN])
- {
- (g_pen_stroke_table[MMI_PEN_STROKE_DOWN]) (pos);
- }
- /* Put stroke point after stroke down handler because multi-block handwriting may invoke
- * mmi_pen_begin_strokes_of_character() and mmi_pen_end_strokes_of_character() in
- * Stroke Down handler.
- */
- if (g_pen_cntx.is_enabled && g_pen_cntx.is_pen_down && g_pen_stroke_max_points > 0)
- {
- mmi_pen_simulator_push_stroke_point(x, y);
- }
- }
- }
- else
- {
- /* Note that Pen Down handler might call mmi_pen_reset() */
- if (g_pen_event_table[MMI_PEN_EVENT_DOWN])
- {
- (g_pen_event_table[MMI_PEN_EVENT_DOWN]) (pos);
- }
- /* touch screen might be disabled inside pen handler */
- if (g_pen_cntx.is_enabled && g_pen_cntx.is_pen_down)
- {
- g_pen_cntx.is_waiting_long_tap_event = 1;
- gui_start_timer(MMI_PEN_REPEAT_TIME * 10, mmi_pen_simulator_repeat_hdlr);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_button_move_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_simulator_button_move_hdlr(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_pen_point_struct pos;
- BOOL restart_repeat_timer = MMI_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_pen_cntx.is_enabled || !g_pen_cntx.is_pen_down)
- {
- return;
- }
- mmi_pen_simulator_fix_point_bound(&x, &y, g_pen_cntx.is_stroke_event && (g_pen_num_stroke_area > 1));
- pos.x = x;
- pos.y = y;
- g_pen_cntx.pen_current_pos = pos;
- if (g_pen_cntx.is_pending_stroke_event)
- {
- if (mmi_pen_simulator_pixel_diff(pos, g_pen_cntx.pen_down_pos) > g_pen_stroke_min_offset)
- {
- g_pen_cntx.is_pending_stroke_event = 0;
- g_pen_cntx.is_stroke_event = 1;
- g_pen_cntx.is_stroke_created = 1;
- /* Abort previous pen down event */
- if (g_pen_event_table[MMI_PEN_EVENT_ABORT])
- {
- (g_pen_event_table[MMI_PEN_EVENT_ABORT]) (pos);
- }
- mmi_pen_simulator_push_stroke_point(g_pen_cntx.pen_down_pos.x, g_pen_cntx.pen_down_pos.y);
- mmi_pen_simulator_push_stroke_point(x, y);
- if (g_pen_stroke_table[MMI_PEN_STROKE_DOWN])
- {
- (g_pen_stroke_table[MMI_PEN_STROKE_DOWN]) (g_pen_cntx.pen_down_pos);
- }
- if (g_pen_stroke_pre_move)
- {
- g_pen_stroke_pre_move();
- }
- if (g_pen_stroke_table[MMI_PEN_STROKE_MOVE])
- {
- (g_pen_stroke_table[MMI_PEN_STROKE_MOVE]) (pos);
- }
- if (g_pen_stroke_post_move)
- {
- g_pen_stroke_post_move();
- }
- }
- /* Otherwise, ignore the move event */
- }
- else if (g_pen_cntx.is_stroke_event)
- {
- if (g_pen_stroke_pre_move)
- {
- g_pen_stroke_pre_move();
- }
- if (g_pen_stroke_table[MMI_PEN_STROKE_MOVE])
- {
- (g_pen_stroke_table[MMI_PEN_STROKE_MOVE]) (pos);
- }
- if (g_pen_stroke_post_move)
- {
- g_pen_stroke_post_move();
- }
- mmi_pen_simulator_push_stroke_point(x, y);
- if (mmi_pen_simulator_pixel_diff(pos, g_pen_cntx.pen_down_pos) > MMI_PEN_SKIP_STROKE_LONGTAP_OFFSET)
- {
- gui_cancel_timer(mmi_pen_simulator_stroke_longtap_hdlr);
- }
- }
- else
- {
- if (g_pen_event_table[MMI_PEN_EVENT_MOVE])
- {
- (g_pen_event_table[MMI_PEN_EVENT_MOVE]) (pos);
- }
- if (mmi_pen_simulator_pixel_diff(pos, g_pen_cntx.pen_repeat_origin_pos) > MMI_PEN_SKIP_LONGTAP_OFFSET)
- {
- g_pen_cntx.is_waiting_long_tap_event = 0; /* Wait Pen Repeat because Pen LongTap only happens at the pen down position */
- g_pen_cntx.pen_repeat_origin_pos = pos;
- gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);
- if (g_pen_cntx.is_enabled && g_pen_cntx.is_pen_down)
- {
- gui_start_timer(MMI_PEN_REPEAT_TIME * 10, mmi_pen_simulator_repeat_hdlr);
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_simulator_button_up_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_simulator_button_up_hdlr(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_pen_point_struct pos;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_pen_cntx.is_enabled || !g_pen_cntx.is_pen_down)
- {
- return;
- }
- mmi_pen_simulator_fix_point_bound(&x, &y, g_pen_cntx.is_stroke_event && (g_pen_num_stroke_area > 1));
- pos.x = x;
- pos.y = y;
- g_pen_cntx.pen_current_pos = pos;
- g_pen_cntx.is_pen_down = 0;
- if (g_pen_cntx.is_pending_stroke_event)
- {
- if (g_pen_event_table[MMI_PEN_EVENT_UP])
- {
- (g_pen_event_table[MMI_PEN_EVENT_UP]) (g_pen_cntx.pen_down_pos);
- }
- }
- else if (g_pen_cntx.is_stroke_event)
- {
- if (g_pen_stroke_table[MMI_PEN_STROKE_UP])
- {
- (g_pen_stroke_table[MMI_PEN_STROKE_UP]) (pos);
- }
- mmi_pen_simulator_push_stroke_point(x, y);
- mmi_pen_simulator_push_stroke_end();
- gui_cancel_timer(mmi_pen_simulator_stroke_longtap_hdlr);
- if (g_pen_cntx.is_stroke_longtap_event_generated)
- {
- /* Clear strokes */
- mmi_pen_end_strokes_of_character();
- mmi_pen_begin_strokes_of_character();
- }
- }
- else
- {
- gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);
- if (g_pen_event_table[MMI_PEN_EVENT_UP])
- {
- (g_pen_event_table[MMI_PEN_EVENT_UP]) (pos);
- }
- }
- if (g_pen_cntx.reset_stroke_on_pen_up)
- {
- if (g_pen_stroke_max_points > 0)
- {
- mmi_pen_end_strokes_of_character();
- mmi_pen_reset();
- mmi_pen_begin_strokes_of_character();
- }
- else
- {
- mmi_pen_reset();
- }
- }
- }
- /*****************************************************************************
- * Global Variable
- *****************************************************************************/
- /*****************************************************************************
- * Global Function
- *****************************************************************************/
- /* Dummy pen handler */
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_dummy_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pos [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_dummy_hdlr(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_UNUSED_PARAMETER(pos);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_config_sampling_period
- * DESCRIPTION
- *
- * PARAMETERS
- * low [IN]
- * high [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_config_sampling_period(kal_uint32 low, kal_uint32 high)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* DUMMY */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_config_timeout_period
- * DESCRIPTION
- *
- * PARAMETERS
- * longtap [IN]
- * repeat [IN]
- * stroke_longtap [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_config_timeout_period(kal_uint32 longtap, kal_uint32 repeat, kal_uint32 stroke_longtap)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* DUMMY */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_config_move_offset
- * DESCRIPTION
- *
- * PARAMETERS
- * event_based [IN]
- * stroke_based [IN]
- * long_tap [IN]
- * stroke_long_tap [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_config_move_offset(
- kal_uint32 event_based,
- kal_uint32 stroke_based,
- kal_uint32 long_tap,
- kal_uint32 stroke_long_tap)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* DUMMY */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_init
- * DESCRIPTION
- * Initialize pen system
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_init(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_HANDWRITING_PAD__
- mmi_frm_setup_default_pen_handler();
- #endif
- #if !defined(MMI_ON_WIN32)
- SetProtocolEventHandler(mmi_pen_MODIS_tp_ind, MSG_ID_TP_EVENT_IND);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_block
- * DESCRIPTION
- * Block pen system
- *
- * Note: typically used for keypad lock in idle screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_block(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_pen_disable();
- g_pen_cntx.is_blocked = 1;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_unblock
- * DESCRIPTION
- * Unblock pen system
- *
- * Note: typically used for keypad lock in idle screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_unblock(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_cntx.is_blocked = 0;
- mmi_pen_enable();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_enable
- * DESCRIPTION
- * Enable pen system
- *
- * Note: typically on Keypad Up
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_enable(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.is_blocked || g_pen_cntx.is_enabled)
- {
- return;
- }
- memset(&g_pen_cntx, 0, sizeof(g_pen_cntx));
- g_pen_cntx.is_enabled = 1;
- #if !defined(MMI_ON_WIN32)
- mmi_pen_MODIS_start_timer();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_disable
- * DESCRIPTION
- * Disable pen system
- *
- * Note: typically on Keypad Down because we don't want to use keypad and touch screen
- * at the same time
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_disable(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.is_blocked || !g_pen_cntx.is_enabled)
- {
- return;
- }
- gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);
- if (g_pen_cntx.is_pen_down)
- {
- if (g_pen_event_table[MMI_PEN_EVENT_ABORT])
- {
- (g_pen_event_table[MMI_PEN_EVENT_ABORT]) (g_pen_cntx.pen_current_pos);
- }
- }
- memset(&g_pen_cntx, 0, sizeof(g_pen_cntx));
- #if !defined(MMI_ON_WIN32)
- mmi_pen_MODIS_flush_queue();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_reset
- * DESCRIPTION
- * Reset the status of touch screen
- * - Flush event queue
- * - If the pen is currently tapped down, ignore all subsequent pen events until the pen is up.
- *
- * Note: typically on MMI screen switching
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_reset(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.is_blocked || !g_pen_cntx.is_enabled)
- {
- return;
- }
- gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);
- if (g_pen_cntx.is_pen_down)
- {
- gui_cancel_timer(mmi_pen_simulator_repeat_hdlr);
- if (g_pen_event_table[MMI_PEN_EVENT_ABORT])
- {
- (g_pen_event_table[MMI_PEN_EVENT_ABORT]) (g_pen_cntx.pen_current_pos);
- }
- }
- memset(&g_pen_cntx, 0, sizeof(g_pen_cntx));
- g_pen_cntx.is_enabled = 1;
- #if !defined(MMI_ON_WIN32)
- mmi_pen_MODIS_flush_queue();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_get_state
- * DESCRIPTION
- * Get the current state of touch screen
- * PARAMETERS
- * is_enabled [OUT]
- * is_pen_down [OUT]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_get_state(kal_bool *is_enabled, kal_bool *is_pen_down)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.is_enabled)
- {
- *is_enabled = KAL_TRUE;
- if (g_pen_cntx.is_pen_down)
- {
- *is_pen_down = KAL_TRUE;
- }
- else
- {
- *is_pen_down = KAL_FALSE;
- }
- }
- else
- {
- *is_enabled = KAL_FALSE;
- *is_pen_down = KAL_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_start_calibration
- * DESCRIPTION
- * Start pen calibration
- * PARAMETERS
- * num [IN] Number of calibration points
- * points [IN] Calibration points
- * RETURNS
- * void
- * REMARKS
- * After mmi_pen_reset(), the calibration process is terminated.
- *****************************************************************************/
- void mmi_pen_start_calibration(kal_uint16 num, const mmi_pen_point_struct *points)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* DUMMY */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_set_calibration_data
- * DESCRIPTION
- * Assign driver calibration data
- * PARAMETERS
- * data [IN]
- * RETURNS
- * void
- * REMARKS
- *
- *****************************************************************************/
- void mmi_pen_set_calibration_data(const mmi_pen_calibration_struct *data)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* DUMMY */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_read_calibration_data
- * DESCRIPTION
- * Read the current value of driver calibration data
- * PARAMETERS
- * data [OUT]
- * RETURNS
- * void
- * REMARKS
- *
- *****************************************************************************/
- void mmi_pen_read_calibration_data(mmi_pen_calibration_struct *data)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* DUMMY */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_down_handler
- * DESCRIPTION
- * Register the Pen Down handler
- * PARAMETERS
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_down_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_event_table[MMI_PEN_EVENT_DOWN] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_long_tap_handler
- * DESCRIPTION
- * Register the Pen LongTap handler
- *
- * LongTap handler is invoked when the pen is tapped for a period of time
- * and stays at the same place where it is tapped down.
- *
- * It is invoked atmost one time before pen up.
- * PARAMETERS
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_long_tap_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_event_table[MMI_PEN_EVENT_LONG_TAP] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_repeat_handler
- * DESCRIPTION
- * Register the Pen Repeat handler.
- *
- * Repeat handler is invoked after LongTap handler.
- * However, unlike LongTap handler, Repeat handler is invoked even if
- * it does not stays at the same place as Pen Down.
- *
- * it might be invoked more than one times before pen up.
- * PARAMETERS
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_repeat_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_event_table[MMI_PEN_EVENT_REPEAT] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_move_handler
- * DESCRIPTION
- * Register the Pen Move handler.
- *
- * The invocation frequency of Pen Move handler is typically less than driver sampling rate.
- * PARAMETERS
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_move_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_event_table[MMI_PEN_EVENT_MOVE] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_up_handler
- * DESCRIPTION
- * Register the Pen Up handler.
- * PARAMETERS
- * pen_fp [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_up_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_event_table[MMI_PEN_EVENT_UP] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_abort_handler
- * DESCRIPTION
- * Register the Pen Abort handler.
- * PARAMETERS
- * pen_fp [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_abort_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_event_table[MMI_PEN_EVENT_ABORT] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_start_capture_strokes
- * DESCRIPTION
- * Win32 port of mmi_pen_start_capture_strokes
- * PARAMETERS
- * max_points [IN] Maximum number of points can be en-queued.
- * point_array [IN] Array for storing sampled points in strokes.
- * num_regions [IN] Number of handwriting regions
- * region_array [IN] Handwriting regions
- * ext_region [IN] Handwriting region after the first stroke is generated. (NULL to ignore it)
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_start_capture_strokes(
- kal_uint32 max_points,
- mmi_pen_point_struct *point_array,
- kal_uint32 num_regions,
- const mmi_pen_handwriting_area_struct *region_array,
- const mmi_pen_handwriting_area_struct *ext_region)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Multi-block mode does not have extended region. Otherwise, it cannot switch to another
- block and multi-block feature is broken. */
- MMI_ASSERT(ext_region == NULL || num_regions == 1);
- if (num_regions > MMI_PEN_MAX_HANDWRITING_REGION)
- {
- num_regions = MMI_PEN_MAX_HANDWRITING_REGION;
- }
- g_pen_num_stroke_area = num_regions;
- memcpy(g_pen_stroke_areas, region_array, sizeof(mmi_pen_handwriting_area_struct) * num_regions);
- if (ext_region)
- {
- g_pen_ext_stroke_area = *ext_region;
- }
- else
- {
- g_pen_ext_stroke_area.x1 = -1;
- g_pen_ext_stroke_area.x2 = -1;
- g_pen_ext_stroke_area.y1 = -1;
- g_pen_ext_stroke_area.y2 = -1;
- }
- if (num_regions == 1)
- {
- g_pen_stroke_min_offset = MMI_PEN_STROKE_MIN_OFFSET;
- }
- else
- {
- g_pen_stroke_min_offset = 0;
- }
- g_pen_stroke_max_points = max_points;
- g_pen_stroke_points = point_array;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_change_handwriting_area
- * DESCRIPTION
- * Win32 port of mmi_pen_change_handwriting_area
- * PARAMETERS
- * num_regions [IN] Number of handwriting regions
- * region_array [IN] Handwriting regions
- * ext_region [IN] Handwriting region after the first stroke is generated. (NULL to ignore it)
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_change_handwriting_area(
- kal_uint32 num_regions,
- const mmi_pen_handwriting_area_struct *region_array,
- const mmi_pen_handwriting_area_struct *ext_region)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_stroke_max_points == 0) /* Handwriting is not enabled */
- {
- /* MMI_DBG_ASSERT(0); */
- return;
- }
- /* Multi-block mode does not have extended region */
- MMI_ASSERT(ext_region == NULL || num_regions == 1);
- if (num_regions > MMI_PEN_MAX_HANDWRITING_REGION)
- {
- num_regions = MMI_PEN_MAX_HANDWRITING_REGION;
- }
- g_pen_num_stroke_area = num_regions;
- memcpy(g_pen_stroke_areas, region_array, sizeof(mmi_pen_handwriting_area_struct) * num_regions);
- if (ext_region)
- {
- g_pen_ext_stroke_area = *ext_region;
- }
- else
- {
- g_pen_ext_stroke_area.x1 = -1;
- g_pen_ext_stroke_area.x2 = -1;
- g_pen_ext_stroke_area.y1 = -1;
- g_pen_ext_stroke_area.y2 = -1;
- }
- if (num_regions == 1)
- {
- g_pen_stroke_min_offset = MMI_PEN_STROKE_MIN_OFFSET;
- }
- else
- {
- g_pen_stroke_min_offset = 0;
- }
- /*
- * We will call mmi_pen_reset() *later* on Pen Up or Stroke Up event.
- *
- * There might be many pending events in driver queue if MMI task is blocked by
- * other time-consuming jobs. If there are pending stroke events in driver queue,
- * it is better to flush driver queue.
- *
- */
- if (!g_pen_cntx.is_pen_down)
- {
- /* Clear strokes */
- mmi_pen_end_strokes_of_character();
- mmi_pen_reset();
- mmi_pen_begin_strokes_of_character();
- }
- else
- {
- /*
- * NOTE: we *cannot* call mmi_pen_reset().
- *
- * For example, assume mmi_pen_change_handwriting_area() is invoked on Button Down.
- * If we invoke mmi_pen_reset() here, it will send MMI_PEN_EVENT_ABORT and reset the button.
- */
- g_pen_cntx.reset_stroke_on_pen_up = 1;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_stop_capture_strokes
- * DESCRIPTION
- * Stop capturing stroke
- *
- * Note: it should be used before mmi_pen_reset() because it does not flush driver pen queue
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_stop_capture_strokes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_num_stroke_area = 0;
- g_pen_stroke_max_points = 0;
- g_pen_stroke_points = NULL;
- /*
- * We will call mmi_pen_reset() *later* on Pen Up or Stroke Up event.
- *
- * There might be many pending events in driver queue if MMI task is blocked by
- * other time-consuming jobs. If there are pending stroke events in driver queue,
- * it is better to flush driver queue.
- *
- */
- if (!g_pen_cntx.is_pen_down)
- {
- mmi_pen_reset();
- }
- else
- {
- /*
- * NOTE: we *cannot* call mmi_pen_reset().
- *
- * For example, assume mmi_pen_stop_capture_strokes() is invoked when scrollbar of inline editor
- * is scrolled on Pen Move event and the highlighed single-line editor is un-highlighted.
- * If we invoke mmi_pen_reset() here, it will send MMI_PEN_EVENT_ABORT and reset the scrolling of scrollbar.
- */
- g_pen_cntx.reset_stroke_on_pen_up = 1;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_stroke_down_handler
- * DESCRIPTION
- * Register the Stroke Down handler
- * PARAMETERS
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_stroke_down_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_stroke_table[MMI_PEN_STROKE_DOWN] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_stroke_move_handler
- * DESCRIPTION
- * Register the Stroke Move handler
- * PARAMETERS
- * begin_fp [IN]
- * end_fp [IN]
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_stroke_move_handler(void (*begin_fp) (void), void (*end_fp) (void), mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_stroke_pre_move = begin_fp;
- g_pen_stroke_table[MMI_PEN_STROKE_MOVE] = pen_fp;
- g_pen_stroke_post_move = end_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_stroke_up_handler
- * DESCRIPTION
- * Register the Stroke Up handler
- * PARAMETERS
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_stroke_up_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_stroke_table[MMI_PEN_STROKE_UP] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_register_stroke_longtap_handler
- * DESCRIPTION
- * Register the Stroke Up handler
- * PARAMETERS
- * pen_fp [IN] Callback handler
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_register_stroke_longtap_handler(mmi_pen_hdlr pen_fp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_pen_stroke_table[MMI_PEN_STROKE_LONGTAP] = pen_fp;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_peek_stroke_state
- * DESCRIPTION
- *
- * PARAMETERS
- * has_unfinished_stroke [OUT] Whether there are more strokes to come
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_peek_stroke_state(BOOL *has_unfinished_stroke)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_pen_cntx.is_pen_down && g_pen_cntx.is_stroke_created)
- {
- *has_unfinished_stroke = MMI_TRUE;
- }
- else
- {
- *has_unfinished_stroke = MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_begin_strokes_of_character
- * DESCRIPTION
- * Start to write a new character
- *
- * It is typically coupled with mmi_pen_end_strokes_of_character(), which stops en-queueing
- * strokes inside 'point_array'.
- * In mmi_pen_begin_strokes_of_character(), MMI continue to en-queue strokes from the head of 'point_array'.
- *
- * (However, simulator does not implement all of these)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_begin_strokes_of_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_DBG_ASSERT(g_pen_num_stroke_area > 0);
- g_pen_cntx.num_points_queued = 0;
- g_pen_cntx.is_stroke_created = 0;
- g_pen_cntx.is_all_stroke_finished = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_end_strokes_of_character
- * DESCRIPTION
- * End a written character.
- *
- * The following procedures are executed
- * o Reset handwriting area to original size
- * o Stop en-queueing new strokes inside 'point_array'. (But incoming strokes are still en-queued in driver ring buffer)
- * o Append end marker (0xffff, 0xffff) in 'point_array'
- * This API should be used only if there is no unfinished stroke (checked by mmi_pen_peek_stroke_state()).
- * After it returns, we may pass 'point_array' to handwriting recognition engine.
- *
- * (However, simulator does not implement all of these)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_end_strokes_of_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_pen_simulator_push_char_end();
- g_pen_cntx.is_all_stroke_finished = 1; /* To block further Pen Down */
- #ifdef MMI_PEN_SAVE_STROKE_IN_FILE
- {
- extern void mmi_pen_save_stroke_in_file(mmi_pen_point_struct *, S32);
- mmi_pen_save_stroke_in_file(g_pen_stroke_points, g_pen_cntx.num_points_queued);
- }
- #endif /* MMI_PEN_SAVE_STROKE_IN_FILE */
- }
- /****************************************************************
- *
- * MODIS support
- *
- * Because the pen handlers might take a long time to execute, race condition is easy to happen.
- *
- ***************************************************************/
- #if !defined(MMI_ON_WIN32)
- #define MMI_PEN_MODIS_QUEUE_SIZE 1024
- typedef struct
- {
- S16 type; /* 0 down, 1 move, 2 up */
- S16 x;
- S16 y;
- } mmi_pen_MODIS_queue_item_struct;
- static volatile int g_mmi_pen_MODIS_qhead; /* modified by MMI thread */
- static volatile int g_mmi_pen_MODIS_qtail; /* modified by windows message loop thread */
- static mmi_pen_MODIS_queue_item_struct g_mmi_pen_MODIS_queue[MMI_PEN_MODIS_QUEUE_SIZE];
- static BOOL g_mmi_pen_MODIS_timer_flag;
- /* By Windows main thread */
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_enqueue_point
- * DESCRIPTION
- *
- * PARAMETERS
- * type [IN]
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_MODIS_enqueue_point(S16 type, S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int tail = g_mmi_pen_MODIS_qtail;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_mmi_pen_MODIS_queue[tail].type = type;
- g_mmi_pen_MODIS_queue[tail].x = x;
- g_mmi_pen_MODIS_queue[tail].y = y;
- if (++tail == MMI_PEN_MODIS_QUEUE_SIZE)
- {
- tail = 0;
- }
- g_mmi_pen_MODIS_qtail = tail;
- MMI_ASSERT(tail != g_mmi_pen_MODIS_qhead);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_enqueue_down
- * DESCRIPTION
- * Remark: Executed from non-MMI task
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_MODIS_enqueue_down(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_pen_MODIS_enqueue_point(0, x, y);
- /*
- * Because polling timer is aligned timer, and it will be suspended if
- * the backlight is turned off. We need to send primitive MSG_ID_TP_EVENT_IND
- * to MMI task in order to resume non-aligned timer.
- */
- message.oslMsgId = MSG_ID_TP_EVENT_IND;
- message.oslDataPtr = NULL;
- message.oslPeerBuffPtr = NULL;
- message.oslSrcId = MOD_L4C;
- message.oslDestId = MOD_MMI;
- OslMsgSendExtQueue(&message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_enqueue_move
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_MODIS_enqueue_move(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_pen_MODIS_enqueue_point(1, x, y);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_enqueue_up
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_MODIS_enqueue_up(S16 x, S16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_pen_MODIS_enqueue_point(2, x, y);
- }
- /* By MMI thread */
- #ifdef __MMI_HANDWRITING_PAD__
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_draw_control_area
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pen_draw_control_area()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_lock_double_buffer();
- for (i = 0; i < TP_AREA_MAX_NUM; i++)
- {
- if (IS_ENABLE_FLAG(tp_area_table[i].flag, TP_CONTROL_AREA))
- {
- int index = 0;
- mmi_pen_point_struct pos1, pos2;
- pos1 = tp_area_table[i].pos[index];
- index++;
- while ((tp_area_table[i].pos[index].x != -1) && (tp_area_table[i].pos[index].y != -1))
- {
- pos2 = tp_area_table[i].pos[index];
- gdi_draw_line(pos1.x, pos1.y, pos2.x, pos2.y, GDI_COLOR_RED);
- pos1 = pos2;
- index++;
- }
- pos2 = tp_area_table[i].pos[0];
- gdi_draw_line(pos1.x, pos1.y, pos2.x, pos2.y, GDI_COLOR_RED);
- }
- else
- {
- /* handwriting area */
- }
- }
- gui_unlock_double_buffer();
- gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
- }
- #endif /* __MMI_HANDWRITING_PAD__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_timer_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_MODIS_timer_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_pen_MODIS_queue_item_struct *pt, *pt_end;
- int new_head, saved_tail;
- MMI_BOOL has_events = MMI_FALSE;
- static MMI_BOOL entered = MMI_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_pen_cntx.is_enabled)
- {
- g_mmi_pen_MODIS_qhead = g_mmi_pen_MODIS_qtail = 0;
- StartTimer(PEN_POLLING_TIMER, 20, mmi_pen_MODIS_timer_hdlr);
- return;
- }
- /* Avoid re-entrance of this function. Typically it's becuase NVRAM routines invoke timer
- handler again */
- if (entered)
- {
- return;
- }
- entered = MMI_TRUE;
- g_mmi_pen_MODIS_timer_flag = MMI_TRUE;
- saved_tail = g_mmi_pen_MODIS_qtail;
- pt = g_mmi_pen_MODIS_queue + g_mmi_pen_MODIS_qhead;
- if (saved_tail < g_mmi_pen_MODIS_qhead)
- {
- pt_end = g_mmi_pen_MODIS_queue + MMI_PEN_MODIS_QUEUE_SIZE;
- new_head = 0;
- }
- else
- {
- pt_end = g_mmi_pen_MODIS_queue + saved_tail;
- new_head = saved_tail;
- }
- if (pt < pt_end)
- {
- has_events = MMI_TRUE;
- }
- while (pt < pt_end)
- {
- #ifdef __MMI_SCREEN_ROTATE__
- if (mmi_frm_get_screen_rotate() != MMI_FRM_SCREEN_ROTATE_0)
- {
- S32 tmp_x = pt->x, tmp_y = pt->y;
- /* W06.04 Replace functions for GDI LCD Rotate */
- gdi_rotate_map_absolute_hw_to_lcd(&tmp_x, &tmp_y);
- /* gdi_layer_map_rotated_coordinates(gdi_layer_get_base_layer_rotation(), &tmp_x, &tmp_y); */
- pt->x = (S16) tmp_x;
- pt->y = (S16) tmp_y;
- }
- #endif /* __MMI_SCREEN_ROTATE__ */
- switch (pt->type)
- {
- case 0:
- mmi_pen_simulator_button_down_hdlr(pt->x, pt->y);
- break;
- case 1:
- mmi_pen_simulator_button_move_hdlr(pt->x, pt->y);
- break;
- case 2:
- mmi_pen_simulator_button_up_hdlr(pt->x, pt->y);
- break;
- default:
- ASSERT(0);
- }
- pt++;
- if (!g_mmi_pen_MODIS_timer_flag)
- {
- break; /* mmi_pen_reset was invoked */
- }
- }
- /* Update queue when no mmi_pen_disable() and mmi_pen_reset() inside previous pen handler */
- if (g_mmi_pen_MODIS_timer_flag)
- {
- g_mmi_pen_MODIS_qhead = new_head;
- }
- g_mmi_pen_MODIS_timer_flag = MMI_FALSE;
- if (has_events)
- {
- TurnOnBacklight(MMI_TRUE);
- #ifdef __MMI_LCD_PARTIAL_ON__
- /* Switch screen and flush pen events */
- LeavePartialOnScreenSaverIfOk();
- #endif /* __MMI_LCD_PARTIAL_ON__ */
- }
- #ifdef __MMI_HANDWRITING_PAD__
- mmi_pen_draw_control_area();
- #endif
- StartTimer(PEN_POLLING_TIMER, 20, mmi_pen_MODIS_timer_hdlr);
- entered = MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_flush_queue
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_MODIS_flush_queue(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_mmi_pen_MODIS_qtail = 0;
- g_mmi_pen_MODIS_qhead = 0;
- g_mmi_pen_MODIS_timer_flag = MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_start_timer
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_MODIS_start_timer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- StartTimer(PEN_POLLING_TIMER, 20, mmi_pen_MODIS_timer_hdlr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pen_MODIS_tp_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * param [IN] unused
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pen_MODIS_tp_ind(void *param /* unused */ )
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_pen_MODIS_timer_hdlr();
- }
- #endif /* !defined(MMI_ON_WIN32) */
- /****************************************************************
- * Unit test
- ***************************************************************/
- #ifdef MMI_PEN_UNIT_TEST
- /*
- * The simple drawing application is not efficent in order
- * * to follow PC Simualator architecture
- */
- #include "wgui_categories.h"
- #include "GlobalDefs.h"
- #include "HistoryGprot.h"
- static mmi_pen_point_struct mmi_pen_test_last_pos;
- static U8 mmi_pen_draw_buffer[LCD_WIDTH * LCD_HEIGHT / 8];