#include "ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.h"
#include <sys/mman.h>
#include <string>
#include <string_view>
#include <utility>
#include "base/base64.h"
#include "base/check.h"
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/strings/strcat.h"
#include "base/strings/string_split.h"
#include "base/time/time.h"
#include "ui/base/wayland/wayland_client_input_types.h"
#include "ui/gfx/range/range.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_seat.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
namespace ui {
namespace {
uint32_t InputTypeToContentPurpose(TextInputType input_type) { … }
uint32_t InputFlagsToContentHint(int input_flags) { … }
std::vector<std::string> ParseModifiersMap(wl_array* array) { … }
std::optional<ZWPTextInputWrapperClient::SpanStyle::Style> ConvertStyle(
uint32_t style) { … }
}
ZWPTextInputWrapperV1::ZWPTextInputWrapperV1(
WaylandConnection* connection,
ZWPTextInputWrapperClient* client,
zwp_text_input_manager_v1* text_input_manager,
zcr_text_input_extension_v1* text_input_extension)
: … { … }
ZWPTextInputWrapperV1::~ZWPTextInputWrapperV1() = default;
void ZWPTextInputWrapperV1::Reset() { … }
void ZWPTextInputWrapperV1::Activate(WaylandWindow* window,
TextInputClient::FocusReason reason) { … }
void ZWPTextInputWrapperV1::Deactivate() { … }
void ZWPTextInputWrapperV1::ShowInputPanel() { … }
void ZWPTextInputWrapperV1::HideInputPanel() { … }
void ZWPTextInputWrapperV1::SetCursorRect(const gfx::Rect& rect) { … }
void ZWPTextInputWrapperV1::SetSurroundingText(
const std::string& text,
const gfx::Range& preedit_range,
const gfx::Range& selection_range) { … }
bool ZWPTextInputWrapperV1::HasAdvancedSurroundingTextSupport() const { … }
void ZWPTextInputWrapperV1::SetSurroundingTextOffsetUtf16(
uint32_t offset_utf16) { … }
void ZWPTextInputWrapperV1::SetContentType(ui::TextInputType type,
ui::TextInputMode mode,
uint32_t flags,
bool should_do_learning,
bool can_compose_inline) { … }
void ZWPTextInputWrapperV1::SetGrammarFragmentAtCursor(
const ui::GrammarFragment& fragment) { … }
void ZWPTextInputWrapperV1::SetAutocorrectInfo(
const gfx::Range& autocorrect_range,
const gfx::Rect& autocorrect_bounds) { … }
void ZWPTextInputWrapperV1::ResetInputEventState() { … }
void ZWPTextInputWrapperV1::TryScheduleFinalizeVirtualKeyboardChanges() { … }
void ZWPTextInputWrapperV1::FinalizeVirtualKeyboardChanges() { … }
bool ZWPTextInputWrapperV1::SupportsFinalizeVirtualKeyboardChanges() { … }
void ZWPTextInputWrapperV1::OnEnter(void* data,
struct zwp_text_input_v1* text_input,
struct wl_surface* surface) { … }
void ZWPTextInputWrapperV1::OnLeave(void* data,
struct zwp_text_input_v1* text_input) { … }
void ZWPTextInputWrapperV1::OnModifiersMap(void* data,
struct zwp_text_input_v1* text_input,
struct wl_array* map) { … }
void ZWPTextInputWrapperV1::OnInputPanelState(
void* data,
struct zwp_text_input_v1* text_input,
uint32_t state) { … }
void ZWPTextInputWrapperV1::OnPreeditString(
void* data,
struct zwp_text_input_v1* text_input,
uint32_t serial,
const char* text,
const char* commit) { … }
void ZWPTextInputWrapperV1::OnPreeditStyling(
void* data,
struct zwp_text_input_v1* text_input,
uint32_t index,
uint32_t length,
uint32_t style) { … }
void ZWPTextInputWrapperV1::OnPreeditCursor(
void* data,
struct zwp_text_input_v1* text_input,
int32_t index) { … }
void ZWPTextInputWrapperV1::OnCommitString(void* data,
struct zwp_text_input_v1* text_input,
uint32_t serial,
const char* text) { … }
void ZWPTextInputWrapperV1::OnCursorPosition(
void* data,
struct zwp_text_input_v1* text_input,
int32_t index,
int32_t anchor) { … }
void ZWPTextInputWrapperV1::OnDeleteSurroundingText(
void* data,
struct zwp_text_input_v1* text_input,
int32_t index,
uint32_t length) { … }
void ZWPTextInputWrapperV1::OnKeysym(void* data,
struct zwp_text_input_v1* text_input,
uint32_t serial,
uint32_t time,
uint32_t key,
uint32_t state,
uint32_t modifiers) { … }
void ZWPTextInputWrapperV1::OnLanguage(void* data,
struct zwp_text_input_v1* text_input,
uint32_t serial,
const char* language) { … }
void ZWPTextInputWrapperV1::OnTextDirection(
void* data,
struct zwp_text_input_v1* text_input,
uint32_t serial,
uint32_t direction) { … }
void ZWPTextInputWrapperV1::OnSetPreeditRegion(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
int32_t index,
uint32_t length) { … }
void ZWPTextInputWrapperV1::OnClearGrammarFragments(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
uint32_t start,
uint32_t end) { … }
void ZWPTextInputWrapperV1::OnAddGrammarFragment(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
uint32_t start,
uint32_t end,
const char* suggestion) { … }
void ZWPTextInputWrapperV1::OnSetAutocorrectRange(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
uint32_t start,
uint32_t end) { … }
void ZWPTextInputWrapperV1::OnSetVirtualKeyboardOccludedBounds(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
int32_t x,
int32_t y,
int32_t width,
int32_t height) { … }
void ZWPTextInputWrapperV1::OnConfirmPreedit(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
uint32_t selection_behavior) { … }
void ZWPTextInputWrapperV1::OnInsertImage(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
const char* src) { … }
void ZWPTextInputWrapperV1::OnInsertImageWithLargeURL(
void* data,
struct zcr_extended_text_input_v1* extended_text_input,
const char* mime_type,
const char* charset,
const int32_t raw_fd,
const uint32_t size) { … }
}