From 7282d3b80c3fada887b68c1251690f73a6a9736e Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 24 Aug 2018 17:26:08 +0200 Subject: Added Socket Terminal plugin --- CMakeLists.txt | 51 ++++++ scalable/emblems/remmina-tool-symbolic.svg | 85 ++++++++++ st_plugin.c | 242 +++++++++++++++++++++++++++++ st_plugin_config.h | 46 ++++++ 4 files changed, 424 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 scalable/emblems/remmina-tool-symbolic.svg create mode 100644 st_plugin.c create mode 100644 st_plugin_config.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5d6e238 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,51 @@ +# remmina-plugin-tool_hello_world - The GTK+ Remote Desktop Client +# +# Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo +# Copyright (C) 2016-2018 Antenore Gatta, Giovanni Panozzo +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# In addition, as a special exception, the copyright holders give +# permission to link the code of portions of this program with the +# OpenSSL library under certain conditions as described in each +# individual source file, and distribute linked combinations +# including the two. +# You must obey the GNU General Public License in all respects +# for all of the code used other than OpenSSL. If you modify +# file(s) with this exception, you may extend this exception to your +# version of the file(s), but you are not obligated to do so. If you +# do not wish to do so, delete this exception statement from your +# version. If you delete this exception statement from all source +# files in the program, then also delete it here. + + +set(REMMINA_PLUGIN_ST_SRCS + st_plugin_config.h + st_plugin.c +) + +add_library(remmina-plugin-st MODULE ${REMMINA_PLUGIN_ST_SRCS}) +set_target_properties(remmina-plugin-st PROPERTIES PREFIX "") +set_target_properties(remmina-plugin-st PROPERTIES NO_SONAME 1) + +include_directories(${REMMINA_COMMON_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS}) +target_link_libraries(remmina-plugin-st ${REMMINA_COMMON_LIBRARIES}) + +install(TARGETS remmina-plugin-st DESTINATION ${REMMINA_PLUGINDIR}) + +install(FILES + scalable/emblems/remmina-tool-symbolic.svg + DESTINATION ${APPICONSCALE_EMBLEMS_DIR}) diff --git a/scalable/emblems/remmina-tool-symbolic.svg b/scalable/emblems/remmina-tool-symbolic.svg new file mode 100644 index 0000000..e5225de --- /dev/null +++ b/scalable/emblems/remmina-tool-symbolic.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/st_plugin.c b/st_plugin.c new file mode 100644 index 0000000..d2578cc --- /dev/null +++ b/st_plugin.c @@ -0,0 +1,242 @@ +/* + * Remmina - The GTK+ Remote Desktop Client + * Copyright (C) 2017-2018 Antenore Gatta, Giovanni Panozzo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * You must obey the GNU General Public License in all respects + * for all of the code used other than OpenSSL. * If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. * If you + * do not wish to do so, delete this exception statement from your + * version. * If you delete this exception statement from all source + * files in the program, then also delete it here. + * + */ + +#include "st_plugin_config.h" + +#include "common/remmina_plugin.h" + +#include +#include +#include +#include +#include +#include +#include + +typedef struct _RemminaPluginData +{ + GtkWidget *socket; + gint socket_id; + GPid pid; +} RemminaPluginData; + +static RemminaPluginService *remmina_plugin_service = NULL; + +static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWidget *gp) +{ + TRACE_CALL(__func__); + RemminaPluginData *gpdata; + gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); + remmina_plugin_service->log_printf("[%s] Plugin plug added on socket %d\n", PLUGIN_NAME, gpdata->socket_id); + remmina_plugin_service->protocol_plugin_emit_signal(gp, "connect"); + return; +} + +static void remmina_plugin_st_on_plug_removed(GtkSocket *socket, RemminaProtocolWidget *gp) +{ + TRACE_CALL(__func__); + remmina_plugin_service->log_printf("[%s] Plugin plug removed\n", PLUGIN_NAME); + remmina_plugin_service->protocol_plugin_close_connection(gp); +} + +static void remmina_plugin_st_init(RemminaProtocolWidget *gp) +{ + TRACE_CALL(__func__); + remmina_plugin_service->log_printf("[%s] Plugin init\n", PLUGIN_NAME); + RemminaPluginData *gpdata; + + gpdata = g_new0(RemminaPluginData, 1); + g_object_set_data_full(G_OBJECT(gp), "plugin-data", gpdata, g_free); + + gpdata->socket = gtk_socket_new(); + remmina_plugin_service->protocol_plugin_register_hostkey(gp, gpdata->socket); + gtk_widget_show(gpdata->socket); + g_signal_connect(G_OBJECT(gpdata->socket), "plug-added", G_CALLBACK(remmina_plugin_st_on_plug_added), gp); + g_signal_connect(G_OBJECT(gpdata->socket), "plug-removed", G_CALLBACK(remmina_plugin_st_on_plug_removed), gp); + gtk_container_add(GTK_CONTAINER(gp), gpdata->socket); +} + +static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) +{ + TRACE_CALL(__func__); + remmina_plugin_service->log_printf("[%s] Plugin open connection\n", PLUGIN_NAME); +#define ADD_ARGUMENT(name, value) \ + { \ + argv[argc] = g_strdup(name); \ + argv_debug[argc] = g_strdup(name); \ + argc++; \ + if (value != NULL) \ + { \ + argv[argc] = value; \ + argv_debug[argc++] = g_strdup(g_strcmp0(name, "-p") != 0 ? value : "XXXXX"); \ + } \ + } + RemminaPluginData *gpdata; + RemminaFile *remminafile; + gboolean ret; + GError *error = NULL; + gchar *argv[50]; // Contains all the arguments included the password + gchar *argv_debug[50]; // Contains all the arguments, excluding the password + gchar *command_line; // The whole command line obtained from argv_debug + gint argc; + gint i; + + gchar *option_str; + gint option_int; + + gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); + remminafile = remmina_plugin_service->protocol_plugin_get_file(gp); + + if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { + remmina_plugin_service->protocol_plugin_set_width(gp, 640); + remmina_plugin_service->protocol_plugin_set_height(gp, 480); + gtk_widget_set_size_request(GTK_WIDGET(gp), 640, 480); + gpdata->socket_id = gtk_socket_get_id(GTK_SOCKET(gpdata->socket)); + } + + argc = 0; + // Main executable name + ADD_ARGUMENT(g_strdup_printf("%s", remmina_plugin_service->file_get_string(remminafile, "terminal")), NULL); + // Embed st-window in another window + if (gpdata->socket_id != 0) + ADD_ARGUMENT("-w", g_strdup_printf("%i", gpdata->socket_id)); + // End of the arguments list + ADD_ARGUMENT(NULL, NULL); + // Retrieve the whole command line + command_line = g_strjoinv(g_strdup(" "), (gchar **)&argv_debug[0]); + remmina_plugin_service->log_printf("[st] starting %s\n", command_line); + g_free(command_line); + // Execute the external process st + ret = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, &gpdata->pid, &error); + remmina_plugin_service->log_printf( + "[st] started st with GPid %d\n", &gpdata->pid); + // Free the arguments list + for (i = 0; i < argc; i++) + { + g_free(argv_debug[i]); + g_free(argv[i]); + } + // Show error message + if (!ret) + remmina_plugin_service->protocol_plugin_set_error(gp, "%s", error->message); + // Show attached window socket ID + if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { + remmina_plugin_service->log_printf("[st] attached window to socket %d\n", + gpdata->socket_id); + return TRUE; + } + else + { + return FALSE; + } +} + +static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) +{ + TRACE_CALL(__func__); + remmina_plugin_service->log_printf("[%s] Plugin close connection\n", PLUGIN_NAME); + remmina_plugin_service->protocol_plugin_emit_signal(gp, "disconnect"); + return FALSE; +} + +/* Array of RemminaProtocolSetting for basic settings. + * Each item is composed by: + * a) RemminaProtocolSettingType for setting type + * b) Setting name + * c) Setting description + * d) Compact disposition + * e) Values for REMMINA_PROTOCOL_SETTING_TYPE_SELECT or REMMINA_PROTOCOL_SETTING_TYPE_COMBO + * f) Unused pointer + */ +static const RemminaProtocolSetting remmina_plugin_st_basic_settings[] = +{ + { REMMINA_PROTOCOL_SETTING_TYPE_COMBO, "terminal", N_("Terminal Emulator"), FALSE, + "st,xterm", NULL }, + { REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL } +}; + +/* Array of RemminaProtocolSetting for advanced settings. + * Each item is composed by: + * a) RemminaProtocolSettingType for setting type + * b) Setting name + * c) Setting description + * d) Compact disposition + * e) Values for REMMINA_PROTOCOL_SETTING_TYPE_SELECT or REMMINA_PROTOCOL_SETTING_TYPE_COMBO + * f) Unused pointer + */ +static const RemminaProtocolSetting remmina_plugin_st_advanced_settings[] = +{ + { REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "detached", N_("Detached window"), TRUE, NULL, NULL }, + { REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL } +}; + +/* Protocol plugin definition and features */ +static RemminaProtocolPlugin remmina_plugin = +{ + REMMINA_PLUGIN_TYPE_PROTOCOL, // Type + PLUGIN_NAME, // Name + PLUGIN_DESCRIPTION, // Description + GETTEXT_PACKAGE, // Translation domain + PLUGIN_VERSION, // Version number + PLUGIN_APPICON, // Icon for normal connection + PLUGIN_APPICON, // Icon for SSH connection + remmina_plugin_st_basic_settings, // Array for basic settings + remmina_plugin_st_advanced_settings, // Array for advanced settings + REMMINA_PROTOCOL_SSH_SETTING_NONE, // SSH settings type + NULL, // Array for available features + remmina_plugin_st_init, // Plugin initialization + remmina_plugin_st_open_connection, // Plugin open connection + remmina_plugin_st_close_connection, // Plugin close connection + NULL, // Query for available features + NULL, // Call a feature + NULL, // Send a keystroke + NULL // Capture screenshot +}; + +G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService *service) +{ + TRACE_CALL(__func__); + remmina_plugin_service = service; + + bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + + + if (!service->register_plugin((RemminaPlugin *) &remmina_plugin)) + { + return FALSE; + } + return TRUE; +} diff --git a/st_plugin_config.h b/st_plugin_config.h new file mode 100644 index 0000000..ec626fc --- /dev/null +++ b/st_plugin_config.h @@ -0,0 +1,46 @@ +/* + * Remmina - The GTK+ Remote Desktop Client + * Copyright (C) 2017-2018 Antenore Gatta + * + * Initially based on the plugin "Remmina Plugin EXEC", created and written by + * Fabio Castelli (Muflone) . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * You must obey the GNU General Public License in all respects + * for all of the code used other than OpenSSL. * If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. * If you + * do not wish to do so, delete this exception statement from your + * version. * If you delete this exception statement from all source + * files in the program, then also delete it here. + * + */ + +#pragma once +#ifndef __PLUGIN_CONFIG_H + #define __PLUGIN_CONFIG_H + + #define PLUGIN_NAME "ST" + #define PLUGIN_DESCRIPTION "ST - Socket terminal" + #define PLUGIN_VERSION "1.0.0.0" + #define PLUGIN_APPICON "remmina-tool-symbolic" +#endif -- cgit v1.2.3 From d29a53719fec200e41cebbdac0e49e171972c79f Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sat, 25 Aug 2018 00:05:38 +0200 Subject: Releasing Remmina Simple Terminal - #1459 --- st_plugin.c | 56 ++++++++++++++++++++++++++++++++++++------------------ st_plugin_config.h | 2 +- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index d2578cc..4b85a43 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -104,17 +104,16 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) } RemminaPluginData *gpdata; RemminaFile *remminafile; - gboolean ret; GError *error = NULL; - gchar *argv[50]; // Contains all the arguments included the password - gchar *argv_debug[50]; // Contains all the arguments, excluding the password + gchar *argv[50]; // Contains all the arguments + gchar *argv_debug[50]; // Contains all the arguments gchar *command_line; // The whole command line obtained from argv_debug + const gchar *term; + const gchar *wflag; + const gchar *command; // The command to be passed to the terminal (if any) gint argc; gint i; - gchar *option_str; - gint option_int; - gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); remminafile = remmina_plugin_service->protocol_plugin_get_file(gp); @@ -125,23 +124,34 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) gpdata->socket_id = gtk_socket_get_id(GTK_SOCKET(gpdata->socket)); } + term = remmina_plugin_service->file_get_string(remminafile, "terminal"); + if (g_strcmp0(term, "st") == 0) { + wflag = "-w"; + }else if (g_strcmp0(term, "urxvt") == 0) { + wflag = "-embed"; + }else if (g_strcmp0(term, "xterm") == 0) { + wflag = "-into"; + } + argc = 0; // Main executable name ADD_ARGUMENT(g_strdup_printf("%s", remmina_plugin_service->file_get_string(remminafile, "terminal")), NULL); // Embed st-window in another window if (gpdata->socket_id != 0) - ADD_ARGUMENT("-w", g_strdup_printf("%i", gpdata->socket_id)); + ADD_ARGUMENT(g_strdup(wflag), g_strdup_printf("%i", gpdata->socket_id)); + // Add eventually any additional arguments set by the user + command = remmina_plugin_service->file_get_string(remminafile, "cmd"); + if(command) + ADD_ARGUMENT("-e", g_strdup_printf("%s", command)); // End of the arguments list ADD_ARGUMENT(NULL, NULL); // Retrieve the whole command line command_line = g_strjoinv(g_strdup(" "), (gchar **)&argv_debug[0]); - remmina_plugin_service->log_printf("[st] starting %s\n", command_line); - g_free(command_line); + remmina_plugin_service->log_printf("[%s] starting %s\n", PLUGIN_NAME, command_line); // Execute the external process st - ret = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, - NULL, NULL, &gpdata->pid, &error); - remmina_plugin_service->log_printf( - "[st] started st with GPid %d\n", &gpdata->pid); + g_spawn_command_line_async(command_line, &error); + g_free(command_line); + // Free the arguments list for (i = 0; i < argc; i++) { @@ -149,12 +159,14 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) g_free(argv[i]); } // Show error message - if (!ret) + if (error) { remmina_plugin_service->protocol_plugin_set_error(gp, "%s", error->message); + g_error_free(error); + } // Show attached window socket ID if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { - remmina_plugin_service->log_printf("[st] attached window to socket %d\n", - gpdata->socket_id); + remmina_plugin_service->log_printf("[%s] attached window to socket %d\n", + PLUGIN_NAME, gpdata->socket_id); return TRUE; } else @@ -171,6 +183,14 @@ static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) return FALSE; } +static gpointer term_list[] = +{ + "st", "Suckless Simple Terminal", + "urxvt", "rxvt-unicode", + "xterm", "Xterm", + NULL +}; + /* Array of RemminaProtocolSetting for basic settings. * Each item is composed by: * a) RemminaProtocolSettingType for setting type @@ -182,8 +202,8 @@ static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) */ static const RemminaProtocolSetting remmina_plugin_st_basic_settings[] = { - { REMMINA_PROTOCOL_SETTING_TYPE_COMBO, "terminal", N_("Terminal Emulator"), FALSE, - "st,xterm", NULL }, + { REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "terminal", N_("Terminal Emulator"), FALSE, term_list, NULL }, + { REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "cmd", N_("Command to be executed"), FALSE, NULL, NULL }, { REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL } }; diff --git a/st_plugin_config.h b/st_plugin_config.h index ec626fc..9e1f010 100644 --- a/st_plugin_config.h +++ b/st_plugin_config.h @@ -40,7 +40,7 @@ #define __PLUGIN_CONFIG_H #define PLUGIN_NAME "ST" - #define PLUGIN_DESCRIPTION "ST - Socket terminal" + #define PLUGIN_DESCRIPTION "Remmina Simple Terminal" #define PLUGIN_VERSION "1.0.0.0" #define PLUGIN_APPICON "remmina-tool-symbolic" #endif -- cgit v1.2.3 From 580a43dc91a84d82671627e99eb1b77526e828f0 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sat, 25 Aug 2018 21:38:04 +0200 Subject: Return false if terminal executable is not found --- st_plugin.c | 1 + 1 file changed, 1 insertion(+) diff --git a/st_plugin.c b/st_plugin.c index 4b85a43..207e4ce 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -162,6 +162,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) if (error) { remmina_plugin_service->protocol_plugin_set_error(gp, "%s", error->message); g_error_free(error); + return FALSE; } // Show attached window socket ID if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { -- cgit v1.2.3 From 6566e1d17f38af4d5b210cc352aea4e86319a75e Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sat, 25 Aug 2018 23:02:17 +0200 Subject: Cleaning and fixes --- st_plugin.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index 207e4ce..7cd6795 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -105,12 +105,13 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) RemminaPluginData *gpdata; RemminaFile *remminafile; GError *error = NULL; - gchar *argv[50]; // Contains all the arguments + gchar *argv[50]; // Contains all the arguments gchar *argv_debug[50]; // Contains all the arguments - gchar *command_line; // The whole command line obtained from argv_debug - const gchar *term; + gchar *command_line; // The whole command line obtained from argv_debug + const gchar *term; // Terminal emulator name from remimna profile. + //gchar *eterm; // Terminal emulator executable full path const gchar *wflag; - const gchar *command; // The command to be passed to the terminal (if any) + const gchar *command; // The command to be passed to the terminal (if any) gint argc; gint i; @@ -125,17 +126,25 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) } term = remmina_plugin_service->file_get_string(remminafile, "terminal"); + if (g_strcmp0(term, "st") == 0) { + /* on Debian based distros st is packaged as stterm */ + if (!g_find_program_in_path(term)) + term = "stterm"; wflag = "-w"; }else if (g_strcmp0(term, "urxvt") == 0) { wflag = "-embed"; }else if (g_strcmp0(term, "xterm") == 0) { wflag = "-into"; } + if (!g_find_program_in_path(term)) { + remmina_plugin_service->protocol_plugin_set_error(gp, "%s not found", term); + return FALSE; + } argc = 0; // Main executable name - ADD_ARGUMENT(g_strdup_printf("%s", remmina_plugin_service->file_get_string(remminafile, "terminal")), NULL); + ADD_ARGUMENT(g_strdup_printf("%s", term), NULL); // Embed st-window in another window if (gpdata->socket_id != 0) ADD_ARGUMENT(g_strdup(wflag), g_strdup_printf("%i", gpdata->socket_id)); -- cgit v1.2.3 From 7704cb4f22ad6b71c8f12ea78ac9fc9f16e12c0c Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sun, 26 Aug 2018 23:41:22 +0200 Subject: Allowing send events in xterm --- st_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st_plugin.c b/st_plugin.c index 7cd6795..f3f10a5 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -135,7 +135,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) }else if (g_strcmp0(term, "urxvt") == 0) { wflag = "-embed"; }else if (g_strcmp0(term, "xterm") == 0) { - wflag = "-into"; + wflag = "-xrm 'XTerm*allowSendEvents: true' -into"; } if (!g_find_program_in_path(term)) { remmina_plugin_service->protocol_plugin_set_error(gp, "%s not found", term); -- cgit v1.2.3 From 6bfcce48bb0e3872611f92b33f85470b3f7638ad Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 27 Aug 2018 16:19:17 +0200 Subject: Minor fixes --- st_plugin.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index f3f10a5..1b2d7ff 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -109,8 +109,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) gchar *argv_debug[50]; // Contains all the arguments gchar *command_line; // The whole command line obtained from argv_debug const gchar *term; // Terminal emulator name from remimna profile. - //gchar *eterm; // Terminal emulator executable full path - const gchar *wflag; + const gchar *wflag = NULL; const gchar *command; // The command to be passed to the terminal (if any) gint argc; gint i; -- cgit v1.2.3 From 9da83e3296cb4fab22cba61e86d690c29b6b3843 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 27 Aug 2018 17:15:19 +0200 Subject: Adding vim and emacs --- st_plugin.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/st_plugin.c b/st_plugin.c index 1b2d7ff..ec24f42 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -135,6 +135,10 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) wflag = "-embed"; }else if (g_strcmp0(term, "xterm") == 0) { wflag = "-xrm 'XTerm*allowSendEvents: true' -into"; + }else if (g_strcmp0(term, "vim") == 0) { + wflag = "-g --socketid"; + }else if (g_strcmp0(term, "emacs") == 0) { + wflag = "--parent-id"; } if (!g_find_program_in_path(term)) { remmina_plugin_service->protocol_plugin_set_error(gp, "%s not found", term); @@ -197,6 +201,8 @@ static gpointer term_list[] = "st", "Suckless Simple Terminal", "urxvt", "rxvt-unicode", "xterm", "Xterm", + "emacs", "GNU Emacs", + "vim", "Vim Text Editor", NULL }; -- cgit v1.2.3 From 042edd54d3365b5ea014b166676719733487dbbb Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 27 Aug 2018 17:45:01 +0200 Subject: Correcthly dealing with additional arguments in emacs and vim --- st_plugin.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/st_plugin.c b/st_plugin.c index ec24f42..dc7725f 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -111,6 +111,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) const gchar *term; // Terminal emulator name from remimna profile. const gchar *wflag = NULL; const gchar *command; // The command to be passed to the terminal (if any) + gboolean isterm; gint argc; gint i; @@ -131,14 +132,19 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) if (!g_find_program_in_path(term)) term = "stterm"; wflag = "-w"; + isterm = TRUE; }else if (g_strcmp0(term, "urxvt") == 0) { wflag = "-embed"; + isterm = TRUE; }else if (g_strcmp0(term, "xterm") == 0) { wflag = "-xrm 'XTerm*allowSendEvents: true' -into"; + isterm = TRUE; }else if (g_strcmp0(term, "vim") == 0) { wflag = "-g --socketid"; + isterm = FALSE; }else if (g_strcmp0(term, "emacs") == 0) { wflag = "--parent-id"; + isterm = FALSE; } if (!g_find_program_in_path(term)) { remmina_plugin_service->protocol_plugin_set_error(gp, "%s not found", term); @@ -153,8 +159,10 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) ADD_ARGUMENT(g_strdup(wflag), g_strdup_printf("%i", gpdata->socket_id)); // Add eventually any additional arguments set by the user command = remmina_plugin_service->file_get_string(remminafile, "cmd"); - if(command) + if(command && isterm) ADD_ARGUMENT("-e", g_strdup_printf("%s", command)); + if(command && !isterm) + ADD_ARGUMENT("", g_strdup_printf("%s", command)); // End of the arguments list ADD_ARGUMENT(NULL, NULL); // Retrieve the whole command line -- cgit v1.2.3 From 64fa2852d377055e00184208d368bbf85d464d79 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 20 Sep 2018 15:50:04 +0200 Subject: Minor fix - Uninitialized variable --- st_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st_plugin.c b/st_plugin.c index dc7725f..f34ed92 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -111,7 +111,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) const gchar *term; // Terminal emulator name from remimna profile. const gchar *wflag = NULL; const gchar *command; // The command to be passed to the terminal (if any) - gboolean isterm; + gboolean isterm = FALSE; gint argc; gint i; -- cgit v1.2.3 From c38001e56897b0d2c42ca8b80edca574be3b58ab Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 27 Sep 2018 00:33:00 +0200 Subject: Plugin declare it uses GtkSocket and rcw block the call if not supported --- st_plugin.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index f34ed92..1af811e 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -44,6 +44,8 @@ #include #include +#define REMMINA_PLUGIN_ST_FEATURE_GTKSOCKET 1 + typedef struct _RemminaPluginData { GtkWidget *socket; @@ -53,6 +55,13 @@ typedef struct _RemminaPluginData static RemminaPluginService *remmina_plugin_service = NULL; +static gboolean remmina_st_query_feature(RemminaProtocolWidget* gp, const RemminaProtocolFeature* feature) +{ + TRACE_CALL(__func__); + return TRUE; +} + + static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWidget *gp) { TRACE_CALL(__func__); @@ -245,6 +254,14 @@ static const RemminaProtocolSetting remmina_plugin_st_advanced_settings[] = { REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL } }; +/* Array for available features. + * The last element of the array must be REMMINA_PROTOCOL_FEATURE_TYPE_END. */ +static const RemminaProtocolFeature remmina_st_features[] = +{ + { REMMINA_PROTOCOL_FEATURE_TYPE_GTKSOCKET, REMMINA_PLUGIN_ST_FEATURE_GTKSOCKET, NULL, NULL, NULL}, + { REMMINA_PROTOCOL_FEATURE_TYPE_END, 0, NULL, NULL, NULL} +}; + /* Protocol plugin definition and features */ static RemminaProtocolPlugin remmina_plugin = { @@ -258,11 +275,11 @@ static RemminaProtocolPlugin remmina_plugin = remmina_plugin_st_basic_settings, // Array for basic settings remmina_plugin_st_advanced_settings, // Array for advanced settings REMMINA_PROTOCOL_SSH_SETTING_NONE, // SSH settings type - NULL, // Array for available features + remmina_st_features, // Array for available features remmina_plugin_st_init, // Plugin initialization remmina_plugin_st_open_connection, // Plugin open connection remmina_plugin_st_close_connection, // Plugin close connection - NULL, // Query for available features + remmina_st_query_feature, // Query for available features NULL, // Call a feature NULL, // Send a keystroke NULL // Capture screenshot -- cgit v1.2.3 From 7a2b53e8656ee1a0a2981d5fe73eab1f663bc875 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sat, 5 Jan 2019 02:37:22 +0100 Subject: Gtk icon cache update during install phase --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d6e238..e3e0c3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,3 +49,5 @@ install(TARGETS remmina-plugin-st DESTINATION ${REMMINA_PLUGINDIR}) install(FILES scalable/emblems/remmina-tool-symbolic.svg DESTINATION ${APPICONSCALE_EMBLEMS_DIR}) + +gtk_update_icon_cache("${REMMINA_DATADIR}/icons/hicolor") -- cgit v1.2.3 From 21ac547864395bd4ab3e46e39390fd98444a6463 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 10 Jan 2019 01:02:37 +0100 Subject: Updating coyright for year 2019 --- CMakeLists.txt | 2 +- st_plugin.c | 2 +- st_plugin_config.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3e0c3e..d1bb34f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # remmina-plugin-tool_hello_world - The GTK+ Remote Desktop Client # # Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo -# Copyright (C) 2016-2018 Antenore Gatta, Giovanni Panozzo +# Copyright (C) 2016-2019 Antenore Gatta, Giovanni Panozzo # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/st_plugin.c b/st_plugin.c index 1af811e..55d2b2d 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2017-2018 Antenore Gatta, Giovanni Panozzo + * Copyright (C) 2017-2019 Antenore Gatta, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/st_plugin_config.h b/st_plugin_config.h index 9e1f010..f028519 100644 --- a/st_plugin_config.h +++ b/st_plugin_config.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2017-2018 Antenore Gatta + * Copyright (C) 2017-2019 Antenore Gatta * * Initially based on the plugin "Remmina Plugin EXEC", created and written by * Fabio Castelli (Muflone) . -- cgit v1.2.3 From 80af1600162187afa9b40350f65f9167c0bf5817 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sun, 13 Jan 2019 23:51:28 +0100 Subject: Adding missing strings to be translated --- st_plugin_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st_plugin_config.h b/st_plugin_config.h index f028519..0afa35d 100644 --- a/st_plugin_config.h +++ b/st_plugin_config.h @@ -40,7 +40,7 @@ #define __PLUGIN_CONFIG_H #define PLUGIN_NAME "ST" - #define PLUGIN_DESCRIPTION "Remmina Simple Terminal" + #define PLUGIN_DESCRIPTION N_("Remmina Simple Terminal") #define PLUGIN_VERSION "1.0.0.0" #define PLUGIN_APPICON "remmina-tool-symbolic" #endif -- cgit v1.2.3 From 0fab51dbc860d908e520cfb306bef68437aed911 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 29 May 2019 22:54:28 +0000 Subject: WWW plugin - A new plugin to connect to Webbased administration consoles fixes #551 --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1bb34f..10dfc76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ -# remmina-plugin-tool_hello_world - The GTK+ Remote Desktop Client +# remmina-plugin-st - The GTK+ Remote Desktop Client # -# Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo # Copyright (C) 2016-2019 Antenore Gatta, Giovanni Panozzo # # This program is free software; you can redistribute it and/or modify -- cgit v1.2.3 From dfecc7765866d89158c987d33a7baf94875017fc Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 31 Jul 2019 01:56:49 +0200 Subject: Make icon cache optional. Partly solve #1045 --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10dfc76..adf0ca9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,4 +49,6 @@ install(FILES scalable/emblems/remmina-tool-symbolic.svg DESTINATION ${APPICONSCALE_EMBLEMS_DIR}) -gtk_update_icon_cache("${REMMINA_DATADIR}/icons/hicolor") +if(WITH_ICON_CACHE) + gtk_update_icon_cache("${REMMINA_DATADIR}/icons/hicolor") +endif() -- cgit v1.2.3 From 792ef0f3a5536f7f48bc7cb90fb86e8291b5fe9a Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sat, 7 Sep 2019 01:06:15 +0200 Subject: Adding setting tooltip in the remmina profile editor --- st_plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index 55d2b2d..1b50e70 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -230,7 +230,7 @@ static gpointer term_list[] = * c) Setting description * d) Compact disposition * e) Values for REMMINA_PROTOCOL_SETTING_TYPE_SELECT or REMMINA_PROTOCOL_SETTING_TYPE_COMBO - * f) Unused pointer + * f) Setting Tooltip */ static const RemminaProtocolSetting remmina_plugin_st_basic_settings[] = { @@ -246,7 +246,7 @@ static const RemminaProtocolSetting remmina_plugin_st_basic_settings[] = * c) Setting description * d) Compact disposition * e) Values for REMMINA_PROTOCOL_SETTING_TYPE_SELECT or REMMINA_PROTOCOL_SETTING_TYPE_COMBO - * f) Unused pointer + * f) Setting Tooltip */ static const RemminaProtocolSetting remmina_plugin_st_advanced_settings[] = { -- cgit v1.2.3 From 4bdd45d771bacaee692bceaa52e21e7a28da3814 Mon Sep 17 00:00:00 2001 From: Giovanni Panozzo Date: Sun, 27 Oct 2019 21:41:37 +0100 Subject: Plugin connection close refactoring --- st_plugin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index 1b50e70..5bcc3d9 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -68,7 +68,7 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi RemminaPluginData *gpdata; gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); remmina_plugin_service->log_printf("[%s] Plugin plug added on socket %d\n", PLUGIN_NAME, gpdata->socket_id); - remmina_plugin_service->protocol_plugin_emit_signal(gp, "connect"); + remmina_plugin_service->protocol_plugin_signal_connection_opened(gp); return; } @@ -76,7 +76,7 @@ static void remmina_plugin_st_on_plug_removed(GtkSocket *socket, RemminaProtocol { TRACE_CALL(__func__); remmina_plugin_service->log_printf("[%s] Plugin plug removed\n", PLUGIN_NAME); - remmina_plugin_service->protocol_plugin_close_connection(gp); + remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); } static void remmina_plugin_st_init(RemminaProtocolWidget *gp) @@ -209,7 +209,7 @@ static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); remmina_plugin_service->log_printf("[%s] Plugin close connection\n", PLUGIN_NAME); - remmina_plugin_service->protocol_plugin_emit_signal(gp, "disconnect"); + remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); return FALSE; } -- cgit v1.2.3 From a9f4a9494d104e552d3ffa9e4abcef94313a183f Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sun, 3 Nov 2019 15:37:36 +0100 Subject: Code cleaning --- st_plugin_config.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/st_plugin_config.h b/st_plugin_config.h index 0afa35d..6b8272a 100644 --- a/st_plugin_config.h +++ b/st_plugin_config.h @@ -37,10 +37,10 @@ #pragma once #ifndef __PLUGIN_CONFIG_H - #define __PLUGIN_CONFIG_H +#define __PLUGIN_CONFIG_H - #define PLUGIN_NAME "ST" - #define PLUGIN_DESCRIPTION N_("Remmina Simple Terminal") - #define PLUGIN_VERSION "1.0.0.0" - #define PLUGIN_APPICON "remmina-tool-symbolic" +#define PLUGIN_NAME "ST" +#define PLUGIN_DESCRIPTION N_("Remmina Simple Terminal") +#define PLUGIN_VERSION "1.0.0.0" +#define PLUGIN_APPICON "remmina-tool-symbolic" #endif -- cgit v1.2.3 From a0c597814ef17252ccf333c13183f050843ad0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Sat, 7 Dec 2019 07:33:30 +0000 Subject: Spelling: "simple terminal" --- st_plugin_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st_plugin_config.h b/st_plugin_config.h index 6b8272a..a9f246f 100644 --- a/st_plugin_config.h +++ b/st_plugin_config.h @@ -40,7 +40,7 @@ #define __PLUGIN_CONFIG_H #define PLUGIN_NAME "ST" -#define PLUGIN_DESCRIPTION N_("Remmina Simple Terminal") +#define PLUGIN_DESCRIPTION N_("Remmina simple terminal") #define PLUGIN_VERSION "1.0.0.0" #define PLUGIN_APPICON "remmina-tool-symbolic" #endif -- cgit v1.2.3 From 885a642837d7e7c665e6c0b5c6d9333081289337 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 10 Jan 2020 15:25:07 +0100 Subject: Updating copyrights and contribution lists --- CMakeLists.txt | 2 +- st_plugin.c | 2 +- st_plugin_config.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adf0ca9..ab9c3d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # remmina-plugin-st - The GTK+ Remote Desktop Client # -# Copyright (C) 2016-2019 Antenore Gatta, Giovanni Panozzo +# Copyright (C) 2016-2020 Antenore Gatta, Giovanni Panozzo # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/st_plugin.c b/st_plugin.c index 5bcc3d9..32d5c4d 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2017-2019 Antenore Gatta, Giovanni Panozzo + * Copyright (C) 2017-2020 Antenore Gatta, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/st_plugin_config.h b/st_plugin_config.h index a9f246f..ad80fa9 100644 --- a/st_plugin_config.h +++ b/st_plugin_config.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2017-2019 Antenore Gatta + * Copyright (C) 2017-2020 Antenore Gatta * * Initially based on the plugin "Remmina Plugin EXEC", created and written by * Fabio Castelli (Muflone) . -- cgit v1.2.3 From 8d6f1cd62af4db8cd19e58bc5007ba69a432bee5 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 18 May 2020 13:17:05 +0000 Subject: New remmina_debug function, replaces remmina_log_print, remmina_log_printf and g_debug remmina_debug is meant to be used in place of remmina_log_print, remmina_log_printf and g_debug, to print debug messages in the remmina log window and in the STDOUT --- st_plugin.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index 32d5c4d..2144c8e 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -67,7 +67,7 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi TRACE_CALL(__func__); RemminaPluginData *gpdata; gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); - remmina_plugin_service->log_printf("[%s] Plugin plug added on socket %d\n", PLUGIN_NAME, gpdata->socket_id); + remmina_plugin_service->debug("[%s] Plugin plug added on socket %d", PLUGIN_NAME, gpdata->socket_id); remmina_plugin_service->protocol_plugin_signal_connection_opened(gp); return; } @@ -75,14 +75,14 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi static void remmina_plugin_st_on_plug_removed(GtkSocket *socket, RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->log_printf("[%s] Plugin plug removed\n", PLUGIN_NAME); + remmina_plugin_service->debug("[%s] Plugin plug removed", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); } static void remmina_plugin_st_init(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->log_printf("[%s] Plugin init\n", PLUGIN_NAME); + remmina_plugin_service->debug("[%s] Plugin init", PLUGIN_NAME); RemminaPluginData *gpdata; gpdata = g_new0(RemminaPluginData, 1); @@ -99,7 +99,7 @@ static void remmina_plugin_st_init(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->log_printf("[%s] Plugin open connection\n", PLUGIN_NAME); + remmina_plugin_service->debug("[%s] Plugin open connection", PLUGIN_NAME); #define ADD_ARGUMENT(name, value) \ { \ argv[argc] = g_strdup(name); \ @@ -176,7 +176,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) ADD_ARGUMENT(NULL, NULL); // Retrieve the whole command line command_line = g_strjoinv(g_strdup(" "), (gchar **)&argv_debug[0]); - remmina_plugin_service->log_printf("[%s] starting %s\n", PLUGIN_NAME, command_line); + remmina_plugin_service->debug("[%s] starting %s", PLUGIN_NAME, command_line); // Execute the external process st g_spawn_command_line_async(command_line, &error); g_free(command_line); @@ -195,7 +195,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) } // Show attached window socket ID if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { - remmina_plugin_service->log_printf("[%s] attached window to socket %d\n", + remmina_plugin_service->debug("[%s] attached window to socket %d", PLUGIN_NAME, gpdata->socket_id); return TRUE; } @@ -208,7 +208,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->log_printf("[%s] Plugin close connection\n", PLUGIN_NAME); + remmina_plugin_service->debug("[%s] Plugin close connection", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); return FALSE; } -- cgit v1.2.3 From 921bb47d8378f7f63d6f09ad33a77b95a982a6dc Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 21 May 2020 00:42:33 +0200 Subject: Refactoring remmina_debug to avoid memory leaks and overhead, should fix #2202 Signed-off-by: Antenore Gatta --- st_plugin.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index 2144c8e..e5a4d79 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -67,7 +67,7 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi TRACE_CALL(__func__); RemminaPluginData *gpdata; gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); - remmina_plugin_service->debug("[%s] Plugin plug added on socket %d", PLUGIN_NAME, gpdata->socket_id); + remmina_plugin_service->_debug("[%s] Plugin plug added on socket %d", PLUGIN_NAME, gpdata->socket_id); remmina_plugin_service->protocol_plugin_signal_connection_opened(gp); return; } @@ -75,14 +75,14 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi static void remmina_plugin_st_on_plug_removed(GtkSocket *socket, RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->debug("[%s] Plugin plug removed", PLUGIN_NAME); + remmina_plugin_service->_debug("[%s] Plugin plug removed", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); } static void remmina_plugin_st_init(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->debug("[%s] Plugin init", PLUGIN_NAME); + remmina_plugin_service->_debug("[%s] Plugin init", PLUGIN_NAME); RemminaPluginData *gpdata; gpdata = g_new0(RemminaPluginData, 1); @@ -99,7 +99,7 @@ static void remmina_plugin_st_init(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->debug("[%s] Plugin open connection", PLUGIN_NAME); + remmina_plugin_service->_debug("[%s] Plugin open connection", PLUGIN_NAME); #define ADD_ARGUMENT(name, value) \ { \ argv[argc] = g_strdup(name); \ @@ -176,7 +176,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) ADD_ARGUMENT(NULL, NULL); // Retrieve the whole command line command_line = g_strjoinv(g_strdup(" "), (gchar **)&argv_debug[0]); - remmina_plugin_service->debug("[%s] starting %s", PLUGIN_NAME, command_line); + remmina_plugin_service->_debug("[%s] starting %s", PLUGIN_NAME, command_line); // Execute the external process st g_spawn_command_line_async(command_line, &error); g_free(command_line); @@ -195,7 +195,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) } // Show attached window socket ID if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { - remmina_plugin_service->debug("[%s] attached window to socket %d", + remmina_plugin_service->_debug("[%s] attached window to socket %d", PLUGIN_NAME, gpdata->socket_id); return TRUE; } @@ -208,7 +208,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->debug("[%s] Plugin close connection", PLUGIN_NAME); + remmina_plugin_service->_debug("[%s] Plugin close connection", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); return FALSE; } -- cgit v1.2.3 From e9ede533e1c9091320ef6b036f4c6f4276e04f94 Mon Sep 17 00:00:00 2001 From: Giovanni panozzo Date: Thu, 21 May 2020 14:28:56 +0200 Subject: Introduce remmina_plugin_debug() for plugins --- st_plugin.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index e5a4d79..ae99d4d 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -54,6 +54,7 @@ typedef struct _RemminaPluginData } RemminaPluginData; static RemminaPluginService *remmina_plugin_service = NULL; +#define remmina_plugin_debug(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt __VA_OPT__(,) __VA_ARGS__) static gboolean remmina_st_query_feature(RemminaProtocolWidget* gp, const RemminaProtocolFeature* feature) { @@ -67,7 +68,7 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi TRACE_CALL(__func__); RemminaPluginData *gpdata; gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); - remmina_plugin_service->_debug("[%s] Plugin plug added on socket %d", PLUGIN_NAME, gpdata->socket_id); + remmina_plugin_debug("[%s] Plugin plug added on socket %d", PLUGIN_NAME, gpdata->socket_id); remmina_plugin_service->protocol_plugin_signal_connection_opened(gp); return; } @@ -75,14 +76,14 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi static void remmina_plugin_st_on_plug_removed(GtkSocket *socket, RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->_debug("[%s] Plugin plug removed", PLUGIN_NAME); + remmina_plugin_debug("[%s] Plugin plug removed", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); } static void remmina_plugin_st_init(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->_debug("[%s] Plugin init", PLUGIN_NAME); + remmina_plugin_debug("[%s] Plugin init", PLUGIN_NAME); RemminaPluginData *gpdata; gpdata = g_new0(RemminaPluginData, 1); @@ -99,7 +100,7 @@ static void remmina_plugin_st_init(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->_debug("[%s] Plugin open connection", PLUGIN_NAME); + remmina_plugin_debug("[%s] Plugin open connection", PLUGIN_NAME); #define ADD_ARGUMENT(name, value) \ { \ argv[argc] = g_strdup(name); \ @@ -176,7 +177,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) ADD_ARGUMENT(NULL, NULL); // Retrieve the whole command line command_line = g_strjoinv(g_strdup(" "), (gchar **)&argv_debug[0]); - remmina_plugin_service->_debug("[%s] starting %s", PLUGIN_NAME, command_line); + remmina_plugin_debug("[%s] starting %s", PLUGIN_NAME, command_line); // Execute the external process st g_spawn_command_line_async(command_line, &error); g_free(command_line); @@ -195,7 +196,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) } // Show attached window socket ID if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { - remmina_plugin_service->_debug("[%s] attached window to socket %d", + remmina_plugin_debug("[%s] attached window to socket %d", PLUGIN_NAME, gpdata->socket_id); return TRUE; } @@ -208,7 +209,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_service->_debug("[%s] Plugin close connection", PLUGIN_NAME); + remmina_plugin_debug("[%s] Plugin close connection", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); return FALSE; } -- cgit v1.2.3 From 759a179543367ade35f08723ae3aa90286426762 Mon Sep 17 00:00:00 2001 From: Giovanni Panozzo Date: Thu, 21 May 2020 15:53:23 +0200 Subject: Change __VA_OPT__ to ## to support clang --- st_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st_plugin.c b/st_plugin.c index ae99d4d..ae7eee7 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -54,7 +54,7 @@ typedef struct _RemminaPluginData } RemminaPluginData; static RemminaPluginService *remmina_plugin_service = NULL; -#define remmina_plugin_debug(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt __VA_OPT__(,) __VA_ARGS__) +#define remmina_plugin_debug(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) static gboolean remmina_st_query_feature(RemminaProtocolWidget* gp, const RemminaProtocolFeature* feature) { -- cgit v1.2.3 From 0d3807efaedfebf86e121de1d6a9a4fc6ae302a4 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 21 May 2020 21:36:38 +0200 Subject: Set macro name to uppercase --- st_plugin.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/st_plugin.c b/st_plugin.c index ae7eee7..d1e4cdc 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -54,7 +54,7 @@ typedef struct _RemminaPluginData } RemminaPluginData; static RemminaPluginService *remmina_plugin_service = NULL; -#define remmina_plugin_debug(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_DEBUG(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) static gboolean remmina_st_query_feature(RemminaProtocolWidget* gp, const RemminaProtocolFeature* feature) { @@ -68,7 +68,7 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi TRACE_CALL(__func__); RemminaPluginData *gpdata; gpdata = (RemminaPluginData*) g_object_get_data(G_OBJECT(gp), "plugin-data"); - remmina_plugin_debug("[%s] Plugin plug added on socket %d", PLUGIN_NAME, gpdata->socket_id); + REMMINA_PLUGIN_DEBUG("[%s] Plugin plug added on socket %d", PLUGIN_NAME, gpdata->socket_id); remmina_plugin_service->protocol_plugin_signal_connection_opened(gp); return; } @@ -76,14 +76,14 @@ static void remmina_plugin_st_on_plug_added(GtkSocket *socket, RemminaProtocolWi static void remmina_plugin_st_on_plug_removed(GtkSocket *socket, RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_debug("[%s] Plugin plug removed", PLUGIN_NAME); + REMMINA_PLUGIN_DEBUG("[%s] Plugin plug removed", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); } static void remmina_plugin_st_init(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_debug("[%s] Plugin init", PLUGIN_NAME); + REMMINA_PLUGIN_DEBUG("[%s] Plugin init", PLUGIN_NAME); RemminaPluginData *gpdata; gpdata = g_new0(RemminaPluginData, 1); @@ -100,7 +100,7 @@ static void remmina_plugin_st_init(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_debug("[%s] Plugin open connection", PLUGIN_NAME); + REMMINA_PLUGIN_DEBUG("[%s] Plugin open connection", PLUGIN_NAME); #define ADD_ARGUMENT(name, value) \ { \ argv[argc] = g_strdup(name); \ @@ -177,7 +177,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) ADD_ARGUMENT(NULL, NULL); // Retrieve the whole command line command_line = g_strjoinv(g_strdup(" "), (gchar **)&argv_debug[0]); - remmina_plugin_debug("[%s] starting %s", PLUGIN_NAME, command_line); + REMMINA_PLUGIN_DEBUG("[%s] starting %s", PLUGIN_NAME, command_line); // Execute the external process st g_spawn_command_line_async(command_line, &error); g_free(command_line); @@ -196,7 +196,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) } // Show attached window socket ID if (!remmina_plugin_service->file_get_int(remminafile, "detached", FALSE)) { - remmina_plugin_debug("[%s] attached window to socket %d", + REMMINA_PLUGIN_DEBUG("[%s] attached window to socket %d", PLUGIN_NAME, gpdata->socket_id); return TRUE; } @@ -209,7 +209,7 @@ static gboolean remmina_plugin_st_open_connection(RemminaProtocolWidget *gp) static gboolean remmina_plugin_st_close_connection(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - remmina_plugin_debug("[%s] Plugin close connection", PLUGIN_NAME); + REMMINA_PLUGIN_DEBUG("[%s] Plugin close connection", PLUGIN_NAME); remmina_plugin_service->protocol_plugin_signal_connection_closed(gp); return FALSE; } -- cgit v1.2.3 From c8caa266cbe4f1f0ff4e4b96cfdd81cf5d3f8ece Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Mon, 4 Jan 2021 08:12:01 +0100 Subject: Updating Copyright notice for 2021 --- CMakeLists.txt | 2 +- st_plugin.c | 2 +- st_plugin_config.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab9c3d6..91a7d51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # remmina-plugin-st - The GTK+ Remote Desktop Client # -# Copyright (C) 2016-2020 Antenore Gatta, Giovanni Panozzo +# Copyright (C) 2016-2021 Antenore Gatta, Giovanni Panozzo # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/st_plugin.c b/st_plugin.c index d1e4cdc..1a7a2f4 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2017-2020 Antenore Gatta, Giovanni Panozzo + * Copyright (C) 2017-2021 Antenore Gatta, Giovanni Panozzo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/st_plugin_config.h b/st_plugin_config.h index ad80fa9..2733849 100644 --- a/st_plugin_config.h +++ b/st_plugin_config.h @@ -1,6 +1,6 @@ /* * Remmina - The GTK+ Remote Desktop Client - * Copyright (C) 2017-2020 Antenore Gatta + * Copyright (C) 2016-2021 Antenore Gatta, Giovanni Panozzo * * Initially based on the plugin "Remmina Plugin EXEC", created and written by * Fabio Castelli (Muflone) . -- cgit v1.2.3 From 9d638d9664a94d839aba00d1e561dda008b5c469 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Fri, 23 Apr 2021 15:10:01 +0200 Subject: Fixing RemminaConnectionWindow map/unmap events The remmina connection windows in fullscreen is a different object than when is in scrolled mode, therefore the old logic to map and unmap the windows from the plugin it was notr working. Now the events are managed directly from the RCW object and the RemminaProtocolWidget, with an API that can be used by any plugins. When in multi monitor and fullscreen, this mechanism doesn't work, Therefore, in the plugin itself I catch when we are in multi monitor fullscreen mode And I ignore the event. This last behaviour should be managed directly in the Remmina Protocol Widget (TODO). Fixes #2475 Signed-off-by: Antenore Gatta --- st_plugin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/st_plugin.c b/st_plugin.c index 1a7a2f4..f5512a0 100644 --- a/st_plugin.c +++ b/st_plugin.c @@ -283,7 +283,9 @@ static RemminaProtocolPlugin remmina_plugin = remmina_st_query_feature, // Query for available features NULL, // Call a feature NULL, // Send a keystroke - NULL // Capture screenshot + NULL, // Capture screenshot + NULL, // RCW map event + NULL // RCW unmap event }; G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService *service) -- cgit v1.2.3