mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-26 07:12:10 -05:00
Pointer-shape canging added -- we now have an I-beam cursor in the terminal
window. Pasting works! [originally from svn r123]
This commit is contained in:
parent
986977ac9e
commit
1353b2a903
40
mac.c
40
mac.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac.c,v 1.1.2.16 1999/03/16 20:27:30 ben Exp $ */
|
/* $Id: mac.c,v 1.1.2.17 1999/03/21 23:23:42 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -67,7 +67,7 @@ static void mac_updatewindow(WindowPtr);
|
|||||||
static void mac_keypress(EventRecord *);
|
static void mac_keypress(EventRecord *);
|
||||||
static int mac_windowtype(WindowPtr);
|
static int mac_windowtype(WindowPtr);
|
||||||
static void mac_menucommand(long);
|
static void mac_menucommand(long);
|
||||||
static void mac_adjustcursor(void);
|
static void mac_adjustcursor(RgnHandle);
|
||||||
static void mac_adjustmenus(void);
|
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);
|
||||||
@ -140,14 +140,17 @@ static void mac_eventloop(void) {
|
|||||||
Boolean gotevent;
|
Boolean gotevent;
|
||||||
EventRecord event;
|
EventRecord event;
|
||||||
int i;
|
int i;
|
||||||
|
RgnHandle cursrgn;
|
||||||
|
|
||||||
|
cursrgn = NewRgn();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
mac_adjustcursor();
|
mac_adjustcursor(cursrgn);
|
||||||
gotevent = WaitNextEvent(everyEvent, &event, LONG_MAX, NULL);
|
gotevent = WaitNextEvent(everyEvent, &event, LONG_MAX, cursrgn);
|
||||||
mac_adjustcursor();
|
mac_adjustcursor(cursrgn);
|
||||||
if (gotevent)
|
if (gotevent)
|
||||||
mac_event(&event);
|
mac_event(&event);
|
||||||
}
|
}
|
||||||
|
DisposeRgn(cursrgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mac_event(EventRecord *event) {
|
static void mac_event(EventRecord *event) {
|
||||||
@ -409,9 +412,32 @@ static void mac_adjustmenus(void) {
|
|||||||
/*
|
/*
|
||||||
* Make sure the right cursor's being displayed.
|
* Make sure the right cursor's being displayed.
|
||||||
*/
|
*/
|
||||||
static void mac_adjustcursor(void) {
|
static void mac_adjustcursor(RgnHandle cursrgn) {
|
||||||
|
Point mouse;
|
||||||
|
WindowPtr window, front;
|
||||||
|
short part;
|
||||||
|
|
||||||
SetCursor(&qd.arrow);
|
GetMouse(&mouse);
|
||||||
|
LocalToGlobal(&mouse);
|
||||||
|
part = FindWindow(mouse, &window);
|
||||||
|
front = FrontWindow();
|
||||||
|
if (part != inContent || window == NULL || window != front) {
|
||||||
|
/* Cursor isn't in the front window, so switch to arrow */
|
||||||
|
SetCursor(&qd.arrow);
|
||||||
|
SetRectRgn(cursrgn, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
|
||||||
|
if (front != NULL)
|
||||||
|
DiffRgn(cursrgn, front->visRgn, cursrgn);
|
||||||
|
} else {
|
||||||
|
switch (mac_windowtype(window)) {
|
||||||
|
case wTerminal:
|
||||||
|
mac_adjusttermcursor(window, mouse, cursrgn);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SetCursor(&qd.arrow);
|
||||||
|
CopyRgn(window->visRgn, cursrgn);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mac_shutdown(void) {
|
static void mac_shutdown(void) {
|
||||||
|
1
mac.h
1
mac.h
@ -22,6 +22,7 @@ extern struct mac_gestalts mac_gestalts;
|
|||||||
/* from macterm.c */
|
/* from macterm.c */
|
||||||
extern void mac_newsession(void);
|
extern void mac_newsession(void);
|
||||||
extern void mac_activateterm(WindowPtr, Boolean);
|
extern void mac_activateterm(WindowPtr, Boolean);
|
||||||
|
extern void mac_adjusttermcursor(WindowPtr, Point, RgnHandle);
|
||||||
extern void mac_adjusttermmenus(WindowPtr);
|
extern void mac_adjusttermmenus(WindowPtr);
|
||||||
extern void mac_updateterm(WindowPtr);
|
extern void mac_updateterm(WindowPtr);
|
||||||
extern void mac_clickterm(WindowPtr, EventRecord *);
|
extern void mac_clickterm(WindowPtr, EventRecord *);
|
||||||
|
36
macterm.c
36
macterm.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macterm.c,v 1.1.2.26 1999/03/18 00:04:34 ben Exp $ */
|
/* $Id: macterm.c,v 1.1.2.27 1999/03/21 23:23:42 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -239,6 +239,34 @@ static void mac_adjustwinbg(struct mac_session *s) {
|
|||||||
SetWinColor(s->window, s->wctab);
|
SetWinColor(s->window, s->wctab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the cursor shape correctly
|
||||||
|
*/
|
||||||
|
void mac_adjusttermcursor(WindowPtr window, Point mouse, RgnHandle cursrgn) {
|
||||||
|
struct mac_session *s;
|
||||||
|
ControlHandle control;
|
||||||
|
short part;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
SetPort(window);
|
||||||
|
s = (struct mac_session *)GetWRefCon(window);
|
||||||
|
GlobalToLocal(&mouse);
|
||||||
|
part = FindControl(mouse, window, &control);
|
||||||
|
if (control == s->scrollbar) {
|
||||||
|
SetCursor(&qd.arrow);
|
||||||
|
RectRgn(cursrgn, &(*s->scrollbar)->contrlRect);
|
||||||
|
SectRgn(cursrgn, window->visRgn, cursrgn);
|
||||||
|
} else {
|
||||||
|
x = mouse.h / font_width;
|
||||||
|
y = mouse.v / font_height;
|
||||||
|
SetCursor(*GetCursor(iBeamCursor));
|
||||||
|
/* Ask for shape changes if we leave this character cell. */
|
||||||
|
SetRectRgn(cursrgn, x * font_width, y * font_height,
|
||||||
|
(x + 1) * font_width, (y + 1) * font_height);
|
||||||
|
SectRgn(cursrgn, window->visRgn, cursrgn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable/disable menu items based on the active terminal window.
|
* Enable/disable menu items based on the active terminal window.
|
||||||
*/
|
*/
|
||||||
@ -370,10 +398,12 @@ void get_clip(void **p, int *lenp) {
|
|||||||
h = NULL;
|
h = NULL;
|
||||||
} else
|
} else
|
||||||
if (GetScrap(NULL, 'TEXT', &offset) > 0) {
|
if (GetScrap(NULL, 'TEXT', &offset) > 0) {
|
||||||
h = NewEmptyHandle();
|
h = NewHandle(0);
|
||||||
*lenp = GetScrap(h, 'TEXT', &offset);
|
*lenp = GetScrap(h, 'TEXT', &offset);
|
||||||
HLock(h);
|
HLock(h);
|
||||||
*p = *h;
|
*p = *h;
|
||||||
|
if (*p == NULL || *lenp <= 0)
|
||||||
|
fatalbox("Empty scrap");
|
||||||
} else {
|
} else {
|
||||||
*p = NULL;
|
*p = NULL;
|
||||||
*lenp = 0;
|
*lenp = 0;
|
||||||
@ -452,8 +482,6 @@ void mac_keyterm(WindowPtr window, EventRecord *event) {
|
|||||||
s = (struct mac_session *)GetWRefCon(window);
|
s = (struct mac_session *)GetWRefCon(window);
|
||||||
len = mac_keytrans(s, event, buf);
|
len = mac_keytrans(s, event, buf);
|
||||||
back->send((char *)buf, len);
|
back->send((char *)buf, len);
|
||||||
term_out();
|
|
||||||
term_update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mac_keytrans(struct mac_session *s, EventRecord *event,
|
static int mac_keytrans(struct mac_session *s, EventRecord *event,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: testback.c,v 1.1.2.2 1999/03/18 00:04:34 ben Exp $ */
|
/* $Id: testback.c,v 1.1.2.3 1999/03/21 23:23:43 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Simon Tatham
|
* Copyright (c) 1999 Simon Tatham
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
@ -70,6 +70,8 @@ static void loop_send (char *buf, int len) {
|
|||||||
inbuf_head = new_head;
|
inbuf_head = new_head;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
term_out();
|
||||||
|
term_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user