e_uuid_store: Switch uuid entries from list to array
This should help to store it in the shm
This commit is contained in:
parent
8662551ee3
commit
9523d7a93c
|
@ -25,8 +25,7 @@ void
|
||||||
e_uuid_dump(void)
|
e_uuid_dump(void)
|
||||||
{
|
{
|
||||||
struct uuid_table *table;
|
struct uuid_table *table;
|
||||||
struct table_entry *entry;
|
int i;
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
if (store == NULL) return;
|
if (store == NULL) return;
|
||||||
|
|
||||||
|
@ -34,8 +33,13 @@ e_uuid_dump(void)
|
||||||
if (table == NULL) return;
|
if (table == NULL) return;
|
||||||
|
|
||||||
INF("Dump UUID table:");
|
INF("Dump UUID table:");
|
||||||
EINA_LIST_FOREACH(table->entries, l, entry)
|
for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++)
|
||||||
INF("UUID %li, x=%i, y=%i, width=%i, heigth=%i", entry->uuid, entry->x, entry->y, entry->width, entry->heigth );
|
{
|
||||||
|
if (table->entries[i].uuid == 0) continue;
|
||||||
|
INF("UUID %li, x=%i, y=%i, width=%i, heigth=%i", table->entries[i].uuid, table->entries[i].x,
|
||||||
|
table->entries[i].y, table->entries[i].width,
|
||||||
|
table->entries[i].heigth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EINTERN int
|
EINTERN int
|
||||||
|
@ -104,8 +108,7 @@ Eina_Bool
|
||||||
e_uuid_store_entry_del(long uuid)
|
e_uuid_store_entry_del(long uuid)
|
||||||
{
|
{
|
||||||
struct uuid_table *table;
|
struct uuid_table *table;
|
||||||
struct table_entry *entry;
|
int i;
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
if (store == NULL) return EINA_FALSE;
|
if (store == NULL) return EINA_FALSE;
|
||||||
|
|
||||||
|
@ -113,12 +116,16 @@ e_uuid_store_entry_del(long uuid)
|
||||||
if (table == NULL) return EINA_FALSE;
|
if (table == NULL) return EINA_FALSE;
|
||||||
|
|
||||||
/* Search through uuid list and delete if found */
|
/* Search through uuid list and delete if found */
|
||||||
EINA_LIST_FOREACH(table->entries, l, entry)
|
for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++)
|
||||||
{
|
{
|
||||||
if (entry->uuid == uuid)
|
if (table->entries[i].uuid == uuid)
|
||||||
{
|
{
|
||||||
table->entries = eina_list_remove(table->entries, entry);
|
table->entries[i].uuid = 0;
|
||||||
free(entry);
|
table->entries[i].x = 0;
|
||||||
|
table->entries[i].x = 0;
|
||||||
|
table->entries[i].width = 0;
|
||||||
|
table->entries[i].heigth = 0;
|
||||||
|
table->entry_count--;
|
||||||
DBG("Removed entry with UUID %li", uuid);
|
DBG("Removed entry with UUID %li", uuid);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -133,8 +140,7 @@ Eina_Bool
|
||||||
e_uuid_store_entry_update(long uuid, E_Client *ec)
|
e_uuid_store_entry_update(long uuid, E_Client *ec)
|
||||||
{
|
{
|
||||||
struct uuid_table *table;
|
struct uuid_table *table;
|
||||||
struct table_entry *entry;
|
int i, index = -1;
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
if (store == NULL) return EINA_FALSE;
|
if (store == NULL) return EINA_FALSE;
|
||||||
|
|
||||||
|
@ -142,28 +148,39 @@ e_uuid_store_entry_update(long uuid, E_Client *ec)
|
||||||
if (table == NULL) return EINA_FALSE;
|
if (table == NULL) return EINA_FALSE;
|
||||||
|
|
||||||
/* Search through uuid list if it already exist if yes update */
|
/* Search through uuid list if it already exist if yes update */
|
||||||
EINA_LIST_FOREACH(table->entries, l, entry)
|
for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++)
|
||||||
{
|
{
|
||||||
if (entry->uuid == uuid)
|
if (table->entries[i].uuid == uuid)
|
||||||
{
|
{
|
||||||
entry->x = ec->x;
|
table->entries[i].x = ec->x;
|
||||||
entry->y = ec->y;
|
table->entries[i].y = ec->y;
|
||||||
entry->width = ec->client.w;
|
table->entries[i].width = ec->client.w;
|
||||||
entry->heigth = ec->client.h;
|
table->entries[i].heigth = ec->client.h;
|
||||||
DBG("Updated entry with UUID %li", uuid);
|
DBG("Updated entry with UUID %li", uuid);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find first empty entry */
|
||||||
|
for (i = 0; i < UUID_STORE_TABLE_SIZE -1; i++)
|
||||||
|
{
|
||||||
|
if (table->entries[i].uuid == 0)
|
||||||
|
index = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
ERR("UUID table full");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* We do not have this UUID in the table yet. Create it */
|
/* We do not have this UUID in the table yet. Create it */
|
||||||
entry = calloc(1, sizeof(struct table_entry));
|
table->entries[index].uuid = uuid;
|
||||||
entry->uuid = uuid;
|
table->entries[index].x = ec->x;
|
||||||
entry->x = ec->x;
|
table->entries[index].y = ec->y;
|
||||||
entry->y = ec->y;
|
table->entries[index].width = ec->client.w;
|
||||||
entry->width = ec->client.w;
|
table->entries[index].heigth = ec->client.h;
|
||||||
entry->heigth = ec->client.h;
|
table->entry_count++;
|
||||||
table->entries = eina_list_append(table->entries, entry);
|
|
||||||
table->entry_count = eina_list_count(table->entries);
|
|
||||||
DBG("Created entry with UUID %li", uuid);
|
DBG("Created entry with UUID %li", uuid);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
|
@ -4,12 +4,7 @@
|
||||||
/* vim:ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0
|
/* vim:ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct uuid_table {
|
#define UUID_STORE_TABLE_SIZE 100
|
||||||
int version; /* Version to allow future extensions */
|
|
||||||
unsigned int entry_count; /* Entry counter to allow excat memory consuptions needs? */
|
|
||||||
/* Global settings like current virtual desktop, screen setup, etc */
|
|
||||||
Eina_List *entries;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct table_entry {
|
struct table_entry {
|
||||||
long uuid;
|
long uuid;
|
||||||
|
@ -20,6 +15,13 @@ struct table_entry {
|
||||||
int flags;
|
int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct uuid_table {
|
||||||
|
int version; /* Version to allow future extensions */
|
||||||
|
unsigned int entry_count; /* Entry counter to allow excat memory consuptions needs? */
|
||||||
|
/* Global settings like current virtual desktop, screen setup, etc */
|
||||||
|
struct table_entry entries[UUID_STORE_TABLE_SIZE]; /* FIXME make this more adjustable */
|
||||||
|
};
|
||||||
|
|
||||||
struct uuid_store {
|
struct uuid_store {
|
||||||
struct uuid_table *table;
|
struct uuid_table *table;
|
||||||
int shmfd;
|
int shmfd;
|
||||||
|
|
Loading…
Reference in New Issue