Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions shell/platform/linux/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ InheritParentConfig: true
# EnumCastOutOfRange warns about some common usages of GTK macros
Checks: >-
-clang-analyzer-optin.core.EnumCastOutOfRange

CheckOptions:
- key: readability-identifier-naming.EnumConstantCase
value: "UPPER_CASE"
- key: readability-identifier-naming.EnumConstantPrefix
value: ""
10 changes: 5 additions & 5 deletions shell/platform/linux/fl_accessible_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct FlAccessibleNodePrivate {
FlutterSemanticsFlag flags;
};

enum { kProp0, kPropEngine, kPropId, kPropLast };
enum { PROP_0, PROP_ENGINE, PROP_ID, PROP_LAST };

#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node) \
((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
Expand Down Expand Up @@ -145,13 +145,13 @@ static void fl_accessible_node_set_property(GObject* object,
GParamSpec* pspec) {
FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(object);
switch (prop_id) {
case kPropEngine:
case PROP_ENGINE:
g_assert(priv->engine == nullptr);
priv->engine = FL_ENGINE(g_value_get_object(value));
g_object_add_weak_pointer(object,
reinterpret_cast<gpointer*>(&priv->engine));
break;
case kPropId:
case PROP_ID:
priv->id = g_value_get_int(value);
break;
default:
Expand Down Expand Up @@ -448,13 +448,13 @@ static void fl_accessible_node_class_init(FlAccessibleNodeClass* klass) {
fl_accessible_node_perform_action_impl;

g_object_class_install_property(
G_OBJECT_CLASS(klass), kPropEngine,
G_OBJECT_CLASS(klass), PROP_ENGINE,
g_param_spec_object(
"engine", "engine", "Flutter engine", fl_engine_get_type(),
static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)));
g_object_class_install_property(
G_OBJECT_CLASS(klass), kPropId,
G_OBJECT_CLASS(klass), PROP_ID,
g_param_spec_int(
"id", "id", "Accessibility node ID", 0, G_MAXINT, 0,
static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
Expand Down
12 changes: 6 additions & 6 deletions shell/platform/linux/fl_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ struct FlApplicationPrivate {
((FlApplicationPrivate*)fl_application_get_instance_private( \
FL_APPLICATION(app)))

enum { kSignalRegisterPlugins, kSignalCreateWindow, kSignalLastSignal };
enum { SIGNAL_REGISTER_PLUGINS, SIGNAL_CREATE_WINDOW, LAST_SIGNAL };

static guint fl_application_signals[kSignalLastSignal];
static guint fl_application_signals[LAST_SIGNAL];

G_DEFINE_TYPE_WITH_CODE(FlApplication,
fl_application,
Expand Down Expand Up @@ -95,14 +95,14 @@ static void fl_application_activate(GApplication* application) {
gtk_widget_show(GTK_WIDGET(view));

GtkWindow* window;
g_signal_emit(self, fl_application_signals[kSignalCreateWindow], 0, view,
g_signal_emit(self, fl_application_signals[SIGNAL_CREATE_WINDOW], 0, view,
&window);

// Make the resources for the view so rendering can start.
// We'll show the view when we have the first frame.
gtk_widget_realize(GTK_WIDGET(view));

g_signal_emit(self, fl_application_signals[kSignalRegisterPlugins], 0,
g_signal_emit(self, fl_application_signals[SIGNAL_REGISTER_PLUGINS], 0,
FL_PLUGIN_REGISTRY(view));
}

Expand Down Expand Up @@ -150,11 +150,11 @@ static void fl_application_class_init(FlApplicationClass* klass) {
klass->register_plugins = fl_application_register_plugins;
klass->create_window = fl_application_create_window;

fl_application_signals[kSignalRegisterPlugins] = g_signal_new(
fl_application_signals[SIGNAL_REGISTER_PLUGINS] = g_signal_new(
"register-plugins", fl_application_get_type(), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(FlApplicationClass, register_plugins), nullptr, nullptr,
nullptr, G_TYPE_NONE, 1, fl_plugin_registry_get_type());
fl_application_signals[kSignalCreateWindow] = g_signal_new(
fl_application_signals[SIGNAL_CREATE_WINDOW] = g_signal_new(
"create-window", fl_application_get_type(), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(FlApplicationClass, create_window),
g_signal_accumulator_first_wins, nullptr, nullptr, GTK_TYPE_WINDOW, 1,
Expand Down
14 changes: 7 additions & 7 deletions shell/platform/linux/fl_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ G_DEFINE_QUARK(fl_engine_error_quark, fl_engine_error)
static void fl_engine_plugin_registry_iface_init(
FlPluginRegistryInterface* iface);

enum { kSignalOnPreEngineRestart, kSignalLastSignal };
enum { SIGNAL_ON_PRE_ENGINE_RESTART, LAST_SIGNAL };

static guint fl_engine_signals[kSignalLastSignal];
static guint fl_engine_signals[LAST_SIGNAL];

G_DEFINE_TYPE_WITH_CODE(
FlEngine,
Expand All @@ -103,7 +103,7 @@ G_DEFINE_TYPE_WITH_CODE(
G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(),
fl_engine_plugin_registry_iface_init))

enum { kProp0, kPropBinaryMessenger, kPropLast };
enum { PROP_0, PROP_BINARY_MESSENGER, PROP_LAST };

// Parse a locale into its components.
static void parse_locale(const gchar* locale,
Expand Down Expand Up @@ -386,7 +386,7 @@ static void fl_engine_update_semantics_cb(const FlutterSemanticsUpdate2* update,
static void fl_engine_on_pre_engine_restart_cb(void* user_data) {
FlEngine* self = FL_ENGINE(user_data);

g_signal_emit(self, fl_engine_signals[kSignalOnPreEngineRestart], 0);
g_signal_emit(self, fl_engine_signals[SIGNAL_ON_PRE_ENGINE_RESTART], 0);
}

// Called when a response to a sent platform message is received from the
Expand Down Expand Up @@ -420,7 +420,7 @@ static void fl_engine_set_property(GObject* object,
GParamSpec* pspec) {
FlEngine* self = FL_ENGINE(object);
switch (prop_id) {
case kPropBinaryMessenger:
case PROP_BINARY_MESSENGER:
g_set_object(&self->binary_messenger,
FL_BINARY_MESSENGER(g_value_get_object(value)));
break;
Expand Down Expand Up @@ -477,14 +477,14 @@ static void fl_engine_class_init(FlEngineClass* klass) {
G_OBJECT_CLASS(klass)->set_property = fl_engine_set_property;

g_object_class_install_property(
G_OBJECT_CLASS(klass), kPropBinaryMessenger,
G_OBJECT_CLASS(klass), PROP_BINARY_MESSENGER,
g_param_spec_object(
"binary-messenger", "messenger", "Binary messenger",
fl_binary_messenger_get_type(),
static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)));

fl_engine_signals[kSignalOnPreEngineRestart] = g_signal_new(
fl_engine_signals[SIGNAL_ON_PRE_ENGINE_RESTART] = g_signal_new(
"on-pre-engine-restart", fl_engine_get_type(), G_SIGNAL_RUN_LAST, 0,
nullptr, nullptr, nullptr, G_TYPE_NONE, 0);
}
Expand Down
2 changes: 0 additions & 2 deletions shell/platform/linux/fl_engine_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ G_BEGIN_DECLS
*/

typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_ENGINE_ERROR_FAILED,
// NOLINTEND(readability-identifier-naming)
} FlEngineError;

GQuark fl_engine_error_quark(void) G_GNUC_CONST;
Expand Down
6 changes: 3 additions & 3 deletions shell/platform/linux/fl_gnome_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct _FlGnomeSettings {
GSettings* interface_settings;
};

enum { kProp0, kPropInterfaceSettings, kPropLast };
enum { PROP_0, PROP_INTERFACE_SETTINGS, PROP_LAST };

static void fl_gnome_settings_iface_init(FlSettingsInterface* iface);

Expand Down Expand Up @@ -106,7 +106,7 @@ static void fl_gnome_settings_set_property(GObject* object,
GParamSpec* pspec) {
FlGnomeSettings* self = FL_GNOME_SETTINGS(object);
switch (prop_id) {
case kPropInterfaceSettings:
case PROP_INTERFACE_SETTINGS:
fl_gnome_settings_set_interface_settings(
self, G_SETTINGS(g_value_get_object(value)));
break;
Expand All @@ -130,7 +130,7 @@ static void fl_gnome_settings_class_init(FlGnomeSettingsClass* klass) {
object_class->set_property = fl_gnome_settings_set_property;

g_object_class_install_property(
object_class, kPropInterfaceSettings,
object_class, PROP_INTERFACE_SETTINGS,
g_param_spec_object(
kInterfaceSettings, kInterfaceSettings, kDesktopInterfaceSchema,
g_settings_get_type(),
Expand Down
9 changes: 5 additions & 4 deletions shell/platform/linux/fl_mouse_cursor_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ struct _FlMouseCursorHandler {
gchar* cursor_name;
};

enum { kSignalCursorChanged, kSignalLastSignal };
enum { SIGNAL_CURSOR_CHANGED, LAST_SIGNAL };

static guint fl_mouse_cursor_handler_signals[kSignalLastSignal];
static guint fl_mouse_cursor_handler_signals[LAST_SIGNAL];

G_DEFINE_TYPE(FlMouseCursorHandler, fl_mouse_cursor_handler, G_TYPE_OBJECT)

Expand Down Expand Up @@ -100,7 +100,8 @@ static void activate_system_cursor(const gchar* kind, gpointer user_data) {
g_free(self->cursor_name);
self->cursor_name = g_strdup(cursor_name);

g_signal_emit(self, fl_mouse_cursor_handler_signals[kSignalCursorChanged], 0);
g_signal_emit(self, fl_mouse_cursor_handler_signals[SIGNAL_CURSOR_CHANGED],
0);
}

static void fl_mouse_cursor_handler_dispose(GObject* object) {
Expand All @@ -117,7 +118,7 @@ static void fl_mouse_cursor_handler_class_init(
FlMouseCursorHandlerClass* klass) {
G_OBJECT_CLASS(klass)->dispose = fl_mouse_cursor_handler_dispose;

fl_mouse_cursor_handler_signals[kSignalCursorChanged] =
fl_mouse_cursor_handler_signals[SIGNAL_CURSOR_CHANGED] =
g_signal_new("cursor-changed", fl_mouse_cursor_handler_get_type(),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
}
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/linux/fl_platform_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@
G_BEGIN_DECLS

typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_PLATFORM_CHANNEL_EXIT_TYPE_CANCELABLE,
FL_PLATFORM_CHANNEL_EXIT_TYPE_REQUIRED,
// NOLINTEND(readability-identifier-naming)
} FlPlatformChannelExitType;

typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_PLATFORM_CHANNEL_EXIT_RESPONSE_CANCEL,
FL_PLATFORM_CHANNEL_EXIT_RESPONSE_EXIT,
// NOLINTEND(readability-identifier-naming)
} FlPlatformChannelExitResponse;

G_DECLARE_FINAL_TYPE(FlPlatformChannel,
Expand Down
2 changes: 0 additions & 2 deletions shell/platform/linux/fl_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ G_BEGIN_DECLS
*/

typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_RENDERER_ERROR_FAILED,
// NOLINTEND(readability-identifier-naming)
} FlRendererError;

GQuark fl_renderer_error_quark(void) G_GNUC_CONST;
Expand Down
10 changes: 5 additions & 5 deletions shell/platform/linux/fl_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
G_DEFINE_INTERFACE(FlSettings, fl_settings, G_TYPE_OBJECT)

enum {
kSignalChanged,
kSignalLastSignal,
SIGNAL_CHANGED,
LAST_SIGNAL,
};

static guint signals[kSignalLastSignal];
static guint signals[LAST_SIGNAL];

static void fl_settings_default_init(FlSettingsInterface* iface) {
/**
Expand All @@ -22,7 +22,7 @@ static void fl_settings_default_init(FlSettingsInterface* iface) {
*
* This signal is emitted after the settings have been changed.
*/
signals[kSignalChanged] =
signals[SIGNAL_CHANGED] =
g_signal_new("changed", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, G_TYPE_NONE, 0);
}
Expand All @@ -49,7 +49,7 @@ gdouble fl_settings_get_text_scaling_factor(FlSettings* self) {

void fl_settings_emit_changed(FlSettings* self) {
g_return_if_fail(FL_IS_SETTINGS(self));
g_signal_emit(self, signals[kSignalChanged], 0);
g_signal_emit(self, signals[SIGNAL_CHANGED], 0);
}

FlSettings* fl_settings_new() {
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/linux/fl_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ G_DECLARE_INTERFACE(FlSettings, fl_settings, FL, SETTINGS, GObject)
* Available clock formats.
*/
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_CLOCK_FORMAT_12H,
FL_CLOCK_FORMAT_24H,
// NOLINTEND(readability-identifier-naming)
} FlClockFormat;

/**
Expand All @@ -33,10 +31,8 @@ typedef enum {
* Available color schemes.
*/
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_COLOR_SCHEME_LIGHT,
FL_COLOR_SCHEME_DARK,
// NOLINTEND(readability-identifier-naming)
} FlColorScheme;

/**
Expand Down
2 changes: 0 additions & 2 deletions shell/platform/linux/fl_settings_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
G_BEGIN_DECLS

typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT,
FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK
// NOLINTEND(readability-identifier-naming)
} FlSettingsChannelPlatformBrightness;

G_DECLARE_FINAL_TYPE(FlSettingsChannel,
Expand Down
8 changes: 4 additions & 4 deletions shell/platform/linux/fl_standard_method_codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct _FlStandardMethodCodec {
FlStandardMessageCodec* message_codec;
};

enum { kPropMessageCodec = 1, kPropLast };
enum { PROP_MESSAGE_CODEC = 1, PROP_LAST };

G_DEFINE_TYPE(FlStandardMethodCodec,
fl_standard_method_codec,
Expand All @@ -34,7 +34,7 @@ static void fl_standard_method_codec_set_property(GObject* object,
FlStandardMethodCodec* self = FL_STANDARD_METHOD_CODEC(object);

switch (prop_id) {
case kPropMessageCodec:
case PROP_MESSAGE_CODEC:
g_set_object(&self->message_codec,
FL_STANDARD_MESSAGE_CODEC(g_value_get_object(value)));
break;
Expand All @@ -51,7 +51,7 @@ static void fl_standard_method_codec_get_property(GObject* object,
FlStandardMethodCodec* self = FL_STANDARD_METHOD_CODEC(object);

switch (prop_id) {
case kPropMessageCodec:
case PROP_MESSAGE_CODEC:
g_value_set_object(value, self->message_codec);
break;
default:
Expand Down Expand Up @@ -278,7 +278,7 @@ static void fl_standard_method_codec_class_init(
fl_standard_method_codec_decode_response;

g_object_class_install_property(
G_OBJECT_CLASS(klass), kPropMessageCodec,
G_OBJECT_CLASS(klass), PROP_MESSAGE_CODEC,
g_param_spec_object(
"message-codec", "message-codec", "Message codec to use",
fl_message_codec_get_type(),
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/linux/fl_text_input_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@
G_BEGIN_DECLS

typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_TEXT_INPUT_TYPE_TEXT,
// Send newline when multi-line and enter is pressed.
FL_TEXT_INPUT_TYPE_MULTILINE,
// The input method is not shown at all.
FL_TEXT_INPUT_TYPE_NONE,
// NOLINTEND(readability-identifier-naming)
} FlTextInputType;

typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
FL_TEXT_AFFINITY_UPSTREAM,
FL_TEXT_AFFINITY_DOWNSTREAM,
// NOLINTEND(readability-identifier-naming)
} FlTextAffinity;

G_DECLARE_FINAL_TYPE(FlTextInputChannel,
Expand Down
8 changes: 4 additions & 4 deletions shell/platform/linux/fl_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ struct _FlView {
GCancellable* cancellable;
};

enum { kSignalFirstFrame, kSignalLastSignal };
enum { SIGNAL_FIRST_FRAME, LAST_SIGNAL };

static guint fl_view_signals[kSignalLastSignal];
static guint fl_view_signals[LAST_SIGNAL];

static void fl_renderable_iface_init(FlRenderableInterface* iface);

Expand Down Expand Up @@ -108,7 +108,7 @@ G_DEFINE_TYPE_WITH_CODE(
static gboolean first_frame_idle_cb(gpointer user_data) {
FlView* self = FL_VIEW(user_data);

g_signal_emit(self, fl_view_signals[kSignalFirstFrame], 0);
g_signal_emit(self, fl_view_signals[SIGNAL_FIRST_FRAME], 0);

return FALSE;
}
Expand Down Expand Up @@ -665,7 +665,7 @@ static void fl_view_class_init(FlViewClass* klass) {
widget_class->key_press_event = fl_view_key_press_event;
widget_class->key_release_event = fl_view_key_release_event;

fl_view_signals[kSignalFirstFrame] =
fl_view_signals[SIGNAL_FIRST_FRAME] =
g_signal_new("first-frame", fl_view_get_type(), G_SIGNAL_RUN_LAST, 0,
NULL, NULL, NULL, G_TYPE_NONE, 0);

Expand Down
Loading