[Commits] [SCM] claws branch, master, updated. 4.2.0-2-gdd4c4e515

jonathan at claws-mail.org jonathan at claws-mail.org
Sun Nov 26 01:59:52 UTC 2023


The branch, master has been updated
       via  dd4c4e5152235f9f4f319cc9fdad9227ebf688c9 (commit)
      from  ca7335445eedf0da1b6518846338a7abdecbb7e1 (commit)

Summary of changes:
 src/action.c                     |  3 ++
 src/compose.c                    | 78 +++++++++++++++++++++++-----------------
 src/plugins/dillo/dillo_viewer.c |  5 +++
 3 files changed, 53 insertions(+), 33 deletions(-)


- Log -----------------------------------------------------------------
commit dd4c4e5152235f9f4f319cc9fdad9227ebf688c9
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sat Nov 18 18:51:30 2023 -0700

    Fix building on non-X11 systems
    
    Gtk Sockets and the GDK_IS_X11_DISPLAY() macro are only available when
    GDK_WINDOWING_X11 is defined

diff --git a/src/action.c b/src/action.c
index d86294fbc..0c459aab6 100644
--- a/src/action.c
+++ b/src/action.c
@@ -30,6 +30,9 @@
 #ifdef GDK_WINDOWING_X11
 #  include <gdk/gdkx.h>
 #endif /* GDK_WINDOWING_X11 */
+#ifdef GDK_WINDOWING_QUARTZ
+#  include <gdk/gdkquartz.h>
+#endif /* GDK_WINDOWING_QUARTZ */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/compose.c b/src/compose.c
index 574d89be1..b32fa6bc7 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -375,11 +375,11 @@ static void compose_set_ext_editor_sensitive	(Compose	*compose,
 						 gboolean	 sensitive);
 static gboolean compose_get_ext_editor_cmd_valid();
 static gboolean compose_get_ext_editor_uses_socket();
-#ifndef G_OS_WIN32
+#ifdef GDK_WINDOWING_X11
 static gboolean compose_ext_editor_plug_removed_cb
 						(GtkSocket      *socket,
 						 Compose        *compose);
-#endif /* G_OS_WIN32 */
+#endif /* GDK_WINDOWING_X11 */
 
 static void compose_undo_state_changed		(UndoMain	*undostruct,
 						 gint		 undo_state,
@@ -9623,11 +9623,11 @@ static gboolean compose_can_autosave(Compose *compose)
 static void compose_exec_ext_editor(Compose *compose)
 {
 	gchar *tmp;
-#ifndef G_OS_WIN32
+#ifdef GDK_WINDOWING_X11
 	GtkWidget *socket;
 	Window socket_wid = 0;
 	gchar *p, *s;
-#endif /* G_OS_WIN32 */
+#endif /* GDK_WINDOWING_X11 */
 	GPid pid;
 	GError *error = NULL;
 	gchar *cmd = NULL;
@@ -9643,39 +9643,43 @@ static void compose_exec_ext_editor(Compose *compose)
 		return;
 	}
 
-	if (compose_get_ext_editor_uses_socket() && GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-#ifndef G_OS_WIN32
-		/* Only allow one socket */
-		if (compose->exteditor_socket != NULL) {
-			if (gtk_widget_is_focus(compose->exteditor_socket)) {
-				/* Move the focus off of the socket */
-				gtk_widget_child_focus(compose->window, GTK_DIR_TAB_BACKWARD);
+#ifdef GDK_WINDOWING_X11
+	if (compose_get_ext_editor_uses_socket()) {
+		if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
+			/* Only allow one socket */
+			if (compose->exteditor_socket != NULL) {
+				if (gtk_widget_is_focus(compose->exteditor_socket)) {
+					/* Move the focus off of the socket */
+					gtk_widget_child_focus(compose->window, GTK_DIR_TAB_BACKWARD);
+				}
+				g_free(tmp);
+				return;
 			}
-			g_free(tmp);
-			return;
-		}
-		/* Create the receiving GtkSocket */
-		socket = gtk_socket_new ();
-		g_signal_connect (G_OBJECT(socket), "plug-removed",
-			          G_CALLBACK(compose_ext_editor_plug_removed_cb),
-				  compose);
-		gtk_box_pack_start(GTK_BOX(compose->edit_vbox), socket, TRUE, TRUE, 0);
-		gtk_widget_set_size_request(socket, prefs_common.compose_width, -1);
-		/* Realize the socket so that we can use its ID */
-		gtk_widget_realize(socket);
-		socket_wid = gtk_socket_get_id(GTK_SOCKET (socket));
-		compose->exteditor_socket = socket;
+			/* Create the receiving GtkSocket */
+			socket = gtk_socket_new ();
+			g_signal_connect (G_OBJECT(socket), "plug-removed",
+						  G_CALLBACK(compose_ext_editor_plug_removed_cb),
+					  compose);
+			gtk_box_pack_start(GTK_BOX(compose->edit_vbox), socket, TRUE, TRUE, 0);
+			gtk_widget_set_size_request(socket, prefs_common.compose_width, -1);
+			/* Realize the socket so that we can use its ID */
+			gtk_widget_realize(socket);
+			socket_wid = gtk_socket_get_id(GTK_SOCKET (socket));
+			compose->exteditor_socket = socket;
+		} else
+			debug_print("Socket communication with an external editor is only available on X11.\n");
+	}
 #else
-		alertpanel_error(_("Socket communication with an external editor is not available on Windows."));
+	if (compose_get_ext_editor_uses_socket()) {
+		alertpanel_error(_("Socket communication with an external editor is only available on X11."));
 		g_free(tmp);
 		return;
-#endif /* G_OS_WIN32 */
-	} else
-		debug_print("Socket communication with an external editor is only available on X11.\n");
+	}
+#endif /* GDK_WINDOWING_X11 */
 
 	if (compose_get_ext_editor_cmd_valid()) {
+#ifdef GDK_WINDOWING_X11
 		if (compose_get_ext_editor_uses_socket() && GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-#ifndef G_OS_WIN32
 			p = g_strdup(prefs_common_get_ext_editor_cmd());
 			s = strstr(p, "%w");
 			s[1] = 'u';
@@ -9684,10 +9688,12 @@ static void compose_exec_ext_editor(Compose *compose)
 			else
 				cmd = g_strdup_printf(p, socket_wid, tmp);
 			g_free(p);
-#endif /* G_OS_WIN32 */
 		} else {
 			cmd = g_strdup_printf(prefs_common_get_ext_editor_cmd(), tmp);
 		}
+#else
+		cmd = g_strdup_printf(prefs_common_get_ext_editor_cmd(), tmp);
+#endif /* GDK_WINDOWING_X11 */
 	} else {
 		if (prefs_common_get_ext_editor_cmd())
 			g_warning("external editor command-line is invalid: '%s'",
@@ -9776,10 +9782,12 @@ static void compose_ext_editor_closed_cb(GPid pid, gint exit_status, gpointer da
 	compose->exteditor_file    = NULL;
 	compose->exteditor_pid     = INVALID_PID;
 	compose->exteditor_tag     = -1;
+#ifdef GDK_WINDOWING_X11
 	if (compose->exteditor_socket && GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
 		gtk_widget_destroy(compose->exteditor_socket);
 		compose->exteditor_socket = NULL;
 	}
+#endif /* GDK_WINDOWING_X11 */
 
 }
 
@@ -9887,6 +9895,7 @@ static void compose_set_ext_editor_sensitive(Compose *compose,
 			ext_editor_menu_entries[i], sensitive);
 	}
 
+#ifdef GDK_WINDOWING_X11
 	if (compose_get_ext_editor_uses_socket() && GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
 		if (sensitive) {
 			if (compose->exteditor_socket)
@@ -9910,6 +9919,9 @@ static void compose_set_ext_editor_sensitive(Compose *compose,
 	} else {
 		gtk_widget_set_sensitive(compose->text,                   sensitive);
 	}
+#else
+	gtk_widget_set_sensitive(compose->text, sensitive);
+#endif /* GDK_WINDOWING_X11 */
 	if (compose->toolbar->send_btn)
 		gtk_widget_set_sensitive(compose->toolbar->send_btn,      sensitive);
 	if (compose->toolbar->sendl_btn)
@@ -9934,14 +9946,14 @@ static gboolean compose_get_ext_editor_uses_socket()
 	        strstr(prefs_common_get_ext_editor_cmd(), "%w"));
 }
 
-#ifndef G_OS_WIN32
+#ifdef GDK_WINDOWING_X11
 static gboolean compose_ext_editor_plug_removed_cb(GtkSocket *socket, Compose *compose)
 {
 	compose->exteditor_socket = NULL;
 	/* returning FALSE allows destruction of the socket */
 	return FALSE;
 }
-#endif /* G_OS_WIN32 */
+#endif /* GDK_WINDOWING_X11 */
 
 /**
  * compose_undo_state_changed:
diff --git a/src/plugins/dillo/dillo_viewer.c b/src/plugins/dillo/dillo_viewer.c
index d2690bff6..8a93511d7 100644
--- a/src/plugins/dillo/dillo_viewer.c
+++ b/src/plugins/dillo/dillo_viewer.c
@@ -125,10 +125,15 @@ static void dillo_show_mimepart(MimeViewer *_viewer,
 		g_free(viewer->filename);
 	}
 
+#ifdef GDK_WINDOWING_X11
 	if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
 		debug_print("dillo viewer only works on X11\n");
 		return;
 	}
+#else
+	debug_print("dillo viewer only works on X11\n");
+	return;
+#endif
 
 	viewer->filename = procmime_get_tmp_file_name(partinfo);
 	

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list