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