| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/libgtk2ui/gtk2_key_bindings_handler.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 case GTK_DELETE_WORDS: | 250 case GTK_DELETE_WORDS: |
| 251 if (count > 0) { | 251 if (count > 0) { |
| 252 commands[0] = TextEditCommandAuraLinux::MOVE_WORD_FORWARD; | 252 commands[0] = TextEditCommandAuraLinux::MOVE_WORD_FORWARD; |
| 253 commands[1] = TextEditCommandAuraLinux::DELETE_WORD_BACKWARD; | 253 commands[1] = TextEditCommandAuraLinux::DELETE_WORD_BACKWARD; |
| 254 } else { | 254 } else { |
| 255 commands[0] = TextEditCommandAuraLinux::MOVE_WORD_BACKWARD; | 255 commands[0] = TextEditCommandAuraLinux::MOVE_WORD_BACKWARD; |
| 256 commands[1] = TextEditCommandAuraLinux::DELETE_WORD_FORWARD; | 256 commands[1] = TextEditCommandAuraLinux::DELETE_WORD_FORWARD; |
| 257 } | 257 } |
| 258 break; | 258 break; |
| 259 case GTK_DELETE_DISPLAY_LINES: | 259 case GTK_DELETE_DISPLAY_LINES: |
| 260 commands[0] = TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_LINE; | 260 commands[0] = TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_LINE; |
| 261 commands[1] = TextEditCommandAuraLinux::DELETE_TO_END_OF_LINE; | 261 commands[1] = TextEditCommandAuraLinux::DELETE_TO_END_OF_LINE; |
| 262 break; | 262 break; |
| 263 case GTK_DELETE_DISPLAY_LINE_ENDS: | 263 case GTK_DELETE_DISPLAY_LINE_ENDS: |
| 264 commands[0] = (count > 0 ? | 264 commands[0] = |
| 265 TextEditCommandAuraLinux::DELETE_TO_END_OF_LINE : | 265 (count > 0 ? TextEditCommandAuraLinux::DELETE_TO_END_OF_LINE |
| 266 TextEditCommandAuraLinux::DELETE_TO_BEGINING_OF_LINE); | 266 : TextEditCommandAuraLinux::DELETE_TO_BEGINNING_OF_LINE); |
| 267 break; | 267 break; |
| 268 case GTK_DELETE_PARAGRAPH_ENDS: | 268 case GTK_DELETE_PARAGRAPH_ENDS: |
| 269 commands[0] = (count > 0 ? | 269 commands[0] = |
| 270 TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH : | 270 (count > 0 |
| 271 TextEditCommandAuraLinux::DELETE_TO_BEGINING_OF_PARAGRAPH); | 271 ? TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH |
| 272 : TextEditCommandAuraLinux::DELETE_TO_BEGINNING_OF_PARAGRAPH); |
| 272 break; | 273 break; |
| 273 case GTK_DELETE_PARAGRAPHS: | 274 case GTK_DELETE_PARAGRAPHS: |
| 274 commands[0] = | 275 commands[0] = TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_PARAGRAPH; |
| 275 TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_PARAGRAPH; | 276 commands[1] = TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH; |
| 276 commands[1] = | |
| 277 TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH; | |
| 278 break; | 277 break; |
| 279 default: | 278 default: |
| 280 // GTK_DELETE_WHITESPACE has no corresponding editor command. | 279 // GTK_DELETE_WHITESPACE has no corresponding editor command. |
| 281 return; | 280 return; |
| 282 } | 281 } |
| 283 | 282 |
| 284 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); | 283 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); |
| 285 if (count < 0) | 284 if (count < 0) |
| 286 count = -count; | 285 count = -count; |
| 287 for (; count > 0; --count) { | 286 for (; count > 0; --count) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 command = (count > 0 ? | 319 command = (count > 0 ? |
| 321 TextEditCommandAuraLinux::MOVE_WORD_RIGHT : | 320 TextEditCommandAuraLinux::MOVE_WORD_RIGHT : |
| 322 TextEditCommandAuraLinux::MOVE_WORD_LEFT); | 321 TextEditCommandAuraLinux::MOVE_WORD_LEFT); |
| 323 break; | 322 break; |
| 324 case GTK_MOVEMENT_DISPLAY_LINES: | 323 case GTK_MOVEMENT_DISPLAY_LINES: |
| 325 command = (count > 0 ? | 324 command = (count > 0 ? |
| 326 TextEditCommandAuraLinux::MOVE_DOWN : | 325 TextEditCommandAuraLinux::MOVE_DOWN : |
| 327 TextEditCommandAuraLinux::MOVE_UP); | 326 TextEditCommandAuraLinux::MOVE_UP); |
| 328 break; | 327 break; |
| 329 case GTK_MOVEMENT_DISPLAY_LINE_ENDS: | 328 case GTK_MOVEMENT_DISPLAY_LINE_ENDS: |
| 330 command = (count > 0 ? | 329 command = |
| 331 TextEditCommandAuraLinux::MOVE_TO_END_OF_LINE : | 330 (count > 0 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_LINE |
| 332 TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_LINE); | 331 : TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_LINE); |
| 333 break; | 332 break; |
| 334 case GTK_MOVEMENT_PARAGRAPH_ENDS: | 333 case GTK_MOVEMENT_PARAGRAPH_ENDS: |
| 335 command = (count > 0 ? | 334 command = |
| 336 TextEditCommandAuraLinux::MOVE_TO_END_OF_PARAGRAPH : | 335 (count > 0 |
| 337 TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_PARAGRAPH); | 336 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_PARAGRAPH |
| 337 : TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_PARAGRAPH); |
| 338 break; | 338 break; |
| 339 case GTK_MOVEMENT_PAGES: | 339 case GTK_MOVEMENT_PAGES: |
| 340 command = (count > 0 ? TextEditCommandAuraLinux::MOVE_PAGE_DOWN : | 340 command = (count > 0 ? TextEditCommandAuraLinux::MOVE_PAGE_DOWN : |
| 341 TextEditCommandAuraLinux::MOVE_PAGE_UP); | 341 TextEditCommandAuraLinux::MOVE_PAGE_UP); |
| 342 break; | 342 break; |
| 343 case GTK_MOVEMENT_BUFFER_ENDS: | 343 case GTK_MOVEMENT_BUFFER_ENDS: |
| 344 command = (count > 0 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_DOCUMENT : | 344 command = |
| 345 TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_DOCUMENT); | 345 (count > 0 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_DOCUMENT |
| 346 : TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_DOCUMENT); |
| 346 break; | 347 break; |
| 347 default: | 348 default: |
| 348 // GTK_MOVEMENT_PARAGRAPHS and GTK_MOVEMENT_HORIZONTAL_PAGES have | 349 // GTK_MOVEMENT_PARAGRAPHS and GTK_MOVEMENT_HORIZONTAL_PAGES have |
| 349 // no corresponding editor commands. | 350 // no corresponding editor commands. |
| 350 return; | 351 return; |
| 351 } | 352 } |
| 352 | 353 |
| 353 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); | 354 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); |
| 354 if (count < 0) | 355 if (count < 0) |
| 355 count = -count; | 356 count = -count; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 // Just for disabling the default handler. | 397 // Just for disabling the default handler. |
| 397 return FALSE; | 398 return FALSE; |
| 398 } | 399 } |
| 399 | 400 |
| 400 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget, | 401 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget, |
| 401 GtkDirectionType arg1) { | 402 GtkDirectionType arg1) { |
| 402 // Just for disabling the default handler. | 403 // Just for disabling the default handler. |
| 403 } | 404 } |
| 404 | 405 |
| 405 } // namespace libgtk2ui | 406 } // namespace libgtk2ui |
| OLD | NEW |