This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add a Linux Shell that uses GTK for rendering. #16977
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Copyright 2013 The Flutter Authors. All rights reserved. | ||
| # Use of this source code is governed by a BSD-style license that can be | ||
| # found in the LICENSE file. | ||
|
|
||
| declare_args() { | ||
| # Whether to build the Linux (GTK) shell for the host platform, if available. | ||
| # | ||
| # The Linux shell is not currently built by default as the CI system doesn't | ||
| # (yet) have GTK as a dependency. When that is ready the flag will be removed. | ||
| build_linux_shell = false | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "flutter/shell/platform/linux/public/flutter_linux/fl_dart_project.h" | ||
|
|
||
| #include <gmodule.h> | ||
|
|
||
| /** | ||
| * FlDartProject: | ||
| * | ||
| * #FlDartProject represents a Dart project. It is used provide information | ||
| * about the application when creating a #FlView. | ||
| */ | ||
|
|
||
| struct _FlDartProject { | ||
| GObject parent_instance; | ||
|
|
||
| gchar* assets_path; | ||
| gchar* icu_data_path; | ||
| }; | ||
|
|
||
| enum { PROP_ASSETS_PATH = 1, PROP_ICU_DATA_PATH, PROP_LAST }; | ||
|
|
||
| G_DEFINE_TYPE(FlDartProject, fl_dart_project, G_TYPE_OBJECT) | ||
|
|
||
| static void fl_dart_project_set_property(GObject* object, | ||
| guint prop_id, | ||
| const GValue* value, | ||
| GParamSpec* pspec) { | ||
| FlDartProject* self = FL_DART_PROJECT(object); | ||
|
|
||
| switch (prop_id) { | ||
| case PROP_ASSETS_PATH: | ||
| g_free(self->assets_path); | ||
| self->assets_path = g_strdup(g_value_get_string(value)); | ||
| break; | ||
| case PROP_ICU_DATA_PATH: | ||
| g_free(self->icu_data_path); | ||
| self->icu_data_path = g_strdup(g_value_get_string(value)); | ||
| break; | ||
| default: | ||
| G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| static void fl_dart_project_get_property(GObject* object, | ||
| guint prop_id, | ||
| GValue* value, | ||
| GParamSpec* pspec) { | ||
| FlDartProject* self = FL_DART_PROJECT(object); | ||
|
|
||
| switch (prop_id) { | ||
| case PROP_ASSETS_PATH: | ||
| g_value_set_string(value, self->assets_path); | ||
| break; | ||
| case PROP_ICU_DATA_PATH: | ||
| g_value_set_string(value, self->icu_data_path); | ||
| break; | ||
| default: | ||
| G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| static void fl_dart_project_dispose(GObject* object) { | ||
| FlDartProject* self = FL_DART_PROJECT(object); | ||
|
|
||
| g_clear_pointer(&self->assets_path, g_free); | ||
| g_clear_pointer(&self->icu_data_path, g_free); | ||
|
|
||
| G_OBJECT_CLASS(fl_dart_project_parent_class)->dispose(object); | ||
| } | ||
|
|
||
| static void fl_dart_project_class_init(FlDartProjectClass* klass) { | ||
| G_OBJECT_CLASS(klass)->set_property = fl_dart_project_set_property; | ||
| G_OBJECT_CLASS(klass)->get_property = fl_dart_project_get_property; | ||
| G_OBJECT_CLASS(klass)->dispose = fl_dart_project_dispose; | ||
|
|
||
| g_object_class_install_property( | ||
| G_OBJECT_CLASS(klass), PROP_ASSETS_PATH, | ||
| g_param_spec_string( | ||
| "assets-path", "assets-path", "Path to Flutter assets", nullptr, | ||
| static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | ||
| G_PARAM_STATIC_STRINGS))); | ||
| g_object_class_install_property( | ||
| G_OBJECT_CLASS(klass), PROP_ICU_DATA_PATH, | ||
| g_param_spec_string( | ||
| "icu-data-path", "icu-data-path", "Path to ICU data", nullptr, | ||
| static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | ||
| G_PARAM_STATIC_STRINGS))); | ||
| } | ||
|
|
||
| static void fl_dart_project_init(FlDartProject* self) {} | ||
|
|
||
| /** | ||
| * fl_dart_project_new: | ||
| * @assets_path: a file path, e.g. "build/assets" | ||
| * @icu_data_path: a file path, e.g. "build/icudtl.dat" | ||
| * | ||
| * Create a Flutter project. | ||
| * | ||
| * Returns: a new #FlDartProject | ||
| */ | ||
| G_MODULE_EXPORT FlDartProject* fl_dart_project_new(const gchar* assets_path, | ||
| const gchar* icu_data_path) { | ||
| return static_cast<FlDartProject*>( | ||
| g_object_new(fl_dart_project_get_type(), "assets-path", assets_path, | ||
| "icu-data-path", icu_data_path, nullptr)); | ||
| } | ||
|
|
||
| /** | ||
| * fl_dart_project_get_assets_path: | ||
| * @view: a #FlDartProject | ||
| * | ||
| * Get the path to the directory containing the assets used in the Flutter | ||
| * application. | ||
| * | ||
| * Returns: a file path, e.g. "build/assets" | ||
| */ | ||
| G_MODULE_EXPORT const gchar* fl_dart_project_get_assets_path( | ||
| FlDartProject* self) { | ||
| g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr); | ||
| return self->assets_path; | ||
| } | ||
|
|
||
| /** | ||
| * fl_dart_project_get_icu_data_path: | ||
| * @view: a #FlDartProject | ||
| * | ||
| * Get the path to the ICU data file in the Flutter application. | ||
| * | ||
| * Returns: a file path, e.g. "build/icudtl.dat" | ||
| */ | ||
| G_MODULE_EXPORT const gchar* fl_dart_project_get_icu_data_path( | ||
| FlDartProject* self) { | ||
| g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr); | ||
| return self->icu_data_path; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.