Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: views/widget/gtk_views_window.cc

Issue 6487002: Add a new constructor to KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/views.gyp ('k') | views/widget/widget_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 #include "views/events/event.h" 6 #include "views/events/event.h"
7 #include "views/widget/gtk_views_window.h" 7 #include "views/widget/gtk_views_window.h"
8 #include "views/focus/focus_manager.h" 8 #include "views/focus/focus_manager.h"
9 9
10 G_BEGIN_DECLS 10 G_BEGIN_DECLS
11 11
12 G_DEFINE_TYPE(GtkViewsWindow, gtk_views_window, GTK_TYPE_WINDOW) 12 G_DEFINE_TYPE(GtkViewsWindow, gtk_views_window, GTK_TYPE_WINDOW)
13 13
14 static void gtk_views_window_move_focus(GtkWindow* window, 14 static void gtk_views_window_move_focus(GtkWindow* window,
15 GtkDirectionType dir) { 15 GtkDirectionType dir) {
16 views::FocusManager* focus_manager = 16 views::FocusManager* focus_manager =
17 views::FocusManager::GetFocusManagerForNativeWindow(window); 17 views::FocusManager::GetFocusManagerForNativeWindow(window);
18 if (focus_manager) { 18 if (focus_manager) {
19 GdkEvent* key = gtk_get_current_event(); 19 GdkEvent* key = gtk_get_current_event();
20 if (key && key->type == GDK_KEY_PRESS) { 20 if (key && key->type == GDK_KEY_PRESS) {
21 views::KeyEvent key_event(reinterpret_cast<GdkEventKey*>(key)); 21 views::KeyEvent key_event(key);
22 focus_manager->OnKeyEvent(key_event); 22 focus_manager->OnKeyEvent(key_event);
23 } 23 }
24 } else if (GTK_WINDOW_CLASS(gtk_views_window_parent_class)->move_focus) { 24 } else if (GTK_WINDOW_CLASS(gtk_views_window_parent_class)->move_focus) {
25 GTK_WINDOW_CLASS(gtk_views_window_parent_class)->move_focus(window, dir); 25 GTK_WINDOW_CLASS(gtk_views_window_parent_class)->move_focus(window, dir);
26 } 26 }
27 } 27 }
28 28
29 static void gtk_views_window_class_init( 29 static void gtk_views_window_class_init(
30 GtkViewsWindowClass* views_window_class) { 30 GtkViewsWindowClass* views_window_class) {
31 GtkWindowClass* window_class = 31 GtkWindowClass* window_class =
32 reinterpret_cast<GtkWindowClass*>(views_window_class); 32 reinterpret_cast<GtkWindowClass*>(views_window_class);
33 window_class->move_focus = gtk_views_window_move_focus; 33 window_class->move_focus = gtk_views_window_move_focus;
34 } 34 }
35 35
36 static void gtk_views_window_init(GtkViewsWindow* window) { 36 static void gtk_views_window_init(GtkViewsWindow* window) {
37 } 37 }
38 38
39 GtkWidget* gtk_views_window_new(GtkWindowType type) { 39 GtkWidget* gtk_views_window_new(GtkWindowType type) {
40 return GTK_WIDGET(g_object_new(GTK_TYPE_VIEWS_WINDOW, "type", type, NULL)); 40 return GTK_WIDGET(g_object_new(GTK_TYPE_VIEWS_WINDOW, "type", type, NULL));
41 } 41 }
42 42
43 G_END_DECLS 43 G_END_DECLS
OLDNEW
« no previous file with comments | « views/views.gyp ('k') | views/widget/widget_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698