Skip to content

Backend: improve/fix #7262 Xlib/X11 backend#9296

Open
Wildric-Auric wants to merge 2 commits intoocornut:masterfrom
Wildric-Auric:xlib
Open

Backend: improve/fix #7262 Xlib/X11 backend#9296
Wildric-Auric wants to merge 2 commits intoocornut:masterfrom
Wildric-Auric:xlib

Conversation

@Wildric-Auric
Copy link

I recently moved to Linux and was quite surprised that there is no X11 backend in Dear ImGui repository.
I found #7262 which was simple and fine for my needs but it had many problems. This pull request describes and fixes them.

  • XInput extension breaks core button events, which is not desirable if those are used somewhere else.
    As highlighted by the reviewer in Backends: Add Xlib backend #7262, there is no need for that dependency. This pull request fixes this and use core X11 features.

  • Fixed space not working for texts, the space character was not pushed which broke text inputs and other features.

  • Fixed stuck modifiers: Modifier events were updated incorrectly, they were pushed on every key event, which completely broke many features such as DragScalars step. My guess is that the developer took inspiration from win32 backend but without noticing the behaviour of ImGui_ImplWin32_ProcessKeyEventsWorkarounds.

  • Fixed mouse wheel event firing twice: Mouse wheel event was registered twice, because Linux has a release event for the mouse wheel.

All these fixes were tested.
I took a quick look at #3372, I didn't test it. The main difference is that they use XCB instead of xlib; and of course that pull request tackles multiple viewports which we don't do here.

I'm willing to maintain this if you decide to merge it.

clementgallet and others added 2 commits January 24, 2024 14:17
The fix covers many aspect:
-Removed XInput dependency, use only core X11 features
-Fixed space not working for texts, space char was not pushed to ImGui
-Fixed stuck modifiers
-Fixed mouse wheel event firing twice
@ocornut
Copy link
Owner

ocornut commented Mar 12, 2026

Thank you Oussama for your PR and for neatly pushing as a two separate commits.

I'm willing to maintain this if you decide to merge it.

May I ask:

  • how long have you been using Dear ImGui?
  • how long have you been using this backend?
  • did you generally try this with multi-viewport?
  • Extra: can you describe the sort of decision/setup that made you use raw Xlib rather than e.g. SDL3/GLFW? That

Out of experience code for tech I don't use on a daily basis are really problematic in terms of maintenance, and I really worry that this might lead to waves of support requests that are difficult for me to deal with.

This however has the potential to be easier to implement subtle features/fix that are difficult to do with SDL3/GLFW, and eventually be a better alternative to them, which might potentially actually reduce support requests.

@Wildric-Auric
Copy link
Author

Thank you for the fast reply!
Here are the answers in the same order as the questions.

  • I have been using Dear ImGui for graphics hobby projects for the last 3 years.
  • I have been using this backend for the last 2 weeks (when I switched to Linux). I noticed the issues I described, and I investigated and fixed them yesterday.
  • I did not try multi-viewport.
  • In general, I want to understand every single part of my software, hence I use the least dependencies and make my own abstractions. I was using the raw Win32 backend when I was on Windows, with my library for windows and opengl context. When I moved to linux, I ported that library and I needed X11 backend. I found this one and fixed it.

I’m available if you need any more details.

@ocornut ocornut changed the title Backend: Fix #7262 Xlib/X11 backend Backend: improve/fix #7262 Xlib/X11 backend Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants