Changeset efdfebc in mainline for uspace/lib/c/include/io/kbd_event.h


Ignore:
Timestamp:
2012-11-06T21:03:44Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
338810f
Parents:
de73242 (diff), 94795812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/kbd_event.h

    rde73242 refdfebc  
    11/*
    2  * Copyright (c) 2006 Jakub Jermar
    3  * Copyright (c) 2011 Radim Vansa
     2 * Copyright (c) 2012 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    3433 */
    3534
    36 #ifndef LIBC_HASH_SET_H_
    37 #define LIBC_HASH_SET_H_
     35#ifndef LIBC_IO_KBD_EVENT_H_
     36#define LIBC_IO_KBD_EVENT_H_
    3837
    3938#include <adt/list.h>
    40 #include <unistd.h>
     39#include <io/keycode.h>
    4140
    42 #define HASH_SET_MIN_SIZE  8
     41typedef enum {
     42        KEY_PRESS,
     43        KEY_RELEASE
     44} kbd_event_type_t;
    4345
    44 typedef unsigned long (*hash_set_hash)(const link_t *);
    45 typedef int (*hash_set_equals)(const link_t *, const link_t *);
    46 
    47 /** Hash table structure. */
     46/** Console event structure. */
    4847typedef struct {
    49         list_t *table;
     48        /** List handle */
     49        link_t link;
    5050       
    51         /** Current table size */
    52         size_t size;
     51        /** Press or release event. */
     52        kbd_event_type_t type;
    5353       
    54         /**
    55          * Current number of entries. If count > size,
    56          * the table is rehashed into table with double
    57          * size. If (4 * count < size) && (size > min_size),
    58          * the table is rehashed into table with half the size.
    59          */
    60         size_t count;
     54        /** Keycode of the key that was pressed or released. */
     55        keycode_t key;
    6156       
    62         /** Hash function */
    63         hash_set_hash hash;
     57        /** Bitmask of modifiers held. */
     58        keymod_t mods;
    6459       
    65         /** Hash table item equals function */
    66         hash_set_equals equals;
    67 } hash_set_t;
    68 
    69 extern int hash_set_init(hash_set_t *, hash_set_hash, hash_set_equals, size_t);
    70 extern int hash_set_insert(hash_set_t *, link_t *);
    71 extern link_t *hash_set_find(hash_set_t *, const link_t *);
    72 extern int hash_set_contains(const hash_set_t *, const link_t *);
    73 extern size_t hash_set_count(const hash_set_t *);
    74 extern link_t *hash_set_remove(hash_set_t *, const link_t *);
    75 extern void hash_set_remove_selected(hash_set_t *,
    76     int (*)(link_t *, void *), void *);
    77 extern void hash_set_destroy(hash_set_t *);
    78 extern void hash_set_apply(hash_set_t *, void (*)(link_t *, void *), void *);
    79 extern void hash_set_clear(hash_set_t *, void (*)(link_t *, void *), void *);
     60        /** The character that was generated or '\0' for none. */
     61        wchar_t c;
     62} kbd_event_t;
    8063
    8164#endif
Note: See TracChangeset for help on using the changeset viewer.