Giter Club home page Giter Club logo

Comments (6)

PadraigK avatar PadraigK commented on July 1, 2024

It gets shorter by the exact amount more you set titleBarHeight past the standard size (22).

from inappstorewindow.

indragiek avatar indragiek commented on July 1, 2024

Hmm, this sounds like it would be pretty difficult to fix, as the share sheet itself seems to be resizing the window. I don't think this could be resolved from within INAppStoreWindow, but maybe you could try fiddling around with the NSSharingServiceDelegate method sharingService:sourceFrameOnScreenForShareItem::

http://developer.apple.com/library/Mac/#documentation/AppKit/Reference/NSSharingServiceDelegate_Protocol/Reference/Reference.html

from inappstorewindow.

PadraigK avatar PadraigK commented on July 1, 2024

After a bit of testing, sharingService:sourceFrameOnScreenForShareItem: seems to determine only where the animation of the tweet window begins from, not the rect the shaded area works with.

from inappstorewindow.

indragiek avatar indragiek commented on July 1, 2024

I see, thanks for looking into it. I can't really think of a good way to fix this from within INAppStoreWindow. The sharing service picker itself is modifying the window somehow, in a way that INAppStoreWindow doesn't like. There's no code inside INAppStoreWindow to resize the window by itself, so what I'm assuming is that the picker uses the window's content/frame rects to calculate some geometry and screws up the calculations as a result of INAppStoreWindow modifying the content view frame.

I did a bit of quick testing by overriding NSWindow layout methods like -contentRectForFrameRect: to see if any of those are called when the sheet appears, but they aren't. I'll keep thinking on this one, but if you discover a fix in the mean time, a pull request would be greatly appreciated!

from inappstorewindow.

gcox avatar gcox commented on July 1, 2024

This is actually caused by setting the styleMask property of the window, which is what NSSharingService is doing before the sharing modal is displayed and when it is dismissed.

You can reproduce this by replacing the code in the example's shareOnTwitter: action with:

-(IBAction)shareOnTwitter:(id)sender
{
    [self.window setStyleMask:self.window.styleMask & ~NSResizableWindowMask];
    [NSThread sleepForTimeInterval:1];
    [self.window setStyleMask:self.window.styleMask | NSResizableWindowMask];
}

When that runs the window's height is reduced after both calls to setStyleMask.

The following is my work-around for the problem, maybe it gives someone an idea on how to fix the problem in INAppStoreWindow itself:

@implementation CustomINAppStoreWindow {
    BOOL _preventResizing;
}

-(void)setFrame:(NSRect)frameRect display:(BOOL)flag {
    if (_preventResizing)
        return;
    [super setFrame:frameRect display:flag];
}
-(void)setStyleMask:(NSUInteger)styleMask {
    _preventResizing = YES;
    [super setStyleMask:styleMask];
    _preventResizing = NO;
}

@end

from inappstorewindow.

indragiek avatar indragiek commented on July 1, 2024

Awesome! Your fix is a good one and after trying it with Padraig's example project, it seems that the issue is resolved :) I'll merge this fix into master.

from inappstorewindow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.