QPaintDevice *QQnxRasterBackingStore::paintDevice()
{
    if (platformWindow() && platformWindow()->hasBuffers())
        return platformWindow()->renderBuffer().image();

    return 0;
}
void QQnxRasterBackingStore::beginPaint(const QRegion &region)
{
    Q_UNUSED(region);

    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
    m_hasUnflushedPaintOperations = true;

    platformWindow()->adjustBufferSize();
}
void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
    Q_UNUSED(offset)

    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << this->window();

    // Sometimes this method is called even though there is nothing to be
    // flushed, for instance, after an expose event directly follows a
    // geometry change event.
    if (!m_hasUnflushedPaintOperations)
            return;

    QQnxWindow *targetWindow = 0;
    if (window)
        targetWindow = static_cast<QQnxWindow *>(window->handle());

    // we only need to flush the platformWindow backing store, since this is
    // the buffer where all drawing operations of all windows, including the
    // child windows, are performed; conceptually ,child windows have no buffers
    // (actually they do have a 1x1 placeholder buffer due to libscreen limitations),
    // since Qt will only draw to the backing store of the top-level window.
    if (!targetWindow || targetWindow == platformWindow()) {

        // visit all pending scroll operations
        for (int i = m_scrollOpList.size() - 1; i >= 0; i--) {

            // do the scroll operation
            ScrollOp &op = m_scrollOpList[i];
            QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) );
            platformWindow()->scroll(srcArea, op.dx, op.dy);
        }

        // clear all pending scroll operations
        m_scrollOpList.clear();

        // update the display with newly rendered content
        platformWindow()->post(region);
    }

    m_hasUnflushedPaintOperations = false;
}
Пример #4
0
void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser)
{
    // FIXME: Support multiple files.

    RefPtr<FileChooser> fileChooser = prpFileChooser;

    GtkWidget* dialog = gtk_file_chooser_dialog_new(_("Upload File"),
                                                    GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(platformWindow()))),
                                                    GTK_FILE_CHOOSER_ACTION_OPEN,
                                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                                    GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
                                                    NULL);

    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
        gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
        if (filename)
            fileChooser->chooseFile(filenameToString(filename));
        g_free(filename);
    }
    gtk_widget_destroy(dialog);
}