1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00
elinks/src/osdep/osdep.h

83 lines
2.1 KiB
C
Raw Normal View History

#ifndef EL__OSDEP_OSDEP_H
#define EL__OSDEP_OSDEP_H
#include "osdep/beos/beos.h"
#include "osdep/os2/os2.h"
#include "osdep/riscos/riscos.h"
#include "osdep/unix/unix.h"
#include "osdep/win32/win32.h"
2006-07-02 10:30:41 -04:00
#ifndef CHAR_DIR_SEP
#define CHAR_DIR_SEP '/'
#endif
#ifndef STRING_DIR_SEP
#define STRING_DIR_SEP "/"
#endif
int get_system_env(void);
int get_e(unsigned char *env);
int is_xterm(void);
int is_twterm(void);
void get_terminal_size(int, int *, int *);
void handle_terminal_resize(int, void (*)(void));
void unhandle_terminal_resize(int);
void set_bin(int);
int c_pipe(int *);
int get_input_handle(void);
int get_output_handle(void);
int get_ctl_handle(void);
void want_draw(void);
void done_draw(void);
void init_osdep(void);
void terminate_osdep(void);
void *handle_mouse(int, void (*)(void *, unsigned char *, int), void *);
void unhandle_mouse(void *);
void suspend_mouse(void *);
void resume_mouse(void *);
int start_thread(void (*)(void *, int), void *, int);
unsigned char *get_clipboard_text(void);
void set_clipboard_text(unsigned char *);
Bug 885: Proper charset support in xterm window title When ELinks runs in an X11 terminal emulator (e.g. xterm), or in GNU Screen, it tries to update the title of the window to match the title of the current document. To do this, ELinks sends an "OSC 1 ; Pt BEL" sequence to the terminal. Unfortunately, xterm expects the Pt string to be in the ISO-8859-1 charset, making it impossible to display e.g. Cyrillic characters. In xterm patch #210 (2006-03-12) however, there is a menu item and a resource that can make xterm take the Pt string in UTF-8 instead, allowing characters from all around the world. The downside is that ELinks apparently cannot ask xterm whether the setting is on or off; so add a terminal._template_.latin1_title option to ELinks and let the user edit that instead. Complete list of changes: - Add the terminal._template_.latin1_title option. But do not add that to the terminal options window because it's already rather crowded there. - In set_window_title(), take a new codepage argument. Use it to decode the title into Unicode characters, and remove only actual control characters. For example, CP437 has graphical characters in the 0x80...0x9F range, so don't remove those, even though ISO-8859-1 has control characters in the same range. Likewise, don't misinterpret single bytes of UTF-8 characters as control characters. - In set_window_title(), do not truncate the title to the width of the window. The font is likely to be different and proportional anyway. But do truncate before 1024 bytes, an xterm limit. - In struct itrm, add a title_codepage member to remember which charset the master said it was going to use in the terminal window title. Initialize title_codepage in handle_trm(), update it in dispatch_special() if the master sends the new request TERM_FN_TITLE_CODEPAGE, and use it in most set_window_title() calls; but not in the one that sets $TERM as the title, because that string was not received from the master and should consist of ASCII characters only. - In set_terminal_title(), convert the caller-provided title to ISO-8859-1 or UTF-8 if appropriate, and report the codepage to the slave with the new TERM_FN_TITLE_CODEPAGE request. The conversion can run out of memory, so return a success/error flag, rather than void. In display_window_title(), check this result and don't update caches on error. - Add a NEWS entry for all of this.
2008-12-28 20:09:53 -05:00
void set_window_title(unsigned char *, int codepage);
unsigned char *get_window_title(int codepage);
void block_stdin(void);
void unblock_stdin(void);
int exe(unsigned char *);
int resize_window(int, int, int, int);
int can_resize_window(int);
int can_open_os_shell(int);
void set_highpri(void);
#ifdef USE_OPEN_PREALLOC
int open_prealloc(char *, int, int, off_t);
void prealloc_truncate(int, off_t);
#else
static inline void prealloc_truncate(int x, int y) { }
#endif
unsigned char *get_system_str(int);
int set_nonblocking_fd(int);
int set_blocking_fd(int);
void set_ip_tos_throughput(int socket);
unsigned char *get_cwd(void);
void set_cwd(unsigned char *);
unsigned char *get_shell(void);
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
/* We define own cfmakeraw() wrapper because cfmakeraw() is broken on AIX,
* thus we fix it right away. We can also emulate cfmakeraw() if it is not
* available at all. Face it, we are just cool. */
void elinks_cfmakeraw(struct termios *t);
#ifndef user_appdata_directory
#define user_appdata_directory() NULL
#endif
#endif