2 * getch2-os2.c : OS/2 TermIO for MPlayer
4 * Copyright (c) 2007 KO Myung-Hun (komh@chollian.net)
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer 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.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include "input/input.h"
36 #if defined(HAVE_LANGINFO) && defined(CONFIG_ICONV)
41 int mp_input_slave_cmd_func( int fd
, char *dest
, int size
)
44 CHAR szPipeName
[ 100 ];
50 DosGetInfoBlocks( NULL
, &ppib
);
52 sprintf( szPipeName
, "\\PIPE\\MPLAYER\\%lx", ppib
->pib_ulpid
);
54 rc
= DosOpen( szPipeName
, &hpipe
, &ulAction
, 0, FILE_NORMAL
,
55 OPEN_ACTION_OPEN_IF_EXISTS
,
56 OPEN_SHARE_DENYREADWRITE
| OPEN_ACCESS_READWRITE
,
59 return MP_INPUT_NOTHING
;
61 rc
= DosRead( hpipe
, dest
, size
, &cbActual
);
63 return MP_INPUT_NOTHING
;
68 DosWrite( hpipe
, &rc
, sizeof( ULONG
), &cbActual
);
76 int screen_width
= 80;
77 int screen_height
= 24;
78 char *erase_to_end_of_line
= NULL
;
80 void get_screen_size( void )
84 vmi
.cb
= sizeof( VIOMODEINFO
);
86 VioGetMode( &vmi
, 0 );
88 screen_width
= vmi
.col
;
89 screen_height
= vmi
.row
;
92 static int getch2_status
= 0;
94 static int getch2_internal( void )
101 if( KbdCharIn( &kki
, IO_NOWAIT
, 0 ))
108 if(( kki
.chChar
== 0x00 ) || ( kki
.chChar
== 0xE0 ))
124 case 0x53 : // Delete
127 case 0x52 : // Insert
136 case 0x49 : // Page Up
139 case 0x51 : // Page Down
140 return KEY_PAGE_DOWN
;
147 case 0x08 : // Backspace
155 if( kki
.chScan
== 0xE0 )
167 void getch2(struct mp_fifo
*fifo
)
171 key
= getch2_internal();
173 mplayer_put_key(fifo
, key
);
176 void getch2_enable( void )
181 void getch2_disable( void )
187 char *get_term_charset( void )
189 char *charset
= NULL
;
192 setlocale( LC_CTYPE
, "");
193 charset
= nl_langinfo( CODESET
);
194 setlocale( LC_CTYPE
, "C");