aboutsummaryrefslogtreecommitdiff
path: root/src/platform/gui/xcb/InputMethod.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-12-05 20:49:10 +0800
committerYuqian Yang <crupest@crupest.life>2025-12-05 20:49:10 +0800
commitf5c801de04f423269d9cefa3d725b52b87c7a0b9 (patch)
tree51bbda6cf58cdd0a6d9128d073ad00c9337680aa /src/platform/gui/xcb/InputMethod.cpp
parent5edaa008efabb1b97446bed2f6b542cf01eb3c70 (diff)
downloadcru-f5c801de04f423269d9cefa3d725b52b87c7a0b9.tar.gz
cru-f5c801de04f423269d9cefa3d725b52b87c7a0b9.tar.bz2
cru-f5c801de04f423269d9cefa3d725b52b87c7a0b9.zip
Refactor CRU_LOG_TAG_*.
Diffstat (limited to 'src/platform/gui/xcb/InputMethod.cpp')
-rw-r--r--src/platform/gui/xcb/InputMethod.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/platform/gui/xcb/InputMethod.cpp b/src/platform/gui/xcb/InputMethod.cpp
index 96d04348..2a370eca 100644
--- a/src/platform/gui/xcb/InputMethod.cpp
+++ b/src/platform/gui/xcb/InputMethod.cpp
@@ -20,9 +20,9 @@ XcbXimInputMethodManager::XcbXimInputMethodManager(
xcb_xim_im_callback kXimCallbacks = {
.forward_event =
- [](xcb_xim_t *im, xcb_xic_t ic, xcb_key_press_event_t *event,
- void *user_data) {
- CRU_LOG_TAG_DEBUG("Key event forwarded back from XIM.");
+ [](xcb_xim_t* im, xcb_xic_t ic, xcb_key_press_event_t* event,
+ void* user_data) {
+ CruLogDebug(kLogTag, "Key event forwarded back from XIM.");
auto manager = static_cast<XcbXimInputMethodManager *>(user_data);
if ((event->response_type & ~0x80) == XCB_KEY_PRESS) {
auto text =
@@ -45,9 +45,9 @@ XcbXimInputMethodManager::XcbXimInputMethodManager(
}
},
.commit_string =
- [](xcb_xim_t *im, xcb_xic_t ic, uint32_t flag, char *str,
- uint32_t length, uint32_t *keysym, size_t nKeySym,
- void *user_data) {
+ [](xcb_xim_t* im, xcb_xic_t ic, uint32_t flag, char* str,
+ uint32_t length, uint32_t* keysym, size_t nKeySym,
+ void* user_data) {
auto manager = static_cast<XcbXimInputMethodManager *>(user_data);
if (flag & XCB_XIM_LOOKUP_KEYSYM) {
@@ -91,7 +91,7 @@ xcb_xim_t *XcbXimInputMethodManager::GetXcbXim() { return im_; }
void XcbXimInputMethodManager::DispatchCommit(xcb_xim_t *im, xcb_xic_t ic,
std::string text) {
- CRU_LOG_TAG_DEBUG("IC {} dispatch commit string: {}", ic, text);
+ CruLogDebug(kLogTag, "IC {} dispatch commit string: {}", ic, text);
if (focus_context_) {
focus_context_->composition_event_.Raise(nullptr);
focus_context_->composition_end_event_.Raise(nullptr);
@@ -104,7 +104,7 @@ bool XcbXimInputMethodManager::HandleXEvent(xcb_generic_event_t *event) {
if (focus_context_ && focus_context_->ic_ &&
(((event->response_type & ~0x80) == XCB_KEY_PRESS) ||
((event->response_type & ~0x80) == XCB_KEY_RELEASE))) {
- CRU_LOG_TAG_DEBUG("Forward key event to XIM.");
+ CruLogDebug(kLogTag, "Forward key event to XIM.");
xcb_xim_forward_event(im_, *focus_context_->ic_,
(xcb_key_press_event_t *)event);
application_->XcbFlush();
@@ -175,7 +175,7 @@ static void EmptyXimDestroyIcCallback(xcb_xim_t *im, xcb_xic_t ic,
void XcbXimInputMethodContext::SetCandidateWindowPosition(const Point &point) {
if (!ic_) return;
- CRU_LOG_TAG_DEBUG("IC {} set candidate window position: {}", *ic_, point);
+ CruLogDebug(kLogTag, "IC {} set candidate window position: {}", *ic_, point);
xcb_point_t spot;
spot.x = point.x;
@@ -212,7 +212,7 @@ void XcbXimInputMethodContext::CreateIc(xcb_window_t window) {
auto XimCreateIcCallback = [](xcb_xim_t *im, xcb_xic_t ic, void *user_data) {
auto context = static_cast<XcbXimInputMethodContext *>(user_data);
context->ic_ = ic;
- CRU_LOG_TAG_DEBUG("XIM IC {} is created.", ic);
+ CruLogDebug(kLogTag, "XIM IC {} is created.", ic);
if (context->window_->HasFocus()) {
context->SetFocus();
}
@@ -223,27 +223,27 @@ void XcbXimInputMethodContext::CreateIc(xcb_window_t window) {
xcb_xim_create_ic(manager_->GetXcbXim(), XimCreateIcCallback, this,
XCB_XIM_XNInputStyle, &input_style, XCB_XIM_XNClientWindow,
&window, XCB_XIM_XNFocusWindow, &window, NULL);
- CRU_LOG_TAG_DEBUG("Create XIM IC.");
+ CruLogDebug(kLogTag, "Create XIM IC.");
manager_->application_->XcbFlush();
}
void XcbXimInputMethodContext::SetFocus() {
manager_->focus_context_ = this;
if (ic_) {
- CRU_LOG_TAG_DEBUG("Focus XIM IC {}.", *ic_);
+ CruLogDebug(kLogTag, "Focus XIM IC {}.", *ic_);
xcb_xim_set_ic_focus(manager_->GetXcbXim(), *ic_);
manager_->application_->XcbFlush();
}
}
void XcbXimInputMethodContext::DestroyIc() {
- auto destroy_callback = [](xcb_xim_t *im, xcb_xic_t ic, void *user_data) {
- CRU_LOG_TAG_DEBUG("XIM IC {} is destroyed.", ic);
+ auto destroy_callback = [](xcb_xim_t* im, xcb_xic_t ic, void* user_data) {
+ CruLogDebug(kLogTag, "XIM IC {} is destroyed.", ic);
};
if (!ic_) return;
xcb_xim_destroy_ic(manager_->GetXcbXim(), *ic_, destroy_callback, this);
- CRU_LOG_TAG_DEBUG("Destroy XIM IC {}.", *ic_);
+ CruLogDebug(kLogTag, "Destroy XIM IC {}.", *ic_);
ic_ = std::nullopt;
manager_->application_->XcbFlush();
}