示例#1
0
DFBResult pulsatingAnimationThreadHandler(void *arg) {
    static int state = 1;
    struct cbs_pulsating_variable *var = (struct cbs_pulsating_variable*)arg;
    update_pulsating_button(state, var->status, var->cbsid);
    state = (state == 1) ? 0 : 1;
    lite_enqueue_window_timeout(PULSATING_ANIMATION_FRAME_DURATION_MS, (LiteTimeoutFunc)pulsatingAnimationThreadHandler, (void*)arg, &pulsating_id);
    return DFB_OK;
}
示例#2
0
void *BrowserMain(void * argument)
{
    printf("%s:%d\n", __func__, __LINE__);

    int argc = 0;
    char**argv = NULL;


    pthread_mutex_init (&mutex, NULL);
    
    g_type_init();
    g_thread_init(NULL);

    lite_open( &argc, &argv );

    WebKitDFB_Initialize( lite_get_dfb_interface() );

    IDirectFBDisplayLayer *layer;
    DFBDisplayLayerConfig  config;
    lite_get_layer_interface( &layer );
    layer->GetConfiguration( layer, &config );

    DFBRectangle windowRect        = {   0,  0, config.width, config.height };
    DFBRectangle webviewRect       = {   0,  0, config.width, config.height };

    lite_new_window( NULL, &windowRect, DWCAPS_NONE, liteNoWindowTheme, "WebKitDFB", &g_window );
    
    lite_new_webview( LITE_BOX(g_window), &webviewRect, liteDefaultWebViewTheme, &g_webview);

    lite_on_webview_doc_loaded ( g_webview, on_webview_doc_loaded, NULL );

    lite_on_raw_window_keyboard(g_window, on_key_press, g_webview );

    lite_focus_box( LITE_BOX(g_webview) );

    lite_set_window_opacity(g_window, 0xff);

    g_window->bg.enabled = DFB_FALSE;
    //lite_set_window_background_color(g_window, 0xff, 0, 0, 0xff);

    registerJsFunctions(g_webview, g_Callback);

    lite_webview_load(g_webview, g_url);
    lite_webview_set_transparent(g_webview, true);

    // FAKE KEY INTERFACE
    //IDirectFB *dfb;
    //dfb = lite_get_dfb_interface();
    //IDirectFBDisplayLayer *layer = NULL;
    //dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
    layer->GetWindow(layer, 1, &g_dfb_window);

    lite_enqueue_window_timeout(200, timeout_cb, NULL, &timer_id);
    g_run = 1;
    while (g_run) {
        pthread_mutex_lock(&mutex);

        g_main_context_iteration(NULL, FALSE);
        lite_window_event_loop(g_window, 1);
        pthread_mutex_unlock(&mutex);
    }

   lite_close();

   return NULL;
}
示例#3
0
static DFBResult timeout_cb(void* data)
{
    g_main_context_iteration(NULL, FALSE);
    lite_enqueue_window_timeout(200, timeout_cb, NULL, &timer_id);
    return DFB_OK;
}