{
if (e_devicemgr->relative_motion_grab.grabbed_boundaries & boundaries)
{
- DMINF("e_devicemgr_relative_motion_is_grabbed() grabbed:%d, boundaries:%d",
- e_devicemgr->relative_motion_grab.grabbed_boundaries, boundaries);
+ DMINF("Relative Motion Grab. boundaries(%d) is grabbed. among others(%d)",
+ boundaries, e_devicemgr->relative_motion_grab.grabbed_boundaries);
return EINA_TRUE;
}
return boundary;
}
-static Eina_Bool
+static void
_e_devicemgr_relative_motion_grab_surface_remove(E_Client *ec,
unsigned int boundary)
{
- if (ec != e_devicemgr->relative_motion_grab.boundaries[boundary].ec)
- return EINA_FALSE;
-
e_devicemgr->relative_motion_grab.boundaries[boundary].client = NULL;
e_devicemgr->relative_motion_grab.boundaries[boundary].ec = NULL;
e_devicemgr->relative_motion_grab.boundaries[boundary].resource = NULL;
e_devicemgr->relative_motion_grab.grabbed_boundaries &= ~(1 << boundary);
e_devicemgr->relative_motion_grab.last_event_boundary = 0;
- return EINA_TRUE;
+ return;
}
static void
}
}
-static Eina_Bool
+static void
_e_devicemgr_relative_motion_grab_surface_add(E_Client *ec, uint32_t boundary,
struct wl_client *client,
struct wl_resource *resource)
{
- if (ec == e_devicemgr->relative_motion_grab.boundaries[boundary].ec)
- return EINA_TRUE;
-
e_devicemgr->relative_motion_grab.boundaries[boundary].client = client;
e_devicemgr->relative_motion_grab.boundaries[boundary].ec = ec;
e_devicemgr->relative_motion_grab.boundaries[boundary].resource = resource;
e_devicemgr->relative_motion_grab.grabbed_boundaries |= (1 << boundary);
- return EINA_TRUE;
+ return;
}
int
if (boundary <= 0 || boundary > E_DEVICEMGR_BOUNDARY_MAX)
return TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER;
- if (e_devicemgr->relative_motion_grab.boundaries[boundary].client &&
- e_devicemgr->relative_motion_grab.boundaries[boundary].client != client)
+ ec = e_client_from_surface_resource(surface);
+ if (!ec)
+ return TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_SURFACE;
+
+ if ((e_devicemgr->relative_motion_grab.boundaries[boundary].client &&
+ e_devicemgr->relative_motion_grab.boundaries[boundary].client != client) ||
+ (e_devicemgr->relative_motion_grab.boundaries[boundary].ec &&
+ e_devicemgr->relative_motion_grab.boundaries[boundary].ec != ec))
{
return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED;
}
- ec = e_client_from_surface_resource(surface);
- if (!ec)
- return TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_SURFACE;
+ // check if ec already grabs other boundary
+ if (_e_devicemgr_relative_motion_grabbed_boundary_get(client, ec) != 0)
+ return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED;
destroy_listener = E_NEW(struct wl_listener, 1);
if (!destroy_listener)
destroy_listener->notify = _e_devicemgr_relative_motion_grab_surface_cb_destroy;
wl_resource_add_destroy_listener(surface, destroy_listener);
- if (!_e_devicemgr_relative_motion_grab_surface_add(ec, boundary, client, resource))
- ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED;
+ _e_devicemgr_relative_motion_grab_surface_add(ec, boundary, client, resource);
return ret;
}
int ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
E_Client *ec;
unsigned int boundary;
+ struct wl_listener *destroy_listener = NULL;
ec = e_client_from_surface_resource(surface);
if (!ec)
boundary = _e_devicemgr_relative_motion_grabbed_boundary_get(client, ec);
if (boundary == 0)
- return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED;
+ return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED;
+
+ destroy_listener = wl_resource_get_destroy_listener(surface, _e_devicemgr_relative_motion_grab_surface_cb_destroy);
+ if (destroy_listener)
+ {
+ wl_list_remove(&destroy_listener->link);
+ E_FREE(destroy_listener);
+ }
- if (!_e_devicemgr_relative_motion_grab_surface_remove(ec, boundary))
- ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED;
+ _e_devicemgr_relative_motion_grab_surface_remove(ec, boundary);
return ret;
}