summaryrefslogtreecommitdiffstats
path: root/views/widget
diff options
context:
space:
mode:
Diffstat (limited to 'views/widget')
-rw-r--r--views/widget/native_widget_aura.cc2
-rw-r--r--views/widget/tooltip_manager_views.cc47
-rw-r--r--views/widget/tooltip_manager_views.h11
3 files changed, 40 insertions, 20 deletions
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc
index 9f50974..e2700ff 100644
--- a/views/widget/native_widget_aura.cc
+++ b/views/widget/native_widget_aura.cc
@@ -68,7 +68,7 @@ void NativeWidgetAura::UpdateFrameAfterFrameChange() {
}
bool NativeWidgetAura::ShouldUseNativeFrame() const {
- NOTIMPLEMENTED();
+ // There is only one frame type for aura.
return false;
}
diff --git a/views/widget/tooltip_manager_views.cc b/views/widget/tooltip_manager_views.cc
index d0d2a86..512bf28 100644
--- a/views/widget/tooltip_manager_views.cc
+++ b/views/widget/tooltip_manager_views.cc
@@ -4,8 +4,14 @@
#include "views/widget/tooltip_manager_views.h"
+#if defined(USE_X11)
#include <X11/Xlib.h>
#include <X11/extensions/XInput2.h>
+#endif
+
+#if defined(OS_WIN)
+#include <windowsx.h>
+#endif
#include "base/logging.h"
#include "base/time.h"
@@ -16,6 +22,7 @@
#include "ui/gfx/screen.h"
#include "views/background.h"
#include "views/border.h"
+#include "views/events/event.h"
#include "views/focus/focus_manager.h"
#include "views/view.h"
#include "views/widget/native_widget.h"
@@ -108,33 +115,29 @@ void TooltipManagerViews::HideKeyboardTooltip() {
#if defined(USE_WAYLAND)
base::MessagePumpObserver::EventStatus TooltipManagerViews::WillProcessEvent(
ui::WaylandEvent* event) {
- if (event->type == ui::WAYLAND_MOTION) {
- if (tooltip_timer_.IsRunning())
- tooltip_timer_.Reset();
- curr_mouse_pos_.SetPoint(event->motion.x, event->motion.y);
-
- // If tooltip is visible, we may want to hide it. If it is not, we are ok.
- if (tooltip_widget_->IsVisible())
- UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false);
- }
+ if (event->type == ui::WAYLAND_MOTION)
+ OnMouseMoved(event->motion.x, event->motion.y);
return base::MessagePumpObserver::EVENT_CONTINUE;
}
-#else
+#elif defined(USE_X11)
base::MessagePumpObserver::EventStatus TooltipManagerViews::WillProcessXEvent(
XEvent* xevent) {
XGenericEventCookie* cookie = &xevent->xcookie;
if (cookie->evtype == XI_Motion) {
XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data);
- if (tooltip_timer_.IsRunning())
- tooltip_timer_.Reset();
- curr_mouse_pos_.SetPoint((int) xievent->event_x, (int) xievent->event_y);
-
- // If tooltip is visible, we may want to hide it. If it is not, we are ok.
- if (tooltip_widget_->IsVisible())
- UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false);
+ OnMouseMoved(static_cast<int>(xievent->event_x),
+ static_cast<int>(xievent->event_y));
}
return base::MessagePumpObserver::EVENT_CONTINUE;
}
+#elif defined(OS_WIN)
+void TooltipManagerViews::WillProcessMessage(const MSG& msg) {
+ if (msg.message == WM_MOUSEMOVE)
+ OnMouseMoved(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
+}
+
+void TooltipManagerViews::DidProcessMessage(const MSG& msg) {
+}
#endif
void TooltipManagerViews::TooltipTimerFired() {
@@ -216,4 +219,14 @@ Widget* TooltipManagerViews::CreateTooltip() {
return widget;
}
+void TooltipManagerViews::OnMouseMoved(int x, int y) {
+ if (tooltip_timer_.IsRunning())
+ tooltip_timer_.Reset();
+ curr_mouse_pos_.SetPoint(x, y);
+
+ // If tooltip is visible, we may want to hide it. If it is not, we are ok.
+ if (tooltip_widget_->IsVisible())
+ UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false);
+}
+
} // namespace views
diff --git a/views/widget/tooltip_manager_views.h b/views/widget/tooltip_manager_views.h
index 648c7cb..3a154df 100644
--- a/views/widget/tooltip_manager_views.h
+++ b/views/widget/tooltip_manager_views.h
@@ -14,11 +14,12 @@
#include "views/widget/widget_delegate.h"
#include "views/view.h"
-typedef union _GdkEvent GdkEvent;
+#if defined(USE_X11)
typedef union _XEvent XEvent;
namespace ui {
union WaylandEvent;
}
+#endif
namespace views {
@@ -44,10 +45,13 @@ class TooltipManagerViews : public TooltipManager,
#if defined(USE_WAYLAND)
virtual base::MessagePumpObserver::EventStatus WillProcessEvent(
ui::WaylandEvent* event) OVERRIDE;
-#else
+#elif defined(USE_X11)
// MessageLoopForUI::Observer
virtual base::MessagePumpObserver::EventStatus WillProcessXEvent(
XEvent* xevent) OVERRIDE;
+#elif defined(OS_WIN)
+ virtual void WillProcessMessage(const MSG& msg) OVERRIDE;
+ virtual void DidProcessMessage(const MSG& msg) OVERRIDE;
#endif
private:
@@ -70,6 +74,9 @@ class TooltipManagerViews : public TooltipManager,
// Creates a widget of type TYPE_TOOLTIP
Widget* CreateTooltip();
+ // Invoked when the mose moves.
+ void OnMouseMoved(int x, int y);
+
scoped_ptr<Widget> tooltip_widget_;
internal::RootView* root_view_;
View* tooltip_view_;