| Flutter Linux Embedder |

Functions
fl_pointer_manager.h File Reference
`#include "flutter/shell/platform/embedder/embedder.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS | G_DECLARE_FINAL_TYPE (FlPointerManager, fl_pointer_manager, FL, POINTER_MANAGER, GObject)
FlPointerManager * | fl_pointer_manager_new (FlutterViewId view_id, FlEngine *engine)
gboolean | fl_pointer_manager_handle_button_press (FlPointerManager *manager, guint event_time, FlutterPointerDeviceKind device_kind, gdouble x, gdouble y, int64_t button)
gboolean | fl_pointer_manager_handle_button_release (FlPointerManager *manager, guint event_time, FlutterPointerDeviceKind device_kind, gdouble x, gdouble y, int64_t button)
gboolean | fl_pointer_manager_handle_motion (FlPointerManager *manager, guint event_time, FlutterPointerDeviceKind device_kind, gdouble x, gdouble y)
gboolean | fl_pointer_manager_handle_enter (FlPointerManager *manager, guint event_time, FlutterPointerDeviceKind device_kind, gdouble x, gdouble y)
gboolean | fl_pointer_manager_handle_leave (FlPointerManager *manager, guint event_time, FlutterPointerDeviceKind device_kind, gdouble x, gdouble y)

## Function Documentation

## ◆ fl_pointer_manager_handle_button_press()

gboolean fl_pointer_manager_handle_button_press | ( | FlPointerManager * | manager,
|  | guint | event_time,
|  | FlutterPointerDeviceKind | device_kind,
|  | gdouble | x,
|  | gdouble | y,
|  | int64_t | button
| ) |  |

fl_pointer_manager_handle_button_press: @manager: an #FlPointerManager. @event_time: event time in milliseconds. @device_kind: kind of device generating the event. @x: x co-ordinate of event. @y: y co-ordinate of event. @button: button being pressed.

Returns TRUE if this event was handled.

Definition at line 76 of file fl_pointer_manager.cc.

82 {
83 g_return_val_if_fail(FL_IS_POINTER_MANAGER(self), FALSE);
84
85 ensure_pointer_added(self, event_time, device_kind, x, y);
86
87 // Drop the event if Flutter already thinks the button is down.
88 if ((self->button_state & button) != 0) {
89 return FALSE;
90 }
91
92 int old_button_state = self->button_state;
93 FlutterPointerPhase phase = kMove;
94 self->button_state ^= button;
95 phase = old_button_state == 0 ? kDown : kMove;
96
97 g_autoptr(FlEngine) engine = FL_ENGINE(g_weak_ref_get(&self->engine));
98 if (engine == nullptr) {
99 return FALSE;
100 }
101
102 fl_engine_send_mouse_pointer_event(
103 engine, self->view_id, phase, event_time * kMicrosecondsPerMillisecond, x,
104 y, device_kind, 0, 0, self->button_state);
105
106 return TRUE;
107 }

References ensure_pointer_added(), fl_engine_send_mouse_pointer_event(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by button_press_event_cb(), and TEST().

## ◆ fl_pointer_manager_handle_button_release()

gboolean fl_pointer_manager_handle_button_release | ( | FlPointerManager * | manager,
|  | guint | event_time,
|  | FlutterPointerDeviceKind | device_kind,
|  | gdouble | x,
|  | gdouble | y,
|  | int64_t | button
| ) |  |

fl_pointer_manager_handle_button_release: @manager: an #FlPointerManager. @event_time: event time in milliseconds. @device_kind: kind of device generating the event. @x: x co-ordinate of event. @y: y co-ordinate of event. @button: button being released.

Returns TRUE if this event was handled.

Definition at line 109 of file fl_pointer_manager.cc.

115 {
116 g_return_val_if_fail(FL_IS_POINTER_MANAGER(self), FALSE);
117
118 // Drop the event if Flutter already thinks the button is up.
119 if ((self->button_state & button) == 0) {
120 return FALSE;
121 }
122
123 FlutterPointerPhase phase = kMove;
124 self->button_state ^= button;
125
126 phase = self->button_state == 0 ? kUp : kMove;
127
128 g_autoptr(FlEngine) engine = FL_ENGINE(g_weak_ref_get(&self->engine));
129 if (engine == nullptr) {
130 return FALSE;
131 }
132
133 fl_engine_send_mouse_pointer_event(
134 engine, self->view_id, phase, event_time * kMicrosecondsPerMillisecond, x,
135 y, device_kind, 0, 0, self->button_state);
136
137 return TRUE;
138 }

References fl_engine_send_mouse_pointer_event(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by button_release_event_cb(), and TEST().

## ◆ fl_pointer_manager_handle_enter()

gboolean fl_pointer_manager_handle_enter | ( | FlPointerManager * | manager,
|  | guint | event_time,
|  | FlutterPointerDeviceKind | device_kind,
|  | gdouble | x,
|  | gdouble | y
| ) |  |

fl_pointer_manager_handle_enter: @manager: an #FlPointerManager. @event_time: event time in milliseconds. @device_kind: kind of device generating the event. @x: x co-ordinate of event. @y: y co-ordinate of event.

Returns TRUE if this event was handled.

Definition at line 162 of file fl_pointer_manager.cc.

166 {
167 g_return_val_if_fail(FL_IS_POINTER_MANAGER(self), FALSE);
168
169 g_autoptr(FlEngine) engine = FL_ENGINE(g_weak_ref_get(&self->engine));
170 if (engine == nullptr) {
171 return FALSE;
172 }
173
174 ensure_pointer_added(self, event_time, device_kind, x, y);
175
176 return TRUE;
177 }

References ensure_pointer_added(), and TRUE.

Referenced by enter_notify_event_cb(), and TEST().

## ◆ fl_pointer_manager_handle_leave()

gboolean fl_pointer_manager_handle_leave | ( | FlPointerManager * | manager,
|  | guint | event_time,
|  | FlutterPointerDeviceKind | device_kind,
|  | gdouble | x,
|  | gdouble | y
| ) |  |

fl_pointer_manager_handle_leave: @manager: an #FlPointerManager. @event_time: event time in milliseconds. @device_kind: kind of device generating the event. @x: x co-ordinate of event. @y: y co-ordinate of event.

Returns TRUE if this event was handled.

Definition at line 179 of file fl_pointer_manager.cc.

183 {
184 g_return_val_if_fail(FL_IS_POINTER_MANAGER(self), FALSE);
185
186 g_autoptr(FlEngine) engine = FL_ENGINE(g_weak_ref_get(&self->engine));
187 if (engine == nullptr) {
188 return FALSE;
189 }
190
191 // Don't remove pointer while button is down; In case of dragging outside of
192 // window with mouse grab active Gtk will send another leave notify on
193 // release.
194 if (self->pointer_inside && self->button_state == 0) {
195 fl_engine_send_mouse_pointer_event(engine, self->view_id, kRemove,
196 event_time * kMicrosecondsPerMillisecond,
197 x, y, device_kind, 0, 0,
198 self->button_state);
199 self->pointer_inside = FALSE;
200 }
201
202 return TRUE;
203 }

References fl_engine_send_mouse_pointer_event(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by leave_notify_event_cb(), and TEST().

## ◆ fl_pointer_manager_handle_motion()

gboolean fl_pointer_manager_handle_motion | ( | FlPointerManager * | manager,
|  | guint | event_time,
|  | FlutterPointerDeviceKind | device_kind,
|  | gdouble | x,
|  | gdouble | y
| ) |  |

fl_pointer_manager_handle_motion: @manager: an #FlPointerManager. @event_time: event time in milliseconds. @device_kind: kind of device generating the event. @x: x co-ordinate of event. @y: y co-ordinate of event.

Returns TRUE if this event was handled.

Definition at line 140 of file fl_pointer_manager.cc.

144 {
145 g_return_val_if_fail(FL_IS_POINTER_MANAGER(self), FALSE);
146
147 g_autoptr(FlEngine) engine = FL_ENGINE(g_weak_ref_get(&self->engine));
148 if (engine == nullptr) {
149 return FALSE;
150 }
151
152 ensure_pointer_added(self, event_time, device_kind, x, y);
153
154 fl_engine_send_mouse_pointer_event(
155 engine, self->view_id, self->button_state != 0 ? kMove : kHover,
156 event_time * kMicrosecondsPerMillisecond, x, y, device_kind, 0, 0,
157 self->button_state);
158
159 return TRUE;
160 }

References ensure_pointer_added(), fl_engine_send_mouse_pointer_event(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by motion_notify_event_cb(), and TEST().

## ◆ fl_pointer_manager_new()

FlPointerManager* fl_pointer_manager_new | ( | FlutterViewId | view_id,
|  | FlEngine * | engine
| ) |  |

fl_pointer_manager_new: @view_id: view ID to report events for. @engine: an #FlEngine.

Create a new #FlPointerManager.

Returns: a new #FlPointerManager.

Definition at line 65 of file fl_pointer_manager.cc.

66 {
67 FlPointerManager* self =
68 FL_POINTER_MANAGER(g_object_new(fl_pointer_manager_get_type(), nullptr));
69
70 self->view_id = view_id;
71 g_weak_ref_init(&self->engine, engine);
72
73 return self;
74 }

Referenced by fl_view_new(), fl_view_new_for_engine(), and TEST().

## ◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE | ( | FlPointerManager | ,
|  | fl_pointer_manager | ,
|  | FL | ,
|  | POINTER_MANAGER | ,
|  | GObject |
| ) |  |

ensure_pointer_added
static void ensure_pointer_added(FlPointerManager *self, guint event_time, FlutterPointerDeviceKind device_kind, gdouble x, gdouble y)
Definition: fl_pointer_manager.cc:31
kMicrosecondsPerMillisecond
static constexpr int kMicrosecondsPerMillisecond
Definition: fl_pointer_manager.cc:9
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
fl_engine_send_mouse_pointer_event
void fl_engine_send_mouse_pointer_event(FlEngine *self, FlutterViewId view_id, FlutterPointerPhase phase, size_t timestamp, double x, double y, FlutterPointerDeviceKind device_kind, double scroll_delta_x, double scroll_delta_y, int64_t buttons)
Definition: fl_engine.cc:918