Skip to content

1 macos fix - #3835

Merged
IntegratedQuantum merged 7 commits into
PixelGuys:masterfrom
Wunka:macosRendering
Dec 3, 2026
Merged

IntegratedQuantum merged 7 commits into
PixelGuys:masterfrom
Wunka:macosRendering

Conversation

@Wunka

@Wunka Wunka commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
  • Fixes wrong cursor postion and window creation on macos. (no issue for that)

I had this on the same branch thats why its one pr.

@Wunka Wunka moved this to High Priority in PRs to review Nov 24, 2026
@Wunka Wunka moved this from High Priority to Easy to Review in PRs to review Nov 24, 2026

@IntegratedQuantum IntegratedQuantum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixes #3826

I cannot accept a random fix until we understand why it is necessary, why it works and for which other buffers it may be needed (now and in the future).

@IntegratedQuantum IntegratedQuantum moved this from Easy to Review to In review in PRs to review Nov 25, 2026
@Wunka

Wunka commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Fixes #3826

I cannot accept a random fix until we understand why it is necessary, why it works and for which other buffers it may be needed (now and in the future).

yeah sorry, this was my branch with all the fixes. I put that commit now into another branch and dropped it here.

@Wunka Wunka changed the title 2 macos fixes 1 macos fix Nov 25, 2026
Comment thread src/graphics/Window.zig Resolved
Comment thread src/graphics/Window.zig Outdated
pub var scrollOffsetInteger: i32 = 0;
var scrollOffsetFraction: f32 = 0;
var contentXScale: f32 = 1;
var contentYScale: f32 = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not make this a vector?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you mean array? vectors + pointer + c is not allowed as we seen. and I just oriented myself at witdth, height. But I can if you want change it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, right. Not sure if an array is really better then.

I've just been trying to get away from separate x/y/z variables everywhere.

Comment thread src/graphics/Window.zig Outdated
c.glfwGetFramebufferSize(window, &frameBuffereWidth, &frameBuffereHeight);
width = @intCast(frameBuffereWidth);
height = @intCast(frameBuffereHeight);
c.glfwGetWindowContentScale(window, &contentXScale, &contentYScale);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please instead call our callbacks, and remove the already existing such call from main.zig.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

can you clarify? Do you mean I should call glfw_callbacks.framebufferSize(null, frameBuffereWidth, frameBuffereHeight); instead of setting width and height directly? That causes:

thread 43204 panic: attempt to use null value
/home/wunka/Documents/Cubyz/dropdown/.zig-cache/o/f3f487178d4ae0829abcd64e0eb253fb/c.zig:23618:37: 0x1663384 in glDeleteFramebuffers (main.zig)
    return glad_glDeleteFramebuffers.?(n, framebuffers);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you mean I should call glfw_callbacks.framebufferSize(null, frameBuffereWidth, frameBuffereHeight); instead of setting width and height directly?

Yes, that's what I meant. If it causes an issue here then we have to keep the frameBuffer callback as is, called in main.

However I would still prefer if you used the callback for the contentScale, so we can catch future additions inside the callback. That would also be beneficial in the current state, as it would log the initial value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It now uses the callback. I also put it into scope to show that's its "its own thing" with a little comment why it exists

Wunka and others added 3 commits December 1, 2026 19:30
Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
Comment thread src/graphics/Window.zig Resolved
Comment thread src/graphics/Window.zig Resolved
Comment thread src/graphics/Window.zig Outdated
_ = c.glfwSetCursorPosCallback(window, glfw_callbacks.cursorPosition);
_ = c.glfwSetMouseButtonCallback(window, glfw_callbacks.mouseButton);
_ = c.glfwSetScrollCallback(window, glfw_callbacks.scroll);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not happy with just placing them at the end of the file, I think they should be above init or below deinit.
Also initGlfwCallbacks could also be glfw_callbacks.init().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved

Comment thread src/graphics/Window.zig Outdated

pub const glfw_callbacks = struct { // MARK: glfw_callbacks

pub fn init() void {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be private

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

.

@IntegratedQuantum
IntegratedQuantum merged commit 8064126 into PixelGuys:master Dec 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants