aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-11-09 21:04:39 +0800
committerPo Lu2022-11-09 21:05:24 +0800
commitb7e476a3d3023ab954939a68f326616ab970ddda (patch)
treed3ec044d32ce63a877d8e5f1e194c66c197a991c /src
parent6f329bd239593c5f54e8f2b51b7974769d75db1f (diff)
downloademacs-b7e476a3d3023ab954939a68f326616ab970ddda.tar.gz
emacs-b7e476a3d3023ab954939a68f326616ab970ddda.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/pgtkterm.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 3350676e3c6..4f3e3697ba4 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -6599,6 +6599,44 @@ pgtk_selection_event (GtkWidget *widget, GdkEvent *event,
6599 return FALSE; 6599 return FALSE;
6600} 6600}
6601 6601
6602/* Display a warning message if the PGTK port is being used under X;
6603 that is not supported. */
6604
6605static void
6606pgtk_display_x_warning (GdkDisplay *display)
6607{
6608 GtkWidget *dialog_widget, *label, *content_area;
6609 GtkDialog *dialog;
6610 GtkWindow *window;
6611 GdkScreen *screen;
6612
6613 /* Do this instead of GDK_IS_X11_DISPLAY because the GDK X header
6614 pulls in Xlib, which conflicts with definitions in pgtkgui.h. */
6615 if (strcmp (G_OBJECT_TYPE_NAME (display),
6616 "GdkX11Display"))
6617 return;
6618
6619 dialog_widget = gtk_dialog_new ();
6620 dialog = GTK_DIALOG (dialog_widget);
6621 window = GTK_WINDOW (dialog_widget);
6622 screen = gdk_display_get_default_screen (display);
6623 content_area = gtk_dialog_get_content_area (dialog);
6624
6625 gtk_window_set_title (window, "Warning");
6626 gtk_window_set_screen (window, screen);
6627
6628 label = gtk_label_new ("You are trying to run Emacs configured with"
6629 " the \"pure-GTK\" interface under the X Window"
6630 " System. That configuration is unsupported and"
6631 " will lead to sporadic crashes during transfer of"
6632 " large selection data. It will also lead to"
6633 " various problems with keyboard input.");
6634 gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
6635 gtk_container_add (GTK_CONTAINER (content_area), label);
6636 gtk_widget_show (label);
6637 gtk_widget_show (dialog_widget);
6638}
6639
6602/* Open a connection to X display DISPLAY_NAME, and return 6640/* Open a connection to X display DISPLAY_NAME, and return
6603 the structure that describes the open display. 6641 the structure that describes the open display.
6604 If we cannot contact the display, return null. */ 6642 If we cannot contact the display, return null. */
@@ -6702,6 +6740,9 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
6702 return 0; 6740 return 0;
6703 } 6741 }
6704 6742
6743 /* If the PGTK port is being used under X, complain very loudly, as
6744 that isn't supported. */
6745 pgtk_display_x_warning (dpy);
6705 6746
6706 dpyinfo = xzalloc (sizeof *dpyinfo); 6747 dpyinfo = xzalloc (sizeof *dpyinfo);
6707 pgtk_initialize_display_info (dpyinfo); 6748 pgtk_initialize_display_info (dpyinfo);