summaryrefslogtreecommitdiffstats
path: root/osdep/terminal-win.c
Commit message (Collapse)AuthorAgeFilesLines
* Set thread name for debuggingwm42014-10-191-0/+2
| | | | | | | | | | Especially with other components (libavcodec, OSX stuff), the thread list can get quite populated. Setting the thread name helps when debugging. Since this is not portable, we check the OS variants in waf configure. old-configure just gets a special-case for glibc, since doing a full check here would probably be a waste of effort.
* terminal-unix: move to threadwm42014-09-101-4/+0
| | | | | | | Do terminal input with a thread, instead of using the central select() loop. This also changes some details how SIGTERM is handled. Part of my crusade against mp_input_add_fd().
* terminal-win: minor simplificationwm42014-09-101-2/+2
| | | | Code should be equivalent.
* win32: correct SGR sequence handlingJames Ross-Gowan2014-08-241-5/+13
| | | | | | This should get colour working again on the Windows console. Fixes #1032.
* win32: correct HANDLE typeJames Ross-Gowan2014-08-241-2/+2
| | | | | The correct type is HANDLE, not HANDLE*, though this change shouldn't affect functionality.
* terminal-win: read input from a threadwm42014-08-211-27/+49
| | | | | | | | | Surprisingly, WaitFor* works on console handles. We can simply run the code for reading the console in a thread, and don't have to worry about crazy win32 crap in the rest of the player's input code anymore. This also fixes the issue that you couldn't unpause the player from the terminal, because the player would stop polling for input.
* terminal: some cleanupswm42014-08-211-35/+13
| | | | In particular, remove all the stupid debug printfs from the win code.
* terminal-win: remove nonsensical codewm42014-08-211-9/+0
| | | | | Something about a non-working MinGW thing? Really, I don't care. It also prevents using the console API properly.
* win32: emulate some ANSI terminal escape codeswm42014-08-211-9/+75
| | | | | | | | | | | | | | We already redirect all terminal output through our own wrappers (for the sake of UTF-8), so we might as well use it to handle ANSI escape codes. This also changes behavior on UNIX: we don't retrieve some escape codes per terminfo anymore, and just hardcode them. Every terminal should understand them. The advantage is that we can pretend to have a real terminal in the normal player code, and Windows atrocities are locked away in glue code.
* Remove the last remains of slave modewm42014-08-011-24/+1
| | | | | | | | | | | Almost nothing was left of it. The only thing this commit actually removes is support for reading input commands from stdin. But you can emulate this via: --input-file=/dev/stdin --input-terminal=no However, this won't work on Windows. Just use a named pipe.
* w32: use the w32_common keymap in terminal-win tooJames Ross-Gowan2014-01-191-40/+13
|
* io/win32: move mp_attach_console to terminal-win.cMartin Herkt2014-01-161-0/+17
| | | | Why didn't I put it there from the start?
* player: redo terminal OSD and status line handlingwm42014-01-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The terminal OSD code includes the handling of the terminal status line, showing player OSD messages on the terminal, and showing subtitles on terminal (the latter two only if there is no video window, or if terminal OSD is forced). This didn't handle some corner cases correctly. For example, showing an OSD message on the terminal always cleared the previous line, even if the line was an important message (or even just the command prompt, if most other messages were silenced). Attempt to handle this correctly by keeping track of how many lines the terminal OSD currently consists of. Since there could be race conditions with other messages being printed, implement this in msg.c. Now msg.c expects that MSGL_STATUS messages rewrite the status line, so the caller is forced to use a single mp_msg() call to set the status line. Instead of littering print_status() all over the place, update the status only once per playloop iteration in update_osd_msg(). In audio- only mode, the status line might now be a little bit off, but it's perhaps ok. Print the status line only if it has changed, or if another message was printed. This might help with extremely slow terminals, although in audio+video mode, it'll still be updated very often (A-V sync display changes on every frame). Instead of hardcoding the terminal sequences, use terminfo/termcap to get the sequences. Remove the --term-osd-esc option, which allowed to override the hardcoded escapes - it's useless now. The fallback for terminals with no escape sequences for moving the cursor and clearing a line is removed. This somewhat breaks status line display on these terminals, including the MS Windows console: instead of querying the terminal size and clearing the line manually by padding the output with spaces, the line is simply not cleared. I don't expect this to be a problem on UNIX, and on MS Windows we could emulate escape sequences. Note that terminal OSD (other than the status line) was broken anyway on these terminals. In osd.c, the function get_term_width() is not used anymore, so remove it. To remind us that the MS Windows console apparently adds a line break when writint the last column, adjust screen_width in terminal- win.c accordingly.
* input: rework how input sources are addedwm42013-12-211-5/+22
| | | | | | | | | | | | | | Until now, there were two functions to add input sources (stuff like stdin input, slave mode, lirc, joystick). Unify them to a single function (mp_input_add_fd()), and make sure the associated callbacks always have a context parameter. Change the lirc and joystick code such that they take store their state in a context struct (probably worthless), and use the new mp_msg replacements (the point of this refactoring). Additionally, get rid of the ugly USE_FD0_CMD_SELECT etc. ifdeffery in the terminal handling code.
* terminal: abstract terminal color handlingwm42013-12-201-5/+43
| | | | | | | | Instead of making msg.c an ifdef hell for unix vs. windows code, move the code to separate functions defined in terminal-unix.c/terminal- win.c. Drop the code that selects random colors for --msgmodule prefixes.
* Rename getch2....c/h to terminal....c/hwm42013-12-191-0/+194
"getch2" really tells nothing about what the heck this code does. It'd be even worse when moving the rest of terminal handling code there.