Code review comment for lp:~mc-return/compiz/compiz0.9.9.merge-plugin-screensaver

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Sat, Mar 30, 2013 at 7:22 PM, MC Return <email address hidden> wrote:
> I understand that we do not want to add a new dependency and you mentioned:
>
> "We could make the dependency conditional.
>
> I know that the dependency on libxss-dev is only there for the
> screensaver timeout logic. That can be conditionally compiled, so
> users of the ubuntu package won't get the timeout-to-screensaver
> functionality."
>
> I would like to help implementing that.
> We could maybe use some internal Compiz timer to add that functionality
> to the Compiz toolbox and not to have to depend on libxss-dev at all.

As mentioned, you can do something like that with cmake in the
toplevel CMakeLists.txt and a config.h.in

config.h.in:

#cmakedefine USE_XSS

CMakeLists.txt

pkg_check_modules (LIBXSS xscrnsaver)

if (LIBXSS_FOUND)
    set (SCREENSAVER_ADDITIONAL_LIBRARIES ${LIBXSS_LIBRARIES})
    set (SCREENSAVER_ADDITIONAL_INCLUDES ${LIBXSS_INCLUDE_DIRS})
    set (USE_XSS ON)
endif (LIBXSS_FOUND)

configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
                     ${CMAKE_CURRENT_BINARY_DIR}/config.h.in)

include_directories (${CMAKE_CURRENT_BINARY_DIR}
                             ${SCREENSAVER_ADDITIONAL_INCLUDES})

compiz_plugin (screensaver PLUGINDEPS composite opengl LIBRARIES
${LIBXSS_LIBRARIES})

Then in the code, you can just conditionally compile the bits that
depend on libxss.

#ifdef USE_XSS
....
#else
....
#endif

>
> I am sure you have an idea on how to best achieve that, Sam ;)
> --
> https://code.launchpad.net/~mc-return/compiz/compiz0.9.9.merge-plugin-screensaver/+merge/141533
> You are reviewing the proposed merge of lp:~mc-return/compiz/compiz0.9.9.merge-plugin-screensaver into lp:compiz.

--
Sam Spilsbury

« Back to merge proposal