2002-12-16 16:00:38 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
|
|
|
|
/* private calls */
|
|
|
|
|
|
|
|
static int
|
2008-02-08 13:42:01 -08:00
|
|
|
evas_key_modifier_number(const Evas_Modifier *m, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
int i;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
for (i = 0; i < m->mod.count; i++)
|
|
|
|
{
|
|
|
|
if (!strcmp(m->mod.list[i], keyname)) return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2008-02-08 13:42:01 -08:00
|
|
|
evas_key_lock_number(const Evas_Lock *l, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
int i;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
for (i = 0; i < l->lock.count; i++)
|
|
|
|
{
|
|
|
|
if (!strcmp(l->lock.list[i], keyname)) return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* local calls */
|
|
|
|
|
|
|
|
/* public calls */
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Returns a handle to the modifiers available in the system. This is required to check
|
|
|
|
* for modifiers with the evas_key_modifier_is_set_get function.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_modifier_add
|
|
|
|
* @see evas_key_modifier_del
|
|
|
|
* @see evas_key_modifier_on
|
|
|
|
* @see evas_key_modifier_off
|
|
|
|
* @see evas_key_modifier_is_set_get
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
*
|
|
|
|
* @return An Evas_Modifier handle to query the modifier subsystem with
|
|
|
|
* evas_key_modifier_is_set_get, or NULL on error.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2008-02-08 13:42:01 -08:00
|
|
|
EAPI const Evas_Modifier *
|
|
|
|
evas_key_modifier_get(const Evas *e)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2002-12-16 16:00:38 -08:00
|
|
|
return &(e->modifiers);
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Returns a handle to the locks available in the system. This is required to check for
|
|
|
|
* locks with the evas_key_lock_is_set_get function.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_lock_add
|
|
|
|
* @see evas_key_lock_del
|
|
|
|
* @see evas_key_lock_on
|
|
|
|
* @see evas_key_lock_off
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_lock_is_set_get
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
*
|
|
|
|
* @return An Evas_Lock handle to query the lock subsystem with
|
|
|
|
* evas_key_lock_is_set_get, or NULL on error.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2008-02-08 13:42:01 -08:00
|
|
|
EAPI const Evas_Lock *
|
|
|
|
evas_key_lock_get(const Evas *e)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return &(e->locks);
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Checks the state of a given modifier. If the modifier is set, such as shift being pressed
|
|
|
|
* this function returns true.
|
|
|
|
*
|
|
|
|
* @see evas_key_modifier_add
|
|
|
|
* @see evas_key_modifier_del
|
|
|
|
* @see evas_key_modifier_get
|
|
|
|
* @see evas_key_modifier_on
|
|
|
|
* @see evas_key_modifier_off
|
|
|
|
*
|
|
|
|
* @param m The current modifier set as returned by evas_key_modifier_get.
|
|
|
|
* @param keyname The name of the key to check its status.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @return 1 if the @p keyname is on, 0 otherwise.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2005-05-03 01:02:29 -07:00
|
|
|
evas_key_modifier_is_set(Evas_Modifier *m, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
2002-12-17 22:02:32 -08:00
|
|
|
Evas_Modifier_Mask num;
|
2003-10-17 20:34:00 -07:00
|
|
|
int n;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
if (!m) return 0;
|
|
|
|
if (!keyname) return 0;
|
2003-10-17 20:34:00 -07:00
|
|
|
n = evas_key_modifier_number(m, keyname);
|
|
|
|
if (n < 0) return 0;
|
|
|
|
num = (Evas_Modifier_Mask)n;
|
2002-12-16 16:00:38 -08:00
|
|
|
num = 1 << num;
|
|
|
|
if (m->mask & num) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Checks the state of a given lock. If the lock is set, such as caps lock, this function
|
|
|
|
* returns true.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_lock_get
|
|
|
|
* @see evas_key_lock_add
|
|
|
|
* @see evas_key_lock_del
|
|
|
|
* @see evas_key_lock_on
|
|
|
|
* @see evas_key_lock_off
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @param l The current lock set as returned by evas_key_lock_get.
|
|
|
|
* @param keyname The name of the lock to add the the list.
|
|
|
|
*
|
|
|
|
* @param 1 if the @p keyname kock is set, 0 otherwise.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Bool
|
2005-05-03 01:02:29 -07:00
|
|
|
evas_key_lock_is_set(Evas_Lock *l, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
2002-12-17 22:02:32 -08:00
|
|
|
Evas_Modifier_Mask num;
|
2003-10-17 20:34:00 -07:00
|
|
|
int n;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
if (!l) return 0;
|
|
|
|
if (!keyname) return 0;
|
2003-10-17 20:34:00 -07:00
|
|
|
n = evas_key_lock_number(l, keyname);
|
|
|
|
if (n < 0) return 0;
|
|
|
|
num = (Evas_Modifier_Mask)n;
|
2002-12-16 16:00:38 -08:00
|
|
|
num = 1 << num;
|
|
|
|
if (l->mask & num) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Adds the @p keyname to the current list of modifiers.
|
|
|
|
*
|
|
|
|
* Modifiers can be keys like shift, alt and ctrl, as well as user defined. This allows
|
|
|
|
* custom modifiers to be added to the evas system as run time. It is then possible to set
|
|
|
|
* and unset the modifier for other parts of the program to check and act on.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_modifier_del
|
|
|
|
* @see evas_key_modifier_get
|
|
|
|
* @see evas_key_modifier_on
|
|
|
|
* @see evas_key_modifier_off
|
|
|
|
* @see evas_key_modifier_is_set_get
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the modifier to add to the list.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_modifier_add(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (!keyname) return;
|
|
|
|
if (e->modifiers.mod.count >= 64) return;
|
|
|
|
evas_key_modifier_del(e, keyname);
|
|
|
|
e->modifiers.mod.count++;
|
|
|
|
e->modifiers.mod.list = realloc(e->modifiers.mod.list, e->modifiers.mod.count * sizeof(char *));
|
|
|
|
e->modifiers.mod.list[e->modifiers.mod.count - 1] = strdup(keyname);
|
|
|
|
e->modifiers.mask = 0;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Removes the @p keyname from the current list of modifiers.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_modifier_add
|
|
|
|
* @see evas_key_modifier_get
|
|
|
|
* @see evas_key_modifier_on
|
|
|
|
* @see evas_key_modifier_off
|
|
|
|
* @see evas_key_modifier_is_set_get
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the key to remove from the modifiers list.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_modifier_del(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
int i;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (!keyname) return;
|
|
|
|
for (i = 0; i < e->modifiers.mod.count; i++)
|
|
|
|
{
|
|
|
|
if (!strcmp(e->modifiers.mod.list[i], keyname))
|
|
|
|
{
|
|
|
|
int j;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
free(e->modifiers.mod.list[i]);
|
|
|
|
e->modifiers.mod.count--;
|
|
|
|
for (j = i; j < e->modifiers.mod.count; j++)
|
|
|
|
e->modifiers.mod.list[j] = e->modifiers.mod.list[j + 1];
|
|
|
|
e->modifiers.mask = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Adds the @p keyname to the current list of locks.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* Locks can be keys like caps lock, num lock or scroll lock, as well as user defined. This
|
|
|
|
* allows custom locks to be added to the evas system at run time. It is then possible to
|
|
|
|
* set and unset the lock for other parts of the program to check and act on.
|
|
|
|
*
|
|
|
|
* @see evas_key_lock_get
|
|
|
|
* @see evas_key_lock_del
|
|
|
|
* @see evas_key_lock_on
|
|
|
|
* @see evas_key_lock_off
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the key to remove from the modifier list.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_lock_add(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2002-12-16 16:00:38 -08:00
|
|
|
if (!keyname) return;
|
|
|
|
if (e->locks.lock.count >= 64) return;
|
|
|
|
evas_key_lock_del(e, keyname);
|
|
|
|
e->locks.lock.count++;
|
|
|
|
e->locks.lock.list = realloc(e->locks.lock.list, e->locks.lock.count * sizeof(char *));
|
|
|
|
e->locks.lock.list[e->locks.lock.count - 1] = strdup(keyname);
|
|
|
|
e->locks.mask = 0;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Removes The @p keyname from the current list of locks.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_lock_get
|
|
|
|
* @see evas_key_lock_add
|
|
|
|
* @see evas_key_lock_on
|
|
|
|
* @see evas_key_lock_off
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the key to remove from the lock list.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_lock_del(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
int i;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2002-12-16 16:00:38 -08:00
|
|
|
if (!keyname) return;
|
|
|
|
e->locks.mask = 0;
|
|
|
|
for (i = 0; i < e->locks.lock.count; i++)
|
|
|
|
{
|
|
|
|
if (!strcmp(e->locks.lock.list[i], keyname))
|
|
|
|
{
|
|
|
|
int j;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
free(e->locks.lock.list[i]);
|
|
|
|
e->locks.lock.count--;
|
|
|
|
for (j = i; j < e->locks.lock.count; j++)
|
|
|
|
e->locks.lock.list[j] = e->locks.lock.list[j + 1];
|
|
|
|
e->locks.mask = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Enables or turns on the modifier with name @p keyname.
|
|
|
|
*
|
|
|
|
* @see evas_key_modifier_add
|
|
|
|
* @see evas_key_modifier_get
|
|
|
|
* @see evas_key_modifier_off
|
|
|
|
* @see evas_key_modifier_is_set_get
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the modifier to set.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_modifier_on(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
2002-12-17 22:02:32 -08:00
|
|
|
Evas_Modifier_Mask num;
|
2003-10-17 20:34:00 -07:00
|
|
|
int n;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2003-10-17 20:34:00 -07:00
|
|
|
n = (Evas_Modifier_Mask)evas_key_modifier_number(&(e->modifiers), keyname);
|
|
|
|
if (n < 0) return;
|
|
|
|
num = (Evas_Modifier_Mask)n;
|
2002-12-16 16:00:38 -08:00
|
|
|
num = 1 << num;
|
|
|
|
e->modifiers.mask |= num;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Disables or turns off the modifier with name @p keyname.
|
|
|
|
*
|
|
|
|
* @see evas_key_modifier_add
|
|
|
|
* @see evas_key_modifier_get
|
|
|
|
* @see evas_key_modifier_on
|
|
|
|
* @see evas_key_modifier_is_set_get
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the modifier to un-set.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_modifier_off(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
2002-12-17 22:02:32 -08:00
|
|
|
Evas_Modifier_Mask num;
|
2003-10-17 20:34:00 -07:00
|
|
|
int n;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2003-10-17 20:34:00 -07:00
|
|
|
n = evas_key_modifier_number(&(e->modifiers), keyname);
|
|
|
|
if (n < 0) return;
|
|
|
|
num = (Evas_Modifier_Mask)n;
|
2002-12-16 16:00:38 -08:00
|
|
|
num = 1 << num;
|
|
|
|
e->modifiers.mask &= ~num;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Enables or turns on the lock with name @p keyname.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_lock_get
|
|
|
|
* @see evas_key_lock_add
|
|
|
|
* @see evas_key_lock_del
|
|
|
|
* @see evas_key_lock_off
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the lock to set.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_lock_on(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
2002-12-17 22:02:32 -08:00
|
|
|
Evas_Modifier_Mask num;
|
2003-10-17 20:34:00 -07:00
|
|
|
int n;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2003-10-17 20:34:00 -07:00
|
|
|
n = evas_key_lock_number(&(e->locks), keyname);
|
|
|
|
if (n < 0) return;
|
|
|
|
num = (Evas_Modifier_Mask)n;
|
2002-12-16 16:00:38 -08:00
|
|
|
num = 1 << num;
|
|
|
|
e->locks.mask |= num;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Disables or turns off the lock with name @p keyname.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_lock_get
|
|
|
|
* @see evas_key_lock_add
|
|
|
|
* @see evas_key_lock_del
|
|
|
|
* @see evas_key_lock_on
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param keyname The name of the lock to un-set.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2003-01-09 20:58:51 -08:00
|
|
|
evas_key_lock_off(Evas *e, const char *keyname)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
2002-12-17 22:02:32 -08:00
|
|
|
Evas_Modifier_Mask num;
|
2003-10-17 20:34:00 -07:00
|
|
|
int n;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2003-10-17 20:34:00 -07:00
|
|
|
n = evas_key_lock_number(&(e->locks), keyname);
|
|
|
|
if (n < 0) return;
|
|
|
|
num = (Evas_Modifier_Mask)n;
|
2002-12-16 16:00:38 -08:00
|
|
|
num = 1 << num;
|
|
|
|
e->locks.mask &= ~num;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* errr need to add key grabbing/ungrabbing calls - missing modifier stuff. */
|
2002-12-17 22:02:32 -08:00
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2007-06-04 02:48:28 -07:00
|
|
|
* Creates a bit mask from the @p keyname for use with events to check for the presence
|
|
|
|
* of the @p keyname modifier.
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @see evas_key_modifier_add
|
|
|
|
* @see evas_key_modifier_get
|
|
|
|
* @see evas_key_modifier_on
|
|
|
|
* @see evas_key_modifier_off
|
|
|
|
* @see evas_key_modifier_is_set_get
|
|
|
|
*
|
|
|
|
* @param keyname The name of the modifier to create the mask for.
|
2005-05-21 19:49:50 -07:00
|
|
|
*
|
2007-06-04 02:48:28 -07:00
|
|
|
* @returns the bit mask or 0 if the @p keyname wasn't registered as a modifier.
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Modifier_Mask
|
2008-02-08 13:42:01 -08:00
|
|
|
evas_key_modifier_mask_get(const Evas *e, const char *keyname)
|
2002-12-17 22:02:32 -08:00
|
|
|
{
|
|
|
|
Evas_Modifier_Mask num;
|
2003-10-17 20:34:00 -07:00
|
|
|
int n;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-12-17 22:02:32 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (!keyname) return 0;
|
2003-10-17 20:34:00 -07:00
|
|
|
n = evas_key_modifier_number(&(e->modifiers), keyname);
|
|
|
|
if (n < 0) return 0;
|
|
|
|
num = (Evas_Modifier_Mask)n;
|
2002-12-17 22:02:32 -08:00
|
|
|
return 1 << num;
|
|
|
|
}
|