2016-10-18 19:21:12 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
|
|
|
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
|
|
|
]>
|
|
|
|
<chapter id="gtk-migrating-3-to-4">
|
|
|
|
<title>Migrating from GTK+ 3.x to GTK+ 4</title>
|
|
|
|
|
|
|
|
<para>
|
2016-10-18 20:20:44 +00:00
|
|
|
GTK+ 4 is a major new version of GTK+ that breaks both API and ABI
|
|
|
|
compared to GTK+ 3.x. Thankfully, most of the changes are not hard
|
|
|
|
to adapt to and there are a number of steps that you can take to
|
|
|
|
prepare your GTK+ 3.x application for the switch to GTK+ 4. After
|
|
|
|
that, there's a small number of adjustments that you may have to do
|
|
|
|
when you actually switch your application to build against GTK+ 4.
|
2016-10-18 19:21:12 +00:00
|
|
|
</para>
|
|
|
|
|
2016-10-18 20:20:44 +00:00
|
|
|
<section>
|
|
|
|
<title>Preparation in GTK+ 3.x</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The steps outlined in the following sections assume that your
|
|
|
|
application is working with GTK+ 3.22, which is the final stable
|
|
|
|
release of GTK+ 3.x. It includes all the necessary APIs and tools
|
|
|
|
to help you port your application to GTK+ 4. If you are still using
|
|
|
|
an older version of GTK+ 3.x, you should first get your application
|
2017-12-01 15:29:14 +00:00
|
|
|
to build and work with the latest minor release in the 3.22 series.
|
2016-10-18 20:20:44 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Do not use deprecated symbols</title>
|
|
|
|
<para>
|
|
|
|
Over the years, a number of functions, and in some cases, entire
|
|
|
|
widgets have been deprecated. These deprecations are clearly spelled
|
|
|
|
out in the API reference, with hints about the recommended replacements.
|
|
|
|
The API reference for GTK+ 3 also includes an
|
|
|
|
<ulink url="https://developer.gnome.org/gtk3/3.22/api-index-deprecated.html">index</ulink> of all deprecated symbols.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
To verify that your program does not use any deprecated symbols,
|
|
|
|
you can use defines to remove deprecated symbols from the header files,
|
|
|
|
as follows:
|
|
|
|
<programlisting>
|
|
|
|
make CFLAGS+="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Note that some parts of our API, such as enumeration values, are
|
|
|
|
not well covered by the deprecation warnings. In most cases, using
|
|
|
|
them will require you to also use deprecated functions, which will
|
|
|
|
trigger warnings.
|
|
|
|
</para>
|
|
|
|
</section>
|
2016-10-20 20:09:45 +00:00
|
|
|
|
2018-02-09 19:36:00 +00:00
|
|
|
<section>
|
|
|
|
<title>Enable diagnostic warnings</title>
|
|
|
|
<para>
|
|
|
|
Deprecations of properties and signals cannot be caught at compile
|
|
|
|
time, as both properties and signals are installed and used after
|
|
|
|
types have been instantiated. In order to catch deprecations and
|
|
|
|
changes in the run time components, you should use the
|
|
|
|
<envar>G_ENABLE_DIAGNOSTIC</envar> environment variable when
|
|
|
|
running your application, e.g.:
|
|
|
|
<programlisting>
|
|
|
|
G_ENABLE_DIAGNOSTIC=1 ./your-app
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-11-20 12:46:47 +00:00
|
|
|
<section>
|
|
|
|
<title>Do not use widget style properties</title>
|
|
|
|
<para>
|
|
|
|
Style properties do not exist in GTK+ 4. You should stop using them in
|
2017-12-01 15:29:14 +00:00
|
|
|
your custom CSS and in your code.
|
2016-11-20 12:46:47 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-10-20 20:09:45 +00:00
|
|
|
<section>
|
|
|
|
<title>Review your window creation flags</title>
|
|
|
|
<para>
|
|
|
|
GTK+ 4 removes the GDK_WA_CURSOR flag. Instead, just use
|
|
|
|
gdk_window_set_cursor() to set a cursor on the window after
|
|
|
|
creating it.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
GTK+ 4 also removes the GDK_WA_VISUAL flag, and always uses
|
|
|
|
an RGBA visual for windows. To prepare your code for this,
|
|
|
|
use gdk_window_set_visual (gdk_screen_get_rgba_visual ()) after
|
|
|
|
creating your window.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
GTK+ 4 also removes the GDK_WA_WMCLASS flag. If you need this
|
|
|
|
X11-specific functionality, use XSetClassHint() directly.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Stop using non-RGBA visuals</title>
|
|
|
|
<para>
|
|
|
|
GTK+ 4 always uses RGBA visuals for its windows; you should make
|
|
|
|
sure that your code works with that.
|
|
|
|
</para>
|
2017-12-01 15:29:14 +00:00
|
|
|
<para>
|
|
|
|
At the same time, you should stop using GdkVisual APIs, this object
|
|
|
|
not longer exist in GTK+ 4. Most of its APIs are deprecated already
|
|
|
|
and not useful when dealing with RGBA visuals.
|
|
|
|
</para>
|
2016-10-20 20:09:45 +00:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
2017-04-28 15:11:52 +00:00
|
|
|
<title>Stop using GtkBox:padding, GtkBox:fill and GtkBox:expand</title>
|
2016-10-20 20:09:45 +00:00
|
|
|
<para>
|
2017-04-28 15:11:52 +00:00
|
|
|
GTK+4 removes these #GtkBox child properties, so you should not use them.
|
|
|
|
You can replace GtkBox:padding using the #GtkWidget:margin properties
|
|
|
|
on your #GtkBox child widgets.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The fill child property can be replaced by setting appropriate values
|
|
|
|
for the #GtkWidget:halign and #GtkWidget:valign properties of the child
|
|
|
|
widgets. If you previously set the fill child property to %TRUE, you can
|
|
|
|
achieve the same effect by setting the halign or valign properties to
|
|
|
|
%GTK_ALIGN_FILL, depending on the parent box -- halign for a horizontal
|
2017-12-01 15:29:14 +00:00
|
|
|
box, valign for a vertical one.
|
2017-04-28 15:11:52 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
#GtkBox also uses the expand child property. It can be replaced by setting
|
|
|
|
#GtkWidget:hexpand or #GtkWidget:vexpand on the child widgets. To match the
|
|
|
|
old behavior of the #GtkBox's expand child property, you need to set
|
|
|
|
#GtkWidget:hexpand on the child widgets of a horizontal #GtkBox and
|
|
|
|
#GtkWidget:vexpand on the child widgets of a vertical #GtkBox.
|
2017-12-01 15:29:14 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2017-04-28 15:11:52 +00:00
|
|
|
Note that there's a subtle but important difference between #GtkBox's
|
|
|
|
expand and fill child properties and the ones in #GtkWidget: setting
|
|
|
|
#GtkWidget:hexpand or #GtkWidget:vexpand to %TRUE will propagate up
|
2017-12-01 15:29:14 +00:00
|
|
|
the widget hierarchy, so a pixel-perfect port might require you to reset
|
|
|
|
the expansion flags to %FALSE in a parent widget higher up the hierarchy.
|
2016-10-20 20:09:45 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Stop using the state argument of GtkStyleContext getters</title>
|
|
|
|
<para>
|
|
|
|
The getters in the GtkStyleContext API, such as
|
|
|
|
gtk_style_context_get_property(), gtk_style_context_get(),
|
|
|
|
or gtk_style_context_get_color() only accept the context's current
|
2017-12-01 15:29:14 +00:00
|
|
|
state for their state argument. You should update all callers to pass
|
|
|
|
the current state.
|
2016-10-20 20:09:45 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-11-20 12:46:47 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using gdk_pixbuf_get_from_window() and gdk_cairo_set_source_window()</title>
|
|
|
|
<para>
|
|
|
|
These functions are not supported in GTK+ 4. Instead, either use backend-specific
|
|
|
|
APIs, or render your widgets using gtk_widget_render().
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2018-02-13 12:57:18 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using GtkButton's image-related API</title>
|
|
|
|
<para>
|
|
|
|
The functions and properties related to automatically add a GtkImage
|
|
|
|
to a GtkButton, and using a GtkSetting to control its visibility, are
|
|
|
|
not supported in GTK+ 4. Instead, you can just pack a GtkImage inside
|
|
|
|
a GtkButton, and control its visibility like you would for any other
|
|
|
|
widget. If you only want to add a named icon to a GtkButton, you can
|
|
|
|
use gtk_button_set_icon_name().
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-10-20 20:09:45 +00:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Changes that need to be done at the time of the switch</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
This section outlines porting tasks that you need to tackle when
|
|
|
|
you get to the point that you actually build your application against
|
|
|
|
GTK+ 4. Making it possible to prepare for these in GTK+ 3 would
|
|
|
|
have been either impossible or impractical.
|
|
|
|
</para>
|
|
|
|
|
2017-12-01 15:29:14 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using GdkScreen</title>
|
|
|
|
<para>
|
|
|
|
The GdkScreen object has been removed in GTK+ 4. Most of its APIs already
|
|
|
|
had replacements in GTK+ 3 and were deprecated, a few remaining replacements
|
|
|
|
have been added to GdkDisplay.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Stop using the root window</title>
|
|
|
|
<para>
|
|
|
|
The root window is an X11-centric concept that is no longer exposed in the
|
|
|
|
backend-neutral GDK API. gdk_window_get_parent() will return %NULL for toplevel
|
|
|
|
windows. If you need to interact with the X11 root window, you can use
|
|
|
|
gdk_x11_display_get_xrootwindow() to get its XID.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-12-26 14:30:07 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using GdkVisual</title>
|
|
|
|
<para>
|
|
|
|
This object is not useful with current GTK+ drawing APIs and has been removed
|
|
|
|
without replacement.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-12-01 15:29:14 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using GdkDeviceManager</title>
|
|
|
|
<para>
|
|
|
|
The GdkDeviceManager object has been removed in GTK+ 4. Most of its APIs already
|
|
|
|
had replacements in GTK+ 3 and were deprecated in favor of GdkSeat.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-11-20 12:46:47 +00:00
|
|
|
<section>
|
|
|
|
<title>Adapt to GdkWindow API changes</title>
|
|
|
|
<para>
|
|
|
|
The gdk_window_new() function has been replaced by a number of more
|
|
|
|
specialized constructors: gdk_window_new_toplevel(), gdk_window_new_popup(),
|
|
|
|
gdk_window_new_temp(), gdk_window_new_child(), gdk_window_new_input(),
|
|
|
|
gdk_wayland_window_new_subsurface(). Use the appropriate ones to create
|
|
|
|
your windows.
|
|
|
|
</para>
|
2017-01-11 02:20:38 +00:00
|
|
|
<para>
|
|
|
|
Native and foreign subwindows are no longer supported. These concepts were
|
|
|
|
complicating the code and could not be supported across backends.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
gdk_window_reparent() is no longer available.
|
|
|
|
</para>
|
2016-11-20 12:46:47 +00:00
|
|
|
</section>
|
|
|
|
|
2017-12-01 15:29:14 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop accessing GdkEvent fields</title>
|
|
|
|
<para>
|
|
|
|
Direct access to GdkEvent structs is no longer possible in GTK+ 4. Some
|
|
|
|
frequently-used fields already had accessors in GTK+ 3, and the remaining
|
|
|
|
fields have gained accessors in GTK+ 4.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-12-26 14:30:07 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using gdk_window_set_event_compression</title>
|
|
|
|
<para>
|
|
|
|
Event compression is now always enabled. If you need to see the uncoalesced
|
|
|
|
motion history, use gdk_event_get_motion_history().
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-12-15 12:48:36 +00:00
|
|
|
<section>
|
|
|
|
<title>Adapt to GdkKeymap API changes</title>
|
|
|
|
<para>
|
2017-12-26 14:30:07 +00:00
|
|
|
The way to get a keymap has changed slightly. gdk_keymap_get_for_display() has
|
|
|
|
been renamed to gdk_display_get_keymap().
|
2017-12-15 12:48:36 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-12-08 03:36:29 +00:00
|
|
|
<section>
|
|
|
|
<title>Adapt to GtkHeaderBar API changes</title>
|
|
|
|
<para>
|
|
|
|
The gtk_header_bar_set_show_close_button() function has been renamed to
|
2017-12-26 14:30:07 +00:00
|
|
|
the more accurate name gtk_header_bar_set_show_title_buttons(). The corresponding
|
|
|
|
getter and the property itself have also been renamed.
|
2017-12-08 03:36:29 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-10-20 20:09:45 +00:00
|
|
|
<section>
|
|
|
|
<title>Adapt to GtkStyleContext API changes</title>
|
|
|
|
<para>
|
|
|
|
The getters in the GtkStyleContext API, such as
|
|
|
|
gtk_style_context_get_property(), gtk_style_context_get(),
|
|
|
|
or gtk_style_context_get_color() have lost their state argument,
|
|
|
|
and always use the context's current state. Update all callers
|
|
|
|
to omit the state argument.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-11-20 12:46:47 +00:00
|
|
|
<section>
|
|
|
|
<title>Adapt to GtkCssProvider API changes</title>
|
|
|
|
<para>
|
|
|
|
In GTK+ 4, the various #GtkCssProvider load functions have lost
|
|
|
|
their #GError argument. If you want to handle CSS loading errors,
|
|
|
|
use the #GtkCssProvider::parsing-error signal instead.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-10-21 13:58:36 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using GtkContainer::border-width</title>
|
|
|
|
<para>
|
|
|
|
GTK+ 4 has removed the #GtkContainer::border-width property.
|
2017-01-11 02:20:38 +00:00
|
|
|
Use other means to influence the spacing of your containers,
|
2017-01-21 22:43:35 +00:00
|
|
|
such as the CSS margin and padding properties on child widgets.
|
2016-10-21 13:58:36 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-10-22 19:40:04 +00:00
|
|
|
<section>
|
|
|
|
<title>Adapt to GtkWidget's size request changes</title>
|
|
|
|
<para>
|
2016-11-07 19:59:23 +00:00
|
|
|
GTK+ 3 used five different virtual functions in GtkWidget to
|
2016-10-22 19:40:04 +00:00
|
|
|
implement size requisition, namely the gtk_widget_get_preferred_width()
|
|
|
|
family of functions. To simplify widget implementations, GTK+4 uses
|
|
|
|
only one virtual function, GtkWidgetClass::measure() that widgets
|
|
|
|
have to implement.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-01-11 02:20:38 +00:00
|
|
|
<section>
|
|
|
|
<title>Switch to GtkWidget's children APIs</title>
|
|
|
|
<para>
|
|
|
|
Instead of the GtkContainer subclass, in GTK+ 4, any widget can
|
|
|
|
have children, and there is new API to navigate the widget tree:
|
|
|
|
gtk_widget_get_first_child(), gtk_widget_get_last_child(),
|
|
|
|
gtk_widget_get_next_sibling(), gtk_widget_get_prev_sibling().
|
|
|
|
The GtkContainer API still works, but if you are implementing
|
|
|
|
your own widgets, you should consider using the new APIs.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-11-07 19:59:23 +00:00
|
|
|
<section>
|
|
|
|
<title>Don't use -gtk-gradient in your CSS</title>
|
|
|
|
<para>
|
|
|
|
GTK+ now supports standard CSS syntax for both linear and radial
|
|
|
|
gradients, just use those.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-01-11 02:20:38 +00:00
|
|
|
<section>
|
|
|
|
<title>Don't use -gtk-icon-effect in your CSS</title>
|
|
|
|
<para>
|
|
|
|
GTK+ now supports a more versatile -gtk-icon-filter instead. Replace
|
|
|
|
-gtk-icon-effect: dim; with -gtk-icon-filter: opacity(0.5); and
|
|
|
|
-gtk-icon-effect: hilight; with -gtk-icon-filter: brightness(1.2);.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2016-11-18 12:42:49 +00:00
|
|
|
<section>
|
2016-11-20 12:46:47 +00:00
|
|
|
<title>Use gtk_widget_measure</title>
|
|
|
|
<para>
|
2017-12-26 14:30:07 +00:00
|
|
|
gtk_widget_measure() replaces the various gtk_widget_get_preferred_ functions
|
2016-11-20 12:46:47 +00:00
|
|
|
for querying sizes.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
2016-11-18 12:42:49 +00:00
|
|
|
<title>Adapt to drawing model changes</title>
|
|
|
|
<para>
|
|
|
|
This area has seen the most radical changes in the transition from GTK+ 3
|
|
|
|
to GTK+ 4. Widgets no longer use a draw() function to render their contents
|
|
|
|
to a cairo surface. Instead, they have a snapshot() function that creates
|
|
|
|
one or more GskRenderNodes to represent their content. Third-party widgets
|
|
|
|
that use a draw() function or a #GtkWidget::draw signal handler for custom
|
2017-01-13 03:46:09 +00:00
|
|
|
drawing will need to be converted to use gtk_snapshot_append_cairo().
|
2016-11-18 12:42:49 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The auxiliary #GtkSnapshot object has APIs to help with creating render
|
|
|
|
nodes.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If you are using a #GtkDrawingArea for custom drawing, you need to switch
|
2017-12-26 14:30:07 +00:00
|
|
|
to using gtk_drawing_area_set_draw_func() to set a draw function instead
|
|
|
|
of connnecting a handler to the #GtkWidget::draw signal.
|
2016-11-18 12:42:49 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-01-11 02:20:38 +00:00
|
|
|
<section>
|
|
|
|
<title>Stop using APIs to query GdkWindows</title>
|
|
|
|
<para>
|
|
|
|
A number of APIs for querying special-purpose windows have been removed,
|
|
|
|
since these windows are no longer publically available:
|
2017-12-01 15:29:14 +00:00
|
|
|
gtk_tree_view_get_bin_window(), gtk_viewport_get_bin_window(),
|
2017-01-11 02:20:38 +00:00
|
|
|
gtk_viewport_get_view_window().
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-12-26 14:30:07 +00:00
|
|
|
<section>
|
|
|
|
<title>Widgets are now visible by default</title>
|
|
|
|
<para>
|
|
|
|
The default value of #GtkWidget::visible in GTK+ 4 is %TRUE, so you no
|
|
|
|
longer need to explicitly show all your widgets. On the flip side, you
|
|
|
|
need to hide widgets that are not meant to be visible from the start.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
A convenient way to remove unnecessary property assignments like this
|
|
|
|
from ui files it run the command <command>gtk4-builder-tool simplify --replace</command>
|
|
|
|
on them.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2017-01-11 02:20:38 +00:00
|
|
|
<section>
|
|
|
|
<title>Adapt to changes in animated hiding and showing of widgets</title>
|
|
|
|
<para>
|
|
|
|
Widgets that appear and disappear with an animation, such as GtkPopover,
|
|
|
|
GtkInfoBar, GtkRevealer no longer use gtk_widget_show() and gtk_widget_hide()
|
|
|
|
for this, but have gained dedicated APIs for this purpose that you should
|
|
|
|
use.
|
|
|
|
</para>
|
|
|
|
</section>
|
2017-01-19 18:52:52 +00:00
|
|
|
|
|
|
|
<section>
|
2017-12-26 14:30:07 +00:00
|
|
|
<title>Stop passing commandline arguments to gtk_init</title>
|
2017-01-19 18:52:52 +00:00
|
|
|
<para>
|
|
|
|
The gtk_init() and gtk_init_check() functions no longer accept commandline
|
|
|
|
arguments. Just call them without arguments. Other initialization functions
|
|
|
|
that were purely related to commandline argument handling, such as
|
|
|
|
gtk_parse_args() and gtk_get_option_group(), are gone. The APIs to
|
|
|
|
initialize GDK separately are also gone, but it is very unlikely
|
|
|
|
that you are affected by that.
|
|
|
|
</para>
|
|
|
|
</section>
|
2017-10-23 16:33:15 +00:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>GdkPixbuf is deemphasized</title>
|
|
|
|
<para>
|
2017-12-26 14:30:07 +00:00
|
|
|
A number of #GdkPixbuf-based APIs have been removed. The available replacements
|
|
|
|
are either using #GIcon, cairo_surface_t or the newly introduced #GdkTexture class
|
2017-12-01 15:29:14 +00:00
|
|
|
instead.
|
|
|
|
</para>
|
|
|
|
<para>
|
2017-12-26 14:30:07 +00:00
|
|
|
If you are dealing with pixbufs, you can use gdk_texture_new_for_pixbuf()
|
|
|
|
to convert them to texture objects where needed.
|
2017-12-01 15:29:14 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>GtkWidget event signals are deemphasized</title>
|
|
|
|
<para>
|
2017-12-26 14:30:07 +00:00
|
|
|
Event controllers and #GtkGestures have already been introduced in GTK+ 3 to handle
|
|
|
|
input for many cases. In GTK+ 4, even more are available, such as #GtkEventControllerScroll
|
|
|
|
and GtkEventControllerMotion, and the traditional widget signals for handling input,
|
|
|
|
such as #GtkWidget::motion-event or #GtkWidget::event have been deprecated.
|
2017-12-01 15:29:14 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
2017-12-26 14:30:07 +00:00
|
|
|
<title>The gtk_window_fullscreen_on_monitor API has changed</title>
|
2017-12-01 15:29:14 +00:00
|
|
|
<para>
|
2017-12-26 14:30:07 +00:00
|
|
|
Instead of a monitor number, gtk_window_fullscreen_on_monitor() now takes a
|
|
|
|
#GdkMonitor argument.
|
2017-12-01 15:29:14 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Adapt to cursor API changes</title>
|
|
|
|
<para>
|
|
|
|
Use the new gtk_widget_set_cursor() function to set cursors, instead of
|
|
|
|
setting the cursor on the underlying window directly. This is necessary
|
|
|
|
because most widgets don't have their own window anymore, turning any
|
|
|
|
such calls into global cursor changes.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
For creating standard cursors, gdk_cursor_new_for_display() has been removed,
|
|
|
|
you have to use cursor names instead of GdkCursorType. For creating custom cursors,
|
|
|
|
use gdk_cursor_new_from_texture(). The ability to get cursor images has been removed.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
2017-12-26 14:30:07 +00:00
|
|
|
<title>Adapt to icon size API changes</title>
|
2017-12-01 15:29:14 +00:00
|
|
|
<para>
|
|
|
|
Instead of the existing extensible set of symbolic icon sizes, GTK+ now only
|
2017-12-26 14:30:07 +00:00
|
|
|
supports normal and large icons with the #GtkIconSize enumeration. The actual sizes
|
|
|
|
can be defined by themes via the CSS property -gtk-icon-size.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
GtkImage setters like gtk_image_set_from_icon_name() no longer take a #GtkIconSize
|
|
|
|
argument. You can use the separate gtk_image_set_icon_size() setter if you need
|
|
|
|
to override the icon size.
|
2017-12-01 15:29:14 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2017-12-26 14:30:07 +00:00
|
|
|
The ::stock-size property of GtkCellRendererPixbuf has been renamed to
|
|
|
|
#GtkCellRendererPixbuf:icon-size.
|
2017-10-23 16:33:15 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
2016-10-18 20:20:44 +00:00
|
|
|
</section>
|
|
|
|
|
2016-10-18 19:21:12 +00:00
|
|
|
</chapter>
|
2016-10-20 20:09:45 +00:00
|
|
|
|