⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selection.c

📁 用于nano-x的xlib
💻 C
字号:
/* Copyright 2003, Jordan Crouse (jordan@cosmicpenguin.net) */#include "nxlib.h"/* Het another dummy storage area.  We hold onto the value and   return them when XGetSelectionOwner says so   It seems that selections live forever - I don't see any way to   remove them.  That's odd to me, but oh, well......*/struct sstruct {	Atom selection;	Window owner;	Time time;	struct ssstruct *next;};static struct sstruct *select_list = 0;int XSetSelectionOwner(Display *display, Atom selection, Window owner, Time t) {		struct sstruct *select = select_list;	struct sstruct *prev = 0;		for( ; select; prev = select, select = select->next) 		if (select->selection == selection) {			if (t > select->time) { 				select->owner = owner;   /* Note:  SelectionClear event should get generated here */				select->time = (t == CurrentTime) ? time(0) : t;			}						return 0;		}		select = (struct sstruct *) malloc(sizeof(struct sstruct));	select->selection = selection;	select->owner = owner;	select->time = (t == CurrentTime) ? time(0) : t;	select->next = 0;	if (!prev) select_list = select;	else prev->next = select;	return 0;}static struct sstruct *find_selection(Atom selection) {	struct sstruct *select = select_list;		for (; select; select = select->next) 		if (select->selection == selection) return select;	return 0;}Window XGetSelectionOwner(Display *display, Atom selection) {	struct sstruct *select = find_selection(selection);	return (select) ? select->owner : None;}/* Move selection to target.  There are lots of events that might be generated here, but for now we won't   worry about those. */int XConvertSelection(Display *display, Atom selection, Atom target, Atom property, Window requestor, Time t) {	struct sstruct *select = find_selection(selection);		select->selection = target;	select->time = (t == CurrentTime) ? time(0) : t;	/* We should generate a SelectionRequest event to the owner in this 	   situation, or if there is no owner, then a SelectionNotify 	   to the requestor 	*/	return 0;}				

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -