-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sample.Gtk: build SourceGen separately #21
base: master
Are you sure you want to change the base?
Sample.Gtk: build SourceGen separately #21
Conversation
We changed the dotnet version to 6.0.300 to ultimately use GtkSharp pre-built packages instead of cloning the repo. Co-authored-by: webwarrior-ws <reg@webwarrior.ws> Co-authored-by: Parham Saremi <parhaamsaremi@gmail.com>
Error: /home/runner/work/maui/maui/src/Controls/samples/Controls.Sample.Gtk/SimpleSampleApp/SimpleSampleGtkApplication.cs(28,5): error CS0117: 'Box' does not contain a definition for 'Fill'
It was throwing some error in our PRs CI, and this seems Microsoft-specific.
FontNamedSizeService is needed when using `Fontsize=Large` or `Fontsize=Small` in Xaml files. Without this service, we get runtime errors when trying to parse Xaml files that have Fontsize attribute in them.
These changes are necessary for having access to MainWindow in MauiGtkApplication. Initially, this field was always null and was never set. We needed access to MainWindow to do manual operations like resize on it because the applications might want to specify custom size of the window. Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
When TRACE_ALLOCATION constant is defined, some debug borders with width and heights is shown for layouts. By disabling them, the debug values are removed from the final output.
Made label widget in Gtk respect LineBreakMode and MaxLines properties, the way it does on other platforms. By doing this labels won't crop text with dashes in any part of the word and they keep the words complete. These properties were added to ILabel interface, as it is in MAUI main branch.
Layout size is messed up after window looses or gains focus. Which is fixed by not returning the cached value. Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
Implement Connectivity for Gtk platform by porting code from nblockchain/DotNetEssentials.
Implemented NavigationViewHandler for Gtk. Made changes so that NavigationViewHandler is used for NavigationPage in Gtk, instead of generic Page handler. It is incomplete at the moment. Processing of navigation events works, but toolbar is not implemented. Co-authored-by: Parham <parhaamsaremi@gmail.com>
In order to have this new CI fragment pass we've had to update many C# files.
Implement AlertManager for Gtk. Implementation is not complete; alert dialogs and action sheets are implemented, progress bar prompts are not. Also title bar is not shown.
Layouts in Gtk now react to change in Visibility property.
This way we know exactly all the projects that are being compiled.
Made date picker work, ported from [1]. But it gives errors in console and can crash[2] if opened/closed many times. [1] https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Platform.GTK/Controls/DatePicker.cs [2] (TODO: file a bug in GtkSharp repo): ``` (GWallet.Frontend.Maui:110296): GLib-GObject-CRITICAL **: 12:14:36.625: g_object_remove_toggle_ref: assertion 'G_IS_OBJECT (object)' failed (GWallet.Frontend.Maui:110296): GLib-GObject-CRITICAL **: 12:14:36.627: g_object_remove_toggle_ref: assertion 'G_IS_OBJECT (object)' failed Marshaling button-press-event signal Exception in Gtk# callback delegate Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception. GLib.MissingIntPtrCtorException: Unable to construct instance of type Microsoft.Maui.Platform.DatePickerWindow from native object handle. Instance of managed subclass may have been prematurely disposed. at GLib.ObjectManager.CreateObject(IntPtr raw) at GLib.Object.GetObject(IntPtr o, Boolean owned_ref) at GLib.Value.get_Val() at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) at GLib.ExceptionManager.RaiseUnhandledException(Exception e, Boolean is_terminal) at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) at GLib.Application.Run(String program_name, String[] args) at GLib.Application.Run() at Microsoft.Maui.MauiGtkApplication.Launch(EventArgs args) in /home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/src/Platform/Gtk/MauiGtkApplication.cs:line 127 at Microsoft.Maui.MauiGtkApplication.Run(String[] args) in /home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/src/Platform/Gtk/MauiGtkApplication.cs:line 40 at GWallet.Frontend.Maui.Program.main(String[] _args) in /home/ubuntu/geewallet-build/geewallet/src/GWallet.Frontend.Maui/Platforms/Gtk/Program.fs:line 14 ``` Co-authored-by: Parham <parhaamsaremi@gmail.com>
Fix potential exception if DatePicker is used many times quickly: ``` (GWallet.Frontend.Maui:110296): GLib-GObject-CRITICAL **: 12:14:36.625: g_object_remove_toggle_ref: assertion 'G_IS_OBJECT (object)' failed (GWallet.Frontend.Maui:110296): GLib-GObject-CRITICAL **: 12:14:36.627: g_object_remove_toggle_ref: assertion 'G_IS_OBJECT (object)' failed Marshaling button-press-event signal Exception in Gtk# callback delegate Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception. GLib.MissingIntPtrCtorException: Unable to construct instance of type Microsoft.Maui.Platform.DatePickerWindow from native object handle. Instance of managed subclass may have been prematurely disposed. at GLib.ObjectManager.CreateObject(IntPtr raw) at GLib.Object.GetObject(IntPtr o, Boolean owned_ref) at GLib.Value.get_Val() at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) at GLib.ExceptionManager.RaiseUnhandledException(Exception e, Boolean is_terminal) at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) at GLib.Application.Run(String program_name, String[] args) at GLib.Application.Run() at Microsoft.Maui.MauiGtkApplication.Launch(EventArgs args) in /home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/src/Platform/Gtk/MauiGtkApplication.cs:line 127 at Microsoft.Maui.MauiGtkApplication.Run(String[] args) in /home/ubuntu/geewallet-build/geewallet/dependencies/maui/src/Core/src/Platform/Gtk/MauiGtkApplication.cs:line 40 at GWallet.Frontend.Maui.Program.main(String[] _args) in /home/ubuntu/geewallet-build/geewallet/src/GWallet.Frontend.Maui/Platforms/Gtk/Program.fs:line 14 ``` By using Hide instead of Destroy.
Fix position of calendar pop-up when opened more than one time.
Avoid excessive firing of OnDateTimeChanged events when creating DatePickerWindow.
Update calendar properties SelectedDate, MinimumDate, MaximumDate when opening calendar popup when it is already created but hidden.
DatePicker window location was wrong when we didn't use x11 GdkBackend. This problem was fixed by setting the TransientFor property. Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
Replace deprecated methods. Used Entry icon instead of defining a new button for datepicker arrow. Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
Core(Gtk): implement date picker
Fix setting background color for Button. Following advice from https://stackoverflow.com/questions/1706550/gtk-modifying-background-color-of-gtkbutton#comment115871542_41850551
Fix setting of style in widgets in certain cases (when widget's CSS path contains spaces).
Core(Gtk): fix button colors.
Add mappers for BorderColor and CornerRadius for Frame elements so they can now have borders.
Fix fill in solid shapes like Ellipse or Rectangle.
Path elements are now being drawn.
Previously, Image class didn't work in maui code and after setting the image nothing would appear.
When visibility for image or label (or other views) was set to false, they stayed visible in the application.
Ported Launcher code from DotNetEssentials.
Implement tap/click gestures for Gtk. Note that due to the way Gtk works only certain widgets can respond to click events. I changed ContentView to inherit from EventBox, so many elements have this capability, including all layouts. Still many widgets such as label for which adding tap gesture recognizer will have no effect. See https://discourse.gnome.org/t/gtk-widget-mouse-down-event-does-not-seem-to-work/1699.
Implement WidthRequest and HeightRequest mappings for Image.
Fix image problems for GTK.
Because of new versions of manifest, we got the following error. So by skipping manifest update we make sure that we don't get unwanted updates. ``` Workload installation failed: Failed to install manifest gtksharp.net.sdk.gtk version 3.24.24-rev.87-develop: gtksharp.net.sdk.gtk.manifest-6.0.300::3.24.24-rev.87-develop is not found in NuGet feeds https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-531f715f/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-3f6c45a2/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-3f6c45a2-1/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json;https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json;https://pkgs.dev.azure.com/xamarin/public/_packaging/SkiaSharp/nuget/v3/index.json;https://nuget.pkg.github.com/GtkSharp/index.json".. ```
I get the goal but not sure I agree with the way you are trying to achieve it. |
I agree with you that this is not ideal. Maybe we can consider this a workaround? I searched a lot and this was the best thing I could come up with. Do you have any other suggestions? |
Add a line in CI that builds this project. |
Ok sure, I'll give it a try. |
What error? You don't explain what this error is, is it a runtime error?, compile time error?, how did you get it? I mean, what did you do to get it? how often do you get it (if not 100% of the time), etc |
9eea9dd
to
d69270f
Compare
I improved the commit message and I believe it should be complete now. I also tested the latest state and it's all ok now. |
d69270f
to
d96b805
Compare
Build Controls.SourceGen.csproj before building Microsoft.Maui.Gtk.slnf. We have to do this since sometimes when building the Sample.Gtk project, the error below is shown. It's a random error that happens when building the Microsoft.Maui.Gtk.slnf but it doesn't happen in each build attempt. ``` CSC : error CS0006: Metadata file '/home/runner/work/maui/maui/.nuspec/Microsoft.Maui.Controls.SourceGen.dll' could not be found [/home/runner/work/maui/maui/src/Controls/samples/Controls.Sample.Gtk/Controls.Sample.Gtk.csproj] 0 Warning(s) 1 Error(s) ```
d96b805
to
5a5c95c
Compare
Build Controls.SourceGen.csproj before building Microsoft.Maui.Gtk.slnf. We have to do this since sometimes when building the Sample.Gtk project, the error below is shown. It's a random error that happens when building the Microsoft.Maui.Gtk.slnf but it doesn't happen in each build attempt.