Example #1
0
static VALUE
rg_set_disabled(VALUE self, VALUE disabled)
{
    gdk_pixbuf_format_set_disabled(_SELF(self), RVAL2CBOOL(disabled));
    return self;
}
Example #2
0
nsresult
nsAppShell::Init()
{
#ifdef PR_LOGGING
    if (!gWidgetLog)
        gWidgetLog = PR_NewLogModule("Widget");
    if (!gWidgetFocusLog)
        gWidgetFocusLog = PR_NewLogModule("WidgetFocus");
    if (!gWidgetDragLog)
        gWidgetDragLog = PR_NewLogModule("WidgetDrag");
    if (!gWidgetDrawLog)
        gWidgetDrawLog = PR_NewLogModule("WidgetDraw");
#endif

    if (!sPollFunc) {
        sPollFunc = g_main_context_get_poll_func(NULL);
        g_main_context_set_poll_func(NULL, &PollWrapper);
    }

    if (PR_GetEnv("MOZ_DEBUG_PAINTS"))
        gdk_window_set_debug_updates(TRUE);

    // Disable JasPer module (jpeg2000) in GDK-PixBuf.
    // Also disable known buggy TGA and icns formats
    GSList* pixbufFormats = gdk_pixbuf_get_formats();
    for (GSList* iter = pixbufFormats; iter; iter = iter->next) {
        GdkPixbufFormat* format = static_cast<GdkPixbufFormat*>(iter->data);
        gchar* name = gdk_pixbuf_format_get_name(format);
        if (strcmp(name, "jpeg2000") == 0 ||
            strcmp(name, "tga") == 0 ||
            strcmp(name, "icns") == 0) {
            gdk_pixbuf_format_set_disabled(format, TRUE);
        }
        g_free(name);
    }
    g_slist_free(pixbufFormats);

    int err = pipe(mPipeFDs);
    if (err)
        return NS_ERROR_OUT_OF_MEMORY;

    GIOChannel *ioc;
    GSource *source;

    // make the pipe nonblocking

    int flags = fcntl(mPipeFDs[0], F_GETFL, 0);
    if (flags == -1)
        goto failed;
    err = fcntl(mPipeFDs[0], F_SETFL, flags | O_NONBLOCK);
    if (err == -1)
        goto failed;
    flags = fcntl(mPipeFDs[1], F_GETFL, 0);
    if (flags == -1)
        goto failed;
    err = fcntl(mPipeFDs[1], F_SETFL, flags | O_NONBLOCK);
    if (err == -1)
        goto failed;

    ioc = g_io_channel_unix_new(mPipeFDs[0]);
    source = g_io_create_watch(ioc, G_IO_IN);
    g_io_channel_unref(ioc);
    g_source_set_callback(source, (GSourceFunc)EventProcessorCallback, this, nullptr);
    g_source_set_can_recurse(source, TRUE);
    mTag = g_source_attach(source, nullptr);
    g_source_unref(source);

    return nsBaseAppShell::Init();
failed:
    close(mPipeFDs[0]);
    close(mPipeFDs[1]);
    mPipeFDs[0] = mPipeFDs[1] = 0;
    return NS_ERROR_FAILURE;
}