diff options
author | robert.bradford@intel.com <robert.bradford@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 18:49:47 +0000 |
---|---|---|
committer | robert.bradford@intel.com <robert.bradford@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-30 18:49:47 +0000 |
commit | 119793819e3e285d8be921c4ae9006dcc73c7fe3 (patch) | |
tree | 2cf7c32a855ff70cad6ec3c56a4b6b11d3489a30 /ui | |
parent | 22d0ab9f741c59baee6b58f36df9f9ce7221b57f (diff) | |
download | chromium_src-119793819e3e285d8be921c4ae9006dcc73c7fe3.zip chromium_src-119793819e3e285d8be921c4ae9006dcc73c7fe3.tar.gz chromium_src-119793819e3e285d8be921c4ae9006dcc73c7fe3.tar.bz2 |
GTK: Port to gdk_x11_window_lookup_for_display
This API replaces gdk_window_lookup and gdk_xid_table_lookup which are
deprecated in 2.24. gdk_x11_window_lookup_for_display was added in 2.24.
As well porting the users to use this new API a compatability version was
added to the ui/base/gtk/gtk_compat.h file.
BUG=79722
TEST=Compiles and ui_unittests run. Chrome also runs.
Review URL: http://codereview.chromium.org/8632021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/gtk/gdk_x_compat.h | 27 | ||||
-rw-r--r-- | ui/base/x/active_window_watcher_x.cc | 5 | ||||
-rw-r--r-- | ui/base/x/x11_util.cc | 4 | ||||
-rw-r--r-- | ui/gfx/gtk_native_view_id_manager.cc | 3 |
4 files changed, 36 insertions, 3 deletions
diff --git a/ui/base/gtk/gdk_x_compat.h b/ui/base/gtk/gdk_x_compat.h new file mode 100644 index 0000000..d304bb9 --- /dev/null +++ b/ui/base/gtk/gdk_x_compat.h @@ -0,0 +1,27 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_GTK_GDK_X_COMPAT_H_ +#define UI_BASE_GTK_GDK_X_COMPAT_H_ +#pragma once + +#include <gdk/gdkx.h> + +// Google Chrome must depend on GTK 2.18, at least until the next LTS drops +// (and we might have to extend which version of GTK we want to target due to +// RHEL). To make our porting job for GTK3 easier, we define all the methods +// that replace deprecated APIs in this file and then include it everywhere. +// +// This file is organized first by version, and then with each version, +// alphabetically by method. + +#if !GTK_CHECK_VERSION(2, 24, 0) +inline GdkWindow* gdk_x11_window_lookup_for_display(GdkDisplay* display, + Window window) { + return static_cast<GdkWindow*>(gdk_xid_table_lookup_for_display(display, + window)); +} +#endif + +#endif // UI_BASE_GTK_GDK_X_COMPAT_H_ diff --git a/ui/base/x/active_window_watcher_x.cc b/ui/base/x/active_window_watcher_x.cc index 10cec2d..f766488 100644 --- a/ui/base/x/active_window_watcher_x.cc +++ b/ui/base/x/active_window_watcher_x.cc @@ -6,6 +6,8 @@ #include <gdk/gdk.h> #include <gdk/gdkx.h> +#include "ui/base/gtk/gtk_compat.h" +#include "ui/base/gtk/gdk_x_compat.h" #include "ui/base/x/active_window_watcher_x_observer.h" #include "ui/base/x/root_window_property_watcher_x.h" @@ -84,7 +86,8 @@ void ActiveWindowWatcherX::NotifyActiveWindowChanged() { // reason.) if (format == 32 && num_items == 1) { int xid = *reinterpret_cast<int*>(property); - GdkWindow* active_window = gdk_window_lookup(xid); + GdkDisplay* display = gdk_display_get_default(); + GdkWindow* active_window = gdk_x11_window_lookup_for_display(display, xid); FOR_EACH_OBSERVER(ActiveWindowWatcherXObserver, observers_, ActiveWindowChanged(active_window)); } diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc index 98faee5..53418bd 100644 --- a/ui/base/x/x11_util.cc +++ b/ui/base/x/x11_util.cc @@ -31,6 +31,8 @@ #include <gdk/gdk.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> +#include "ui/base/gtk/gtk_compat.h" +#include "ui/base/gtk/gdk_x_compat.h" #else // TODO(sad): Use the new way of handling X errors when // http://codereview.chromium.org/7889040/ lands. @@ -241,7 +243,7 @@ XID GetX11WindowFromGdkWindow(GdkWindow* window) { GtkWindow* GetGtkWindowFromX11Window(XID xid) { GdkWindow* gdk_window = - gdk_window_lookup_for_display(gdk_display_get_default(), xid); + gdk_x11_window_lookup_for_display(gdk_display_get_default(), xid); if (!gdk_window) return NULL; GtkWindow* gtk_window = NULL; diff --git a/ui/gfx/gtk_native_view_id_manager.cc b/ui/gfx/gtk_native_view_id_manager.cc index 4f1623d..6c053b4 100644 --- a/ui/gfx/gtk_native_view_id_manager.cc +++ b/ui/gfx/gtk_native_view_id_manager.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/rand_util.h" #include "ui/base/gtk/gtk_compat.h" +#include "ui/base/gtk/gdk_x_compat.h" #include "ui/gfx/gtk_preserve_window.h" // ----------------------------------------------------------------------------- @@ -174,7 +175,7 @@ void GtkNativeViewManager::ReleasePermanentXID(XID xid) { gtk_preserve_window_set_preserve(i->second.widget, FALSE); } else { GdkWindow* window = reinterpret_cast<GdkWindow*>( - gdk_xid_table_lookup(xid)); + gdk_x11_window_lookup_for_display(gdk_display_get_default(), xid)); DCHECK(window); gdk_window_destroy(window); } |