summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 16:28:44 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 16:28:44 +0000
commit0e0e6d757d44f0b0a3678a714c0c09186e3aa6eb (patch)
treea2bcf52eaa02b828865954b6fb800fccee08463b /views
parentb57c599f4d27dbd93db10033d599fbb512611788 (diff)
downloadchromium_src-0e0e6d757d44f0b0a3678a714c0c09186e3aa6eb.zip
chromium_src-0e0e6d757d44f0b0a3678a714c0c09186e3aa6eb.tar.gz
chromium_src-0e0e6d757d44f0b0a3678a714c0c09186e3aa6eb.tar.bz2
Enabling the default button behavior on Linux toolkit_views.
I had to make the KeyEvent constructor include the event flags. Also cleaned-up some unit-tests BUG=None TEST=Run the unit-tests. Review URL: http://codereview.chromium.org/266012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28397 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/accelerator.h6
-rw-r--r--views/controls/button/custom_button.cc14
-rw-r--r--views/controls/button/native_button_gtk.cc7
-rw-r--r--views/event.cc8
-rw-r--r--views/event.h10
-rw-r--r--views/event_gtk.cc4
-rw-r--r--views/event_win.cc11
-rw-r--r--views/focus/accelerator_handler_win.cc1
-rw-r--r--views/focus/focus_manager_unittest.cc27
-rw-r--r--views/view.cc6
-rw-r--r--views/view_unittest.cc164
-rw-r--r--views/widget/widget_win.cc8
12 files changed, 105 insertions, 161 deletions
diff --git a/views/accelerator.h b/views/accelerator.h
index 1848c98..4aab592 100644
--- a/views/accelerator.h
+++ b/views/accelerator.h
@@ -37,7 +37,7 @@ class Accelerator {
modifiers_ = accelerator.modifiers_;
}
- ~Accelerator() { };
+ ~Accelerator() { }
Accelerator& operator=(const Accelerator& accelerator) {
if (this != &accelerator) {
@@ -79,6 +79,10 @@ class Accelerator {
return key_code_;
}
+ int modifiers() const {
+ return modifiers_;
+ }
+
// Returns a string with the localized shortcut if any.
std::wstring GetShortcutText() const;
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index 67ee098..91bc33c 100644
--- a/views/controls/button/custom_button.cc
+++ b/views/controls/button/custom_button.cc
@@ -94,18 +94,8 @@ bool CustomButton::IsTriggerableEvent(const MouseEvent& e) {
bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) {
if (enabled_) {
SetState(BS_NORMAL);
-#if defined(OS_WIN)
- KeyEvent key_event(Event::ET_KEY_RELEASED, accelerator.GetKeyCode(), 0, 0);
-#elif defined(OS_LINUX)
- GdkEventKey gdk_key;
- memset(&gdk_key, 0, sizeof(GdkEventKey));
- gdk_key.type = GDK_KEY_RELEASE;
- gdk_key.keyval = accelerator.GetKeyCode();
- gdk_key.state = (accelerator.IsAltDown() << 3) +
- (accelerator.IsCtrlDown() << 2) +
- accelerator.IsShiftDown();
- KeyEvent key_event(&gdk_key);
-#endif
+ KeyEvent key_event(Event::ET_KEY_RELEASED, accelerator.GetKeyCode(),
+ accelerator.modifiers(), 0, 0);
NotifyClick(key_event);
return true;
}
diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc
index fd58c42..17a25e2 100644
--- a/views/controls/button/native_button_gtk.cc
+++ b/views/controls/button/native_button_gtk.cc
@@ -55,7 +55,8 @@ void NativeButtonGtk::UpdateEnabled() {
void NativeButtonGtk::UpdateDefault() {
if (!native_view())
return;
- NOTIMPLEMENTED();
+ if (native_button_->is_default())
+ gtk_widget_grab_default(native_view());
}
View* NativeButtonGtk::GetView() {
@@ -96,6 +97,10 @@ void NativeButtonGtk::CreateNativeControl() {
GtkWidget* widget = gtk_button_new();
g_signal_connect(G_OBJECT(widget), "clicked",
G_CALLBACK(CallClicked), this);
+
+ // Any push button can become the default button.
+ GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT);
+
NativeControlCreated(widget);
}
diff --git a/views/event.cc b/views/event.cc
index 8e6a0f1..2f9834b 100644
--- a/views/event.cc
+++ b/views/event.cc
@@ -25,6 +25,14 @@ LocatedEvent::LocatedEvent(const LocatedEvent& model, View* from, View* to)
View::ConvertPointToView(from, to, &location_);
}
+KeyEvent::KeyEvent(EventType type, base::KeyboardCode key_code,
+ int event_flags, int repeat_count, int message_flags)
+ : Event(type, event_flags),
+ key_code_(key_code),
+ repeat_count_(repeat_count),
+ message_flags_(message_flags) {
+}
+
MouseEvent::MouseEvent(EventType type,
View* from,
View* to,
diff --git a/views/event.h b/views/event.h
index 138327d..d7831ce 100644
--- a/views/event.h
+++ b/views/event.h
@@ -241,13 +241,13 @@ class MouseEvent : public LocatedEvent {
////////////////////////////////////////////////////////////////////////////////
class KeyEvent : public Event {
public:
-#if defined(OS_WIN)
// Create a new key event
KeyEvent(EventType type,
base::KeyboardCode key_code,
+ int event_flags,
int repeat_count,
int message_flags);
-#elif defined(OS_LINUX)
+#if defined(OS_LINUX)
explicit KeyEvent(GdkEventKey* event);
#endif
@@ -267,11 +267,13 @@ class KeyEvent : public Event {
return repeat_count_;
}
- private:
#if defined(OS_WIN)
- int GetKeyStateFlags() const;
+ // Returns the current state of the KeyState.
+ static int GetKeyStateFlags();
#endif
+ private:
+
base::KeyboardCode key_code_;
int repeat_count_;
int message_flags_;
diff --git a/views/event_gtk.cc b/views/event_gtk.cc
index c5970b7..cb76e76 100644
--- a/views/event_gtk.cc
+++ b/views/event_gtk.cc
@@ -10,9 +10,6 @@
namespace views {
-// TODO(jcampan): the same physical key can send different keyvals (ex: a or A).
-// In order for accelerators to work, we need to normalize that. The right
-// solution should probably to get the key-code out of the keystate.
KeyEvent::KeyEvent(GdkEventKey* event)
: Event(event->type == GDK_KEY_PRESS ?
Event::ET_KEY_PRESSED : Event::ET_KEY_RELEASED,
@@ -23,6 +20,7 @@ KeyEvent::KeyEvent(GdkEventKey* event)
message_flags_(0) {
}
+// static
int Event::GetFlagsFromGdkState(int state) {
int flags = 0;
if (state & GDK_CONTROL_MASK)
diff --git a/views/event_win.cc b/views/event_win.cc
index da6457e..5542f59 100644
--- a/views/event_win.cc
+++ b/views/event_win.cc
@@ -37,15 +37,8 @@ int Event::ConvertWindowsFlags(UINT win_flags) {
return r;
}
-KeyEvent::KeyEvent(EventType type, base::KeyboardCode key_code,
- int repeat_count, int message_flags)
- : Event(type, GetKeyStateFlags()),
- key_code_(key_code),
- repeat_count_(repeat_count),
- message_flags_(message_flags) {
-}
-
-int KeyEvent::GetKeyStateFlags() const {
+// static
+int KeyEvent::GetKeyStateFlags() {
// Windows Keyboard messages don't come with control key state as parameters
// like mouse messages do, so we need to explicitly probe for these key
// states.
diff --git a/views/focus/accelerator_handler_win.cc b/views/focus/accelerator_handler_win.cc
index ee5c5b7..64b51f4 100644
--- a/views/focus/accelerator_handler_win.cc
+++ b/views/focus/accelerator_handler_win.cc
@@ -26,6 +26,7 @@ bool AcceleratorHandler::Dispatch(const MSG& msg) {
case WM_SYSKEYDOWN: {
KeyEvent event(Event::ET_KEY_PRESSED,
win_util::WinToKeyboardCode(msg.wParam),
+ KeyEvent::GetKeyStateFlags(),
msg.lParam & 0xFFFF,
(msg.lParam & 0xFFFF0000) >> 16);
process_message = focus_manager->OnKeyEvent(event);
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index 71f6fbd..3f88610 100644
--- a/views/focus/focus_manager_unittest.cc
+++ b/views/focus/focus_manager_unittest.cc
@@ -414,19 +414,19 @@ void FocusTraversalTest::InitContentView() {
y += label_height + gap_between_labels;
NativeButton* button = new NativeButton(NULL, L"Click me");
- button->SetBounds(label_x, y + 10, 50, 20);
+ button->SetBounds(label_x, y + 10, 80, 30);
button->SetID(kFruitButtonID);
left_container->AddChildView(button);
y += 40;
cb = new Checkbox(L"This is another check box");
- cb->SetBounds(label_x + label_width + 5, y, 150, 20);
+ cb->SetBounds(label_x + label_width + 5, y, 180, 20);
cb->SetID(kFruitCheckBoxID);
left_container->AddChildView(cb);
y += 20;
Combobox* combobox = new Combobox(&combobox_model_);
- combobox->SetBounds(label_x + label_width + 5, y, 150, 20);
+ combobox->SetBounds(label_x + label_width + 5, y, 150, 30);
combobox->SetID(kComboboxID);
left_container->AddChildView(combobox);
@@ -439,7 +439,7 @@ void FocusTraversalTest::InitContentView() {
right_container->SetBounds(270, 35, 300, 200);
y = 10;
- int radio_button_height = 15;
+ int radio_button_height = 18;
int gap_between_radio_buttons = 10;
RadioButton* radio_button = new RadioButton(L"Asparagus", 1);
radio_button->SetID(kAsparagusButtonID);
@@ -507,22 +507,23 @@ void FocusTraversalTest::InitContentView() {
}
y = 250;
- int width = 50;
+ int width = 60;
button = new NativeButton(NULL, L"OK");
button->SetID(kOKButtonID);
+ button->SetIsDefault(true);
content_view_->AddChildView(button);
- button->SetBounds(150, y, width, 20);
+ button->SetBounds(150, y, width, 30);
button = new NativeButton(NULL, L"Cancel");
button->SetID(kCancelButtonID);
content_view_->AddChildView(button);
- button->SetBounds(250, y, width, 20);
+ button->SetBounds(220, y, width, 30);
button = new NativeButton(NULL, L"Help");
button->SetID(kHelpButtonID);
content_view_->AddChildView(button);
- button->SetBounds(350, y, width, 20);
+ button->SetBounds(290, y, width, 30);
y += 40;
@@ -571,20 +572,20 @@ void FocusTraversalTest::InitContentView() {
button = new NativeButton(NULL, L"Search");
contents->AddChildView(button);
- button->SetBounds(115, 10, 50, 20);
+ button->SetBounds(112, 5, 60, 30);
button->SetID(kSearchButtonID);
link = new Link(L"Help");
link->SetHorizontalAlignment(Label::ALIGN_LEFT);
link->SetID(kHelpLinkID);
contents->AddChildView(link);
- link->SetBounds(170, 20, 30, 15);
+ link->SetBounds(175, 10, 30, 20);
search_border_view_ = new BorderView(contents);
search_border_view_->SetID(kSearchContainerID);
content_view_->AddChildView(search_border_view_);
- search_border_view_->SetBounds(300, y, 200, 50);
+ search_border_view_->SetBounds(300, y, 240, 50);
y += 60;
@@ -594,11 +595,11 @@ void FocusTraversalTest::InitContentView() {
contents->SetID(kThumbnailContainerID);
button = new NativeButton(NULL, L"Star");
contents->AddChildView(button);
- button->SetBounds(5, 5, 50, 20);
+ button->SetBounds(5, 5, 50, 30);
button->SetID(kThumbnailStarID);
button = new NativeButton(NULL, L"SuperStar");
contents->AddChildView(button);
- button->SetBounds(60, 5, 100, 20);
+ button->SetBounds(60, 5, 100, 30);
button->SetID(kThumbnailSuperStarID);
content_view_->AddChildView(contents);
diff --git a/views/view.cc b/views/view.cc
index 3c5d77b..232da55 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -988,8 +988,6 @@ void View::RemoveAccelerator(const Accelerator& accelerator) {
return;
}
- // TODO(port): Fix this once we have a FocusManger for Linux.
-#if defined(OS_WIN)
FocusManager* focus_manager = GetFocusManager();
if (focus_manager) {
// We may not have a FocusManager if the window containing us is being
@@ -997,7 +995,6 @@ void View::RemoveAccelerator(const Accelerator& accelerator) {
// nothing to unregister.
focus_manager->UnregisterAccelerator(accelerator, this);
}
-#endif
}
void View::ResetAccelerators() {
@@ -1047,8 +1044,6 @@ void View::UnregisterAccelerators() {
RootView* root_view = GetRootView();
if (root_view) {
- // TODO(port): Fix this once we have a FocusManger for Linux.
-#if defined(OS_WIN)
FocusManager* focus_manager = GetFocusManager();
if (focus_manager) {
// We may not have a FocusManager if the window containing us is being
@@ -1059,7 +1054,6 @@ void View::UnregisterAccelerators() {
accelerators_->clear();
accelerators_.reset();
registered_accelerator_count_ = 0;
-#endif
}
}
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index cf942b6..a326c12 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -999,17 +999,15 @@ TEST_F(ViewTest, DISABLED_RerouteMouseWheelTest) {
}
#endif
-#if defined(OS_WIN)
////////////////////////////////////////////////////////////////////////////////
// Dialogs' default button
////////////////////////////////////////////////////////////////////////////////
-class TestDialogView : public views::View,
- public views::DialogDelegate,
- public views::ButtonListener {
+class TestDialog : public DialogDelegate, public ButtonListener {
public:
- TestDialogView()
- : button1_(NULL),
+ TestDialog()
+ : contents_(NULL),
+ button1_(NULL),
button2_(NULL),
checkbox_(NULL),
last_pressed_button_(NULL),
@@ -1023,14 +1021,16 @@ class TestDialogView : public views::View,
}
virtual View* GetContentsView() {
- views::View* container = new views::View();
- button1_ = new views::NativeButton(this, L"Button1");
- button2_ = new views::NativeButton(this, L"Button2");
- checkbox_ = new views::Checkbox(L"My checkbox");
- container->AddChildView(button1_);
- container->AddChildView(button2_);
- container->AddChildView(checkbox_);
- return container;
+ if (!contents_) {
+ contents_ = new View();
+ button1_ = new NativeButton(this, L"Button1");
+ button2_ = new NativeButton(this, L"Button2");
+ checkbox_ = new Checkbox(L"My checkbox");
+ contents_->AddChildView(button1_);
+ contents_->AddChildView(button2_);
+ contents_->AddChildView(checkbox_);
+ }
+ return contents_;
}
// Prevent the dialog from really closing (so we can click the OK/Cancel
@@ -1055,10 +1055,11 @@ class TestDialogView : public views::View,
last_pressed_button_ = NULL;
}
- views::NativeButton* button1_;
- views::NativeButton* button2_;
- views::NativeButton* checkbox_;
- views::Button* last_pressed_button_;
+ View* contents_;
+ NativeButton* button1_;
+ NativeButton* button2_;
+ NativeButton* checkbox_;
+ Button* last_pressed_button_;
bool canceled_;
bool oked_;
@@ -1074,21 +1075,21 @@ class DefaultButtonTest : public ViewTest {
};
DefaultButtonTest()
- : native_window_(NULL),
- focus_manager_(NULL),
+ : focus_manager_(NULL),
+ test_dialog_(NULL),
client_view_(NULL),
ok_button_(NULL),
cancel_button_(NULL) {
}
virtual void SetUp() {
- dialog_view_ = new TestDialogView();
+ test_dialog_ = new TestDialog();
views::Window* window =
views::Window::CreateChromeWindow(NULL, gfx::Rect(0, 0, 100, 100),
- dialog_view_);
+ test_dialog_);
window->Show();
- native_window_ = window->GetNativeWindow();
- focus_manager_ = FocusManager::GetFocusManagerForNativeView(native_window_);
+ focus_manager_ = test_dialog_->contents_->GetFocusManager();
+ ASSERT_TRUE(focus_manager_ != NULL);
client_view_ =
static_cast<views::DialogClientView*>(window->GetClientView());
ok_button_ = client_view_->ok_button();
@@ -1096,43 +1097,37 @@ class DefaultButtonTest : public ViewTest {
}
void SimularePressingEnterAndCheckDefaultButton(ButtonID button_id) {
-#if defined(OS_WIN)
- KeyEvent event(Event::ET_KEY_PRESSED, base::VKEY_RETURN, 0, 0);
+ KeyEvent event(Event::ET_KEY_PRESSED, base::VKEY_RETURN, 0, 0, 0);
focus_manager_->OnKeyEvent(event);
-#else
- // TODO(platform)
- return;
-#endif
switch (button_id) {
case OK:
- EXPECT_TRUE(dialog_view_->oked_);
- EXPECT_FALSE(dialog_view_->canceled_);
- EXPECT_FALSE(dialog_view_->last_pressed_button_);
+ EXPECT_TRUE(test_dialog_->oked_);
+ EXPECT_FALSE(test_dialog_->canceled_);
+ EXPECT_FALSE(test_dialog_->last_pressed_button_);
break;
case CANCEL:
- EXPECT_FALSE(dialog_view_->oked_);
- EXPECT_TRUE(dialog_view_->canceled_);
- EXPECT_FALSE(dialog_view_->last_pressed_button_);
+ EXPECT_FALSE(test_dialog_->oked_);
+ EXPECT_TRUE(test_dialog_->canceled_);
+ EXPECT_FALSE(test_dialog_->last_pressed_button_);
break;
case BUTTON1:
- EXPECT_FALSE(dialog_view_->oked_);
- EXPECT_FALSE(dialog_view_->canceled_);
- EXPECT_TRUE(dialog_view_->last_pressed_button_ ==
- dialog_view_->button1_);
+ EXPECT_FALSE(test_dialog_->oked_);
+ EXPECT_FALSE(test_dialog_->canceled_);
+ EXPECT_TRUE(test_dialog_->last_pressed_button_ ==
+ test_dialog_->button1_);
break;
case BUTTON2:
- EXPECT_FALSE(dialog_view_->oked_);
- EXPECT_FALSE(dialog_view_->canceled_);
- EXPECT_TRUE(dialog_view_->last_pressed_button_ ==
- dialog_view_->button2_);
+ EXPECT_FALSE(test_dialog_->oked_);
+ EXPECT_FALSE(test_dialog_->canceled_);
+ EXPECT_TRUE(test_dialog_->last_pressed_button_ ==
+ test_dialog_->button2_);
break;
}
- dialog_view_->ResetStates();
+ test_dialog_->ResetStates();
}
- gfx::NativeWindow native_window_;
views::FocusManager* focus_manager_;
- TestDialogView* dialog_view_;
+ TestDialog* test_dialog_;
DialogClientView* client_view_;
views::NativeButton* ok_button_;
views::NativeButton* cancel_button_;
@@ -1147,44 +1142,43 @@ TEST_F(DefaultButtonTest, DialogDefaultButtonTest) {
SimularePressingEnterAndCheckDefaultButton(OK);
// Simulate focusing another button, it should become the default button.
- client_view_->FocusWillChange(ok_button_, dialog_view_->button1_);
+ client_view_->FocusWillChange(ok_button_, test_dialog_->button1_);
EXPECT_FALSE(ok_button_->is_default());
- EXPECT_TRUE(dialog_view_->button1_->is_default());
+ EXPECT_TRUE(test_dialog_->button1_->is_default());
// Simulate pressing enter, that should trigger button1.
SimularePressingEnterAndCheckDefaultButton(BUTTON1);
// Now select something that is not a button, the OK should become the default
// button again.
- client_view_->FocusWillChange(dialog_view_->button1_,
- dialog_view_->checkbox_);
+ client_view_->FocusWillChange(test_dialog_->button1_,
+ test_dialog_->checkbox_);
EXPECT_TRUE(ok_button_->is_default());
- EXPECT_FALSE(dialog_view_->button1_->is_default());
+ EXPECT_FALSE(test_dialog_->button1_->is_default());
SimularePressingEnterAndCheckDefaultButton(OK);
// Select yet another button.
- client_view_->FocusWillChange(dialog_view_->checkbox_,
- dialog_view_->button2_);
+ client_view_->FocusWillChange(test_dialog_->checkbox_,
+ test_dialog_->button2_);
EXPECT_FALSE(ok_button_->is_default());
- EXPECT_FALSE(dialog_view_->button1_->is_default());
- EXPECT_TRUE(dialog_view_->button2_->is_default());
+ EXPECT_FALSE(test_dialog_->button1_->is_default());
+ EXPECT_TRUE(test_dialog_->button2_->is_default());
SimularePressingEnterAndCheckDefaultButton(BUTTON2);
// Focus nothing.
- client_view_->FocusWillChange(dialog_view_->button2_, NULL);
+ client_view_->FocusWillChange(test_dialog_->button2_, NULL);
EXPECT_TRUE(ok_button_->is_default());
- EXPECT_FALSE(dialog_view_->button1_->is_default());
- EXPECT_FALSE(dialog_view_->button2_->is_default());
+ EXPECT_FALSE(test_dialog_->button1_->is_default());
+ EXPECT_FALSE(test_dialog_->button2_->is_default());
SimularePressingEnterAndCheckDefaultButton(OK);
// Focus the cancel button.
client_view_->FocusWillChange(NULL, cancel_button_);
EXPECT_FALSE(ok_button_->is_default());
EXPECT_TRUE(cancel_button_->is_default());
- EXPECT_FALSE(dialog_view_->button1_->is_default());
- EXPECT_FALSE(dialog_view_->button2_->is_default());
+ EXPECT_FALSE(test_dialog_->button1_->is_default());
+ EXPECT_FALSE(test_dialog_->button2_->is_default());
SimularePressingEnterAndCheckDefaultButton(CANCEL);
}
-#endif
////////////////////////////////////////////////////////////////////////////////
// View hierachy / Visibility changes
@@ -1213,49 +1207,3 @@ TEST_F(ViewTest, ChangeVisibility) {
native->SetVisible(true);
}
*/
-
-#if defined(OS_LINUX)
-class TestViewWithControls : public View {
- public:
- TestViewWithControls() {
- button_ = new NativeButton(NULL, L"Button");
- checkbox_ = new Checkbox(L"My checkbox");
- text_field_ = new Textfield();
- AddChildView(button_);
- button_->SetBounds(0, 0, 100, 30);
- AddChildView(checkbox_);
- checkbox_->SetBounds(0, 100, 100, 30);
- AddChildView(text_field_);
- text_field_->SetBounds(0, 200, 100, 30);
- text_field_->SetBackgroundColor(SK_ColorYELLOW);
- text_field_->SetFont(gfx::Font::CreateFont(L"Arial", 30));
- }
-
- Button* button_;
- Checkbox* checkbox_;
- Textfield* text_field_;
-};
-
-class SimpleWindowDelegate : public WindowDelegate {
- public:
- SimpleWindowDelegate(View* contents) : contents_(contents) { }
-
- virtual void DeleteDelegate() { delete this; }
-
- virtual View* GetContentsView() { return contents_; }
-
- private:
- View* contents_;
-};
-
-TEST_F(ViewTest, DISABLED_Stupid) {
- TestViewWithControls* view_with_controls = new TestViewWithControls();
- views::Window* window =
- views::Window::CreateChromeWindow(
- NULL, gfx::Rect(200, 200, 500, 500),
- new SimpleWindowDelegate(view_with_controls));
- window->Show();
- AcceleratorHandler accelerator_handler;
- MessageLoopForUI::current()->Run(&accelerator_handler);
-}
-#endif
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index 6f30622..16f4860 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -571,8 +571,8 @@ void WidgetWin::OnInitMenuPopup(HMENU menu,
}
void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) {
- KeyEvent event(Event::ET_KEY_PRESSED,
- win_util::WinToKeyboardCode(c), rep_cnt, flags);
+ KeyEvent event(Event::ET_KEY_PRESSED, win_util::WinToKeyboardCode(c),
+ KeyEvent::GetKeyStateFlags(), rep_cnt, flags);
RootView* root_view = GetFocusedViewRootView();
if (!root_view)
root_view = root_view_.get();
@@ -581,8 +581,8 @@ void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) {
}
void WidgetWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) {
- KeyEvent event(Event::ET_KEY_RELEASED,
- win_util::WinToKeyboardCode(c), rep_cnt, flags);
+ KeyEvent event(Event::ET_KEY_RELEASED, win_util::WinToKeyboardCode(c),
+ KeyEvent::GetKeyStateFlags(), rep_cnt, flags);
RootView* root_view = GetFocusedViewRootView();
if (!root_view)
root_view = root_view_.get();