Commit 465489da authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Commit Bot

Revert "exo: Send keysym on zwp_test_input_v1_send_keysym."

This reverts commit f4423821.

Reason for revert: Blocking the revert of a CL that blocks chrome-uprev. See issue 1132766.

BUG=1132766

Original change's description:
> exo: Send keysym on zwp_test_input_v1_send_keysym.
>
> According to the document, the zwp_test_input_v1_send_keysym's argument
> named |code| should be XKB keysym.
> Currently, XKB keycode is sent, so fixed to the collect one.
>
> BUG=1123705
> TEST=Ran locally. Made sure expected keysym is sent to client.
>
> Change-Id: I9db31cf84b21a7c9a400d75bcbec2fbfe69a2ad4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432165
> Reviewed-by: Jun Mukai <mukai@chromium.org>
> Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#810912}

TBR=mukai@chromium.org,hidehiko@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1123705
Change-Id: I7852ff3d577044e82cd2f8fb5c859f1947b1b3fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2436509Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811362}
parent 3df38ad3
......@@ -215,8 +215,8 @@ Server::Server(Display* display)
wl_global_create(wl_display_.get(), &zcr_extended_drag_v1_interface, 1,
display_, bind_extended_drag);
zwp_text_manager_data_ = std::make_unique<WaylandTextInputManager>(
display_->seat()->xkb_tracker(), serial_tracker_.get());
zwp_text_manager_data_ =
std::make_unique<WaylandTextInputManager>(serial_tracker_.get());
wl_global_create(wl_display_.get(), &zwp_text_input_manager_v1_interface, 1,
zwp_text_manager_data_.get(), bind_text_input_manager);
......
......@@ -14,7 +14,6 @@
#include "components/exo/text_input.h"
#include "components/exo/wayland/serial_tracker.h"
#include "components/exo/wayland/server_util.h"
#include "components/exo/xkb_tracker.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
......@@ -30,11 +29,8 @@ namespace {
class WaylandTextInputDelegate : public TextInput::Delegate {
public:
WaylandTextInputDelegate(wl_resource* text_input,
const XkbTracker* xkb_tracker,
SerialTracker* serial_tracker)
: text_input_(text_input),
xkb_tracker_(xkb_tracker),
serial_tracker_(serial_tracker) {}
: text_input_(text_input), serial_tracker_(serial_tracker) {}
~WaylandTextInputDelegate() override = default;
void set_surface(wl_resource* surface) { surface_ = surface; }
......@@ -117,8 +113,7 @@ class WaylandTextInputDelegate : public TextInput::Delegate {
}
void SendKey(const ui::KeyEvent& event) override {
uint32_t keysym = xkb_tracker_->GetKeysym(
ui::KeycodeConverter::DomCodeToNativeKeycode(event.code()));
uint32_t code = ui::KeycodeConverter::DomCodeToNativeKeycode(event.code());
bool pressed = (event.type() == ui::ET_KEY_PRESSED);
// TODO(mukai): consolidate the definition of this modifiers_mask with other
// similar ones in components/exo/keyboard.cc or arc_ime_service.cc.
......@@ -132,7 +127,7 @@ class WaylandTextInputDelegate : public TextInput::Delegate {
zwp_text_input_v1_send_keysym(
text_input_, TimeTicksToMilliseconds(event.time_stamp()),
serial_tracker_->GetNextSerial(SerialTracker::EventType::OTHER_EVENT),
keysym,
code,
pressed ? WL_KEYBOARD_KEY_STATE_PRESSED
: WL_KEYBOARD_KEY_STATE_RELEASED,
modifiers);
......@@ -161,12 +156,10 @@ class WaylandTextInputDelegate : public TextInput::Delegate {
wl_resource* text_input_;
wl_resource* surface_ = nullptr;
// Owned by Seat, which is updated before calling the callbacks of this
// class.
const XkbTracker* const xkb_tracker_;
// Owned by Server, which always outlives this delegate.
SerialTracker* const serial_tracker_;
DISALLOW_COPY_AND_ASSIGN(WaylandTextInputDelegate);
};
void text_input_activate(wl_client* client,
......@@ -360,7 +353,7 @@ void text_input_manager_create_text_input(wl_client* client,
SetImplementation(
text_input_resource, &text_input_v1_implementation,
std::make_unique<TextInput>(std::make_unique<WaylandTextInputDelegate>(
text_input_resource, data->xkb_tracker, data->serial_tracker)));
text_input_resource, data->serial_tracker)));
}
const struct zwp_text_input_manager_v1_interface
......
......@@ -7,26 +7,22 @@
#include <stdint.h>
#include "base/macros.h"
struct wl_client;
namespace exo {
class XkbTracker;
namespace wayland {
class SerialTracker;
struct WaylandTextInputManager {
WaylandTextInputManager(const XkbTracker* xkb_tracker,
SerialTracker* serial_tracker)
: xkb_tracker(xkb_tracker), serial_tracker(serial_tracker) {}
WaylandTextInputManager(const WaylandTextInputManager&) = delete;
WaylandTextInputManager& operator=(const WaylandTextInputManager&) = delete;
// Owned by Seat, which also always outlives zwp_text_input_manager.
const XkbTracker* const xkb_tracker;
WaylandTextInputManager(SerialTracker* serial_tracker)
: serial_tracker(serial_tracker) {}
// Owned by Server, which always outlives zwp_text_input_manager.
SerialTracker* const serial_tracker;
DISALLOW_COPY_AND_ASSIGN(WaylandTextInputManager);
};
void bind_text_input_manager(wl_client* client,
......
......@@ -46,10 +46,6 @@ void XkbTracker::UpdateKeyboardModifiers(int modifier_flags) {
UpdateKeyboardModifiersInternal();
}
uint32_t XkbTracker::GetKeysym(uint32_t xkb_keycode) const {
return xkb_state_key_get_one_sym(xkb_state_.get(), xkb_keycode);
}
std::unique_ptr<char, base::FreeDeleter> XkbTracker::GetKeymap() const {
return std::unique_ptr<char, base::FreeDeleter>(
xkb_keymap_get_as_string(xkb_keymap_.get(), XKB_KEYMAP_FORMAT_TEXT_V1));
......
......@@ -41,10 +41,6 @@ class XkbTracker {
// ui::EventFlags.
void UpdateKeyboardModifiers(int modifier_flags);
// Returns the keysym for the given XKB keycode, based on the current
// keymap and its modifier state.
uint32_t GetKeysym(uint32_t xkb_keycode) const;
// Returns the XKB keymap data.
std::unique_ptr<char, base::FreeDeleter> GetKeymap() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment