I fully agree with you that dispatch based on strings is bad and having
that done at compile time, either in this file or in some make file
magik, is definitely the better solution.
What would you call the common parts of the backend? The gsc classes?
Moving these into a separate framework semms wrong to me, they either
belong to gui (as part of NSGraphicContext) or into the backend itself.
And at the tiem we made the split of gui and back the current interface
seemed sensible to us, it still does for me.
What we are talking about here is somebody wanting to write a new
backend, lets say from framebuffer, Wayland or CoreGraphics. I don't see
anything stopping him or her to integrate this into the current back
code. Doing so would help to share code between the different
implementations. At least up to now it was the best way to handle that code.
Fred
On 28.06.2012 03:55, Gregory Casamento wrote:
Fred,
What I had thought is that the initializeBackend method could use
information from the info.plist for the bundle to determine what the
concrete subclass for the context and server are. This would be trivial to
implement.
It seems to me that it should be possible to compile a backend without
modifying the logic I quoted in the previous message.
Wouldn't it be also better to build the common parts of the backend into a
framework so that "third party" backends could be written without requiring
direct changes to GNUstep code.
This is just something I was thinking about that could be useful which is
why I asked for thoughts regarding it. It is not a fully formed idea, so
there shouldn't be any puzzling over it, I was asking people to brainstorm
a little with me.
Later, GC
On Wed, Jun 27, 2012 at 5:36 PM, Fred Kiefer <[email protected]> wrote:
On 27.06.2012 17:02, Gregory Casamento wrote:
Guys, currently the code which configures the backend graphics context
looks like this:
/* What backend context? */
if ([defs stringForKey: @"GSContext"])
context = [defs stringForKey: @"GSContext"];
if ([context isEqual: @"xdps"])
contextClass = NSClassFromString(@"NSDPSContext");
else if ([context isEqual: @"art"])
contextClass = NSClassFromString(@"ARTContext");
else if ([context isEqual: @"winlib"])
contextClass = NSClassFromString(@"WIN32Context");
else if ([context isEqual: @"cairo"])
contextClass = NSClassFromString(@"CairoContext");
else
contextClass = NSClassFromString(@"XGContext");
I think that this information should come from the backend bundles
plist if possible. This way it's possible to create a backend without
needing to modify backend code directly.
Any thoughts?
Later, GC
Getting this information from the plist instead of hard coding the values
here is fine by me. But how would the correct value get into the plist and
how can you write a backend without touching the backend code?
Completely puzzled,
Fred
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev