aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-07-21 19:31:16 +0200
committerdec05eba <dec05eba@protonmail.com>2023-07-21 19:31:16 +0200
commit4ede73678e4b2120019a5f3d3ff18707a8f9683d (patch)
treeb8796839b3b9c598b41ef9a725de7199a5e3bfd1 /src
parenta559d9741713713deb40dae661bce5112cfa255f (diff)
Fix crash because x11 connection is closed, check if neither x11 nor wayland is running
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4582e0f..a9a777b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2840,8 +2840,14 @@ static const char* gpu_vendor_to_name(gpu_vendor vendor) {
static void activate(GtkApplication *app, gpointer) {
Display *dpy = XOpenDisplay(NULL);
wayland = !dpy || is_xwayland(dpy);
- if(dpy)
- XCloseDisplay(dpy);
+ if(!wayland && !dpy) {
+ GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ "Neither X11 nor Wayland is running.");
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ g_application_quit(G_APPLICATION(app));
+ return;
+ }
nvfbc_installed = !wayland && is_nv_fbc_installed();