openbsd-ports/www/links+/patches/patch-x_c
2002-09-15 07:29:55 +00:00

61 lines
1.4 KiB
Plaintext

$OpenBSD: patch-x_c,v 1.3 2002/09/15 07:29:55 fgsch Exp $
--- x.c.orig Thu Sep 12 04:31:03 2002
+++ x.c Sun Sep 15 03:52:31 2002
@@ -168,6 +168,20 @@ x_hash_table[X_HASH_TABLE_SIZE];
static int flush_in_progress=0;
+static void x_do_paste(struct graphics_device* gd)
+{
+ int num=0;
+ unsigned char *buffer,*p;
+
+ buffer=XFetchBytes(x_display,&num);
+ for (p=buffer;num>0;num--,p++)
+ {
+ if (*p==10)gd->keyboard_handler(gd,KBD_ENTER,0);
+ else
+ if (*p>=32)gd->keyboard_handler(gd,*p,0);
+ }
+ if (buffer)XFree(buffer);
+}
static void x_do_flush(void *ignore)
{
@@ -598,6 +612,11 @@ static void x_process_events(void *data)
gd=x_find_gd(&(event.xkey.window));
if (!gd)break;
x_translate_key((XKeyEvent*)(&event),&k,&f);
+ if (k == KBD_INS && f == KBD_SHIFT)
+ {
+ x_do_paste(gd);
+ return;
+ }
gd->keyboard_handler(gd,k,f);
}
break;
@@ -686,21 +705,8 @@ static void x_process_events(void *data)
case 2:
a=B_MIDDLE;
- if (event.xbutton.state & ShiftMask) /* paste */
- {
- int num=0;
- unsigned char *buffer,*p;
-
- buffer=XFetchBytes(x_display,&num);
- for (p=buffer;num>0;num--,p++)
- {
- if (*p==10)gd->keyboard_handler(gd,KBD_ENTER,0);
- else
- if (*p>=32)gd->keyboard_handler(gd,*p,0);
- }
- if (buffer)XFree(buffer);
- return;
- }
+ x_do_paste(gd);
+ return;
break;
case 4: