From 04c4b387a025eeda4290c42113ba0f67d5341f62 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 18 Nov 2020 10:48:01 -0500 Subject: [PATCH 1/5] gtk-demo: Add more keywords Add GtkShortcutController as a keyword to some demos that show its use. --- demos/gtk-demo/builder.c | 2 +- demos/gtk-demo/sliding_puzzle.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/demos/gtk-demo/builder.c b/demos/gtk-demo/builder.c index 22c06dfa72..082632204a 100644 --- a/demos/gtk-demo/builder.c +++ b/demos/gtk-demo/builder.c @@ -1,5 +1,5 @@ /* Builder - * #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, toolbar + * #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, GtkShortcutController, toolbar * * Demonstrates a traditional interface, loaded from a XML description, * and shows how to connect actions to the menu items and toolbar buttons. diff --git a/demos/gtk-demo/sliding_puzzle.c b/demos/gtk-demo/sliding_puzzle.c index 4d7e23f908..1af4e2b48a 100644 --- a/demos/gtk-demo/sliding_puzzle.c +++ b/demos/gtk-demo/sliding_puzzle.c @@ -1,5 +1,5 @@ /* Sliding Puzzle - * #Keywords: GdkPaintable, GdkGesture, game + * #Keywords: GdkPaintable, GdkGesture, GtkShortcutController, game * * This demo demonstrates how to use gestures and paintables to create a * small sliding puzzle game. @@ -281,7 +281,8 @@ start_puzzle (GdkPaintable *paintable) gtk_aspect_frame_set_obey_child (GTK_ASPECT_FRAME (frame), FALSE); /* Add shortcuts so people can use the arrow - * keys to move the puzzle */ + * keys to move the puzzle + */ controller = gtk_shortcut_controller_new (); gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller), GTK_SHORTCUT_SCOPE_LOCAL); From 88be92ceeea321db2b32832bb5c5ba2fe221f2b1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 18 Nov 2020 17:27:13 -0500 Subject: [PATCH 2/5] scrollbar: Don't talk about steppers There steppers were lost on the way from GtkRange to GtkScrollbar, so don't talk about them in the docs. --- gtk/gtkscrollbar.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c index 14ba704ff7..f3d02f8bf8 100644 --- a/gtk/gtkscrollbar.c +++ b/gtk/gtkscrollbar.c @@ -52,8 +52,8 @@ * #GtkAdjustment:page-size represents the size of the visible scrollable area. * The fields #GtkAdjustment:step-increment and #GtkAdjustment:page-increment * fields are added to or subtracted from the #GtkAdjustment:value when the user - * asks to move by a step (using e.g. the cursor arrow keys or, if present, the - * stepper buttons) or by a page (using e.g. the Page Down/Up keys). + * asks to move by a step (using e.g. the cursor arrow keys) or by a page (using + * e.g. the Page Down/Up keys). * * # CSS nodes * @@ -71,10 +71,6 @@ * The range node gets the style class .fine-tune added when the scrollbar is * in 'fine-tuning' mode. * - * If steppers are enabled, they are represented by up to four additional - * subnodes with name button. These get the style classes .up and .down to - * indicate in which direction they are moving. - * * Other style classes that may be added to scrollbars inside #GtkScrolledWindow * include the positional classes (.left, .right, .top, .bottom) and style * classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering). From 86d7ab7c50191201f498413676a5c71c7cf4b90a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 18 Nov 2020 18:18:31 -0500 Subject: [PATCH 3/5] docs: Update GtkSensitivityType docs Don't talk about steppers here, since we are only using this type for combobox buttons nowadays. --- gtk/gtkenums.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index d3b6b3e6b2..761db8a538 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -196,13 +196,13 @@ typedef enum /** * GtkSensitivityType: - * @GTK_SENSITIVITY_AUTO: The arrow is made insensitive if the - * thumb is at the end - * @GTK_SENSITIVITY_ON: The arrow is always sensitive - * @GTK_SENSITIVITY_OFF: The arrow is always insensitive + * @GTK_SENSITIVITY_AUTO: The control is made insensitive if no + * action can be triggered + * @GTK_SENSITIVITY_ON: The control is always sensitive + * @GTK_SENSITIVITY_OFF: The control is always insensitive * - * Determines how GTK handles the sensitivity of stepper arrows - * at the end of range widgets. + * Determines how GTK handles the sensitivity of various controls, + * such as combo box buttons. */ typedef enum { From 09fd2d61c47a1e70b4b1f1dd9474dfd2262175e1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 18 Nov 2020 18:35:56 -0500 Subject: [PATCH 4/5] gtk-demo: Rename some demos This is just to make it easier for myself to find the right sources. --- .../{constraints4.c => constraints_builder.c} | 4 ++-- .../{constraints.ui => constraints_builder.ui} | 0 ...onstraints2.c => constraints_interactive.c} | 2 +- .../{constraints3.c => constraints_vfl.c} | 2 +- demos/gtk-demo/demo.gresource.xml | 18 +++++++++--------- .../{listbox2.c => listbox_controls.c} | 4 ++-- .../{listbox2.ui => listbox_controls.ui} | 0 demos/gtk-demo/meson.build | 10 +++++----- .../{overlay2.c => overlay_decorative.c} | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) rename demos/gtk-demo/{constraints4.c => constraints_builder.c} (91%) rename demos/gtk-demo/{constraints.ui => constraints_builder.ui} (100%) rename demos/gtk-demo/{constraints2.c => constraints_interactive.c} (99%) rename demos/gtk-demo/{constraints3.c => constraints_vfl.c} (99%) rename demos/gtk-demo/{listbox2.c => listbox_controls.c} (94%) rename demos/gtk-demo/{listbox2.ui => listbox_controls.ui} (100%) rename demos/gtk-demo/{overlay2.c => overlay_decorative.c} (98%) diff --git a/demos/gtk-demo/constraints4.c b/demos/gtk-demo/constraints_builder.c similarity index 91% rename from demos/gtk-demo/constraints4.c rename to demos/gtk-demo/constraints_builder.c index 4b4ca49643..1233adaed1 100644 --- a/demos/gtk-demo/constraints4.c +++ b/demos/gtk-demo/constraints_builder.c @@ -43,7 +43,7 @@ constraints_grid_class_init (ConstraintsGridClass *klass) } GtkWidget * -do_constraints4 (GtkWidget *do_widget) +do_constraints_builder (GtkWidget *do_widget) { static GtkWidget *window; @@ -53,7 +53,7 @@ do_constraints4 (GtkWidget *do_widget) g_type_ensure (constraints_grid_get_type ()); - builder = gtk_builder_new_from_resource ("/constraints4/constraints.ui"); + builder = gtk_builder_new_from_resource ("/constraints_builder/constraints_builder.ui"); window = GTK_WIDGET (gtk_builder_get_object (builder, "window1")); gtk_window_set_display (GTK_WINDOW (window), diff --git a/demos/gtk-demo/constraints.ui b/demos/gtk-demo/constraints_builder.ui similarity index 100% rename from demos/gtk-demo/constraints.ui rename to demos/gtk-demo/constraints_builder.ui diff --git a/demos/gtk-demo/constraints2.c b/demos/gtk-demo/constraints_interactive.c similarity index 99% rename from demos/gtk-demo/constraints2.c rename to demos/gtk-demo/constraints_interactive.c index 782ade175b..90262552f6 100644 --- a/demos/gtk-demo/constraints2.c +++ b/demos/gtk-demo/constraints_interactive.c @@ -205,7 +205,7 @@ interactive_grid_init (InteractiveGrid *self) } GtkWidget * -do_constraints2 (GtkWidget *do_widget) +do_constraints_interactive (GtkWidget *do_widget) { static GtkWidget *window; diff --git a/demos/gtk-demo/constraints3.c b/demos/gtk-demo/constraints_vfl.c similarity index 99% rename from demos/gtk-demo/constraints3.c rename to demos/gtk-demo/constraints_vfl.c index b0d15dc2ac..08016f0b48 100644 --- a/demos/gtk-demo/constraints3.c +++ b/demos/gtk-demo/constraints_vfl.c @@ -128,7 +128,7 @@ vfl_grid_init (VflGrid *self) } GtkWidget * -do_constraints3 (GtkWidget *do_widget) +do_constraints_vfl (GtkWidget *do_widget) { static GtkWidget *window; diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml index 72933ebef6..a0ccb783d9 100644 --- a/demos/gtk-demo/demo.gresource.xml +++ b/demos/gtk-demo/demo.gresource.xml @@ -18,8 +18,8 @@ demoimage.c demoimage.h - - constraints.ui + + constraints_builder.ui css_accordion.css @@ -253,9 +253,9 @@ clipboard.c combobox.c constraints.c - constraints2.c - constraints3.c - constraints4.c + constraints_interactive.c + constraints_vfl.c + constraints_builder.c css_accordion.c css_basics.c css_blendmodes.c @@ -294,7 +294,7 @@ layoutmanager2.c links.c listbox.c - listbox2.c + listbox_controls.c listview_applauncher.c listview_colors.c listview_clocks.c @@ -309,7 +309,7 @@ markup.c menu.c overlay.c - overlay2.c + overlay_decorative.c paint.c pagesetup.c paintable.c @@ -359,8 +359,8 @@ messages.txt apple-red.png - - listbox2.ui + + listbox_controls.ui glarea-gl.fs.glsl diff --git a/demos/gtk-demo/listbox2.c b/demos/gtk-demo/listbox_controls.c similarity index 94% rename from demos/gtk-demo/listbox2.c rename to demos/gtk-demo/listbox_controls.c index 17a79df741..5a72622d22 100644 --- a/demos/gtk-demo/listbox2.c +++ b/demos/gtk-demo/listbox_controls.c @@ -34,7 +34,7 @@ row_activated (GtkListBox *list, } GtkWidget * -do_listbox2 (GtkWidget *do_widget) +do_listbox_controls (GtkWidget *do_widget) { if (!window) { @@ -47,7 +47,7 @@ do_listbox2 (GtkWidget *do_widget) builder = gtk_builder_new (); gtk_builder_set_scope (builder, scope); - gtk_builder_add_from_resource (builder, "/listbox2/listbox2.ui", NULL); + gtk_builder_add_from_resource (builder, "/listbox_controls/listbox_controls.ui", NULL); window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); gtk_window_set_display (GTK_WINDOW (window), diff --git a/demos/gtk-demo/listbox2.ui b/demos/gtk-demo/listbox_controls.ui similarity index 100% rename from demos/gtk-demo/listbox2.ui rename to demos/gtk-demo/listbox_controls.ui diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build index 93a78c9fca..9076c05383 100644 --- a/demos/gtk-demo/meson.build +++ b/demos/gtk-demo/meson.build @@ -7,9 +7,9 @@ demos = files([ 'clipboard.c', 'combobox.c', 'constraints.c', - 'constraints2.c', - 'constraints3.c', - 'constraints4.c', + 'constraints_interactive.c', + 'constraints_vfl.c', + 'constraints_builder.c', 'css_accordion.c', 'css_basics.c', 'css_blendmodes.c', @@ -44,7 +44,7 @@ demos = files([ 'layoutmanager2.c', 'links.c', 'listbox.c', - 'listbox2.c', + 'listbox_controls.c', 'menu.c', 'flowbox.c', 'list_store.c', @@ -60,7 +60,7 @@ demos = files([ 'listview_words.c', 'markup.c', 'overlay.c', - 'overlay2.c', + 'overlay_decorative.c', 'paint.c', 'paintable.c', 'paintable_animated.c', diff --git a/demos/gtk-demo/overlay2.c b/demos/gtk-demo/overlay_decorative.c similarity index 98% rename from demos/gtk-demo/overlay2.c rename to demos/gtk-demo/overlay_decorative.c index 11f2e2a243..8306f52fb1 100644 --- a/demos/gtk-demo/overlay2.c +++ b/demos/gtk-demo/overlay_decorative.c @@ -21,7 +21,7 @@ margin_changed (GtkAdjustment *adjustment, } GtkWidget * -do_overlay2 (GtkWidget *do_widget) +do_overlay_decorative (GtkWidget *do_widget) { static GtkWidget *window = NULL; From a2ce6268b2f5380a695f2cada25fe73cfb061b4a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 19 Nov 2020 07:30:30 -0500 Subject: [PATCH 5/5] gtk-demo: Make a more interesting constraints demo Show various ways to influence spacing. This is more or less modeled on the way Androids constraint layout lets you set up 'chains'. --- demos/gtk-demo/constraints_builder.c | 8 +- demos/gtk-demo/constraints_builder.ui | 468 ++++++++++++++++++++++---- 2 files changed, 416 insertions(+), 60 deletions(-) diff --git a/demos/gtk-demo/constraints_builder.c b/demos/gtk-demo/constraints_builder.c index 1233adaed1..5d8b6a9413 100644 --- a/demos/gtk-demo/constraints_builder.c +++ b/demos/gtk-demo/constraints_builder.c @@ -1,8 +1,10 @@ /* Constraints/Builder * - * GtkConstraintLayouts can be created in .ui files, and constraints can be - * set up at that time as well, as this example demonstrates. It uses the - * same setup as the “Simple” constraints demo. + * GtkConstraintLayouts can be created in .ui files, and constraints can + * be set up at that time as well, as this example demonstrates. It shows + * various ways to do spacing and sizing with constraints. + * + * Make the window wider to see the rows react differently */ #include diff --git a/demos/gtk-demo/constraints_builder.ui b/demos/gtk-demo/constraints_builder.ui index 1766f931c7..c5748e7f42 100644 --- a/demos/gtk-demo/constraints_builder.ui +++ b/demos/gtk-demo/constraints_builder.ui @@ -5,99 +5,453 @@ 260 + fill + fill + 10 + 10 + 10 + 10 - - - - - - - - - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Child 1 + A - Child 2 + B - Child 3 + C + + + + + A + + + + + B + + + + + C + + + + + A + + + + + B + + + + + C + + + + + A + + + + + B + + + + + C + + + + + A + + + + + B + + + + + C