From 0179d765694057717c2c0a700ddd9b8d2958c671 Mon Sep 17 00:00:00 2001 From: Blady Date: Sat, 1 Feb 2020 19:04:14 +0100 Subject: [PATCH 1/8] Add testgtk/task_project/obj in .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 86745f383..54b0c4390 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ docs/gtkada_ug/gtkada_ug.html docs/gtkada_ug/gtkada_ug.info docs/gtkada_ug/gtkada_ug.ps docs/gtkada_ug/gtkada_ug.txt +testgtk/task_project/obj From 1cbced30b152579d72416d5141cec3fa076df6eb Mon Sep 17 00:00:00 2001 From: Blady Date: Sat, 1 Feb 2020 19:09:01 +0100 Subject: [PATCH 2/8] Fix css_accordion.css issues: (testgtk): Gtk-WARNING: Theme parsing error: css_accordion.css:10:13: The 'icon-shadow' property has been renamed to '-gtk-icon-shadow' (testgtk): Gtk-WARNING: Theme parsing error: css_accordion.css:54:8: The 'engine' property is ignored (testgtk): Gtk-WARNING: Theme parsing error: css_accordion.css:57:31: The style property GtkWidget:focus-line-width is deprecated and shouldn't be used anymore. It will be removed in a future version (testgtk): Gtk-WARNING: Theme parsing error: css_accordion.css:58:28: The style property GtkWidget:focus-padding is deprecated and shouldn't be used anymore. It will be removed in a future version (testgtk): Gtk-WARNING: Theme parsing error: css_accordion.css:59:28: The style property GtkNotebook:initial-gap is deprecated and shouldn't be used anymore. It will be removed in a future version (testgtk): Gtk-WARNING: Theme parsing error: css_accordion.css:66:24: Using Pango syntax for the font: style property is deprecated; please use CSS syntax Failed to load css_accordion.css ! css_accordion.css:66:10not a number --- testgtk/css_accordion.css | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/testgtk/css_accordion.css b/testgtk/css_accordion.css index a2761e57c..a1b56ba61 100644 --- a/testgtk/css_accordion.css +++ b/testgtk/css_accordion.css @@ -7,7 +7,7 @@ font-variant: inherit; font-weight: inherit; text-shadow: inherit; - icon-shadow: inherit; + -gtk-icon-shadow: inherit; box-shadow: initial; margin-top: initial; margin-left: initial; @@ -51,19 +51,19 @@ transition-duration: initial; transition-timing-function: initial; transition-delay: initial; - engine: initial; - gtk-key-bindings: initial; - -GtkWidget-focus-line-width: 0; - -GtkWidget-focus-padding: 0; - -GtkNotebook-initial-gap: 0; + -gtk-key-bindings: initial; + + + + } * { transition-property: color, background-color, border-color, background-image, padding, border-width; transition-duration: 0.2s; - font: Cantarell 20px; + font: 20px Cantarell; } GtkWindow { From d9a8020e05e1bfa96e01b7fdd2e7da72d1a8c915 Mon Sep 17 00:00:00 2001 From: Blady Date: Sat, 1 Feb 2020 21:25:30 +0100 Subject: [PATCH 3/8] Fix blocking issue in create_cursors.adb. The gdk-window-process-all-updates function has been deprecated since version 3.22 and should not be used in newly-written code. --- testgtk/create_cursors.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testgtk/create_cursors.adb b/testgtk/create_cursors.adb index 5dc2b4b33..1eef50d09 100644 --- a/testgtk/create_cursors.adb +++ b/testgtk/create_cursors.adb @@ -129,9 +129,10 @@ package body Create_Cursors is -- The cursor change is asynchronous: if you plan to do a blocking -- operation right after setting this, it is useful to call - -- Process_All_Updates in order for impacted windows to have the new + -- Process_Updates in order for impacted windows to have the new -- cursor. - Process_All_Updates; + Process_Updates (Self => Window, + Update_Children => False); -- Note: the cursor pixmap is copied to the server, which keeps it as -- long at it needs. On the client side, it is possible to delete the From 19251fbebc1d09837ba2f82bfb75b1140a17c5e8 Mon Sep 17 00:00:00 2001 From: Blady Date: Sun, 2 Feb 2020 11:43:49 +0100 Subject: [PATCH 4/8] Fix issues when clipboard content is not UTF8 or null. (testgtk): Gtk-CRITICAL: gtk_text_buffer_emit_insert: assertion 'g_utf8_validate (text, len, NULL)' failed and raised INTERFACES.C.STRINGS.DEREFERENCE_ERROR : i-cstrin.adb:206 --- testgtk/create_clipboard.adb | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/testgtk/create_clipboard.adb b/testgtk/create_clipboard.adb index a503cb9a0..eae4f45c1 100644 --- a/testgtk/create_clipboard.adb +++ b/testgtk/create_clipboard.adb @@ -21,7 +21,9 @@ -- -- ------------------------------------------------------------------------------ +with System; with Glib; use Glib; +with Glib.Unicode; use Glib.Unicode; with Gdk.Pixbuf; use Gdk.Pixbuf; with Gdk.Property; use Gdk.Property; with Gdk.Types; use Gdk.Types; @@ -165,6 +167,9 @@ package body Create_Clipboard is declare Format : constant String := Get_String (Model, Iter, 0); + Valid : Boolean; + Invalid_Pos : Natural; + use type System.Address; begin Data := Wait_For_Contents (Clipboard, Atom_Intern (Format)); @@ -196,10 +201,27 @@ package body Create_Clipboard is & ASCII.LF); if As_String then - Insert - (Contents, - First, - "As_String=" & Get_Data_As_String (Data)); + if Data.Get_Data /= System.Null_Address then + UTF8_Validate (Str => Get_Data_As_String (Data), + Valid => Valid, + Invalid_Pos => Invalid_Pos); + if Valid then + Insert + (Contents, + First, + "As_String=" & Get_Data_As_String (Data)); + else + Insert + (Contents, + First, + "Non valid UTF8 string"); + end if; + else + Insert + (Contents, + First, + "Null data"); + end if; end if; Free (Data); From 185dbbd64656c1debfead3557ea1c240c951bb61 Mon Sep 17 00:00:00 2001 From: Blady Date: Sun, 2 Feb 2020 15:49:47 +0100 Subject: [PATCH 5/8] Improve tooltip display. --- testgtk/create_tooltips.adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testgtk/create_tooltips.adb b/testgtk/create_tooltips.adb index 0ec167b1d..d74775b01 100644 --- a/testgtk/create_tooltips.adb +++ b/testgtk/create_tooltips.adb @@ -81,7 +81,7 @@ package body Create_Tooltips is is pragma Unreferenced (X, Y, Keyboard_Tip, Tooltip); Window : constant Gtk_Window := Gtk_Window (Check.Get_Tooltip_Window); - Color : constant Gdk_RGBA := (0.0, 0.0, 1.0, 0.5); + Color : constant Gdk_RGBA := (0.25, 0.65, 1.0, 1.0); begin Window.Override_Background_Color (Gtk_State_Flag_Normal, Color); return True; @@ -131,7 +131,7 @@ package body Create_Tooltips is Gtk_New (Label, "A selectable label"); Box1.Pack_Start (Label, False, False, 0); Label.Set_Selectable (True); - Label.Set_Tooltip_Text ("Another Label tooltip"); + Label.Set_Tooltip_Markup ("Another Label tooltip"); -- Another one, with a custom tooltip window From 4b41ecf3b5825e10a56115a7924a659f5931e1be Mon Sep 17 00:00:00 2001 From: Blady Date: Sun, 2 Feb 2020 16:36:03 +0100 Subject: [PATCH 6/8] Workaround in range controls: raised CONSTRAINT_ERROR : erroneous memory access it seems to be a GTK issue in gtkscalebutton.c:988 --- testgtk/create_range.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testgtk/create_range.adb b/testgtk/create_range.adb index 238c31dff..8f9a77d48 100644 --- a/testgtk/create_range.adb +++ b/testgtk/create_range.adb @@ -34,6 +34,8 @@ with Gtk.Volume_Button; use Gtk.Volume_Button; package body Create_Range is + Zero_String : aliased String := (1 => ASCII.NUL); + ---------- -- Help -- ---------- @@ -107,7 +109,8 @@ package body Create_Range is Pack_Start (Box3, Label, False, False, 0); Gtk_New (Scale_Button, Icon_Size_Button, 0.0, 100.0, 2.0, - Icons => (1 .. 0 => null)); + -- Icons => (1 .. 0 => null)); -- it seems to be a GTK issue in gtkscalebutton.c:988 + Icons => (1 => Zero_String'Access)); Pack_Start (Box3, Scale_Button, False, False, 0); Gtk_New (Label, "Volume button:"); From e853879aed38436050393617b749f45a7eafba2c Mon Sep 17 00:00:00 2001 From: Blady Date: Sun, 2 Feb 2020 18:22:11 +0100 Subject: [PATCH 7/8] Fix warning in revealer. (testgtk:43073): Gtk-WARNING **: 18:19:58.075: Negative content width -17 (allocation 1, extents 9x9) while allocating gadget (node entry, owner GtkEntry) --- testgtk/create_revealer.adb | 1 - 1 file changed, 1 deletion(-) diff --git a/testgtk/create_revealer.adb b/testgtk/create_revealer.adb index a57d15a58..31e9edd2f 100644 --- a/testgtk/create_revealer.adb +++ b/testgtk/create_revealer.adb @@ -77,7 +77,6 @@ package body Create_Revealer is Gtk_New (Button, "None"); Box.Attach (Button, 0, 0, 1, 1); Gtk_New (Revealer); - Revealer.Set_Halign (Align_Start); Revealer.Set_Valign (Align_Start); Gtk_New (Ent); Ent.Set_Text ("00000"); From 08f9aa66474c1a56820b63ec0bae87e5a1347417 Mon Sep 17 00:00:00 2001 From: Blady Date: Sun, 2 Feb 2020 19:22:13 +0100 Subject: [PATCH 8/8] Add missing frame labels. --- testgtk/create_canvas.adb | 2 ++ testgtk/create_canvas_view_animate.adb | 2 ++ testgtk/create_canvas_view_composite.adb | 2 ++ testgtk/create_canvas_view_edit.adb | 2 ++ testgtk/create_canvas_view_events.adb | 2 ++ testgtk/create_canvas_view_items.adb | 2 ++ testgtk/create_canvas_view_links.adb | 2 ++ testgtk/create_canvas_view_minimap.adb | 2 ++ testgtk/create_canvas_view_routes.adb | 2 ++ testgtk/create_canvas_view_rtrees.adb | 2 ++ testgtk/create_mdi.adb | 2 ++ testgtk/create_splittable.adb | 2 ++ 12 files changed, 24 insertions(+) diff --git a/testgtk/create_canvas.adb b/testgtk/create_canvas.adb index d287ed35d..3faa1df9a 100644 --- a/testgtk/create_canvas.adb +++ b/testgtk/create_canvas.adb @@ -791,6 +791,8 @@ package body Create_Canvas is Success : Boolean; begin + Gtk.Frame.Set_Label (Frame, "Canvas (obsolescent)"); + Last_Item := Items_List'First; Last_Link := 1; diff --git a/testgtk/create_canvas_view_animate.adb b/testgtk/create_canvas_view_animate.adb index eca2c367c..f8f0e65fc 100644 --- a/testgtk/create_canvas_view_animate.adb +++ b/testgtk/create_canvas_view_animate.adb @@ -111,6 +111,8 @@ package body Create_Canvas_View_Animate is Scrolled : Gtk_Scrolled_Window; Label : Gtk_Label; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (animation)"); + Gtk_New (Model); Gtkada.Canvas_View.Initialize (Canvas); diff --git a/testgtk/create_canvas_view_composite.adb b/testgtk/create_canvas_view_composite.adb index 5713883b4..ef9cd3ec4 100644 --- a/testgtk/create_canvas_view_composite.adb +++ b/testgtk/create_canvas_view_composite.adb @@ -280,6 +280,8 @@ package body Create_Canvas_View_Composite is end Do_Example; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (composite)"); + Red := Gtk_New (Stroke => Black_RGBA, Fill => Create_Rgba_Pattern ((1.0, 0.0, 0.0, 0.6))); diff --git a/testgtk/create_canvas_view_edit.adb b/testgtk/create_canvas_view_edit.adb index 6a43743d6..cf16b4924 100644 --- a/testgtk/create_canvas_view_edit.adb +++ b/testgtk/create_canvas_view_edit.adb @@ -64,6 +64,8 @@ package body Create_Canvas_View_Edit is Rect : Rect_Item; White, Font : Drawing_Style; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (editing)"); + Font := Gtk_New (Stroke => Null_RGBA, Font => (Name => From_String ("sans 10"), diff --git a/testgtk/create_canvas_view_events.adb b/testgtk/create_canvas_view_events.adb index 125911812..45bc4a794 100644 --- a/testgtk/create_canvas_view_events.adb +++ b/testgtk/create_canvas_view_events.adb @@ -179,6 +179,8 @@ package body Create_Canvas_View_Events is L : Gdouble; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (events)"); + Gtk_New (Model); Model.Set_Selection_Mode (Selection_Multiple); diff --git a/testgtk/create_canvas_view_items.adb b/testgtk/create_canvas_view_items.adb index b44c37979..66a6a6ed0 100644 --- a/testgtk/create_canvas_view_items.adb +++ b/testgtk/create_canvas_view_items.adb @@ -329,6 +329,8 @@ package body Create_Canvas_View_Items is Rect1, Rect2 : Rect_Item; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (items)"); + Font := Gtk_New (Stroke => Null_RGBA, Font => (Name => From_String ("sans 10"), diff --git a/testgtk/create_canvas_view_links.adb b/testgtk/create_canvas_view_links.adb index f29660da0..8a18695b3 100644 --- a/testgtk/create_canvas_view_links.adb +++ b/testgtk/create_canvas_view_links.adb @@ -355,6 +355,8 @@ package body Create_Canvas_View_Links is Text : Text_Item; Y : Gdouble; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (links)"); + Gtk_New (Model); Black := Gtk_New; diff --git a/testgtk/create_canvas_view_minimap.adb b/testgtk/create_canvas_view_minimap.adb index f437a2c22..73143d766 100644 --- a/testgtk/create_canvas_view_minimap.adb +++ b/testgtk/create_canvas_view_minimap.adb @@ -68,6 +68,8 @@ package body Create_Canvas_View_Minimap is L : Gdouble; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (minimap)"); + Gtk_New (Model); Canvas := new Canvas_View_Record; diff --git a/testgtk/create_canvas_view_routes.adb b/testgtk/create_canvas_view_routes.adb index 76d7ab2a4..751fc6cd7 100644 --- a/testgtk/create_canvas_view_routes.adb +++ b/testgtk/create_canvas_view_routes.adb @@ -171,6 +171,8 @@ package body Create_Canvas_View_Routes is Items : array (Pos'Range) of Demo_Item; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (routes)"); + Layout := Frame.Create_Pango_Layout; Layout.Set_Font_Description (From_String ("sans 8px")); diff --git a/testgtk/create_canvas_view_rtrees.adb b/testgtk/create_canvas_view_rtrees.adb index 583df9554..def666cab 100644 --- a/testgtk/create_canvas_view_rtrees.adb +++ b/testgtk/create_canvas_view_rtrees.adb @@ -87,6 +87,8 @@ package body Create_Canvas_View_Rtrees is Link_Style : Drawing_Style; begin + Gtk.Frame.Set_Label (Frame, "Canvas View (large)"); + Gtk_New (Model); Model.Set_Selection_Mode (Selection_Single); diff --git a/testgtk/create_mdi.adb b/testgtk/create_mdi.adb index 72f5c1622..6b3c70216 100644 --- a/testgtk/create_mdi.adb +++ b/testgtk/create_mdi.adb @@ -371,6 +371,7 @@ package body Create_MDI is procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is begin + Gtk.Frame.Set_Label (Frame, "MDI"); Setup (Frame, Independent => False); end Run; @@ -381,6 +382,7 @@ package body Create_MDI is procedure Run_Independent (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is begin + Gtk.Frame.Set_Label (Frame, "MDI (independent perspectives)"); Setup (Frame, Independent => True); end Run_Independent; end Create_MDI; diff --git a/testgtk/create_splittable.adb b/testgtk/create_splittable.adb index fff5f583e..347bd3ad7 100644 --- a/testgtk/create_splittable.adb +++ b/testgtk/create_splittable.adb @@ -215,6 +215,8 @@ package body Create_Splittable is Box : Gtk_Box; Toggle : Gtk_Toggle_Button; begin + Gtk.Frame.Set_Label (Frame, "Multi Paned"); + Gtk_New_Vbox (Box, Homogeneous => False); Add (Frame, Box);