Пример #1
0
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
    const char *ptr = state.constData();
    IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
    SurfaceFlags flags;
    memcpy(&flags, ptr, sizeof(SurfaceFlags));

    setSurfaceFlags(flags);
    ptr += sizeof(SurfaceFlags);
    DFBWindowID id;
    memcpy(&id, ptr, sizeof(DFBWindowID));
    if (dfbSurface)
        dfbSurface->Release(dfbSurface);
    if (id != (DFBWindowID)-1) {
        IDirectFBWindow *dw;
        layer->GetWindow(layer, id, &dw);
        if (dw->GetSurface(dw, &dfbSurface) != DFB_OK)
                dfbSurface = 0;
        dw->Release(dw);
    }
    else {
        dfbSurface = 0;
    }
}
Пример #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;
}