Re: Context Menu and first responder targets

2023-03-05 Thread Graham Cox via Cocoa-dev
Hi Eyal, I believe the target for a pop-up menu is the view that you pass in that method, at least initially. If there is an established responder chain from that view to other responders (up to and including First Responder) then the menu items should reach their target. But it’s pretty easy t

Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Graham Cox via Cocoa-dev
Then look at some of the other options in that API, e.g. IOPMAssertionDeclareUserActivity AFACS, this is the supported way to do the kinds of things you want, of it can be done at all. > On 29 Jun 2020, at 4:51 pm, Gabriel Zachmann wrote: > >> but the header for that function says it can be

Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-28 Thread Graham Cox via Cocoa-dev
In the “old days”, your app could periodically call UpdateSystemActivity( UsrActivity ) to prevent the screensaver kicking in. This has been deprecated since 10.8, but the header for that function says it can be replaced by IOPMAssertionCreateWithName(). I haven’t looked at that in detail or use

Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-27 Thread Graham Cox via Cocoa-dev
You can make your app trigger a command-line program and pass params using NSTask. It’s not difficult to use. But in this case you might want to negotiate this with the user - apps that just go ahead and change MY system preferences are being user-hostile to say the least. —Graham > On 28 Ju

Re: Launching in fullscreen gives "Funk" sound sometimes

2020-06-24 Thread Graham Cox via Cocoa-dev
Set a symbolic breakpoint on NSBeep and see whether it’s your code that’s calling it. —Graham > On 24 Jun 2020, at 7:23 pm, Gabriel Zachmann via Cocoa-dev > wrote: > > I have an app that should switch to fullscreen automatically, > if it is launched with a specific flag. > > This is my co

Re: Increasing stack size of NSDocument's open file thread

2017-07-06 Thread Graham Cox
> On 7 Jul 2017, at 2:44 am, Jens Alfke wrote: > > >> On Jul 6, 2017, at 8:42 AM, Steve Mills wrote: >> >> Why can't you spawn your own thread to do the recursive code? Create the >> NSThread, set its stack size, light its fuse to do the processing, and >> delete it. > > This. Although I w

Re: Increasing stack size of NSDocument's open file thread

2017-07-06 Thread Graham Cox
> On 6 Jul 2017, at 11:04 pm, Alastair Houghton > wrote: > > There’s no way an API could exist that did that - in general it’d have to > copy the entire existing stack to a new location, then update a load of > pointers that it has no obvious way to find (otherwise the moment you return, > e

Increasing stack size of NSDocument's open file thread

2017-07-05 Thread Graham Cox
Hi all, I’m wondering if there’s a way to increase the stack size of the thread that opens my NSDocument in the background. NSThread has a -setStackSize: method which would work, but it must be set prior to starting the thread. The problem is I don’t start the thread - Cocoa does. By the time

Re: Very slow NSTableView

2017-07-05 Thread Graham Cox
> On 5 Jul 2017, at 7:25 pm, Georg Seifert wrote: > > Any reason you set the tableview to be "Source List". Set it to regular and > it will work perfectly. It seems that the NSPopUpButtonCell don’t like to be > in a source list. Maybe you can subclass it and draw yourself? Interesting… I don

Re: Very slow NSTableView

2017-07-04 Thread Graham Cox
> On 5 Jul 2017, at 11:23 am, Graham Cox wrote: > > If anyone can offer a place to host the project, I’d be happy to share it, > and see whether the problem is seen by others. (I no longer have file hosting > services). Never mind - I remembered I had an Amazon S3 acco

Re: Very slow NSTableView

2017-07-04 Thread Graham Cox
> On 5 Jul 2017, at 5:21 am, Quincey Morris > wrote: > > OTOH, before you go to too much more trouble with this, it seems to me that > your next step is to convert to a view-based table view. It’s really not that > much work, and cell-based table views were deprecated in 10.10, which is > ba

Re: Very slow NSTableView

2017-07-04 Thread Graham Cox
> On 4 Jul 2017, at 6:02 pm, Graham Cox wrote: > > I can live with layer-backing as a solution, it doesn’t appear to have any > downsides. I spoke too soon. Layer backing disguises the performance issue by capturing the first render pass which is then used for scrolling. So

Re: Very slow NSTableView

2017-07-04 Thread Graham Cox
> On 4 Jul 2017, at 5:39 pm, Quincey Morris > wrote: > > On Jul 4, 2017, at 00:18 , Graham Cox wrote: >> >> Is there a way to opt-out of vibrancy for an entire table view? > > There’s no clear indication that the performance problem has anything to do &

Re: Very slow NSTableView

2017-07-04 Thread Graham Cox
> On 4 Jul 2017, at 5:00 pm, Graham Cox wrote: > > >> On 4 Jul 2017, at 12:29 pm, Quincey Morris >> wrote: >> >> On Jul 3, 2017, at 18:19 , Graham Cox wrote: >>> >>> slow. as. molasses. >> >> What does Instruments say it’

Re: Very slow NSTableView

2017-07-04 Thread Graham Cox
> On 4 Jul 2017, at 12:29 pm, Quincey Morris > wrote: > > On Jul 3, 2017, at 18:19 , Graham Cox wrote: >> >> slow. as. molasses. > > What does Instruments say it’s doing? > Heh, well, I wish I knew. Instruments isn’t working. It’s a new machine whic

Very slow NSTableView

2017-07-03 Thread Graham Cox
I have a NSTableView, cell-based (partially because it’s a very long-standing piece of code, partially because it is just a table of values which a cell-based table is ideally suited to - view-based would not do anything for me here). This table has always worked fine, but in Sierra, it is slow

Re: Doubled Pixels

2017-06-25 Thread Graham Cox
> On 25 Jun 2017, at 7:39 pm, Gerriet M. Denkmann wrote: > > Which of these two lines is preferable: > NSString *colorSpaceName = useColour ? NSDeviceRGBColorSpace : > NSDeviceWhiteColorSpace; > NSString *colorSpaceName = useColour ? NSCalibratedRGBColorSpace : > NSCalibratedWhite

Re: Doubled Pixels

2017-06-24 Thread Graham Cox
> On 24 Jun 2017, at 4:46 pm, Gerriet M. Denkmann wrote: > >> By making the NSBitMapRepresentation yourself, creating a context for it, >> drawing to that. >> —Graham > > You severely underestimate the depth of my ignorance. It took me half a day > to fathom your (for me) cryptic remarks. > B

Re: Why is XCode suddenly doing this?

2017-06-23 Thread Graham Cox
h blah something > about backup blah) but I changed mine so that all archives were in the same > correct place. > > Mark > >> On 23 Jun 2017, at 5:19 am, Graham Cox wrote: >> >> I’ve been archiving built Mac apps forever with no issues. (Build -> Archive

Re: Doubled Pixels

2017-06-23 Thread Graham Cox
> On 24 Jun 2017, at 1:45 am, Gerriet M. Denkmann wrote: > > the image looks fine, but when I write subData to disk, it has 64 x 64 pixels. By making the NSBitMapRepresentation yourself, creating a context for it, drawing to that. If you make it yourself using the long-winded but complete in

Why is XCode suddenly doing this?

2017-06-22 Thread Graham Cox
I’ve been archiving built Mac apps forever with no issues. (Build -> Archive) Suddenly, XCode has stopped adding the archive to the ‘Mac OSX Apps section under that particular app, and started it adding it as a ‘Generic XCode Archive’ under the ‘Other’ section. Why, and more importantly, how do

Re: Writing NSImage

2017-06-21 Thread Graham Cox
Drop down one level - create a bitmap image rep of the type you want, make a context for it, draw the image into that, then (if necessary) add it to a NSImage with addRepresentation: Working at this level you have total control, and rarely need an NSImage at all. —Graham > On 21 Jun 2017, a

Re: Annual codesign pain point

2017-06-18 Thread Graham Cox
, which were probably a red herring after all. —Graham > On 19 Jun 2017, at 1:58 pm, Shane Stanley wrote: > > On 19 Jun 2017, at 1:06 pm, Graham Cox wrote: >> >> resource fork, Finder information, or similar detritus not allowed > > See: <https://develope

Annual codesign pain point

2017-06-18 Thread Graham Cox
Hi all, It’s that time of year, so it must mean it’s time for my annual frustration-fest that is dealing with code signing. I just upgraded to a new Mac for development. I transferred everything from the previous Mac using migration assistant, and mostly it works fine. The transfer included Xc

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Graham Cox
just transform a known point and see where it ends up. That way you don’t need to know how the transform’s internals are laid out. > On 15 Mar 2017, at 2:41 PM, Eric E. Dolecki wrote: > > I don't follow. > > On Tue, Mar 14, 2017 at 11:29 PM Graham Cox wrote: > Get th

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Graham Cox
Get the final transform, then use it to transform an angle of 0. The result is the angle. —Graham > On 15 Mar 2017, at 2:13 PM, Eric E. Dolecki wrote: > > Once done (I dispatch after the randomSpeed duration), I'd like to > determine the angle it's currently at. > > *let transform:CATransfo

Re: Sometimes all my menus are disabled

2017-02-14 Thread Graham Cox
> On 15 Feb 2017, at 12:39 AM, Andreas Falkenhahn > wrote: > > I knew how to use IB on the old PowerPC Mac, > but that was 10 years ago. Well, it hasn’t changed that much in principle. In fact it’s got a lot better in most respects because it stays in sync with your code and is not a separate

Re: Sometimes all my menus are disabled

2017-02-13 Thread Graham Cox
> On 14 Feb 2017, at 3:58 AM, Andreas Falkenhahn wrote: > > This annoying issue is just another reason why I prefer doing things in code. > This has already cost me hours over hours and it's still not solved. > True, I can see that. But how do I rewire my nib? I don't remember anything > about

Re: Sometimes all my menus are disabled

2017-02-12 Thread Graham Cox
Another possibility is that the target (app delegate) overrides -validateMenuItem: and isn’t doing the right thing. —Graham > On 13 Feb 2017, at 7:55 AM, Kyle Sluder wrote: > >>> >>> On Feb 12, 2017, at 12:36 PM, Andreas Falkenhahn >>> wrote: >> >> >>> On 12.02.2017 at 21:29 Kyle Slu

Re: What should we do if file-opening takes a long time?

2016-12-31 Thread Graham Cox
NSDocument will open it on a background thread if you implement +canConcurrentlyReadDocumentsOfType: to return YES for that file type. All of the data is read in and the model prepared before any user interface (e.g. the document window) is created. If there’s a failure you’ll see an error alert

Re: Giving names to undo actions

2016-12-21 Thread Graham Cox
I believe NSUndoManager arguably works a bit incorrectly in this regard - I’ve just run into the same issue on one project. When you register an Undo action, you set the action name. On an Undo or a Redo, because you’re invoking the ‘inverse’ operation which may also be a normal operation, it c

Re: [Solved] Crash in addSubview: when compiled with SDK > 10.9

2016-11-03 Thread Graham Cox
> On 4 Nov 2016, at 2:00 AM, Konidaris Christos wrote: > > The problem was that my NIBs also contained NSViewController objects for some > of their subviews. Changing these controllers to plain NSObjects eliminated > the crashes. > > Thank you for pointing me to the correct direction. > Tha

Re: observeValueForKeyPath:... called too often in macOS 12

2016-10-17 Thread Graham Cox
> On 15 Oct 2016, at 5:08 PM, Gerriet M. Denkmann wrote: > > Any workaround for these multiple (and unnecessary) calls? Do they actually cause any problems? If not, just move on - there’s probably no point worrying about it. If they do cause a problem, then that might indicate a code smell o

Re: Xcode 8 causes scroll issue when displaying keyboard

2016-10-11 Thread Graham Cox
> On 12 Oct 2016, at 12:29 PM, Rick Mann wrote: > > Ah, it happens because we call becomeFirstResponder() on the first text field > while in viewWillAppear(). Dispatching that on the main queue asynchronously > fixes the problem, but ugh it's so hacky. What if you called it in -viewDidAppear

Re: Swift 3 macOS read keyboard

2016-10-10 Thread Graham Cox
I don’t think this is the right way to do this. NSWindow, NSWindowController and NSView, NSViewController all inherit from NSResponder, which provide standard methods for dealing with keyUp and keyDown events. The normal approach to receive these events is to subclass one of these (least likel

Re: Cocoa-dev Digest, Vol 13, Issue 415

2016-09-29 Thread Graham Cox
> On 30 Sep 2016, at 3:48 AM, Gabriel Zachmann wrote: > > I was just a little bit hesitant to use the regular ScreenSaverDefaults for > those really small pieces of data that change every time, > because I already use the ScreenSaverDefaults to store quite a bit of other > data (that changes o

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Graham Cox
> On 27 Sep 2016, at 7:28 PM, Felipe Monteiro de Carvalho > wrote: > > By the way, not sure if this makes a difference, but the original text > was added via NSTextView.string > > It is not text inputted by the user. > Well, a NSTextView can’t have a string unless it came from somewhere, the

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Graham Cox
> On 27 Sep 2016, at 7:26 PM, Felipe Monteiro de Carvalho > wrote: > > But to be sure I will test the same thing as you are testing, you are > reading the text via NSTextView.string ? Yes. I set up a very simple situation where the NSTextView’s delegate simply logs the textView.string as I t

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Graham Cox
> On 27 Sep 2016, at 5:31 PM, Felipe Monteiro de Carvalho > wrote: > > But the resulting string contains line endings which are added in the > places where the word-wrap takes places, and I need the raw text, > without such added line endings. Are you sure about that? I’ve never seen the text

Re: XCode documentation browser

2016-09-26 Thread Graham Cox
> On 27 Sep 2016, at 11:01 AM, Graham Cox wrote: > > the browser has started to open everything in Safari Never mind; re-downloading the doc sets has fixed it. —G. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not p

XCode documentation browser

2016-09-26 Thread Graham Cox
Forgive this non-Cocoa question, but I’m sure the learned folks on this list will be much quicker at pinpointing the issue…. I’m using XCode 7.3.1 on OSX 10.11.6. The built-in documentation browser has always worked fine, and I usually download the doc sets locally so that it’s reasonably fast

Re: Subclassing and Archiving/Unarchiving

2016-09-25 Thread Graham Cox
> On 25 Sep 2016, at 8:12 PM, Dave wrote: > > Is there any way that I can get the archiver to just select the Base Class > and ignore the extra properties in the Subclass? Or is there a better way of > doing this? You mean the dearchiver. It can have a delegate (NSKeyedUnarchiverDelegate,

Re: Stupid objective-c question

2016-09-23 Thread Graham Cox
> On 24 Sep 2016, at 12:13 PM, Uli Kusterer > wrote: > >> I expect the first thing -isEqualToString: does is a pointer comparison, so >> it’s unlikely to be significantly less performant for the case of when the >> pointers are literally identical. > > No, Graham, don't do that! > > There i

Re: MLMediaLibrary sometimes does not call my KVO

2016-09-22 Thread Graham Cox
> On 22 Sep 2016, at 10:45 PM, Gabriel Zachmann wrote: > >> I’ve run into some unreliability in MLMediaLibrary. It appears to be a bug >> because it sometimes can be seen in places that use MLMediaLibrary within >> general standard components, such as NSOpenPanel (this adds a media browsing >

Re: Stupid objective-c question

2016-09-21 Thread Graham Cox
> On 22 Sep 2016, at 10:40 AM, Quincey Morris > wrote: > > On Sep 21, 2016, at 17:01 , Graham Cox wrote: >> >> This should be: if([(NSString*)context >> isEqualToString:@“mediaLibraryLoaded”])… > > Actually, this is not a good idea either, because *oth

Re: Stupid objective-c question

2016-09-21 Thread Graham Cox
> On 22 Sep 2016, at 9:44 AM, Gabriel Zachmann wrote: > > I have found on the net That isn’t always a recommendation ;) > if ( context == (__bridge void *) @"mediaLibraryLoaded" ) Don’t do this, even if it appears to work. You got lucky, or are taking advantage of undocumented implement

Re: MLMediaLibrary sometimes does not call my KVO

2016-09-21 Thread Graham Cox
> On 22 Sep 2016, at 8:59 AM, Gabriel Zachmann wrote: > > I am a bit at a loss about the MLMediaLibrary API. > Maybe, I haven't quite understood it yet, maybe something else is wrong. > > I am writing a screen saver that accesses Photos' albums and the images > referenced by them. > (Code exce

Re: Package installation on MacOS Sierra

2016-09-18 Thread Graham Cox
> On 19 Sep 2016, at 7:22 AM, Jonathan Mitchell wrote: > > Hi > > I have a MacOS package that installs into /Applications on 10.11. > On 10.12 it appears to install into the user’s Downloads folder. > > Is this change related to the new feature in MacOS 12 to encapsulate > downloaded apps int

Re: Replacement for CGContextSelectFont ?

2016-09-18 Thread Graham Cox
> On 18 Sep 2016, at 7:24 PM, Gabriel Zachmann wrote: > > But if anyone could suggest modifications to make it better (e.g., remove a > bug, make it simpler, or more future proof), > I will greatly appreciate it. Have you looked at or tried CATextLayer? It already does all of this internally

Re: Replacement for CGContextSelectFont ?

2016-09-15 Thread Graham Cox
Another alternative, if you’re going to go high-level, is to use a CATextLayer. —Graham > On 16 Sep 2016, at 12:46 AM, Alex Kac wrote: > > One thing you might consider is just using an attributed string: > > NSAttributedString* attrString = [[NSAttributedString alloc] > initWithString:@"Tex

Re: What difference exist from where a method will be called?

2016-09-08 Thread Graham Cox
> On 8 Sep 2016, at 11:13 PM, Raimond Hettrich wrote: > > the init-method of the DelegateClass is running. This is because I have a > class object in the Document.xib file Alarm bells. What exactly does this mean? I assume you mean you have a custom view within the document’s window, and yo

Re: What difference exist from where a method will be called?

2016-09-08 Thread Graham Cox
> On 8 Sep 2016, at 11:37 PM, Raimond Hettrich wrote: > > he ivar / property theme can’t be the solution (so I think as newbie :)), > because the sent array comes with it’s content to the DelegateClass. If there > were a problem, maybe that I sent an empty array it couldn’t come to the > Dele

Re: What difference exist from where a method will be called?

2016-09-08 Thread Graham Cox
> On 8 Sep 2016, at 9:27 PM, Raimond Hettrich wrote: > > @interface Document : NSDocument { >NSMutableArray *tableViewArray; > } > > @property (copy) NSMutableArray *tableViewArray; > > > @end > > > // > // Document.m > // Test > // > > #import "Document.h" > > @interface Document (

Re: What difference exist from where a method will be called?

2016-09-08 Thread Graham Cox
> On 8 Sep 2016, at 9:27 PM, Raimond Hettrich wrote: > > @interface DelegateClass : NSView { >NSMutableArray *delegateArray; > > >__weak IBOutlet Document *documentOutlet; > } > > @end > > > // > // DelegateClass.m > // Test > // > > #import "DelegateClass.h" > > @implementatio

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Graham Cox
> On 8 Sep 2016, at 3:44 AM, Andreas Falkenhahn wrote: > > How can I access "IMPORTANT_DATA_PTR" from within the block above? You already did it. Variables are captured from the scope where the block is declared and “magically” get referenced within the block. So what you’ve written should w

Re: Security-scoped bookmarks, what's going on?

2016-09-06 Thread Graham Cox
> On 7 Sep 2016, at 2:12 PM, Quincey Morris > wrote: > > In other words, don’t create the bookmark data every time in > ‘encodeWithCoder’. Instead, create it once when you first get the URL from > NSOpen/SavePanel, store it as a property, and archive that NSData object. Ah, that makes (some

Security-scoped bookmarks, what's going on?

2016-09-06 Thread Graham Cox
Hi all, I’m having trouble with security-scoped bookmarks in a sandboxed app. I have an object which has a URL as a property, being a folder the user chooses to save stuff to. This object is persistent, due to NSCoding. When I archive the URL, I use a security-scoped bookmark to save the data.

Re: NSUserNotificationCenter configuration mysteries

2016-08-30 Thread Graham Cox
> On 31 Aug 2016, at 10:42 AM, Graham Cox wrote: > > note.identifier = self.URL.absoluteString; > > [[NSUserNotificationCenter > defaultUserNotificationCenter] delive

NSUserNotificationCenter configuration mysteries

2016-08-30 Thread Graham Cox
I want to post a notification to the NSUserNotificationCenter when a certain event happens in my app (the user is able to toggle which events cause notifications). It’s working, but not how I want. I can’t find the documentation that tells me what I need to know. What I want: For EVERY event o

[SOLVED] Re: length of file from NSFileHandle?

2016-08-27 Thread Graham Cox
> On 27 Aug 2016, at 1:41 PM, Ken Thomases wrote: > > The reason it has no length property is because not all NSFileHandles have > the concept of a length. For example, a file handle associated with a pipe > or socket. Right, though for those cases it could just return 0 or some other marker

length of file from NSFileHandle?

2016-08-26 Thread Graham Cox
Hi all, Apparently a simple task, but no obvious API for it: getting the length (size) of a file I have a NSFileHandle for. This class has no -length property, so how can I get it? I need to know because I have a requirement to create a backup copy of a file once it exceeds a certain size. Thi

Re: Does setFormatter() retain?

2016-08-24 Thread Graham Cox
> On 25 Aug 2016, at 6:24 AM, Andreas Falkenhahn wrote: > > If it retains, I could just do the following: > >[textField setFormatter:formatter]; >[formatter release]; > > And I wouldn't have to worry about "formatter" any longer. If it doesn't > retain, > the above isn't possible.

Re: NSAlert::runModal doesn't work on 10.6

2016-08-23 Thread Graham Cox
> On 24 Aug 2016, at 12:52 AM, Andreas Falkenhahn > wrote: > > I really can't use NSApplicationMain() because AFAICS it also expects > to load a NIB file from the app bundle which simply doesn't exist for > my app because I'm not using Xcode at all and everything is set up > programmatically.

Re: NSAlert::runModal doesn't work on 10.6

2016-08-22 Thread Graham Cox
> On 23 Aug 2016, at 1:46 AM, Andreas Falkenhahn wrote: > > It is unusual in the way that it's not calling NSApplicationMain() but tries > to imitate what NSApplicationMain() does. Here goes the code that is executed > to set up the NSApp: There’s your problem. You’re not running a proper NSR

Re: GetNumEventsInQueue() for Cocoa

2016-08-21 Thread Graham Cox
> On 21 Aug 2016, at 3:59 AM, Andreas Falkenhahn wrote: > > Longer story: > > Yes, I know, my app isn't doing things the Cocoa way but that's not possible > because it's a multi-platform app written in C and I need to make the Cocoa > backend > fit into this fixed, abstracted multi-platform de

Drag and Drop on iOS

2016-08-11 Thread Graham Cox
Hi all, I have a small app that works on Mac, and I’m further developing an iOS version of it. I’m wondering what the general approach is for dragging an object from one view to another in iOS is. On the Mac version, I simply use the usual drag image+pasteboard approach, but on iOS this appear

Re: NSImage drawInRect deadlock

2016-08-10 Thread Graham Cox
> On 9 Aug 2016, at 4:05 AM, Andrew Keller wrote: > > In my app, I’m creating thumbnails of images. To do this in parallel, I’m > using the global background dispatch queue: Just to throw another consideration into the discusion, you don’t say what the thumbnails are being used for. Typica

Re: Core Data or not

2016-08-05 Thread Graham Cox
> On 6 Aug 2016, at 12:46 AM, Trygve Inda wrote: > > I am considering moving an app[…] > Everything > works. So my question is: what is your motivation? Is it underperforming? Is it just idle curiosity, restlessness, too much time on your hands, or some other state of mind? While I have s

Re: NSImage from bitmap - then delete bitmap

2016-07-26 Thread Graham Cox
> On 27 Jul 2016, at 12:18 PM, Graham Cox wrote: > > The atomic setter method probably looks something like this: A further thought. If the getter method is also protected, like: - (NSImageRep*) imageRep { @synchronized( self ) { return [[_imageR

Re: NSImage from bitmap - then delete bitmap

2016-07-26 Thread Graham Cox
> On 27 Jul 2016, at 12:05 PM, Trygve Inda wrote: > > How is it retained by the main thread without an explicit retain call? > > I would be no different than a main thread calling: > > someVar [[MyObj alloc] init] > [someVar doSomething]; > > If a worker thread were able to call [someVar rele

Codesign assumes folder structure, fails.

2016-07-25 Thread Graham Cox
Hi all, I’m getting an error from codesign when it tries to sign a third-party embedded framework. The error is: /Users/grahamcox/Library/Developer/Xcode/DerivedData/Drawkit-hlbdxcwqkoiqzlesbkfsrobctzke/Build/Products/Debug/Ortelius 2.app/Contents/Frameworks/GEOS.framework/Versions/A: No such

Re: NSFileHandle and thread safety

2016-07-25 Thread Graham Cox
> On 26 Jul 2016, at 5:37 AM, Daniel Stenmark wrote: > > 2. Can I read from a single file using two NSFileHandles on two threads at > the same time? > > Why would you need to do that in the first place? Unless you’re reading a > single byte at a time, it sounds like a sure-fire way to get co

Re: NSImage from bitmap - then delete bitmap

2016-07-23 Thread Graham Cox
> On 23 Jul 2016, at 4:09 PM, Ken Thomases wrote: > > No, because the main thread may not have started servicing the > performSelector request yet. The background thread has blocked as soon as > the request is _queued_ for the main thread, not just once the main thread > has received the req

Re: NSImage from bitmap - then delete bitmap

2016-07-22 Thread Graham Cox
> On 23 Jul 2016, at 12:45 AM, Trygve Inda wrote: > > Because the main thread sometimes needs to ask the worker threads to > terminate. If it does this after performOnMainThread has been called by a > worker thread, but before the main thread has processed it, then the main > thread will block w

Re: NSImage from bitmap - then delete bitmap

2016-07-22 Thread Graham Cox
> On 22 Jul 2016, at 11:53 PM, Trygve Inda wrote: > > How can I draw the NSImageRep directly into a window? -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]; i.e. same as NSImage. > > Also, the main pixel buffer is updated slowly (it takes a long time to > draw).

Re: NSImage from bitmap - then delete bitmap

2016-07-22 Thread Graham Cox
> On 22 Jul 2016, at 5:30 PM, Quincey Morris > wrote: > > On Jul 22, 2016, at 00:08 , Graham Cox wrote: >> >> If the thread building images never goes faster than once per second, the >> time to draw the image is a fraction of that - I’m sure 60fps is achiev

Re: NSImage from bitmap - then delete bitmap

2016-07-22 Thread Graham Cox
> On 22 Jul 2016, at 5:00 PM, Roland King wrote: > > Since you need the data to persist for display whilst you write a new image > that means there’s two separate buffers, there has to be Not sure there HAS to be. Whether it’s the easiest approach is another matter. If the thread building ima

Re: NSImage from bitmap - then delete bitmap

2016-07-21 Thread Graham Cox
> On 22 Jul 2016, at 4:40 PM, Trygve Inda wrote: > > >> With half an eye on performance, if you *do* strictly need a copy of the >> bitmap, note that NSBitmapImageRep conforms to NSCopying. You don’t have to >> turn it into a TIFF and back again. >> >> Also, you don’t even need an NSImage - th

Re: NSImage from bitmap - then delete bitmap

2016-07-21 Thread Graham Cox
> On 22 Jul 2016, at 4:08 PM, Trygve Inda wrote: > > I don't think the second part will work because of my workflow: > > At Launch: Create pixel buffer that is 1000 x 1000 pixels > > Looping thread > 1. Fill pixel buffer with pixels based on some algorithm > 2. create an NSImage with these pix

Re: NSImage from bitmap - then delete bitmap

2016-07-21 Thread Graham Cox
> On 22 Jul 2016, at 3:37 PM, Trygve Inda wrote: > > I create an NSBitmapImageRep: > > [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL > pixelsWide:pixelSize.width > pixelsHigh:pixelSize.height > bitsPerSample:8 > samplesPerPixel:4 > hasAlpha:YES > isPlanar:NO > colorSpaceName:NSDevice

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Graham Cox
> On 22 Jul 2016, at 9:22 AM, Uli Kusterer wrote: > > On 21 Jul 2016, at 17:20, Graham Cox wrote: >> One of my apps uses NSTask to wrap a command line utility that is embedded >> in the same app’s resources. This utility writes files to disk - I have no >> knowled

Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Graham Cox
One of my apps uses NSTask to wrap a command line utility that is embedded in the same app’s resources. This utility writes files to disk - I have no knowledge of which APIs it uses to do this. If the task has ended (and I can see that the actual instance of the running command line tool has dis

Re: NSTextView pagination

2016-07-07 Thread Graham Cox
> On 8 Jul 2016, at 2:42 AM, Jonathan Mitchell wrote: > > could supply a new view that would correspond to the new page orientation (if > I could get an appropriate notification) but NSPrintOperation’s -view > is readonly. Do it this way. The textview can share the same NSTextStorage a

Re: Property synthesis trouble - 32 vs 64 bit builds

2016-07-05 Thread Graham Cox
> On 6 Jul 2016, at 7:10 AM, Jonathan Taylor > wrote: > > Quicktime. My code has been 32-bit only since I first wrote it, because I > make use of the APIs in QuickTime/ImageCompression.h for encoding movies. Not really quite on-topic, but if you are having to switch to a whole new API, a po

Re: Working around radio button grouphing behaviour in 10.8 SDK?

2016-07-02 Thread Graham Cox
> On 3 Jul 2016, at 4:19 PM, Jo Meder wrote: > > Hi, > > Sorry, I thought I’d said enough. > > From the 10.8 SDK onward radio buttons which have the same superview and > action now all behave as if they’re part of one radio group. Prior to this > each radio button was independent, it was jus

Tracking down this annoyance

2016-07-02 Thread Graham Cox
In my app, I ‘m getting this message logged now and again: CoreAnimation: warning, deleted thread with uncommitted CATransaction; created by: 0 QuartzCore 0x7fff94e5c69a _ZN2CA11Transaction4pushEv + 318 1 QuartzCore 0x7fff94e5c19a _Z

Re: Issue with read/write to NSFileHandle

2016-06-30 Thread Graham Cox
> On 1 Jul 2016, at 2:18 AM, Jens Alfke wrote: > > NSFileHandle is just exposing the semantics of a file stream, i.e. a standard > C `FILE*`, or a Unix file-descriptor. Every file I/O API I can think of, on > any platform, has this behavior — there is a single offset that’s used for > reads a

Re: Issue with read/write to NSFileHandle

2016-06-29 Thread Graham Cox
> On 30 Jun 2016, at 2:27 PM, Shane Stanley wrote: > > You're not trying to use the same handle for both, are you? Yes, is that wrong? If it is wrong, what’s the purpose of +[NSFileHandle fileHandleForUpdatingURL:…] which is intended for read/write, as opposed to making a separate one for r

Issue with read/write to NSFileHandle

2016-06-29 Thread Graham Cox
Hi all, I’m not sure whether what I’m doing is right here. I’m trying to implement a simple logging system, where I write to a log file, and a NSTextView shows what’s in the log. I have a NSFileHandle that I create using +[NSFileHande fileHandleForUpdatingAtURL:error:] I write new log message

Re: Using va_list to build a formatted string

2016-06-29 Thread Graham Cox
Got it, thanks! —Graham > On 30 Jun 2016, at 12:45 PM, Wim Lewis wrote: > > You need to use -stringWithFormat:arguments: here, since you're passing in a > va_list of arguments. > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Using va_list to build a formatted string

2016-06-29 Thread Graham Cox
Hi all, Got a problem with variadic arguments. I have a function thus: voidXVLogEvent( NSString* format, ... ) { NSString* logString; va_list argsP; va_start( argsP, format ); logString = [NSString stringWithFormat:format, argsP];

Re: NSTask argument list

2016-06-26 Thread Graham Cox
> On 26 Jun 2016, at 4:58 PM, Sandor Szatmari > wrote: > > You can either asynchronously monitor the task's output with notifications, > or I have read about a new API, but never used it, > -setReadabilityHandler:^(NSFileHandle* file) > > Sandor > Thanks! I was able to set a readability

Re: NSTask argument list

2016-06-25 Thread Graham Cox
> On 26 Jun 2016, at 3:22 PM, dangerwillrobinsondan...@gmail.com wrote: > > If it helps, you can think of it as an object oriented wrapped around C > system calls that keeps track of PID and all the other bits like stdout and > so on. > That helps to grok why the args is and array and the too

Re: NSTask argument list

2016-06-25 Thread Graham Cox
Ah thanks Marco, Andy… this makes a lot more sense and works fine. —Graham > On 26 Jun 2016, at 2:30 PM, Marco S Hyman wrote: > I believe arguments is an array of arguments, not an array containing a > string that matches a command line. > > Then your arguments array should contain five item

NSTask argument list

2016-06-25 Thread Graham Cox
HI all, I am using NSTask to wrap ffmpeg, the video conversion utility. I am able to invoke ffmpeg alright, but it’s unclear how the argument list should be passed through NSTask. I tried making my various arguments into one big string, but ffmeg doesn’t parse it, instead writing an error. Her

Re: Properties: A question of style

2016-06-15 Thread Graham Cox
> On 16 Jun 2016, at 3:45 AM, Jens Alfke wrote: > > >> On Jun 14, 2016, at 4:48 PM, Graham Cox wrote: >> >> @property (readonly) BOOL isFoo; >> >> or: >> >> @property (readonly, getter=isFoo) BOOL foo; > > Are you askin

Properties: A question of style

2016-06-14 Thread Graham Cox
Hi all, Just a quick point for discussion. Suppose I have a read-only BOOL property. What’s better, to declare it as: @property (readonly) BOOL isFoo; or: @property (readonly, getter=isFoo) BOOL foo; Is there any advantage to one over the other? n.b. I’d always use the latter form for read/

Re: CIImage initWithCGLayer is deprecated in 10.11

2016-06-09 Thread Graham Cox
> On 9 Jun 2016, at 7:39 PM, Jeff Szuhay wrote: > > Here’s the thing: I draw into a layer, then I want to apply a > CIFilter to that layer. With initWithCGLayer deprecated, I > can’t for the life of me figure out how to use the existing > APIs to do what I want. > > The sample code — FunHous

Re: NSFileWrapper

2016-06-05 Thread Graham Cox
> On 6 Jun 2016, at 4:31 AM, Jens Alfke wrote: > > So I guess NSFileWrapper’s not popular on the AppKit team either :) Seems a pity, as in some cases it’s handy to pass around something that mirrors the structure of a chunk of disk storage. If it loaded its content lazily it wouldn’t have thi

Re: NSFileWrapper

2016-06-04 Thread Graham Cox
> On 5 Jun 2016, at 8:02 AM, Daryle Walker wrote: > > You have to come up with a new extension. For instance, if you’re already > using “.xyz” for you single-file format, you could use “.xyz-pkg” for your > package format. You can use the same extension and leave it to your app to figure ou

  1   2   3   4   5   6   7   8   9   10   >