chromium/ui/gtk/gtk_key_bindings_handler.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GTK_GTK_KEY_BINDINGS_HANDLER_H_
#define UI_GTK_GTK_KEY_BINDINGS_HANDLER_H_

#include <string>
#include <vector>

#include "base/memory/raw_ptr.h"
#include "ui/base/ime/linux/text_edit_command_auralinux.h"
#include "ui/events/platform_event.h"
#include "ui/gtk/gtk_compat.h"

namespace ui {
class Event;
}

namespace gtk {

// This class is a convenience class for handling editor key bindings defined
// in gtk keyboard theme.
// In gtk, only GtkEntry and GtkTextView support customizing editor key bindings
// through keyboard theme. And in gtk keyboard theme definition file, each key
// binding must be bound to a specific class or object. So existing keyboard
// themes only define editor key bindings exactly for GtkEntry and GtkTextView.
// Then, the only way for us to intercept editor key bindings defined in
// keyboard theme, is to create a GtkEntry or GtkTextView object and call
// gtk_bindings_activate_event() against it for the key events. If a key event
// matches a predefined key binding, corresponding signal will be emitted.
// GtkTextView is used here because it supports more key bindings than GtkEntry,
// but in order to minimize the side effect of using a GtkTextView object, a new
// class derived from GtkTextView is used, which overrides all signals related
// to key bindings, to make sure GtkTextView won't receive them.
//
// See third_party/blink/renderer/core/editing/commands/editor_command.cc for
// detailed definition of Blink edit commands.
class GtkKeyBindingsHandler {};

}  // namespace gtk

#endif  // UI_GTK_GTK_KEY_BINDINGS_HANDLER_H_