| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_GTK_GTK_COMPAT_H_ | 5 #ifndef UI_BASE_GTK_GTK_COMPAT_H_ |
| 6 #define UI_BASE_GTK_GTK_COMPAT_H_ | 6 #define UI_BASE_GTK_GTK_COMPAT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 // Google Chrome must depend on GTK 2.18, at least until the next LTS drops | 11 // Google Chrome must depend on GTK 2.18, at least until the next LTS drops |
| 12 // (and we might have to extend which version of GTK we want to target due to | 12 // (and we might have to extend which version of GTK we want to target due to |
| 13 // RHEL). To make our porting job for GTK3 easier, we define all the methods | 13 // RHEL). To make our porting job for GTK3 easier, we define all the methods |
| 14 // that replace deprecated APIs in this file and then include it everywhere. | 14 // that replace deprecated APIs in this file and then include it everywhere. |
| 15 // | 15 // |
| 16 // This file is organized first by version, and then with each version, | 16 // This file is organized first by version, and then with each version, |
| 17 // alphabetically by method. | 17 // alphabetically by method. |
| 18 | 18 |
| 19 #if !GTK_CHECK_VERSION(2, 20, 0) | 19 #if !GTK_CHECK_VERSION(2, 20, 0) |
| 20 inline gboolean gtk_widget_get_mapped(GtkWidget* widget) { |
| 21 return GTK_WIDGET_MAPPED(widget); |
| 22 } |
| 23 |
| 20 inline gboolean gtk_widget_get_realized(GtkWidget* widget) { | 24 inline gboolean gtk_widget_get_realized(GtkWidget* widget) { |
| 21 return GTK_WIDGET_REALIZED(widget); | 25 return GTK_WIDGET_REALIZED(widget); |
| 22 } | 26 } |
| 23 | 27 |
| 24 inline gboolean gtk_widget_is_toplevel(GtkWidget* widget) { | 28 inline gboolean gtk_widget_is_toplevel(GtkWidget* widget) { |
| 25 return GTK_WIDGET_TOPLEVEL(widget); | 29 return GTK_WIDGET_TOPLEVEL(widget); |
| 26 } | 30 } |
| 31 |
| 32 inline void gtk_widget_set_mapped(GtkWidget* widget, |
| 33 gboolean mapped) { |
| 34 if (mapped) |
| 35 GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); |
| 36 else |
| 37 GTK_WIDGET_UNSET_FLAGS(widget, GTK_MAPPED); |
| 38 } |
| 39 |
| 40 inline void gtk_widget_set_realized(GtkWidget* widget, |
| 41 gboolean realized) { |
| 42 if (realized) |
| 43 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); |
| 44 else |
| 45 GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED); |
| 46 } |
| 27 #endif | 47 #endif |
| 28 | 48 |
| 29 #if !GTK_CHECK_VERSION(2, 22, 0) | 49 #if !GTK_CHECK_VERSION(2, 22, 0) |
| 30 inline gint gdk_visual_get_depth(GdkVisual* visual) { | 50 inline gint gdk_visual_get_depth(GdkVisual* visual) { |
| 31 return visual->depth; | 51 return visual->depth; |
| 32 } | 52 } |
| 33 #endif | 53 #endif |
| 34 | 54 |
| 35 #if !GTK_CHECK_VERSION(2, 24, 0) | 55 #if !GTK_CHECK_VERSION(2, 24, 0) |
| 36 inline void gdk_pixmap_get_size(GdkPixmap* pixmap, gint* width, gint* height) { | 56 inline void gdk_pixmap_get_size(GdkPixmap* pixmap, gint* width, gint* height) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 } | 68 } |
| 49 | 69 |
| 50 inline int gdk_window_get_width(GdkWindow* window) { | 70 inline int gdk_window_get_width(GdkWindow* window) { |
| 51 int width; | 71 int width; |
| 52 gdk_drawable_get_size(GDK_DRAWABLE(window), &width, NULL); | 72 gdk_drawable_get_size(GDK_DRAWABLE(window), &width, NULL); |
| 53 return width; | 73 return width; |
| 54 } | 74 } |
| 55 #endif | 75 #endif |
| 56 | 76 |
| 57 #endif // UI_BASE_GTK_GTK_COMPAT_H_ | 77 #endif // UI_BASE_GTK_GTK_COMPAT_H_ |
| OLD | NEW |