[Xfce4-commits] <xfce4-embed-plugin:master> Fixed compatibility with GTK+ 2.20

David Schneider noreply at xfce.org
Mon Jan 23 11:02:01 CET 2012


Updating branch refs/heads/master
         to f0198aa074f1023653dc016dea741714f9b0d844 (commit)
       from 3b5936b38cf20fd8fd8b2b56244741c7ff443e01 (commit)

commit f0198aa074f1023653dc016dea741714f9b0d844
Author: David Schneider <dnschneid at gmail.com>
Date:   Mon Jan 23 01:59:22 2012 -0800

    Fixed compatibility with GTK+ 2.20

 autogen.sh                   |    2 +-
 panel-plugin/embed-dialogs.c |    9 +++++----
 panel-plugin/embed.c         |   20 ++++++++++++++++++--
 panel-plugin/ewmh.c          |    3 ++-
 4 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index b099848..c49d180 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -29,5 +29,5 @@ EOF
   exit 1
 }
 
-XDT_AUTOGEN_REQUIRED_VERSION="4.7.3" \
+XDT_AUTOGEN_REQUIRED_VERSION="4.7.2" \
 exec xdt-autogen $@
diff --git a/panel-plugin/embed-dialogs.c b/panel-plugin/embed-dialogs.c
index abec1ee..1d9de71 100644
--- a/panel-plugin/embed-dialogs.c
+++ b/panel-plugin/embed-dialogs.c
@@ -23,6 +23,7 @@
 
 #include <string.h>
 #include <gtk/gtk.h>
+#include <X11/Xlib.h>
 
 #include <libxfce4ui/libxfce4ui.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
@@ -93,15 +94,15 @@ static void
 embed_entry_set_good (GtkEntry *edit, gboolean good)
 {
   if (good) {
-    gtk_entry_set_icon_tooltip_text (edit, GTK_ENTRY_ICON_SECONDARY,
-                                     _("Input is valid"));
     gtk_entry_set_icon_from_stock (edit, GTK_ENTRY_ICON_SECONDARY,
                                    GTK_STOCK_YES);
-  } else {
     gtk_entry_set_icon_tooltip_text (edit, GTK_ENTRY_ICON_SECONDARY,
-                                     _("Input is invalid"));
+                                     _("Input is valid"));
+  } else {
     gtk_entry_set_icon_from_stock (edit, GTK_ENTRY_ICON_SECONDARY,
                                    GTK_STOCK_NO);
+    gtk_entry_set_icon_tooltip_text (edit, GTK_ENTRY_ICON_SECONDARY,
+                                     _("Input is invalid"));
   }
 }
 
diff --git a/panel-plugin/embed.c b/panel-plugin/embed.c
index b92bfc5..de812d0 100644
--- a/panel-plugin/embed.c
+++ b/panel-plugin/embed.c
@@ -25,6 +25,7 @@
 #endif
 
 #include <gtk/gtk.h>
+#include <X11/Xlib.h>
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4panel/xfce-hvbox.h>
@@ -33,6 +34,12 @@
 #include "embed.h"
 #include "embed-dialogs.h"
 
+/* GTK < 2.24 compatibility */
+#if !GTK_CHECK_VERSION(2,24,0)
+#define gdk_x11_window_foreign_new_for_display \
+          gdk_window_foreign_new_for_display
+#endif
+
 /* default settings */
 #define DEFAULT_PROC_NAME    NULL
 #define DEFAULT_WINDOW_REGEX NULL
@@ -506,7 +513,7 @@ embed_launch_command (EmbedPlugin *embed)
        * with the actual socket id. */
       socketpos = g_strdup_printf ("%.*s%lu%s",
           (gint)(socketpos - embed->launch_cmd), embed->launch_cmd,
-          (intptr_t)gtk_socket_get_id (GTK_SOCKET (embed->socket)),
+          (gulong)gtk_socket_get_id (GTK_SOCKET (embed->socket)),
           socketpos + strlen (EMBED_LAUNCH_CMD_SOCKET));
       if (!g_spawn_command_line_async (socketpos, NULL)) {
         DBG ("launch failed");
@@ -658,8 +665,12 @@ embed_plug_added (GtkWidget *socket, EmbedPlugin *embed)
   } else {
     /* Grab the GtkPlug's window. */
     embed->plug_window = gtk_socket_get_plug_window (GTK_SOCKET (embed->socket));
-    if (embed->plug_window)
+    if (embed->plug_window) {
       embed->plug = gdk_x11_drawable_get_xid (GDK_DRAWABLE (embed->plug_window));
+    } else {
+      DBG ("failed to get plug X11 window");
+      embed->plug = 0;
+    }
   }
   if (embed->plug_window && embed->plug) {
     /* Monitor for unmap/destroy events if it is not a standard GtkPlug. If the
@@ -716,6 +727,11 @@ embed_plug_removed (GtkWidget *socket, EmbedPlugin *embed)
   gtk_widget_show (embed->embed_menu);
   embed->has_plug = FALSE;
 
+  /* If this was a GtkPlug, the plug has been destroyed and embed->plug is
+   * now an invalid window. */
+  if (embed->plug_is_gtkplug)
+    embed->plug = 0;
+
   /* Assume the socket will be destroyed after this returns, so get rid of our
    * reference. */
   embed->socket = NULL;
diff --git a/panel-plugin/ewmh.c b/panel-plugin/ewmh.c
index f8dd093..549cad3 100644
--- a/panel-plugin/ewmh.c
+++ b/panel-plugin/ewmh.c
@@ -24,8 +24,9 @@
 #include <string.h>
 #endif
 
-#include <X11/Xatom.h>
 #include <gtk/gtk.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 


More information about the Xfce4-commits mailing list