GNOME Goal: Adapt to GTK+3 Rendering Cleanup

Introduction

The stated goal of the rendering cleanup is the removal of GdkColormap and GdkPixmap, and the introduction of gtk_widget_draw() (with the expose-event signal replaced by a draw signal)

GdkPixmap was to be replaced by cairo_surface_t usage and GdkColormap functionality was either removed because it is outdated or replaced by GdkVisual.

Guidelines

Replace !GdkPixmap by cairo surfaces

  • Replace GdkPixmap/GdkBitmap usage with appropriate equivalents; this looks pretty straightforward, and it usually is: The GdkPixmap version is replaced with a cairo_surface_t version. However, there were some special cases:

    • Setting a shape is done internally using a region, so that API is exposed instead. Plus a function called gdk_cairo_region_create_from_surface() was added that does what it says using 50% alpha as the threshold.
    • All functions that take or produce a pixmap and a mask were removed and replaced with versions that use any cairo_surface_t.
  • Get rid of the Pixmap option when a Pixbuf option exists:
    • A lot of APIs have versions taking either a Pixmap or a Pixbuf. In those cases, the Pixman version was removed. If people still use them, they can use gdk_pixbuf_get_from_drawable() or similar to convert to a pixbuf. Examples are GtkImage or GdkCursor.

Replace colormaps by visuals:

  • For drawing with cairo, it is not necessary to allocate colors, and a #GdkVisual provides enough information for cairo to handle colors in 'native' surfaces. The colormap-handling functions of #GtkWidget (gtk_widget_set_colormap(), etc) have been removed and gtk_widget_set_visual() has been undeprecated.

  • For example, the new code to get translucent windows looks like this: gtk_widget_set_visual (window, gdk_screen_get_rgba_visual (gdk_screen_get_default ()) (before it was gtk_widget_set_colormap (window, gdk_screen_get_rgba_colormap (gdk_screen_get_default ()))

The !GtkWidget::draw signal:

  • The GtkWidget #GtkWidget::expose-event signal has been replaced by a new #GtkWidget::draw signal, which takes a #cairo_t instead of an expose event.

  • The widget is expected to draw itself with its allocated size, which is available via the new gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height().
  • All GtkStyle drawing functions (gtk_paint_box(), etc) have been changed to take a #cairo_t instead of a window and a clip area. ::draw implementations will usually just use the cairo context that has been passed in for this.

More info here:

Also, follow the tips of the GTK+ migration guide

Comments before approval

Status of this goal

/!\ Note: Updated automatical stats can be found at:
http://people.gnome.org/~fpeters/reports/gtk-rendering-cleanup.html
http://people.gnome.org/~fpeters/reports/gdkpixmap.html
http://people.gnome.org/~fpeters/reports/expose-event.html

{i} Tip: If you choose to work on a module, create the bug report on the GNOME bugzilla for the relevant module, and make it block bug <<insert here a link to the tracker bug>>. This way people will know someone already works on it, and won't duplicate the work you're doing.

State

Markup

todo

<: #ff8080> todo

patch

<: #ffcc50> [[GnomeBug:xxxxx|patch]]

done

<: #80ff80> [[GnomeBug:xxxxx|done]]

not needed

<: #80ff80> not needed

Above are the states and corresponding markup to update the modules state table below.

Module

Status

Desktop

alacarte

to do

brasero

to do

bug-buddy

to do

caribou

to do

cheese

to do

dasher

to do

dconf

to do

deskbar-applet

to do

ekiga

to do

empathy

to do

eog

to do

epiphany

to do

evince

done

evolution-data-server

to do

evolution

to do

gcalctool

to do

gdm

to do

gedit

to do

gnome-applets

to do

gnome-bluetooth

to do

gnome-control-center

to do

gnome-desktop

done

gnome-disk-utility

to do

gnome-games

to do

gnome-mag

to do

gnome-panel

to do

gnome-power-manager

to do

gnome-screensaver

done

gnome-session

to do

gnome-settings-daemon

done

gnome-shell

done

gnome-system-monitor

to do

gnome-system-tools

to do

gnome-terminal

done

gnome-themes

to do

gnome-utils

to do

gtk-engines

done

gtkhtml

to do

gtksourceview

done

gucharmap

done

hamster-applet

to do

libgnomekbd

done

librsvg

done

libwnck

branch

metacity

to do

mutter

done

nautilus

done

orca

to do

sound-juicer

to do

tomboy

to do

totem

to do

vinagre

to do

vino

done

vte

done

zenity

to do

Admin

sabayon

to do

Development Tools

accerciser

to do

anjuta

to do

gdl

to do

glade3

to do

gnome-devel-docs

to do

External Dependencies

cairo

to do

gtk-vnc

done

libcanberra

done

webkit

done

Other

abiword

to do

atomix

to do

banshee

to do

contact-lookup-applet

to do

couch-db

to do

deja-dup

to do

dia

to do

evolution-couchdb

to do

f-spot

to do

ghex

to do

giggle

to do

gimp

to do

gitg

to do

glom

to do

gnome-blog

to do

gnome-main-menu

to do

GNOME Phone Manager

to do

goocanvas

to do

goocanvasmm

to do

GParted

to do

Gnumeric

to do

gtetrinet

to do

gthumb

to do

gtranslator

to do

krb5-auth-dialog

to do

libbtctl

to do

libgnomekbd

to do

libgoffice

to do

libgsf

to do

ontv

not needed

mousetrap

to do

nemiver

to do

network-manager-applet

to do

pdfmod

to do

planner

to do

rhythmbox

to do

simple-scan

to do

xchat-gnome

to do

Initiatives/GnomeGoals/GTKRenderingCleanup (last edited 2013-12-18 13:44:46 by LuisMenina)