1 /*
2  * Copyright 2017 LarsGit223
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 /* Compatibility macros to support different VTE versions */
20 
21 #ifndef GP_VTECOMPAT_H
22 #define GP_VTECOMPAT_H
23 
24 G_BEGIN_DECLS
25 
26 /* Replace call to vte_terminal_copy_clipboard() with a call to
27    vte_terminal_copy_clipboard_format starting from version 0.50 */
28 #if VTE_CHECK_VERSION(0, 50, 0)
29 #define vte_terminal_copy_clipboard(terminal) \
30         vte_terminal_copy_clipboard_format(terminal, VTE_FORMAT_TEXT)
31 #endif
32 
33 /* Version info for VTE is incomplete so we use all the macros below
34    simply if GTK3 is used. */
35 #if GTK_CHECK_VERSION(3, 0, 0)
36 /* Remove vte_terminal_set_emulation() starting from 0.26.2 version */
37 #define vte_terminal_set_emulation(vte, emulation)
38 
39 /* Replace call to vte_terminal_set_font_from_string() with a call to
40    gp_vtecompat_set_font_from_string() starting from version 0.26.2 */
41 #define vte_terminal_set_font_from_string(vte, font) \
42         gp_vtecompat_set_font_from_string(vte, font)
43 
44 /* Replace call to vte_pty_new_foreign() with a call to
45    vte_pty_new_foreign_sync() starting from version 0.26.2 */
46 #define vte_pty_new_foreign(pty, error) \
47         vte_pty_new_foreign_sync(pty, NULL, error)
48 
49 /* Replace call to vte_terminal_set_pty_object() with a call to
50    vte_terminal_set_pty() starting from version 0.26.2 */
51 #define vte_terminal_set_pty_object(terminal, pty) \
52         vte_terminal_set_pty(terminal, pty)
53 
54 void gp_vtecompat_set_font_from_string(VteTerminal *vte, char *font);
55 #endif
56 
57 G_END_DECLS
58 
59 #endif /* GP_VTECOMPAT_H */
60 
61