| 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 #include "ui/gfx/gtk_native_view_id_manager.h" | 5 #include "ui/gfx/gtk_native_view_id_manager.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
| 12 #include "ui/base/gtk/gtk_compat.h" | 12 #include "ui/base/gtk/gtk_compat.h" |
| 13 #include "ui/base/gtk/gdk_x_compat.h" |
| 13 #include "ui/gfx/gtk_preserve_window.h" | 14 #include "ui/gfx/gtk_preserve_window.h" |
| 14 | 15 |
| 15 // ----------------------------------------------------------------------------- | 16 // ----------------------------------------------------------------------------- |
| 16 // Bounce functions for GTK to callback into a C++ object... | 17 // Bounce functions for GTK to callback into a C++ object... |
| 17 | 18 |
| 18 void OnRealize(gfx::NativeView widget, void* arg) { | 19 void OnRealize(gfx::NativeView widget, void* arg) { |
| 19 GtkNativeViewManager* manager = reinterpret_cast<GtkNativeViewManager*>(arg); | 20 GtkNativeViewManager* manager = reinterpret_cast<GtkNativeViewManager*>(arg); |
| 20 manager->OnRealize(widget); | 21 manager->OnRealize(widget); |
| 21 } | 22 } |
| 22 | 23 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 if (i == perm_xid_to_info_.end()) | 168 if (i == perm_xid_to_info_.end()) |
| 168 return; | 169 return; |
| 169 | 170 |
| 170 if (i->second.ref_count > 1) { | 171 if (i->second.ref_count > 1) { |
| 171 i->second.ref_count--; | 172 i->second.ref_count--; |
| 172 } else { | 173 } else { |
| 173 if (i->second.widget) { | 174 if (i->second.widget) { |
| 174 gtk_preserve_window_set_preserve(i->second.widget, FALSE); | 175 gtk_preserve_window_set_preserve(i->second.widget, FALSE); |
| 175 } else { | 176 } else { |
| 176 GdkWindow* window = reinterpret_cast<GdkWindow*>( | 177 GdkWindow* window = reinterpret_cast<GdkWindow*>( |
| 177 gdk_xid_table_lookup(xid)); | 178 gdk_x11_window_lookup_for_display(gdk_display_get_default(), xid)); |
| 178 DCHECK(window); | 179 DCHECK(window); |
| 179 gdk_window_destroy(window); | 180 gdk_window_destroy(window); |
| 180 } | 181 } |
| 181 perm_xid_to_info_.erase(i); | 182 perm_xid_to_info_.erase(i); |
| 182 } | 183 } |
| 183 } | 184 } |
| 184 | 185 |
| 185 // ----------------------------------------------------------------------------- | 186 // ----------------------------------------------------------------------------- |
| 186 | 187 |
| 187 | 188 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 243 |
| 243 if (k != perm_xid_to_info_.end()) | 244 if (k != perm_xid_to_info_.end()) |
| 244 k->second.widget = NULL; | 245 k->second.widget = NULL; |
| 245 } | 246 } |
| 246 | 247 |
| 247 native_view_to_id_.erase(i); | 248 native_view_to_id_.erase(i); |
| 248 id_to_info_.erase(j); | 249 id_to_info_.erase(j); |
| 249 } | 250 } |
| 250 | 251 |
| 251 // ----------------------------------------------------------------------------- | 252 // ----------------------------------------------------------------------------- |
| OLD | NEW |