Skip to content

Doc typo fix for struct winit::Window - #452

Merged
francesca64 merged 1 commit into
rust-windowing:masterfrom
virome:window-doc-fix-typo
Apr 13, 2018
Merged

francesca64 merged 1 commit into
rust-windowing:masterfrom
virome:window-doc-fix-typo

Conversation

@virome

@virome virome commented Apr 9, 2018

Copy link
Copy Markdown
Contributor

No description provided.

@virome

virome commented Apr 9, 2018

Copy link
Copy Markdown
Contributor Author

Whoops, didn't [ci skip] this, sorry!

@matt-dombrowski

Copy link
Copy Markdown

This change seems appropriate, although I feel that there is a linking verb missing.

@virome

virome commented Apr 9, 2018

Copy link
Copy Markdown
Contributor Author

Did you spot the 'matches' on the line below? With that, I think it reads fine.
What's an example of a linking verb you were thinking of?

@matt-dombrowski

Copy link
Copy Markdown

I would like to preface this by stating that I have not attempted to learn this particular dialect by going through previous comments, so take this with a grain of salt. The phrase I'm keying in on is "if nothing". It sounds like it is missing an object compliment after it (i.e. "if nothing has happened" or "if nothing is present"). I think the parsimonious way to make this flow better is to say "if it is nothing" (which is the linking verb I was thinking of). I can tell that the line of thinking for this comment is a basic branch structured as "if x than y or if not x than z", but that doesn't translate well into natural language. Personally I would rephrase to more explicitly follow the schema of "if x than y, or if not possible z" (for example "...or the primary monitor if there is no current monitor"). I am aware that this new schema is semantically identical to the previous one, but it translates better into natural language. It is a tad redundant, but it does more explicitly explain what is going on while still being succinct.

I did not spot the "matches". I believe it is semantically null, so would be in favor of axing it entirely.

@virome

virome commented Apr 9, 2018

Copy link
Copy Markdown
Contributor Author

True, it isn't exactly clear what it means for there to be no matches.

I'm not familiar enough with the codebase to know why there wouldn't be any matches for the current monitor. I'll look into that, and then maybe this sentence could be rewritten to be a bit more descriptive.

@francesca64

francesca64 commented Apr 11, 2018 •

Copy link
Copy Markdown
Member

I was initially going to tell you that this PR could be merged as-is, but...

I'm not familiar enough with the codebase to know why there wouldn't be any matches for the current monitor.

...then I realized that I don't actually know this either. I've thus investigated:

  • Windows: stubbed as unimplemented!(), though Implement set_maximized, get_current_monitor, set_fullscreen and set_decorations for windows #457 implements it. The monitor that the majority of the window is on is returned.
  • macOS: stubbed as unimplemented!().
  • X11: the monitor that the majority of the window is on is returned. There's a default value that's used when get_position or get_outer_size return None (though it's dubious that it makes sense to return a monitor at all in that case, since AFAIK this would really only be hit for a window that's been closed). That default value is the first monitor returned by get_available_monitors, which is the first monitor enumerated by XRRGetMonitors on XRandR 1.5 and onward, and XRRGetScreenResources otherwise. Neither of these claim to always have the primary monitor as the first one.
  • Wayland: due to inavailability of positioning info, the window's most recent monitor is returned.
  • Android, iOS, and emscripten: these implementations don't really do anything, so it's not an issue here.

So you've inadvertently caused the discovery that the doc comment isn't even accurate, which I'd say is a victory for winit!

@virome

virome commented Apr 11, 2018

Copy link
Copy Markdown
Contributor Author

In that case, do you think it's even necessary to mention the possiblity of 'no matches' in the documentation? Or something akin to "if a window's monitor cannot not be determined for certain, a platform-specifc best guess is returned."

@matt-dombrowski

Copy link
Copy Markdown

Oh, I'll bet that that was what the "matches" comment was for!

@francesca64

Copy link
Copy Markdown
Member

I personally don't think it's necessary. There aren't really any reasonable cases where there won't be a match.

@matt-dombrowski

Copy link
Copy Markdown

I probably should have been more clear, I still believe that the "matches" comment is semantically null. Any use it may have had is met with a descriptive comment about the purpose of the function. I merely now understand it's (probable) former purpose.

@virome
virome force-pushed the window-doc-fix-typo branch from 84c42c1 to c63043d Compare April 13, 2018 03:09
@francesca64

Copy link
Copy Markdown
Member

@virome I see that you updated your commit, so I assume you're ready for me to merge this. For future reference, GitHub didn't send me a notification when that happened; IIRC it only notifies me if you add commits, so it's always good to comment to give me a heads up.

Anyway, thanks for the contribution!

@francesca64
francesca64 merged commit 2477d8c into rust-windowing:master Apr 13, 2018
@virome

virome commented Apr 13, 2018

Copy link
Copy Markdown
Contributor Author

@francesca64 Good to know!

tmfink pushed a commit to tmfink/winit that referenced this pull request Jan 5, 2022
Fix arm simd shuffling arguments

According to packed_simd docs, the syntax for simd_shuffle4()
is as follows:

"The indices must be in range [0, M * N) where M is the number of input
vectors (1 or 2)and N is the number of lanes of the input vectors. The
indices i in range [0, N) refer to the i-th element of vec0, while the
indices in range [N, 2*N) refer to the i - N-th element of vec1."

I did not find implementation or documentation for simd_shuffle4() but
I believe packed_simd implements exactly the same interface.

Plus, implementing this change has fixed font-kit glyph output on
an Apple M1 mac (64-bit arm).

Closes rust-windowing#450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants