OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "views/controls/textfield/textfield.h" | 5 #include "views/controls/textfield/textfield.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 | 352 |
353 std::string Textfield::GetClassName() const { | 353 std::string Textfield::GetClassName() const { |
354 return kViewClassName; | 354 return kViewClassName; |
355 } | 355 } |
356 | 356 |
357 app::KeyboardCode Textfield::Keystroke::GetKeyboardCode() const { | 357 app::KeyboardCode Textfield::Keystroke::GetKeyboardCode() const { |
358 #if defined(OS_WIN) | 358 #if defined(OS_WIN) |
359 return static_cast<app::KeyboardCode>(key_); | 359 return static_cast<app::KeyboardCode>(key_); |
360 #else | 360 #else |
361 return static_cast<app::KeyboardCode>( | 361 return event_->GetKeyCode(); |
362 app::WindowsKeyCodeForGdkKeyCode(event_.keyval)); | |
363 #endif | 362 #endif |
364 } | 363 } |
365 | 364 |
366 #if defined(OS_WIN) | 365 #if defined(OS_WIN) |
367 bool Textfield::Keystroke::IsControlHeld() const { | 366 bool Textfield::Keystroke::IsControlHeld() const { |
368 return win_util::IsCtrlPressed(); | 367 return win_util::IsCtrlPressed(); |
369 } | 368 } |
370 | 369 |
371 bool Textfield::Keystroke::IsShiftHeld() const { | 370 bool Textfield::Keystroke::IsShiftHeld() const { |
372 return win_util::IsShiftPressed(); | 371 return win_util::IsShiftPressed(); |
373 } | 372 } |
374 #else | 373 #else |
375 bool Textfield::Keystroke::IsControlHeld() const { | 374 bool Textfield::Keystroke::IsControlHeld() const { |
376 return (event_.state & gtk_accelerator_get_default_mod_mask()) == | 375 return event_->IsControlDown(); |
377 GDK_CONTROL_MASK; | |
378 } | 376 } |
379 | 377 |
380 bool Textfield::Keystroke::IsShiftHeld() const { | 378 bool Textfield::Keystroke::IsShiftHeld() const { |
381 return (event_.state & gtk_accelerator_get_default_mod_mask()) == | 379 return event_->IsShiftDown(); |
382 GDK_SHIFT_MASK; | |
383 } | 380 } |
384 #endif | 381 #endif |
385 | 382 |
386 } // namespace views | 383 } // namespace views |
OLD | NEW |