[vlc-commits] Gtk: only use gdk_window_get_{width, height} when it is available

Cheng Sun git at videolan.org
Mon Feb 6 19:39:37 CET 2012


npapi-vlc | branch: master | Cheng Sun <chengsun9 at gmail.com> | Mon Feb  6 18:28:17 2012 +0000| [382ed111a8eb9676099cb304153c11a8e5ffa826] | committer: Cheng Sun

Gtk: only use gdk_window_get_{width,height} when it is available

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=382ed111a8eb9676099cb304153c11a8e5ffa826
---

 npapi/vlcplugin_gtk.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/npapi/vlcplugin_gtk.cpp b/npapi/vlcplugin_gtk.cpp
index c2808cf..8ce5291 100644
--- a/npapi/vlcplugin_gtk.cpp
+++ b/npapi/vlcplugin_gtk.cpp
@@ -272,9 +272,15 @@ static bool video_expose_handler(GtkWidget *widget, GdkEvent *event, gpointer us
     GdkPixbuf *cone_icon = plugin->cone_icon;
     if (!cone_icon) return false;
 
-    int winwidth   = gdk_window_get_width(window),
-        winheight  = gdk_window_get_height(window),
-        iconwidth  = gdk_pixbuf_get_width(cone_icon),
+    int winwidth, winheight;
+#   if GTK_CHECK_VERSION(2, 24, 0)
+        winwidth  = gdk_window_get_width(window);
+        winheight = gdk_window_get_height(window);
+#   else
+        gdk_drawable_get_size(GDK_DRAWABLE(window), &winwidth, &winheight);
+#   endif
+
+    int iconwidth  = gdk_pixbuf_get_width(cone_icon),
         iconheight = gdk_pixbuf_get_height(cone_icon);
     double widthratio  = (double) winwidth / iconwidth,
            heightratio = (double) winheight / iconheight;



More information about the vlc-commits mailing list