ui_x11 use press_key() and release_key() too now
This commit is contained in:
parent
091556e9ad
commit
69e70b70ce
1 changed files with 5 additions and 33 deletions
38
src/ui_x11.c
38
src/ui_x11.c
|
@ -2382,40 +2382,12 @@ int CreateWindows( int argc, char** argv )
|
|||
|
||||
int key_event( int b, XEvent* xev )
|
||||
{
|
||||
int code;
|
||||
int i, r, c;
|
||||
if ( xev->type == KeyPress )
|
||||
press_key( b );
|
||||
else
|
||||
release_key( b );
|
||||
|
||||
code = keyboard[ b ].code;
|
||||
if ( xev->type == KeyPress ) {
|
||||
keyboard[ b ].pressed = 1;
|
||||
DrawButton( b );
|
||||
if ( code == 0x8000 ) {
|
||||
for ( i = 0; i < 9; i++ )
|
||||
saturn.keybuf.rows[ i ] |= 0x8000;
|
||||
do_kbd_int();
|
||||
} else {
|
||||
r = code >> 4;
|
||||
c = 1 << ( code & 0xf );
|
||||
if ( ( saturn.keybuf.rows[ r ] & c ) == 0 ) {
|
||||
if ( saturn.kbd_ien ) {
|
||||
do_kbd_int();
|
||||
}
|
||||
saturn.keybuf.rows[ r ] |= c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( code == 0x8000 ) {
|
||||
for ( i = 0; i < 9; i++ )
|
||||
saturn.keybuf.rows[ i ] &= ~0x8000;
|
||||
memset( &saturn.keybuf, 0, sizeof( saturn.keybuf ) );
|
||||
} else {
|
||||
r = code >> 4;
|
||||
c = 1 << ( code & 0xf );
|
||||
saturn.keybuf.rows[ r ] &= ~c;
|
||||
}
|
||||
keyboard[ b ].pressed = 0;
|
||||
DrawButton( b );
|
||||
}
|
||||
DrawButton( b );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue