(define-module (wlroots)
  #:use-module (oop goops))

(eval-when (eval load compile)
  (begin
    (define %public-modules
      (map (lambda (a) (cons 'wlroots a))
           '((backend libinput)
             (backend multi)
             (backend session)
             (backend)
             (render allocator)
             (render dmabuf)
             (render drm-format-set)
             (render renderer)
             (render texture)
             (types compositor)
             (types cursor)
             (types damage-ring)
             (types data-control)
             (types data-device)
             (types drm)
             (types fullscreen-shell)
             (types input-device)
             (types gamma-control)
             (types idle-inhibit)
             (types input-inhibitor)
             (types input-method)
             (types keyboard)
             (types layer-shell)
             (types matrix)
             (types output)
             (types output-layout)
             (types output-management)
             (types pointer)
             (types pointer-gestures)
             (types presentation-time)
             (types primary-selection)
             (types scene)
             (types screencopy)
             (types seat)
             (types server-decoration)
             (types session-lock)
             (types subcompositor)
             (types switch)
             (types tablet-tool)
             (types text-input)
             (types touch )
             (types viewporter)
             (types xcursor-manager)
             (types xdg-activation)
             (types xdg-decoration)
             (types xdg-output)
             (types export-dmabuf)
             (types xdg-shell)
             (util addon)
             (util box)
             (util log)
             (utils)
             (types))))

    (let* ((current-module (current-module))
           (current-module-interface (resolve-interface (module-name current-module))))
      (for-each
       (lambda (submodule)
         (let ((submodule-interface (resolve-interface submodule)))
           (module-use! current-module submodule-interface)
           (module-use! current-module-interface submodule-interface)))
       %public-modules)
      (set-module-duplicates-handlers!
       current-module-interface
       (append (lookup-duplicates-handlers 'merge-accessors)
               (lookup-duplicates-handlers 'merge-generics)
               (module-duplicates-handlers current-module-interface)) ))))
