From 6ddbb2a40227eb8ede1ac3bf868fb319ddb0bd99 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Jan 2021 07:52:36 -0500 Subject: [PATCH 1/2] doc: Clarify some migration hints Don't mention GdkSurface::layout as replacement for GtkWindow::configure-event. Instead, explain how to save window state. --- docs/reference/gtk/migrating-3to4.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md index 77296ac6c9..9942b46048 100644 --- a/docs/reference/gtk/migrating-3to4.md +++ b/docs/reference/gtk/migrating-3to4.md @@ -165,11 +165,11 @@ for this change. | ::key-release-event | #GtkEventControllerKey | | ::enter-notify-event | #GtkEventControllerMotion | | ::leave-notify-event | #GtkEventControllerMotion | -| ::configure-event | replaced by #GdkSurface::layout | +| ::configure-event | - | | ::focus-in-event | #GtkEventControllerFocus | | ::focus-out-event | #GtkEventControllerFocus | -| ::map-event | replaced by #GdkSurface:mapped | -| ::unmap-event | replaced by #GdkSurface:mapped | +| ::map-event | - | +| ::unmap-event | - | | ::property-notify-event | replaced by #GdkClipboard | | ::selection-clear-event | replaced by #GdkClipboard | | ::selection-request-event | replaced by #GdkClipboard | @@ -178,10 +178,17 @@ for this change. | ::proximity-in-event | #GtkGestureStylus | | ::proximity-out-event | #GtkGestureStylus | | ::visibility-notify-event | - | -| ::window-state-event | replaced by #GdkToplevel:state | +| ::window-state-event | - | | ::damage-event | - | | ::grab-broken-event | - | +Event signals which are not directly related to input have to be dealt +with on a one-by-one basis. If you were using ::configure-event and +::window-state-event to save window state, you should use property +notification for corresponding GtkWindow properties, such as +#GtkWindow:default-width, #GtkWindow:default-height, #GtkWindow:maximized +or #GtkWindow:fullscreened. + ### Set a proper application ID In GTK 4 we want the application's #GApplication 'application-id' @@ -854,7 +861,8 @@ to get it. The ::size-allocate signal has been removed, since it is easy to misuse. If you need to learn about sizing changes of custom drawing widgets, use the #GtkDrawingArea::resize or #GtkGLArea::resize -signals. +signals. If you want to track the size of toplevel windows, use +property notification for #GtkWindow:default-width and #GtkWindow:default-height. ### Switch to GtkWidget's children APIs From 880468f5a389f31aa5fa3d21223c03c44f471028 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Jan 2021 08:13:34 -0500 Subject: [PATCH 2/2] docs: Fix a heading gotcha One of the many migration guide sections was too prominent. --- docs/reference/gtk/migrating-3to4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md index 9942b46048..3d2fa1638b 100644 --- a/docs/reference/gtk/migrating-3to4.md +++ b/docs/reference/gtk/migrating-3to4.md @@ -522,7 +522,7 @@ option. You should always review the resulting changes. The tag now supports for the 'lib' attribute the 'gtk' value only, instead of the 'gtk+' one previously. -## Adapt to GtkBuilder API changes +### Adapt to GtkBuilder API changes gtk_builder_connect_signals() no longer exists. Instead, signals are always connected automatically. If you need to add user data to your