diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bf5839..bc75ce4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,10 +19,6 @@ pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET "gtk+-3.0>=3.16.0") pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET "glib-2.0>=2.43.4") link_libraries(PkgConfig::GTK3 PkgConfig::GLIB) -# X11 -find_package(X11 REQUIRED) -link_libraries(${X11_LIBRARIES}) - # Build add_custom_command( OUTPUT ".gresource.c" diff --git a/src/entry.c b/src/entry.c index 44b91bd..93910a0 100644 --- a/src/entry.c +++ b/src/entry.c @@ -153,7 +153,7 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data) { g_object_unref (builder); - zenity_util_show_dialog (dialog, data->attach); + zenity_util_show_dialog (dialog); if (data->timeout_delay > 0) { g_timeout_add_seconds (data->timeout_delay, diff --git a/src/option.c b/src/option.c index 17229be..bb8e3fb 100644 --- a/src/option.c +++ b/src/option.c @@ -29,7 +29,6 @@ /* General Options */ static gchar *zenity_general_dialog_title; -static gchar *zenity_general_window_icon; static int zenity_general_width; static int zenity_general_height; static gchar *zenity_general_dialog_text; @@ -44,7 +43,6 @@ static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; static gchar **zenity_general_extra_buttons; static gboolean zenity_general_modal; -static guintptr zenity_general_attach; /* Entry Dialog Options */ static gboolean zenity_entry_active; @@ -69,13 +67,6 @@ static GOptionEntry general_options[] = {{"title", &zenity_general_dialog_title, "Set the dialog title", "TITLE"}, - {"window-icon", - '\0', - 0, - G_OPTION_ARG_FILENAME, - &zenity_general_window_icon, - "Set the window icon", - "ICONPATH"}, {"width", '\0', 0, @@ -126,13 +117,6 @@ static GOptionEntry general_options[] = {{"title", &zenity_general_modal, "Set the modal hint", NULL}, - {"attach", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_INT, - &zenity_general_attach, - "Set the parent window to attach to", - "WINDOW"}, {NULL}}; static GOptionEntry entry_options[] = {{"entry", @@ -280,8 +264,6 @@ void zenity_option_free (void) { if (zenity_general_dialog_title) g_free (zenity_general_dialog_title); - if (zenity_general_window_icon) - g_free (zenity_general_window_icon); if (zenity_general_dialog_text) g_free (zenity_general_dialog_text); if (zenity_general_uri) @@ -341,7 +323,6 @@ static gboolean zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) { zenity_general_dialog_title = NULL; - zenity_general_window_icon = NULL; zenity_general_width = -1; zenity_general_height = -1; zenity_general_dialog_text = NULL; @@ -356,7 +337,6 @@ zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group, zenity_general_dialog_no_markup = FALSE; zenity_general_timeout_delay = -1; zenity_general_modal = FALSE; - zenity_general_attach = 0; return TRUE; } @@ -394,7 +374,6 @@ static gboolean zenity_general_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) { results->data->dialog_title = zenity_general_dialog_title; - results->data->window_icon = zenity_general_window_icon; results->data->width = zenity_general_width; results->data->height = zenity_general_height; results->data->timeout_delay = zenity_general_timeout_delay; @@ -402,7 +381,6 @@ zenity_general_post_callback (GOptionContext *context, GOptionGroup *group, results->data->cancel_label = zenity_general_cancel_button; results->data->extra_label = zenity_general_extra_buttons; results->data->modal = zenity_general_modal; - results->data->attach = zenity_general_attach; return TRUE; } diff --git a/src/tree.c b/src/tree.c index a181eb9..30ef04f 100644 --- a/src/tree.c +++ b/src/tree.c @@ -635,7 +635,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) { gtk_tree_view_set_search_column (GTK_TREE_VIEW (tree_view), 1); } - zenity_util_show_dialog (dialog, data->attach); + zenity_util_show_dialog (dialog); if (tree_data->mid_search) gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (tree_view), diff --git a/src/util.c b/src/util.c index a134508..0ad11ff 100644 --- a/src/util.c +++ b/src/util.c @@ -36,10 +36,6 @@ #include #include -#ifdef GDK_WINDOWING_X11 -#include -#endif - #define ZENITY_OK_DEFAULT 0 #define ZENITY_CANCEL_DEFAULT 1 #define ZENITY_ESC_DEFAULT 1 @@ -244,93 +240,9 @@ zenity_util_exit_code_with_data (ZenityExitCode value, ZenityData *zen_data) { zen_data->exit_code = zenity_util_return_exit_code (value); } -#ifdef GDK_WINDOWING_X11 - -static Window -transient_get_xterm (void) { - const char *wid_str = g_getenv ("WINDOWID"); - if (wid_str) { - char *wid_str_end; - int ret; - Window wid = strtoul (wid_str, &wid_str_end, 10); - if (*wid_str != '\0' && *wid_str_end == '\0' && wid != 0) { - XWindowAttributes attrs; - GdkDisplay *display; - display = gdk_display_get_default (); - gdk_x11_display_error_trap_push (display); - ret = XGetWindowAttributes ( - GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wid, &attrs); - if (gdk_x11_display_error_trap_pop (display) != 0 || ret == 0) { - return None; - } - return wid; - } - } - return None; -} - -static void -transient_x_free (void *ptr) { - if (ptr) - XFree (ptr); -} - -static gboolean -transient_is_toplevel (Window wid) { - XTextProperty prop; - Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); - if (!XGetWMName (dpy, wid, &prop)) - return FALSE; - transient_x_free (prop.value); - return !!prop.value; -} - -/* - * GNOME Terminal doesn't give us its toplevel window, but the WM needs a - * toplevel XID for proper stacking. Other terminals work fine without this - * magic. We can't use GDK here since "xterm" is a foreign window. - */ - -static Window -transient_get_xterm_toplevel (void) { - Window xterm = transient_get_xterm (); - Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); - while (xterm != None && !transient_is_toplevel (xterm)) { - Window root, parent, *children; - unsigned nchildren; - XQueryTree (dpy, xterm, &root, &parent, &children, &nchildren); - transient_x_free (children); - if (parent == root) - xterm = None; - else - xterm = parent; - } - return xterm; -} - -static void -zenity_util_make_transient (GdkWindow *window, Window parent) { - Window parent_window = parent; - if (parent_window == 0) - parent_window = transient_get_xterm_toplevel (); - if (parent_window != None) { - XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), - GDK_WINDOW_XID (window), - parent_window); - } -} - -#endif /* GDK_WINDOWING_X11 */ - void -zenity_util_show_dialog (GtkWidget *dialog, guintptr parent) { +zenity_util_show_dialog (GtkWidget *dialog) { gtk_widget_realize (dialog); -#ifdef GDK_WINDOWING_X11 - if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) { - g_assert (gtk_widget_get_window (dialog)); - zenity_util_make_transient (gtk_widget_get_window (dialog), parent); - } -#endif gtk_widget_show (dialog); } diff --git a/src/util.h b/src/util.h index 3000e63..5603771 100644 --- a/src/util.h +++ b/src/util.h @@ -17,7 +17,7 @@ gboolean zenity_util_fill_file_buffer ( void zenity_util_show_help (GError **error); gint zenity_util_return_exit_code (ZenityExitCode value); void zenity_util_exit_code_with_data (ZenityExitCode value, ZenityData *data); -void zenity_util_show_dialog (GtkWidget *widget, guintptr parent); +void zenity_util_show_dialog (GtkWidget *widget); gboolean zenity_util_timeout_handle (gpointer data); diff --git a/src/zenity.h b/src/zenity.h index 719a3ae..25e82e0 100644 --- a/src/zenity.h +++ b/src/zenity.h @@ -7,7 +7,6 @@ G_BEGIN_DECLS typedef struct { gchar *dialog_title; - gchar *window_icon; gchar *ok_label; gchar *cancel_label; gchar **extra_label;