summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/terminal-screen.c14
-rw-r--r--src/terminal-window.c48
-rw-r--r--src/terminal.c22
3 files changed, 58 insertions, 26 deletions
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 562d793..91d503f 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -27,8 +27,13 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include <gdk/gdk.h>
+
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#ifndef GDK_IS_X11_DISPLAY
+#define GDK_IS_X11_DISPLAY(display) 1
+#endif
#endif
#include "terminal-accels.h"
@@ -1360,6 +1365,7 @@ get_child_environment (TerminalScreen *screen,
TerminalScreenPrivate *priv = screen->priv;
GtkWidget *term = GTK_WIDGET (screen);
GtkWidget *window;
+ GdkDisplay *display;
char **env;
char *e, *v;
GHashTable *env_table;
@@ -1372,6 +1378,7 @@ get_child_environment (TerminalScreen *screen,
window = gtk_widget_get_toplevel (term);
g_assert (window != NULL);
g_assert (gtk_widget_is_toplevel (window));
+ display = gdk_window_get_display (gtk_widget_get_window (window));
env_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -1404,8 +1411,11 @@ get_child_environment (TerminalScreen *screen,
#ifdef GDK_WINDOWING_X11
/* FIXME: moving the tab between windows, or the window between displays will make the next two invalid... */
- g_hash_table_replace (env_table, g_strdup ("WINDOWID"), g_strdup_printf ("%ld", GDK_WINDOW_XWINDOW (gtk_widget_get_window (window))));
- g_hash_table_replace (env_table, g_strdup ("DISPLAY"), g_strdup (gdk_display_get_name (gtk_widget_get_display (window))));
+ if (GDK_IS_X11_DISPLAY(display))
+ {
+ g_hash_table_replace (env_table, g_strdup ("WINDOWID"), g_strdup_printf ("%ld", GDK_WINDOW_XWINDOW (gtk_widget_get_window (window))));
+ g_hash_table_replace (env_table, g_strdup ("DISPLAY"), g_strdup (gdk_display_get_name (display)));
+ }
#endif
list_schemas = g_settings_list_schemas();
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 33f1180..43333bf 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -24,6 +24,9 @@
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#ifndef GDK_IS_X11_DISPLAY
+#define GDK_IS_X11_DISPLAY(display) 1
+#endif
#endif
#include <gdk/gdkkeysyms.h>
@@ -1521,7 +1524,7 @@ terminal_window_realize (GtkWidget *widget)
{
TerminalWindow *window = TERMINAL_WINDOW (widget);
TerminalWindowPrivate *priv = window->priv;
-#ifdef GDK_WINDOWING_X11
+#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
GdkScreen *screen;
GtkAllocation widget_allocation;
#if GTK_CHECK_VERSION (3, 0, 0)
@@ -1735,12 +1738,15 @@ terminal_window_screen_update (TerminalWindow *window,
{
TerminalApp *app;
- terminal_window_window_manager_changed_cb (screen, window);
- g_signal_connect (screen, "window-manager-changed",
- G_CALLBACK (terminal_window_window_manager_changed_cb), window);
#ifdef GDK_WINDOWING_X11
- g_signal_connect (screen, "composited-changed",
- G_CALLBACK (terminal_window_composited_changed_cb), window);
+ if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
+ {
+ terminal_window_window_manager_changed_cb (screen, window);
+ g_signal_connect (screen, "window-manager-changed",
+ G_CALLBACK (terminal_window_window_manager_changed_cb), window);
+ g_signal_connect (screen, "composited-changed",
+ G_CALLBACK (terminal_window_composited_changed_cb), window);
+ }
#endif
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection")))
@@ -1776,13 +1782,16 @@ terminal_window_screen_changed (GtkWidget *widget,
if (previous_screen)
{
- g_signal_handlers_disconnect_by_func (previous_screen,
- G_CALLBACK (terminal_window_window_manager_changed_cb),
- window);
#ifdef GDK_WINDOWING_X11
- g_signal_handlers_disconnect_by_func (previous_screen,
- G_CALLBACK (terminal_window_composited_changed_cb),
- window);
+ if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (previous_screen)))
+ {
+ g_signal_handlers_disconnect_by_func (previous_screen,
+ G_CALLBACK (terminal_window_window_manager_changed_cb),
+ window);
+ g_signal_handlers_disconnect_by_func (previous_screen,
+ G_CALLBACK (terminal_window_composited_changed_cb),
+ window);
+ }
#endif
}
@@ -2331,13 +2340,16 @@ terminal_window_dispose (GObject *object)
screen = gtk_widget_get_screen (GTK_WIDGET (object));
if (screen)
{
- g_signal_handlers_disconnect_by_func (screen,
- G_CALLBACK (terminal_window_window_manager_changed_cb),
- window);
#ifdef GDK_WINDOWING_X11
- g_signal_handlers_disconnect_by_func (screen,
- G_CALLBACK (terminal_window_composited_changed_cb),
- window);
+ if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
+ {
+ g_signal_handlers_disconnect_by_func (screen,
+ G_CALLBACK (terminal_window_window_manager_changed_cb),
+ window);
+ g_signal_handlers_disconnect_by_func (screen,
+ G_CALLBACK (terminal_window_composited_changed_cb),
+ window);
+ }
#endif
}
diff --git a/src/terminal.c b/src/terminal.c
index 82af964..22c7813 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -31,7 +31,14 @@
#include <glib/gstdio.h>
#include <gio/gio.h>
+#include <gdk/gdk.h>
+
+#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#ifndef GDK_IS_X11_DISPLAY
+#define GDK_IS_X11_DISPLAY(display) 1
+#endif
+#endif
#ifdef WITH_SMCLIENT
#include "eggsmclient.h"
@@ -427,6 +434,7 @@ name_lost_cb (GDBusConnection *connection,
*
*/
+#ifdef GDK_WINDOWING_X11
/* Copied from libcaja/caja-program-choosing.c; Needed in case
* we have no DESKTOP_STARTUP_ID (with its accompanying timestamp).
*/
@@ -477,6 +485,7 @@ slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
return event.xproperty.time;
}
+#endif
static char *
get_factory_name_for_display (const char *display_name)
@@ -573,8 +582,12 @@ main (int argc, char **argv)
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE");
- /* Do this here so that gdk_display is initialized */
- if (options->startup_id == NULL)
+ display = gdk_display_get_default ();
+ display_name = gdk_display_get_name (display);
+ options->display_name = g_strdup (display_name);
+
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY(display) && options->startup_id == NULL)
{
/* Create a fake one containing a timestamp that we can use */
Time timestamp;
@@ -583,10 +596,7 @@ main (int argc, char **argv)
options->startup_id = g_strdup_printf ("_TIME%lu", timestamp);
}
-
- display = gdk_display_get_default ();
- display_name = gdk_display_get_name (display);
- options->display_name = g_strdup (display_name);
+#endif
if (options->use_factory)
{