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

Side by Side Diff: chrome/browser/gtk/browser_window_gtk.cc

Issue 99103: Filter modifier to only include accelerator modifiers. (Closed)
Patch Set: Created 11 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/gtk/browser_window_gtk.h" 5 #include "chrome/browser/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include "base/base_paths_linux.h" 9 #include "base/base_paths_linux.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 { GDK_g, IDC_FIND_NEXT, GDK_CONTROL_MASK }, 123 { GDK_g, IDC_FIND_NEXT, GDK_CONTROL_MASK },
124 { GDK_F3, IDC_FIND_NEXT, GdkModifierType(0) }, 124 { GDK_F3, IDC_FIND_NEXT, GdkModifierType(0) },
125 { GDK_g, IDC_FIND_PREVIOUS, 125 { GDK_g, IDC_FIND_PREVIOUS,
126 GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, 126 GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) },
127 { GDK_F3, IDC_FIND_PREVIOUS, GDK_SHIFT_MASK }, 127 { GDK_F3, IDC_FIND_PREVIOUS, GDK_SHIFT_MASK },
128 }; 128 };
129 129
130 int GetCommandId(guint accel_key, GdkModifierType modifier) { 130 int GetCommandId(guint accel_key, GdkModifierType modifier) {
131 // Bug 9806: If capslock is on, we will get a capital letter as accel_key. 131 // Bug 9806: If capslock is on, we will get a capital letter as accel_key.
132 accel_key = gdk_keyval_to_lower(accel_key); 132 accel_key = gdk_keyval_to_lower(accel_key);
133 // Filter modifier to only include accelerator modifiers.
134 modifier = static_cast<GdkModifierType>(
135 modifier & gtk_accelerator_get_default_mod_mask());
133 for (size_t i = 0; i < arraysize(kAcceleratorMap); ++i) { 136 for (size_t i = 0; i < arraysize(kAcceleratorMap); ++i) {
134 if (kAcceleratorMap[i].keyval == accel_key && 137 if (kAcceleratorMap[i].keyval == accel_key &&
135 kAcceleratorMap[i].modifier_type == modifier) 138 kAcceleratorMap[i].modifier_type == modifier)
136 return kAcceleratorMap[i].command_id; 139 return kAcceleratorMap[i].command_id;
137 } 140 }
138 NOTREACHED(); 141 NOTREACHED();
139 return 0; 142 return 0;
140 } 143 }
141 144
142 // An event handler for key press events. We need to special case key 145 // An event handler for key press events. We need to special case key
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 } else { 700 } else {
698 browser_window->ExecuteBrowserCommand(command_id); 701 browser_window->ExecuteBrowserCommand(command_id);
699 } 702 }
700 703
701 return TRUE; 704 return TRUE;
702 } 705 }
703 706
704 void BrowserWindowGtk::ExecuteBrowserCommand(int id) { 707 void BrowserWindowGtk::ExecuteBrowserCommand(int id) {
705 browser_->ExecuteCommand(id); 708 browser_->ExecuteCommand(id);
706 } 709 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698