diff options
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/gtk_native_view_id_manager.cc | 16 | ||||
-rw-r--r-- | ui/gfx/gtk_native_view_id_manager.h | 5 | ||||
-rw-r--r-- | ui/gfx/gtk_preserve_window.cc | 8 |
3 files changed, 27 insertions, 2 deletions
diff --git a/ui/gfx/gtk_native_view_id_manager.cc b/ui/gfx/gtk_native_view_id_manager.cc index 3efc3c7..d2a3699 100644 --- a/ui/gfx/gtk_native_view_id_manager.cc +++ b/ui/gfx/gtk_native_view_id_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// 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. @@ -129,6 +129,20 @@ bool GtkNativeViewManager::GetPermanentXIDForId(XID* output, return true; } +bool GtkNativeViewManager::AddRefPermanentXID(XID xid) { + base::AutoLock locked(lock_); + + std::map<XID, PermanentXIDInfo>::iterator i = + perm_xid_to_info_.find(xid); + + if (i == perm_xid_to_info_.end()) + return false; + + i->second.ref_count++; + + return true; +} + void GtkNativeViewManager::ReleasePermanentXID(XID xid) { base::AutoLock locked(lock_); diff --git a/ui/gfx/gtk_native_view_id_manager.h b/ui/gfx/gtk_native_view_id_manager.h index 462a51d..6ea16a2 100644 --- a/ui/gfx/gtk_native_view_id_manager.h +++ b/ui/gfx/gtk_native_view_id_manager.h @@ -72,6 +72,11 @@ class GtkNativeViewManager { // returns: true if |id| is a valid id, false otherwise. bool GetPermanentXIDForId(XID* xid, gfx::NativeViewId id); + // Can be called from any thread. + // Will return false if the given XID isn't permanent or has already been + // released. + bool AddRefPermanentXID(XID xid); + // Must be called from the UI thread because we may need to access a // GtkWidget or destroy a GdkWindow. // diff --git a/ui/gfx/gtk_preserve_window.cc b/ui/gfx/gtk_preserve_window.cc index 174e23d..12585f3 100644 --- a/ui/gfx/gtk_preserve_window.cc +++ b/ui/gfx/gtk_preserve_window.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -82,6 +82,12 @@ static void gtk_preserve_window_realize(GtkWidget* widget) { gtk_widget_get_parent_window(widget), widget->allocation.x, widget->allocation.y); + GtkPreserveWindowPrivate* priv = GTK_PRESERVE_WINDOW_GET_PRIVATE(widget); + if (!priv->delegate_resize) { + gdk_window_resize(widget->window, + widget->allocation.width, + widget->allocation.height); + } widget->style = gtk_style_attach(widget->style, widget->window); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); |