emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b7e476a3d3 2/2: Make the PGTK port display a loud warning when ru


From: Po Lu
Subject: master b7e476a3d3 2/2: Make the PGTK port display a loud warning when run under X
Date: Wed, 9 Nov 2022 08:05:44 -0500 (EST)

branch: master
commit b7e476a3d3023ab954939a68f326616ab970ddda
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Make the PGTK port display a loud warning when run under X
    
    * src/pgtkterm.c (pgtk_display_x_warning): New function.
    (pgtk_term_init): Call it.
---
 src/pgtkterm.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 3350676e3c..4f3e3697ba 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -6599,6 +6599,44 @@ pgtk_selection_event (GtkWidget *widget, GdkEvent *event,
   return FALSE;
 }
 
+/* Display a warning message if the PGTK port is being used under X;
+   that is not supported.  */
+
+static void
+pgtk_display_x_warning (GdkDisplay *display)
+{
+  GtkWidget *dialog_widget, *label, *content_area;
+  GtkDialog *dialog;
+  GtkWindow *window;
+  GdkScreen *screen;
+
+  /* Do this instead of GDK_IS_X11_DISPLAY because the GDK X header
+     pulls in Xlib, which conflicts with definitions in pgtkgui.h.  */
+  if (strcmp (G_OBJECT_TYPE_NAME (display),
+             "GdkX11Display"))
+    return;
+
+  dialog_widget = gtk_dialog_new ();
+  dialog = GTK_DIALOG (dialog_widget);
+  window = GTK_WINDOW (dialog_widget);
+  screen = gdk_display_get_default_screen (display);
+  content_area = gtk_dialog_get_content_area (dialog);
+
+  gtk_window_set_title (window, "Warning");
+  gtk_window_set_screen (window, screen);
+
+  label = gtk_label_new ("You are trying to run Emacs configured with"
+                         " the \"pure-GTK\" interface under the X Window"
+                         " System.  That configuration is unsupported and"
+                         " will lead to sporadic crashes during transfer of"
+                         " large selection data.  It will also lead to"
+                         " various problems with keyboard input.");
+  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+  gtk_container_add (GTK_CONTAINER (content_area), label);
+  gtk_widget_show (label);
+  gtk_widget_show (dialog_widget);
+}
+
 /* Open a connection to X display DISPLAY_NAME, and return
    the structure that describes the open display.
    If we cannot contact the display, return null.  */
@@ -6702,6 +6740,9 @@ pgtk_term_init (Lisp_Object display_name, char 
*resource_name)
       return 0;
     }
 
+  /* If the PGTK port is being used under X, complain very loudly, as
+     that isn't supported.  */
+  pgtk_display_x_warning (dpy);
 
   dpyinfo = xzalloc (sizeof *dpyinfo);
   pgtk_initialize_display_info (dpyinfo);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]