1 |
/* |
2 |
* PearPC |
3 |
* syskeyboard.cc - keyboard access functions for BeOS |
4 |
* |
5 |
* Copyright (C) 1999-2004 Stefan Weyergraf (stefan@weyergraf.de) |
6 |
* Copyright (C) 1999-2004 Sebastian Biallas (sb@biallas.net) |
7 |
* Copyright (C) 2004 Francois Revol (revol@free.fr) |
8 |
* |
9 |
* This program is free software; you can redistribute it and/or modify |
10 |
* it under the terms of the GNU General Public License version 2 as |
11 |
* published by the Free Software Foundation. |
12 |
* |
13 |
* This program is distributed in the hope that it will be useful, |
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
* GNU General Public License for more details. |
17 |
* |
18 |
* You should have received a copy of the GNU General Public License |
19 |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 |
*/ |
22 |
|
23 |
#include <cstdlib> |
24 |
|
25 |
#include <InterfaceDefs.h> |
26 |
|
27 |
#include "system/display.h" |
28 |
#include "system/keyboard.h" |
29 |
|
30 |
#define DPRINTF(a...) |
31 |
//#define DPRINTF(a...) ht_printf(a) |
32 |
|
33 |
class BeOSSystemKeyboard: public SystemKeyboard { |
34 |
public: |
35 |
virtual int getKeybLEDs() |
36 |
{ |
37 |
int r = 0; |
38 |
uint32 mods = modifiers(); |
39 |
if (mods & B_CAPS_LOCK) r |= KEYB_LED_NUM; |
40 |
if (mods & B_CAPS_LOCK) r |= KEYB_LED_CAPS; |
41 |
if (mods & B_SCROLL_LOCK) r |= KEYB_LED_SCROLL; |
42 |
return r; |
43 |
} |
44 |
|
45 |
virtual void setKeybLEDs(int leds) |
46 |
{ |
47 |
uint32 mods = 0; |
48 |
if (leds & KEYB_LED_NUM) mods |= B_CAPS_LOCK; |
49 |
if (leds & KEYB_LED_CAPS) mods |= B_CAPS_LOCK; |
50 |
if (leds & KEYB_LED_SCROLL) mods |= B_SCROLL_LOCK; |
51 |
// XXX: warning: set_keyboard_locks() doesn't work correctly |
52 |
set_keyboard_locks(mods); |
53 |
} |
54 |
|
55 |
virtual bool handleEvent(const SystemEvent &ev) |
56 |
{ |
57 |
return SystemKeyboard::handleEvent(ev); |
58 |
} |
59 |
}; |
60 |
|
61 |
SystemKeyboard *allocSystemKeyboard() |
62 |
{ |
63 |
if (gKeyboard) return NULL; |
64 |
return new BeOSSystemKeyboard(); |
65 |
} |