Merge pull request #363 from unxed/master

Fix far2l extensions support
This commit is contained in:
Cyd
2022-01-27 20:56:48 +01:00
committed by GitHub
10 changed files with 30 additions and 30 deletions
+1 -1
View File
@@ -1295,7 +1295,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppb(sesskey, "HideMousePtr", false, conf, CONF_hide_mouseptr);
gppb(sesskey, "SunkenEdge", false, conf, CONF_sunken_edge);
gppi(sesskey, "WindowBorder", 1, conf, CONF_window_border);
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
gppi(sesskey, "CurType", 1, conf, CONF_cursor_type);
gppb(sesskey, "BlinkCur", true, conf, CONF_blink_cur);
#else
+14 -14
View File
@@ -13,10 +13,10 @@
#include "putty.h"
#include "terminal.h"
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* base64 library - needed for far2l extensions support */
#include <windows/cencode.h>
#include <windows/cdecode.h>
#include <../far2l/cencode.h>
#include <../far2l/cdecode.h>
#endif
#ifdef MOD_PERSO
#include "charset.h"
@@ -2005,7 +2005,7 @@ Terminal *term_init(Conf *myconf, struct unicode_data *ucsdata, TermWin *win)
* that need it.
*/
term = snew(Terminal);
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l */
term->far2l_ext = 0; // far2l extensions mode is enabled?
term->is_apc = 0; // currently processing incoming APC sequence?
@@ -3215,7 +3215,7 @@ static void toggle_mode(Terminal *term, int mode, int query, bool state)
*/
static void do_osc(Terminal *term)
{
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l extensions support */
if (term->is_apc) {
@@ -3280,7 +3280,7 @@ static void do_osc(Terminal *term)
// until implementing dynamic osc_string allocation
#ifdef _WINDOWS
MessageBox(wgs.term_hwnd, "Too large clipboard :(", "Error", MB_OK);
MessageBox(NULL, "Too large clipboard :(", "Error", MB_OK);
#endif
// correct request id is lost forever
@@ -3339,13 +3339,13 @@ static void do_osc(Terminal *term)
NOTIFYICONDATAW pnid;
// todo: do this on window focus also
pnid.cbSize = sizeof(pnid);
pnid.hWnd = wgs.term_hwnd;
pnid.hWnd = NULL;
pnid.hIcon = LoadIcon(0, IDI_APPLICATION);
pnid.uID = 200;
Shell_NotifyIconW(NIM_DELETE, &pnid);
// todo: use putty icon
pnid.cbSize = sizeof(pnid);
pnid.hWnd = wgs.term_hwnd;
pnid.hWnd = NULL;
pnid.hIcon = LoadIcon(0, IDI_APPLICATION);
pnid.uID = 200;
pnid.uFlags = NIF_ICON | NIF_INFO | NIF_MESSAGE;
@@ -3413,7 +3413,7 @@ static void do_osc(Terminal *term)
#ifdef _WINDOWS
char ec_status = 0;
if (term->clip_allowed == 1) {
OpenClipboard(wgs.term_hwnd);
OpenClipboard(NULL);
ec_status = EmptyClipboard() ? 1 : 0;
CloseClipboard();
}
@@ -3464,7 +3464,7 @@ static void do_osc(Terminal *term)
#ifdef _WINDOWS
if (term->clip_allowed == -1) {
int status = MessageBox(wgs.term_hwnd,
int status = MessageBox(NULL,
"Allow far2l clipboard sync?", "PyTTY", MB_OKCANCEL);
if (status == IDOK) {
term->clip_allowed = 1;
@@ -3546,7 +3546,7 @@ static void do_osc(Terminal *term)
memcpy(GData,buffer,BufferSize);
GlobalUnlock(hData);
if (OpenClipboard(wgs.term_hwnd)) {
if (OpenClipboard(NULL)) {
if (!SetClipboardData(fmt, (HANDLE)hData)) {
GlobalFree(hData);
@@ -3605,7 +3605,7 @@ static void do_osc(Terminal *term)
int32_t ClipTextSize = 0;
if ((gfmt == CF_TEXT || gfmt == CF_UNICODETEXT || gfmt >= 0xC000) &&
OpenClipboard(wgs.term_hwnd))
OpenClipboard(NULL))
{
HANDLE hClipData = GetClipboardData((gfmt == CF_TEXT) ? CF_UNICODETEXT : gfmt);
@@ -4689,7 +4689,7 @@ static void term_out(Terminal *term)
term->esc_args[0] = ARG_DEFAULT;
term->esc_query = 0;
break;
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
case '_': /* far2l: processing APC is almost the same as processing OSC */
term->is_apc = 1;
//break;
@@ -5922,7 +5922,7 @@ static void term_out(Terminal *term)
} else {
term->termstate = OSC_STRING;
term->osc_strlen = 0;
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l */
if (term->is_apc) {
term->osc_string[term->osc_strlen++] = (char)c;
+3 -3
View File
@@ -185,7 +185,7 @@ struct terminal_tag {
#define ANSI(x,y) ((x)+((y)*256))
#define ANSI_QUE(x) ANSI(x,1)
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l extensions support */
//#define OSC_STR_MAX 2048
// todo: allocate osc_string dynamically
@@ -197,7 +197,7 @@ struct terminal_tag {
char osc_string[OSC_STR_MAX + 1];
bool osc_w;
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l */
int far2l_ext; // extensions mode on
bool is_apc; // currently processing APC sequence
@@ -219,7 +219,7 @@ struct terminal_tag {
SEEN_OSC_P,
OSC_STRING, OSC_MAYBE_ST,
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l extensions support */ SEEN_APC,
VT52_ESC,
#else
+6 -6
View File
@@ -10,10 +10,10 @@
#include <limits.h>
#include <assert.h>
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l extensions support - base64 encode/decode libs */
#include <cencode.h>
#include <cdecode.h>
#include <../../far2l/cencode.h>
#include <../../far2l/cdecode.h>
#endif
#ifdef __WINE__
@@ -618,7 +618,7 @@ static const SeatVtable win_seat_vt = {
.interactive = nullseat_interactive_yes,
.get_cursor_position = win_seat_get_cursor_position,
};
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
// "static" removed by far2l extensions support patch
// we need to access wgs from terminal.c to open dialog boxes, etc
WinGuiSeat wgs = { .seat.vt = &win_seat_vt,
@@ -4843,7 +4843,7 @@ free(cmd);
ignore_clip = wParam; /* don't panic on DESTROYCLIPBOARD */
break;
case WM_DESTROYCLIPBOARD:
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l extensions support */
// In far2l extensions mode we should not do anything here,
@@ -5620,7 +5620,7 @@ if( (GetKeyState(VK_MENU)&0x8000) && (wParam==VK_SPACE) ) {
* number noise.
*/
noise_ultralight(NOISE_SOURCE_KEY, lParam);
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/* far2l extensions support */
if (term->far2l_ext) {
+1 -1
View File
@@ -3,7 +3,7 @@
* and windlg.c.
*/
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
#pragma once
#endif
typedef struct WinGuiSeat WinGuiSeat;
+1 -1
View File
@@ -1,4 +1,4 @@
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/*
cdecoder.c - c source to a base64 decoding algorithm implementation
This is part of the libb64 project, and has been placed in the public domain.
+1 -1
View File
@@ -1,4 +1,4 @@
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/*
cdecode.h - c header for a base64 decoding algorithm
This is part of the libb64 project, and has been placed in the public domain.
+1 -1
View File
@@ -1,4 +1,4 @@
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/*
cencoder.c - c source to a base64 encoding algorithm implementation
This is part of the libb64 project, and has been placed in the public domain.
+1 -1
View File
@@ -1,4 +1,4 @@
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
/*
cencode.h - c header for a base64 encoding algorithm
This is part of the libb64 project, and has been placed in the public domain.
+1 -1
View File
@@ -759,7 +759,7 @@ void load_open_settings_forced(char *filename, Conf *conf) {
gppb_forced(sesskey, "HideMousePtr", false, conf, CONF_hide_mouseptr);
gppb_forced(sesskey, "SunkenEdge", false, conf, CONF_sunken_edge);
gppi_forced(sesskey, "WindowBorder", 1, conf, CONF_window_border);
#ifdef DMOD_FAR2L
#ifdef MOD_FAR2L
gppi_forced(sesskey, "CurType", 1, conf, CONF_cursor_type);
gppb_forced(sesskey, "BlinkCur", true, conf, CONF_blink_cur);
#else