aboutsummaryrefslogtreecommitdiffstats
path: root/src/pgtkselect.c
diff options
context:
space:
mode:
authorYuuki Harano2020-05-24 18:16:03 +0900
committerJeff Walsh2020-11-24 12:24:40 +1100
commit72f79d820df2eff19d1127ab687fac11ffd1c379 (patch)
tree7139e4fcb615cda2fcc3ca5a170034a1032b7bcd /src/pgtkselect.c
parentd109dabbc53c9d8e5a5dedf3d82f70692875c908 (diff)
downloademacs-72f79d820df2eff19d1127ab687fac11ffd1c379.tar.gz
emacs-72f79d820df2eff19d1127ab687fac11ffd1c379.zip
* src/pgtkselect.c: change coding style
Diffstat (limited to 'src/pgtkselect.c')
-rw-r--r--src/pgtkselect.c276
1 files changed, 156 insertions, 120 deletions
diff --git a/src/pgtkselect.c b/src/pgtkselect.c
index 4f4a43da8be..491c50b3365 100644
--- a/src/pgtkselect.c
+++ b/src/pgtkselect.c
@@ -72,11 +72,11 @@ frame_for_pgtk_selection (Lisp_Object object)
72 return f; 72 return f;
73 73
74 FOR_EACH_FRAME (tail, frame) 74 FOR_EACH_FRAME (tail, frame)
75 { 75 {
76 f = XFRAME (frame); 76 f = XFRAME (frame);
77 if (FRAME_PGTK_P (f) && FRAME_LIVE_P (f)) 77 if (FRAME_PGTK_P (f) && FRAME_LIVE_P (f))
78 return f; 78 return f;
79 } 79 }
80 } 80 }
81 else if (TERMINALP (object)) 81 else if (TERMINALP (object))
82 { 82 {
@@ -84,11 +84,11 @@ frame_for_pgtk_selection (Lisp_Object object)
84 84
85 if (t->type == output_pgtk) 85 if (t->type == output_pgtk)
86 FOR_EACH_FRAME (tail, frame) 86 FOR_EACH_FRAME (tail, frame)
87 { 87 {
88 f = XFRAME (frame); 88 f = XFRAME (frame);
89 if (FRAME_LIVE_P (f) && f->terminal == t) 89 if (FRAME_LIVE_P (f) && f->terminal == t)
90 return f; 90 return f;
91 } 91 }
92 } 92 }
93 else if (FRAMEP (object)) 93 else if (FRAMEP (object))
94 { 94 {
@@ -100,74 +100,98 @@ frame_for_pgtk_selection (Lisp_Object object)
100 return NULL; 100 return NULL;
101} 101}
102 102
103static GtkClipboard *symbol_to_gtk_clipboard(GtkWidget *widget, Lisp_Object symbol) 103static GtkClipboard *
104symbol_to_gtk_clipboard (GtkWidget * widget, Lisp_Object symbol)
104{ 105{
105 GdkAtom atom; 106 GdkAtom atom;
106 107
107 CHECK_SYMBOL (symbol); 108 CHECK_SYMBOL (symbol);
108 if (NILP(symbol)) { 109 if (NILP (symbol))
109 atom = GDK_SELECTION_PRIMARY; 110 {
110 } else if (EQ(symbol, QCLIPBOARD)) { 111 atom = GDK_SELECTION_PRIMARY;
111 atom = GDK_SELECTION_CLIPBOARD; 112 }
112 } else if (EQ(symbol, QPRIMARY)) { 113 else if (EQ (symbol, QCLIPBOARD))
113 atom = GDK_SELECTION_PRIMARY; 114 {
114 } else if (EQ(symbol, QSECONDARY)) { 115 atom = GDK_SELECTION_CLIPBOARD;
115 atom = GDK_SELECTION_SECONDARY; 116 }
116 } else if (EQ(symbol, Qt)) { 117 else if (EQ (symbol, QPRIMARY))
117 atom = GDK_SELECTION_SECONDARY; 118 {
118 } else { 119 atom = GDK_SELECTION_PRIMARY;
119 atom = 0; 120 }
120 error ("Bad selection"); 121 else if (EQ (symbol, QSECONDARY))
121 } 122 {
122 123 atom = GDK_SELECTION_SECONDARY;
123 return gtk_widget_get_clipboard(widget, atom); 124 }
125 else if (EQ (symbol, Qt))
126 {
127 atom = GDK_SELECTION_SECONDARY;
128 }
129 else
130 {
131 atom = 0;
132 error ("Bad selection");
133 }
134
135 return gtk_widget_get_clipboard (widget, atom);
124} 136}
125 137
126static void selection_type_to_quarks(GdkAtom type, GQuark *quark_data, GQuark *quark_size) 138static void
139selection_type_to_quarks (GdkAtom type, GQuark * quark_data,
140 GQuark * quark_size)
127{ 141{
128 if (type == GDK_SELECTION_PRIMARY) { 142 if (type == GDK_SELECTION_PRIMARY)
129 *quark_data = quark_primary_data; 143 {
130 *quark_size = quark_primary_size; 144 *quark_data = quark_primary_data;
131 } else if (type == GDK_SELECTION_SECONDARY) { 145 *quark_size = quark_primary_size;
132 *quark_data = quark_secondary_data; 146 }
133 *quark_size = quark_secondary_size; 147 else if (type == GDK_SELECTION_SECONDARY)
134 } else if (type == GDK_SELECTION_CLIPBOARD) { 148 {
135 *quark_data = quark_clipboard_data; 149 *quark_data = quark_secondary_data;
136 *quark_size = quark_clipboard_size; 150 *quark_size = quark_secondary_size;
137 } else { 151 }
138 /* fixme: Is it safe to use 'error' here? */ 152 else if (type == GDK_SELECTION_CLIPBOARD)
139 error("Unknown selection type."); 153 {
140 } 154 *quark_data = quark_clipboard_data;
155 *quark_size = quark_clipboard_size;
156 }
157 else
158 {
159 /* fixme: Is it safe to use 'error' here? */
160 error ("Unknown selection type.");
161 }
141} 162}
142 163
143static void 164static void
144get_func(GtkClipboard *cb, GtkSelectionData *data, guint info, gpointer user_data_or_owner) 165get_func (GtkClipboard * cb, GtkSelectionData * data, guint info,
166 gpointer user_data_or_owner)
145{ 167{
146 PGTK_TRACE("get_func:"); 168 PGTK_TRACE ("get_func:");
147 GObject *obj = G_OBJECT(user_data_or_owner); 169 GObject *obj = G_OBJECT (user_data_or_owner);
148 const char *str; 170 const char *str;
149 int size; 171 int size;
150 GQuark quark_data, quark_size; 172 GQuark quark_data, quark_size;
151 173
152 selection_type_to_quarks(gtk_clipboard_get_selection(cb), &quark_data, &quark_size); 174 selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
175 &quark_size);
153 176
154 str = g_object_get_qdata(obj, quark_data); 177 str = g_object_get_qdata (obj, quark_data);
155 size = GPOINTER_TO_SIZE(g_object_get_qdata(obj, quark_size)); 178 size = GPOINTER_TO_SIZE (g_object_get_qdata (obj, quark_size));
156 PGTK_TRACE("get_func: str: %s", str); 179 PGTK_TRACE ("get_func: str: %s", str);
157 gtk_selection_data_set_text(data, str, size); 180 gtk_selection_data_set_text (data, str, size);
158} 181}
159 182
160static void 183static void
161clear_func(GtkClipboard *cb, gpointer user_data_or_owner) 184clear_func (GtkClipboard * cb, gpointer user_data_or_owner)
162{ 185{
163 PGTK_TRACE("clear_func:"); 186 PGTK_TRACE ("clear_func:");
164 GObject *obj = G_OBJECT(user_data_or_owner); 187 GObject *obj = G_OBJECT (user_data_or_owner);
165 GQuark quark_data, quark_size; 188 GQuark quark_data, quark_size;
166 189
167 selection_type_to_quarks(gtk_clipboard_get_selection(cb), &quark_data, &quark_size); 190 selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
191 &quark_size);
168 192
169 g_object_set_qdata(obj, quark_data, NULL); 193 g_object_set_qdata (obj, quark_data, NULL);
170 g_object_set_qdata(obj, quark_size, 0); 194 g_object_set_qdata (obj, quark_size, 0);
171} 195}
172 196
173 197
@@ -177,27 +201,35 @@ clear_func(GtkClipboard *cb, gpointer user_data_or_owner)
177 201
178 ========================================================================== */ 202 ========================================================================== */
179 203
180void pgtk_selection_init(void) 204void
205pgtk_selection_init (void)
181{ 206{
182 if (quark_primary_data == 0) { 207 if (quark_primary_data == 0)
183 quark_primary_data = g_quark_from_static_string("pgtk-primary-data"); 208 {
184 quark_primary_size = g_quark_from_static_string("pgtk-primary-size"); 209 quark_primary_data = g_quark_from_static_string ("pgtk-primary-data");
185 quark_secondary_data = g_quark_from_static_string("pgtk-secondary-data"); 210 quark_primary_size = g_quark_from_static_string ("pgtk-primary-size");
186 quark_secondary_size = g_quark_from_static_string("pgtk-secondary-size"); 211 quark_secondary_data =
187 quark_clipboard_data = g_quark_from_static_string("pgtk-clipboard-data"); 212 g_quark_from_static_string ("pgtk-secondary-data");
188 quark_clipboard_size = g_quark_from_static_string("pgtk-clipboard-size"); 213 quark_secondary_size =
189 } 214 g_quark_from_static_string ("pgtk-secondary-size");
215 quark_clipboard_data =
216 g_quark_from_static_string ("pgtk-clipboard-data");
217 quark_clipboard_size =
218 g_quark_from_static_string ("pgtk-clipboard-size");
219 }
190} 220}
191 221
192void pgtk_selection_lost(GtkWidget *widget, GdkEventSelection *event, gpointer user_data) 222void
223pgtk_selection_lost (GtkWidget * widget, GdkEventSelection * event,
224 gpointer user_data)
193{ 225{
194 GQuark quark_data, quark_size; 226 GQuark quark_data, quark_size;
195 PGTK_TRACE("pgtk_selection_lost:"); 227 PGTK_TRACE ("pgtk_selection_lost:");
196 228
197 selection_type_to_quarks(event->selection, &quark_data, &quark_size); 229 selection_type_to_quarks (event->selection, &quark_data, &quark_size);
198 230
199 g_object_set_qdata(G_OBJECT(widget), quark_data, NULL); 231 g_object_set_qdata (G_OBJECT (widget), quark_data, NULL);
200 g_object_set_qdata(G_OBJECT(widget), quark_size, 0); 232 g_object_set_qdata (G_OBJECT (widget), quark_size, 0);
201} 233}
202 234
203static bool 235static bool
@@ -294,8 +326,7 @@ pgtk_selection_usable (void)
294 ========================================================================== */ 326 ========================================================================== */
295 327
296 328
297DEFUN ("pgtk-own-selection-internal", Fpgtk_own_selection_internal, 329DEFUN ("pgtk-own-selection-internal", Fpgtk_own_selection_internal, Spgtk_own_selection_internal, 2, 3, 0,
298 Spgtk_own_selection_internal, 2, 3, 0,
299 doc: /* Assert an X selection of type SELECTION and value VALUE. 330 doc: /* Assert an X selection of type SELECTION and value VALUE.
300SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 331SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
301\(Those are literal upper-case symbol names, since that's what X expects.) 332\(Those are literal upper-case symbol names, since that's what X expects.)
@@ -303,10 +334,10 @@ VALUE is typically a string, or a cons of two markers, but may be
303anything that the functions on `selection-converter-alist' know about. 334anything that the functions on `selection-converter-alist' know about.
304 335
305FRAME should be a frame that should own the selection. If omitted or 336FRAME should be a frame that should own the selection. If omitted or
306nil, it defaults to the selected frame.*/) 337nil, it defaults to the selected frame. */)
307 (Lisp_Object selection, Lisp_Object value, Lisp_Object frame) 338 (Lisp_Object selection, Lisp_Object value, Lisp_Object frame)
308{ 339{
309 PGTK_TRACE("pgtk-own-selection-internal."); 340 PGTK_TRACE ("pgtk-own-selection-internal.");
310 Lisp_Object successful_p = Qnil; 341 Lisp_Object successful_p = Qnil;
311 Lisp_Object target_symbol, rest; 342 Lisp_Object target_symbol, rest;
312 GtkClipboard *cb; 343 GtkClipboard *cb;
@@ -318,13 +349,15 @@ nil, it defaults to the selected frame.*/)
318 if (!pgtk_selection_usable ()) 349 if (!pgtk_selection_usable ())
319 return Qnil; 350 return Qnil;
320 351
321 if (NILP (frame)) frame = selected_frame; 352 if (NILP (frame))
353 frame = selected_frame;
322 if (!FRAME_LIVE_P (XFRAME (frame)) || !FRAME_PGTK_P (XFRAME (frame))) 354 if (!FRAME_LIVE_P (XFRAME (frame)) || !FRAME_PGTK_P (XFRAME (frame)))
323 error ("pgtk selection unavailable for this frame"); 355 error ("pgtk selection unavailable for this frame");
324 f = XFRAME(frame); 356 f = XFRAME (frame);
325 357
326 cb = symbol_to_gtk_clipboard(FRAME_GTK_WIDGET(f), selection); 358 cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
327 selection_type_to_quarks(gtk_clipboard_get_selection(cb), &quark_data, &quark_size); 359 selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
360 &quark_size);
328 361
329 /* We only support copy of text. */ 362 /* We only support copy of text. */
330 target_symbol = QTEXT; 363 target_symbol = QTEXT;
@@ -340,25 +373,29 @@ nil, it defaults to the selected frame.*/)
340 373
341 targets = gtk_target_table_new_from_list (list, &n_targets); 374 targets = gtk_target_table_new_from_list (list, &n_targets);
342 375
343 int size = SBYTES(value); 376 int size = SBYTES (value);
344 gchar *str = xmalloc(size + 1); 377 gchar *str = xmalloc (size + 1);
345 memcpy(str, SSDATA(value), size); 378 memcpy (str, SSDATA (value), size);
346 str[size] = '\0'; 379 str[size] = '\0';
347 380
348 widget = FRAME_GTK_WIDGET(f); 381 widget = FRAME_GTK_WIDGET (f);
349 g_object_set_qdata_full(G_OBJECT(widget), quark_data, str, xfree); 382 g_object_set_qdata_full (G_OBJECT (widget), quark_data, str, xfree);
350 g_object_set_qdata_full(G_OBJECT(widget), quark_size, GSIZE_TO_POINTER(size), NULL); 383 g_object_set_qdata_full (G_OBJECT (widget), quark_size,
384 GSIZE_TO_POINTER (size), NULL);
351 385
352 PGTK_TRACE("set_with_owner: owner=%p", FRAME_GTK_WIDGET(f)); 386 PGTK_TRACE ("set_with_owner: owner=%p", FRAME_GTK_WIDGET (f));
353 if (gtk_clipboard_set_with_owner (cb, 387 if (gtk_clipboard_set_with_owner (cb,
354 targets, n_targets, 388 targets, n_targets,
355 get_func, clear_func, 389 get_func, clear_func,
356 G_OBJECT(FRAME_GTK_WIDGET(f)))) { 390 G_OBJECT (FRAME_GTK_WIDGET (f))))
357 PGTK_TRACE("set_with_owner succeeded.."); 391 {
358 successful_p = Qt; 392 PGTK_TRACE ("set_with_owner succeeded..");
359 } else { 393 successful_p = Qt;
360 PGTK_TRACE("set_with_owner failed."); 394 }
361 } 395 else
396 {
397 PGTK_TRACE ("set_with_owner failed.");
398 }
362 gtk_clipboard_set_can_store (cb, NULL, 0); 399 gtk_clipboard_set_can_store (cb, NULL, 0);
363 400
364 gtk_target_table_free (targets, n_targets); 401 gtk_target_table_free (targets, n_targets);
@@ -368,16 +405,16 @@ nil, it defaults to the selected frame.*/)
368 if (!EQ (Vpgtk_sent_selection_hooks, Qunbound)) 405 if (!EQ (Vpgtk_sent_selection_hooks, Qunbound))
369 { 406 {
370 /* FIXME: Use run-hook-with-args! */ 407 /* FIXME: Use run-hook-with-args! */
371 for (rest = Vpgtk_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest)) 408 for (rest = Vpgtk_sent_selection_hooks; CONSP (rest);
372 call3 (Fcar (rest), selection, target_symbol, successful_p); 409 rest = Fcdr (rest))
410 call3 (Fcar (rest), selection, target_symbol, successful_p);
373 } 411 }
374 412
375 return value; 413 return value;
376} 414}
377 415
378 416
379DEFUN ("pgtk-disown-selection-internal", Fpgtk_disown_selection_internal, 417DEFUN ("pgtk-disown-selection-internal", Fpgtk_disown_selection_internal, Spgtk_disown_selection_internal, 1, 3, 0,
380 Spgtk_disown_selection_internal, 1, 3, 0,
381 doc: /* If we own the selection SELECTION, disown it. 418 doc: /* If we own the selection SELECTION, disown it.
382Disowning it means there is no such selection. 419Disowning it means there is no such selection.
383 420
@@ -393,7 +430,7 @@ On MS-DOS, all this does is return non-nil if we own the selection.
393On PGTK, the TIME-OBJECT is unused. */) 430On PGTK, the TIME-OBJECT is unused. */)
394 (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) 431 (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal)
395{ 432{
396 PGTK_TRACE("pgtk-disown-selection-internal."); 433 PGTK_TRACE ("pgtk-disown-selection-internal.");
397 434
398 struct frame *f = frame_for_pgtk_selection (terminal); 435 struct frame *f = frame_for_pgtk_selection (terminal);
399 GtkClipboard *cb; 436 GtkClipboard *cb;
@@ -404,16 +441,16 @@ On PGTK, the TIME-OBJECT is unused. */)
404 if (!f) 441 if (!f)
405 return Qnil; 442 return Qnil;
406 443
407 cb = symbol_to_gtk_clipboard(FRAME_GTK_WIDGET(f), selection); 444 cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
408 445
409 gtk_clipboard_clear(cb); 446 gtk_clipboard_clear (cb);
410 447
411 return Qt; 448 return Qt;
412} 449}
413 450
414 451
415DEFUN ("pgtk-selection-exists-p", Fpgtk_selection_exists_p, Spgtk_selection_exists_p, 452DEFUN ("pgtk-selection-exists-p", Fpgtk_selection_exists_p, Spgtk_selection_exists_p, 0, 2, 0,
416 0, 2, 0, doc: /* Whether there is an owner for the given X selection. 453 doc: /* Whether there is an owner for the given X selection.
417SELECTION should be the name of the selection in question, typically 454SELECTION should be the name of the selection in question, typically
418one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects 455one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects
419these literal upper-case names.) The symbol nil is the same as 456these literal upper-case names.) The symbol nil is the same as
@@ -424,9 +461,9 @@ server to query. If omitted or nil, that stands for the selected
424frame's display, or the first available X display. 461frame's display, or the first available X display.
425 462
426On Nextstep, TERMINAL is unused. */) 463On Nextstep, TERMINAL is unused. */)
427 (Lisp_Object selection, Lisp_Object terminal) 464 (Lisp_Object selection, Lisp_Object terminal)
428{ 465{
429 PGTK_TRACE("pgtk-selection-exists-p."); 466 PGTK_TRACE ("pgtk-selection-exists-p.");
430 struct frame *f = frame_for_pgtk_selection (terminal); 467 struct frame *f = frame_for_pgtk_selection (terminal);
431 GtkClipboard *cb; 468 GtkClipboard *cb;
432 469
@@ -436,14 +473,13 @@ On Nextstep, TERMINAL is unused. */)
436 if (!f) 473 if (!f)
437 return Qnil; 474 return Qnil;
438 475
439 cb = symbol_to_gtk_clipboard(FRAME_GTK_WIDGET(f), selection); 476 cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
440 477
441 return gtk_clipboard_wait_is_text_available(cb) ? Qt : Qnil; 478 return gtk_clipboard_wait_is_text_available (cb) ? Qt : Qnil;
442} 479}
443 480
444 481
445DEFUN ("pgtk-selection-owner-p", Fpgtk_selection_owner_p, Spgtk_selection_owner_p, 482DEFUN ("pgtk-selection-owner-p", Fpgtk_selection_owner_p, Spgtk_selection_owner_p, 0, 2, 0,
446 0, 2, 0,
447 doc: /* Whether the current Emacs process owns the given X Selection. 483 doc: /* Whether the current Emacs process owns the given X Selection.
448The arg should be the name of the selection in question, typically one of 484The arg should be the name of the selection in question, typically one of
449the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 485the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
@@ -456,9 +492,9 @@ server to query. If omitted or nil, that stands for the selected
456frame's display, or the first available X display. 492frame's display, or the first available X display.
457 493
458On Nextstep, TERMINAL is unused. */) 494On Nextstep, TERMINAL is unused. */)
459 (Lisp_Object selection, Lisp_Object terminal) 495 (Lisp_Object selection, Lisp_Object terminal)
460{ 496{
461 PGTK_TRACE("pgtk-selection-owner-p."); 497 PGTK_TRACE ("pgtk-selection-owner-p.");
462 struct frame *f = frame_for_pgtk_selection (terminal); 498 struct frame *f = frame_for_pgtk_selection (terminal);
463 GtkClipboard *cb; 499 GtkClipboard *cb;
464 GObject *obj; 500 GObject *obj;
@@ -467,17 +503,17 @@ On Nextstep, TERMINAL is unused. */)
467 if (!pgtk_selection_usable ()) 503 if (!pgtk_selection_usable ())
468 return Qnil; 504 return Qnil;
469 505
470 cb = symbol_to_gtk_clipboard(FRAME_GTK_WIDGET(f), selection); 506 cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection);
471 selection_type_to_quarks(gtk_clipboard_get_selection(cb), &quark_data, &quark_size); 507 selection_type_to_quarks (gtk_clipboard_get_selection (cb), &quark_data,
508 &quark_size);
472 509
473 obj = gtk_clipboard_get_owner(cb); 510 obj = gtk_clipboard_get_owner (cb);
474 511
475 return g_object_get_qdata(obj, quark_data) != NULL ? Qt : Qnil; 512 return g_object_get_qdata (obj, quark_data) != NULL ? Qt : Qnil;
476} 513}
477 514
478 515
479DEFUN ("pgtk-get-selection-internal", Fpgtk_get_selection_internal, 516DEFUN ("pgtk-get-selection-internal", Fpgtk_get_selection_internal, Spgtk_get_selection_internal, 2, 4, 0,
480 Spgtk_get_selection_internal, 2, 4, 0,
481 doc: /* Return text selected from some X window. 517 doc: /* Return text selected from some X window.
482SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 518SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
483\(Those are literal upper-case symbol names, since that's what X expects.) 519\(Those are literal upper-case symbol names, since that's what X expects.)
@@ -508,12 +544,12 @@ On PGTK, TIME-STAMP is unused. */)
508 if (!pgtk_selection_usable ()) 544 if (!pgtk_selection_usable ())
509 return Qnil; 545 return Qnil;
510 546
511 cb = symbol_to_gtk_clipboard(FRAME_GTK_WIDGET(f), selection_symbol); 547 cb = symbol_to_gtk_clipboard (FRAME_GTK_WIDGET (f), selection_symbol);
512 548
513 gchar *s = gtk_clipboard_wait_for_text(cb); 549 gchar *s = gtk_clipboard_wait_for_text (cb);
514 if (s == NULL) 550 if (s == NULL)
515 return Qnil; 551 return Qnil;
516 int size = strlen(s); 552 int size = strlen (s);
517 Lisp_Object str = make_unibyte_string (s, size); 553 Lisp_Object str = make_unibyte_string (s, size);
518 Fput_text_property (make_fixnum (0), make_fixnum (size), 554 Fput_text_property (make_fixnum (0), make_fixnum (size),
519 Qforeign_selection, QUTF8_STRING, str); 555 Qforeign_selection, QUTF8_STRING, str);
@@ -524,13 +560,13 @@ On PGTK, TIME-STAMP is unused. */)
524void 560void
525nxatoms_of_pgtkselect (void) 561nxatoms_of_pgtkselect (void)
526{ 562{
527 PGTK_TRACE("nxatoms_of_pgtkselect"); 563 PGTK_TRACE ("nxatoms_of_pgtkselect");
528} 564}
529 565
530void 566void
531syms_of_pgtkselect (void) 567syms_of_pgtkselect (void)
532{ 568{
533 PGTK_TRACE("syms_of_pgtkselect"); 569 PGTK_TRACE ("syms_of_pgtkselect");
534 570
535 DEFSYM (QCLIPBOARD, "CLIPBOARD"); 571 DEFSYM (QCLIPBOARD, "CLIPBOARD");
536 DEFSYM (QSECONDARY, "SECONDARY"); 572 DEFSYM (QSECONDARY, "SECONDARY");
@@ -553,7 +589,7 @@ syms_of_pgtkselect (void)
553#endif 589#endif
554 590
555 DEFVAR_LISP ("pgtk-sent-selection-hooks", Vpgtk_sent_selection_hooks, 591 DEFVAR_LISP ("pgtk-sent-selection-hooks", Vpgtk_sent_selection_hooks,
556 "A list of functions to be called when Emacs answers a selection request.\n\ 592 "A list of functions to be called when Emacs answers a selection request.\n\
557The functions are called with four arguments:\n\ 593The functions are called with four arguments:\n\
558 - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD');\n\ 594 - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD');\n\
559 - the selection-type which Emacs was asked to convert the\n\ 595 - the selection-type which Emacs was asked to convert the\n\