summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-15 23:15:07 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-15 23:15:07 +0000
commite2f0954d5f4ecbcd8b701e0b74b677c8b2ed3eeb (patch)
tree2417dc077c96404457f4dfae53490480cbdc5c64 /views
parent109f3d80239c07211d92286042bf7b77119ed9bf (diff)
downloadchromium_src-e2f0954d5f4ecbcd8b701e0b74b677c8b2ed3eeb.zip
chromium_src-e2f0954d5f4ecbcd8b701e0b74b677c8b2ed3eeb.tar.gz
chromium_src-e2f0954d5f4ecbcd8b701e0b74b677c8b2ed3eeb.tar.bz2
views-desktop: Fix updating the cursor for windows.
It is necessary to remember the cursor set for the associated widget in the NativeWidgetView so that it can return the correct cursor when the parent Widget requests for it. BUG=none TEST=manually (launch chrome with views-desktop, move cursor over a link/textfield and see the cursor change properly) Review URL: http://codereview.chromium.org/7633018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96852 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/native_widget_view.cc7
-rw-r--r--views/widget/native_widget_view.h6
-rw-r--r--views/widget/native_widget_views.cc1
3 files changed, 13 insertions, 1 deletions
diff --git a/views/widget/native_widget_view.cc b/views/widget/native_widget_view.cc
index 85cb30e..c816c0f 100644
--- a/views/widget/native_widget_view.cc
+++ b/views/widget/native_widget_view.cc
@@ -18,7 +18,8 @@ const char NativeWidgetView::kViewClassName[] = "views/NativeWidgetView";
NativeWidgetView::NativeWidgetView(NativeWidgetViews* native_widget)
: native_widget_(native_widget),
sent_create_(false),
- delete_native_widget_(true) {
+ delete_native_widget_(true),
+ cursor_(NULL) {
}
NativeWidgetView::~NativeWidgetView() {
@@ -69,6 +70,10 @@ void NativeWidgetView::OnPaint(gfx::Canvas* canvas) {
delegate()->OnNativeWidgetPaint(canvas);
}
+gfx::NativeCursor NativeWidgetView::GetCursor(const MouseEvent& event) {
+ return cursor_;
+}
+
bool NativeWidgetView::OnMousePressed(const MouseEvent& event) {
MouseEvent e(event, this);
return delegate()->OnMouseEvent(event);
diff --git a/views/widget/native_widget_view.h b/views/widget/native_widget_view.h
index 0a729a0..88131132 100644
--- a/views/widget/native_widget_view.h
+++ b/views/widget/native_widget_view.h
@@ -40,6 +40,8 @@ class VIEWS_EXPORT NativeWidgetView : public View {
delete_native_widget_ = delete_native_widget;
}
+ void set_cursor(gfx::NativeCursor cursor) { cursor_ = cursor; }
+
// Overridden from View:
virtual void SchedulePaintInternal(const gfx::Rect& r) OVERRIDE;
virtual void MarkLayerDirty() OVERRIDE;
@@ -53,6 +55,7 @@ class VIEWS_EXPORT NativeWidgetView : public View {
View* child) OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+ virtual gfx::NativeCursor GetCursor(const MouseEvent& event) OVERRIDE;
virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE;
virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE;
virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE;
@@ -86,6 +89,9 @@ class VIEWS_EXPORT NativeWidgetView : public View {
bool delete_native_widget_;
+ // The cursor set for the associated widget.
+ gfx::NativeCursor cursor_;
+
DISALLOW_COPY_AND_ASSIGN(NativeWidgetView);
};
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc
index 3814586..92ec9aa 100644
--- a/views/widget/native_widget_views.cc
+++ b/views/widget/native_widget_views.cc
@@ -477,6 +477,7 @@ void NativeWidgetViews::SchedulePaintInRect(const gfx::Rect& rect) {
}
void NativeWidgetViews::SetCursor(gfx::NativeCursor cursor) {
+ view_->set_cursor(cursor);
GetParentNativeWidget()->SetCursor(cursor);
}