Flutter Engine
fl_view.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"
#include <gdk/gdkwayland.h>
#include <cstring>
#include "flutter/shell/platform/linux/fl_engine_private.h"
#include "flutter/shell/platform/linux/fl_key_event_plugin.h"
#include "flutter/shell/platform/linux/fl_mouse_cursor_plugin.h"
#include "flutter/shell/platform/linux/fl_platform_plugin.h"
#include "flutter/shell/platform/linux/fl_plugin_registrar_private.h"
#include "flutter/shell/platform/linux/fl_renderer_wayland.h"
#include "flutter/shell/platform/linux/fl_renderer_x11.h"
#include "flutter/shell/platform/linux/fl_text_input_plugin.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  {
  PROP_FLUTTER_PROJECT = 1,
  PROP_LAST
}
 

Functions

static void fl_view_plugin_registry_iface_init (FlPluginRegistryInterface *iface)
 
 G_DEFINE_TYPE_WITH_CODE (FlView, fl_view, GTK_TYPE_WIDGET, G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(), fl_view_plugin_registry_iface_init)) static gboolean fl_view_send_pointer_button_event(FlView *self
 
 switch (event->button)
 
 if (event->type==GDK_BUTTON_PRESS)
 
 if (self->engine==nullptr)
 
 fl_engine_send_mouse_pointer_event (self->engine, phase, event->time *kMicrosecondsPerMillisecond, event->x *scale_factor, event->y *scale_factor, 0, 0, self->button_state)
 
static void fl_view_geometry_changed (FlView *self)
 
static FlPluginRegistrar * fl_view_get_registrar_for_plugin (FlPluginRegistry *registry, const gchar *name)
 
static FlRenderer * fl_view_get_renderer_for_display (GdkDisplay *display)
 
static void fl_view_constructed (GObject *object)
 
static void fl_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 
static void fl_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 
static void fl_view_notify (GObject *object, GParamSpec *pspec)
 
static void fl_view_dispose (GObject *object)
 
static void fl_view_realize (GtkWidget *widget)
 
static void fl_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 
static gboolean fl_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
 
static gboolean fl_view_button_release_event (GtkWidget *widget, GdkEventButton *event)
 
static gboolean fl_view_scroll_event (GtkWidget *widget, GdkEventScroll *event)
 
static gboolean fl_view_motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
 
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 FlEngine * fl_view_get_engine (FlView *view)
 

Variables

static constexpr int kMicrosecondsPerMillisecond = 1000
 
GdkEventButton * event
 
int old_button_state = self->button_state
 
FlutterPointerPhase phase = kMove
 
gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self))
 
return TRUE
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROP_FLUTTER_PROJECT 
PROP_LAST 

Definition at line 48 of file fl_view.cc.

Function Documentation

◆ fl_engine_send_mouse_pointer_event()

fl_engine_send_mouse_pointer_event ( self->  engine,
phase  ,
event->time *  kMicrosecondsPerMillisecond,
event->x *  scale_factor,
event->y *  scale_factor,
,
,
self->  button_state 
)

◆ fl_view_button_press_event()

static gboolean fl_view_button_press_event ( GtkWidget *  widget,
GdkEventButton *  event 
)
static

Definition at line 261 of file fl_view.cc.

Referenced by fl_view_class_init().

262  {
263  FlView* self = FL_VIEW(widget);
264 
265  // Flutter doesn't handle double and triple click events.
266  if (event->type == GDK_DOUBLE_BUTTON_PRESS ||
267  event->type == GDK_TRIPLE_BUTTON_PRESS) {
268  return FALSE;
269  }
270 
271  return fl_view_send_pointer_button_event(self, event);
272 }
GdkEventButton * event
Definition: fl_view.cc:62

◆ fl_view_button_release_event()

static gboolean fl_view_button_release_event ( GtkWidget *  widget,
GdkEventButton *  event 
)
static

Definition at line 275 of file fl_view.cc.

Referenced by fl_view_class_init().

276  {
277  FlView* self = FL_VIEW(widget);
278 
279  return fl_view_send_pointer_button_event(self, event);
280 }
GdkEventButton * event
Definition: fl_view.cc:62

◆ fl_view_class_init()

static void fl_view_class_init ( FlViewClass *  klass)
static

Definition at line 358 of file fl_view.cc.

References fl_view_button_press_event(), fl_view_button_release_event(), fl_view_constructed(), fl_view_dispose(), fl_view_get_property(), fl_view_key_press_event(), fl_view_key_release_event(), fl_view_motion_notify_event(), fl_view_notify(), fl_view_realize(), fl_view_scroll_event(), fl_view_set_property(), fl_view_size_allocate(), and PROP_FLUTTER_PROJECT.

358  {
359  G_OBJECT_CLASS(klass)->constructed = fl_view_constructed;
360  G_OBJECT_CLASS(klass)->set_property = fl_view_set_property;
361  G_OBJECT_CLASS(klass)->get_property = fl_view_get_property;
362  G_OBJECT_CLASS(klass)->notify = fl_view_notify;
363  G_OBJECT_CLASS(klass)->dispose = fl_view_dispose;
364  GTK_WIDGET_CLASS(klass)->realize = fl_view_realize;
365  GTK_WIDGET_CLASS(klass)->size_allocate = fl_view_size_allocate;
366  GTK_WIDGET_CLASS(klass)->button_press_event = fl_view_button_press_event;
367  GTK_WIDGET_CLASS(klass)->button_release_event = fl_view_button_release_event;
368  GTK_WIDGET_CLASS(klass)->scroll_event = fl_view_scroll_event;
369  GTK_WIDGET_CLASS(klass)->motion_notify_event = fl_view_motion_notify_event;
370  GTK_WIDGET_CLASS(klass)->key_press_event = fl_view_key_press_event;
371  GTK_WIDGET_CLASS(klass)->key_release_event = fl_view_key_release_event;
372 
373  g_object_class_install_property(
374  G_OBJECT_CLASS(klass), PROP_FLUTTER_PROJECT,
375  g_param_spec_object(
376  "flutter-project", "flutter-project", "Flutter project in use",
377  fl_dart_project_get_type(),
378  static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
379  G_PARAM_STATIC_STRINGS)));
380 }
static gboolean fl_view_scroll_event(GtkWidget *widget, GdkEventScroll *event)
Definition: fl_view.cc:283
static void fl_view_dispose(GObject *object)
Definition: fl_view.cc:212
static void fl_view_constructed(GObject *object)
Definition: fl_view.cc:152
static void fl_view_notify(GObject *object, GParamSpec *pspec)
Definition: fl_view.cc:200
static void fl_view_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Definition: fl_view.cc:167
static void fl_view_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
Definition: fl_view.cc:184
static void fl_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
Definition: fl_view.cc:245
static void fl_view_realize(GtkWidget *widget)
Definition: fl_view.cc:227
static gboolean fl_view_motion_notify_event(GtkWidget *widget, GdkEventMotion *event)
Definition: fl_view.cc:320
static gboolean fl_view_key_release_event(GtkWidget *widget, GdkEventKey *event)
Definition: fl_view.cc:348
static gboolean fl_view_button_press_event(GtkWidget *widget, GdkEventButton *event)
Definition: fl_view.cc:261
static gboolean fl_view_button_release_event(GtkWidget *widget, GdkEventButton *event)
Definition: fl_view.cc:275
static gboolean fl_view_key_press_event(GtkWidget *widget, GdkEventKey *event)
Definition: fl_view.cc:338

◆ fl_view_constructed()

static void fl_view_constructed ( GObject *  object)
static

Definition at line 152 of file fl_view.cc.

References fl_engine_get_binary_messenger(), fl_engine_new(), fl_key_event_plugin_new(), fl_mouse_cursor_plugin_new(), fl_platform_plugin_new(), fl_text_input_plugin_new(), and fl_view_get_renderer_for_display().

Referenced by fl_view_class_init().

152  {
153  FlView* self = FL_VIEW(object);
154 
155  GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(self));
156  self->renderer = fl_view_get_renderer_for_display(display);
157  self->engine = fl_engine_new(self->project, self->renderer);
158 
159  // Create system channel handlers.
160  FlBinaryMessenger* messenger = fl_engine_get_binary_messenger(self->engine);
161  self->key_event_plugin = fl_key_event_plugin_new(messenger);
162  self->mouse_cursor_plugin = fl_mouse_cursor_plugin_new(messenger, self);
163  self->platform_plugin = fl_platform_plugin_new(messenger);
164  self->text_input_plugin = fl_text_input_plugin_new(messenger, self);
165 }
FlKeyEventPlugin * fl_key_event_plugin_new(FlBinaryMessenger *messenger, GAsyncReadyCallback response_callback, const char *channel_name)
static FlRenderer * fl_view_get_renderer_for_display(GdkDisplay *display)
Definition: fl_view.cc:136
FlMouseCursorPlugin * fl_mouse_cursor_plugin_new(FlBinaryMessenger *messenger, FlView *view)
FlTextInputPlugin * fl_text_input_plugin_new(FlBinaryMessenger *messenger, FlView *view)
FlEngine * fl_engine_new(FlDartProject *project, FlRenderer *renderer)
Definition: fl_engine.cc:337
FlPlatformPlugin * fl_platform_plugin_new(FlBinaryMessenger *messenger)
G_MODULE_EXPORT FlBinaryMessenger * fl_engine_get_binary_messenger(FlEngine *self)
Definition: fl_engine.cc:597

◆ fl_view_dispose()

static void fl_view_dispose ( GObject *  object)
static

Definition at line 212 of file fl_view.cc.

Referenced by fl_view_class_init().

212  {
213  FlView* self = FL_VIEW(object);
214 
215  g_clear_object(&self->project);
216  g_clear_object(&self->renderer);
217  g_clear_object(&self->engine);
218  g_clear_object(&self->key_event_plugin);
219  g_clear_object(&self->mouse_cursor_plugin);
220  g_clear_object(&self->platform_plugin);
221  g_clear_object(&self->text_input_plugin);
222 
223  G_OBJECT_CLASS(fl_view_parent_class)->dispose(object);
224 }

◆ fl_view_geometry_changed()

static void fl_view_geometry_changed ( FlView *  self)
static

Definition at line 111 of file fl_view.cc.

References fl_engine_send_window_metrics_event(), and fl_renderer_set_geometry().

Referenced by fl_view_notify(), and fl_view_size_allocate().

111  {
112  GtkAllocation allocation;
113  gtk_widget_get_allocation(GTK_WIDGET(self), &allocation);
114  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
116  self->engine, allocation.width * scale_factor,
117  allocation.height * scale_factor, scale_factor);
118  fl_renderer_set_geometry(self->renderer, &allocation, scale_factor);
119 }
void fl_renderer_set_geometry(FlRenderer *self, GdkRectangle *geometry, gint scale)
Definition: fl_renderer.cc:202
void fl_engine_send_window_metrics_event(FlEngine *self, size_t width, size_t height, double pixel_ratio)
Definition: fl_engine.cc:549
gint scale_factor
Definition: fl_view.cc:101

◆ fl_view_get_engine()

G_MODULE_EXPORT FlEngine* fl_view_get_engine ( FlView *  view)

fl_view_get_engine: : an #FlView.

Gets the engine being rendered in the view.

Returns: an #FlEngine.

Definition at line 391 of file fl_view.cc.

391  {
392  g_return_val_if_fail(FL_IS_VIEW(view), nullptr);
393  return view->engine;
394 }

◆ fl_view_get_property()

static void fl_view_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 184 of file fl_view.cc.

References PROP_FLUTTER_PROJECT.

Referenced by fl_view_class_init().

187  {
188  FlView* self = FL_VIEW(object);
189 
190  switch (prop_id) {
192  g_value_set_object(value, self->project);
193  break;
194  default:
195  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
196  break;
197  }
198 }
uint8_t value

◆ fl_view_get_registrar_for_plugin()

static FlPluginRegistrar* fl_view_get_registrar_for_plugin ( FlPluginRegistry *  registry,
const gchar *  name 
)
static

Definition at line 122 of file fl_view.cc.

References fl_engine_get_binary_messenger(), and fl_plugin_registrar_new().

Referenced by fl_view_plugin_registry_iface_init().

124  {
125  FlView* self = FL_VIEW(registry);
126 
127  return fl_plugin_registrar_new(self,
128  fl_engine_get_binary_messenger(self->engine));
129 }
FlPluginRegistrar * fl_plugin_registrar_new(FlView *view, FlBinaryMessenger *messenger)
G_MODULE_EXPORT FlBinaryMessenger * fl_engine_get_binary_messenger(FlEngine *self)
Definition: fl_engine.cc:597

◆ fl_view_get_renderer_for_display()

static FlRenderer* fl_view_get_renderer_for_display ( GdkDisplay *  display)
static

Definition at line 136 of file fl_view.cc.

References fl_renderer_wayland_new().

Referenced by fl_view_constructed().

136  {
137 #ifdef GDK_WINDOWING_X11
138  if (GDK_IS_X11_DISPLAY(display)) {
139  return FL_RENDERER(fl_renderer_x11_new());
140  }
141 #endif
142 
143  if (GDK_IS_WAYLAND_DISPLAY(display)) {
144  return FL_RENDERER(fl_renderer_wayland_new());
145  }
146 
147  g_error("Unsupported GDK backend");
148 
149  return nullptr;
150 }
FlRendererWayland * fl_renderer_wayland_new()

◆ fl_view_init()

static void fl_view_init ( FlView *  self)
static

Definition at line 382 of file fl_view.cc.

References TRUE.

382  {
383  gtk_widget_set_can_focus(GTK_WIDGET(self), TRUE);
384 }
return TRUE
Definition: fl_view.cc:107

◆ fl_view_key_press_event()

static gboolean fl_view_key_press_event ( GtkWidget *  widget,
GdkEventKey *  event 
)
static

Definition at line 338 of file fl_view.cc.

References fl_key_event_plugin_send_key_event(), fl_text_input_plugin_filter_keypress(), and TRUE.

Referenced by fl_view_class_init().

338  {
339  FlView* self = FL_VIEW(widget);
340 
341  fl_key_event_plugin_send_key_event(self->key_event_plugin, event);
342  fl_text_input_plugin_filter_keypress(self->text_input_plugin, event);
343 
344  return TRUE;
345 }
gboolean fl_text_input_plugin_filter_keypress(FlTextInputPlugin *self, GdkEventKey *event)
GdkEventButton * event
Definition: fl_view.cc:62
void fl_key_event_plugin_send_key_event(FlKeyEventPlugin *self, GdkEventKey *event, gpointer user_data)
return TRUE
Definition: fl_view.cc:107

◆ fl_view_key_release_event()

static gboolean fl_view_key_release_event ( GtkWidget *  widget,
GdkEventKey *  event 
)
static

Definition at line 348 of file fl_view.cc.

References fl_key_event_plugin_send_key_event(), fl_text_input_plugin_filter_keypress(), and TRUE.

Referenced by fl_view_class_init().

349  {
350  FlView* self = FL_VIEW(widget);
351 
352  fl_key_event_plugin_send_key_event(self->key_event_plugin, event);
353  fl_text_input_plugin_filter_keypress(self->text_input_plugin, event);
354 
355  return TRUE;
356 }
gboolean fl_text_input_plugin_filter_keypress(FlTextInputPlugin *self, GdkEventKey *event)
GdkEventButton * event
Definition: fl_view.cc:62
void fl_key_event_plugin_send_key_event(FlKeyEventPlugin *self, GdkEventKey *event, gpointer user_data)
return TRUE
Definition: fl_view.cc:107

◆ fl_view_motion_notify_event()

static gboolean fl_view_motion_notify_event ( GtkWidget *  widget,
GdkEventMotion *  event 
)
static

Definition at line 320 of file fl_view.cc.

References fl_engine_send_mouse_pointer_event(), kHover, kMicrosecondsPerMillisecond, kMove, and TRUE.

Referenced by fl_view_class_init().

321  {
322  FlView* self = FL_VIEW(widget);
323 
324  if (self->engine == nullptr) {
325  return FALSE;
326  }
327 
328  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
330  self->engine, self->button_state != 0 ? kMove : kHover,
331  event->time * kMicrosecondsPerMillisecond, event->x * scale_factor,
332  event->y * scale_factor, 0, 0, self->button_state);
333 
334  return TRUE;
335 }
fl_engine_send_mouse_pointer_event(self->engine, phase, event->time *kMicrosecondsPerMillisecond, event->x *scale_factor, event->y *scale_factor, 0, 0, self->button_state)
static constexpr int kMicrosecondsPerMillisecond
Definition: fl_view.cc:24
The pointer moved while up.
Definition: embedder.h:503
GdkEventButton * event
Definition: fl_view.cc:62
gint scale_factor
Definition: fl_view.cc:101
return TRUE
Definition: fl_view.cc:107

◆ fl_view_new()

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 *mesenger = fl_engine_get_binary_messenger (fl_view_get_engine (view)); setup_channels_or_plugins (messenger); ]| fl_view_new: : The project to show.

Creates a widget to show Flutter application.

Returns: a new #FlView.

Definition at line 386 of file fl_view.cc.

386  {
387  return static_cast<FlView*>(
388  g_object_new(fl_view_get_type(), "flutter-project", project, nullptr));
389 }

◆ fl_view_notify()

static void fl_view_notify ( GObject *  object,
GParamSpec *  pspec 
)
static

Definition at line 200 of file fl_view.cc.

References fl_view_geometry_changed().

Referenced by fl_view_class_init().

200  {
201  FlView* self = FL_VIEW(object);
202 
203  if (strcmp(pspec->name, "scale-factor") == 0) {
205  }
206 
207  if (G_OBJECT_CLASS(fl_view_parent_class)->notify != nullptr) {
208  G_OBJECT_CLASS(fl_view_parent_class)->notify(object, pspec);
209  }
210 }
static void fl_view_geometry_changed(FlView *self)
Definition: fl_view.cc:111

◆ fl_view_plugin_registry_iface_init()

static void fl_view_plugin_registry_iface_init ( FlPluginRegistryInterface *  iface)
static

Definition at line 131 of file fl_view.cc.

References fl_view_get_registrar_for_plugin().

132  {
133  iface->get_registrar_for_plugin = fl_view_get_registrar_for_plugin;
134 }
static FlPluginRegistrar * fl_view_get_registrar_for_plugin(FlPluginRegistry *registry, const gchar *name)
Definition: fl_view.cc:122

◆ fl_view_realize()

static void fl_view_realize ( GtkWidget *  widget)
static

Definition at line 227 of file fl_view.cc.

References error, fl_engine_start(), fl_renderer_start(), and TRUE.

Referenced by fl_view_class_init().

227  {
228  FlView* self = FL_VIEW(widget);
229  g_autoptr(GError) error = nullptr;
230 
231  gtk_widget_set_realized(widget, TRUE);
232 
233  if (!fl_renderer_start(self->renderer, widget, &error)) {
234  g_warning("Failed to start Flutter renderer: %s", error->message);
235  return;
236  }
237 
238  if (!fl_engine_start(self->engine, &error)) {
239  g_warning("Failed to start Flutter engine: %s", error->message);
240  return;
241  }
242 }
FlMethodResponse GError ** error
gboolean fl_renderer_start(FlRenderer *self, GtkWidget *widget, GError **error)
Definition: fl_renderer.cc:182
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:352
return TRUE
Definition: fl_view.cc:107

◆ fl_view_scroll_event()

static gboolean fl_view_scroll_event ( GtkWidget *  widget,
GdkEventScroll *  event 
)
static

Definition at line 283 of file fl_view.cc.

References fl_engine_send_mouse_pointer_event(), kHover, kMicrosecondsPerMillisecond, kMove, and TRUE.

Referenced by fl_view_class_init().

283  {
284  FlView* self = FL_VIEW(widget);
285 
286  // TODO(robert-ancell): Update to use GtkEventControllerScroll when we can
287  // depend on GTK 3.24.
288 
289  gdouble scroll_delta_x = 0.0, scroll_delta_y = 0.0;
290  if (event->direction == GDK_SCROLL_SMOOTH) {
291  scroll_delta_x = event->delta_x;
292  scroll_delta_y = event->delta_y;
293  } else if (event->direction == GDK_SCROLL_UP) {
294  scroll_delta_y = -1;
295  } else if (event->direction == GDK_SCROLL_DOWN) {
296  scroll_delta_y = 1;
297  } else if (event->direction == GDK_SCROLL_LEFT) {
298  scroll_delta_x = -1;
299  } else if (event->direction == GDK_SCROLL_RIGHT) {
300  scroll_delta_x = 1;
301  }
302 
303  // TODO(robert-ancell): See if this can be queried from the OS; this value is
304  // chosen arbitrarily to get something that feels reasonable.
305  const int kScrollOffsetMultiplier = 20;
306  scroll_delta_x *= kScrollOffsetMultiplier;
307  scroll_delta_y *= kScrollOffsetMultiplier;
308 
309  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
311  self->engine, self->button_state != 0 ? kMove : kHover,
312  event->time * kMicrosecondsPerMillisecond, event->x * scale_factor,
313  event->y * scale_factor, scroll_delta_x, scroll_delta_y,
314  self->button_state);
315 
316  return TRUE;
317 }
fl_engine_send_mouse_pointer_event(self->engine, phase, event->time *kMicrosecondsPerMillisecond, event->x *scale_factor, event->y *scale_factor, 0, 0, self->button_state)
static constexpr int kMicrosecondsPerMillisecond
Definition: fl_view.cc:24
The pointer moved while up.
Definition: embedder.h:503
GdkEventButton * event
Definition: fl_view.cc:62
gint scale_factor
Definition: fl_view.cc:101
return TRUE
Definition: fl_view.cc:107

◆ fl_view_set_property()

static void fl_view_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 167 of file fl_view.cc.

References PROP_FLUTTER_PROJECT.

Referenced by fl_view_class_init().

170  {
171  FlView* self = FL_VIEW(object);
172 
173  switch (prop_id) {
175  g_set_object(&self->project,
176  static_cast<FlDartProject*>(g_value_get_object(value)));
177  break;
178  default:
179  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
180  break;
181  }
182 }
uint8_t value

◆ fl_view_size_allocate()

static void fl_view_size_allocate ( GtkWidget *  widget,
GtkAllocation *  allocation 
)
static

Definition at line 245 of file fl_view.cc.

References fl_view_geometry_changed().

Referenced by fl_view_class_init().

246  {
247  FlView* self = FL_VIEW(widget);
248 
249  gtk_widget_set_allocation(widget, allocation);
250 
251  if (gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) {
252  gdk_window_move_resize(gtk_widget_get_window(widget), allocation->x,
253  allocation->y, allocation->width,
254  allocation->height);
255  }
256 
258 }
static void fl_view_geometry_changed(FlView *self)
Definition: fl_view.cc:111

◆ G_DEFINE_TYPE_WITH_CODE()

G_DEFINE_TYPE_WITH_CODE ( FlView  ,
fl_view  ,
GTK_TYPE_WIDGET  ,
G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(), fl_view_plugin_registry_iface_init  
)

◆ if() [1/2]

else if ( event->  type = = GDK_BUTTON_PRESS)

Definition at line 79 of file fl_view.cc.

References event, kDown, kMove, and kUp.

Referenced by txt::ParagraphTxt::GetGlyphPositionAtCoordinate(), and txt::ParagraphTxt::Paint().

79  {
80  // Drop the event if Flutter already thinks the button is down.
81  if ((self->button_state & button) != 0) {
82  return FALSE;
83  }
84  self->button_state ^= button;
85 
86  phase = old_button_state == 0 ? kDown : kMove;
87  } else if (event->type == GDK_BUTTON_RELEASE) {
int old_button_state
Definition: fl_view.cc:77
FlutterPointerPhase phase
Definition: fl_view.cc:78
GdkEventButton * event
Definition: fl_view.cc:62

◆ if() [2/2]

if ( self->  engine = = nullptr)

Definition at line 97 of file fl_view.cc.

97  {
98  return FALSE;
99  }

◆ switch()

switch ( event->  button)

Definition at line 64 of file fl_view.cc.

References kFlutterPointerButtonMouseMiddle, kFlutterPointerButtonMousePrimary, and kFlutterPointerButtonMouseSecondary.

64  {
65  case 1:
67  break;
68  case 2:
70  break;
71  case 3:
73  break;
74  default:
75  return FALSE;
76  }

Variable Documentation

◆ event

◆ kMicrosecondsPerMillisecond

constexpr int kMicrosecondsPerMillisecond = 1000
static

Definition at line 24 of file fl_view.cc.

Referenced by fl_view_motion_notify_event(), and fl_view_scroll_event().

◆ old_button_state

int old_button_state = self->button_state

Definition at line 77 of file fl_view.cc.

◆ phase

◆ scale_factor

gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self))

Definition at line 101 of file fl_view.cc.

◆ TRUE