Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Weird behavior with UITextLayer on OS X 10.8 #85

Open
silvermana opened this issue Jun 7, 2012 · 11 comments
Open

Weird behavior with UITextLayer on OS X 10.8 #85

silvermana opened this issue Jun 7, 2012 · 11 comments

Comments

@silvermana
Copy link

Has anyone tested their Chameleon apps on 10.8? I have and UITextFields and UITextViews are not working correctly.

If I build the app with the latest 10.7 SDK and run it on 10.8:

  1. UITextFields do not render any text.
  2. UITextViews work correctly

If I build the app with the latest 10.8 SDK and run it on 10.8:

  1. Neither worked at all at first (wouldn't become first responder), but after mucking with some of the hit testing code I got them mostly working.

Reading the 10.8 release notes from Apple makes me think the changes they made to NSView/CALayer is messing with Chameleon. Before I investigate for hours I wanted to see if anyone else had a solution already.

@BigZaphod
Copy link
Owner

Set the project's base SDK to 10.7 for now to avoid some of this for now unless you can find an elegant way to fix it. I've looked into a bit and it seems like every time I feel like I've almost nailed it down, I find another case that's breaks it. Very irritating.

@silvermana
Copy link
Author

Yeah, I'm just worried Apple might drop a release date on 10.8 next week. If you want to share what changes you are making in a public branch I'm happy to help you test things.

@sergiosilva
Copy link

I think I fixed it on my fork. The only problem I was having was that the text layer seemed flipped. I solved it by adding

//deal with 10.8 geometry differences.
self.geometryFlipped = [[[[containerView window].screen UIKitView] layer] isGeometryFlipped];

to UITextLayer.m

- (void)addNSView

@rafcabezas
Copy link

I can confirm that sergio's solution works for me as well.

@jeremy-w
Copy link

The patch by @sergiosilva seems to lead to UIText{View,Field}s displaying flipped for Lion users. It does seem to fix things for 10.8 users, though.

@sergiosilva
Copy link

I did note that using a placeholder text in a UITextField still looked flipped for Lion users, but it was the only case, entering new text was rendered correctly, do you have others?

On 27/02/2013, at 21:45, "Jeremy W. Sherman" [email protected] wrote:

The patch by @sergiosilva seems to lead to UIText{View,Field}s displaying flipped for Lion users. It does seem to fix things for 10.8 users, though.


Reply to this email directly or view it on GitHub.

@jeremy-w
Copy link

Yes, I was watching live text input go in flipped. It was very strange. My current approach is just "punt and test for something new on OS X 10.8". Looks like NSColor now has colorWithCGColor:, and NSPageController is wholly new, so testing for those should let me know whether we're getting the 10.8 weirdness or the 10.7 weirdness.

@sergiosilva
Copy link

Think your are missing this patch also on my fork:
sergiosilva@af1529f

With this only the placeholder text should still be flipped. Never investigated that case properly... Let me know if this helps.

@jeremy-w
Copy link

Ah yes, I just had the code you inlined earlier. But version-sniffing turns out to work fine, and no flipping. Here's what I ended up adding to -[UITextLayer addNSView]:

    /* OS X 10.8 changes something about layer geometry.
     * This fixes text drawing problems in UITextField/View on OS X.
     * See <URL:https://github.com/BigZaphod/Chameleon/issues/85>.
     *
     * But doing this seems to flip the text for 10.7 and previous.
     * So we version sniff. */
    if ([NSColor respondsToSelector:@selector(colorWithCGColor:)]
        && NSClassFromString(@"NSPageController") != Nil) {
        UIKitView *hostView = [[containerView window].screen UIKitView];
        self.geometryFlipped = [[hostView layer] isGeometryFlipped];
    }

@sergiosilva
Copy link

Actually, I think that I also had some issue with some UILabels that required the patch I posted. But hey, if it works for you with just that patch to UITextLayer great! I was going to ask if your patch worked also with placeholder text but now that I think about it, support for placeholder text in UITextFields is not on the master repo so its an issue you won't run into...

@michaelmelanson
Copy link

If anyone is having troubles with building against the OS X 10.8 SDK, I have put several commits in my fork of the project at https://github.com/michaelmelanson/Chameleon/tree/master which fix the issues we encountered getting our application to work.

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

No branches or pull requests

6 participants