2005-06-22 11:20:32 -07:00
|
|
|
/*
|
2005-10-13 07:08:18 -07:00
|
|
|
* mooterm-private.h
|
2005-06-22 11:20:32 -07:00
|
|
|
*
|
2006-02-23 06:03:17 -08:00
|
|
|
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2005-06-22 11:20:32 -07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
2005-06-23 13:18:45 -07:00
|
|
|
*/
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#ifndef MOOTERM_COMPILATION
|
|
|
|
#error "This file may not be included"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __MOO_TERM_PRIVATE_H__
|
|
|
|
#define __MOO_TERM_PRIVATE_H__
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
#include "mooterm/mooterm.h"
|
2005-10-15 22:07:02 -07:00
|
|
|
#include "mooterm/mootermtag.h"
|
2005-07-16 21:49:01 -07:00
|
|
|
#include "mooterm/mootermbuffer.h"
|
2005-07-10 19:54:58 -07:00
|
|
|
#include "mooterm/mooterm-vt.h"
|
2005-10-15 22:07:02 -07:00
|
|
|
#include <gtk/gtk.h>
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2005-07-12 07:23:08 -07:00
|
|
|
#if 0
|
2005-07-15 08:11:08 -07:00
|
|
|
#define TERM_IMPLEMENT_ME_WARNING g_warning
|
2005-07-12 07:23:08 -07:00
|
|
|
#else
|
2005-07-15 08:11:08 -07:00
|
|
|
#define TERM_IMPLEMENT_ME_WARNING g_message
|
2005-07-12 07:23:08 -07:00
|
|
|
#endif
|
|
|
|
|
2005-07-25 06:34:22 -07:00
|
|
|
#define TERM_IMPLEMENT_ME TERM_IMPLEMENT_ME_WARNING ("%s: implement me", G_STRLOC)
|
2005-07-12 07:23:08 -07:00
|
|
|
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2006-03-24 16:51:31 -08:00
|
|
|
#define PT_WRITER_PRIORITY G_PRIORITY_DEFAULT
|
|
|
|
#define PT_READER_PRIORITY G_PRIORITY_DEFAULT
|
|
|
|
|
2006-06-09 12:28:17 -07:00
|
|
|
#define ADJUSTMENT_PRIORITY G_PRIORITY_DEFAULT_IDLE
|
2005-07-10 19:54:58 -07:00
|
|
|
#define ADJUSTMENT_DELTA 30.0
|
2006-06-09 12:28:17 -07:00
|
|
|
|
|
|
|
#define UPDATE_TIMEOUT 10
|
|
|
|
#define UPDATE_REPEAT_TIMEOUT 40
|
|
|
|
#define PROCESS_INCOMING_TIMEOUT 10
|
|
|
|
#define INPUT_CHUNK_SIZE 4096
|
2005-07-01 02:53:39 -07:00
|
|
|
|
2005-07-16 19:36:26 -07:00
|
|
|
#define MIN_TERMINAL_WIDTH 8
|
|
|
|
#define MIN_TERMINAL_HEIGHT 4
|
2005-06-22 11:20:32 -07:00
|
|
|
#define MAX_TERMINAL_WIDTH 4096
|
2005-07-10 19:54:58 -07:00
|
|
|
|
2005-07-15 02:49:48 -07:00
|
|
|
#define SCROLL_GRANULARITY 3
|
|
|
|
|
2006-03-27 00:11:07 -08:00
|
|
|
#ifdef MOO_DEBUG
|
|
|
|
#define DEFAULT_MONOSPACE_FONT "Courier New 11"
|
|
|
|
#else
|
|
|
|
#define DEFAULT_MONOSPACE_FONT "Monospace 10"
|
|
|
|
#endif
|
2005-07-23 02:24:06 -07:00
|
|
|
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
typedef enum {
|
2005-07-14 23:37:09 -07:00
|
|
|
POINTER_NONE = 0,
|
|
|
|
POINTER_TEXT = 1,
|
|
|
|
POINTER_NORMAL = 2,
|
|
|
|
POINTERS_NUM = 3
|
2005-07-15 03:05:27 -07:00
|
|
|
} TermPointerType;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
enum {
|
2005-07-22 05:02:36 -07:00
|
|
|
COLOR_NORMAL = 0,
|
|
|
|
COLOR_BOLD = 1,
|
|
|
|
COLOR_MAX = 16
|
2005-06-22 11:20:32 -07:00
|
|
|
};
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
typedef enum {
|
|
|
|
DRAG_NONE = 0,
|
|
|
|
DRAG_SELECT,
|
|
|
|
DRAG_DRAG
|
|
|
|
} DragType;
|
|
|
|
|
2005-07-21 15:11:16 -07:00
|
|
|
typedef struct _MooTermFont MooTermFont;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
struct _MooTermPrivate {
|
2005-07-10 19:54:58 -07:00
|
|
|
struct _MooTermPt *pt;
|
|
|
|
struct _MooTermParser *parser;
|
2006-06-09 12:28:17 -07:00
|
|
|
GString *incoming;
|
|
|
|
guint process_timeout;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-10 19:54:58 -07:00
|
|
|
struct _MooTermBuffer *buffer;
|
|
|
|
struct _MooTermBuffer *primary_buffer;
|
|
|
|
struct _MooTermBuffer *alternate_buffer;
|
2005-07-06 16:41:14 -07:00
|
|
|
|
2005-07-10 19:54:58 -07:00
|
|
|
guint8 modes[MODE_MAX];
|
|
|
|
guint8 saved_modes[MODE_MAX];
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-20 11:42:54 -07:00
|
|
|
gboolean scrolled;
|
|
|
|
guint top_line;
|
2005-07-10 19:54:58 -07:00
|
|
|
guint width;
|
|
|
|
guint height;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-10 19:54:58 -07:00
|
|
|
guint cursor_row;
|
|
|
|
guint cursor_col;
|
2005-07-16 21:38:09 -07:00
|
|
|
|
|
|
|
struct {
|
2005-12-03 12:29:23 -08:00
|
|
|
guint cursor_row, cursor_col; /* these are real cursor coordinates in buffer
|
|
|
|
(it may be different from what's displayed in AWM mode) */
|
2005-07-16 21:38:09 -07:00
|
|
|
MooTermTextAttr attr;
|
|
|
|
int GL, GR;
|
|
|
|
gboolean autowrap;
|
|
|
|
gboolean decom;
|
|
|
|
guint top_margin, bottom_margin;
|
|
|
|
/* TODO: Selective erase attribute ??? */
|
|
|
|
int single_shift;
|
|
|
|
} saved_cursor;
|
2005-07-01 02:53:39 -07:00
|
|
|
|
2005-07-19 02:43:44 -07:00
|
|
|
gpointer selection;
|
2005-07-19 08:14:29 -07:00
|
|
|
gboolean owns_selection;
|
|
|
|
|
2005-07-21 15:11:16 -07:00
|
|
|
MooTermFont *font;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2006-03-24 15:27:31 -08:00
|
|
|
GdkRegion *changed; /* screen coordinates */
|
|
|
|
guint cursor_row_old; /* cursor has been here, and it's been invalidated */
|
|
|
|
guint cursor_col_old;
|
2006-06-09 12:28:17 -07:00
|
|
|
guint update_timer;
|
2006-03-24 15:27:31 -08:00
|
|
|
|
2005-07-10 19:54:58 -07:00
|
|
|
GdkGC *clip;
|
|
|
|
gboolean font_changed;
|
|
|
|
PangoLayout *layout;
|
2005-07-16 11:32:43 -07:00
|
|
|
gboolean colors_inverted;
|
2005-07-20 11:42:54 -07:00
|
|
|
gboolean cursor_visible;
|
2005-07-20 08:52:15 -07:00
|
|
|
|
2005-07-20 11:42:54 -07:00
|
|
|
gboolean blink_cursor_visible;
|
|
|
|
gboolean cursor_blinks;
|
|
|
|
guint cursor_blink_time;
|
|
|
|
guint cursor_blink_timeout_id;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-22 05:02:36 -07:00
|
|
|
GdkGC *color[COLOR_MAX];
|
2005-07-20 11:24:14 -07:00
|
|
|
GdkGC *fg[2];
|
|
|
|
GdkGC *bg;
|
2005-07-22 05:02:36 -07:00
|
|
|
GdkColor palette[COLOR_MAX];
|
|
|
|
GdkColor fg_color[2];
|
|
|
|
GdkColor bg_color;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
GdkCursor *pointer[POINTERS_NUM];
|
|
|
|
gboolean pointer_visible;
|
2005-07-15 04:41:00 -07:00
|
|
|
int tracking_mouse;
|
|
|
|
gulong track_press_id;
|
|
|
|
gulong track_release_id;
|
2005-07-15 09:27:09 -07:00
|
|
|
gulong track_scroll_id;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2006-04-07 22:31:50 -07:00
|
|
|
GtkWidget *menu;
|
|
|
|
|
2005-07-14 23:37:09 -07:00
|
|
|
GtkIMContext *im;
|
|
|
|
gboolean im_preedit_active;
|
|
|
|
GdkModifierType modifiers;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-10 19:54:58 -07:00
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
guint pending_adjustment_changed;
|
|
|
|
guint pending_adjustment_value_changed;
|
2005-07-14 23:37:09 -07:00
|
|
|
|
|
|
|
struct {
|
|
|
|
MooTermEraseBinding backspace_binding;
|
|
|
|
MooTermEraseBinding delete_binding;
|
2006-03-26 18:22:11 -08:00
|
|
|
guint hide_pointer_on_keypress : 1; /* = TRUE */
|
|
|
|
guint meta_sends_escape : 1; /* = TRUE */
|
2006-04-09 15:17:27 -07:00
|
|
|
guint scroll_on_input : 1; /* = TRUE */
|
2006-03-26 18:22:11 -08:00
|
|
|
guint bold_pango : 1;
|
|
|
|
gboolean bold_offset : 1;
|
2005-07-14 23:37:09 -07:00
|
|
|
} settings;
|
2005-07-26 04:12:40 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
struct {
|
|
|
|
guint drag_scroll_timeout;
|
|
|
|
GdkEventType drag_button;
|
|
|
|
DragType drag_type;
|
|
|
|
int drag_start_x;
|
|
|
|
int drag_start_y;
|
2006-03-26 18:22:11 -08:00
|
|
|
guint drag_moved : 1;
|
2005-10-13 07:08:18 -07:00
|
|
|
} mouse_stuff;
|
2005-07-10 19:54:58 -07:00
|
|
|
};
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-16 21:49:01 -07:00
|
|
|
#define term_top_line(term) \
|
2005-07-20 11:42:54 -07:00
|
|
|
((term)->priv->scrolled ? \
|
|
|
|
(term)->priv->top_line : \
|
2005-07-16 21:49:01 -07:00
|
|
|
buf_scrollback ((term)->priv->buffer))
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_apply_settings (MooTerm *term);
|
2006-04-08 19:09:02 -07:00
|
|
|
void _moo_term_init_settings (void);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_set_window_title (MooTerm *term,
|
2005-07-10 19:54:58 -07:00
|
|
|
const char *title);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_set_icon_name (MooTerm *term,
|
2005-07-10 19:54:58 -07:00
|
|
|
const char *title);
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_buf_content_changed (MooTerm *term,
|
2005-07-10 19:54:58 -07:00
|
|
|
MooTermBuffer *buf);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_cursor_moved (MooTerm *term,
|
2005-07-10 19:54:58 -07:00
|
|
|
MooTermBuffer *buf);
|
2006-03-24 15:27:31 -08:00
|
|
|
void _moo_term_buffer_scrolled (MooTermBuffer *buf,
|
|
|
|
guint lines,
|
|
|
|
MooTerm *term);
|
2005-07-10 19:54:58 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_size_changed (MooTerm *term);
|
2005-07-10 19:54:58 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_init_font_stuff (MooTerm *term);
|
|
|
|
void _moo_term_init_palette (MooTerm *term);
|
2006-03-09 16:28:03 -08:00
|
|
|
void _moo_term_update_palette (MooTerm *term);
|
|
|
|
void _moo_term_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *previous_style);
|
2005-07-10 19:54:58 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_update_pointer (MooTerm *term);
|
|
|
|
void _moo_term_set_pointer_visible (MooTerm *term,
|
2005-07-14 23:37:09 -07:00
|
|
|
gboolean visible);
|
2005-10-13 07:08:18 -07:00
|
|
|
gboolean _moo_term_button_press (GtkWidget *widget,
|
2005-07-10 19:54:58 -07:00
|
|
|
GdkEventButton *event);
|
2005-10-13 07:08:18 -07:00
|
|
|
gboolean _moo_term_button_release (GtkWidget *widget,
|
2005-07-10 19:54:58 -07:00
|
|
|
GdkEventButton *event);
|
2005-10-13 07:08:18 -07:00
|
|
|
gboolean _moo_term_motion_notify (GtkWidget *widget,
|
2005-07-15 02:49:48 -07:00
|
|
|
GdkEventMotion *event);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_do_popup_menu (MooTerm *term,
|
2005-07-15 02:49:48 -07:00
|
|
|
GdkEventButton *event);
|
2005-07-14 23:37:09 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
gboolean _moo_term_key_press (GtkWidget *widget,
|
2005-07-10 19:54:58 -07:00
|
|
|
GdkEventKey *event);
|
2005-10-13 07:08:18 -07:00
|
|
|
gboolean _moo_term_key_release (GtkWidget *widget,
|
2005-07-10 19:54:58 -07:00
|
|
|
GdkEventKey *event);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_im_commit (GtkIMContext *imcontext,
|
2005-07-14 23:37:09 -07:00
|
|
|
gchar *arg,
|
|
|
|
MooTerm *term);
|
2005-07-01 02:53:39 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
gboolean _moo_term_expose_event (GtkWidget *widget,
|
2005-07-10 19:54:58 -07:00
|
|
|
GdkEventExpose *event);
|
2006-03-24 15:27:31 -08:00
|
|
|
|
|
|
|
/* (row, col) coordinates relative to visible part of buffer,
|
|
|
|
i.e. _moo_term_invalidate is equivalent to
|
|
|
|
_moo_term_invalidate_screen_rect ({0, 0, width, height}) */
|
|
|
|
void _moo_term_invalidate_screen_rect(MooTerm *term,
|
2005-07-10 19:54:58 -07:00
|
|
|
GdkRectangle *rect);
|
2006-03-24 15:27:31 -08:00
|
|
|
/* invalidate whole window */
|
|
|
|
void _moo_term_invalidate (MooTerm *term);
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_release_selection (MooTerm *term);
|
|
|
|
void _moo_term_grab_selection (MooTerm *term);
|
2005-07-19 08:14:29 -07:00
|
|
|
|
2005-07-20 11:24:14 -07:00
|
|
|
/* in mooterm-draw.c */
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_pause_cursor_blinking (MooTerm *term);
|
|
|
|
void _moo_term_set_cursor_blinks (MooTerm *term,
|
2005-07-20 08:52:15 -07:00
|
|
|
gboolean blinks);
|
|
|
|
|
2006-06-09 12:28:17 -07:00
|
|
|
gsize _moo_term_get_input_chunk_len (MooTerm *term);
|
|
|
|
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-10 19:54:58 -07:00
|
|
|
/*************************************************************************/
|
|
|
|
/* vt commands
|
|
|
|
*/
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_bell (MooTerm *term);
|
|
|
|
void _moo_term_decid (MooTerm *term);
|
|
|
|
void _moo_term_set_dec_modes (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
int *modes,
|
|
|
|
guint n_modes,
|
|
|
|
gboolean set);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_save_dec_modes (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
int *modes,
|
|
|
|
guint n_modes);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_restore_dec_modes (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
int *modes,
|
|
|
|
guint n_modes);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_set_ansi_modes (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
int *modes,
|
|
|
|
guint n_modes,
|
|
|
|
gboolean set);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_set_mode (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
int mode,
|
|
|
|
gboolean set);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_set_ca_mode (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
gboolean set);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_decsc (MooTerm *term);
|
|
|
|
void _moo_term_decrc (MooTerm *term);
|
2005-07-16 21:38:09 -07:00
|
|
|
|
2005-07-12 07:23:08 -07:00
|
|
|
/* these two are in mootermdraw.c */
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_invert_colors (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
gboolean invert);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_set_cursor_visible (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
gboolean visible);
|
|
|
|
/* this one is in mooterminput.c, tracking_type == -1 means turn it off */
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_set_mouse_tracking (MooTerm *term,
|
2005-07-12 07:23:08 -07:00
|
|
|
int tracking_type);
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_da1 (MooTerm *term);
|
|
|
|
void _moo_term_da2 (MooTerm *term);
|
|
|
|
void _moo_term_da3 (MooTerm *term);
|
2005-07-10 19:54:58 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_setting_request (MooTerm *term,
|
2005-07-14 23:37:09 -07:00
|
|
|
int setting);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_dsr (MooTerm *term,
|
2005-07-14 23:37:09 -07:00
|
|
|
int type,
|
|
|
|
int arg,
|
|
|
|
gboolean extended);
|
|
|
|
|
2005-07-10 19:54:58 -07:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* font info
|
|
|
|
*/
|
|
|
|
|
2005-07-21 15:11:16 -07:00
|
|
|
struct _MooTermFont {
|
2005-06-22 11:20:32 -07:00
|
|
|
PangoContext *ctx;
|
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
guint ascent;
|
|
|
|
};
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_term_font_free (MooTermFont *info);
|
2005-07-20 11:24:14 -07:00
|
|
|
|
2005-07-21 15:11:16 -07:00
|
|
|
#define term_char_width(term) ((term)->priv->font->width)
|
|
|
|
#define term_char_height(term) ((term)->priv->font->height)
|
2005-07-15 02:49:48 -07:00
|
|
|
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#endif /* __MOO_TERM_PRIVATE_H__ */
|