Wed Nov 15 14:20:13 PST 2000 Michael Jennings <mej@eterm.org>

As requested by Chris Morton <chris.morton@ericsson.com>, I added
	support for the SunCut, SunCopy, SunPaste, and SunFront keys.  The 1st
	3 operate on the xclipboard-managed "ClipBoard" buffer.  The SunFront
	key will activate Eterm's "steal focus" mechanism.


SVN revision: 3891
eterm-0.10
Michael Jennings 22 years ago
parent 718ea96410
commit 1bcfa73217
  1. 8
      ChangeLog
  2. 52
      src/screen.c
  3. 11
      src/screen.h
  4. 8
      src/term.c

@ -3969,3 +3969,11 @@ Tue Nov 14 17:17:53 PST 2000 Michael Jennings <mej@eterm.org>
this will not work with those themes.
-------------------------------------------------------------------------------
Wed Nov 15 14:20:13 PST 2000 Michael Jennings <mej@eterm.org>
As requested by Chris Morton <chris.morton@ericsson.com>, I added
support for the SunCut, SunCopy, SunPaste, and SunFront keys. The 1st
3 operate on the xclipboard-managed "ClipBoard" buffer. The SunFront
key will activate Eterm's "steal focus" mechanism.
-------------------------------------------------------------------------------

@ -2364,7 +2364,7 @@ PasteIt(unsigned char *data, unsigned int nitems)
* EXT: SelectionNotify
*/
void
selection_paste(Window win, unsigned prop, int Delete)
selection_paste(Window win, unsigned prop, int delete)
{
long nread;
unsigned long bytes_after, nitems;
@ -2375,7 +2375,7 @@ selection_paste(Window win, unsigned prop, int Delete)
if (prop == None)
return;
for (nread = 0, bytes_after = 1; bytes_after > 0;) {
if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE, Delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success)) {
if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE, delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success)) {
if (data != NULL) {
XFree(data);
}
@ -2441,6 +2441,46 @@ selection_request(Time tm, int x, int y)
}
}
void
selection_copy(Atom selection, Atom prop, char *str, size_t len)
{
XSetSelectionOwner(Xdisplay, selection, TermWin.vt, CurrentTime);
if (XGetSelectionOwner(Xdisplay, XA_PRIMARY) != TermWin.vt) {
print_error("Can't take ownership of primary selection\n");
}
XChangeProperty(Xdisplay, Xroot, prop, XA_STRING, 8, PropModeReplace, str, len);
}
void
selection_copy_to_clipboard(void)
{
if (selection.text) {
selection_copy(X_CLIPBOARD_SELECTION, X_CLIPBOARD_PROP, selection.text, selection.len);
}
}
void
selection_paste_from_clipboard(void)
{
Atom select, type;
select = X_CLIPBOARD_SELECTION;
if (XGetSelectionOwner(Xdisplay, select) == None) {
selection_paste(Xroot, X_CLIPBOARD_PROP, False);
} else {
type = XInternAtom(Xdisplay, "VT_SELECTION", False);
#if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H)
if (encoding_method != LATIN1) {
XConvertSelection(Xdisplay, select, XA_COMPOUND_TEXT(Xdisplay), type, TermWin.vt, CurrentTime);
} else {
XConvertSelection(Xdisplay, select, XA_STRING, type, TermWin.vt, CurrentTime);
}
#else
XConvertSelection(Xdisplay, select, XA_STRING, type, TermWin.vt, CurrentTime);
#endif
}
}
/*
* Clear the current selection from the screen rendition list
*/
@ -2664,12 +2704,10 @@ selection_make(Time tm)
selection.text = new_selection_text;
selection.screen = current_screen;
XSetSelectionOwner(Xdisplay, XA_PRIMARY, TermWin.vt, tm);
if (XGetSelectionOwner(Xdisplay, XA_PRIMARY) != TermWin.vt)
print_error("can't get primary selection\n");
XChangeProperty(Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8,
PropModeReplace, selection.text, selection.len);
selection_copy(XA_PRIMARY, XA_CUT_BUFFER0, selection.text, selection.len);
D_SELECT(("selection.len=%d\n", selection.len));
return;
tm = 0;
}
/*

@ -16,6 +16,14 @@
#include <X11/Xfuncproto.h>
#include "startup.h"
#ifdef XA_CLIPBOARD
# define X_CLIPBOARD_SELECTION XA_CLIPBOARD(Xdisplay)
# define X_CLIPBOARD_PROP XA_CLIPBOARD(Xdisplay)
#else
# define X_CLIPBOARD_SELECTION XA_PRIMARY
# define X_CLIPBOARD_PROP XA_CUT_BUFFER0
#endif
/************ Macros and Definitions ************/
#define WRAP_CHAR (MAX_COLS + 1)
#define PROP_SIZE 4096
@ -279,6 +287,9 @@ extern void selection_check(void);
extern void PasteIt(unsigned char *, unsigned int);
extern void selection_paste(Window, unsigned, int);
extern void selection_request(Time, int, int);
extern void selection_copy(Atom, Atom, char *, size_t);
extern void selection_copy_to_clipboard(void);
extern void selection_paste_from_clipboard(void);
extern void selection_reset(void);
extern void selection_clear(void);
extern void selection_setclr(int, int, int, int, int);

@ -296,16 +296,20 @@ lookup_key(XEvent * ev)
}
#endif
#ifdef HAVE_X11_SUNKEYSYM_H
#if defined(HAVE_X11_SUNKEYSYM_H) && defined(HAVE_X11_XMU_ATOMS_H)
switch (keysym) {
case SunXK_Copy:
case SunXK_Cut:
selection_copy_to_clipboard();
LK_RET();
break;
case SunXK_Paste:
selection_request(ev->xkey.time, ev->xkey.x, ev->xkey.y);
selection_paste_from_clipboard();
LK_RET();
break;
case SunXK_Front:
xterm_seq(XTerm_Takeover, "");
LK_RET();
break;
default:
break;

Loading…
Cancel
Save