2 * an application for displaying Win32 console
4 * Copyright 2001 Eric Pouech
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wineconsole_res.h"
28 /* this is the configuration stored & loaded into the registry */
30 DWORD color_map
[16]; /* console color table */
31 unsigned cell_width
; /* width in pixels of a character */
32 unsigned cell_height
; /* height in pixels of a character */
33 int cursor_size
; /* in % of cell height */
35 DWORD def_attr
; /* default fill attributes (screen colors) */
36 DWORD popup_attr
; /* pop-up color attributes */
37 WCHAR face_name
[32]; /* name of font (size is LF_FACESIZE) */
39 DWORD history_size
; /* number of commands in history buffer */
40 DWORD history_nodup
; /* TRUE if commands are not stored twice in buffer */
41 DWORD insert_mode
; /* TRUE to insert text at the cursor location; FALSE to overwrite it */
42 DWORD menu_mask
; /* MK_CONTROL MK_SHIFT mask to drive submenu opening */
43 DWORD quick_edit
; /* whether mouse ops are sent to app (false) or used for content selection (true) */
44 unsigned sb_width
; /* active screen buffer width */
45 unsigned sb_height
; /* active screen buffer height */
46 unsigned win_width
; /* size (in cells) of visible part of window (width & height) */
48 COORD win_pos
; /* position (in cells) of visible part of screen buffer in window */
49 BOOL exit_on_die
; /* whether the wineconsole should quit if server destroys the console */
50 unsigned edition_mode
; /* edition mode flavor while line editing */
51 WCHAR
* registry
; /* <x> part of HKLU\\<x>\\Console where config is read from (NULL if default settings) */
55 struct config_data curcfg
;
57 CHAR_INFO
* cells
; /* local copy of cells (sb_width * sb_height) */
59 COORD cursor
; /* position in cells of cursor */
61 HANDLE hConIn
; /* console input handle */
62 HANDLE hConOut
; /* screen buffer handle: has to be changed when active sb changes */
63 HANDLE hSynchro
; /* waitable handle signalled by server when something in server has been modified */
64 HANDLE hProcess
; /* handle to the child process or NULL */
65 HWND hWnd
; /* handle of 'user' window or NULL for 'curses' */
66 INT nCmdShow
; /* argument of WinMain */
67 BOOL in_set_config
; /* to handle re-entrant calls to WINECON_SetConfig */
68 BOOL in_grab_changes
;/* to handle re-entrant calls to WINECON_GrabChanges */
69 BOOL dying
; /* to TRUE when we've been notified by server that child has died */
71 int (*fnMainLoop
)(struct inner_data
* data
);
72 void (*fnPosCursor
)(const struct inner_data
* data
);
73 void (*fnShapeCursor
)(struct inner_data
* data
, int size
, int vis
, BOOL force
);
74 void (*fnComputePositions
)(struct inner_data
* data
);
75 void (*fnRefresh
)(const struct inner_data
* data
, int tp
, int bm
);
76 void (*fnResizeScreenBuffer
)(struct inner_data
* data
);
77 void (*fnSetTitle
)(const struct inner_data
* data
);
78 void (*fnScroll
)(struct inner_data
* data
, int pos
, BOOL horz
);
79 void (*fnSetFont
)(struct inner_data
* data
, const WCHAR
* font
, unsigned height
, unsigned weight
);
80 void (*fnDeleteBackend
)(struct inner_data
* data
);
82 void* private; /* data part belonging to the chosen backend */
85 /* from wineconsole.c */
86 extern void WINECON_Fatal(const char* msg
);
87 extern void WINECON_ResizeWithContainer(struct inner_data
* data
, int width
, int height
);
88 extern int WINECON_GetHistorySize(HANDLE hConIn
);
89 extern int WINECON_GetHistoryMode(HANDLE hConIn
);
90 extern BOOL
WINECON_GetConsoleTitle(HANDLE hConIn
, WCHAR
* buffer
, size_t len
);
91 extern void WINECON_GrabChanges(struct inner_data
* data
);
92 extern void WINECON_SetConfig(struct inner_data
* data
,
93 const struct config_data
* cfg
);
95 extern void WINECON_RegLoad(const WCHAR
* appname
, struct config_data
* cfg
);
96 extern void WINECON_RegSave(const struct config_data
* cfg
);
97 extern void WINECON_DumpConfig(const char* pfx
, const struct config_data
* cfg
);
101 init_success
, init_failed
, init_not_supported
103 extern enum init_return
WCUSER_InitBackend(struct inner_data
* data
);
104 extern enum init_return
WCCURSES_InitBackend(struct inner_data
* data
);