Gtk-minimo中的几个BUG
转载时请注明出处和作者联系方式
作者联系方式:李先静 <xianjimli at hotmail dot com>
颜色不正常:背景颜色和字体颜色随机变化,一会儿蓝一会白,甚至有时全变白色了,什么都看不见。我怀疑是内存越界或者使用了没有初始化的变量。但是用valgrind运行时没有任何发现迹象。只好手工去调试了,先在draw_glyph中设置断点,发现gc的颜色值不正常,进行一步跟踪发现UpdateGC后颜色没有生效,最后发现是nsGCCache::ReuseGC出了问题。原来在ReuseGC里面对于GTK+/DirectFB的处理有误,导致entry->gc的内容没有正常更新。我看了一下,那些判断并不会提高性能,就直接调用了gdk_gc_set_values强制更新。之后颜色恢复正常。
void nsGCCache::ReuseGC(GCCacheEntry *entry, GdkGCValues *gcv, GdkGCValuesMask flags)
{
gdk_gc_set_values(entry->gc, gcv, flags);
}
{
gdk_gc_set_values(entry->gc, gcv, flags);
}
状态栏隐藏之后不消失。我们发现在gtk_moz_embed_size_allocate函数中的参数完全正常,gtk_moz_embed的大小已经调整过了,但它就是没有重绘界面。mozilla的排版有点复杂,决定先花了两天时间看view/layout/dom目录中的代码再说。在有了大致的了解之后,我断定是viewmanager处理paint事件有问题,后来证实是判断view可见性有误。根据注释的提示,去掉对ViewObserver可见性的判断,gtk_moz_embed就刷新正常了。
static PRBool IsViewVisible(nsView *aView)
{
for (nsIView *view = aView; view; view = view->GetParent()) {
// We don't check widget visibility here because in the future (with
// the better approach to this that's in attachment 160801 on bug
// 227361), callers of the equivalent to this function should be able
// to rely on being notified when the result of this function changes.
if (view->GetVisibility() == nsViewVisibility_kHide)
7 return PR_FALSE;
}
return PR_TRUE;
// Find out if the root view is visible by asking the view observer
// (this won't be needed anymore if we link view trees across chrome /
// content boundaries in DocumentViewerImpl::MakeWindow).
nsIViewObserver* vo = aView->GetViewManager()->GetViewObserver();
return vo && vo->IsVisible();
}
{
for (nsIView *view = aView; view; view = view->GetParent()) {
// We don't check widget visibility here because in the future (with
// the better approach to this that's in attachment 160801 on bug
// 227361), callers of the equivalent to this function should be able
// to rely on being notified when the result of this function changes.
if (view->GetVisibility() == nsViewVisibility_kHide)
7 return PR_FALSE;
}
return PR_TRUE;
// Find out if the root view is visible by asking the view observer
// (this won't be needed anymore if we link view trees across chrome /
// content boundaries in DocumentViewerImpl::MakeWindow).
nsIViewObserver* vo = aView->GetViewManager()->GetViewObserver();
return vo && vo->IsVisible();
}
~~end~~