window: react on WM change only on X11

master-1.22
monsta 2016-01-12 13:01:54 +03:00
parent 7ac202c5d9
commit 6a2f8dec69
1 changed files with 26 additions and 3 deletions

View File

@ -22,7 +22,9 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#endif
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include <libmate-desktop/mate-aboutdialog.h> #include <libmate-desktop/mate-aboutdialog.h>
@ -1677,9 +1679,18 @@ terminal_window_screen_update (TerminalWindow *window,
{ {
TerminalApp *app; TerminalApp *app;
#ifdef GDK_WINDOWING_X11
#if GTK_CHECK_VERSION (3, 0, 0)
if (screen && GDK_IS_X11_SCREEN (screen))
#else
if (screen)
#endif
{
terminal_window_window_manager_changed_cb (screen, window); terminal_window_window_manager_changed_cb (screen, window);
g_signal_connect (screen, "window-manager-changed", g_signal_connect (screen, "window-manager-changed",
G_CALLBACK (terminal_window_window_manager_changed_cb), window); G_CALLBACK (terminal_window_window_manager_changed_cb), window);
}
#endif
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection"))) if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection")))
return; return;
@ -1712,12 +1723,18 @@ terminal_window_screen_changed (GtkWidget *widget,
if (previous_screen == screen) if (previous_screen == screen)
return; return;
#ifdef GDK_WINDOWING_X11
#if GTK_CHECK_VERSION (3, 0, 0)
if (previous_screen && GDK_IS_X11_SCREEN (previous_screen))
#else
if (previous_screen) if (previous_screen)
#endif
{ {
g_signal_handlers_disconnect_by_func (previous_screen, g_signal_handlers_disconnect_by_func (previous_screen,
G_CALLBACK (terminal_window_window_manager_changed_cb), G_CALLBACK (terminal_window_window_manager_changed_cb),
window); window);
} }
#endif
if (!screen) if (!screen)
return; return;
@ -2266,13 +2283,19 @@ terminal_window_dispose (GObject *object)
G_CALLBACK (update_edit_menu), G_CALLBACK (update_edit_menu),
window); window);
#ifdef GDK_WINDOWING_X11
screen = gtk_widget_get_screen (GTK_WIDGET (object)); screen = gtk_widget_get_screen (GTK_WIDGET (object));
#if GTK_CHECK_VERSION (3, 0, 0)
if (screen && GDK_IS_X11_SCREEN (screen))
#else
if (screen) if (screen)
#endif
{ {
g_signal_handlers_disconnect_by_func (screen, g_signal_handlers_disconnect_by_func (screen,
G_CALLBACK (terminal_window_window_manager_changed_cb), G_CALLBACK (terminal_window_window_manager_changed_cb),
window); window);
} }
#endif
G_OBJECT_CLASS (terminal_window_parent_class)->dispose (object); G_OBJECT_CLASS (terminal_window_parent_class)->dispose (object);
} }