From: Chris Siebenmann <cks>
To: sam-fans
Subject: My patches
Date: Wed, 18 Nov 1992 20:42:01 -0500 [thread overview]
Message-ID: <92Nov18.204207est.2795@hawkwind.utcs.toronto.edu> (raw)
Here are my patches (and my readme for them). All diffs are relative
to the current source on research.att.com.
README.cks:
I've made various modifications to the sam source in these directories,
originally from research.att.com:/dist/sam. This is an attempt to sort of
describe them.
libXg:
- sweeping out a rectangle will now grab the pointer from the
X server; this means that you can swipe from outside the sam
window, making sure your windows line up neatly with the
boundary of the sam window.
- sam (more properly, samterm) will now attempt to use both old
and new style X selections; it always writes to both new and
old-style, and attempts to read from the old-style selection
if the new-style one is empty.
- menus no longer force the mouse to center on them; the pointer
stays where it was when you selected the menu.
libframe:
- some small diddling to work with Ultrix better
- u.h's exits() and _exits() macros fixed to a form more
palatable to the Sun ANSI compiler (v!=0 checks vs (v)).
- u.h: map exec() to execvp(), not execv(), so our
$PATH will get searched if necessary
samterm:
- change to mesg.c to center a searched-for selection in the
window (change by Byron)
I don't think there are any other bugs or real problems left in sam
and/or samterm, but I haven't used it TOO much.
Patches:
*** /tmp/,RCSt1a09176 Wed Nov 18 20:21:28 1992
--- libXg/getrect.c Mon Nov 16 17:44:04 1992
***************
*** 20,29 ****
--- 20,30 ----
but = 1<<(but-1);
cursorswitch(&sweep);
while(m->buttons)
*m = emouse();
+ _grabpointer();
while(!(m->buttons & but)){
*m = emouse();
if(m->buttons & (7^but))
goto Return;
}
***************
*** 42,48 ****
--- 43,50 ----
if(m->buttons & (7^but)){
rc.min.x = rc.max.x = 0;
while(m->buttons)
*m = emouse();
}
+ _ungrabpointer();
return rc;
}
*** /tmp/,RCSt1a09176 Wed Nov 18 20:21:29 1992
--- libXg/libgint.h Mon Nov 16 17:44:05 1992
***************
*** 35,44 ****
--- 35,48 ----
extern GC _getcopygc(Fcode, Bitmap*, Bitmap*, int*);
/* balloc without zero init (which uses a gc!) */
extern Bitmap *_balloc(Rectangle, int);
+ /* grab and ungrab the pointer. might be safe to make externally visible,
+ but really only around for getrect(). */
+ extern void _grabpointer(void), _ungrabpointer(void);
+
/* X Display for this application's connection */
extern Display *_dpy;
/* screen depth foreground and background for this application */
extern unsigned long _fgpixel, _bgpixel;
*** /tmp/,RCSt1a09176 Wed Nov 18 20:21:30 1992
--- libXg/menuhit.c Mon Nov 16 17:44:05 1992
***************
*** 76,86 ****
font, item, S);
}
bflush();
lasti = menusel(menur, m->xy);
r = menurect(menur, menu->lasthit);
! cursorset(divpt(add(r.min, sub(r.max, Pt(0,Vspacing))), 2));
bitblt(&screen, r.min, &screen, r, F&~D);
for(;;){
*m = emouse();
if(!(m->buttons & (1<<(but-1))))
break;
--- 76,86 ----
font, item, S);
}
bflush();
lasti = menusel(menur, m->xy);
r = menurect(menur, menu->lasthit);
! /* cursorset(divpt(add(r.min, sub(r.max, Pt(0,Vspacing))), 2)); */
bitblt(&screen, r.min, &screen, r, F&~D);
for(;;){
*m = emouse();
if(!(m->buttons & (1<<(but-1))))
break;
*** /tmp/,RCSt1a09176 Wed Nov 18 20:21:31 1992
--- libXg/xtbinit.c Mon Nov 16 17:44:04 1992
***************
*** 642,651 ****
--- 642,659 ----
int
snarfswap(char *s, int n, char **t)
{
*t = GwinSelectionSwap(widg, s);
+ if ((*t && strlen(*t) == 0) || !*t) {
+ int l;
+ /* Might be using old-style selections. */
+ *t = XFetchBytes(_dpy, &l);
+ }
+ /* Cope with really old clients: write into old selection
+ buffer too. */
+ XStoreBytes(_dpy, s, n);
if (*t)
return strlen(*t);
return 0;
}
***************
*** 662,666 ****
--- 670,690 ----
v.foreground, v.background, v.function, v.fill_style,
v.font, v.tile, v.stipple);
}
#endif
+ void
+ _grabpointer(void)
+ {
+ /* Grab X server with an iron hand. */
+ while (XGrabPointer(_dpy, XtWindow(widg), False,
+ ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|
+ StructureNotifyMask|ExposureMask|KeyPressMask,
+ GrabModeAsync, GrabModeAsync, None, None, CurrentTime)
+ != GrabSuccess)
+ (void) sleep(2);
+ }
+ void
+ _ungrabpointer(void)
+ {
+ XUngrabPointer(_dpy, CurrentTime);
+ }
*** /tmp/,RCSt1a09176 Wed Nov 18 20:21:32 1992
--- libframe/u.h Mon Nov 16 17:44:05 1992
***************
*** 91,100 ****
--- 91,105 ----
#define WEXITSTATUS(s) (((s)>>8)&0xFF)
#define NEEDMEMMOVE
#define NEEDSTDARG
#endif /* DYNIX */
+ #ifdef __ultrix
+ typedef unsigned long ulong;
+ #define NEEDSTDARG
+ #endif
+
#ifdef v10
typedef unsigned short ushort;
typedef unsigned long ulong;
#endif
***************
*** 105,120 ****
#define sprint sprintf
#define dup(a,b) dup2(a,b)
#define seek(a,b,c) lseek(a,b,c)
#define create(name, mode, perm) creat(name, perm)
! #define exec(a,b) execv(a,b)
#define USED(a)
#define SET(a)
! #define exits(v) if (v) exit(1); else exit(0)
! #define _exits(v) if (v) _exit(1); else _exit(0)
enum
{
OREAD = 0, /* open for read */
OWRITE = 1, /* open for write */
--- 110,125 ----
#define sprint sprintf
#define dup(a,b) dup2(a,b)
#define seek(a,b,c) lseek(a,b,c)
#define create(name, mode, perm) creat(name, perm)
! #define exec(a,b) execvp(a,b)
#define USED(a)
#define SET(a)
! #define exits(v) if (v!=0) exit(1); else exit(0)
! #define _exits(v) if (v!=0) _exit(1); else _exit(0)
enum
{
OREAD = 0, /* open for read */
OWRITE = 1, /* open for write */
*** /tmp/,RCSt1a09176 Wed Nov 18 20:21:33 1992
--- samterm/mesg.c Wed Nov 18 15:16:57 1992
***************
*** 492,502 ****
{
Text *t = whichtext(m);
Flayer *l = &t->l[t->front];
if(p0<l->origin || p0-l->origin>l->f.nchars*9/10)
! outTsll(Torigin, m, p0, 2L);
}
void
hcheck(int m)
{
--- 492,502 ----
{
Text *t = whichtext(m);
Flayer *l = &t->l[t->front];
if(p0<l->origin || p0-l->origin>l->f.nchars*9/10)
! outTsll(Torigin, m, p0, l->f.nlines / 2L);
}
void
hcheck(int m)
{
next reply other threads:[~1992-11-19 1:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-11-19 1:42 Chris Siebenmann [this message]
1992-11-19 2:12 ` good move Chris John Mackin
1992-11-19 22:21 ` My patches Scott Schwartz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92Nov18.204207est.2795@hawkwind.utcs.toronto.edu \
--to=sam-fans@hawkwind.utcs.toronto.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).