Skip to content

Commit

Permalink
Update to work with vte 2.91 as well as 2.90
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain Lane committed Nov 10, 2014
1 parent df57591 commit 9ec1aea
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
10 changes: 8 additions & 2 deletions cmake/FindVTE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ if(NOT _VTE_VERSION_NUM)
set(_VTE_LIB_NAME vte)
set(_VTE_VERSION vte)
else()
set(_VTE_LIB_NAME vte${_VTE_VERSION_NUM})
if(${_VTE_VERSION_NUM} VERSION_LESS 2.91)
set(_VTE_LIB_NAME vte${_VTE_VERSION_NUM})
else()
set(_VTE_LIB_NAME vte-${_VTE_VERSION_NUM})
endif()
set(_VTE_VERSION vte-${_VTE_VERSION_NUM})
endif()

string(REPLACE . _ _VTE_LIB_NAME ${_VTE_LIB_NAME})
if(${_VTE_VERSION_NUM} VERSION_LESS 2.91)
string(REPLACE . _ _VTE_LIB_NAME ${_VTE_LIB_NAME})
endif()

pkg_check_modules(PC_VTE ${_VTE_VERSION})

Expand Down
25 changes: 17 additions & 8 deletions remmina/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,26 @@ if(AVAHI_FOUND)
target_link_libraries(remmina ${AVAHI_LIBRARIES})
endif()

if(GTK3_FOUND)
set(_VTE_VERSION_NUM 2.90)
else()
option(WITH_VTE "Build with support for VTE" ON)
if(GTK3_FOUND AND WITH_VTE)
set(_VTE_VERSION_NUMS 2.91 2.90)
foreach(__VTE_VERSION ${_VTE_VERSION_NUMS})
set(_VTE_VERSION_NUM ${__VTE_VERSION})
find_package(VTE)
if(VTE_FOUND)
break()
endif()
message(STATUS "VTE ${__VTE_VERSION} not found")
endforeach(__VTE_VERSION)
elseif(WITH_VTE)
set(_VTE_VERSION_NUM)
find_package(VTE)
endif()

find_suggested_package(VTE _VTE_VERSION_NUM)
if(VTE_FOUND)
add_definitions(-DHAVE_LIBVTE)
include_directories(${VTE_INCLUDE_DIRS})
target_link_libraries(remmina ${VTE_LIBRARIES})
if (VTE_FOUND)
add_definitions(-DHAVE_LIBVTE)
include_directories(${VTE_INCLUDE_DIRS})
target_link_libraries(remmina ${VTE_LIBRARIES})
endif()

if(GTK3_FOUND)
Expand Down
22 changes: 22 additions & 0 deletions remmina/src/remmina_ssh_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,18 @@ remmina_plugin_ssh_main_thread (gpointer data)
THREADS_ENTER
if (charset && charset[0] != '\0')
{
#if !VTE_CHECK_VERSION(0,38,0)
vte_terminal_set_encoding (VTE_TERMINAL (gpdata->vte), charset);
#else
vte_terminal_set_encoding (VTE_TERMINAL (gpdata->vte), charset, NULL);
#endif
}
#if !VTE_CHECK_VERSION(0,38,0)
vte_terminal_set_pty (VTE_TERMINAL (gpdata->vte), shell->slave);
#else
vte_terminal_set_pty (VTE_TERMINAL (gpdata->vte),
vte_pty_new_foreign_sync (shell->slave, NULL, NULL));
#endif
THREADS_LEAVE

remmina_plugin_service->protocol_plugin_emit_signal (gp, "connect");
Expand Down Expand Up @@ -183,7 +192,12 @@ remmina_plugin_ssh_set_vte_pref (RemminaProtocolWidget *gp)
gpdata = (RemminaPluginSshData*) g_object_get_data (G_OBJECT(gp), "plugin-data");
if (remmina_pref.vte_font && remmina_pref.vte_font[0])
{
#if !VTE_CHECK_VERSION(0,38,0)
vte_terminal_set_font_from_string (VTE_TERMINAL (gpdata->vte), remmina_pref.vte_font);
#else
vte_terminal_set_font (VTE_TERMINAL (gpdata->vte),
pango_font_description_from_string (remmina_pref.vte_font));
#endif
}
vte_terminal_set_allow_bold (VTE_TERMINAL (gpdata->vte), remmina_pref.vte_allow_bold_text);
if (remmina_pref.vte_lines > 0)
Expand Down Expand Up @@ -224,9 +238,17 @@ remmina_plugin_ssh_init (RemminaProtocolWidget *gp)
remmina_plugin_service->protocol_plugin_register_hostkey (gp, vte);

#if GTK_VERSION == 3
#if VTE_CHECK_VERSION(0, 38, 0)
vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (vte)));
#else
vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vte_terminal_get_adjustment (VTE_TERMINAL (vte)));
#endif
#elif GTK_VERSION == 2
#if VTE_CHECK_VERSION(0, 38, 0)
vscrollbar = gtk_vscrollbar_new (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE_TERMINAL (vte)));
#else
vscrollbar = gtk_vscrollbar_new (vte_terminal_get_adjustment (VTE_TERMINAL (vte)));
#endif
#endif
gtk_widget_show(vscrollbar);
gtk_box_pack_start (GTK_BOX (hbox), vscrollbar, FALSE, TRUE, 0);
Expand Down

0 comments on commit 9ec1aea

Please sign in to comment.