Skip to content

Comments

Fix mouse capture bugs and super-space problem on Wayland (ibus-lotus)#599

Open
hien-ngo29 wants to merge 3 commits intoBambooEngine:masterfrom
hien-ngo29:ibus-lotus-fix
Open

Fix mouse capture bugs and super-space problem on Wayland (ibus-lotus)#599
hien-ngo29 wants to merge 3 commits intoBambooEngine:masterfrom
hien-ngo29:ibus-lotus-fix

Conversation

@hien-ngo29
Copy link

Mình đã sử dụng hàm Reset() từ ibus để bắt những thời điểm thích hợp để commit thay vì phải tự bắt chuột bằng xlib.
engine.go:136-142

func (e *IBusBambooEngine) Reset() *dbus.Error {
	fmt.Print("Reset.\n")
	if e.checkInputMode(config.PreeditIM) {
		e.preeditor.Reset() // e.commitPreeditAndReset(e.getPreeditString())
	}
	return nil
}

Mình không rõ có ý định gì khi để commit chữ trong hàm Reset() này. Mình chạy lại test thấy vẫn ok nên chắc thôi kệ đi nhỉ.
Cũng chính vì đã có cách fix này rồi nên các phần code liên quan đến bắt sự kiện chuột mình đã xóa đi hết rồi nhé.

Còn vấn đề không đổi bộ gõ bằng super - space được trên Wayland (phím super bị ignore) thì mình chỉ việc thêm IBusMod4Mask = 1 << 6 vào ibus_constants.go là xong. Nếu mn check lại doc của ibus sẽ thấy. Có vẻ như phím super trên wayland dùng giá trị bit khác.


Mình định merge thêm cái sửa lỗi không mở được bảng tùy chọn trên Wayland từ ibus-lotus tuy nhiên goatastronaut không đồng ý với cách trên bởi nó yêu cầu phải cài đặt extension từ bên thứ 3 trên GNOME. Mình sẽ để sau để mn bàn lại vậy.

@hien-ngo29
Copy link
Author

hien-ngo29 commented Jan 23, 2026

Hơi ngoài lề một chút, nhưng không biết mình có nên thêm một PR lại cho cái này không? #581

Copy link
Contributor

@luongthanhlam luongthanhlam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few questions and some minor improvements

func (e *IBusBambooEngine) Reset() *dbus.Error {
fmt.Print("Reset.\n")
if e.checkInputMode(config.PreeditIM) {
e.commitPreeditAndReset(e.getPreeditString())
Copy link
Contributor

@luongthanhlam luongthanhlam Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when mouse capture is not active, and you're typing text in one location and then clicking elsewhere will commit any remaining buffered input at the new cursor position. That's annoying in x11.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's odd because my gnome wayland would automatically commit the text when i click my cursor elsewhere, even if the line e.commitPreeditAndReset(e.getPreeditString()) was removed. With that normal code before my PR, ibus-bamboo spams 2 duplicate words: one in the old location and one in the new location that mouse just clicked.

Did you mean this line is X11 only?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's designed to work on x11 only. What do you think if we disable this entirely on wayland, but still active for X11 users?

Copy link
Author

@hien-ngo29 hien-ngo29 Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well i'm not sure. I tried switching to an X11 desktop (GNOME 46 and Cinnamon) and the issue was the same as on Wayland. It duplicated two same words on two different cursor locations instead of "moved" the word from location A to location B like you said. Are you sure you are able reproduce the that x11 issue while mouse capture option is disabled?

I doubt that you're using an older ibus version so that problem persists (mine is 1.5.33 and 1.5.29-rc2). Not too sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been a week and you haven't had any response to this. What do you think about integrating both features and let users choose whether one they want in the configuration window? It might be that your linux setup was too outdated, we could integrate that feature for users who like to keep their machine stable and outdated. But i would say, i wouldn't like that, it's a dirty workaround. What do you think?

We can hold up this and discuss more if you want. But is it fine to merge the super-space fix on Wayland right now?

dictionary, _ = loadDictionary(DictVietnameseCm)
}
if inStringList(disabledMouseCapturingList, e.getWmClass()) {
stopMouseCapturing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if I'm missing something, what exactly is the problem with mouse capturing? Could you send me a link to the relevant discussion? tks

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On most modern desktop environments, they start replacing from X11 to Wayland. And you know, the mouse capturing in the code used xlib to capture mouse events and commit the text, this is pretty a bad idea as not only it doesn't work on Wayland but also causes some trouble like #487, I assume XWayland on GNOME Wayland is trying some way to get the permission to control the mouse by popping up that remote interaction dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants