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"
35 #if defined(HAVE_LANGINFO) && defined(CONFIG_ICONV)
40 int mp_input_slave_cmd_func( int fd
, char *dest
, int size
)
43 CHAR szPipeName
[ 100 ];
49 DosGetInfoBlocks( NULL
, &ppib
);
51 sprintf( szPipeName
, "\\PIPE\\MPLAYER\\%lx", ppib
->pib_ulpid
);
53 rc
= DosOpen( szPipeName
, &hpipe
, &ulAction
, 0, FILE_NORMAL
,
54 OPEN_ACTION_OPEN_IF_EXISTS
,
55 OPEN_SHARE_DENYREADWRITE
| OPEN_ACCESS_READWRITE
,
58 return MP_INPUT_NOTHING
;
60 rc
= DosRead( hpipe
, dest
, size
, &cbActual
);
62 return MP_INPUT_NOTHING
;
67 DosWrite( hpipe
, &rc
, sizeof( ULONG
), &cbActual
);
75 int screen_width
= 80;
76 int screen_height
= 24;
77 char *erase_to_end_of_line
= NULL
;
79 void get_screen_size( void )
83 vmi
.cb
= sizeof( VIOMODEINFO
);
85 VioGetMode( &vmi
, 0 );
87 screen_width
= vmi
.col
;
88 screen_height
= vmi
.row
;
91 static int getch2_status
= 0;
93 static int getch2_internal( void )
100 if( KbdCharIn( &kki
, IO_NOWAIT
, 0 ))
107 if(( kki
.chChar
== 0x00 ) || ( kki
.chChar
== 0xE0 ))
123 case 0x53 : // Delete
126 case 0x52 : // Insert
135 case 0x49 : // Page Up
138 case 0x51 : // Page Down
139 return KEY_PAGE_DOWN
;
146 case 0x08 : // Backspace
154 if( kki
.chScan
== 0xE0 )
170 key
= getch2_internal();
172 mplayer_put_key( key
);
175 void getch2_enable( void )
180 void getch2_disable( void )
186 char *get_term_charset( void )
188 char *charset
= NULL
;
191 setlocale( LC_CTYPE
, "");
192 charset
= nl_langinfo( CODESET
);
193 setlocale( LC_CTYPE
, "C");