[gnome-shell/gnome-3-36] shell: Do not use stack-allocated ClutterEvents
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-36] shell: Do not use stack-allocated ClutterEvents
- Date: Wed, 7 Oct 2020 18:29:22 +0000 (UTC)
commit 938432a453251e5c1b52de1cd3b84fab55a7e899
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Sep 24 18:19:44 2020 +0200
shell: Do not use stack-allocated ClutterEvents
All events should be allocated.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1451
src/shell-global.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index ec9a052176..bfc0e5f83c 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1332,31 +1332,32 @@ shell_global_sync_pointer (ShellGlobal *global)
{
int x, y;
ClutterModifierType mods;
- ClutterMotionEvent event;
+ ClutterEvent *event;
ClutterSeat *seat;
shell_global_get_pointer (global, &x, &y, &mods);
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
+ event = clutter_event_new (CLUTTER_MOTION);
- event.type = CLUTTER_MOTION;
- event.time = shell_global_get_current_time (global);
- event.flags = CLUTTER_EVENT_FLAG_SYNTHETIC;
- event.stage = global->stage;
- event.x = x;
- event.y = y;
- event.modifier_state = mods;
- event.axes = NULL;
- event.device = clutter_seat_get_pointer (seat);
+ event->motion.time = shell_global_get_current_time (global);
+ event->motion.flags = CLUTTER_EVENT_FLAG_SYNTHETIC;
+ event->motion.stage = global->stage;
+ event->motion.x = x;
+ event->motion.y = y;
+ event->motion.modifier_state = mods;
+ event->motion.axes = NULL;
+ clutter_event_set_device (event, clutter_seat_get_pointer (seat));
/* Leaving event.source NULL will force clutter to look it up, which
* will generate enter/leave events as a side effect, if they are
* needed. We need a better way to do this though... see
* http://bugzilla.clutter-project.org/show_bug.cgi?id=2615.
*/
- event.source = NULL;
+ clutter_event_set_source_device (event, NULL);
- clutter_event_put ((ClutterEvent *)&event);
+ clutter_event_put (event);
+ clutter_event_free (event);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]