device-manager: Don't pass the event mask around

There's no point in doing this, as we always use a constant event mask.
Simply do what everything else does.

https://bugzilla.gnome.org/show_bug.cgi?id=703969
This commit is contained in:
Jasper St. Pierre 2013-07-10 16:34:48 -04:00
parent e38ea7a20f
commit 032688800c
6 changed files with 21 additions and 57 deletions

View File

@ -138,8 +138,7 @@ struct _ClutterInputDeviceClass
GObjectClass parent_class;
void (* select_stage_events) (ClutterInputDevice *device,
ClutterStage *stage,
gint event_mask);
ClutterStage *stage);
gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode);
@ -152,8 +151,7 @@ void _clutter_device_manager_remove_device (ClutterDeviceMa
ClutterInputDevice *device);
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
ClutterStage *stage,
gint event_mask);
ClutterStage *stage);
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
/* input device */
@ -199,8 +197,7 @@ void _clutter_input_device_remove_slave (ClutterInputDev
ClutterInputDevice *slave);
void _clutter_input_device_select_stage_events (ClutterInputDevice *device,
ClutterStage *stage,
gint event_flags);
ClutterStage *stage);
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,

View File

@ -304,8 +304,7 @@ clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
void
_clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
ClutterStage *stage,
gint event_flags)
ClutterStage *stage)
{
ClutterDeviceManagerClass *manager_class;
const GSList *devices, *d;
@ -320,7 +319,7 @@ _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manage
ClutterInputDevice *device = d->data;
if (device->is_enabled)
_clutter_input_device_select_stage_events (device, stage, event_flags);
_clutter_input_device_select_stage_events (device, stage);
}
}

View File

@ -1619,7 +1619,6 @@ clutter_input_device_get_associated_device (ClutterInputDevice *device)
* clutter_input_device_select_stage_events:
* @device: a #ClutterInputDevice
* @stage: the #ClutterStage to select events on
* @event_mask: platform-specific mask of events
*
* Selects input device events on @stage.
*
@ -1627,14 +1626,13 @@ clutter_input_device_get_associated_device (ClutterInputDevice *device)
*/
void
_clutter_input_device_select_stage_events (ClutterInputDevice *device,
ClutterStage *stage,
gint event_mask)
ClutterStage *stage)
{
ClutterInputDeviceClass *device_class;
device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
if (device_class->select_stage_events != NULL)
device_class->select_stage_events (device, stage, event_mask);
device_class->select_stage_events (device, stage);
}
/**

View File

@ -55,8 +55,7 @@ G_DEFINE_TYPE (ClutterInputDeviceXI2,
static void
clutter_input_device_xi2_select_stage_events (ClutterInputDevice *device,
ClutterStage *stage,
gint event_mask)
ClutterStage *stage)
{
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
ClutterBackendX11 *backend_x11;
@ -71,25 +70,12 @@ clutter_input_device_xi2_select_stage_events (ClutterInputDevice *device,
len = XIMaskLen (XI_LASTEVENT);
mask = g_new0 (unsigned char, len);
if (event_mask & PointerMotionMask)
XISetMask (mask, XI_Motion);
if (event_mask & ButtonPressMask)
XISetMask (mask, XI_ButtonPress);
if (event_mask & ButtonReleaseMask)
XISetMask (mask, XI_ButtonRelease);
if (event_mask & KeyPressMask)
XISetMask (mask, XI_KeyPress);
if (event_mask & KeyReleaseMask)
XISetMask (mask, XI_KeyRelease);
if (event_mask & EnterWindowMask)
XISetMask (mask, XI_Enter);
if (event_mask & LeaveWindowMask)
XISetMask (mask, XI_Leave);
#ifdef HAVE_XINPUT_2_2

View File

@ -547,14 +547,10 @@ _clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11,
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);
stage_cogl->wrapper);
}
static void
@ -564,12 +560,10 @@ stage_events_device_added (ClutterDeviceManager *device_manager,
{
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);
stage_cogl->wrapper);
}
static gboolean
@ -580,7 +574,6 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
ClutterDeviceManager *device_manager;
int event_flags;
gfloat width, height;
clutter_actor_get_size (CLUTTER_ACTOR (stage_cogl->wrapper),
@ -623,14 +616,6 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
set_wm_title (stage_x11);
set_cursor_visible (stage_x11);
/* the masks for the events we want to select on a stage window;
* KeyPressMask and KeyReleaseMask are necessary even with XI1
* because key events are broken with that extension, and will
* be fixed by XI2
*/
event_flags = CLUTTER_STAGE_X11_EVENT_MASK;
/* we unconditionally select input events even with event retrieval
* disabled because we need to guarantee that the Clutter internal
* state is maintained when calling clutter_x11_handle_event() without
@ -648,7 +633,7 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
* for an example of things that break if we do conditional event
* selection.
*/
XSelectInput (backend_x11->xdpy, stage_x11->xwin, event_flags);
XSelectInput (backend_x11->xdpy, stage_x11->xwin, CLUTTER_STAGE_X11_EVENT_MASK);
/* input events also depent on the actual device, so we need to
* use the device manager to let every device select them, using
@ -658,8 +643,7 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
if (G_UNLIKELY (device_manager != NULL))
{
_clutter_device_manager_select_stage_events (device_manager,
stage_cogl->wrapper,
event_flags);
stage_cogl->wrapper);
g_signal_connect (device_manager, "device-added",
G_CALLBACK (stage_events_device_added),

View File

@ -86,7 +86,7 @@ struct _ClutterStageX11Class
KeyReleaseMask | \
ButtonPressMask | \
ButtonReleaseMask | \
PointerMotionMask;
PointerMotionMask
GType _clutter_stage_x11_get_type (void) G_GNUC_CONST;