[gnome-terminal/gnome-3-4: 4/10] Add runtime checks for X11 specific code
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal/gnome-3-4: 4/10] Add runtime checks for X11 specific code
- Date: Tue, 7 Feb 2012 16:49:08 +0000 (UTC)
commit fc877ab0fce01bcd8ce105cc35db9fdfb447e5bc
Author: Alexander Larsson <alexl redhat com>
Date: Fri Jan 27 08:46:08 2012 +0100
Add runtime checks for X11 specific code
With this in place things work with the broadway backend too.
src/terminal-screen.c | 17 ++++++++---------
src/terminal-window.c | 29 ++++++++---------------------
src/terminal.c | 9 ++++++++-
3 files changed, 24 insertions(+), 31 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index b20b404..0be20a3 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1393,15 +1393,14 @@ get_child_environment (TerminalScreen *screen,
g_hash_table_replace (env_table, g_strdup ("COLORTERM"), g_strdup (EXECUTABLE_NAME));
#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",
-#if GTK_CHECK_VERSION (2, 91, 6)
- GDK_WINDOW_XID (gtk_widget_get_window (window))));
-#else
- GDK_WINDOW_XWINDOW (gtk_widget_get_window (window))));
-#endif
- g_hash_table_replace (env_table, g_strdup ("DISPLAY"), g_strdup (gdk_display_get_name (gtk_widget_get_display (window))));
+ if (GDK_IS_X11_SCREEN (gtk_widget_get_screen (window)))
+ {
+ /* 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_XID (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))));
+ }
#endif
terminal_util_add_proxy_env (env_table);
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 491bbaf..3eb7d88 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1518,16 +1518,12 @@ terminal_window_realize (GtkWidget *widget)
#ifdef GDK_WINDOWING_X11
GdkScreen *screen;
GtkAllocation widget_allocation;
-#if GTK_CHECK_VERSION (2, 90, 8)
GdkVisual *visual;
-#else
- GdkColormap *colormap;
-#endif
gtk_widget_get_allocation (widget, &widget_allocation);
screen = gtk_widget_get_screen (GTK_WIDGET (window));
-#if GTK_CHECK_VERSION (2, 90, 8)
if (gdk_screen_is_composited (screen) &&
+ GDK_IS_X11_SCREEN (screen) &&
(visual = gdk_screen_get_rgba_visual (screen)) != NULL)
{
/* Set RGBA visual if possible so VTE can use real transparency */
@@ -1539,20 +1535,6 @@ terminal_window_realize (GtkWidget *widget)
gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen));
priv->have_argb_visual = FALSE;
}
-#else
- if (gdk_screen_is_composited (screen) &&
- (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL)
- {
- /* Set RGBA colormap if possible so VTE can use real transparency */
- gtk_widget_set_colormap (widget, colormap);
- priv->have_argb_visual = TRUE;
- }
- else
- {
- gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen));
- priv->have_argb_visual = FALSE;
- }
-#endif
#endif
_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
@@ -1588,7 +1570,9 @@ terminal_window_map_event (GtkWidget *widget,
if (priv->clear_demands_attention)
{
#ifdef GDK_WINDOWING_X11
- terminal_util_x11_clear_demands_attention (gtk_widget_get_window (widget));
+ GdkWindow *window = gtk_widget_get_window (widget);
+ if (GDK_IS_X11_WINDOW (window))
+ terminal_util_x11_clear_demands_attention (window);
#endif
priv->clear_demands_attention = FALSE;
@@ -1638,7 +1622,9 @@ terminal_window_window_manager_changed_cb (GdkScreen *screen,
GtkAction *action;
gboolean supports_fs;
- supports_fs = gdk_x11_screen_supports_net_wm_hint (screen, gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE));
+ supports_fs = FALSE;
+ if (GDK_IS_X11_SCREEN (screen))
+ supports_fs = gdk_x11_screen_supports_net_wm_hint (screen, gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE));
action = gtk_action_group_get_action (priv->action_group, "ViewFullscreen");
gtk_action_set_sensitive (action, supports_fs);
@@ -1655,6 +1641,7 @@ terminal_window_composited_changed_cb (GdkScreen *screen,
composited = gdk_screen_is_composited (screen);
if ((composited != priv->have_argb_visual) &&
+ GDK_IS_X11_SCREEN (screen) &&
gtk_widget_get_realized (GTK_WIDGET (window)))
{
GtkWidget *widget = GTK_WIDGET (window);
diff --git a/src/terminal.c b/src/terminal.c
index 06de533..9b19aa4 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -409,6 +409,8 @@ name_lost_cb (GDBusConnection *connection,
*
*/
+#ifdef GDK_WINDOWING_X11
+
/* Copied from libnautilus/nautilus-program-choosing.c; Needed in case
* we have no DESKTOP_STARTUP_ID (with its accompanying timestamp).
*/
@@ -460,6 +462,8 @@ slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
return event.xproperty.time;
}
+#endif
+
static char *
get_factory_name_for_display (const char *display_name)
{
@@ -558,7 +562,9 @@ main (int argc, char **argv)
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE");
/* Do this here so that gdk_display is initialized */
- if (options->startup_id == NULL)
+#ifdef GDK_WINDOWING_X11
+ if (options->startup_id == NULL && GDK_IS_X11_DISPLAY (gdk_display_get_default ())
+ )
{
/* Create a fake one containing a timestamp that we can use */
Time timestamp;
@@ -567,6 +573,7 @@ main (int argc, char **argv)
options->startup_id = g_strdup_printf ("_TIME%lu", timestamp);
}
+#endif
display = gdk_display_get_default ();
display_name = gdk_display_get_name (display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]