#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"
#include "flutter/shell/platform/linux/fl_view_private.h"
#include <atk/atk.h>
#include <gtk/gtk-a11y.h>
#include <cstring>
#include "flutter/common/constants.h"
#include "flutter/shell/platform/linux/fl_accessible_node.h"
#include "flutter/shell/platform/linux/fl_engine_private.h"
#include "flutter/shell/platform/linux/fl_framebuffer.h"
#include "flutter/shell/platform/linux/fl_key_event.h"
#include "flutter/shell/platform/linux/fl_keyboard_handler.h"
#include "flutter/shell/platform/linux/fl_keyboard_view_delegate.h"
#include "flutter/shell/platform/linux/fl_mouse_cursor_handler.h"
#include "flutter/shell/platform/linux/fl_platform_handler.h"
#include "flutter/shell/platform/linux/fl_plugin_registrar_private.h"
#include "flutter/shell/platform/linux/fl_renderer_gdk.h"
#include "flutter/shell/platform/linux/fl_scrolling_manager.h"
#include "flutter/shell/platform/linux/fl_scrolling_view_delegate.h"
#include "flutter/shell/platform/linux/fl_socket_accessible.h"
#include "flutter/shell/platform/linux/fl_text_input_handler.h"
#include "flutter/shell/platform/linux/fl_text_input_view_delegate.h"
#include "flutter/shell/platform/linux/fl_view_accessible.h"
#include "flutter/shell/platform/linux/fl_window_state_monitor.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registry.h"
Go to the source code of this file.
Classes | |
struct | _FlView |
Enumerations | |
enum | { kSignalFirstFrame, kSignalLastSignal } |
Functions | |
static void | fl_view_plugin_registry_iface_init (FlPluginRegistryInterface *iface) |
static void | fl_view_keyboard_delegate_iface_init (FlKeyboardViewDelegateInterface *iface) |
static void | fl_view_scrolling_delegate_iface_init (FlScrollingViewDelegateInterface *iface) |
static void | fl_view_text_input_delegate_iface_init (FlTextInputViewDelegateInterface *iface) |
G_DEFINE_TYPE_WITH_CODE (FlView, fl_view, GTK_TYPE_BOX, G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(), fl_view_plugin_registry_iface_init) G_IMPLEMENT_INTERFACE(fl_keyboard_view_delegate_get_type(), fl_view_keyboard_delegate_iface_init) G_IMPLEMENT_INTERFACE(fl_scrolling_view_delegate_get_type(), fl_view_scrolling_delegate_iface_init) G_IMPLEMENT_INTERFACE(fl_text_input_view_delegate_get_type(), fl_view_text_input_delegate_iface_init)) static gboolean first_frame_idle_cb(gpointer user_data) | |
static gboolean | window_delete_event_cb (FlView *self) |
static void | init_keyboard (FlView *self) |
static void | init_scrolling (FlView *self) |
static FlutterPointerDeviceKind | get_device_kind (GdkEvent *event) |
static gboolean | send_pointer_button_event (FlView *self, GdkEvent *event) |
static void | check_pointer_inside (FlView *self, GdkEvent *event) |
static void | handle_geometry_changed (FlView *self) |
static void | view_added_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
static void | update_semantics_cb (FlEngine *engine, const FlutterSemanticsUpdate2 *update, gpointer user_data) |
static void | on_pre_engine_restart_cb (FlView *self) |
static FlPluginRegistrar * | fl_view_get_registrar_for_plugin (FlPluginRegistry *registry, const gchar *name) |
static gboolean | button_press_event_cb (FlView *self, GdkEventButton *button_event) |
static gboolean | button_release_event_cb (FlView *self, GdkEventButton *button_event) |
static gboolean | scroll_event_cb (FlView *self, GdkEventScroll *event) |
static gboolean | motion_notify_event_cb (FlView *self, GdkEventMotion *motion_event) |
static gboolean | enter_notify_event_cb (FlView *self, GdkEventCrossing *crossing_event) |
static gboolean | leave_notify_event_cb (FlView *self, GdkEventCrossing *crossing_event) |
static void | keymap_keys_changed_cb (FlView *self) |
static void | gesture_rotation_begin_cb (FlView *self) |
static void | gesture_rotation_update_cb (FlView *self, gdouble rotation, gdouble delta) |
static void | gesture_rotation_end_cb (FlView *self) |
static void | gesture_zoom_begin_cb (FlView *self) |
static void | gesture_zoom_update_cb (FlView *self, gdouble scale) |
static void | gesture_zoom_end_cb (FlView *self) |
static GdkGLContext * | create_context_cb (FlView *self) |
static void | realize_cb (FlView *self) |
static gboolean | render_cb (FlView *self, GdkGLContext *context) |
static void | unrealize_cb (FlView *self) |
static void | size_allocate_cb (FlView *self) |
static void | fl_view_notify (GObject *object, GParamSpec *pspec) |
static void | fl_view_dispose (GObject *object) |
static void | fl_view_realize (GtkWidget *widget) |
static gboolean | fl_view_key_press_event (GtkWidget *widget, GdkEventKey *event) |
static gboolean | fl_view_key_release_event (GtkWidget *widget, GdkEventKey *event) |
static void | fl_view_class_init (FlViewClass *klass) |
static void | fl_view_init (FlView *self) |
G_MODULE_EXPORT FlView * | fl_view_new (FlDartProject *project) |
G_MODULE_EXPORT FlView * | fl_view_new_for_engine (FlEngine *engine) |
G_MODULE_EXPORT FlEngine * | fl_view_get_engine (FlView *self) |
G_MODULE_EXPORT int64_t | fl_view_get_id (FlView *self) |
G_MODULE_EXPORT void | fl_view_set_background_color (FlView *self, const GdkRGBA *color) |
void | fl_view_redraw (FlView *self) |
GHashTable * | fl_view_get_keyboard_state (FlView *self) |
Variables | |
static constexpr int | kMicrosecondsPerMillisecond = 1000 |
static guint | fl_view_signals [kSignalLastSignal] |
anonymous enum |
|
static |
Definition at line 428 of file fl_view.cc.
References check_pointer_inside(), event, and send_pointer_button_event().
Referenced by fl_view_init().
|
static |
Definition at line 445 of file fl_view.cc.
References event, and send_pointer_button_event().
Referenced by fl_view_init().
|
static |
Definition at line 242 of file fl_view.cc.
References event, fl_engine_send_mouse_pointer_event(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.
Referenced by button_press_event_cb(), enter_notify_event_cb(), and motion_notify_event_cb().
|
static |
Definition at line 574 of file fl_view.cc.
References error, fl_engine_get_binary_messenger(), fl_mouse_cursor_handler_new(), fl_platform_handler_new(), fl_renderer_gdk_create_contexts(), fl_renderer_gdk_get_context(), fl_renderer_gdk_set_window(), init_scrolling(), and keymap_keys_changed_cb().
Referenced by fl_view_new().
|
static |
Definition at line 493 of file fl_view.cc.
References check_pointer_inside(), event, and TRUE.
Referenced by fl_view_init().
|
static |
Definition at line 753 of file fl_view.cc.
References fl_view_dispose(), fl_view_key_press_event(), fl_view_key_release_event(), fl_view_notify(), fl_view_realize(), fl_view_signals, and kSignalFirstFrame.
|
static |
Definition at line 684 of file fl_view.cc.
References fl_engine_remove_view(), fl_engine_set_update_semantics_handler(), and fl_renderer_remove_view().
Referenced by fl_view_class_init().
G_MODULE_EXPORT FlEngine* fl_view_get_engine | ( | FlView * | view | ) |
fl_view_get_engine: @view: an #FlView.
Gets the engine being rendered in the view.
Returns: an #FlEngine.
Definition at line 874 of file fl_view.cc.
Referenced by TEST().
G_MODULE_EXPORT int64_t fl_view_get_id | ( | FlView * | view | ) |
fl_view_get_id: @view: an #FlView.
Gets the Flutter view ID used by this view.
Returns: a view ID or -1 if now ID assigned.
Definition at line 880 of file fl_view.cc.
Referenced by TEST().
GHashTable* fl_view_get_keyboard_state | ( | FlView * | view | ) |
fl_view_get_keyboard_state: @view: an #FlView.
Returns the keyboard pressed state. The hash table contains one entry per pressed keys, mapping from the logical key to the physical key.*
Definition at line 905 of file fl_view.cc.
References fl_keyboard_handler_get_pressed_state().
Referenced by fl_view_keyboard_delegate_iface_init().
|
static |
Definition at line 321 of file fl_view.cc.
References fl_engine_get_binary_messenger(), fl_engine_get_texture_registrar(), and fl_plugin_registrar_new().
Referenced by fl_view_plugin_registry_iface_init().
|
static |
Definition at line 771 of file fl_view.cc.
References button_press_event_cb(), button_release_event_cb(), enter_notify_event_cb(), gesture_rotation_begin_cb(), gesture_rotation_end_cb(), gesture_rotation_update_cb(), gesture_zoom_begin_cb(), gesture_zoom_end_cb(), gesture_zoom_update_cb(), leave_notify_event_cb(), motion_notify_event_cb(), render_cb(), scroll_event_cb(), size_allocate_cb(), and TRUE.
|
static |
Definition at line 736 of file fl_view.cc.
References event, fl_key_event_new_from_gdk_event(), and fl_keyboard_handler_handle_event().
Referenced by fl_view_class_init().
|
static |
Definition at line 745 of file fl_view.cc.
References event, fl_key_event_new_from_gdk_event(), and fl_keyboard_handler_handle_event().
Referenced by fl_view_class_init().
|
static |
Definition at line 336 of file fl_view.cc.
References callback, event, fl_engine_get_binary_messenger(), fl_engine_send_key_event(), fl_key_event_get_origin(), fl_text_input_handler_filter_keypress(), fl_view_get_keyboard_state(), and user_data.
G_MODULE_EXPORT FlView* fl_view_new | ( | FlDartProject * | project | ) |
FlView:
#FlView is a GTK widget that is capable of displaying a Flutter application.
The following example shows how to set up a view in a GTK application: |[ FlDartProject *project = fl_dart_project_new (); FlView *view = fl_view_new (project); gtk_widget_show (GTK_WIDGET (view)); gtk_container_add (GTK_CONTAINER (parent), view);
FlBinaryMessenger *messenger = fl_engine_get_binary_messenger (fl_view_get_engine (view)); setup_channels_or_plugins (messenger); ]| fl_view_new: @project: The project to show.
Creates a widget to show a Flutter application.
Returns: a new #FlView.
Definition at line 829 of file fl_view.cc.
References create_context_cb(), fl_engine_get_renderer(), fl_engine_new(), fl_engine_set_update_semantics_handler(), on_pre_engine_restart_cb(), realize_cb(), unrealize_cb(), and update_semantics_cb().
Referenced by fl_application_activate(), and TEST().
G_MODULE_EXPORT FlView* fl_view_new_for_engine | ( | FlEngine * | engine | ) |
fl_view_new_for_engine: @engine: an #FlEngine.
Creates a widget to show a window in a Flutter application. The engine must be not be headless.
Returns: a new #FlView.
Definition at line 855 of file fl_view.cc.
References fl_engine_add_view(), fl_engine_get_renderer(), fl_renderer_add_view(), on_pre_engine_restart_cb(), and view_added_cb().
Referenced by TEST().
|
static |
Definition at line 672 of file fl_view.cc.
References handle_geometry_changed(), and pspec.
Referenced by fl_view_class_init().
|
static |
Definition at line 331 of file fl_view.cc.
References fl_view_get_registrar_for_plugin().
|
static |
void fl_view_redraw | ( | FlView * | view | ) |
fl_view_redraw: @view: an #FlView.
Indicate the view needs to redraw.
Definition at line 892 of file fl_view.cc.
References TRUE.
Referenced by fl_renderer_present_layers(), and TEST().
|
static |
Definition at line 388 of file fl_view.cc.
References fl_engine_send_mouse_pointer_event(), and fl_engine_send_pointer_pan_zoom_event().
G_MODULE_EXPORT void fl_view_set_background_color | ( | FlView * | view, |
const GdkRGBA * | color | ||
) |
fl_view_set_background_color: @view: an #FlView. @color: a background color.
Set the background color for Flutter (defaults to black).
Definition at line 885 of file fl_view.cc.
|
static |
Definition at line 415 of file fl_view.cc.
G_DEFINE_TYPE_WITH_CODE | ( | FlView | , |
fl_view | , | ||
GTK_TYPE_BOX | , | ||
G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(), fl_view_plugin_registry_iface_init) G_IMPLEMENT_INTERFACE(fl_keyboard_view_delegate_get_type(), fl_view_keyboard_delegate_iface_init) G_IMPLEMENT_INTERFACE(fl_scrolling_view_delegate_get_type(), fl_view_scrolling_delegate_iface_init) G_IMPLEMENT_INTERFACE(fl_text_input_view_delegate_get_type(), fl_view_text_input_delegate_iface_init) | |||
) |
Definition at line 106 of file fl_view.cc.
References fl_view_signals, kSignalFirstFrame, and user_data.
|
static |
Definition at line 547 of file fl_view.cc.
References fl_scrolling_manager_handle_rotation_begin().
Referenced by fl_view_init().
|
static |
Definition at line 558 of file fl_view.cc.
References fl_scrolling_manager_handle_rotation_end().
Referenced by fl_view_init().
|
static |
Definition at line 551 of file fl_view.cc.
References fl_scrolling_manager_handle_rotation_update().
Referenced by fl_view_init().
|
static |
Definition at line 562 of file fl_view.cc.
References fl_scrolling_manager_handle_zoom_begin().
Referenced by fl_view_init().
|
static |
Definition at line 570 of file fl_view.cc.
References fl_scrolling_manager_handle_zoom_end().
Referenced by fl_view_init().
|
static |
Definition at line 566 of file fl_view.cc.
References fl_scrolling_manager_handle_zoom_update().
Referenced by fl_view_init().
|
static |
Definition at line 159 of file fl_view.cc.
References event.
Referenced by check_pointer_inside(), leave_notify_event_cb(), motion_notify_event_cb(), and send_pointer_button_event().
|
static |
Definition at line 260 of file fl_view.cc.
References fl_engine_send_window_metrics_event(), and fl_renderer_wait_for_frame().
Referenced by fl_view_notify(), realize_cb(), size_allocate_cb(), and view_added_cb().
|
static |
Definition at line 136 of file fl_view.cc.
References fl_engine_get_binary_messenger(), fl_keyboard_handler_new(), and fl_text_input_handler_new().
Referenced by on_pre_engine_restart_cb(), and realize_cb().
|
static |
Definition at line 153 of file fl_view.cc.
References fl_scrolling_manager_new().
Referenced by create_context_cb(), and on_pre_engine_restart_cb().
|
static |
|
static |
Definition at line 507 of file fl_view.cc.
References event, fl_engine_send_mouse_pointer_event(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.
Referenced by fl_view_init().
|
static |
Definition at line 463 of file fl_view.cc.
References check_pointer_inside(), event, fl_engine_send_mouse_pointer_event(), fl_keyboard_handler_sync_modifier_if_needed(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.
Referenced by fl_view_init().
|
static |
Definition at line 315 of file fl_view.cc.
References init_keyboard(), and init_scrolling().
Referenced by fl_view_new(), and fl_view_new_for_engine().
|
static |
Definition at line 599 of file fl_view.cc.
References error, fl_engine_get_binary_messenger(), fl_engine_start(), fl_renderer_add_view(), fl_renderer_make_current(), fl_renderer_setup(), fl_socket_accessible_embed(), fl_view_accessible_new(), fl_window_state_monitor_new(), handle_geometry_changed(), init_keyboard(), and window_delete_event_cb().
Referenced by fl_view_new().
|
static |
Definition at line 639 of file fl_view.cc.
References fl_renderer_render(), height, TRUE, and width.
Referenced by fl_view_init().
|
static |
Definition at line 452 of file fl_view.cc.
References event, fl_scrolling_manager_handle_scroll_event(), and TRUE.
Referenced by fl_view_init().
|
static |
Definition at line 179 of file fl_view.cc.
References event, fl_engine_send_mouse_pointer_event(), fl_keyboard_handler_sync_modifier_if_needed(), fl_scrolling_manager_set_last_mouse_position(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.
Referenced by button_press_event_cb(), and button_release_event_cb().
|
static |
Definition at line 668 of file fl_view.cc.
References handle_geometry_changed().
Referenced by fl_view_init().
|
static |
Definition at line 654 of file fl_view.cc.
References error, fl_renderer_cleanup(), and fl_renderer_make_current().
Referenced by fl_view_new().
|
static |
Definition at line 302 of file fl_view.cc.
References fl_view_accessible_handle_update_semantics(), and user_data.
Referenced by fl_view_new().
|
static |
Definition at line 282 of file fl_view.cc.
References error, fl_engine_add_view_finish(), handle_geometry_changed(), result, and user_data.
Referenced by fl_view_new_for_engine().
|
static |
Definition at line 129 of file fl_view.cc.
References fl_platform_handler_request_app_exit(), and TRUE.
Referenced by realize_cb().
|
static |
Definition at line 92 of file fl_view.cc.
Referenced by fl_view_class_init(), and G_DEFINE_TYPE_WITH_CODE().
|
staticconstexpr |
Definition at line 35 of file fl_view.cc.
Referenced by check_pointer_inside(), leave_notify_event_cb(), motion_notify_event_cb(), and send_pointer_button_event().