Hi Community,
I started experimenting with writing a mutter plugin first step was just drawing a simple rectangle via a clutter canvas and actor. This worked very well, the next step would be getting input events like mouse move or mouse click but I am not able to get this sorted out. What I tried so far is setting the actor to be reactive and then connecting to the key-press and motion event.
Here some simplified code how it looks currently:
MetaDisplay *display = meta_plugin_get_display(plugin);
int screen_width, screen_height;
meta_display_get_size(display, &screen_width, &screen_height);
ClutterContent *canvas = clutter_canvas_new();
clutter_canvas_set_size(CLUTTER_CANVAS(canvas), screen_width, screen_height);
ClutterActor *desktop = clutter_actor_new();
clutter_actor_set_request_mode(desktop, CLUTTER_REQUEST_CONTENT_SIZE);
clutter_actor_set_content(desktop, canvas);
clutter_actor_set_reactive(desktop, true);
<connect to signals>
g_object_unref(canvas);
ClutterActor *stage = meta_get_stage_for_display(display);
clutter_actor_insert_child_above(stage, desktop, nullptr);
clutter_actor_show(desktop);
Is there anything special which needs to be done in order to receive input events from within mutter?
Thanks in advance,
Jan