Subversion Repositories HelenOS

Rev

Rev 4035 | Rev 4153 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4035 Rev 4036
Line 25... Line 25...
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup kbd
29
/** @addtogroup kbd
30
 * @brief   US Dvorak Simplified Keyboard layout.
30
 * @brief US Dvorak Simplified Keyboard layout.
31
 * @{
31
 * @{
32
 */
32
 */
33
 
33
 
34
#include <kbd.h>
34
#include <kbd.h>
35
#include <kbd/kbd.h>
35
#include <kbd/kbd.h>
36
#include <kbd/keycode.h>
36
#include <kbd/keycode.h>
37
#include <layout.h>
37
#include <layout.h>
Line 190... Line 190...
190
    [KC_NPERIOD] = '.'
190
    [KC_NPERIOD] = '.'
191
};
191
};
192
 
192
 
193
static int translate(unsigned int key, char *map, size_t map_length)
193
static int translate(unsigned int key, char *map, size_t map_length)
194
{
194
{
195
    if (key >= map_length) return 0;
195
    if (key >= map_length)
-
 
196
        return 0;
196
    return map[key];   
197
    return map[key];
197
}
198
}
198
 
199
 
199
char layout_parse_ev(kbd_event_t *ev)
200
char layout_parse_ev(kbd_event_t *ev)
200
{
201
{
201
    char c;
202
    char c;
Line 203... Line 204...
203
    /* Produce no characters when Ctrl or Alt is pressed. */
204
    /* Produce no characters when Ctrl or Alt is pressed. */
204
    if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
205
    if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
205
        return 0;
206
        return 0;
206
 
207
 
207
    c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char));
208
    c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char));
208
    if (c != 0) return c;
209
    if (c != 0)
-
 
210
        return c;
209
 
211
 
210
    if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
212
    if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
211
        c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char));
213
        c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char));
212
    else
214
    else
213
        c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char));
215
        c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char));
214
 
216
 
215
    if (c != 0) return c;
217
    if (c != 0)
-
 
218
        return c;
216
 
219
 
217
    if ((ev->mods & KM_SHIFT) != 0)
220
    if ((ev->mods & KM_SHIFT) != 0)
218
        c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char));
221
        c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char));
219
    else
222
    else
220
        c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char));
223
        c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char));
221
 
224
 
222
    if (c != 0) return c;
225
    if (c != 0)
-
 
226
        return c;
223
 
227
 
224
    if ((ev->mods & KM_NUM_LOCK) != 0)
228
    if ((ev->mods & KM_NUM_LOCK) != 0)
225
        c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char));
229
        c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char));
226
    else
230
    else
227
        c = 0;
231
        c = 0;
Line 229... Line 233...
229
    return c;
233
    return c;
230
}
234
}
231
 
235
 
232
/**
236
/**
233
 * @}
237
 * @}
234
 */
238
 */