1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module vte.Terminal;
26 
27 private import gdk.Cursor;
28 private import gdk.Event;
29 private import gdk.RGBA;
30 private import gio.Cancellable;
31 private import gio.OutputStream;
32 private import glib.ArrayG;
33 private import glib.ConstructionException;
34 private import glib.ErrorG;
35 private import glib.GException;
36 private import glib.Regex;
37 private import glib.Str;
38 private import gobject.ObjectG;
39 private import gobject.Signals;
40 private import gtk.BuildableIF;
41 private import gtk.BuildableT;
42 private import gtk.ScrollableIF;
43 private import gtk.ScrollableT;
44 private import gtk.Widget;
45 private import gtk.Window;
46 private import pango.PgFontDescription;
47 private import std.algorithm;
48 private import vte.Pty;
49 private import vte.Regex : RegexVte = Regex;
50 private import vtec.vte;
51 public  import vtec.vtetypes;
52 
53 
54 /** */
55 public class Terminal : Widget, ScrollableIF
56 {
57 	/** the main Gtk struct */
58 	protected VteTerminal* vteTerminal;
59 
60 	/** Get the main Gtk struct */
61 	public VteTerminal* getTerminalStruct()
62 	{
63 		return vteTerminal;
64 	}
65 
66 	/** the main Gtk struct as a void* */
67 	protected override void* getStruct()
68 	{
69 		return cast(void*)vteTerminal;
70 	}
71 
72 	protected override void setStruct(GObject* obj)
73 	{
74 		vteTerminal = cast(VteTerminal*)obj;
75 		super.setStruct(obj);
76 	}
77 
78 	/**
79 	 * Sets our main struct and passes it to the parent class.
80 	 */
81 	public this (VteTerminal* vteTerminal, bool ownedRef = false)
82 	{
83 		this.vteTerminal = vteTerminal;
84 		super(cast(GtkWidget*)vteTerminal, ownedRef);
85 	}
86 
87 	// add the Scrollable capabilities
88 	mixin ScrollableT!(VteTerminal);
89 
90 
91 	/** */
92 	public static GType getType()
93 	{
94 		return vte_terminal_get_type();
95 	}
96 
97 	/**
98 	 * Creates a new terminal widget.
99 	 *
100 	 * Returns: a new #VteTerminal object
101 	 *
102 	 * Throws: ConstructionException GTK+ fails to create the object.
103 	 */
104 	public this()
105 	{
106 		auto p = vte_terminal_new();
107 		
108 		if(p is null)
109 		{
110 			throw new ConstructionException("null returned by new");
111 		}
112 		
113 		this(cast(VteTerminal*) p);
114 	}
115 
116 	/**
117 	 * Places the selected text in the terminal in the #GDK_SELECTION_CLIPBOARD
118 	 * selection.
119 	 */
120 	public void copyClipboard()
121 	{
122 		vte_terminal_copy_clipboard(vteTerminal);
123 	}
124 
125 	/**
126 	 * Places the selected text in the terminal in the #GDK_SELECTION_PRIMARY
127 	 * selection.
128 	 */
129 	public void copyPrimary()
130 	{
131 		vte_terminal_copy_primary(vteTerminal);
132 	}
133 
134 	/**
135 	 * This function does nothing.
136 	 *
137 	 * Deprecated: Use vte_terminal_event_check_regex_simple() instead.
138 	 *
139 	 * Params:
140 	 *     event = a #GdkEvent
141 	 *     regexes = an array of #GRegex
142 	 *     nRegexes = number of items in @regexes
143 	 *     matchFlags = the #GRegexMatchFlags to use when matching the regexes
144 	 *     matches = a location to store the matches
145 	 *
146 	 * Returns: %FALSE
147 	 *
148 	 * Since: 0.44
149 	 */
150 	public bool eventCheckGregexSimple(Event event, Regex[] regexes, GRegexMatchFlags matchFlags, string[] matches)
151 	{
152 		GRegex*[] regexesArray = new GRegex*[regexes.length];
153 		for ( int i = 0; i < regexes.length; i++ )
154 		{
155 			regexesArray[i] = regexes[i].getRegexStruct();
156 		}
157 		
158 		return vte_terminal_event_check_gregex_simple(vteTerminal, (event is null) ? null : event.getEventStruct(), regexesArray.ptr, cast(size_t)matches.length, matchFlags, Str.toStringzArray(matches)) != 0;
159 	}
160 
161 	/**
162 	 * Checks each regex in @regexes if the text in and around the position of
163 	 * the event matches the regular expressions.  If a match exists, the matched
164 	 * text is stored in @matches at the position of the regex in @regexes; otherwise
165 	 * %NULL is stored there.
166 	 *
167 	 * Params:
168 	 *     event = a #GdkEvent
169 	 *     regexes = an array of #VteRegex
170 	 *     nRegexes = number of items in @regexes
171 	 *     matchFlags = PCRE2 match flags, or 0
172 	 *     matches = a location to store the matches
173 	 *
174 	 * Returns: %TRUE iff any of the regexes produced a match
175 	 *
176 	 * Since: 0.46
177 	 */
178 	public bool eventCheckRegexSimple(Event event, RegexVte[] regexes, uint matchFlags, string[] matches)
179 	{
180 		VteRegex*[] regexesArray = new VteRegex*[regexes.length];
181 		for ( int i = 0; i < regexes.length; i++ )
182 		{
183 			regexesArray[i] = regexes[i].getRegexStruct();
184 		}
185 		
186 		return vte_terminal_event_check_regex_simple(vteTerminal, (event is null) ? null : event.getEventStruct(), regexesArray.ptr, cast(size_t)matches.length, matchFlags, Str.toStringzArray(matches)) != 0;
187 	}
188 
189 	/**
190 	 * Interprets @data as if it were data received from a child process.  This
191 	 * can either be used to drive the terminal without a child process, or just
192 	 * to mess with your users.
193 	 *
194 	 * Params:
195 	 *     data = a string in the terminal's current encoding
196 	 *     length = the length of the string, or -1 to use the full length or a nul-terminated string
197 	 */
198 	public void feed(string data)
199 	{
200 		vte_terminal_feed(vteTerminal, Str.toStringz(data), cast(ptrdiff_t)data.length);
201 	}
202 
203 	/**
204 	 * Sends a block of UTF-8 text to the child as if it were entered by the user
205 	 * at the keyboard.
206 	 *
207 	 * Params:
208 	 *     text = data to send to the child
209 	 *     length = length of @text in bytes, or -1 if @text is NUL-terminated
210 	 */
211 	public void feedChild(string text, ptrdiff_t length)
212 	{
213 		vte_terminal_feed_child(vteTerminal, Str.toStringz(text), length);
214 	}
215 
216 	/**
217 	 * Sends a block of binary data to the child.
218 	 *
219 	 * Params:
220 	 *     data = data to send to the child
221 	 *     length = length of @data
222 	 */
223 	public void feedChildBinary(ubyte[] data)
224 	{
225 		vte_terminal_feed_child_binary(vteTerminal, data.ptr, cast(size_t)data.length);
226 	}
227 
228 	/**
229 	 * Checks whether or not the terminal will attempt to draw bold text by
230 	 * repainting text with a one-pixel offset.
231 	 *
232 	 * Returns: %TRUE if bolding is enabled, %FALSE if not
233 	 */
234 	public bool getAllowBold()
235 	{
236 		return vte_terminal_get_allow_bold(vteTerminal) != 0;
237 	}
238 
239 	/**
240 	 * Checks whether or not the terminal will beep when the child outputs the
241 	 * "bl" sequence.
242 	 *
243 	 * Returns: %TRUE if audible bell is enabled, %FALSE if not
244 	 */
245 	public bool getAudibleBell()
246 	{
247 		return vte_terminal_get_audible_bell(vteTerminal) != 0;
248 	}
249 
250 	/**
251 	 * Returns: the height of a character cell
252 	 */
253 	public glong getCharHeight()
254 	{
255 		return vte_terminal_get_char_height(vteTerminal);
256 	}
257 
258 	/**
259 	 * Returns: the width of a character cell
260 	 */
261 	public glong getCharWidth()
262 	{
263 		return vte_terminal_get_char_width(vteTerminal);
264 	}
265 
266 	/**
267 	 * Returns whether ambiguous-width characters are narrow or wide when using
268 	 * the UTF-8 encoding (vte_terminal_set_encoding()).
269 	 *
270 	 * Returns: 1 if ambiguous-width characters are narrow, or 2 if they are wide
271 	 */
272 	public int getCjkAmbiguousWidth()
273 	{
274 		return vte_terminal_get_cjk_ambiguous_width(vteTerminal);
275 	}
276 
277 	/**
278 	 * Returns: the number of columns
279 	 */
280 	public glong getColumnCount()
281 	{
282 		return vte_terminal_get_column_count(vteTerminal);
283 	}
284 
285 	/**
286 	 * Returns: the URI of the current directory of the
287 	 *     process running in the terminal, or %NULL
288 	 */
289 	public string getCurrentDirectoryUri()
290 	{
291 		return Str.toString(vte_terminal_get_current_directory_uri(vteTerminal));
292 	}
293 
294 	/**
295 	 * Returns: the URI of the current file the
296 	 *     process running in the terminal is operating on, or %NULL if
297 	 *     not set
298 	 */
299 	public string getCurrentFileUri()
300 	{
301 		return Str.toString(vte_terminal_get_current_file_uri(vteTerminal));
302 	}
303 
304 	/**
305 	 * Returns the currently set cursor blink mode.
306 	 *
307 	 * Returns: cursor blink mode.
308 	 */
309 	public VteCursorBlinkMode getCursorBlinkMode()
310 	{
311 		return vte_terminal_get_cursor_blink_mode(vteTerminal);
312 	}
313 
314 	/**
315 	 * Reads the location of the insertion cursor and returns it.  The row
316 	 * coordinate is absolute.
317 	 *
318 	 * Params:
319 	 *     column = a location to store the column, or %NULL
320 	 *     row = a location to store the row, or %NULL
321 	 */
322 	public void getCursorPosition(out glong column, out glong row)
323 	{
324 		vte_terminal_get_cursor_position(vteTerminal, &column, &row);
325 	}
326 
327 	/**
328 	 * Returns the currently set cursor shape.
329 	 *
330 	 * Returns: cursor shape.
331 	 */
332 	public VteCursorShape getCursorShape()
333 	{
334 		return vte_terminal_get_cursor_shape(vteTerminal);
335 	}
336 
337 	/**
338 	 * Determines the name of the encoding in which the terminal expects data to be
339 	 * encoded.
340 	 *
341 	 * Returns: the current encoding for the terminal
342 	 */
343 	public string getEncoding()
344 	{
345 		return Str.toString(vte_terminal_get_encoding(vteTerminal));
346 	}
347 
348 	/**
349 	 * Queries the terminal for information about the fonts which will be
350 	 * used to draw text in the terminal.  The actual font takes the font scale
351 	 * into account, this is not reflected in the return value, the unscaled
352 	 * font is returned.
353 	 *
354 	 * Returns: a #PangoFontDescription describing the font the
355 	 *     terminal uses to render text at the default font scale of 1.0.
356 	 */
357 	public PgFontDescription getFont()
358 	{
359 		auto p = vte_terminal_get_font(vteTerminal);
360 		
361 		if(p is null)
362 		{
363 			return null;
364 		}
365 		
366 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p);
367 	}
368 
369 	/**
370 	 * Returns: the terminal's font scale
371 	 */
372 	public double getFontScale()
373 	{
374 		return vte_terminal_get_font_scale(vteTerminal);
375 	}
376 
377 	/**
378 	 * Fills in some @hints from @terminal's geometry. The hints
379 	 * filled are those covered by the %GDK_HINT_RESIZE_INC,
380 	 * %GDK_HINT_MIN_SIZE and %GDK_HINT_BASE_SIZE flags.
381 	 *
382 	 * See gtk_window_set_geometry_hints() for more information.
383 	 *
384 	 * @terminal must be realized (see gtk_widget_get_realized()).
385 	 *
386 	 * Params:
387 	 *     hints = a #GdkGeometry to fill in
388 	 *     minRows = the minimum number of rows to request
389 	 *     minColumns = the minimum number of columns to request
390 	 */
391 	public void getGeometryHints(out GdkGeometry hints, int minRows, int minColumns)
392 	{
393 		vte_terminal_get_geometry_hints(vteTerminal, &hints, minRows, minColumns);
394 	}
395 
396 	/**
397 	 * Checks if the terminal currently contains selected text.  Note that this
398 	 * is different from determining if the terminal is the owner of any
399 	 * #GtkClipboard items.
400 	 *
401 	 * Returns: %TRUE if part of the text in the terminal is selected.
402 	 */
403 	public bool getHasSelection()
404 	{
405 		return vte_terminal_get_has_selection(vteTerminal) != 0;
406 	}
407 
408 	/**
409 	 * Returns: the icon title
410 	 */
411 	public string getIconTitle()
412 	{
413 		return Str.toString(vte_terminal_get_icon_title(vteTerminal));
414 	}
415 
416 	/**
417 	 * Returns whether the terminal allow user input.
418 	 */
419 	public bool getInputEnabled()
420 	{
421 		return vte_terminal_get_input_enabled(vteTerminal) != 0;
422 	}
423 
424 	/**
425 	 * Determines the value of the terminal's mouse autohide setting.  When
426 	 * autohiding is enabled, the mouse cursor will be hidden when the user presses
427 	 * a key and shown when the user moves the mouse.  This setting can be changed
428 	 * using vte_terminal_set_mouse_autohide().
429 	 *
430 	 * Returns: %TRUE if autohiding is enabled, %FALSE if not
431 	 */
432 	public bool getMouseAutohide()
433 	{
434 		return vte_terminal_get_mouse_autohide(vteTerminal) != 0;
435 	}
436 
437 	/**
438 	 * Returns the #VtePty of @terminal.
439 	 *
440 	 * Returns: a #VtePty, or %NULL
441 	 */
442 	public Pty getPty()
443 	{
444 		auto p = vte_terminal_get_pty(vteTerminal);
445 		
446 		if(p is null)
447 		{
448 			return null;
449 		}
450 		
451 		return ObjectG.getDObject!(Pty)(cast(VtePty*) p);
452 	}
453 
454 	/**
455 	 * Checks whether or not the terminal will rewrap its contents upon resize.
456 	 *
457 	 * Returns: %TRUE if rewrapping is enabled, %FALSE if not
458 	 */
459 	public bool getRewrapOnResize()
460 	{
461 		return vte_terminal_get_rewrap_on_resize(vteTerminal) != 0;
462 	}
463 
464 	/**
465 	 * Returns: the number of rows
466 	 */
467 	public glong getRowCount()
468 	{
469 		return vte_terminal_get_row_count(vteTerminal);
470 	}
471 
472 	/**
473 	 * Extracts a view of the visible part of the terminal.  If @is_selected is not
474 	 * %NULL, characters will only be read if @is_selected returns %TRUE after being
475 	 * passed the column and row, respectively.  A #VteCharAttributes structure
476 	 * is added to @attributes for each byte added to the returned string detailing
477 	 * the character's position, colors, and other characteristics.
478 	 *
479 	 * Params:
480 	 *     isSelected = a #VteSelectionFunc callback
481 	 *     userData = user data to be passed to the callback
482 	 *     attributes = location for storing text attributes
483 	 *
484 	 * Returns: a newly allocated text string, or %NULL.
485 	 */
486 	public string getText(VteSelectionFunc isSelected, void* userData, out ArrayG attributes)
487 	{
488 		GArray* outattributes = gMalloc!GArray();
489 		
490 		auto retStr = vte_terminal_get_text(vteTerminal, isSelected, userData, outattributes);
491 		
492 		attributes = new ArrayG(outattributes, true);
493 		
494 		scope(exit) Str.freeString(retStr);
495 		return Str.toString(retStr);
496 	}
497 
498 	/**
499 	 * Extracts a view of the visible part of the terminal.  If @is_selected is not
500 	 * %NULL, characters will only be read if @is_selected returns %TRUE after being
501 	 * passed the column and row, respectively.  A #VteCharAttributes structure
502 	 * is added to @attributes for each byte added to the returned string detailing
503 	 * the character's position, colors, and other characteristics. This function
504 	 * differs from vte_terminal_get_text() in that trailing spaces at the end of
505 	 * lines are included.
506 	 *
507 	 * Params:
508 	 *     isSelected = a #VteSelectionFunc callback
509 	 *     userData = user data to be passed to the callback
510 	 *     attributes = location for storing text attributes
511 	 *
512 	 * Returns: a newly allocated text string, or %NULL.
513 	 */
514 	public string getTextIncludeTrailingSpaces(VteSelectionFunc isSelected, void* userData, out ArrayG attributes)
515 	{
516 		GArray* outattributes = gMalloc!GArray();
517 		
518 		auto retStr = vte_terminal_get_text_include_trailing_spaces(vteTerminal, isSelected, userData, outattributes);
519 		
520 		attributes = new ArrayG(outattributes, true);
521 		
522 		scope(exit) Str.freeString(retStr);
523 		return Str.toString(retStr);
524 	}
525 
526 	/**
527 	 * Extracts a view of the visible part of the terminal.  If @is_selected is not
528 	 * %NULL, characters will only be read if @is_selected returns %TRUE after being
529 	 * passed the column and row, respectively.  A #VteCharAttributes structure
530 	 * is added to @attributes for each byte added to the returned string detailing
531 	 * the character's position, colors, and other characteristics.  The
532 	 * entire scrollback buffer is scanned, so it is possible to read the entire
533 	 * contents of the buffer using this function.
534 	 *
535 	 * Params:
536 	 *     startRow = first row to search for data
537 	 *     startCol = first column to search for data
538 	 *     endRow = last row to search for data
539 	 *     endCol = last column to search for data
540 	 *     isSelected = a #VteSelectionFunc callback
541 	 *     userData = user data to be passed to the callback
542 	 *     attributes = location for storing text attributes
543 	 *
544 	 * Returns: a newly allocated text string, or %NULL.
545 	 */
546 	public string getTextRange(glong startRow, glong startCol, glong endRow, glong endCol, VteSelectionFunc isSelected, void* userData, out ArrayG attributes)
547 	{
548 		GArray* outattributes = gMalloc!GArray();
549 		
550 		auto retStr = vte_terminal_get_text_range(vteTerminal, startRow, startCol, endRow, endCol, isSelected, userData, outattributes);
551 		
552 		attributes = new ArrayG(outattributes, true);
553 		
554 		scope(exit) Str.freeString(retStr);
555 		return Str.toString(retStr);
556 	}
557 
558 	/**
559 	 * Returns: the window title
560 	 */
561 	public string getWindowTitle()
562 	{
563 		return Str.toString(vte_terminal_get_window_title(vteTerminal));
564 	}
565 
566 	/**
567 	 * Returns the set of characters which will be considered parts of a word
568 	 * when doing word-wise selection, in addition to the default which only
569 	 * considers alphanumeric characters part of a word.
570 	 *
571 	 * If %NULL, a built-in set is used.
572 	 *
573 	 * Returns: a string, or %NULL
574 	 *
575 	 * Since: 0.40
576 	 */
577 	public string getWordCharExceptions()
578 	{
579 		return Str.toString(vte_terminal_get_word_char_exceptions(vteTerminal));
580 	}
581 
582 	/**
583 	 * Adds the regular expression @regex to the list of matching expressions.  When the
584 	 * user moves the mouse cursor over a section of displayed text which matches
585 	 * this expression, the text will be highlighted.
586 	 *
587 	 * Deprecated: Use vte_terminal_match_add_regex() or vte_terminal_match_add_regex_full() instead.
588 	 *
589 	 * Params:
590 	 *     gregex = a #GRegex
591 	 *     gflags = the #GRegexMatchFlags to use when matching the regex
592 	 *
593 	 * Returns: an integer associated with this expression, or -1 if @gregex could not be
594 	 *     transformed into a #VteRegex or @gflags were incompatible
595 	 */
596 	public int matchAddGregex(Regex gregex, GRegexMatchFlags gflags)
597 	{
598 		return vte_terminal_match_add_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags);
599 	}
600 
601 	/**
602 	 * Adds the regular expression @regex to the list of matching expressions.  When the
603 	 * user moves the mouse cursor over a section of displayed text which matches
604 	 * this expression, the text will be highlighted.
605 	 *
606 	 * Params:
607 	 *     regex = a #VteRegex
608 	 *     flags = PCRE2 match flags, or 0
609 	 *
610 	 * Returns: an integer associated with this expression
611 	 *
612 	 * Since: 0.46
613 	 */
614 	public int matchAddRegex(RegexVte regex, uint flags)
615 	{
616 		return vte_terminal_match_add_regex(vteTerminal, (regex is null) ? null : regex.getRegexStruct(), flags);
617 	}
618 
619 	/**
620 	 * Checks if the text in and around the specified position matches any of the
621 	 * regular expressions previously set using vte_terminal_match_add().  If a
622 	 * match exists, the text string is returned and if @tag is not %NULL, the number
623 	 * associated with the matched regular expression will be stored in @tag.
624 	 *
625 	 * If more than one regular expression has been set with
626 	 * vte_terminal_match_add(), then expressions are checked in the order in
627 	 * which they were added.
628 	 *
629 	 * Deprecated: Use vte_terminal_match_check_event() instead.
630 	 *
631 	 * Params:
632 	 *     column = the text column
633 	 *     row = the text row
634 	 *     tag = a location to store the tag, or %NULL
635 	 *
636 	 * Returns: a newly allocated string which matches one of the previously
637 	 *     set regular expressions
638 	 */
639 	public string matchCheck(glong column, glong row, out int tag)
640 	{
641 		auto retStr = vte_terminal_match_check(vteTerminal, column, row, &tag);
642 		
643 		scope(exit) Str.freeString(retStr);
644 		return Str.toString(retStr);
645 	}
646 
647 	/**
648 	 * Checks if the text in and around the position of the event matches any of the
649 	 * regular expressions previously set using vte_terminal_match_add().  If a
650 	 * match exists, the text string is returned and if @tag is not %NULL, the number
651 	 * associated with the matched regular expression will be stored in @tag.
652 	 *
653 	 * If more than one regular expression has been set with
654 	 * vte_terminal_match_add(), then expressions are checked in the order in
655 	 * which they were added.
656 	 *
657 	 * Params:
658 	 *     event = a #GdkEvent
659 	 *     tag = a location to store the tag, or %NULL
660 	 *
661 	 * Returns: a newly allocated string which matches one of the previously
662 	 *     set regular expressions
663 	 */
664 	public string matchCheckEvent(Event event, out int tag)
665 	{
666 		auto retStr = vte_terminal_match_check_event(vteTerminal, (event is null) ? null : event.getEventStruct(), &tag);
667 		
668 		scope(exit) Str.freeString(retStr);
669 		return Str.toString(retStr);
670 	}
671 
672 	/**
673 	 * Removes the regular expression which is associated with the given @tag from
674 	 * the list of expressions which the terminal will highlight when the user
675 	 * moves the mouse cursor over matching text.
676 	 *
677 	 * Params:
678 	 *     tag = the tag of the regex to remove
679 	 */
680 	public void matchRemove(int tag)
681 	{
682 		vte_terminal_match_remove(vteTerminal, tag);
683 	}
684 
685 	/**
686 	 * Clears the list of regular expressions the terminal uses to highlight text
687 	 * when the user moves the mouse cursor.
688 	 */
689 	public void matchRemoveAll()
690 	{
691 		vte_terminal_match_remove_all(vteTerminal);
692 	}
693 
694 	/**
695 	 * Sets which cursor the terminal will use if the pointer is over the pattern
696 	 * specified by @tag.  The terminal keeps a reference to @cursor.
697 	 *
698 	 * Deprecated: Use vte_terminal_match_set_cursor_type() or vte_terminal_match_set_cursor_named() instead.
699 	 *
700 	 * Params:
701 	 *     tag = the tag of the regex which should use the specified cursor
702 	 *     cursor = the #GdkCursor which the terminal should use when the pattern is
703 	 *         highlighted, or %NULL to use the standard cursor
704 	 */
705 	public void matchSetCursor(int tag, Cursor cursor)
706 	{
707 		vte_terminal_match_set_cursor(vteTerminal, tag, (cursor is null) ? null : cursor.getCursorStruct());
708 	}
709 
710 	/**
711 	 * Sets which cursor the terminal will use if the pointer is over the pattern
712 	 * specified by @tag.
713 	 *
714 	 * Params:
715 	 *     tag = the tag of the regex which should use the specified cursor
716 	 *     cursorName = the name of the cursor
717 	 */
718 	public void matchSetCursorName(int tag, string cursorName)
719 	{
720 		vte_terminal_match_set_cursor_name(vteTerminal, tag, Str.toStringz(cursorName));
721 	}
722 
723 	/**
724 	 * Sets which cursor the terminal will use if the pointer is over the pattern
725 	 * specified by @tag.
726 	 *
727 	 * Params:
728 	 *     tag = the tag of the regex which should use the specified cursor
729 	 *     cursorType = a #GdkCursorType
730 	 */
731 	public void matchSetCursorType(int tag, GdkCursorType cursorType)
732 	{
733 		vte_terminal_match_set_cursor_type(vteTerminal, tag, cursorType);
734 	}
735 
736 	/**
737 	 * Sends the contents of the #GDK_SELECTION_CLIPBOARD selection to the
738 	 * terminal's child.  If necessary, the data is converted from UTF-8 to the
739 	 * terminal's current encoding. It's called on paste menu item, or when
740 	 * user presses Shift+Insert.
741 	 */
742 	public void pasteClipboard()
743 	{
744 		vte_terminal_paste_clipboard(vteTerminal);
745 	}
746 
747 	/**
748 	 * Sends the contents of the #GDK_SELECTION_PRIMARY selection to the terminal's
749 	 * child.  If necessary, the data is converted from UTF-8 to the terminal's
750 	 * current encoding.  The terminal will call also paste the
751 	 * #GDK_SELECTION_PRIMARY selection when the user clicks with the the second
752 	 * mouse button.
753 	 */
754 	public void pastePrimary()
755 	{
756 		vte_terminal_paste_primary(vteTerminal);
757 	}
758 
759 	/**
760 	 * Creates a new #VtePty, and sets the emulation property
761 	 * from #VteTerminal:emulation.
762 	 *
763 	 * See vte_pty_new() for more information.
764 	 *
765 	 * Params:
766 	 *     flags = flags from #VtePtyFlags
767 	 *     cancellable = a #GCancellable, or %NULL
768 	 *
769 	 * Returns: a new #VtePty
770 	 *
771 	 * Throws: GException on failure.
772 	 */
773 	public Pty ptyNewSync(VtePtyFlags flags, Cancellable cancellable)
774 	{
775 		GError* err = null;
776 		
777 		auto p = vte_terminal_pty_new_sync(vteTerminal, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
778 		
779 		if (err !is null)
780 		{
781 			throw new GException( new ErrorG(err) );
782 		}
783 		
784 		if(p is null)
785 		{
786 			return null;
787 		}
788 		
789 		return ObjectG.getDObject!(Pty)(cast(VtePty*) p, true);
790 	}
791 
792 	/**
793 	 * Resets as much of the terminal's internal state as possible, discarding any
794 	 * unprocessed input data, resetting character attributes, cursor state,
795 	 * national character set state, status line, terminal modes (insert/delete),
796 	 * selection state, and encoding.
797 	 *
798 	 * Params:
799 	 *     clearTabstops = whether to reset tabstops
800 	 *     clearHistory = whether to empty the terminal's scrollback buffer
801 	 */
802 	public void reset(bool clearTabstops, bool clearHistory)
803 	{
804 		vte_terminal_reset(vteTerminal, clearTabstops, clearHistory);
805 	}
806 
807 	/**
808 	 * Searches the next string matching the search regex set with
809 	 * vte_terminal_search_set_regex().
810 	 *
811 	 * Returns: %TRUE if a match was found
812 	 */
813 	public bool searchFindNext()
814 	{
815 		return vte_terminal_search_find_next(vteTerminal) != 0;
816 	}
817 
818 	/**
819 	 * Searches the previous string matching the search regex set with
820 	 * vte_terminal_search_set_regex().
821 	 *
822 	 * Returns: %TRUE if a match was found
823 	 */
824 	public bool searchFindPrevious()
825 	{
826 		return vte_terminal_search_find_previous(vteTerminal) != 0;
827 	}
828 
829 	/**
830 	 *
831 	 *
832 	 * Deprecated: use vte_terminal_search_get_regex() instead.
833 	 *
834 	 * Returns: %NULL
835 	 */
836 	public Regex searchGetGregex()
837 	{
838 		auto p = vte_terminal_search_get_gregex(vteTerminal);
839 		
840 		if(p is null)
841 		{
842 			return null;
843 		}
844 		
845 		return new Regex(cast(GRegex*) p);
846 	}
847 
848 	/**
849 	 * Returns: the search #VteRegex regex set in @terminal, or %NULL
850 	 *
851 	 * Since: 0.46
852 	 */
853 	public RegexVte searchGetRegex()
854 	{
855 		auto p = vte_terminal_search_get_regex(vteTerminal);
856 		
857 		if(p is null)
858 		{
859 			return null;
860 		}
861 		
862 		return ObjectG.getDObject!(RegexVte)(cast(VteRegex*) p);
863 	}
864 
865 	/**
866 	 * Returns: whether searching will wrap around
867 	 */
868 	public bool searchGetWrapAround()
869 	{
870 		return vte_terminal_search_get_wrap_around(vteTerminal) != 0;
871 	}
872 
873 	/**
874 	 * Sets the #GRegex regex to search for. Unsets the search regex when passed %NULL.
875 	 *
876 	 * Deprecated: use vte_terminal_search_set_regex() instead.
877 	 *
878 	 * Params:
879 	 *     gregex = a #GRegex, or %NULL
880 	 *     gflags = flags from #GRegexMatchFlags
881 	 */
882 	public void searchSetGregex(Regex gregex, GRegexMatchFlags gflags)
883 	{
884 		vte_terminal_search_set_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags);
885 	}
886 
887 	/**
888 	 * Sets the regex to search for. Unsets the search regex when passed %NULL.
889 	 *
890 	 * Params:
891 	 *     regex = a #VteRegex, or %NULL
892 	 *     flags = PCRE2 match flags, or 0
893 	 *
894 	 * Since: 0.46
895 	 */
896 	public void searchSetRegex(RegexVte regex, uint flags)
897 	{
898 		vte_terminal_search_set_regex(vteTerminal, (regex is null) ? null : regex.getRegexStruct(), flags);
899 	}
900 
901 	/**
902 	 * Sets whether search should wrap around to the beginning of the
903 	 * terminal content when reaching its end.
904 	 *
905 	 * Params:
906 	 *     wrapAround = whether search should wrap
907 	 */
908 	public void searchSetWrapAround(bool wrapAround)
909 	{
910 		vte_terminal_search_set_wrap_around(vteTerminal, wrapAround);
911 	}
912 
913 	/**
914 	 * Selects all text within the terminal (including the scrollback buffer).
915 	 */
916 	public void selectAll()
917 	{
918 		vte_terminal_select_all(vteTerminal);
919 	}
920 
921 	/**
922 	 * Controls whether or not the terminal will attempt to draw bold text,
923 	 * either by using a bold font variant or by repainting text with a different
924 	 * offset.
925 	 *
926 	 * Params:
927 	 *     allowBold = %TRUE if the terminal should attempt to draw bold text
928 	 */
929 	public void setAllowBold(bool allowBold)
930 	{
931 		vte_terminal_set_allow_bold(vteTerminal, allowBold);
932 	}
933 
934 	/**
935 	 * Controls whether or not the terminal will beep when the child outputs the
936 	 * "bl" sequence.
937 	 *
938 	 * Params:
939 	 *     isAudible = %TRUE if the terminal should beep
940 	 */
941 	public void setAudibleBell(bool isAudible)
942 	{
943 		vte_terminal_set_audible_bell(vteTerminal, isAudible);
944 	}
945 
946 	/**
947 	 * Modifies the terminal's backspace key binding, which controls what
948 	 * string or control sequence the terminal sends to its child when the user
949 	 * presses the backspace key.
950 	 *
951 	 * Params:
952 	 *     binding = a #VteEraseBinding for the backspace key
953 	 */
954 	public void setBackspaceBinding(VteEraseBinding binding)
955 	{
956 		vte_terminal_set_backspace_binding(vteTerminal, binding);
957 	}
958 
959 	/**
960 	 * This setting controls whether ambiguous-width characters are narrow or wide
961 	 * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings,
962 	 * the width of ambiguous-width characters is fixed.
963 	 *
964 	 * Params:
965 	 *     width = either 1 (narrow) or 2 (wide)
966 	 */
967 	public void setCjkAmbiguousWidth(int width)
968 	{
969 		vte_terminal_set_cjk_ambiguous_width(vteTerminal, width);
970 	}
971 
972 	/**
973 	 * Sets the background color for text which does not have a specific background
974 	 * color assigned.  Only has effect when no background image is set and when
975 	 * the terminal is not transparent.
976 	 *
977 	 * Params:
978 	 *     background = the new background color
979 	 */
980 	public void setColorBackground(RGBA background)
981 	{
982 		vte_terminal_set_color_background(vteTerminal, (background is null) ? null : background.getRGBAStruct());
983 	}
984 
985 	/**
986 	 * Sets the color used to draw bold text in the default foreground color.
987 	 * If @bold is %NULL then the default color is used.
988 	 *
989 	 * Params:
990 	 *     bold = the new bold color or %NULL
991 	 */
992 	public void setColorBold(RGBA bold)
993 	{
994 		vte_terminal_set_color_bold(vteTerminal, (bold is null) ? null : bold.getRGBAStruct());
995 	}
996 
997 	/**
998 	 * Sets the background color for text which is under the cursor.  If %NULL, text
999 	 * under the cursor will be drawn with foreground and background colors
1000 	 * reversed.
1001 	 *
1002 	 * Params:
1003 	 *     cursorBackground = the new color to use for the text cursor, or %NULL
1004 	 */
1005 	public void setColorCursor(RGBA cursorBackground)
1006 	{
1007 		vte_terminal_set_color_cursor(vteTerminal, (cursorBackground is null) ? null : cursorBackground.getRGBAStruct());
1008 	}
1009 
1010 	/**
1011 	 * Sets the foreground color for text which is under the cursor.  If %NULL, text
1012 	 * under the cursor will be drawn with foreground and background colors
1013 	 * reversed.
1014 	 *
1015 	 * Params:
1016 	 *     cursorForeground = the new color to use for the text cursor, or %NULL
1017 	 *
1018 	 * Since: 0.44
1019 	 */
1020 	public void setColorCursorForeground(RGBA cursorForeground)
1021 	{
1022 		vte_terminal_set_color_cursor_foreground(vteTerminal, (cursorForeground is null) ? null : cursorForeground.getRGBAStruct());
1023 	}
1024 
1025 	/**
1026 	 * Sets the foreground color used to draw normal text.
1027 	 *
1028 	 * Params:
1029 	 *     foreground = the new foreground color
1030 	 */
1031 	public void setColorForeground(RGBA foreground)
1032 	{
1033 		vte_terminal_set_color_foreground(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct());
1034 	}
1035 
1036 	/**
1037 	 * Sets the background color for text which is highlighted.  If %NULL,
1038 	 * it is unset.  If neither highlight background nor highlight foreground are set,
1039 	 * highlighted text (which is usually highlighted because it is selected) will
1040 	 * be drawn with foreground and background colors reversed.
1041 	 *
1042 	 * Params:
1043 	 *     highlightBackground = the new color to use for highlighted text, or %NULL
1044 	 */
1045 	public void setColorHighlight(RGBA highlightBackground)
1046 	{
1047 		vte_terminal_set_color_highlight(vteTerminal, (highlightBackground is null) ? null : highlightBackground.getRGBAStruct());
1048 	}
1049 
1050 	/**
1051 	 * Sets the foreground color for text which is highlighted.  If %NULL,
1052 	 * it is unset.  If neither highlight background nor highlight foreground are set,
1053 	 * highlighted text (which is usually highlighted because it is selected) will
1054 	 * be drawn with foreground and background colors reversed.
1055 	 *
1056 	 * Params:
1057 	 *     highlightForeground = the new color to use for highlighted text, or %NULL
1058 	 */
1059 	public void setColorHighlightForeground(RGBA highlightForeground)
1060 	{
1061 		vte_terminal_set_color_highlight_foreground(vteTerminal, (highlightForeground is null) ? null : highlightForeground.getRGBAStruct());
1062 	}
1063 
1064 	/**
1065 	 * @palette specifies the new values for the 256 palette colors: 8 standard colors,
1066 	 * their 8 bright counterparts, 6x6x6 color cube, and 24 grayscale colors.
1067 	 * Omitted entries will default to a hardcoded value.
1068 	 *
1069 	 * @palette_size must be 0, 8, 16, 232 or 256.
1070 	 *
1071 	 * If @foreground is %NULL and @palette_size is greater than 0, the new foreground
1072 	 * color is taken from @palette[7].  If @background is %NULL and @palette_size is
1073 	 * greater than 0, the new background color is taken from @palette[0].
1074 	 *
1075 	 * Params:
1076 	 *     foreground = the new foreground color, or %NULL
1077 	 *     background = the new background color, or %NULL
1078 	 *     palette = the color palette
1079 	 *     paletteSize = the number of entries in @palette
1080 	 */
1081 	public void setColors(RGBA foreground, RGBA background, RGBA[] palette)
1082 	{
1083 		GdkRGBA[] paletteArray = new GdkRGBA[palette.length];
1084 		for ( int i = 0; i < palette.length; i++ )
1085 		{
1086 			paletteArray[i] = *(palette[i].getRGBAStruct());
1087 		}
1088 		
1089 		vte_terminal_set_colors(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct(), (background is null) ? null : background.getRGBAStruct(), paletteArray.ptr, cast(size_t)palette.length);
1090 	}
1091 
1092 	/**
1093 	 * Sets whether or not the cursor will blink. Using %VTE_CURSOR_BLINK_SYSTEM
1094 	 * will use the #GtkSettings::gtk-cursor-blink setting.
1095 	 *
1096 	 * Params:
1097 	 *     mode = the #VteCursorBlinkMode to use
1098 	 */
1099 	public void setCursorBlinkMode(VteCursorBlinkMode mode)
1100 	{
1101 		vte_terminal_set_cursor_blink_mode(vteTerminal, mode);
1102 	}
1103 
1104 	/**
1105 	 * Sets the shape of the cursor drawn.
1106 	 *
1107 	 * Params:
1108 	 *     shape = the #VteCursorShape to use
1109 	 */
1110 	public void setCursorShape(VteCursorShape shape)
1111 	{
1112 		vte_terminal_set_cursor_shape(vteTerminal, shape);
1113 	}
1114 
1115 	/**
1116 	 * Reset the terminal palette to reasonable compiled-in default color.
1117 	 */
1118 	public void setDefaultColors()
1119 	{
1120 		vte_terminal_set_default_colors(vteTerminal);
1121 	}
1122 
1123 	/**
1124 	 * Modifies the terminal's delete key binding, which controls what
1125 	 * string or control sequence the terminal sends to its child when the user
1126 	 * presses the delete key.
1127 	 *
1128 	 * Params:
1129 	 *     binding = a #VteEraseBinding for the delete key
1130 	 */
1131 	public void setDeleteBinding(VteEraseBinding binding)
1132 	{
1133 		vte_terminal_set_delete_binding(vteTerminal, binding);
1134 	}
1135 
1136 	/**
1137 	 * Changes the encoding the terminal will expect data from the child to
1138 	 * be encoded with.  For certain terminal types, applications executing in the
1139 	 * terminal can change the encoding. If @codeset is %NULL, it uses "UTF-8".
1140 	 *
1141 	 * Params:
1142 	 *     codeset = a valid #GIConv target, or %NULL to use UTF-8
1143 	 *
1144 	 * Returns: %TRUE if the encoding could be changed to the specified one,
1145 	 *     or %FALSE with @error set to %G_CONVERT_ERROR_NO_CONVERSION.
1146 	 *
1147 	 * Throws: GException on failure.
1148 	 */
1149 	public bool setEncoding(string codeset)
1150 	{
1151 		GError* err = null;
1152 		
1153 		auto p = vte_terminal_set_encoding(vteTerminal, Str.toStringz(codeset), &err) != 0;
1154 		
1155 		if (err !is null)
1156 		{
1157 			throw new GException( new ErrorG(err) );
1158 		}
1159 		
1160 		return p;
1161 	}
1162 
1163 	/**
1164 	 * Sets the font used for rendering all text displayed by the terminal,
1165 	 * overriding any fonts set using gtk_widget_modify_font().  The terminal
1166 	 * will immediately attempt to load the desired font, retrieve its
1167 	 * metrics, and attempt to resize itself to keep the same number of rows
1168 	 * and columns.  The font scale is applied to the specified font.
1169 	 *
1170 	 * Params:
1171 	 *     fontDesc = a #PangoFontDescription for the desired font, or %NULL
1172 	 */
1173 	public void setFont(PgFontDescription fontDesc)
1174 	{
1175 		vte_terminal_set_font(vteTerminal, (fontDesc is null) ? null : fontDesc.getPgFontDescriptionStruct());
1176 	}
1177 
1178 	/**
1179 	 * Sets the terminal's font scale to @scale.
1180 	 *
1181 	 * Params:
1182 	 *     scale = the font scale
1183 	 */
1184 	public void setFontScale(double scale)
1185 	{
1186 		vte_terminal_set_font_scale(vteTerminal, scale);
1187 	}
1188 
1189 	/**
1190 	 * Sets @terminal as @window's geometry widget. See
1191 	 * gtk_window_set_geometry_hints() for more information.
1192 	 *
1193 	 * @terminal must be realized (see gtk_widget_get_realized()).
1194 	 *
1195 	 * Params:
1196 	 *     window = a #GtkWindow
1197 	 */
1198 	public void setGeometryHintsForWindow(Window window)
1199 	{
1200 		vte_terminal_set_geometry_hints_for_window(vteTerminal, (window is null) ? null : window.getWindowStruct());
1201 	}
1202 
1203 	/**
1204 	 * Enables or disables user input. When user input is disabled,
1205 	 * the terminal's child will not receive any key press, or mouse button
1206 	 * press or motion events sent to it.
1207 	 *
1208 	 * Params:
1209 	 *     enabled = whether to enable user input
1210 	 */
1211 	public void setInputEnabled(bool enabled)
1212 	{
1213 		vte_terminal_set_input_enabled(vteTerminal, enabled);
1214 	}
1215 
1216 	/**
1217 	 * Changes the value of the terminal's mouse autohide setting.  When autohiding
1218 	 * is enabled, the mouse cursor will be hidden when the user presses a key and
1219 	 * shown when the user moves the mouse.  This setting can be read using
1220 	 * vte_terminal_get_mouse_autohide().
1221 	 *
1222 	 * Params:
1223 	 *     setting = whether the mouse pointer should autohide
1224 	 */
1225 	public void setMouseAutohide(bool setting)
1226 	{
1227 		vte_terminal_set_mouse_autohide(vteTerminal, setting);
1228 	}
1229 
1230 	/**
1231 	 * Sets @pty as the PTY to use in @terminal.
1232 	 * Use %NULL to unset the PTY.
1233 	 *
1234 	 * Params:
1235 	 *     pty = a #VtePty, or %NULL
1236 	 */
1237 	public void setPty(Pty pty)
1238 	{
1239 		vte_terminal_set_pty(vteTerminal, (pty is null) ? null : pty.getPtyStruct());
1240 	}
1241 
1242 	/**
1243 	 * Controls whether or not the terminal will rewrap its contents, including
1244 	 * the scrollback history, whenever the terminal's width changes.
1245 	 *
1246 	 * Params:
1247 	 *     rewrap = %TRUE if the terminal should rewrap on resize
1248 	 */
1249 	public void setRewrapOnResize(bool rewrap)
1250 	{
1251 		vte_terminal_set_rewrap_on_resize(vteTerminal, rewrap);
1252 	}
1253 
1254 	/**
1255 	 * Controls whether or not the terminal will forcibly scroll to the bottom of
1256 	 * the viewable history when the user presses a key.  Modifier keys do not
1257 	 * trigger this behavior.
1258 	 *
1259 	 * Params:
1260 	 *     scroll = whether the terminal should scroll on keystrokes
1261 	 */
1262 	public void setScrollOnKeystroke(bool scroll)
1263 	{
1264 		vte_terminal_set_scroll_on_keystroke(vteTerminal, scroll);
1265 	}
1266 
1267 	/**
1268 	 * Controls whether or not the terminal will forcibly scroll to the bottom of
1269 	 * the viewable history when the new data is received from the child.
1270 	 *
1271 	 * Params:
1272 	 *     scroll = whether the terminal should scroll on output
1273 	 */
1274 	public void setScrollOnOutput(bool scroll)
1275 	{
1276 		vte_terminal_set_scroll_on_output(vteTerminal, scroll);
1277 	}
1278 
1279 	/**
1280 	 * Sets the length of the scrollback buffer used by the terminal.  The size of
1281 	 * the scrollback buffer will be set to the larger of this value and the number
1282 	 * of visible rows the widget can display, so 0 can safely be used to disable
1283 	 * scrollback.
1284 	 *
1285 	 * A negative value means "infinite scrollback".
1286 	 *
1287 	 * Note that this setting only affects the normal screen buffer.
1288 	 * No scrollback is allowed on the alternate screen buffer.
1289 	 *
1290 	 * Params:
1291 	 *     lines = the length of the history buffer
1292 	 */
1293 	public void setScrollbackLines(glong lines)
1294 	{
1295 		vte_terminal_set_scrollback_lines(vteTerminal, lines);
1296 	}
1297 
1298 	/**
1299 	 * Attempts to change the terminal's size in terms of rows and columns.  If
1300 	 * the attempt succeeds, the widget will resize itself to the proper size.
1301 	 *
1302 	 * Params:
1303 	 *     columns = the desired number of columns
1304 	 *     rows = the desired number of rows
1305 	 */
1306 	public void setSize(glong columns, glong rows)
1307 	{
1308 		vte_terminal_set_size(vteTerminal, columns, rows);
1309 	}
1310 
1311 	/**
1312 	 * With this function you can provide a set of characters which will
1313 	 * be considered parts of a word when doing word-wise selection, in
1314 	 * addition to the default which only considers alphanumeric characters
1315 	 * part of a word.
1316 	 *
1317 	 * The characters in @exceptions must be non-alphanumeric, each character
1318 	 * must occur only once, and if @exceptions contains the character
1319 	 * U+002D HYPHEN-MINUS, it must be at the start of the string.
1320 	 *
1321 	 * Use %NULL to reset the set of exception characters to the default.
1322 	 *
1323 	 * Params:
1324 	 *     exceptions = a string of ASCII punctuation characters, or %NULL
1325 	 *
1326 	 * Since: 0.40
1327 	 */
1328 	public void setWordCharExceptions(string exceptions)
1329 	{
1330 		vte_terminal_set_word_char_exceptions(vteTerminal, Str.toStringz(exceptions));
1331 	}
1332 
1333 	/**
1334 	 * A convenience function that wraps creating the #VtePty and spawning
1335 	 * the child process on it. See vte_pty_new_sync(), vte_pty_spawn_async(),
1336 	 * and vte_pty_spawn_finish() for more information.
1337 	 *
1338 	 * When the operation is finished successfully, @callback will be called
1339 	 * with the child #GPid, and a %NULL #GError. The child PID will already be
1340 	 * watched via vte_terminal_watch_child().
1341 	 *
1342 	 * When the operation fails, @callback will be called with a -1 #GPid,
1343 	 * and a non-%NULL #GError containing the error information.
1344 	 *
1345 	 * Note that if @terminal has been destroyed before the operation is called,
1346 	 * @callback will be called with a %NULL @terminal; you must not do anything
1347 	 * in the callback besides freeing any resources associated with @user_data,
1348 	 * but taking care not to access the now-destroyed #VteTerminal. Note that
1349 	 * in this case, if spawning was successful, the child process will be aborted
1350 	 * automatically.
1351 	 *
1352 	 * Params:
1353 	 *     ptyFlags = flags from #VtePtyFlags
1354 	 *     workingDirectory = the name of a directory the command should start
1355 	 *         in, or %NULL to use the current working directory
1356 	 *     argv = child's argument vector
1357 	 *     envv = a list of environment
1358 	 *         variables to be added to the environment before starting the process, or %NULL
1359 	 *     spawnFlags = flags from #GSpawnFlags
1360 	 *     childSetup = an extra child setup function to run in the child just before exec(), or %NULL
1361 	 *     childSetupData = user data for @child_setup, or %NULL
1362 	 *     childSetupDataDestroy = a #GDestroyNotify for @child_setup_data, or %NULL
1363 	 *     timeout = a timeout value in ms, or -1 to wait indefinitely
1364 	 *     cancellable = a #GCancellable, or %NULL
1365 	 *     callback = a #VteTerminalSpawnAsyncCallback, or %NULL
1366 	 *     userData = user data for @callback, or %NULL
1367 	 *
1368 	 * Since: 0.48
1369 	 */
1370 	public void spawnAsync(VtePtyFlags ptyFlags, string workingDirectory, string[] argv, string[] envv, GSpawnFlags spawnFlags, GSpawnChildSetupFunc childSetup, void* childSetupData, GDestroyNotify childSetupDataDestroy, int timeout, Cancellable cancellable, VteTerminalSpawnAsyncCallback callback, void* userData)
1371 	{
1372 		vte_terminal_spawn_async(vteTerminal, ptyFlags, Str.toStringz(workingDirectory), Str.toStringzArray(argv), Str.toStringzArray(envv), spawnFlags, childSetup, childSetupData, childSetupDataDestroy, timeout, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1373 	}
1374 
1375 	/**
1376 	 * Starts the specified command under a newly-allocated controlling
1377 	 * pseudo-terminal.  The @argv and @envv lists should be %NULL-terminated.
1378 	 * The "TERM" environment variable is automatically set to a default value,
1379 	 * but can be overridden from @envv.
1380 	 * @pty_flags controls logging the session to the specified system log files.
1381 	 *
1382 	 * Note that %G_SPAWN_DO_NOT_REAP_CHILD will always be added to @spawn_flags.
1383 	 *
1384 	 * Note that all open file descriptors will be closed in the child. If you want
1385 	 * to keep some file descriptor open for use in the child process, you need to
1386 	 * use a child setup function that unsets the FD_CLOEXEC flag on that file
1387 	 * descriptor.
1388 	 *
1389 	 * See vte_pty_new(), g_spawn_async() and vte_terminal_watch_child() for more information.
1390 	 *
1391 	 * Deprecated: Use vte_terminal_spawn_async() instead.
1392 	 *
1393 	 * Params:
1394 	 *     ptyFlags = flags from #VtePtyFlags
1395 	 *     workingDirectory = the name of a directory the command should start
1396 	 *         in, or %NULL to use the current working directory
1397 	 *     argv = child's argument vector
1398 	 *     envv = a list of environment
1399 	 *         variables to be added to the environment before starting the process, or %NULL
1400 	 *     spawnFlags = flags from #GSpawnFlags
1401 	 *     childSetup = an extra child setup function to run in the child just before exec(), or %NULL
1402 	 *     childSetupData = user data for @child_setup
1403 	 *     childPid = a location to store the child PID, or %NULL
1404 	 *     cancellable = a #GCancellable, or %NULL
1405 	 *
1406 	 * Returns: %TRUE on success, or %FALSE on error with @error filled in
1407 	 *
1408 	 * Throws: GException on failure.
1409 	 */
1410 	public bool spawnSync(VtePtyFlags ptyFlags, string workingDirectory, string[] argv, string[] envv, GSpawnFlags spawnFlags, GSpawnChildSetupFunc childSetup, void* childSetupData, out GPid childPid, Cancellable cancellable)
1411 	{
1412 		GError* err = null;
1413 		
1414 		auto p = vte_terminal_spawn_sync(vteTerminal, ptyFlags, Str.toStringz(workingDirectory), Str.toStringzArray(argv), Str.toStringzArray(envv), spawnFlags, childSetup, childSetupData, &childPid, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1415 		
1416 		if (err !is null)
1417 		{
1418 			throw new GException( new ErrorG(err) );
1419 		}
1420 		
1421 		return p;
1422 	}
1423 
1424 	/**
1425 	 * Clears the current selection.
1426 	 */
1427 	public void unselectAll()
1428 	{
1429 		vte_terminal_unselect_all(vteTerminal);
1430 	}
1431 
1432 	/**
1433 	 * Watches @child_pid. When the process exists, the #VteTerminal::child-exited
1434 	 * signal will be called with the child's exit status.
1435 	 *
1436 	 * Prior to calling this function, a #VtePty must have been set in @terminal
1437 	 * using vte_terminal_set_pty().
1438 	 * When the child exits, the terminal's #VtePty will be set to %NULL.
1439 	 *
1440 	 * Note: g_child_watch_add() or g_child_watch_add_full() must not have
1441 	 * been called for @child_pid, nor a #GSource for it been created with
1442 	 * g_child_watch_source_new().
1443 	 *
1444 	 * Note: when using the g_spawn_async() family of functions,
1445 	 * the %G_SPAWN_DO_NOT_REAP_CHILD flag MUST have been passed.
1446 	 *
1447 	 * Params:
1448 	 *     childPid = a #GPid
1449 	 */
1450 	public void watchChild(GPid childPid)
1451 	{
1452 		vte_terminal_watch_child(vteTerminal, childPid);
1453 	}
1454 
1455 	/**
1456 	 * Write contents of the current contents of @terminal (including any
1457 	 * scrollback history) to @stream according to @flags.
1458 	 *
1459 	 * If @cancellable is not %NULL, then the operation can be cancelled by triggering
1460 	 * the cancellable object from another thread. If the operation was cancelled,
1461 	 * the error %G_IO_ERROR_CANCELLED will be returned in @error.
1462 	 *
1463 	 * This is a synchronous operation and will make the widget (and input
1464 	 * processing) during the write operation, which may take a long time
1465 	 * depending on scrollback history and @stream availability for writing.
1466 	 *
1467 	 * Params:
1468 	 *     stream = a #GOutputStream to write to
1469 	 *     flags = a set of #VteWriteFlags
1470 	 *     cancellable = a #GCancellable object, or %NULL
1471 	 *
1472 	 * Returns: %TRUE on success, %FALSE if there was an error
1473 	 *
1474 	 * Throws: GException on failure.
1475 	 */
1476 	public bool writeContentsSync(OutputStream stream, VteWriteFlags flags, Cancellable cancellable)
1477 	{
1478 		GError* err = null;
1479 		
1480 		auto p = vte_terminal_write_contents_sync(vteTerminal, (stream is null) ? null : stream.getOutputStreamStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1481 		
1482 		if (err !is null)
1483 		{
1484 			throw new GException( new ErrorG(err) );
1485 		}
1486 		
1487 		return p;
1488 	}
1489 
1490 	protected class OnBellDelegateWrapper
1491 	{
1492 		static OnBellDelegateWrapper[] listeners;
1493 		void delegate(Terminal) dlg;
1494 		gulong handlerId;
1495 		
1496 		this(void delegate(Terminal) dlg)
1497 		{
1498 			this.dlg = dlg;
1499 			this.listeners ~= this;
1500 		}
1501 		
1502 		void remove(OnBellDelegateWrapper source)
1503 		{
1504 			foreach(index, wrapper; listeners)
1505 			{
1506 				if (wrapper.handlerId == source.handlerId)
1507 				{
1508 					listeners[index] = null;
1509 					listeners = std.algorithm.remove(listeners, index);
1510 					break;
1511 				}
1512 			}
1513 		}
1514 	}
1515 
1516 	/**
1517 	 * This signal is emitted when the a child sends a bell request to the
1518 	 * terminal.
1519 	 */
1520 	gulong addOnBell(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1521 	{
1522 		auto wrapper = new OnBellDelegateWrapper(dlg);
1523 		wrapper.handlerId = Signals.connectData(
1524 			this,
1525 			"bell",
1526 			cast(GCallback)&callBackBell,
1527 			cast(void*)wrapper,
1528 			cast(GClosureNotify)&callBackBellDestroy,
1529 			connectFlags);
1530 		return wrapper.handlerId;
1531 	}
1532 	
1533 	extern(C) static void callBackBell(VteTerminal* terminalStruct, OnBellDelegateWrapper wrapper)
1534 	{
1535 		wrapper.dlg(wrapper.outer);
1536 	}
1537 	
1538 	extern(C) static void callBackBellDestroy(OnBellDelegateWrapper wrapper, GClosure* closure)
1539 	{
1540 		wrapper.remove(wrapper);
1541 	}
1542 
1543 	protected class OnCharSizeChangedDelegateWrapper
1544 	{
1545 		static OnCharSizeChangedDelegateWrapper[] listeners;
1546 		void delegate(uint, uint, Terminal) dlg;
1547 		gulong handlerId;
1548 		
1549 		this(void delegate(uint, uint, Terminal) dlg)
1550 		{
1551 			this.dlg = dlg;
1552 			this.listeners ~= this;
1553 		}
1554 		
1555 		void remove(OnCharSizeChangedDelegateWrapper source)
1556 		{
1557 			foreach(index, wrapper; listeners)
1558 			{
1559 				if (wrapper.handlerId == source.handlerId)
1560 				{
1561 					listeners[index] = null;
1562 					listeners = std.algorithm.remove(listeners, index);
1563 					break;
1564 				}
1565 			}
1566 		}
1567 	}
1568 
1569 	/**
1570 	 * Emitted whenever selection of a new font causes the values of the
1571 	 * %char_width or %char_height fields to change.
1572 	 *
1573 	 * Params:
1574 	 *     width = the new character cell width
1575 	 *     height = the new character cell height
1576 	 */
1577 	gulong addOnCharSizeChanged(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1578 	{
1579 		auto wrapper = new OnCharSizeChangedDelegateWrapper(dlg);
1580 		wrapper.handlerId = Signals.connectData(
1581 			this,
1582 			"char-size-changed",
1583 			cast(GCallback)&callBackCharSizeChanged,
1584 			cast(void*)wrapper,
1585 			cast(GClosureNotify)&callBackCharSizeChangedDestroy,
1586 			connectFlags);
1587 		return wrapper.handlerId;
1588 	}
1589 	
1590 	extern(C) static void callBackCharSizeChanged(VteTerminal* terminalStruct, uint width, uint height, OnCharSizeChangedDelegateWrapper wrapper)
1591 	{
1592 		wrapper.dlg(width, height, wrapper.outer);
1593 	}
1594 	
1595 	extern(C) static void callBackCharSizeChangedDestroy(OnCharSizeChangedDelegateWrapper wrapper, GClosure* closure)
1596 	{
1597 		wrapper.remove(wrapper);
1598 	}
1599 
1600 	protected class OnChildExitedDelegateWrapper
1601 	{
1602 		static OnChildExitedDelegateWrapper[] listeners;
1603 		void delegate(int, Terminal) dlg;
1604 		gulong handlerId;
1605 		
1606 		this(void delegate(int, Terminal) dlg)
1607 		{
1608 			this.dlg = dlg;
1609 			this.listeners ~= this;
1610 		}
1611 		
1612 		void remove(OnChildExitedDelegateWrapper source)
1613 		{
1614 			foreach(index, wrapper; listeners)
1615 			{
1616 				if (wrapper.handlerId == source.handlerId)
1617 				{
1618 					listeners[index] = null;
1619 					listeners = std.algorithm.remove(listeners, index);
1620 					break;
1621 				}
1622 			}
1623 		}
1624 	}
1625 
1626 	/**
1627 	 * This signal is emitted when the terminal detects that a child
1628 	 * watched using vte_terminal_watch_child() has exited.
1629 	 *
1630 	 * Params:
1631 	 *     status = the child's exit status
1632 	 */
1633 	gulong addOnChildExited(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1634 	{
1635 		auto wrapper = new OnChildExitedDelegateWrapper(dlg);
1636 		wrapper.handlerId = Signals.connectData(
1637 			this,
1638 			"child-exited",
1639 			cast(GCallback)&callBackChildExited,
1640 			cast(void*)wrapper,
1641 			cast(GClosureNotify)&callBackChildExitedDestroy,
1642 			connectFlags);
1643 		return wrapper.handlerId;
1644 	}
1645 	
1646 	extern(C) static void callBackChildExited(VteTerminal* terminalStruct, int status, OnChildExitedDelegateWrapper wrapper)
1647 	{
1648 		wrapper.dlg(status, wrapper.outer);
1649 	}
1650 	
1651 	extern(C) static void callBackChildExitedDestroy(OnChildExitedDelegateWrapper wrapper, GClosure* closure)
1652 	{
1653 		wrapper.remove(wrapper);
1654 	}
1655 
1656 	protected class OnCommitDelegateWrapper
1657 	{
1658 		static OnCommitDelegateWrapper[] listeners;
1659 		void delegate(string, uint, Terminal) dlg;
1660 		gulong handlerId;
1661 		
1662 		this(void delegate(string, uint, Terminal) dlg)
1663 		{
1664 			this.dlg = dlg;
1665 			this.listeners ~= this;
1666 		}
1667 		
1668 		void remove(OnCommitDelegateWrapper source)
1669 		{
1670 			foreach(index, wrapper; listeners)
1671 			{
1672 				if (wrapper.handlerId == source.handlerId)
1673 				{
1674 					listeners[index] = null;
1675 					listeners = std.algorithm.remove(listeners, index);
1676 					break;
1677 				}
1678 			}
1679 		}
1680 	}
1681 
1682 	/**
1683 	 * Emitted whenever the terminal receives input from the user and
1684 	 * prepares to send it to the child process.  The signal is emitted even
1685 	 * when there is no child process.
1686 	 *
1687 	 * Params:
1688 	 *     text = a string of text
1689 	 *     size = the length of that string of text
1690 	 */
1691 	gulong addOnCommit(void delegate(string, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1692 	{
1693 		auto wrapper = new OnCommitDelegateWrapper(dlg);
1694 		wrapper.handlerId = Signals.connectData(
1695 			this,
1696 			"commit",
1697 			cast(GCallback)&callBackCommit,
1698 			cast(void*)wrapper,
1699 			cast(GClosureNotify)&callBackCommitDestroy,
1700 			connectFlags);
1701 		return wrapper.handlerId;
1702 	}
1703 	
1704 	extern(C) static void callBackCommit(VteTerminal* terminalStruct, char* text, uint size, OnCommitDelegateWrapper wrapper)
1705 	{
1706 		wrapper.dlg(Str.toString(text), size, wrapper.outer);
1707 	}
1708 	
1709 	extern(C) static void callBackCommitDestroy(OnCommitDelegateWrapper wrapper, GClosure* closure)
1710 	{
1711 		wrapper.remove(wrapper);
1712 	}
1713 
1714 	protected class OnContentsChangedDelegateWrapper
1715 	{
1716 		static OnContentsChangedDelegateWrapper[] listeners;
1717 		void delegate(Terminal) dlg;
1718 		gulong handlerId;
1719 		
1720 		this(void delegate(Terminal) dlg)
1721 		{
1722 			this.dlg = dlg;
1723 			this.listeners ~= this;
1724 		}
1725 		
1726 		void remove(OnContentsChangedDelegateWrapper source)
1727 		{
1728 			foreach(index, wrapper; listeners)
1729 			{
1730 				if (wrapper.handlerId == source.handlerId)
1731 				{
1732 					listeners[index] = null;
1733 					listeners = std.algorithm.remove(listeners, index);
1734 					break;
1735 				}
1736 			}
1737 		}
1738 	}
1739 
1740 	/**
1741 	 * Emitted whenever the visible appearance of the terminal has changed.
1742 	 * Used primarily by #VteTerminalAccessible.
1743 	 */
1744 	gulong addOnContentsChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1745 	{
1746 		auto wrapper = new OnContentsChangedDelegateWrapper(dlg);
1747 		wrapper.handlerId = Signals.connectData(
1748 			this,
1749 			"contents-changed",
1750 			cast(GCallback)&callBackContentsChanged,
1751 			cast(void*)wrapper,
1752 			cast(GClosureNotify)&callBackContentsChangedDestroy,
1753 			connectFlags);
1754 		return wrapper.handlerId;
1755 	}
1756 	
1757 	extern(C) static void callBackContentsChanged(VteTerminal* terminalStruct, OnContentsChangedDelegateWrapper wrapper)
1758 	{
1759 		wrapper.dlg(wrapper.outer);
1760 	}
1761 	
1762 	extern(C) static void callBackContentsChangedDestroy(OnContentsChangedDelegateWrapper wrapper, GClosure* closure)
1763 	{
1764 		wrapper.remove(wrapper);
1765 	}
1766 
1767 	protected class OnCopyClipboardDelegateWrapper
1768 	{
1769 		static OnCopyClipboardDelegateWrapper[] listeners;
1770 		void delegate(Terminal) dlg;
1771 		gulong handlerId;
1772 		
1773 		this(void delegate(Terminal) dlg)
1774 		{
1775 			this.dlg = dlg;
1776 			this.listeners ~= this;
1777 		}
1778 		
1779 		void remove(OnCopyClipboardDelegateWrapper source)
1780 		{
1781 			foreach(index, wrapper; listeners)
1782 			{
1783 				if (wrapper.handlerId == source.handlerId)
1784 				{
1785 					listeners[index] = null;
1786 					listeners = std.algorithm.remove(listeners, index);
1787 					break;
1788 				}
1789 			}
1790 		}
1791 	}
1792 
1793 	/**
1794 	 * Emitted whenever vte_terminal_copy_clipboard() is called.
1795 	 */
1796 	gulong addOnCopyClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1797 	{
1798 		auto wrapper = new OnCopyClipboardDelegateWrapper(dlg);
1799 		wrapper.handlerId = Signals.connectData(
1800 			this,
1801 			"copy-clipboard",
1802 			cast(GCallback)&callBackCopyClipboard,
1803 			cast(void*)wrapper,
1804 			cast(GClosureNotify)&callBackCopyClipboardDestroy,
1805 			connectFlags);
1806 		return wrapper.handlerId;
1807 	}
1808 	
1809 	extern(C) static void callBackCopyClipboard(VteTerminal* terminalStruct, OnCopyClipboardDelegateWrapper wrapper)
1810 	{
1811 		wrapper.dlg(wrapper.outer);
1812 	}
1813 	
1814 	extern(C) static void callBackCopyClipboardDestroy(OnCopyClipboardDelegateWrapper wrapper, GClosure* closure)
1815 	{
1816 		wrapper.remove(wrapper);
1817 	}
1818 
1819 	protected class OnCurrentDirectoryUriChangedDelegateWrapper
1820 	{
1821 		static OnCurrentDirectoryUriChangedDelegateWrapper[] listeners;
1822 		void delegate(Terminal) dlg;
1823 		gulong handlerId;
1824 		
1825 		this(void delegate(Terminal) dlg)
1826 		{
1827 			this.dlg = dlg;
1828 			this.listeners ~= this;
1829 		}
1830 		
1831 		void remove(OnCurrentDirectoryUriChangedDelegateWrapper source)
1832 		{
1833 			foreach(index, wrapper; listeners)
1834 			{
1835 				if (wrapper.handlerId == source.handlerId)
1836 				{
1837 					listeners[index] = null;
1838 					listeners = std.algorithm.remove(listeners, index);
1839 					break;
1840 				}
1841 			}
1842 		}
1843 	}
1844 
1845 	/**
1846 	 * Emitted when the current directory URI is modified.
1847 	 */
1848 	gulong addOnCurrentDirectoryUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1849 	{
1850 		auto wrapper = new OnCurrentDirectoryUriChangedDelegateWrapper(dlg);
1851 		wrapper.handlerId = Signals.connectData(
1852 			this,
1853 			"current-directory-uri-changed",
1854 			cast(GCallback)&callBackCurrentDirectoryUriChanged,
1855 			cast(void*)wrapper,
1856 			cast(GClosureNotify)&callBackCurrentDirectoryUriChangedDestroy,
1857 			connectFlags);
1858 		return wrapper.handlerId;
1859 	}
1860 	
1861 	extern(C) static void callBackCurrentDirectoryUriChanged(VteTerminal* terminalStruct, OnCurrentDirectoryUriChangedDelegateWrapper wrapper)
1862 	{
1863 		wrapper.dlg(wrapper.outer);
1864 	}
1865 	
1866 	extern(C) static void callBackCurrentDirectoryUriChangedDestroy(OnCurrentDirectoryUriChangedDelegateWrapper wrapper, GClosure* closure)
1867 	{
1868 		wrapper.remove(wrapper);
1869 	}
1870 
1871 	protected class OnCurrentFileUriChangedDelegateWrapper
1872 	{
1873 		static OnCurrentFileUriChangedDelegateWrapper[] listeners;
1874 		void delegate(Terminal) dlg;
1875 		gulong handlerId;
1876 		
1877 		this(void delegate(Terminal) dlg)
1878 		{
1879 			this.dlg = dlg;
1880 			this.listeners ~= this;
1881 		}
1882 		
1883 		void remove(OnCurrentFileUriChangedDelegateWrapper source)
1884 		{
1885 			foreach(index, wrapper; listeners)
1886 			{
1887 				if (wrapper.handlerId == source.handlerId)
1888 				{
1889 					listeners[index] = null;
1890 					listeners = std.algorithm.remove(listeners, index);
1891 					break;
1892 				}
1893 			}
1894 		}
1895 	}
1896 
1897 	/**
1898 	 * Emitted when the current file URI is modified.
1899 	 */
1900 	gulong addOnCurrentFileUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1901 	{
1902 		auto wrapper = new OnCurrentFileUriChangedDelegateWrapper(dlg);
1903 		wrapper.handlerId = Signals.connectData(
1904 			this,
1905 			"current-file-uri-changed",
1906 			cast(GCallback)&callBackCurrentFileUriChanged,
1907 			cast(void*)wrapper,
1908 			cast(GClosureNotify)&callBackCurrentFileUriChangedDestroy,
1909 			connectFlags);
1910 		return wrapper.handlerId;
1911 	}
1912 	
1913 	extern(C) static void callBackCurrentFileUriChanged(VteTerminal* terminalStruct, OnCurrentFileUriChangedDelegateWrapper wrapper)
1914 	{
1915 		wrapper.dlg(wrapper.outer);
1916 	}
1917 	
1918 	extern(C) static void callBackCurrentFileUriChangedDestroy(OnCurrentFileUriChangedDelegateWrapper wrapper, GClosure* closure)
1919 	{
1920 		wrapper.remove(wrapper);
1921 	}
1922 
1923 	protected class OnCursorMovedDelegateWrapper
1924 	{
1925 		static OnCursorMovedDelegateWrapper[] listeners;
1926 		void delegate(Terminal) dlg;
1927 		gulong handlerId;
1928 		
1929 		this(void delegate(Terminal) dlg)
1930 		{
1931 			this.dlg = dlg;
1932 			this.listeners ~= this;
1933 		}
1934 		
1935 		void remove(OnCursorMovedDelegateWrapper source)
1936 		{
1937 			foreach(index, wrapper; listeners)
1938 			{
1939 				if (wrapper.handlerId == source.handlerId)
1940 				{
1941 					listeners[index] = null;
1942 					listeners = std.algorithm.remove(listeners, index);
1943 					break;
1944 				}
1945 			}
1946 		}
1947 	}
1948 
1949 	/**
1950 	 * Emitted whenever the cursor moves to a new character cell.  Used
1951 	 * primarily by #VteTerminalAccessible.
1952 	 */
1953 	gulong addOnCursorMoved(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1954 	{
1955 		auto wrapper = new OnCursorMovedDelegateWrapper(dlg);
1956 		wrapper.handlerId = Signals.connectData(
1957 			this,
1958 			"cursor-moved",
1959 			cast(GCallback)&callBackCursorMoved,
1960 			cast(void*)wrapper,
1961 			cast(GClosureNotify)&callBackCursorMovedDestroy,
1962 			connectFlags);
1963 		return wrapper.handlerId;
1964 	}
1965 	
1966 	extern(C) static void callBackCursorMoved(VteTerminal* terminalStruct, OnCursorMovedDelegateWrapper wrapper)
1967 	{
1968 		wrapper.dlg(wrapper.outer);
1969 	}
1970 	
1971 	extern(C) static void callBackCursorMovedDestroy(OnCursorMovedDelegateWrapper wrapper, GClosure* closure)
1972 	{
1973 		wrapper.remove(wrapper);
1974 	}
1975 
1976 	protected class OnDecreaseFontSizeDelegateWrapper
1977 	{
1978 		static OnDecreaseFontSizeDelegateWrapper[] listeners;
1979 		void delegate(Terminal) dlg;
1980 		gulong handlerId;
1981 		
1982 		this(void delegate(Terminal) dlg)
1983 		{
1984 			this.dlg = dlg;
1985 			this.listeners ~= this;
1986 		}
1987 		
1988 		void remove(OnDecreaseFontSizeDelegateWrapper source)
1989 		{
1990 			foreach(index, wrapper; listeners)
1991 			{
1992 				if (wrapper.handlerId == source.handlerId)
1993 				{
1994 					listeners[index] = null;
1995 					listeners = std.algorithm.remove(listeners, index);
1996 					break;
1997 				}
1998 			}
1999 		}
2000 	}
2001 
2002 	/**
2003 	 * Emitted when the user hits the '-' key while holding the Control key.
2004 	 */
2005 	gulong addOnDecreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2006 	{
2007 		auto wrapper = new OnDecreaseFontSizeDelegateWrapper(dlg);
2008 		wrapper.handlerId = Signals.connectData(
2009 			this,
2010 			"decrease-font-size",
2011 			cast(GCallback)&callBackDecreaseFontSize,
2012 			cast(void*)wrapper,
2013 			cast(GClosureNotify)&callBackDecreaseFontSizeDestroy,
2014 			connectFlags);
2015 		return wrapper.handlerId;
2016 	}
2017 	
2018 	extern(C) static void callBackDecreaseFontSize(VteTerminal* terminalStruct, OnDecreaseFontSizeDelegateWrapper wrapper)
2019 	{
2020 		wrapper.dlg(wrapper.outer);
2021 	}
2022 	
2023 	extern(C) static void callBackDecreaseFontSizeDestroy(OnDecreaseFontSizeDelegateWrapper wrapper, GClosure* closure)
2024 	{
2025 		wrapper.remove(wrapper);
2026 	}
2027 
2028 	protected class OnDeiconifyWindowDelegateWrapper
2029 	{
2030 		static OnDeiconifyWindowDelegateWrapper[] listeners;
2031 		void delegate(Terminal) dlg;
2032 		gulong handlerId;
2033 		
2034 		this(void delegate(Terminal) dlg)
2035 		{
2036 			this.dlg = dlg;
2037 			this.listeners ~= this;
2038 		}
2039 		
2040 		void remove(OnDeiconifyWindowDelegateWrapper source)
2041 		{
2042 			foreach(index, wrapper; listeners)
2043 			{
2044 				if (wrapper.handlerId == source.handlerId)
2045 				{
2046 					listeners[index] = null;
2047 					listeners = std.algorithm.remove(listeners, index);
2048 					break;
2049 				}
2050 			}
2051 		}
2052 	}
2053 
2054 	/**
2055 	 * Emitted at the child application's request.
2056 	 */
2057 	gulong addOnDeiconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2058 	{
2059 		auto wrapper = new OnDeiconifyWindowDelegateWrapper(dlg);
2060 		wrapper.handlerId = Signals.connectData(
2061 			this,
2062 			"deiconify-window",
2063 			cast(GCallback)&callBackDeiconifyWindow,
2064 			cast(void*)wrapper,
2065 			cast(GClosureNotify)&callBackDeiconifyWindowDestroy,
2066 			connectFlags);
2067 		return wrapper.handlerId;
2068 	}
2069 	
2070 	extern(C) static void callBackDeiconifyWindow(VteTerminal* terminalStruct, OnDeiconifyWindowDelegateWrapper wrapper)
2071 	{
2072 		wrapper.dlg(wrapper.outer);
2073 	}
2074 	
2075 	extern(C) static void callBackDeiconifyWindowDestroy(OnDeiconifyWindowDelegateWrapper wrapper, GClosure* closure)
2076 	{
2077 		wrapper.remove(wrapper);
2078 	}
2079 
2080 	protected class OnEncodingChangedDelegateWrapper
2081 	{
2082 		static OnEncodingChangedDelegateWrapper[] listeners;
2083 		void delegate(Terminal) dlg;
2084 		gulong handlerId;
2085 		
2086 		this(void delegate(Terminal) dlg)
2087 		{
2088 			this.dlg = dlg;
2089 			this.listeners ~= this;
2090 		}
2091 		
2092 		void remove(OnEncodingChangedDelegateWrapper source)
2093 		{
2094 			foreach(index, wrapper; listeners)
2095 			{
2096 				if (wrapper.handlerId == source.handlerId)
2097 				{
2098 					listeners[index] = null;
2099 					listeners = std.algorithm.remove(listeners, index);
2100 					break;
2101 				}
2102 			}
2103 		}
2104 	}
2105 
2106 	/**
2107 	 * Emitted whenever the terminal's current encoding has changed, either
2108 	 * as a result of receiving a control sequence which toggled between the
2109 	 * local and UTF-8 encodings, or at the parent application's request.
2110 	 */
2111 	gulong addOnEncodingChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2112 	{
2113 		auto wrapper = new OnEncodingChangedDelegateWrapper(dlg);
2114 		wrapper.handlerId = Signals.connectData(
2115 			this,
2116 			"encoding-changed",
2117 			cast(GCallback)&callBackEncodingChanged,
2118 			cast(void*)wrapper,
2119 			cast(GClosureNotify)&callBackEncodingChangedDestroy,
2120 			connectFlags);
2121 		return wrapper.handlerId;
2122 	}
2123 	
2124 	extern(C) static void callBackEncodingChanged(VteTerminal* terminalStruct, OnEncodingChangedDelegateWrapper wrapper)
2125 	{
2126 		wrapper.dlg(wrapper.outer);
2127 	}
2128 	
2129 	extern(C) static void callBackEncodingChangedDestroy(OnEncodingChangedDelegateWrapper wrapper, GClosure* closure)
2130 	{
2131 		wrapper.remove(wrapper);
2132 	}
2133 
2134 	protected class OnEofDelegateWrapper
2135 	{
2136 		static OnEofDelegateWrapper[] listeners;
2137 		void delegate(Terminal) dlg;
2138 		gulong handlerId;
2139 		
2140 		this(void delegate(Terminal) dlg)
2141 		{
2142 			this.dlg = dlg;
2143 			this.listeners ~= this;
2144 		}
2145 		
2146 		void remove(OnEofDelegateWrapper source)
2147 		{
2148 			foreach(index, wrapper; listeners)
2149 			{
2150 				if (wrapper.handlerId == source.handlerId)
2151 				{
2152 					listeners[index] = null;
2153 					listeners = std.algorithm.remove(listeners, index);
2154 					break;
2155 				}
2156 			}
2157 		}
2158 	}
2159 
2160 	/**
2161 	 * Emitted when the terminal receives an end-of-file from a child which
2162 	 * is running in the terminal.  This signal is frequently (but not
2163 	 * always) emitted with a #VteTerminal::child-exited signal.
2164 	 */
2165 	gulong addOnEof(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2166 	{
2167 		auto wrapper = new OnEofDelegateWrapper(dlg);
2168 		wrapper.handlerId = Signals.connectData(
2169 			this,
2170 			"eof",
2171 			cast(GCallback)&callBackEof,
2172 			cast(void*)wrapper,
2173 			cast(GClosureNotify)&callBackEofDestroy,
2174 			connectFlags);
2175 		return wrapper.handlerId;
2176 	}
2177 	
2178 	extern(C) static void callBackEof(VteTerminal* terminalStruct, OnEofDelegateWrapper wrapper)
2179 	{
2180 		wrapper.dlg(wrapper.outer);
2181 	}
2182 	
2183 	extern(C) static void callBackEofDestroy(OnEofDelegateWrapper wrapper, GClosure* closure)
2184 	{
2185 		wrapper.remove(wrapper);
2186 	}
2187 
2188 	protected class OnIconTitleChangedDelegateWrapper
2189 	{
2190 		static OnIconTitleChangedDelegateWrapper[] listeners;
2191 		void delegate(Terminal) dlg;
2192 		gulong handlerId;
2193 		
2194 		this(void delegate(Terminal) dlg)
2195 		{
2196 			this.dlg = dlg;
2197 			this.listeners ~= this;
2198 		}
2199 		
2200 		void remove(OnIconTitleChangedDelegateWrapper source)
2201 		{
2202 			foreach(index, wrapper; listeners)
2203 			{
2204 				if (wrapper.handlerId == source.handlerId)
2205 				{
2206 					listeners[index] = null;
2207 					listeners = std.algorithm.remove(listeners, index);
2208 					break;
2209 				}
2210 			}
2211 		}
2212 	}
2213 
2214 	/**
2215 	 * Emitted when the terminal's %icon_title field is modified.
2216 	 */
2217 	gulong addOnIconTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2218 	{
2219 		auto wrapper = new OnIconTitleChangedDelegateWrapper(dlg);
2220 		wrapper.handlerId = Signals.connectData(
2221 			this,
2222 			"icon-title-changed",
2223 			cast(GCallback)&callBackIconTitleChanged,
2224 			cast(void*)wrapper,
2225 			cast(GClosureNotify)&callBackIconTitleChangedDestroy,
2226 			connectFlags);
2227 		return wrapper.handlerId;
2228 	}
2229 	
2230 	extern(C) static void callBackIconTitleChanged(VteTerminal* terminalStruct, OnIconTitleChangedDelegateWrapper wrapper)
2231 	{
2232 		wrapper.dlg(wrapper.outer);
2233 	}
2234 	
2235 	extern(C) static void callBackIconTitleChangedDestroy(OnIconTitleChangedDelegateWrapper wrapper, GClosure* closure)
2236 	{
2237 		wrapper.remove(wrapper);
2238 	}
2239 
2240 	protected class OnIconifyWindowDelegateWrapper
2241 	{
2242 		static OnIconifyWindowDelegateWrapper[] listeners;
2243 		void delegate(Terminal) dlg;
2244 		gulong handlerId;
2245 		
2246 		this(void delegate(Terminal) dlg)
2247 		{
2248 			this.dlg = dlg;
2249 			this.listeners ~= this;
2250 		}
2251 		
2252 		void remove(OnIconifyWindowDelegateWrapper source)
2253 		{
2254 			foreach(index, wrapper; listeners)
2255 			{
2256 				if (wrapper.handlerId == source.handlerId)
2257 				{
2258 					listeners[index] = null;
2259 					listeners = std.algorithm.remove(listeners, index);
2260 					break;
2261 				}
2262 			}
2263 		}
2264 	}
2265 
2266 	/**
2267 	 * Emitted at the child application's request.
2268 	 */
2269 	gulong addOnIconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2270 	{
2271 		auto wrapper = new OnIconifyWindowDelegateWrapper(dlg);
2272 		wrapper.handlerId = Signals.connectData(
2273 			this,
2274 			"iconify-window",
2275 			cast(GCallback)&callBackIconifyWindow,
2276 			cast(void*)wrapper,
2277 			cast(GClosureNotify)&callBackIconifyWindowDestroy,
2278 			connectFlags);
2279 		return wrapper.handlerId;
2280 	}
2281 	
2282 	extern(C) static void callBackIconifyWindow(VteTerminal* terminalStruct, OnIconifyWindowDelegateWrapper wrapper)
2283 	{
2284 		wrapper.dlg(wrapper.outer);
2285 	}
2286 	
2287 	extern(C) static void callBackIconifyWindowDestroy(OnIconifyWindowDelegateWrapper wrapper, GClosure* closure)
2288 	{
2289 		wrapper.remove(wrapper);
2290 	}
2291 
2292 	protected class OnIncreaseFontSizeDelegateWrapper
2293 	{
2294 		static OnIncreaseFontSizeDelegateWrapper[] listeners;
2295 		void delegate(Terminal) dlg;
2296 		gulong handlerId;
2297 		
2298 		this(void delegate(Terminal) dlg)
2299 		{
2300 			this.dlg = dlg;
2301 			this.listeners ~= this;
2302 		}
2303 		
2304 		void remove(OnIncreaseFontSizeDelegateWrapper source)
2305 		{
2306 			foreach(index, wrapper; listeners)
2307 			{
2308 				if (wrapper.handlerId == source.handlerId)
2309 				{
2310 					listeners[index] = null;
2311 					listeners = std.algorithm.remove(listeners, index);
2312 					break;
2313 				}
2314 			}
2315 		}
2316 	}
2317 
2318 	/**
2319 	 * Emitted when the user hits the '+' key while holding the Control key.
2320 	 */
2321 	gulong addOnIncreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2322 	{
2323 		auto wrapper = new OnIncreaseFontSizeDelegateWrapper(dlg);
2324 		wrapper.handlerId = Signals.connectData(
2325 			this,
2326 			"increase-font-size",
2327 			cast(GCallback)&callBackIncreaseFontSize,
2328 			cast(void*)wrapper,
2329 			cast(GClosureNotify)&callBackIncreaseFontSizeDestroy,
2330 			connectFlags);
2331 		return wrapper.handlerId;
2332 	}
2333 	
2334 	extern(C) static void callBackIncreaseFontSize(VteTerminal* terminalStruct, OnIncreaseFontSizeDelegateWrapper wrapper)
2335 	{
2336 		wrapper.dlg(wrapper.outer);
2337 	}
2338 	
2339 	extern(C) static void callBackIncreaseFontSizeDestroy(OnIncreaseFontSizeDelegateWrapper wrapper, GClosure* closure)
2340 	{
2341 		wrapper.remove(wrapper);
2342 	}
2343 
2344 	protected class OnLowerWindowDelegateWrapper
2345 	{
2346 		static OnLowerWindowDelegateWrapper[] listeners;
2347 		void delegate(Terminal) dlg;
2348 		gulong handlerId;
2349 		
2350 		this(void delegate(Terminal) dlg)
2351 		{
2352 			this.dlg = dlg;
2353 			this.listeners ~= this;
2354 		}
2355 		
2356 		void remove(OnLowerWindowDelegateWrapper source)
2357 		{
2358 			foreach(index, wrapper; listeners)
2359 			{
2360 				if (wrapper.handlerId == source.handlerId)
2361 				{
2362 					listeners[index] = null;
2363 					listeners = std.algorithm.remove(listeners, index);
2364 					break;
2365 				}
2366 			}
2367 		}
2368 	}
2369 
2370 	/**
2371 	 * Emitted at the child application's request.
2372 	 */
2373 	gulong addOnLowerWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2374 	{
2375 		auto wrapper = new OnLowerWindowDelegateWrapper(dlg);
2376 		wrapper.handlerId = Signals.connectData(
2377 			this,
2378 			"lower-window",
2379 			cast(GCallback)&callBackLowerWindow,
2380 			cast(void*)wrapper,
2381 			cast(GClosureNotify)&callBackLowerWindowDestroy,
2382 			connectFlags);
2383 		return wrapper.handlerId;
2384 	}
2385 	
2386 	extern(C) static void callBackLowerWindow(VteTerminal* terminalStruct, OnLowerWindowDelegateWrapper wrapper)
2387 	{
2388 		wrapper.dlg(wrapper.outer);
2389 	}
2390 	
2391 	extern(C) static void callBackLowerWindowDestroy(OnLowerWindowDelegateWrapper wrapper, GClosure* closure)
2392 	{
2393 		wrapper.remove(wrapper);
2394 	}
2395 
2396 	protected class OnMaximizeWindowDelegateWrapper
2397 	{
2398 		static OnMaximizeWindowDelegateWrapper[] listeners;
2399 		void delegate(Terminal) dlg;
2400 		gulong handlerId;
2401 		
2402 		this(void delegate(Terminal) dlg)
2403 		{
2404 			this.dlg = dlg;
2405 			this.listeners ~= this;
2406 		}
2407 		
2408 		void remove(OnMaximizeWindowDelegateWrapper source)
2409 		{
2410 			foreach(index, wrapper; listeners)
2411 			{
2412 				if (wrapper.handlerId == source.handlerId)
2413 				{
2414 					listeners[index] = null;
2415 					listeners = std.algorithm.remove(listeners, index);
2416 					break;
2417 				}
2418 			}
2419 		}
2420 	}
2421 
2422 	/**
2423 	 * Emitted at the child application's request.
2424 	 */
2425 	gulong addOnMaximizeWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2426 	{
2427 		auto wrapper = new OnMaximizeWindowDelegateWrapper(dlg);
2428 		wrapper.handlerId = Signals.connectData(
2429 			this,
2430 			"maximize-window",
2431 			cast(GCallback)&callBackMaximizeWindow,
2432 			cast(void*)wrapper,
2433 			cast(GClosureNotify)&callBackMaximizeWindowDestroy,
2434 			connectFlags);
2435 		return wrapper.handlerId;
2436 	}
2437 	
2438 	extern(C) static void callBackMaximizeWindow(VteTerminal* terminalStruct, OnMaximizeWindowDelegateWrapper wrapper)
2439 	{
2440 		wrapper.dlg(wrapper.outer);
2441 	}
2442 	
2443 	extern(C) static void callBackMaximizeWindowDestroy(OnMaximizeWindowDelegateWrapper wrapper, GClosure* closure)
2444 	{
2445 		wrapper.remove(wrapper);
2446 	}
2447 
2448 	protected class OnMoveWindowDelegateWrapper
2449 	{
2450 		static OnMoveWindowDelegateWrapper[] listeners;
2451 		void delegate(uint, uint, Terminal) dlg;
2452 		gulong handlerId;
2453 		
2454 		this(void delegate(uint, uint, Terminal) dlg)
2455 		{
2456 			this.dlg = dlg;
2457 			this.listeners ~= this;
2458 		}
2459 		
2460 		void remove(OnMoveWindowDelegateWrapper source)
2461 		{
2462 			foreach(index, wrapper; listeners)
2463 			{
2464 				if (wrapper.handlerId == source.handlerId)
2465 				{
2466 					listeners[index] = null;
2467 					listeners = std.algorithm.remove(listeners, index);
2468 					break;
2469 				}
2470 			}
2471 		}
2472 	}
2473 
2474 	/**
2475 	 * Emitted at the child application's request.
2476 	 *
2477 	 * Params:
2478 	 *     x = the terminal's desired location, X coordinate
2479 	 *     y = the terminal's desired location, Y coordinate
2480 	 */
2481 	gulong addOnMoveWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2482 	{
2483 		auto wrapper = new OnMoveWindowDelegateWrapper(dlg);
2484 		wrapper.handlerId = Signals.connectData(
2485 			this,
2486 			"move-window",
2487 			cast(GCallback)&callBackMoveWindow,
2488 			cast(void*)wrapper,
2489 			cast(GClosureNotify)&callBackMoveWindowDestroy,
2490 			connectFlags);
2491 		return wrapper.handlerId;
2492 	}
2493 	
2494 	extern(C) static void callBackMoveWindow(VteTerminal* terminalStruct, uint x, uint y, OnMoveWindowDelegateWrapper wrapper)
2495 	{
2496 		wrapper.dlg(x, y, wrapper.outer);
2497 	}
2498 	
2499 	extern(C) static void callBackMoveWindowDestroy(OnMoveWindowDelegateWrapper wrapper, GClosure* closure)
2500 	{
2501 		wrapper.remove(wrapper);
2502 	}
2503 
2504 	protected class OnPasteClipboardDelegateWrapper
2505 	{
2506 		static OnPasteClipboardDelegateWrapper[] listeners;
2507 		void delegate(Terminal) dlg;
2508 		gulong handlerId;
2509 		
2510 		this(void delegate(Terminal) dlg)
2511 		{
2512 			this.dlg = dlg;
2513 			this.listeners ~= this;
2514 		}
2515 		
2516 		void remove(OnPasteClipboardDelegateWrapper source)
2517 		{
2518 			foreach(index, wrapper; listeners)
2519 			{
2520 				if (wrapper.handlerId == source.handlerId)
2521 				{
2522 					listeners[index] = null;
2523 					listeners = std.algorithm.remove(listeners, index);
2524 					break;
2525 				}
2526 			}
2527 		}
2528 	}
2529 
2530 	/**
2531 	 * Emitted whenever vte_terminal_paste_clipboard() is called.
2532 	 */
2533 	gulong addOnPasteClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2534 	{
2535 		auto wrapper = new OnPasteClipboardDelegateWrapper(dlg);
2536 		wrapper.handlerId = Signals.connectData(
2537 			this,
2538 			"paste-clipboard",
2539 			cast(GCallback)&callBackPasteClipboard,
2540 			cast(void*)wrapper,
2541 			cast(GClosureNotify)&callBackPasteClipboardDestroy,
2542 			connectFlags);
2543 		return wrapper.handlerId;
2544 	}
2545 	
2546 	extern(C) static void callBackPasteClipboard(VteTerminal* terminalStruct, OnPasteClipboardDelegateWrapper wrapper)
2547 	{
2548 		wrapper.dlg(wrapper.outer);
2549 	}
2550 	
2551 	extern(C) static void callBackPasteClipboardDestroy(OnPasteClipboardDelegateWrapper wrapper, GClosure* closure)
2552 	{
2553 		wrapper.remove(wrapper);
2554 	}
2555 
2556 	protected class OnRaiseWindowDelegateWrapper
2557 	{
2558 		static OnRaiseWindowDelegateWrapper[] listeners;
2559 		void delegate(Terminal) dlg;
2560 		gulong handlerId;
2561 		
2562 		this(void delegate(Terminal) dlg)
2563 		{
2564 			this.dlg = dlg;
2565 			this.listeners ~= this;
2566 		}
2567 		
2568 		void remove(OnRaiseWindowDelegateWrapper source)
2569 		{
2570 			foreach(index, wrapper; listeners)
2571 			{
2572 				if (wrapper.handlerId == source.handlerId)
2573 				{
2574 					listeners[index] = null;
2575 					listeners = std.algorithm.remove(listeners, index);
2576 					break;
2577 				}
2578 			}
2579 		}
2580 	}
2581 
2582 	/**
2583 	 * Emitted at the child application's request.
2584 	 */
2585 	gulong addOnRaiseWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2586 	{
2587 		auto wrapper = new OnRaiseWindowDelegateWrapper(dlg);
2588 		wrapper.handlerId = Signals.connectData(
2589 			this,
2590 			"raise-window",
2591 			cast(GCallback)&callBackRaiseWindow,
2592 			cast(void*)wrapper,
2593 			cast(GClosureNotify)&callBackRaiseWindowDestroy,
2594 			connectFlags);
2595 		return wrapper.handlerId;
2596 	}
2597 	
2598 	extern(C) static void callBackRaiseWindow(VteTerminal* terminalStruct, OnRaiseWindowDelegateWrapper wrapper)
2599 	{
2600 		wrapper.dlg(wrapper.outer);
2601 	}
2602 	
2603 	extern(C) static void callBackRaiseWindowDestroy(OnRaiseWindowDelegateWrapper wrapper, GClosure* closure)
2604 	{
2605 		wrapper.remove(wrapper);
2606 	}
2607 
2608 	protected class OnRefreshWindowDelegateWrapper
2609 	{
2610 		static OnRefreshWindowDelegateWrapper[] listeners;
2611 		void delegate(Terminal) dlg;
2612 		gulong handlerId;
2613 		
2614 		this(void delegate(Terminal) dlg)
2615 		{
2616 			this.dlg = dlg;
2617 			this.listeners ~= this;
2618 		}
2619 		
2620 		void remove(OnRefreshWindowDelegateWrapper source)
2621 		{
2622 			foreach(index, wrapper; listeners)
2623 			{
2624 				if (wrapper.handlerId == source.handlerId)
2625 				{
2626 					listeners[index] = null;
2627 					listeners = std.algorithm.remove(listeners, index);
2628 					break;
2629 				}
2630 			}
2631 		}
2632 	}
2633 
2634 	/**
2635 	 * Emitted at the child application's request.
2636 	 */
2637 	gulong addOnRefreshWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2638 	{
2639 		auto wrapper = new OnRefreshWindowDelegateWrapper(dlg);
2640 		wrapper.handlerId = Signals.connectData(
2641 			this,
2642 			"refresh-window",
2643 			cast(GCallback)&callBackRefreshWindow,
2644 			cast(void*)wrapper,
2645 			cast(GClosureNotify)&callBackRefreshWindowDestroy,
2646 			connectFlags);
2647 		return wrapper.handlerId;
2648 	}
2649 	
2650 	extern(C) static void callBackRefreshWindow(VteTerminal* terminalStruct, OnRefreshWindowDelegateWrapper wrapper)
2651 	{
2652 		wrapper.dlg(wrapper.outer);
2653 	}
2654 	
2655 	extern(C) static void callBackRefreshWindowDestroy(OnRefreshWindowDelegateWrapper wrapper, GClosure* closure)
2656 	{
2657 		wrapper.remove(wrapper);
2658 	}
2659 
2660 	protected class OnResizeWindowDelegateWrapper
2661 	{
2662 		static OnResizeWindowDelegateWrapper[] listeners;
2663 		void delegate(uint, uint, Terminal) dlg;
2664 		gulong handlerId;
2665 		
2666 		this(void delegate(uint, uint, Terminal) dlg)
2667 		{
2668 			this.dlg = dlg;
2669 			this.listeners ~= this;
2670 		}
2671 		
2672 		void remove(OnResizeWindowDelegateWrapper source)
2673 		{
2674 			foreach(index, wrapper; listeners)
2675 			{
2676 				if (wrapper.handlerId == source.handlerId)
2677 				{
2678 					listeners[index] = null;
2679 					listeners = std.algorithm.remove(listeners, index);
2680 					break;
2681 				}
2682 			}
2683 		}
2684 	}
2685 
2686 	/**
2687 	 * Emitted at the child application's request.
2688 	 *
2689 	 * Params:
2690 	 *     width = the desired number of columns
2691 	 *     height = the desired number of rows
2692 	 */
2693 	gulong addOnResizeWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2694 	{
2695 		auto wrapper = new OnResizeWindowDelegateWrapper(dlg);
2696 		wrapper.handlerId = Signals.connectData(
2697 			this,
2698 			"resize-window",
2699 			cast(GCallback)&callBackResizeWindow,
2700 			cast(void*)wrapper,
2701 			cast(GClosureNotify)&callBackResizeWindowDestroy,
2702 			connectFlags);
2703 		return wrapper.handlerId;
2704 	}
2705 	
2706 	extern(C) static void callBackResizeWindow(VteTerminal* terminalStruct, uint width, uint height, OnResizeWindowDelegateWrapper wrapper)
2707 	{
2708 		wrapper.dlg(width, height, wrapper.outer);
2709 	}
2710 	
2711 	extern(C) static void callBackResizeWindowDestroy(OnResizeWindowDelegateWrapper wrapper, GClosure* closure)
2712 	{
2713 		wrapper.remove(wrapper);
2714 	}
2715 
2716 	protected class OnRestoreWindowDelegateWrapper
2717 	{
2718 		static OnRestoreWindowDelegateWrapper[] listeners;
2719 		void delegate(Terminal) dlg;
2720 		gulong handlerId;
2721 		
2722 		this(void delegate(Terminal) dlg)
2723 		{
2724 			this.dlg = dlg;
2725 			this.listeners ~= this;
2726 		}
2727 		
2728 		void remove(OnRestoreWindowDelegateWrapper source)
2729 		{
2730 			foreach(index, wrapper; listeners)
2731 			{
2732 				if (wrapper.handlerId == source.handlerId)
2733 				{
2734 					listeners[index] = null;
2735 					listeners = std.algorithm.remove(listeners, index);
2736 					break;
2737 				}
2738 			}
2739 		}
2740 	}
2741 
2742 	/**
2743 	 * Emitted at the child application's request.
2744 	 */
2745 	gulong addOnRestoreWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2746 	{
2747 		auto wrapper = new OnRestoreWindowDelegateWrapper(dlg);
2748 		wrapper.handlerId = Signals.connectData(
2749 			this,
2750 			"restore-window",
2751 			cast(GCallback)&callBackRestoreWindow,
2752 			cast(void*)wrapper,
2753 			cast(GClosureNotify)&callBackRestoreWindowDestroy,
2754 			connectFlags);
2755 		return wrapper.handlerId;
2756 	}
2757 	
2758 	extern(C) static void callBackRestoreWindow(VteTerminal* terminalStruct, OnRestoreWindowDelegateWrapper wrapper)
2759 	{
2760 		wrapper.dlg(wrapper.outer);
2761 	}
2762 	
2763 	extern(C) static void callBackRestoreWindowDestroy(OnRestoreWindowDelegateWrapper wrapper, GClosure* closure)
2764 	{
2765 		wrapper.remove(wrapper);
2766 	}
2767 
2768 	protected class OnSelectionChangedDelegateWrapper
2769 	{
2770 		static OnSelectionChangedDelegateWrapper[] listeners;
2771 		void delegate(Terminal) dlg;
2772 		gulong handlerId;
2773 		
2774 		this(void delegate(Terminal) dlg)
2775 		{
2776 			this.dlg = dlg;
2777 			this.listeners ~= this;
2778 		}
2779 		
2780 		void remove(OnSelectionChangedDelegateWrapper source)
2781 		{
2782 			foreach(index, wrapper; listeners)
2783 			{
2784 				if (wrapper.handlerId == source.handlerId)
2785 				{
2786 					listeners[index] = null;
2787 					listeners = std.algorithm.remove(listeners, index);
2788 					break;
2789 				}
2790 			}
2791 		}
2792 	}
2793 
2794 	/**
2795 	 * Emitted whenever the contents of terminal's selection changes.
2796 	 */
2797 	gulong addOnSelectionChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2798 	{
2799 		auto wrapper = new OnSelectionChangedDelegateWrapper(dlg);
2800 		wrapper.handlerId = Signals.connectData(
2801 			this,
2802 			"selection-changed",
2803 			cast(GCallback)&callBackSelectionChanged,
2804 			cast(void*)wrapper,
2805 			cast(GClosureNotify)&callBackSelectionChangedDestroy,
2806 			connectFlags);
2807 		return wrapper.handlerId;
2808 	}
2809 	
2810 	extern(C) static void callBackSelectionChanged(VteTerminal* terminalStruct, OnSelectionChangedDelegateWrapper wrapper)
2811 	{
2812 		wrapper.dlg(wrapper.outer);
2813 	}
2814 	
2815 	extern(C) static void callBackSelectionChangedDestroy(OnSelectionChangedDelegateWrapper wrapper, GClosure* closure)
2816 	{
2817 		wrapper.remove(wrapper);
2818 	}
2819 
2820 	protected class OnTextDeletedDelegateWrapper
2821 	{
2822 		static OnTextDeletedDelegateWrapper[] listeners;
2823 		void delegate(Terminal) dlg;
2824 		gulong handlerId;
2825 		
2826 		this(void delegate(Terminal) dlg)
2827 		{
2828 			this.dlg = dlg;
2829 			this.listeners ~= this;
2830 		}
2831 		
2832 		void remove(OnTextDeletedDelegateWrapper source)
2833 		{
2834 			foreach(index, wrapper; listeners)
2835 			{
2836 				if (wrapper.handlerId == source.handlerId)
2837 				{
2838 					listeners[index] = null;
2839 					listeners = std.algorithm.remove(listeners, index);
2840 					break;
2841 				}
2842 			}
2843 		}
2844 	}
2845 
2846 	/**
2847 	 * An internal signal used for communication between the terminal and
2848 	 * its accessibility peer. May not be emitted under certain
2849 	 * circumstances.
2850 	 */
2851 	gulong addOnTextDeleted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2852 	{
2853 		auto wrapper = new OnTextDeletedDelegateWrapper(dlg);
2854 		wrapper.handlerId = Signals.connectData(
2855 			this,
2856 			"text-deleted",
2857 			cast(GCallback)&callBackTextDeleted,
2858 			cast(void*)wrapper,
2859 			cast(GClosureNotify)&callBackTextDeletedDestroy,
2860 			connectFlags);
2861 		return wrapper.handlerId;
2862 	}
2863 	
2864 	extern(C) static void callBackTextDeleted(VteTerminal* terminalStruct, OnTextDeletedDelegateWrapper wrapper)
2865 	{
2866 		wrapper.dlg(wrapper.outer);
2867 	}
2868 	
2869 	extern(C) static void callBackTextDeletedDestroy(OnTextDeletedDelegateWrapper wrapper, GClosure* closure)
2870 	{
2871 		wrapper.remove(wrapper);
2872 	}
2873 
2874 	protected class OnTextInsertedDelegateWrapper
2875 	{
2876 		static OnTextInsertedDelegateWrapper[] listeners;
2877 		void delegate(Terminal) dlg;
2878 		gulong handlerId;
2879 		
2880 		this(void delegate(Terminal) dlg)
2881 		{
2882 			this.dlg = dlg;
2883 			this.listeners ~= this;
2884 		}
2885 		
2886 		void remove(OnTextInsertedDelegateWrapper source)
2887 		{
2888 			foreach(index, wrapper; listeners)
2889 			{
2890 				if (wrapper.handlerId == source.handlerId)
2891 				{
2892 					listeners[index] = null;
2893 					listeners = std.algorithm.remove(listeners, index);
2894 					break;
2895 				}
2896 			}
2897 		}
2898 	}
2899 
2900 	/**
2901 	 * An internal signal used for communication between the terminal and
2902 	 * its accessibility peer. May not be emitted under certain
2903 	 * circumstances.
2904 	 */
2905 	gulong addOnTextInserted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2906 	{
2907 		auto wrapper = new OnTextInsertedDelegateWrapper(dlg);
2908 		wrapper.handlerId = Signals.connectData(
2909 			this,
2910 			"text-inserted",
2911 			cast(GCallback)&callBackTextInserted,
2912 			cast(void*)wrapper,
2913 			cast(GClosureNotify)&callBackTextInsertedDestroy,
2914 			connectFlags);
2915 		return wrapper.handlerId;
2916 	}
2917 	
2918 	extern(C) static void callBackTextInserted(VteTerminal* terminalStruct, OnTextInsertedDelegateWrapper wrapper)
2919 	{
2920 		wrapper.dlg(wrapper.outer);
2921 	}
2922 	
2923 	extern(C) static void callBackTextInsertedDestroy(OnTextInsertedDelegateWrapper wrapper, GClosure* closure)
2924 	{
2925 		wrapper.remove(wrapper);
2926 	}
2927 
2928 	protected class OnTextModifiedDelegateWrapper
2929 	{
2930 		static OnTextModifiedDelegateWrapper[] listeners;
2931 		void delegate(Terminal) dlg;
2932 		gulong handlerId;
2933 		
2934 		this(void delegate(Terminal) dlg)
2935 		{
2936 			this.dlg = dlg;
2937 			this.listeners ~= this;
2938 		}
2939 		
2940 		void remove(OnTextModifiedDelegateWrapper source)
2941 		{
2942 			foreach(index, wrapper; listeners)
2943 			{
2944 				if (wrapper.handlerId == source.handlerId)
2945 				{
2946 					listeners[index] = null;
2947 					listeners = std.algorithm.remove(listeners, index);
2948 					break;
2949 				}
2950 			}
2951 		}
2952 	}
2953 
2954 	/**
2955 	 * An internal signal used for communication between the terminal and
2956 	 * its accessibility peer. May not be emitted under certain
2957 	 * circumstances.
2958 	 */
2959 	gulong addOnTextModified(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
2960 	{
2961 		auto wrapper = new OnTextModifiedDelegateWrapper(dlg);
2962 		wrapper.handlerId = Signals.connectData(
2963 			this,
2964 			"text-modified",
2965 			cast(GCallback)&callBackTextModified,
2966 			cast(void*)wrapper,
2967 			cast(GClosureNotify)&callBackTextModifiedDestroy,
2968 			connectFlags);
2969 		return wrapper.handlerId;
2970 	}
2971 	
2972 	extern(C) static void callBackTextModified(VteTerminal* terminalStruct, OnTextModifiedDelegateWrapper wrapper)
2973 	{
2974 		wrapper.dlg(wrapper.outer);
2975 	}
2976 	
2977 	extern(C) static void callBackTextModifiedDestroy(OnTextModifiedDelegateWrapper wrapper, GClosure* closure)
2978 	{
2979 		wrapper.remove(wrapper);
2980 	}
2981 
2982 	protected class OnTextScrolledDelegateWrapper
2983 	{
2984 		static OnTextScrolledDelegateWrapper[] listeners;
2985 		void delegate(int, Terminal) dlg;
2986 		gulong handlerId;
2987 		
2988 		this(void delegate(int, Terminal) dlg)
2989 		{
2990 			this.dlg = dlg;
2991 			this.listeners ~= this;
2992 		}
2993 		
2994 		void remove(OnTextScrolledDelegateWrapper source)
2995 		{
2996 			foreach(index, wrapper; listeners)
2997 			{
2998 				if (wrapper.handlerId == source.handlerId)
2999 				{
3000 					listeners[index] = null;
3001 					listeners = std.algorithm.remove(listeners, index);
3002 					break;
3003 				}
3004 			}
3005 		}
3006 	}
3007 
3008 	/**
3009 	 * An internal signal used for communication between the terminal and
3010 	 * its accessibility peer. May not be emitted under certain
3011 	 * circumstances.
3012 	 *
3013 	 * Params:
3014 	 *     delta = the number of lines scrolled
3015 	 */
3016 	gulong addOnTextScrolled(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
3017 	{
3018 		auto wrapper = new OnTextScrolledDelegateWrapper(dlg);
3019 		wrapper.handlerId = Signals.connectData(
3020 			this,
3021 			"text-scrolled",
3022 			cast(GCallback)&callBackTextScrolled,
3023 			cast(void*)wrapper,
3024 			cast(GClosureNotify)&callBackTextScrolledDestroy,
3025 			connectFlags);
3026 		return wrapper.handlerId;
3027 	}
3028 	
3029 	extern(C) static void callBackTextScrolled(VteTerminal* terminalStruct, int delta, OnTextScrolledDelegateWrapper wrapper)
3030 	{
3031 		wrapper.dlg(delta, wrapper.outer);
3032 	}
3033 	
3034 	extern(C) static void callBackTextScrolledDestroy(OnTextScrolledDelegateWrapper wrapper, GClosure* closure)
3035 	{
3036 		wrapper.remove(wrapper);
3037 	}
3038 
3039 	protected class OnWindowTitleChangedDelegateWrapper
3040 	{
3041 		static OnWindowTitleChangedDelegateWrapper[] listeners;
3042 		void delegate(Terminal) dlg;
3043 		gulong handlerId;
3044 		
3045 		this(void delegate(Terminal) dlg)
3046 		{
3047 			this.dlg = dlg;
3048 			this.listeners ~= this;
3049 		}
3050 		
3051 		void remove(OnWindowTitleChangedDelegateWrapper source)
3052 		{
3053 			foreach(index, wrapper; listeners)
3054 			{
3055 				if (wrapper.handlerId == source.handlerId)
3056 				{
3057 					listeners[index] = null;
3058 					listeners = std.algorithm.remove(listeners, index);
3059 					break;
3060 				}
3061 			}
3062 		}
3063 	}
3064 
3065 	/**
3066 	 * Emitted when the terminal's %window_title field is modified.
3067 	 */
3068 	gulong addOnWindowTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
3069 	{
3070 		auto wrapper = new OnWindowTitleChangedDelegateWrapper(dlg);
3071 		wrapper.handlerId = Signals.connectData(
3072 			this,
3073 			"window-title-changed",
3074 			cast(GCallback)&callBackWindowTitleChanged,
3075 			cast(void*)wrapper,
3076 			cast(GClosureNotify)&callBackWindowTitleChangedDestroy,
3077 			connectFlags);
3078 		return wrapper.handlerId;
3079 	}
3080 	
3081 	extern(C) static void callBackWindowTitleChanged(VteTerminal* terminalStruct, OnWindowTitleChangedDelegateWrapper wrapper)
3082 	{
3083 		wrapper.dlg(wrapper.outer);
3084 	}
3085 	
3086 	extern(C) static void callBackWindowTitleChangedDestroy(OnWindowTitleChangedDelegateWrapper wrapper, GClosure* closure)
3087 	{
3088 		wrapper.remove(wrapper);
3089 	}
3090 
3091 	/**
3092 	 * Gets the user's shell, or %NULL. In the latter case, the
3093 	 * system default (usually "/bin/sh") should be used.
3094 	 *
3095 	 * Returns: a newly allocated string with the
3096 	 *     user's shell, or %NULL
3097 	 */
3098 	public static string getUserShell()
3099 	{
3100 		auto retStr = vte_get_user_shell();
3101 		
3102 		scope(exit) Str.freeString(retStr);
3103 		return Str.toString(retStr);
3104 	}
3105 }