Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WantCaptureMouse changed? #1789

Closed
sonoro1234 opened this issue May 2, 2018 · 8 comments
Closed

WantCaptureMouse changed? #1789

sonoro1234 opened this issue May 2, 2018 · 8 comments

Comments

@sonoro1234
Copy link

When doing a bind against 1.60 the behaviour of WantCaptureMouse changed

this is my callback

local function mouse_button_callbak(win, button, action,mods)
			if button == glc.GLFW_MOUSE_BUTTON_1 then
				GL.mouse_but[1] = (action == glc.GLFW_PRESS) and 1 or 0
			end
			imgui.ImGui_ImplGlfwGL3_MouseButtonCallback(win, button, action, mods)
			--dont process mouse if used by imgui
			if imgui.igGetIO().WantCaptureMouse then return end

with 1.53 WantCaptureMouse was detected and not now. Has been any relevant change?

@ocornut
Copy link
Owner

ocornut commented May 2, 2018

No particular change as far as I remember. It's hard to tell how you could have been affected without the fuller context. You are not explaining how it changed and in which context.

@sonoro1234
Copy link
Author

ImGuiIO struct was badly defined in binding :-(

@ocornut
Copy link
Owner

ocornut commented May 3, 2018

You should add code to check the size of structs.. See what I do in DebugCheckVersionAndDataLayout + adding also checking IM_OFFSET() of a few selected fields.

@Nukem9
Copy link

Nukem9 commented May 3, 2018

Is there any reason you are avoiding #pragma pack()? Even DebugCheckVersionAndDataLayout would be needed in every .cpp file, no? (if compile options change between each .cpp)

edit: Im also kind of referring to previous issues with this

@ocornut
Copy link
Owner

ocornut commented May 3, 2018

@Nukem9 I am not sure what you mean. Do you suggest using #pragma pack() (with empty parenthesis) to force-reset the data structure to the compiler initial settings? (surrounding the whole file with push/pop of course) ?

@Nukem9
Copy link

Nukem9 commented May 3, 2018

@Nukem9 I am not sure what you mean. Do you suggest using #pragma pack() (with empty parenthesis) to force-reset the data structure to the compiler initial settings? (surrounding the whole file with push/pop of course) ?

Yes - that would fix anything like #1769 in the future. I'm not sure about fixing the #define problem though (#1695).

Personally I wouldn't use #pragma pack(), but some number like #pragma pack(push, 1, 4, 8, 16, ...) that forces all imgui structs to be the same alignment in every cpp file.

@sonoro1234
Copy link
Author

My specific problem was not with packing but with a bad definition (now corrected)

@ocornut
Copy link
Owner

ocornut commented May 4, 2018

@Nukem9 To answer your question, the issue is mostly that it is work to figure out the least intrusive way to do it across most compilers and test it. If you want to do it for imgui.h and imgui_internal.h and it's not too intrusive, I would take a PR. I think Clang needs attribute on every structure :/

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants