2001-12-04 21:46:54 +01:00
|
|
|
/*
|
|
|
|
* an application for displaying Win32 console
|
|
|
|
*
|
|
|
|
* Copyright 2001 Eric Pouech
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-12-04 21:46:54 +01:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <windef.h>
|
2001-11-24 00:04:58 +01:00
|
|
|
#include <winbase.h>
|
|
|
|
#include <wincon.h>
|
|
|
|
|
|
|
|
#include "wineconsole_res.h"
|
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
/* this is the configuration stored & loaded into the registry */
|
|
|
|
struct config_data {
|
2002-06-01 01:06:46 +02:00
|
|
|
unsigned cell_width; /* width in pixels of a character */
|
2001-12-04 21:46:54 +01:00
|
|
|
unsigned cell_height; /* height in pixels of a character */
|
|
|
|
int cursor_size; /* in % of cell height */
|
|
|
|
int cursor_visible;
|
|
|
|
DWORD def_attr;
|
|
|
|
WCHAR face_name[32]; /* name of font (size is LF_FACESIZE) */
|
|
|
|
DWORD font_weight;
|
2002-09-04 20:41:52 +02:00
|
|
|
DWORD history_size; /* number of commands in history buffer */
|
|
|
|
DWORD history_nodup; /* TRUE if commands are not stored twice in buffer */
|
2015-06-30 12:05:35 +02:00
|
|
|
DWORD insert_mode; /* TRUE to insert text at the cursor location; FALSE to overwrite it */
|
2001-12-04 21:46:54 +01:00
|
|
|
DWORD menu_mask; /* MK_CONTROL MK_SHIFT mask to drive submenu opening */
|
2002-02-04 19:41:32 +01:00
|
|
|
DWORD quick_edit; /* whether mouse ops are sent to app (false) or used for content selection (true) */
|
2001-12-04 21:46:54 +01:00
|
|
|
unsigned sb_width; /* active screen buffer width */
|
|
|
|
unsigned sb_height; /* active screen buffer height */
|
|
|
|
unsigned win_width; /* size (in cells) of visible part of window (width & height) */
|
|
|
|
unsigned win_height;
|
|
|
|
COORD win_pos; /* position (in cells) of visible part of screen buffer in window */
|
2002-05-21 20:05:16 +02:00
|
|
|
BOOL exit_on_die; /* whether the wineconsole should quit if server destroys the console */
|
2003-01-09 07:01:51 +01:00
|
|
|
unsigned edition_mode; /* edition mode flavor while line editing */
|
2002-09-04 20:41:52 +02:00
|
|
|
WCHAR* registry; /* <x> part of HKLU\\<x>\\Console where config is read from (NULL if default settings) */
|
2001-12-04 21:46:54 +01:00
|
|
|
};
|
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
struct inner_data {
|
2001-12-04 21:46:54 +01:00
|
|
|
struct config_data curcfg;
|
|
|
|
|
2001-11-24 00:04:58 +01:00
|
|
|
CHAR_INFO* cells; /* local copy of cells (sb_width * sb_height) */
|
|
|
|
|
|
|
|
COORD cursor; /* position in cells of cursor */
|
|
|
|
|
|
|
|
HANDLE hConIn; /* console input handle */
|
|
|
|
HANDLE hConOut; /* screen buffer handle: has to be changed when active sb changes */
|
|
|
|
HANDLE hSynchro; /* waitable handle signalled by server when something in server has been modified */
|
2015-09-24 04:34:57 +02:00
|
|
|
HANDLE hProcess; /* handle to the child process or NULL */
|
2007-08-23 17:14:58 +02:00
|
|
|
HWND hWnd; /* handle of 'user' window or NULL for 'curses' */
|
2005-04-14 13:30:09 +02:00
|
|
|
INT nCmdShow; /* argument of WinMain */
|
2010-11-15 21:36:02 +01:00
|
|
|
BOOL in_set_config; /* to handle re-entrant calls to WINECON_SetConfig */
|
2011-09-08 22:27:41 +02:00
|
|
|
BOOL in_grab_changes;/* to handle re-entrant calls to WINECON_GrabChanges */
|
2011-03-20 09:18:10 +01:00
|
|
|
BOOL dying; /* to TRUE when we've been notified by server that child has died */
|
2001-11-24 00:04:58 +01:00
|
|
|
|
|
|
|
int (*fnMainLoop)(struct inner_data* data);
|
|
|
|
void (*fnPosCursor)(const struct inner_data* data);
|
|
|
|
void (*fnShapeCursor)(struct inner_data* data, int size, int vis, BOOL force);
|
|
|
|
void (*fnComputePositions)(struct inner_data* data);
|
|
|
|
void (*fnRefresh)(const struct inner_data* data, int tp, int bm);
|
|
|
|
void (*fnResizeScreenBuffer)(struct inner_data* data);
|
|
|
|
void (*fnSetTitle)(const struct inner_data* data);
|
|
|
|
void (*fnScroll)(struct inner_data* data, int pos, BOOL horz);
|
2002-09-04 20:41:52 +02:00
|
|
|
void (*fnSetFont)(struct inner_data* data, const WCHAR* font, unsigned height, unsigned weight);
|
2001-11-24 00:04:58 +01:00
|
|
|
void (*fnDeleteBackend)(struct inner_data* data);
|
|
|
|
|
2014-10-02 10:30:06 +02:00
|
|
|
void* private; /* data part belonging to the chosen backend */
|
2001-11-24 00:04:58 +01:00
|
|
|
};
|
|
|
|
|
2001-12-04 21:46:54 +01:00
|
|
|
/* from wineconsole.c */
|
2002-09-04 20:41:52 +02:00
|
|
|
extern void WINECON_Fatal(const char* msg);
|
2010-11-15 21:36:02 +01:00
|
|
|
extern void WINECON_ResizeWithContainer(struct inner_data* data, int width, int height);
|
2001-11-24 00:04:58 +01:00
|
|
|
extern int WINECON_GetHistorySize(HANDLE hConIn);
|
|
|
|
extern int WINECON_GetHistoryMode(HANDLE hConIn);
|
|
|
|
extern BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len);
|
2011-03-20 09:18:10 +01:00
|
|
|
extern void WINECON_GrabChanges(struct inner_data* data);
|
|
|
|
extern void WINECON_SetConfig(struct inner_data* data,
|
2005-11-03 12:32:52 +01:00
|
|
|
const struct config_data* cfg);
|
2001-12-04 21:46:54 +01:00
|
|
|
/* from registry.c */
|
2002-09-04 20:41:52 +02:00
|
|
|
extern void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg);
|
|
|
|
extern void WINECON_RegSave(const struct config_data* cfg);
|
|
|
|
extern void WINECON_DumpConfig(const char* pfx, const struct config_data* cfg);
|
2001-12-04 21:46:54 +01:00
|
|
|
|
|
|
|
/* backends... */
|
2003-06-13 18:32:52 +02:00
|
|
|
enum init_return {
|
|
|
|
init_success, init_failed, init_not_supported
|
|
|
|
};
|
|
|
|
extern enum init_return WCUSER_InitBackend(struct inner_data* data);
|
|
|
|
extern enum init_return WCCURSES_InitBackend(struct inner_data* data);
|