McCLIM icon indicating copy to clipboard operation
McCLIM copied to clipboard

How to write a new backend for McCLIM

Open ailisp opened this issue 9 years ago • 16 comments

I remember that there were gtkairo and graphicforms backends for McCLIM. If I want to write a new backend wrap native windows api to enable McCLIM to run under Windows, which files, classes and function/methods should be implemented? Which folder in the Backends folder can be a good reference? Thanks.

ailisp avatar Aug 14 '16 01:08 ailisp

Hey, currently we have no clear instructions how to write a new backend (we want to have such guide though). Current focus is targeted at improving CLX backend.

The other backends were broken and I won't be ably to provide any information on them except information covered here, but if you want to work on them here are some tips:

  • beagle backend requires ccl and isn't removed
  • gtkairo was removed with commit a427e9d
  • clim-graphic-forms (windows) was removed with commit 2077454 (it seems to depend on https://common-lisp.net/viewvc/graphic-forms/trunk/)
  • OpenGL backend was removed with commit d1bc1e2

Regarding the system definitions, keep in mind that some systems might have changed their names. Regarding the dependencies, I'd look at CLX backend. Backend "Standard" is just a shared implementation of some functions.

If you want to change the default backend, you need to change Core/clim-basic/ports.lisp *server-path-search-order* to find your backend first and toplevel mcclim.asd system mcclim/looks to load your backend if accessible.

Toplevel file package.lisp contains a package clim-backend with a comment mentioning, that this symbols "must be defined by a backend" – it may be a good starting point to read them.

dkochmanski avatar Aug 14 '16 05:08 dkochmanski

Thanks, its quite detailed. I will try to write a windows backend.

ailisp avatar Aug 14 '16 08:08 ailisp

@dkochmanski is this information up to date? I'm going to try to write an OpenGL backend.

gregcman avatar Jan 17 '20 20:01 gregcman

Hows the backend for Mezzano as a starting point? https://github.com/McCLIM/McCLIM/compare/master...fittestbits:fittestbits/compositor

gregcman avatar Jan 17 '20 20:01 gregcman

It seems relatively simple.

  • McCLIM array -> Opticl data -> Opengl Texture
  • One opengl texture per McCLIM frame
  • An event pipe, for resizing, and mouse and keyboard events

gregcman avatar Jan 17 '20 21:01 gregcman

I got a prototype working, here's a first glimpse: alive

gregcman avatar Jan 18 '20 06:01 gregcman

https://github.com/gmasching/McCLIM

gregcman avatar Jan 18 '20 06:01 gregcman

Glimpse 2: alive

gregcman avatar Jan 18 '20 06:01 gregcman

congrats! yes, information is up to date as far as I can tell.

dkochmanski avatar Jan 18 '20 15:01 dkochmanski

The file mezzano-shim.lisp seems to be missing.

slyrus avatar Jan 18 '20 17:01 slyrus

Whoops, here's mezzano-shim.lisp: https://github.com/gmasching/McCLIM/commit/f3da99dfeec24012b5136139c0c6cb0f479d75cd

gregcman avatar Jan 18 '20 18:01 gregcman

The demo has been cleaned up, see: https://github.com/gmasching/McCLIM/tree/fittestbits/compositor/Backends/Mezzano

Basically:

(ql:mcclim-mezzano-test)
(mmt:start)

Right now, you can move the mouse around, and even if you turn the thread sleeping off, there are visual artifacts. Also, sucle supports only one window at the moment. Also there are some errors related to arrays

gregcman avatar Jan 18 '20 19:01 gregcman

Image https://youtu.be/CPU2u1ItUIk

gregcman avatar Jan 18 '20 20:01 gregcman

You can click on things, drag mezzano windows around and close them. However there are optimizations and missing features as you can see.

gregcman avatar Jan 18 '20 20:01 gregcman

video update

gregcman avatar Jan 18 '20 21:01 gregcman

image https://youtu.be/2TtTcJUCb1Y

It seems to function like a fully-featured McCLIM backend [Just the mouse], however its about 7 frames per second because the compositor is slow.

gregcman avatar Jan 18 '20 22:01 gregcman