ClutterInputDevice *master, *slave;
XIDeviceInfo *info;
int n_devices;
+ gboolean send_changed = FALSE;
CLUTTER_NOTE (EVENT, "Hierarchy event: slave %s",
(ev->info[i].flags & XISlaveAttached)
{
_clutter_input_device_remove_slave (master, slave);
_clutter_input_device_set_associated_device (slave, NULL);
+
+ send_changed = TRUE;
}
/* and attach the slave to the new master if needed */
_clutter_input_device_set_associated_device (slave, master);
_clutter_input_device_add_slave (master, slave);
+ send_changed = TRUE;
XIFreeDeviceInfo (info);
}
+
+ if (send_changed)
+ {
+ ClutterStage *stage = _clutter_input_device_get_stage (master);
+ if (stage != NULL)
+ _clutter_stage_x11_events_device_changed (CLUTTER_STAGE_X11 (_clutter_stage_get_window (stage)),
+ master,
+ CLUTTER_DEVICE_MANAGER (manager_xi2));
+ }
}
}
}
* queue a relayout etc. */
}
+void
+_clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11,
+ ClutterInputDevice *device,
+ ClutterDeviceManager *device_manager)
+{
+ ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
+ int event_flags = 0;
+
+ if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_FLOATING)
+ event_flags = CLUTTER_STAGE_X11_EVENT_MASK;
+
+ _clutter_device_manager_select_stage_events (device_manager,
+ stage_cogl->wrapper,
+ event_flags);
+}
+
+static void
+stage_events_device_added (ClutterDeviceManager *device_manager,
+ ClutterInputDevice *device,
+ gpointer user_data)
+{
+ ClutterStageWindow *stage_window = user_data;
+ ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
+ int event_flags = CLUTTER_STAGE_X11_EVENT_MASK;
+
+ if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_FLOATING)
+ _clutter_device_manager_select_stage_events (device_manager,
+ stage_cogl->wrapper,
+ event_flags);
+}
+
static gboolean
clutter_stage_x11_realize (ClutterStageWindow *stage_window)
{
stage_cogl->wrapper,
event_flags);
+ g_signal_connect (device_manager, "device-added",
+ G_CALLBACK (stage_events_device_added), stage_window);
+
clutter_stage_x11_fix_window_size (stage_x11,
stage_x11->xwin_width,
stage_x11->xwin_height);
void _clutter_stage_x11_update_foreign_event_mask (CoglOnscreen *onscreen,
guint32 event_mask,
void *user_data);
+void _clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11,
+ ClutterInputDevice *device,
+ ClutterDeviceManager *device_manager);
/* Private to subclasses */
void _clutter_stage_x11_set_user_time (ClutterStageX11 *stage_x11,