Commit 39c0805c authored by Victor Ananjevsky's avatar Victor Ananjevsky

move checking for x11 to runtime

parent e8e4b1dc
...@@ -48,6 +48,8 @@ static GtkWidget *text = NULL; ...@@ -48,6 +48,8 @@ static GtkWidget *text = NULL;
static gint ret = YAD_RESPONSE_ESC; static gint ret = YAD_RESPONSE_ESC;
static gboolean is_x11 = FALSE;
YadNTabs *tabs; YadNTabs *tabs;
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
...@@ -556,9 +558,8 @@ create_dialog (void) ...@@ -556,9 +558,8 @@ create_dialog (void)
gtk_window_fullscreen (GTK_WINDOW (dlg)); gtk_window_fullscreen (GTK_WINDOW (dlg));
} }
#ifdef GDK_WINDOWING_X11
/* print xid */ /* print xid */
if (options.print_xid) if (is_x11 && options.print_xid)
{ {
FILE *xf; FILE *xf;
...@@ -577,7 +578,6 @@ create_dialog (void) ...@@ -577,7 +578,6 @@ create_dialog (void)
fflush (xf); fflush (xf);
} }
} }
#endif
return dlg; return dlg;
} }
...@@ -725,6 +725,12 @@ main (gint argc, gchar ** argv) ...@@ -725,6 +725,12 @@ main (gint argc, gchar ** argv)
} }
yad_set_mode (); yad_set_mode ();
/* check for current GDK backend */
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
is_x11 = TRUE;
#endif
/* parse custom gtkrc */ /* parse custom gtkrc */
if (options.gtkrc_file) if (options.gtkrc_file)
{ {
...@@ -792,14 +798,12 @@ main (gint argc, gchar ** argv) ...@@ -792,14 +798,12 @@ main (gint argc, gchar ** argv)
signal (SIGUSR2, sa_usr2); signal (SIGUSR2, sa_usr2);
#endif #endif
#ifndef GDK_WINDOWING_X11 if (!is_x11 && options.plug != -1)
if (options.plug != -1)
{ {
options.plug = -1; options.plug = -1;
if (options.debug) if (options.debug)
g_printerr ("YAD: WARNING: --plug mode not supported outside X11"); g_printerr ("YAD: WARNING: --plug mode not supported outside X11");
} }
#endif
/* plug mode */ /* plug mode */
if (options.plug != -1) if (options.plug != -1)
...@@ -810,17 +814,18 @@ main (gint argc, gchar ** argv) ...@@ -810,17 +814,18 @@ main (gint argc, gchar ** argv)
return ret; return ret;
} }
#ifndef GDK_WINDOWING_X11 if (!is_x11)
if (options.mode == YAD_MODE_NOTEBOOK || options.mode == YAD_MODE_PANED {
if (options.mode == YAD_MODE_NOTEBOOK || options.mode == YAD_MODE_PANED
#ifdef HAVE_TRAY #ifdef HAVE_TRAY
|| options.mode == YAD_MODE_NOTIFICATION || options.mode == YAD_MODE_NOTIFICATION
#endif #endif
) )
{ {
g_printerr ("This mode not supported outside X11"); g_printerr ("This mode not supported outside X11");
return 1; return 1;
}
} }
#endif
switch (options.mode) switch (options.mode)
{ {
...@@ -857,11 +862,12 @@ main (gint argc, gchar ** argv) ...@@ -857,11 +862,12 @@ main (gint argc, gchar ** argv)
default: default:
dialog = create_dialog (); dialog = create_dialog ();
#ifdef GDK_WINDOWING_X11 if (is_x11)
/* add YAD_XID variable */ {
str = g_strdup_printf ("0x%X", (guint) GDK_WINDOW_XID (gtk_widget_get_window (dialog))); /* add YAD_XID variable */
g_setenv ("YAD_XID", str, TRUE); str = g_strdup_printf ("0x%X", (guint) GDK_WINDOW_XID (gtk_widget_get_window (dialog)));
#endif g_setenv ("YAD_XID", str, TRUE);
}
/* make some specific init actions */ /* make some specific init actions */
if (options.mode == YAD_MODE_NOTEBOOK) if (options.mode == YAD_MODE_NOTEBOOK)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment