This part describes what you need to change in programs use older versions of GTK so that they can use the new features. It also mentions how to convert applications using widgets found in the libgnomeui library to use their counterparts in GTK.
Table of Contents
- Migrating from GTK 2.x to GTK 4
- Migrating from GTK 3.x to GTK 4
- Preparation in GTK 3.x
- Do not use deprecated symbols
- Enable diagnostic warnings
- Do not use widget style properties
- Review your window creation flags
- Stop using non-RGBA visuals
- Stop using GtkBox:padding, GtkBox:fill and GtkBox:expand
- Stop using the state argument of GtkStyleContext getters
- Stop using
gdk_pixbuf_get_from_window()andgdk_cairo_set_source_surface() - Stop using GtkButton's image-related API
- Stop using GtkWidget event signals
- Set a proper application ID
- Changes that need to be done at the time of the switch
- Convert your ui files
- Stop using GdkScreen
- Stop using the root window
- Stop using GdkVisual
- Stop using GdkDeviceManager
- Adapt to GdkWindow API changes
- Stop accessing GdkEvent fields
- Stop using gdk_surface_set_event_compression
- Stop using
gdk_pointer_warp() - Adapt to coordinate API changes
- Adapt to GdkKeymap API changes
- Stop using GtkEventBox
- Stop using GtkButtonBox
- Adapt to GtkButton API changes
- Adapt to GtkHeaderBar and GtkActionBar API changes
- Adapt to GtkStack, GtkAssistant and GtkNotebook API changes
- Adapt to GtkStyleContext API changes
- Adapt to GtkCssProvider API changes
- Stop using GtkContainer::border-width
- Adapt to GtkWidget's size request changes
- Adapt to GtkWidget's size allocation changes
- Switch to GtkWidget's children APIs
- Don't use -gtk-gradient in your CSS
- Don't use -gtk-icon-effect in your CSS
- Use gtk_widget_measure
- Adapt to drawing model changes
- Stop using APIs to query GdkSurfaces
- Widgets are now visible by default
- Adapt to changes in animated hiding and showing of widgets
- Stop passing commandline arguments to gtk_init
- GdkPixbuf is deemphasized
- GtkWidget event signals are removed
- Invalidation handling has changed
- Stop using GtkWidget::draw
- Window content observation has changed
- The gtk_window_fullscreen_on_monitor API has changed
- Adapt to cursor API changes
- Adapt to icon size API changes
- Convert .ui files
- Adapt to changes in the GtkAssistant API
- Adapt to changes in the API of GtkEntry, GtkSearchEntry and GtkSpinButton
- Adapt to changes in GtkOverlay API
- Use GtkFixed instead of GtkLayout
- Adapt to search entry changes
- Stop using child properties
- Stop using tabular menus
- Stop using
gtk_menu_set_display() - Stop using
gtk_window_activate_default() - Stop setting ::has-default and ::has-focus in .ui files
- Stop using the GtkWidget::display-changed signal
