mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-27 07:42:09 -05:00
Meta key support, mostly.
[originally from svn r131]
This commit is contained in:
parent
04aceed7bf
commit
f050f04135
16
mac.c
16
mac.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac.c,v 1.1.2.18 1999/03/27 15:39:45 ben Exp $ */
|
/* $Id: mac.c,v 1.1.2.19 1999/03/28 02:06:10 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -59,6 +59,7 @@ struct mac_gestalts mac_gestalts;
|
|||||||
|
|
||||||
static void mac_startup(void);
|
static void mac_startup(void);
|
||||||
static void mac_eventloop(void);
|
static void mac_eventloop(void);
|
||||||
|
#pragma noreturn (mac_eventloop)
|
||||||
static void mac_event(EventRecord *);
|
static void mac_event(EventRecord *);
|
||||||
static void mac_contentclick(WindowPtr, EventRecord *);
|
static void mac_contentclick(WindowPtr, EventRecord *);
|
||||||
static void mac_growwindow(WindowPtr, EventRecord *);
|
static void mac_growwindow(WindowPtr, EventRecord *);
|
||||||
@ -72,6 +73,7 @@ static void mac_adjustmenus(void);
|
|||||||
static void mac_closewindow(WindowPtr);
|
static void mac_closewindow(WindowPtr);
|
||||||
static void mac_zoomwindow(WindowPtr, short);
|
static void mac_zoomwindow(WindowPtr, short);
|
||||||
static void mac_shutdown(void);
|
static void mac_shutdown(void);
|
||||||
|
#pragma noreturn (mac_shutdown)
|
||||||
|
|
||||||
struct mac_windows {
|
struct mac_windows {
|
||||||
WindowPtr terminal; /* XXX: Temporary */
|
WindowPtr terminal; /* XXX: Temporary */
|
||||||
@ -87,6 +89,8 @@ int main (int argc, char **argv) {
|
|||||||
mac_eventloop();
|
mac_eventloop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma noreturn (main)
|
||||||
|
|
||||||
static void mac_startup(void) {
|
static void mac_startup(void) {
|
||||||
Handle menuBar;
|
Handle menuBar;
|
||||||
|
|
||||||
@ -290,11 +294,17 @@ static int mac_windowtype(WindowPtr window) {
|
|||||||
static void mac_keypress(EventRecord *event) {
|
static void mac_keypress(EventRecord *event) {
|
||||||
WindowPtr window;
|
WindowPtr window;
|
||||||
|
|
||||||
if (event->what == keyDown && (event->modifiers & cmdKey)) {
|
window = FrontWindow();
|
||||||
|
/*
|
||||||
|
* Check for a command-key combination, but ignore it if it counts
|
||||||
|
* as a meta-key combination and we're in a terminal window.
|
||||||
|
*/
|
||||||
|
if (event->what == keyDown && (event->modifiers & cmdKey) &&
|
||||||
|
!((event->modifiers & cfg.meta_modifiers) == cfg.meta_modifiers &&
|
||||||
|
mac_windowtype(window) == wTerminal)) {
|
||||||
mac_adjustmenus();
|
mac_adjustmenus();
|
||||||
mac_menucommand(MenuKey(event->message & charCodeMask));
|
mac_menucommand(MenuKey(event->message & charCodeMask));
|
||||||
} else {
|
} else {
|
||||||
window = FrontWindow();
|
|
||||||
switch (mac_windowtype(window)) {
|
switch (mac_windowtype(window)) {
|
||||||
case wTerminal:
|
case wTerminal:
|
||||||
mac_keyterm(window, event);
|
mac_keyterm(window, event);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac_res.r,v 1.1.2.13 1999/03/16 20:27:30 ben Exp $ */
|
/* $Id: mac_res.r,v 1.1.2.14 1999/03/28 02:06:10 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -545,6 +545,7 @@ type 'pSET' {
|
|||||||
longint; /* font_height */
|
longint; /* font_height */
|
||||||
integer; /* 'pltt' for colours */
|
integer; /* 'pltt' for colours */
|
||||||
integer; /* 'wORD' for wordness */
|
integer; /* 'wORD' for wordness */
|
||||||
|
integer; /* meta modifiers */
|
||||||
};
|
};
|
||||||
|
|
||||||
resource 'pSET' (PREF_settings, "settings", purgeable) {
|
resource 'pSET' (PREF_settings, "settings", purgeable) {
|
||||||
@ -576,6 +577,7 @@ resource 'pSET' (PREF_settings, "settings", purgeable) {
|
|||||||
PREF_pltt, /* colours 'pltt' */
|
PREF_pltt, /* colours 'pltt' */
|
||||||
#define PREF_wordness 1024
|
#define PREF_wordness 1024
|
||||||
PREF_wordness, /* wordness 'wORD */
|
PREF_wordness, /* wordness 'wORD */
|
||||||
|
0x900, /* meta modifiers (cmd+option) */
|
||||||
};
|
};
|
||||||
|
|
||||||
resource 'STR#' (PREF_strings, "strings", purgeable) {
|
resource 'STR#' (PREF_strings, "strings", purgeable) {
|
||||||
@ -688,6 +690,7 @@ resource 'TMPL' (128, "pSET") {
|
|||||||
"Font size", 'DLNG',
|
"Font size", 'DLNG',
|
||||||
"pltt ID", 'DWRD',
|
"pltt ID", 'DWRD',
|
||||||
"wORD ID", 'DWRD',
|
"wORD ID", 'DWRD',
|
||||||
|
"meta modifiers", 'HWRD',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
4
maccfg.c
4
maccfg.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: maccfg.c,v 1.1.2.4 1999/03/23 21:00:05 ben Exp $ */
|
/* $Id: maccfg.c,v 1.1.2.5 1999/03/28 02:06:10 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* maccfg.c -- Mac port configuration
|
* maccfg.c -- Mac port configuration
|
||||||
*/
|
*/
|
||||||
@ -75,6 +75,7 @@ struct pSET {
|
|||||||
long font_height;
|
long font_height;
|
||||||
short colours_id;
|
short colours_id;
|
||||||
short wordness_id;
|
short wordness_id;
|
||||||
|
unsigned short meta_modifiers;
|
||||||
};
|
};
|
||||||
#pragma options align=reset
|
#pragma options align=reset
|
||||||
|
|
||||||
@ -112,6 +113,7 @@ void mac_loadconfig(Config *cfg) {
|
|||||||
cfg->linux_funkeys = (s->kbd_flags & LINUX_FUNKEYS) != 0;
|
cfg->linux_funkeys = (s->kbd_flags & LINUX_FUNKEYS) != 0;
|
||||||
cfg->app_cursor = (s->kbd_flags & APP_CURSOR) != 0;
|
cfg->app_cursor = (s->kbd_flags & APP_CURSOR) != 0;
|
||||||
cfg->app_keypad = (s->kbd_flags & APP_KEYPAD) != 0;
|
cfg->app_keypad = (s->kbd_flags & APP_KEYPAD) != 0;
|
||||||
|
cfg->meta_modifiers = s->meta_modifiers;
|
||||||
/* Terminal */
|
/* Terminal */
|
||||||
cfg->savelines = s->savelines;
|
cfg->savelines = s->savelines;
|
||||||
cfg->dec_om = (s->term_flags & DEC_OM) != 0;
|
cfg->dec_om = (s->term_flags & DEC_OM) != 0;
|
||||||
|
34
macterm.c
34
macterm.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macterm.c,v 1.1.2.29 1999/03/27 15:39:45 ben Exp $ */
|
/* $Id: macterm.c,v 1.1.2.30 1999/03/28 02:06:10 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -41,6 +41,7 @@
|
|||||||
#include <QuickdrawText.h>
|
#include <QuickdrawText.h>
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <Scrap.h>
|
#include <Scrap.h>
|
||||||
|
#include <Script.h>
|
||||||
#include <Sound.h>
|
#include <Sound.h>
|
||||||
#include <ToolUtils.h>
|
#include <ToolUtils.h>
|
||||||
|
|
||||||
@ -493,6 +494,25 @@ void mac_keyterm(WindowPtr window, EventRecord *event) {
|
|||||||
back->send((char *)buf, len);
|
back->send((char *)buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UInt32 mac_rekey(EventModifiers newmodifiers, UInt32 oldmessage) {
|
||||||
|
UInt32 transresult, state;
|
||||||
|
Ptr kchr;
|
||||||
|
|
||||||
|
state = 0;
|
||||||
|
kchr = (Ptr)GetScriptManagerVariable(smKCHRCache);
|
||||||
|
transresult = KeyTranslate(kchr,
|
||||||
|
(oldmessage & keyCodeMask) >> 8 |
|
||||||
|
newmodifiers & 0xff00,
|
||||||
|
&state);
|
||||||
|
/*
|
||||||
|
* KeyTranslate returns two character codes. We only worry about
|
||||||
|
* one. Yes, this is slightly bogus, but it makes life less
|
||||||
|
* painful.
|
||||||
|
*/
|
||||||
|
return oldmessage & ~charCodeMask | transresult & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int mac_keytrans(struct mac_session *s, EventRecord *event,
|
static int mac_keytrans(struct mac_session *s, EventRecord *event,
|
||||||
unsigned char *output) {
|
unsigned char *output) {
|
||||||
unsigned char *p = output;
|
unsigned char *p = output;
|
||||||
@ -500,6 +520,14 @@ static int mac_keytrans(struct mac_session *s, EventRecord *event,
|
|||||||
|
|
||||||
/* No meta key yet -- that'll be rather fun. */
|
/* No meta key yet -- that'll be rather fun. */
|
||||||
|
|
||||||
|
/* Check if the meta "key" was held down */
|
||||||
|
|
||||||
|
if ((event->modifiers & cfg.meta_modifiers) == cfg.meta_modifiers) {
|
||||||
|
*p++ = '\033';
|
||||||
|
event->modifiers &= ~cfg.meta_modifiers;
|
||||||
|
event->message = mac_rekey(event->modifiers, event->message);
|
||||||
|
}
|
||||||
|
|
||||||
/* Keys that we handle locally */
|
/* Keys that we handle locally */
|
||||||
if (event->modifiers & shiftKey) {
|
if (event->modifiers & shiftKey) {
|
||||||
switch (event->message & keyCodeMask) {
|
switch (event->message & keyCodeMask) {
|
||||||
@ -669,8 +697,8 @@ void mac_updateterm(WindowPtr window) {
|
|||||||
(*window->visRgn)->rgnBBox.right,
|
(*window->visRgn)->rgnBBox.right,
|
||||||
(*window->visRgn)->rgnBBox.bottom);
|
(*window->visRgn)->rgnBBox.bottom);
|
||||||
/* Restore default colours in case the Window Manager uses them */
|
/* Restore default colours in case the Window Manager uses them */
|
||||||
PmForeColor(16);
|
PmForeColor(DEFAULT_FG);
|
||||||
PmBackColor(18);
|
PmBackColor(DEFAULT_BG);
|
||||||
if (FrontWindow() != window)
|
if (FrontWindow() != window)
|
||||||
EraseRect(&(*s->scrollbar)->contrlRect);
|
EraseRect(&(*s->scrollbar)->contrlRect);
|
||||||
UpdateControls(window, window->visRgn);
|
UpdateControls(window, window->visRgn);
|
||||||
|
13
mkputty.mpw
13
mkputty.mpw
@ -1,9 +1,14 @@
|
|||||||
|
# $Id: mkputty.mpw,v 1.1.2.5 1999/03/28 02:06:11 ben Exp $
|
||||||
|
|
||||||
Set program PuTTY
|
Set program PuTTY
|
||||||
Set makefile Makefile.mpw
|
Set makefile Makefile.mpw
|
||||||
|
|
||||||
# Run Make, then execute its output.
|
# Run Make, then execute its output.
|
||||||
|
|
||||||
Echo "# `Date -t` ----- Build of {program}."
|
Echo "# `Date -t` ----- Build of {program}."
|
||||||
|
#if (`exists "#"Å"#"`)
|
||||||
|
# echo "# `Date -t` ----- Warning: auto-save file present."
|
||||||
|
#end
|
||||||
Echo "# `Date -t` ----- Analyzing dependencies."
|
Echo "# `Date -t` ----- Analyzing dependencies."
|
||||||
Begin
|
Begin
|
||||||
Echo "Set Echo 1"
|
Echo "Set Echo 1"
|
||||||
@ -17,12 +22,4 @@ Set type "`files -i -n -x t "{program}"
|
|||||||
Set CaseSensitive True #filetype check for DA must be case sensitive
|
Set CaseSensitive True #filetype check for DA must be case sensitive
|
||||||
If "{type}" =~ /Å APPL/ OR "{type}" =~ /Å MPST/ # application or tool
|
If "{type}" =~ /Å APPL/ OR "{type}" =~ /Å MPST/ # application or tool
|
||||||
Echo -n ¶t; Quote -n "{program}"; Echo -n " "
|
Echo -n ¶t; Quote -n "{program}"; Echo -n " "
|
||||||
Else If "{type}" =~ /Å DFIL/ # desk accessory in Suitcase
|
|
||||||
Echo -n ¶t
|
|
||||||
Quote -n "Font/DA Mover" "{SystemFolder}"System "{program}";
|
|
||||||
Echo -n " # Install DA"
|
|
||||||
Else If "{type}" =~ /Å dfil/ # desk accessory (System 7)
|
|
||||||
Echo -n ¶t
|
|
||||||
Quote -n Duplicate -y "{program}" "{SystemFolder}Apple Menu Items";
|
|
||||||
Echo -n " # Install DA into Apple Menu"
|
|
||||||
End
|
End
|
||||||
|
4
putty.h
4
putty.h
@ -144,6 +144,7 @@ typedef struct {
|
|||||||
int linux_funkeys;
|
int linux_funkeys;
|
||||||
int app_cursor;
|
int app_cursor;
|
||||||
int app_keypad;
|
int app_keypad;
|
||||||
|
int meta_modifiers;
|
||||||
/* Terminal options */
|
/* Terminal options */
|
||||||
int savelines;
|
int savelines;
|
||||||
int dec_om;
|
int dec_om;
|
||||||
@ -209,6 +210,9 @@ void get_clip (void **, int *);
|
|||||||
void optimised_move (int, int, int);
|
void optimised_move (int, int, int);
|
||||||
void do_scroll(int, int, int);
|
void do_scroll(int, int, int);
|
||||||
void fatalbox (const char *, ...);
|
void fatalbox (const char *, ...);
|
||||||
|
#ifdef macintosh
|
||||||
|
#pragma noreturn (fatalbox)
|
||||||
|
#endif
|
||||||
void beep (void);
|
void beep (void);
|
||||||
#define OPTIMISE_IS_SCROLL 1
|
#define OPTIMISE_IS_SCROLL 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user