-
Notifications
You must be signed in to change notification settings - Fork 2
/
HaikuTextInput.h
84 lines (59 loc) · 2.06 KB
/
HaikuTextInput.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
#include <String.h>
#include "WlGlobal.h"
#include "TextInputUnstableV3.h"
#include <Messenger.h>
#include <util/DoublyLinkedList.h>
class HaikuSurface;
class HaikuSeatGlobal;
class HaikuTextInputGlobal;
class HaikuTextInput: public ZwpTextInputV3 {
private:
HaikuTextInputGlobal *fGlobal;
HaikuSeatGlobal *fSeat;
DoublyLinkedListLink<HaikuTextInput> fLink;
public:
typedef DoublyLinkedList<HaikuTextInput, DoublyLinkedListMemberGetLink<HaikuTextInput, &HaikuTextInput::fLink>> List;
public:
HaikuTextInput(HaikuTextInputGlobal *global, HaikuSeatGlobal *seat);
virtual ~HaikuTextInput();
void HandleEnable() final;
void HandleDisable() final;
void HandleSetSurroundingText(const char *text, int32_t cursor, int32_t anchor) final;
void HandleSetTextChangeCause(uint32_t cause) final;
void HandleSetContentType(uint32_t hint, uint32_t purpose) final;
void HandleSetCursorRectangle(int32_t x, int32_t y, int32_t width, int32_t height) final;
void HandleCommit() final;
};
class HaikuTextInputGlobal: public WlGlocal {
private:
friend class HaikuTextInput;
HaikuSeatGlobal *fSeat;
HaikuTextInput::List fTextInputIfaces{};
int32 fSerial {};
BMessenger fImReplyMsgr;
BString fString;
int32 fSelectionBeg {};
int32 fSelectionEnd {};
bool fActive {};
bool fConfirmed {};
BRect fCursorRect;
HaikuTextInputGlobal(HaikuSeatGlobal *seat): fSeat(seat) {}
void Clear();
void SendState(HaikuTextInput *textInput);
public:
static HaikuTextInputGlobal *Create(struct wl_display *display, HaikuSeatGlobal *seat);
virtual ~HaikuTextInputGlobal();
void Bind(struct wl_client *wl_client, uint32_t version, uint32_t id) final;
void Enter(HaikuSurface *surface);
void Leave(HaikuSurface *surface);
bool MessageReceived(HaikuSurface *surface, BMessage *msg);
};
class HaikuTextInputManager: public ZwpTextInputManagerV3 {
private:
HaikuTextInputGlobal *fGlobal;
public:
virtual ~HaikuTextInputManager() = default;
HaikuTextInputManager(HaikuTextInputGlobal *global): fGlobal(global) {}
void HandleGetTextInput(uint32_t id, struct wl_resource *seat) final;
};