+2009-02-18 Xan Lopez <xan@gnome.org>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23989
+
+ Based on a patch by Bo Yang <techrazy.yang@gmail.com>
+
+ Make the cursor cache global, that's all we really need and
+ otherwise we can miss cursor transitions in some situations (see
+ the bug for one testcase). Also remove some now useless code.
+
+ * platform/Widget.h:
+ * platform/gtk/WidgetGtk.cpp:
+ (WebCore::Widget::Widget):
+ (WebCore::Widget::~Widget):
+ (WebCore::Widget::setCursor):
+
2009-02-17 Adam Roben <aroben@apple.com>
Windows build fix
namespace WebCore {
-class WidgetPrivate {
-public:
- GdkCursor* cursor;
-};
+static GdkCursor* lastSetCursor;
Widget::Widget(PlatformWidget widget)
- : m_data(new WidgetPrivate)
{
init(widget);
- m_data->cursor = 0;
}
Widget::~Widget()
{
ASSERT(!parent());
releasePlatformWidget();
- delete m_data;
}
void Widget::setFocus()
gtk_widget_grab_focus(platformWidget() ? platformWidget() : GTK_WIDGET(root()->hostWindow()->platformWindow()));
}
-Cursor Widget::cursor()
-{
- return Cursor(m_data->cursor);
-}
-
static GdkDrawable* gdkDrawable(PlatformWidget widget)
{
return widget ? widget->window : 0;
void Widget::setCursor(const Cursor& cursor)
{
- GdkCursor* pcur = cursor.impl();
+ GdkCursor* platformCursor = cursor.impl();
// http://bugs.webkit.org/show_bug.cgi?id=16388
// [GTK] Widget::setCursor() gets called frequently
// gdk_window_set_cursor() in certain GDK backends seems to be an
// expensive operation, so avoid it if possible.
- if (pcur == m_data->cursor)
+ if (platformCursor == lastSetCursor)
return;
- gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformWindow())->window, pcur);
- m_data->cursor = pcur;
+ gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformWindow())->window, platformCursor);
+ lastSetCursor = platformCursor;
}
void Widget::show()