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

📄 touchscreen.c

📁 MTK6225
💻 C
📖 第 1 页 / 共 5 页
字号:
             */
            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 */
	//kal_print("mmi_pen_simulator_button_up_hdlr test end strokes3333");
            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)
        {
      //  kal_print("mmi_pen_simulator_button_up_hdlr test end strokes4444");
            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)

⌨️ 快捷键说明

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