libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Classes | Typedefs | Enumerations | Functions | Variables
t3_widget Namespace Reference

The t3_widget namespace is contains all classes, functions and global variables in the libt3widget library. More...

Classes

class  attribute_picker_dialog_t
 
class  attribute_test_line_t
 
struct  attributes_t
 
class  autocompleter_t
 
class  bad_draw_recheck_t
 Base class for widgets that need handle user text and draw differently based on the t3_win_can_draw function. More...
 
class  bullet_t
 Class implementing a bullet driven by a boolean valued callback. More...
 
class  button_t
 Button widget. More...
 
class  center_component_t
 Base class for components which need to center dialogs. More...
 
class  checkbox_t
 Class implementing a checkbox. More...
 
class  cleanup_ptr_base
 
class  cleanup_ptr_base< T[], D >
 
class  color_pair_picker_t
 
class  color_picker_base_t
 
class  color_picker_t
 
class  complex_error_t
 A class representing an error from one of the supporting libraries. More...
 
class  container_t
 Base class for window_component_t's that are the parents of other window_component_t's. More...
 
struct  delete_functor
 
struct  delete_functor< T[]>
 
class  dialog_base_t
 
class  dialog_t
 Base class for dialogs. More...
 
class  dummy_widget_t
 A widget that does not actually show anything on screen. More...
 
class  edit_window_t
 Class implementing an edit widget. More...
 
class  ensure_clipboard_lock_t
 
class  expander_group_t
 A class to group a set of expander widgets such that at most one is expanded at a time. More...
 
class  expander_t
 A widget showing an expander, which allows hiding another widget. More...
 
struct  extclipboard_interface_t
 
class  file_dialog_t
 
class  file_list_t
 Abstract base class for file lists. More...
 
class  file_name_list_t
 Implementation of the file_list_t interface. More...
 
class  file_pane_t
 A widget displaying the contents of a directory. More...
 
class  filtered_file_list_t
 Filted file list implementation. More...
 
class  filtered_list_base_t
 Abstract base class for filtered string and file lists. More...
 
class  filtered_list_internal_t
 Partial implementation of the filtered list. More...
 
class  filtered_list_t
 Generic filtered list template. More...
 
class  filtered_list_t< string_list_base_t >
 Specialized filtered list template for string_list_base_t. More...
 
class  find_dialog_t
 
struct  find_result_t
 A struct holding the result of a find operation. More...
 
class  finder_t
 Class holding the context of a find operation. More...
 
class  focus_widget_t
 Base class for widgets that take focus. More...
 
class  frame_t
 A widget showing a frame. More...
 
struct  free_func
 
struct  free_func2
 
class  goto_dialog_t
 
struct  incr_send_data_t
 
class  init_parameters_t
 Structure holding the parameters for initialization for libt3widget. More...
 
class  input_selection_dialog_t
 
class  insert_char_dialog_t
 
class  item_buffer_t
 Class implmementing a mutex-protected queue of items. More...
 
class  key_buffer_t
 Class implmementing a mutex-protected queue of key symbols. More...
 
struct  key_sequence_t
 
struct  key_string_t
 
struct  kp_mapping_t
 
class  label_t
 A widget displaying a text. More...
 
class  linked_ptr_base
 
class  linked_ptr_base< T[], D >
 
class  list_base_t
 Abstract base class for string and file lists and filtered lists. More...
 
class  list_pane_t
 
struct  main_loop_exit_t
 
class  main_window_base_t
 Base class for the application's main window. More...
 
struct  mapping_t
 
class  menu_bar_t
 Class implementing a menu bar. More...
 
class  menu_item_base_t
 
class  menu_item_t
 
class  menu_panel_t
 
class  menu_separator_t
 
class  message_dialog_t
 
struct  mouse_event_t
 Structure holding the relevant elements of a mouse event. More...
 
class  mouse_target_t
 
class  multi_widget_t
 
class  open_file_dialog_t
 
class  optional
 Class defining values with a separate validity check. More...
 
class  pimpl_ptr_base
 
class  popup_t
 Base class for dialogs. More...
 
class  replace_buttons_dialog_t
 
class  save_as_dialog_t
 
class  scrollbar_t
 
class  separator_t
 
class  smart_label_t
 
class  smart_label_text_t
 
class  smartptr_base
 
class  split_t
 A widget that can contain multiple other widgets. More...
 
class  string_list_base_t
 Abstract base class for string and file lists, but not for filtered lists. More...
 
class  string_list_t
 Implementation of a string list. More...
 
class  string_matcher_t
 
struct  terminal_mapping_t
 
class  text_buffer_t
 
struct  text_coordinate_t
 
class  text_field_t
 
class  text_line_factory_t
 
class  text_line_t
 
class  text_window_t
 
class  undo_double_text_t
 
class  undo_double_text_triple_coord_t
 
class  undo_list_t
 
class  undo_single_text_double_coord_t
 
class  undo_single_text_t
 
class  undo_t
 
class  widget_container_t
 
class  widget_group_t
 A widget aggregating several widgets into a single widget. More...
 
class  widget_t
 Base class for widgets. More...
 
class  window_component_t
 Abstract base class for all items displayed on screen. More...
 
class  wrap_info_t
 Class holding information about wrapping a text_buffer_t. More...
 

Typedefs

typedef cleanup_func_ptr
< t3_window_t, t3_win_del >::t 
cleanup_t3_window_ptr
 
typedef std::list
< dialog_base_t * > 
dialog_base_list_t
 
typedef std::list< dialog_t * > dialogs_t
 
typedef filtered_list_t
< string_list_base_t
filtered_string_list_t
 Special name for filtered string lists. More...
 
typedef list< incr_send_data_tincr_send_list_t
 
typedef long key_t
 Integer type holding a single key symbol. More...
 
typedef std::vector
< text_line_t * > 
lines_t
 
typedef item_buffer_t
< mouse_event_t
mouse_event_buffer_t
 
typedef optional< int > optint
 
typedef std::deque< widget_t * > widgets_t
 
typedef std::vector
< wrap_points_t * > 
wrap_data_t
 
typedef std::vector< int > wrap_points_t
 
typedef xcb_atom_t x11_atom_t
 
typedef xcb_generic_event_t x11_event_t
 
typedef xcb_property_notify_event_t x11_property_event_t
 
typedef xcb_selection_clear_event_t x11_selection_clear_event_t
 
typedef
xcb_selection_notify_event_t 
x11_selection_event_t
 
typedef
xcb_selection_request_event_t 
x11_selection_request_event_t
 
typedef xcb_timestamp_t x11_time_t
 
typedef xcb_window_t x11_window_t
 

Enumerations

enum  { CLASS_WHITESPACE, CLASS_ALNUM, CLASS_GRAPH, CLASS_OTHER }
 
enum  { WINCH_SIGNAL, QUIT_SIGNAL }
 
enum  {
  CLIPBOARD, PRIMARY, TARGETS, TIMESTAMP,
  MULTIPLE, UTF8_STRING, GDK_SELECTION, INCR,
  ATOM, ATOM_PAIR
}
 
enum  { EKEY_FIRST_SPECIAL }
 
enum  {
  EKEY_IGNORE, EKEY_END, EKEY_HOME, EKEY_PGUP,
  EKEY_PGDN, EKEY_LEFT, EKEY_RIGHT, EKEY_UP,
  EKEY_DOWN, EKEY_DEL, EKEY_INS, EKEY_BS,
  EKEY_NL, EKEY_KP_CENTER, EKEY_KP_END, EKEY_KP_HOME,
  EKEY_KP_PGUP, EKEY_KP_PGDN, EKEY_KP_LEFT, EKEY_KP_RIGHT,
  EKEY_KP_UP, EKEY_KP_DOWN, EKEY_KP_DEL, EKEY_KP_INS,
  EKEY_KP_NL, EKEY_KP_DIV, EKEY_KP_MUL, EKEY_KP_PLUS,
  EKEY_KP_MINUS, EKEY_F1, EKEY_F2, EKEY_F3,
  EKEY_F4, EKEY_F5, EKEY_F6, EKEY_F7,
  EKEY_F8, EKEY_F9, EKEY_F10, EKEY_F11,
  EKEY_F12, EKEY_F13, EKEY_F14, EKEY_F15,
  EKEY_F16, EKEY_F17, EKEY_F18, EKEY_F19,
  EKEY_F20, EKEY_F21, EKEY_F22, EKEY_F23,
  EKEY_F24, EKEY_F25, EKEY_F26, EKEY_F27,
  EKEY_F28, EKEY_F29, EKEY_F30, EKEY_F31,
  EKEY_F32, EKEY_F33, EKEY_F34, EKEY_F35,
  EKEY_F36, EKEY_RESIZE, EKEY_HOTKEY, EKEY_EXTERNAL_UPDATE,
  EKEY_UPDATE_TERMINAL, EKEY_MOUSE_EVENT, EKEY_ESC, EKEY_SHIFT,
  EKEY_META, EKEY_CTRL, EKEY_PROTECT, EKEY_KEY_MASK
}
 List of special keys and masks generated by the key handling code. More...
 
enum  { XTERM_MOUSE_NONE, XTERM_MOUSE_SINGLE_BYTE, XTERM_MOUSE_COORD_UTF, XTERM_MOUSE_ALL_UTF }
 
enum  {
  EMOUSE_BUTTON_LEFT, EMOUSE_BUTTON_MIDDLE, EMOUSE_BUTTON_RIGHT, EMOUSE_SCROLL_UP,
  EMOUSE_SCROLL_DOWN, EMOUSE_CLICKED_LEFT, EMOUSE_CLICKED_MIDDLE, EMOUSE_CLICKED_RIGHT,
  EMOUSE_DOUBLE_CLICKED_LEFT, EMOUSE_DOUBLE_CLICKED_MIDDLE, EMOUSE_DOUBLE_CLICKED_RIGHT, EMOUSE_TRIPLE_CLICKED_LEFT,
  EMOUSE_TRIPLE_CLICKED_MIDDLE, EMOUSE_TRIPLE_CLICKED_RIGHT, EMOUSE_ALL_BUTTONS, EMOUSE_ALL_BUTTONS_COUNT,
  EMOUSE_CLICK_BUTTONS_COUNT, EMOUSE_CLICK_BUTTONS
}
 
enum  { EMOUSE_SHIFT, EMOUSE_META, EMOUSE_CTRL }
 
enum  { EMOUSE_BUTTON_PRESS, EMOUSE_BUTTON_RELEASE, EMOUSE_MOTION, EMOUSE_OUTSIDE_GRAB }
 
enum  clipboard_action_t {
  ACTION_NONE, CONVERT_CLIPBOARD, CONVERT_PRIMARY, CLAIM_CLIPBOARD,
  CLAIM_PRIMARY, RELEASE_SELECTIONS
}
 
enum  terminal_code_t { TERM_NONE, TERM_XTERM, TERM_LINUX }
 
enum  undo_type_t {
  UNDO_NONE, UNDO_DELETE, UNDO_DELETE_BLOCK, UNDO_BACKSPACE,
  UNDO_ADD, UNDO_ADD_BLOCK, UNDO_REPLACE_BLOCK, UNDO_OVERWRITE,
  UNDO_DELETE_NEWLINE, UNDO_BACKSPACE_NEWLINE, UNDO_ADD_NEWLINE, UNDO_INDENT,
  UNDO_UNINDENT, UNDO_ADD_NEWLINE_INDENT, UNDO_BLOCK_START, UNDO_BLOCK_END,
  UNDO_ADD_REDO, UNDO_BACKSPACE_REDO, UNDO_REPLACE_BLOCK_REDO, UNDO_OVERWRITE_REDO,
  UNDO_ADD_NEWLINE_INDENT_REDO, UNDO_BLOCK_START_REDO, UNDO_BLOCK_END_REDO
}
 

Functions

 _T3_WIDGET_ENUM (selection_mode_t, NONE, SHIFT, MARK, ALL)
 
 _T3_WIDGET_ENUM (find_flags_t, BACKWARD=(1<< 0), ICASE=(1<< 1), REGEX=(1<< 2), WRAP=(1<< 3), TRANSFROM_BACKSLASH=(1<< 4), WHOLE_WORD=(1<< 5)|(1<< 6), ANCHOR_WORD_LEFT=(1<< 5), ANCHOR_WORD_RIGHT=(1<< 6), VALID=(1<< 7), REPLACEMENT_VALID=(1<< 8),)
 
 _T3_WIDGET_ENUM (find_action_t, FIND, SKIP, REPLACE, REPLACE_ALL, REPLACE_IN_SELECTION)
 
 _T3_WIDGET_ENUM (attribute_t, NON_PRINT, TEXT_SELECTION_CURSOR, TEXT_SELECTION_CURSOR2, BAD_DRAW, TEXT_CURSOR, TEXT, TEXT_SELECTED, HOTKEY_HIGHLIGHT, DIALOG, DIALOG_SELECTED, BUTTON_SELECTED, SCROLLBAR, MENUBAR, MENUBAR_SELECTED, BACKGROUND, SHADOW, META_TEXT)
 Constants for indicating which attribute to change/retrieve. More...
 
 _T3_WIDGET_ENUM (rewrap_type_t, REWRAP_ALL, REWRAP_LINE, REWRAP_LINE_LOCAL, INSERT_LINES, DELETE_LINES)
 
 _T3_WIDGET_ENUM (wrap_type_t, NONE, WORD, CHARACTER)
 
template<typename T , typename D = delete_functor<T>>
 _T3_WIDGET_TYPEDEF (cleanup_ptr, cleanup_ptr_base< T, D >)
 
template<typename T , void(*)(T *) f>
 _T3_WIDGET_TYPEDEF (cleanup_func_ptr, cleanup_ptr_base< T, free_func< T, f > >)
 
template<typename T , typename U , U(*)(T *) f>
 _T3_WIDGET_TYPEDEF (cleanup_func2_ptr, cleanup_ptr_base< T, free_func2< T, U, f > >)
 
template<typename T >
 _T3_WIDGET_TYPEDEF (cleanup_free_ptr, cleanup_ptr_base< T, free_func<> >)
 
template<typename T , typename D = delete_functor<T>>
 _T3_WIDGET_TYPEDEF (linked_ptr, linked_ptr_base< T, D >)
 
template<typename T >
 _T3_WIDGET_TYPEDEF (pimpl_ptr, pimpl_ptr_base< T >)
 
static uint32_t casefold_single (uint32_t c)
 
bool check_mouse_fd (fd_set *readset)
 Check the mouse event fd for events, if appropriate bits in readset indicate available data. More...
 
static x11_time_t claim (x11_time_t since, x11_atom_t selection)
 Claim a selection. More...
 
static void claim_selection (bool clipboard, string *data)
 
void cleanup (void)
 Free memory used by libt3widget. More...
 
void cleanup_keys (void)
 Clean-up any data allocated for the key handling code. More...
 
static int compare_mapping (const void *a, const void *b)
 
static int compare_sequence_with_mapping (const void *key, const void *mapping)
 
sigc::connection connect_on_init (const sigc::slot< void, bool > &slot)
 Connect a callback to the on_init signal. More...
 
sigc::connection connect_resize (const sigc::slot< void, int, int > &slot)
 Connect a callback to the resize signal. More...
 
sigc::connection connect_terminal_settings_changed (const sigc::slot< void > &slot)
 Connect a callback to the terminal_settings_changed signal. More...
 
sigc::connection connect_update_notification (const sigc::slot< void > &slot)
 Connect a callback to the update_notification signal. More...
 
void convert_lang_codeset (const char *str, size_t len, std::string *result, bool from)
 
void convert_lang_codeset (const char *str, std::string *result, bool from)
 
void convert_lang_codeset (const std::string *str, std::string *result, bool from)
 
static void convert_next_key (void)
 
static key_t decode_sequence (bool outer)
 
bool decode_xterm_mouse (void)
 Decode an xterm mouse event. More...
 
void deinit_keys (void)
 Switch to the default keypad mode to allow other applications to function. More...
 
void deinit_mouse_reporting (void)
 Switch off mouse reporting to allow other applications to function. More...
 
static void do_resize (void)
 
static t3_attr_t ensure_color (t3_attr_t value)
 
void exit_main_loop (int exit_code)
 Exit the main loop. More...
 
void fd_set_mouse_fd (fd_set *readset, int *max_fd)
 Set bit(s) for mouse event fd. More...
 
t3_attr_t get_attribute (attribute_t attribute)
 Retrieve the setting of a default attribute. More...
 
int get_class (const std::string *str, int pos)
 Get the character class associated with the character at a specific position in a string. More...
 
linked_ptr< string >::t get_clipboard (void)
 Get the clipboard data. More...
 
t3_attr_t get_default_attribute (attribute_t attribute, bool color_mode)
 Retrieve the default setting of a default attribute. More...
 
string get_directory (const char *directory)
 
int get_key_timeout (void)
 Get the timeout for handling escape sequences. More...
 
long get_libt3key_version (void)
 Get the version of the libt3key library used by libt3widget at runtime. More...
 
long get_libt3window_version (void)
 Get the version of the libt3window library used by libt3widget at runtime. More...
 
static key_t get_next_converted_key (void)
 
static int get_next_keychar (void)
 
linked_ptr< string >::t get_primary (void)
 Get the primary selection data. More...
 
void get_screen_size (int *height, int *width)
 Get the dimensions of the screen as used by libt3widget. More...
 
static linked_ptr< string >::t get_selection (bool clipboard)
 
long get_version (void)
 Get the version of the libt3widget library used at runtime. More...
 
string get_working_directory (void)
 
bool glob_filter (string_list_base_t *list, size_t idx, const std::string *str, bool show_hidden)
 Filter function using glob on the fs_name of a file entry. More...
 
static void handle_property_notify (x11_property_event_t *event)
 Handle an incoming PropertyNotify event. More...
 
complex_error_t init (const init_parameters_t *params)
 Initialize the libt3widget library. More...
 
void init_attributes (void)
 
static void init_external_clipboard (bool init)
 
complex_error_t init_keys (const char *term, bool separate_keypad)
 Initialize the key handling code. More...
 
void init_mouse_reporting (bool xterm_mouse)
 Initialize the mouse handling code. More...
 
static bool init_x11 (void)
 
void insert_protected_key (t3_widget::key_t key)
 Insert a key to the queue, marked to ensure it is not interpreted by any widget except text widgets. More...
 
bool is_dir (const string *current_dir, const char *name)
 
static bool is_function_key (const char *str)
 
static bool is_hex_digit (int c)
 
static int is_start_char (int c)
 
void iterate (void)
 Perform a single iteration of the main loop. More...
 
static void lang_codeset_init (bool init)
 
static void lock (void)
 
void lock_clipboard (void)
 
int main_loop (void)
 Run the main event loop of the libt3widget library. More...
 
static key_t map_kp (key_t kp)
 
ssize_t nosig_read (int fd, char *buffer, size_t bytes)
 
ssize_t nosig_write (int fd, const char *buffer, size_t bytes)
 
static sigc::signal< void, bool > & on_init ()
 
int parse_escape (const std::string &str, const char **error_message, size_t &read_position, bool replacements=false)
 Parse a single escape sequence in a string. More...
 
bool parse_escapes (std::string &str, const char **error_message, bool replacements=false)
 Convert escapes in a string to associated values. More...
 
static void * process_events (void *arg)
 Thread to process incoming events. More...
 
key_t read_key (void)
 Retrieve a key from the input queue. More...
 
bool read_keychar (int timeout)
 Read chars into buffer for processing. More...
 
static void * read_keys (void *arg)
 
mouse_event_t read_mouse_event (void)
 Retrieve a mouse event from the input queue. More...
 
void redraw (void)
 Force a complete redraw of the terminal contents. More...
 
void reinit_keys (void)
 Switch back to best keypad mode after using deinit_keys. More...
 
void reinit_mouse_reporting (void)
 Switch back to mouse reporting after using deinit_mouse_reporting. More...
 
void release_selections (void)
 
void restore (void)
 Function to restore the terminal to the original settings. More...
 
static long retrieve_data (void)
 Retrieve data set by another X client on our window. More...
 
void sanitize_dir (string *directory)
 
static bool send_selection (x11_window_t requestor, x11_atom_t target, x11_atom_t property, linked_ptr< string >::t data, x11_time_t since)
 Send data requested by another X client. More...
 
void set_attribute (attribute_t attribute, t3_attr_t value)
 Change the setting of a default attribute. More...
 
void set_clipboard (string *str)
 
bool set_color_mode (bool on)
 Control the color mode. More...
 
void set_key_timeout (int msec)
 Set the timeout for handling escape sequences. More...
 
void set_primary (string *str)
 
void signal_update (void)
 Request the generation of the update_notification signal. More...
 
static void sigwinch_handler (int param)
 
void stop_clipboard (void)
 
static void stop_keys (void)
 
void stop_mouse_reporting (void)
 Stop mouse reporting all together before program termination. More...
 
static void stop_x11 (void)
 Stop the X11 event processing. More...
 
bool string_compare_filter (string_list_base_t *list, size_t idx, const std::string *str)
 Filter function comparing the initial part of an entry with str. More...
 
void suspend (void)
 Suspend execution of this program by sending a SIGSTOP signal. More...
 
static sigc::signal< void > & terminal_settings_changed ()
 
static void terminal_specific_restore (void)
 
static void terminal_specific_setup (void)
 
static long timediff (struct timeval a, struct timeval b)
 
static struct timespec timeout_time (int usec)
 
static int to_lower (int c)
 
static void unget_key (key_t c)
 
static void unget_keychar (int c)
 
static void unlock (void)
 
void unlock_clipboard (void)
 
bool use_xterm_mouse_reporting (void)
 Report whether XTerm mouse reporting is active. More...
 
static void x11_acknowledge_wakeup (fd_set *fds)
 
static void x11_change_property (x11_window_t win, x11_atom_t property, x11_atom_t type, int format, int mode, const unsigned char *data, int nelements)
 
static void x11_close_display (void)
 
static void x11_convert_selection (x11_atom_t selection, x11_atom_t type, x11_atom_t property, x11_window_t win, x11_time_t req_time)
 
static void x11_delete_property (x11_window_t win, x11_atom_t property)
 
static int x11_fill_fds (fd_set *fds)
 
static void x11_flush (void)
 
static void x11_free_event (x11_event_t *event)
 
static void x11_free_property_data (void *data)
 
static x11_window_t x11_get_selection_owner (x11_atom_t selection)
 
static bool x11_get_window_property (x11_window_t win, x11_atom_t property, long long_offset, long long_length, bool del, x11_atom_t req_type, x11_atom_t *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, unsigned char **prop_return)
 
static x11_event_t * x11_probe_event (void)
 
static void x11_select_prop_change (x11_window_t win, bool interested)
 
static void x11_send_event (x11_window_t win, bool propagate, long event_mask, x11_event_t *event_send)
 
static void x11_set_selection_owner (x11_atom_t selection, x11_window_t win, x11_time_t since)
 

Variables

extclipboard_interface_t _t3_widget_extclipboard_calls
 
static key_t accepted_keys []
 
static clipboard_action_t action
 
static const char * atom_names []
 
static x11_atom_t atoms [ATOM_COUNT]
 
attributes_t attributes
 
char char_buffer [32]
 
int char_buffer_fill
 
linked_ptr< string >::t clipboard_data
 
static pthread_mutex_t clipboard_mutex
 
static x11_time_t clipboard_owner_since
 
static pthread_cond_t clipboard_signal
 
static xcb_connection_t * connection
 
static transcript_t * conversion_handle
 
static x11_time_t conversion_started_at
 
static bool conversion_succeeded
 
text_line_factory_t default_text_line_factory
 
static const char * disable_mouse
 
static bool drop_single_esc
 
static const char * enable_mouse
 
static bool end_connection
 
static const char * enter
 
static extclipboard_interface_textclipboard_calls
 
static incr_send_list_t incr_sends
 
static sigc::connection init_connected
 
static int init_level
 
init_parameters_tinit_params
 
insert_char_dialog_tinsert_char_dialog
 Global insert_char_dialog_t dialog. More...
 
static bool is_prefix
 
static key_buffer_t key_buffer
 
static const key_string_t key_strings []
 
static int key_timeout
 
static pthread_mutex_t key_timeout_lock
 
static const t3_key_node_t * keymap
 
static const kp_mapping_t kp_mappings []
 
static transcript_t * lang_codeset_handle
 
static sigc::connection lang_codeset_init_connection
 
static bool lang_codeset_is_utf8
 
static const char * leave
 
static mapping_tmap
 
static int map_count
 
static key_t map_single [128]
 
static size_t max_data
 
message_dialog_tmessage_dialog
 Global message_dialog_t dialog. More...
 
static int mouse_button_state
 
static mouse_event_buffer_t mouse_event_buffer
 
const optint None
 Standard uninitialized optint value. More...
 
static key_t nul
 
linked_ptr< string >::t primary_data
 
static x11_time_t primary_owner_since
 
static xcb_get_property_reply_t * property_reply
 
static pthread_t read_key_thread
 
static bool receive_incr
 
static sigc::signal< void, int,
int > 
resize
 
static string retrieved_data
 
static int screen_columns
 
static int screen_lines
 
static int signal_pipe [2]
 
static terminal_code_t terminal
 
static terminal_mapping_t terminal_mapping []
 
static uint32_t unicode_buffer [16]
 
static int unicode_buffer_fill
 
static sigc::signal< void > update_notification
 
static x11_window_t window
 
static bool x11_error
 
static pthread_t x11_event_thread
 
static bool x11_initialized
 
static enum t3_widget:: { ... }  xterm_mouse_reporting
 

Detailed Description

The t3_widget namespace is contains all classes, functions and global variables in the libt3widget library.

Typedef Documentation

Special name for filtered string lists.

typedef long t3_widget::key_t

Integer type holding a single key symbol.

Enumeration Type Documentation

anonymous enum

List of special keys and masks generated by the key handling code.

Enumerator
EKEY_RESIZE 

Key symbol indicating the terminal was resized.

EKEY_HOTKEY 

Key symbol used when a widget has indicated that a pressed key is a hot key.

Testing whether a key is a hot key for a widget is performed using the widget_t::is_hotkey function. If that returns true, the widget_t::process_key is called with this value.

EKEY_EXTERNAL_UPDATE 

Key symbol indicating that the signal_update function was called and the update_notification signal should be emitted.

EKEY_UPDATE_TERMINAL 

Key symbol indicating that the terminal_settings_changed signal should be emitted.

EKEY_MOUSE_EVENT 

Key symbol indicating that there is a new #mouse_event_t available in the mouse events queue.

EKEY_ESC 

Symbolic name for the escape key.

EKEY_SHIFT 

Value indicating the shift key was pressed with a key press, used as bit-field.

EKEY_META 

Value indicating the meta key was pressed with a key press, used as bit-field.

EKEY_CTRL 

Value indicating the control key was pressed with a key press, used as bit-field.

EKEY_PROTECT 

Value indicating the key was inserted using insert_protected_key, used as bit-field.

EKEY_KEY_MASK 

Bit mask to retrieve the base key symbol.

Function Documentation

t3_widget::_T3_WIDGET_ENUM ( attribute_t  ,
NON_PRINT  ,
TEXT_SELECTION_CURSOR  ,
TEXT_SELECTION_CURSOR2  ,
BAD_DRAW  ,
TEXT_CURSOR  ,
TEXT  ,
TEXT_SELECTED  ,
HOTKEY_HIGHLIGHT  ,
DIALOG  ,
DIALOG_SELECTED  ,
BUTTON_SELECTED  ,
SCROLLBAR  ,
MENUBAR  ,
MENUBAR_SELECTED  ,
BACKGROUND  ,
SHADOW  ,
META_TEXT   
)

Constants for indicating which attribute to change/retrieve.

bool t3_widget::check_mouse_fd ( fd_set *  readset)

Check the mouse event fd for events, if appropriate bits in readset indicate available data.

static x11_time_t t3_widget::claim ( x11_time_t  since,
x11_atom_t  selection 
)
static

Claim a selection.

void t3_widget::cleanup ( void  )

Free memory used by libt3widget.

After this function is called, no further calls to libt3widget should be made. Normally, there is no reason to call this function at all, because the operating system will reclaim all memory. However, if you are trying to track down memory leaks in your program, calling this function will free all memory allocated in libt3widget, thus allowing you to debug your own memory allocations more easily.

void t3_widget::cleanup_keys ( void  )

Clean-up any data allocated for the key handling code.

sigc::connection t3_widget::connect_on_init ( const sigc::slot< void, bool > &  slot)

Connect a callback to the on_init signal.

The on_init signal is emitted after initialization is complete. The signal is provided to allow initialization of global variables after initialization is complete, but without knowledge of when init is called.

sigc::connection t3_widget::connect_resize ( const sigc::slot< void, int, int > &  slot)

Connect a callback to the resize signal.

sigc::connection t3_widget::connect_terminal_settings_changed ( const sigc::slot< void > &  slot)

Connect a callback to the terminal_settings_changed signal.

The terminal_settings_changed signal is emitted when the libt3window library has completed the terminal capability detection.

sigc::connection t3_widget::connect_update_notification ( const sigc::slot< void > &  slot)

Connect a callback to the update_notification signal.

The update_notification signal is sent in response to signal_update function.

bool t3_widget::decode_xterm_mouse ( void  )

Decode an xterm mouse event.

Decode an XTerm mouse event.

This routine would have been simple, had it not been for the fact that the original XTerm mouse protocol is a little broken, and it is hard to detect whether the fix is present. First of all, the original protocol can not handle coordinates above 223. This is due to the fact that a coordinate is encoded as coordinate + 32 (and coordinates start at 1).

Once screens got big enough to make terminals more than 223 columns wide, a fix was implemented, which uses UTF-8 encoding (but only using at most 2 bytes, instead of simply using the full range). However, to accomodate clients which simply assumed all input was UTF-8 encoded, several versions later the buttons were encoded as UTF-8 as well. Thus we now have three different versions of the XTerm mouse reporting protocol.

This wouldn't be so bad, if it wasn't for all those terminal emulators out there claiming to be XTerm. They make detection of the specific version of the protocol practically impossible, because they may report any version number in response to a "Send Device Attributes" request. Thus, this routine tries to do automatic switching, based on the received mouse reports.

Autodetection logic:

  • start by assuming full UTF-8 encoded mode
  • if the buttons have the top bit set, but are not properly UTF-8 encoded, assume that only the coordinates have been UTF-8 encoded
  • if a coordinate is not properly UTF-8 encoded, assume single byte coding
  • if during the examination of the coordinate we find that not enough bytes are available to decode, assume single byte coding. (This situation can not be caused by incorrecly assuming that the buttons are UTF-8 encoded, because then the first coordinate byte would be invalid.)
void t3_widget::deinit_keys ( void  )

Switch to the default keypad mode to allow other applications to function.

void t3_widget::deinit_mouse_reporting ( void  )

Switch off mouse reporting to allow other applications to function.

void t3_widget::exit_main_loop ( int  exit_code)

Exit the main loop.

Calling this function will cause an exit from the main loop. This is accomplished by throwing an exception, so using an unqualified catch clause will interfere with the execution of this action.

void t3_widget::fd_set_mouse_fd ( fd_set *  readset,
int *  max_fd 
)

Set bit(s) for mouse event fd.

t3_attr_t t3_widget::get_attribute ( attribute_t  attribute)

Retrieve the setting of a default attribute.

See the attribute_t enum for possible values.

int t3_widget::get_class ( const std::string *  str,
int  pos 
)

Get the character class associated with the character at a specific position in a string.

linked_ptr< std::string >::t t3_widget::get_clipboard ( void  )

Get the clipboard data.

While the returned linked_ptr is in scope, the clipboard should be locked. See lock_clipboard for details.

t3_attr_t t3_widget::get_default_attribute ( attribute_t  attribute,
bool  color_mode 
)

Retrieve the default setting of a default attribute.

See the attribute_t enum for possible values.

int t3_widget::get_key_timeout ( void  )

Get the timeout for handling escape sequences.

See set_key_timeout for details about the return value.

long t3_widget::get_libt3key_version ( void  )

Get the version of the libt3key library used by libt3widget at runtime.

long t3_widget::get_libt3window_version ( void  )

Get the version of the libt3window library used by libt3widget at runtime.

linked_ptr< std::string >::t t3_widget::get_primary ( void  )

Get the primary selection data.

While the returned linked_ptr is in scope, the clipboard should be locked. See lock_clipboard for details.

void t3_widget::get_screen_size ( int *  height,
int *  width 
)

Get the dimensions of the screen as used by libt3widget.

long t3_widget::get_version ( void  )

Get the version of the libt3widget library used at runtime.

bool t3_widget::glob_filter ( string_list_base_t *  list,
size_t  idx,
const std::string *  str,
bool  show_hidden 
)

Filter function using glob on the fs_name of a file entry.

static void t3_widget::handle_property_notify ( x11_property_event_t *  event)
static

Handle an incoming PropertyNotify event.

There are so many different things which may be going on when we receive a PropertyNotify event, that it has its own routine.

complex_error_t t3_widget::init ( const init_parameters_t *  params)

Initialize the libt3widget library.

This function should be called before any other function in the libt3widget library.

complex_error_t t3_widget::init_keys ( const char *  term,
bool  separate_keypad 
)

Initialize the key handling code.

void t3_widget::init_mouse_reporting ( bool  xterm_mouse)

Initialize the mouse handling code.

void t3_widget::insert_protected_key ( t3_widget::key_t  key)

Insert a key to the queue, marked to ensure it is not interpreted by any widget except text widgets.

void t3_widget::iterate ( void  )

Perform a single iteration of the main loop.

This function updates the contents of the terminal, waits for a key press and sends it to the currently focussed dialog. Called repeatedly from main_loop.

int t3_widget::main_loop ( void  )

Run the main event loop of the libt3widget library.

This function will return only by calling exit_main_loop, yielding the value passed to that function.

int t3_widget::parse_escape ( const std::string &  str,
const char **  error_message,
size_t &  read_position,
bool  replacements = false 
)

Parse a single escape sequence in a string.

Parameters
strThe string to parse the escape from.
error_messagePointer to storage for an error message.
read_positionThe index in str to start reading, updated by parse_escape.
replacementsA boolean indicating whether replacement markers should be parsed as such.
bool t3_widget::parse_escapes ( std::string &  str,
const char **  error_message,
bool  replacements = false 
)

Convert escapes in a string to associated values.

Convert a string from the input format to an internally usable string.

Parameters
strThe string to parse, updated by this function.
error_messagePointer to storage for an error message.
replacementsA boolean indicating whether replacement markers should be parsed as such.
strA Token with the str to be converted.
error_messageLocation to store the error message if necessary.
replacementsMark replacment substitutions (\1 .. \9) in the string.
Returns
The length of the resulting str.

The use of this function processes escape characters. The converted characters are written in the original str.

static void* t3_widget::process_events ( void *  arg)
static

Thread to process incoming events.

key_t t3_widget::read_key ( void  )

Retrieve a key from the input queue.

bool t3_widget::read_keychar ( int  timeout)

Read chars into buffer for processing.

mouse_event_t t3_widget::read_mouse_event ( void  )

Retrieve a mouse event from the input queue.

void t3_widget::redraw ( void  )

Force a complete redraw of the terminal contents.

The terminal contents may get corrupted due to the output from other processes. The only remedy is to clear the terminal and redraw it, which is exactly what this function does.

void t3_widget::reinit_keys ( void  )

Switch back to best keypad mode after using deinit_keys.

void t3_widget::reinit_mouse_reporting ( void  )

Switch back to mouse reporting after using deinit_mouse_reporting.

void t3_widget::restore ( void  )

Function to restore the terminal to the original settings.

This function is called automatically on program termination by use of atexit(3).

static long t3_widget::retrieve_data ( void  )
static

Retrieve data set by another X client on our window.

Returns
The number of bytes received, or -1 on failure.
static bool t3_widget::send_selection ( x11_window_t  requestor,
x11_atom_t  target,
x11_atom_t  property,
linked_ptr< string >::t  data,
x11_time_t  since 
)
static

Send data requested by another X client.

Parameters
requestorThe x11_window_t of the requesting X client.
targetThe requested conversion.
propertyThe property which must be used for sending the data.
dataThe data to send.
sinceThe timestamp at which we aquired the requested selection.
Returns
A boolean indicating succes.
void t3_widget::set_attribute ( attribute_t  attribute,
t3_attr_t  value 
)

Change the setting of a default attribute.

See the attribute_t enum for possible values.

bool t3_widget::set_color_mode ( bool  on)

Control the color mode.

libt3widget by default starts in black and white mode, as most terminals support the limited attributes required. This function allows switching to and from color mode. If the terminal does not support (enough) colors, switching to color mode will not do anything and false will be returned.

void t3_widget::set_key_timeout ( int  msec)

Set the timeout for handling escape sequences.

The value of the msec parameter can have the following values:

  • 0 to disable the timeout completely. To generate EKEY_ESC, the user needs to press the escape key twice.
  • a positive value to accept the keys within msec milliseconds as part of an escape sequence. Pressing escape once and waiting for the timeout to pass will result in EKEY_ESC.
  • a positive value to accept the keys within msec milliseconds as part of an escape sequence. Pressing escape once and waiting for the timeout to pass will result in the escape key press being ignored. To generate EKEY_ESC, the user needs to press the escape key twice.
void t3_widget::signal_update ( void  )

Request the generation of the update_notification signal.

This function is part of the multi-threading support of libt3widget. Updates to widgets are only allowed from the thread running the main_loop function. The signal_update function can be called from any thread and will cause an update_notification signal to be generated on the thread running the main_loop function.

void t3_widget::stop_mouse_reporting ( void  )

Stop mouse reporting all together before program termination.

static void t3_widget::stop_x11 ( void  )
static

Stop the X11 event processing.

bool t3_widget::string_compare_filter ( string_list_base_t *  list,
size_t  idx,
const std::string *  str 
)

Filter function comparing the initial part of an entry with str.

void t3_widget::suspend ( void  )

Suspend execution of this program by sending a SIGSTOP signal.

Before sending the SIGSTOP signal, the terminal is reset to its original state. This allows the parent process (usually the shell) to continue running, while the current program is temporarily suspended.

bool t3_widget::use_xterm_mouse_reporting ( void  )

Report whether XTerm mouse reporting is active.

Variable Documentation

insert_char_dialog_t * t3_widget::insert_char_dialog

Global insert_char_dialog_t dialog.

message_dialog_t * t3_widget::message_dialog

Global message_dialog_t dialog.

const optint t3_widget::None

Standard uninitialized optint value.