Mercurial > pidgin
annotate console/plugins/gntclipboard.c @ 15808:b0d74443fa2a
Protection against missing SHA1C
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 17 Mar 2007 17:38:12 +0000 |
parents | 8afc77eb6c1f |
children |
rev | line source |
---|---|
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
1 /** |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
2 * @file gntclipboard.c |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
3 * |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
4 * Copyright (C) 2007 Richard Nelson <wabz@whatsbeef.net> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
5 * |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
9 * (at your option) any later version. |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
10 * |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
15 * |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
19 */ |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
20 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
21 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
22 #include "internal.h" |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
23 #include <glib.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
24 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
25 #define PLUGIN_STATIC_NAME "GntClipboard" |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
26 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
27 #ifdef HAVE_X11 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
28 #include <X11/Xlib.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
29 #include <X11/Xutil.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
30 #include <X11/Xatom.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
31 #endif |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
32 |
15781 | 33 #include <sys/types.h> |
34 #include <signal.h> | |
35 | |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
36 #include <glib.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
37 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
38 #include <plugin.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
39 #include <version.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
40 #include <debug.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
41 #include <gntwm.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
42 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
43 #include <gntplugin.h> |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
44 |
15781 | 45 static pid_t child = 0; |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
46 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
47 static gulong sig_handle; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
48 |
15781 | 49 static void |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
50 set_clip(gchar *string) |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
51 { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
52 #ifdef HAVE_X11 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
53 Window w; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
54 XEvent e, respond; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
55 XSelectionRequestEvent *req; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
56 const char *ids; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
57 Display *dpy = XOpenDisplay(NULL); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
58 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
59 if (!dpy) |
15781 | 60 return; |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
61 ids = getenv("WINDOWID"); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
62 if (ids == NULL) |
15781 | 63 return; |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
64 w = atoi(ids); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
65 XSetSelectionOwner(dpy, XA_PRIMARY, w, CurrentTime); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
66 XFlush(dpy); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
67 XSelectInput(dpy, w, StructureNotifyMask); |
15781 | 68 while (TRUE) { |
69 XNextEvent(dpy, &e); /* this blocks. */ | |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
70 req = &e.xselectionrequest; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
71 if (e.type == SelectionRequest) { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
72 XChangeProperty(dpy, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
73 req->requestor, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
74 req->property, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
75 XA_STRING, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
76 8, PropModeReplace, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
77 (unsigned char *)string, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
78 strlen(string)); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
79 respond.xselection.property = req->property; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
80 respond.xselection.type = SelectionNotify; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
81 respond.xselection.display = req->display; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
82 respond.xselection.requestor = req->requestor; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
83 respond.xselection.selection = req->selection; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
84 respond.xselection.target= req->target; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
85 respond.xselection.time = req->time; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
86 XSendEvent(dpy, req->requestor, 0, 0, &respond); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
87 XFlush (dpy); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
88 } else if (e.type == SelectionClear) { |
15781 | 89 return; |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
90 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
91 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
92 #endif |
15781 | 93 return; |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
94 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
95 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
96 static void |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
97 clipboard_changed(GntWM *wm, gchar *string) |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
98 { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
99 #ifdef HAVE_X11 |
15781 | 100 if (child) { |
101 kill(child, SIGTERM); | |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
102 } |
15781 | 103 if ((child = fork() == 0)) { |
104 set_clip(string); | |
105 _exit(0); | |
106 } | |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
107 #endif |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
108 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
109 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
110 static gboolean |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
111 plugin_load(GaimPlugin *plugin) |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
112 { |
15781 | 113 if (!XOpenDisplay(NULL)) { |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
114 gaim_debug_warning("gntclipboard", "Couldn't find X display\n"); |
15781 | 115 return FALSE; |
116 } | |
117 if (!getenv("WINDOWID")) { | |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
118 gaim_debug_warning("gntclipboard", "Couldn't find window\n"); |
15781 | 119 return FALSE; |
120 } | |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
121 sig_handle = g_signal_connect(G_OBJECT(gnt_get_clipboard()), "clipboard_changed", G_CALLBACK(clipboard_changed), NULL); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
122 return TRUE; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
123 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
124 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
125 static gboolean |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
126 plugin_unload(GaimPlugin *plugin) |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
127 { |
15781 | 128 if (child) { |
129 kill(child, SIGTERM); | |
130 child = 0; | |
131 } | |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
132 g_signal_handler_disconnect(G_OBJECT(gnt_get_clipboard()), sig_handle); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
133 return TRUE; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
134 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
135 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
136 static GaimPluginInfo info = |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
137 { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
138 GAIM_PLUGIN_MAGIC, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
139 GAIM_MAJOR_VERSION, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
140 GAIM_MINOR_VERSION, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
141 GAIM_PLUGIN_STANDARD, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
142 GAIM_GNT_PLUGIN_TYPE, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
143 0, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
144 NULL, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
145 GAIM_PRIORITY_DEFAULT, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
146 "gntclipboard", |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
147 N_("GntClipboard"), |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
148 VERSION, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
149 N_("Clipboard plugin"), |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
150 N_("When the gnt clipboard contents change, " |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
151 "the contents are made available to X, if possible."), |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
152 "Richard Nelson <wabz@whatsbeef.net>", |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
153 "http://gaim.sourceforge.net", |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
154 plugin_load, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
155 plugin_unload, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
156 NULL, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
157 NULL, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
158 NULL, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
159 NULL, |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
160 NULL |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
161 }; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
162 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
163 static void |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
164 init_plugin(GaimPlugin *plugin) |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
165 { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
166 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
167 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
diff
changeset
|
168 GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |