[touchpad] Use a separate X11 Display to monitor the XInput event.
AbandonedPublic

Authored by xuetianweng on Dec 28 2016, 12:10 AM.

Details

Reviewers
davidedmundson
Summary

For some reason, the XI event is not received if the change is from
global shortcut. This makes global shortcut always disable the touchpad
because kded5 never aware it is disabled. This simple workaround may fix
it.

CCBUG:370588

Test Plan

Manually test with global shortcut.

Diff Detail

Repository
R119 Plasma Desktop
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
xuetianweng retitled this revision from to [touchpad] Use a separate X11 Display to monitor the XInput event..
xuetianweng updated this object.
xuetianweng edited the test plan for this revision. (Show Details)
xuetianweng added a reviewer: davidedmundson.
Restricted Application added a project: Plasma. · View Herald TranscriptDec 28 2016, 12:10 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

Could you explain the relationship to global shortcuts? That sounds to me like a bug which needs to be fixed in kglobalaccel

Could you explain the relationship to global shortcuts? That sounds to me like a bug which needs to be fixed in kglobalaccel

I don't really sure about this. So basically XlibNotifications uses XISelectEvent to monitor certain event. And strangely, the event is not received only if it is triggered by global hotkey. The Display* used in touchpad kded is already a separated one instead of Qt's, so I don't know if there's any interference between them. If someone could highlight me about what is the real cause of this I'd appreciated it.

My guess is that it could be caused by mix Xinput call on the same display and there's some interference.

Might this change fix this issue? https://bugs.kde.org/show_bug.cgi?id=370588

Yeah, I suspect so. I already put it in CCBUG, but I'd prefer reporter to confirm it.

Could you explain the relationship to global shortcuts? That sounds to me like a bug which needs to be fixed in kglobalaccel

I don't really sure about this. So basically XlibNotifications uses XISelectEvent to monitor certain event. And strangely, the event is not received only if it is triggered by global hotkey.

Which "event"?

The Display* used in touchpad kded is already a separated one instead of Qt's, so I don't know if there's any interference between them. If someone could highlight me about what is the real cause of this I'd appreciated it.

This sounds weird and wrong to me. In none of the applications we use, even in the heavily X relying one like KWin or kglobalaccel, we create another Display, but use the one Qt provides. From my experience there is no need to have a dedicate Display. It can certainly be a source for issues.

Could you explain the relationship to global shortcuts? That sounds to me like a bug which needs to be fixed in kglobalaccel

I don't really sure about this. So basically XlibNotifications uses XISelectEvent to monitor certain event. And strangely, the event is not received only if it is triggered by global hotkey.

Which "event"?

search XIPropertyEvent in xlibnotifications.cpp

For whatever reason, that part of code is not reached if it is triggered by global hotkey with current code, the display pointer is not shared with anyone.. I really don't understand why adding a new one helps, but it does help.

I would say the overall problem is that this here still uses an XLib event queue. But Qt uses an xcb connection. I would say this needs a porting away from the XLib code and use Qt's XCB connection and event handling.

I would say the overall problem is that this here still uses an XLib event queue. But Qt uses an xcb connection. I would say this needs a porting away from the XLib code and use Qt's XCB connection and event handling.

At that time the xinput in xcb is incomplete and buggy so XLib is the only choice. Not sure if things change now.

I would say the overall problem is that this here still uses an XLib event queue. But Qt uses an xcb connection. I would say this needs a porting away from the XLib code and use Qt's XCB connection and event handling.

At that time the xinput in xcb is incomplete and buggy so XLib is the only choice. Not sure if things change now.

no, it never was buggy. There are just no bindings. But all we care about are the events. And events are just a struct. If one wants to use them one can. An example how one can use XInput from an xcb based application without needing the bindings is https://cgit.kde.org/kwin.git/tree/plugins/platforms/x11/standalone/xinputintegration.cpp

What's next for this?

z3ntu added a subscriber: z3ntu.Oct 23 2017, 3:35 PM

This patch works for me :)

@graesslin, does this still need changes to be merge-worthy?

@graesslin, does this still need changes to be merge-worthy?

Yes, we did not migrate back to xlib, so the port to xcb is still required.

davidedmundson requested changes to this revision.Jun 5 2018, 2:28 PM

We don't need this now we have Albert's patch, right?

This revision now requires changes to proceed.Jun 5 2018, 2:28 PM
xuetianweng abandoned this revision.Jun 6 2018, 12:15 AM