discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What function sets up the GNUstep environment?


From: Fred Kiefer
Subject: Re: What function sets up the GNUstep environment?
Date: Wed, 4 Nov 2020 21:11:47 +0100

GNUstep gui uses the backend defined in the defaults variable GSBackend, he 
default being „back". And this is documented in DefaultsSummary 
(https://github.com/gnustep/libs-gui/blob/master/Documentation/GuiUser/DefaultsSummary.gsdoc).
 When you compile a backend with a different name you set this variable to that 
name and it will be used.

Hope this helps,
Fred

> Am 04.11.2020 um 20:19 schrieb Gustavo Tavares <gustavotavares@mac.com>:
> 
> Hi Greg!
> 
> I started working on it and made some null classes.
> 
> My question is—how does AppKit know which backend to load?
> 
> I was reading GSBackend.m and I can see some macros there which determine 
> which backend but I’m not quite sure how this happens.
> 
> Can you explain?
> 
> We can add that to the docs.
> 
> Thank you,
> 
> GT
> 
> On Wed, Nov 4, 2020, at 2:54 PM, Gregory Casamento wrote:
>> Just FYI, you still need a display server (whether that's X or Windows or 
>> whatever) to start a headless application.  Is this an issue?  If it is, 
>> then we would need something like the null backend.
>> 
>> 
>> On Tue, Nov 3, 2020 at 8:48 PM Gustavo Tavares <gustavotavares@mac.com> 
>> wrote:
>> 
>> Yes Greg, I want to archive / unarchive GUI classes for Attributed String. 
>> Colors, Fonts, Attachments, etc.
>> 
>> On Tue, Nov 3, 2020, at 6:38 PM, Gregory Casamento wrote:
>>> Gustavo,
>>> 
>>> NSCoder and all of its implementations 
>>> (NSArchiver/NSUnarchiver/NSKeyedArchiver/NSKeyedUnarchiver) are entirely 
>>> implemented in Foundation/Base.  Unless you need to archive (or unarchive) 
>>> AppKit/GUI classes, then you really don't have any need for AppKit/GUI.  
>>> What are your requirements?  Perhaps we can close in on what you really 
>>> need.
>>> 
>>> NSAttributedString is also implemented in Foundation/Base (see here... 
>>> https://developer.apple.com/documentation/foundation/nsattributedstring?language=objc).
>>>   So you should be able to use it without loading GUI as well.
>>> 
>>> GC
>>> 
>>> 
>>> On Tue, Nov 3, 2020 at 4:44 PM Gustavo Tavares <gustavotavares@mac.com> 
>>> wrote:
>>> 
>>> To be even more specific, most of what I do would have to do with NSCoding 
>>> and storing NSAttributedString attributes—most of which are part of AppKit, 
>>> not Foundation.
>>> 
>>> On Tue, Nov 3, 2020, at 5:39 PM, Gustavo Tavares wrote:
>>>> Confirming, I just need headless so that I have access to the AppKit 
>>>> functions I call.
>>>> 
>>>> I don’t need any output whatsoever.
>>>> 
>>>> On Tue, Nov 3, 2020, at 5:22 PM, Gregory Casamento wrote:
>>>>> 
>>>>> Gustavo,
>>>>> 
>>>>> What is your true aim here?  If having a "headless" application is all 
>>>>> you really need, so that you have access to AppKit functions then that is 
>>>>> pretty easy.  You don't need to have a gui model (xib, nib, gorm, etc) 
>>>>> attached to the application.
>>>>> 
>>>>> I like the idea of a no-op or null backend as this might allow us some 
>>>>> other freedoms with respect to testing.
>>>>> 
>>>>> On Tue, Nov 3, 2020 at 3:53 PM Gustavo Tavares <mucholove@fastmail.com> 
>>>>> wrote:
>>>>> 
>>>>> Yes, Fred, Greg,
>>>>> 
>>>>> This is exactly what I need and was looking at doing just that. I did 
>>>>> some no-op classes but I have very little experience with there system to 
>>>>> do so immediately.
>>>>> 
>>>>> It doesn’t look like a lot of files but I might be wrong. There are a lot 
>>>>> of subtle interactions that I have already bumped into.
>>>>> 
>>>>> For example, right now, I’m still working through the call to 
>>>>> +[NSProcessInfo initalizeWithArguments:count:environment:] (I think I 
>>>>> have the name right but I didn’t look it up on my phone.
>>>>> 
>>>>> Calling this didn’t solve my problem immediately.
>>>>> 
>>>>> As for testing it’s pretty wonderful. I already have some tests running 
>>>>> by enclosing them in a framework (Marcel WeiHer does this in MPWTest)
>>>>> 
>>>>> The use case as a server backend is compelling too because you can save 
>>>>> and interact with User preferences for Font, Color, Theme, etc on the 
>>>>> backend just as you would on a frontend.
>>>>> 
>>>>> 
>>>>> On Tue, Nov 3, 2020, at 4:19 PM, Gregory Casamento wrote:
>>>>>> This is a really interesting notion.   Would the no-op backend (I think 
>>>>>> we need a better name) be able to print, or output postscript?  Would it 
>>>>>> be possible to use it for testing GUI in some way?
>>>>>> 
>>>>>> GC
>>>>>> 
>>>>>> 
>>>>>> On Tue, Nov 3, 2020 at 12:06 PM Fred Kiefer <fredkiefer@gmx.de> wrote:
>>>>>> Your problem got me thinking. Would it help you if we offered a „no-op“ 
>>>>>> backend for GNUstep? That is a backend where both the window and the 
>>>>>> drawing system would be implemented as no-operations.
>>>>>> 
>>>>>> We could try to get this done as a special GNUstep back configuration. 
>>>>>> Most likely we could cheat here by reusing the gsc classes as a real 
>>>>>> drawing backend, which of course would not draw but raise 
>>>>>> subclassResponsibility:. That means we only need code for the 
>>>>>> window/event part and a lot of configuration to switch all the extra 
>>>>>> libraries off.
>>>>>> 
>>>>>> Cheers,
>>>>>> Fred 
>>>>>> 
>>>>>> 
>>>>>> > Am 03.11.2020 um 16:02 schrieb Gustavo Tavares 
>>>>>> > <mucholove@fastmail.com>:
>>>>>> > 
>>>>>> > Thank you! This is great.
>>>>>> > 
>>>>>> > I think I'm going to make some sort of 
>>>>>> > subclass—NSCommandLineApplication.
>>>>>> > 
>>>>>> > I did implement some of the backend classes in a -doNothingMethod { ; 
>>>>>> > } style: GSFontInfo / GSFontEnumerator.
>>>>>> > 
>>>>>> > Previously I just tried running X11 and calling it a day—but that 
>>>>>> > didn't work. So goes the rabbit hole...
>>>>>> > 
>>>>>> > Looks like it will be fun though. Just gotta love Objective-C :)
>>>>>> > 
>>>>>> > Gustabo
>>>>>> > 
>>>>>> > 
>>>>>> > On Mon, Nov 2, 2020, at 11:20 PM, Ivan Vučica wrote:
>>>>>> >> Based on 
>>>>>> >> https://github.com/gnustep/libs-base/blob/3752016/Source/NSProcessInfo.m#L140-L154,
>>>>>> >>  this comes from 
>>>>>> >> https://github.com/gnustep/libs-base/blob/3752016/Source/NSProcessInfo.m#L919
>>>>>> >>  or 
>>>>>> >> https://github.com/gnustep/libs-base/blob/3752016/Source/NSProcessInfo.m#L1021.
>>>>>> >>  
>>>>>> >> If these were GUI apps, I’d recommend calling NSApplicationMain which 
>>>>>> >> takes argc and argv and sorts this out for you – in fact, that’s 
>>>>>> >> ideally exactly what you should do if you’re using any GUI methods.  
>>>>>> >> You’re saying you’re using certain GUI classes on the server; if you 
>>>>>> >> believe they will actually behave correctly in a server environment 
>>>>>> >> without gnustep-back (not a given; hypothetically, NSColor could 
>>>>>> >> heavily depend on Opal’s CGColorRef), you may be able to call 
>>>>>> >> NSProcessInfo +initializeWithArguments:..., too.
>>>>>> >>  
>>>>>> >> Otherwise study 
>>>>>> >> https://github.com/gnustep/libs-gui/blob/0ccdb278d4cc8ad60f033892a5105e0532261838/Source/Functions.m#L63
>>>>>> >>  carefully, but don’t be surprised if lack of x11 breaks GUI classes. 
>>>>>> >> You break it (into pieces), you get to pick up those pieces and glue 
>>>>>> >> them together :)
>>>>>> >>  
>>>>>> >> (Yes, I noticed you said you went ahead and removed some 
>>>>>> >> backend-dependent code. This sounds like it’ll be a lot of fun…)
>>>>>> >>  
>>>>>> >> Ivan Vučica
>>>>>> >>  
>>>>>> >> From: Gustavo Tavares
>>>>>> >> Sent: Tuesday 3 November 2020 02:13
>>>>>> >> To: GNUstep Discuss
>>>>>> >> Subject: What function sets up the GNUstep environment?
>>>>>> >> 
>>>>>> >>  
>>>>>> >> Hi!
>>>>>> >>  
>>>>>> >> Was wondering what function sets up a GNUstep environemtnt?
>>>>>> >>  
>>>>>> >> Getting this error:
>>>>>> >>  
>>>>>> >> GNUSTEP Internal Error:
>>>>>> >> The private GNUstep function to establish the argv and environment
>>>>>> >> variables was not called.
>>>>>> >>  
>>>>>> >> Mismatched library versions between GNUstep Foundation (base) and 
>>>>>> >> AppKit
>>>>>> >> (gui) is most often the cause of this message. Please be sure you
>>>>>> >> are using known compatible versions and not a mismatched set. 
>>>>>> >> Generally,
>>>>>> >> we recommend you use versions of base and gui which were released 
>>>>>> >> together.
>>>>>> >>  
>>>>>> >> For more detailed assistance, please report the error to 
>>>>>> >> bug-gnustep@gnu.org.
>>>>>> >>  
>>>>>> >> ---
>>>>>> >>  
>>>>>> >> For context—I built a seperate framework that extracts some "GUI" 
>>>>>> >> classes with the intention to use them semantically on a server. 
>>>>>> >> (Such as NSImage, NSColor, NSFont...)
>>>>>> >> I already went through the business of overriding / deleting some of 
>>>>>> >> the backend functions so that the classes would be "initalized" and 
>>>>>> >> wouldn't need to be rendered to screen.
>>>>>> >>  
>>>>>> >> Stuck here. 
>>>>>> >> 
>>>>>> >> Where should I look?
>>>>>> >> 
>>>>>> >>  
>>>>>> >> Thank you,
>>>>>> >> G
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> Gregory Casamento
>>>>>> GNUstep Lead Developer / OLC, Principal Consultant
>>>>>> http://www.gnustep.org - http://heronsperch.blogspot.com
>>>>>> https://www.patreon.com/bePatron?u=352392 - Become a Patron
>>>>>> https://gf.me/u/x8m3sx - My GNUstep GoFundMe
>>>>>> https://teespring.com/stores/gnustep - Store
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Gregory Casamento
>>>>> GNUstep Lead Developer / OLC, Principal Consultant
>>>>> http://www.gnustep.org - http://heronsperch.blogspot.com
>>>>> https://www.patreon.com/bePatron?u=352392 - Become a Patron
>>>>> https://gf.me/u/x8m3sx - My GNUstep GoFundMe
>>>>> https://teespring.com/stores/gnustep - Store
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Gregory Casamento
>>> GNUstep Lead Developer / OLC, Principal Consultant
>>> http://www.gnustep.org - http://heronsperch.blogspot.com
>>> https://www.patreon.com/bePatron?u=352392 - Become a Patron
>>> https://gf.me/u/x8m3sx - My GNUstep GoFundMe
>>> https://teespring.com/stores/gnustep - Store
>> 
>> 
>> 
>> -- 
>> Gregory Casamento
>> GNUstep Lead Developer / OLC, Principal Consultant
>> http://www.gnustep.org - http://heronsperch.blogspot.com
>> https://www.patreon.com/bePatron?u=352392 - Become a Patron
>> https://gf.me/u/x8m3sx - My GNUstep GoFundMe
>> https://teespring.com/stores/gnustep - Store




reply via email to

[Prev in Thread] Current Thread [Next in Thread]