2008-01-26 18:00:47 +01:00
|
|
|
/*
|
2008-02-27 09:04:17 +01:00
|
|
|
* version.c - version message utility functions
|
2008-01-25 11:49:18 +01:00
|
|
|
*
|
|
|
|
* Copyright © 2008 Julien Danjou <julien@danjou.info>
|
|
|
|
* Copyright © 2008 Hans Ulrich Niedermann <hun@n-dimensional.de>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2014-03-30 20:07:48 +02:00
|
|
|
#include "config.h"
|
|
|
|
#include "common/version.h"
|
2020-02-03 02:36:20 +01:00
|
|
|
#include "globalconf.h"
|
2014-03-30 20:07:48 +02:00
|
|
|
#include "awesome-version-internal.h"
|
|
|
|
|
2008-01-25 11:49:18 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2012-04-23 16:46:53 +02:00
|
|
|
#include <lualib.h>
|
|
|
|
#include <lauxlib.h>
|
2016-10-29 11:57:02 +02:00
|
|
|
#include <xcb/randr.h> /* for XCB_RANDR_GET_MONITORS */
|
2012-04-23 16:46:53 +02:00
|
|
|
|
2008-01-25 11:49:18 +01:00
|
|
|
/** \brief Print version message and quit program.
|
2008-02-27 09:00:42 +01:00
|
|
|
* \param executable program name
|
2008-01-25 11:49:18 +01:00
|
|
|
*/
|
|
|
|
void
|
2009-04-08 18:53:53 +02:00
|
|
|
eprint_version(void)
|
2008-01-25 11:49:18 +01:00
|
|
|
{
|
2012-06-08 02:19:07 +02:00
|
|
|
lua_State *L = luaL_newstate();
|
2016-07-09 19:05:44 +02:00
|
|
|
luaL_openlibs(L);
|
2012-04-23 16:46:53 +02:00
|
|
|
lua_getglobal(L, "_VERSION");
|
2016-07-09 19:05:44 +02:00
|
|
|
lua_getglobal(L, "jit");
|
|
|
|
|
|
|
|
if (lua_istable(L, 2))
|
|
|
|
lua_getfield(L, 2, "version");
|
|
|
|
else
|
|
|
|
lua_pop(L, 1);
|
2012-04-23 16:46:53 +02:00
|
|
|
|
2016-10-29 13:13:34 +02:00
|
|
|
/* Either push version number or error message onto stack */
|
|
|
|
(void) luaL_dostring(L, "return require('lgi.version')");
|
|
|
|
|
2008-06-24 20:25:42 +02:00
|
|
|
#ifdef WITH_DBUS
|
2019-02-20 18:04:23 +01:00
|
|
|
const char *has_dbus = "yes";
|
2008-06-24 20:25:42 +02:00
|
|
|
#else
|
2019-02-20 18:04:23 +01:00
|
|
|
const char *has_dbus = "no";
|
2008-06-24 20:25:42 +02:00
|
|
|
#endif
|
Use xcb-errors library if it is available
This library allows to get a human-readable string describing X11
requests, events, and errors. We now use this library to pretty-print
X11 errors if we get any.
To test this code, I added the following two lines to AwesomeWM so that
X11 errors are generated:
xcb_set_input_focus(globalconf.connection, 42, 42, 42);
xcb_randr_set_output_primary(globalconf.connection,
globalconf.screen->root, 42);
Output without xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=BadValue (2)
X error: request=(null) (major 140, minor 30), error=(null) (147)
Output with xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=Value (2)
X error: request=RandR-SetOutputPrimary (major 140, minor 30), error=RandR-BadOutput (147)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 15:09:21 +01:00
|
|
|
#ifdef WITH_XCB_ERRORS
|
2019-02-20 18:04:23 +01:00
|
|
|
const char *has_xcb_errors = "yes";
|
Use xcb-errors library if it is available
This library allows to get a human-readable string describing X11
requests, events, and errors. We now use this library to pretty-print
X11 errors if we get any.
To test this code, I added the following two lines to AwesomeWM so that
X11 errors are generated:
xcb_set_input_focus(globalconf.connection, 42, 42, 42);
xcb_randr_set_output_primary(globalconf.connection,
globalconf.screen->root, 42);
Output without xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=BadValue (2)
X error: request=(null) (major 140, minor 30), error=(null) (147)
Output with xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=Value (2)
X error: request=RandR-SetOutputPrimary (major 140, minor 30), error=RandR-BadOutput (147)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 15:09:21 +01:00
|
|
|
#else
|
2019-02-20 18:04:23 +01:00
|
|
|
const char *has_xcb_errors = "no";
|
Use xcb-errors library if it is available
This library allows to get a human-readable string describing X11
requests, events, and errors. We now use this library to pretty-print
X11 errors if we get any.
To test this code, I added the following two lines to AwesomeWM so that
X11 errors are generated:
xcb_set_input_focus(globalconf.connection, 42, 42, 42);
xcb_randr_set_output_primary(globalconf.connection,
globalconf.screen->root, 42);
Output without xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=BadValue (2)
X error: request=(null) (major 140, minor 30), error=(null) (147)
Output with xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=Value (2)
X error: request=RandR-SetOutputPrimary (major 140, minor 30), error=RandR-BadOutput (147)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 15:09:21 +01:00
|
|
|
#endif
|
2016-10-29 11:57:02 +02:00
|
|
|
#ifdef HAS_EXECINFO
|
2019-02-20 18:04:23 +01:00
|
|
|
const char *has_execinfo = "yes";
|
2016-10-29 11:57:02 +02:00
|
|
|
#else
|
2019-02-20 18:04:23 +01:00
|
|
|
const char *has_execinfo = "no";
|
2016-10-29 11:57:02 +02:00
|
|
|
#endif
|
2015-11-19 17:15:48 +01:00
|
|
|
|
|
|
|
printf("awesome %s (%s)\n"
|
|
|
|
" • Compiled against %s (running with %s)\n"
|
2020-02-03 02:36:20 +01:00
|
|
|
" • API level: %d\n"
|
2016-10-29 11:57:02 +02:00
|
|
|
" • D-Bus support: %s\n"
|
Use xcb-errors library if it is available
This library allows to get a human-readable string describing X11
requests, events, and errors. We now use this library to pretty-print
X11 errors if we get any.
To test this code, I added the following two lines to AwesomeWM so that
X11 errors are generated:
xcb_set_input_focus(globalconf.connection, 42, 42, 42);
xcb_randr_set_output_primary(globalconf.connection,
globalconf.screen->root, 42);
Output without xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=BadValue (2)
X error: request=(null) (major 140, minor 30), error=(null) (147)
Output with xcb-errors:
X error: request=SetInputFocus (major 42, minor 0), error=Value (2)
X error: request=RandR-SetOutputPrimary (major 140, minor 30), error=RandR-BadOutput (147)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 15:09:21 +01:00
|
|
|
" • xcb-errors support: %s\n"
|
2016-10-29 11:57:02 +02:00
|
|
|
" • execinfo support: %s\n"
|
2017-01-23 17:17:46 +01:00
|
|
|
" • xcb-randr version: %d.%d\n"
|
2020-02-03 02:36:20 +01:00
|
|
|
" • LGI version: %s\n"
|
|
|
|
" • Transparency enabled: %s\n"
|
|
|
|
" • Custom search paths: %s\n",
|
|
|
|
/* version */ AWESOME_VERSION,
|
|
|
|
/* release */ AWESOME_RELEASE,
|
|
|
|
/* Lua linked */ LUA_RELEASE,
|
|
|
|
/* Lua runtime */ lua_tostring(L, -2),
|
|
|
|
/* API Level */ globalconf.api_level,
|
|
|
|
/* DBus */ has_dbus,
|
|
|
|
/* XCB Error */ has_xcb_errors,
|
|
|
|
/* Execinfo */ has_execinfo,
|
|
|
|
/* XRandR major */ XCB_RANDR_MAJOR_VERSION,
|
|
|
|
/* XRandR minor */ XCB_RANDR_MINOR_VERSION,
|
|
|
|
/* LGI version */ lua_tostring(L, -1),
|
|
|
|
/* ARGB support */ globalconf.had_overriden_depth ? "no" : "yes",
|
|
|
|
/* Search path */ globalconf.have_searchpaths ? "yes" : "no"
|
|
|
|
);
|
2015-11-19 17:15:48 +01:00
|
|
|
lua_close(L);
|
|
|
|
|
2008-01-25 11:49:18 +01:00
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2014-04-13 17:48:03 +02:00
|
|
|
/** Get version string.
|
|
|
|
* \return A string describing the current version.
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
awesome_version_string(void)
|
|
|
|
{
|
|
|
|
return AWESOME_VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Get release string.
|
|
|
|
* \return A string describing the code name of the relase.
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
awesome_release_string(void)
|
|
|
|
{
|
|
|
|
return AWESOME_RELEASE;
|
|
|
|
}
|
|
|
|
|
2020-02-03 00:57:26 +01:00
|
|
|
|
|
|
|
int
|
|
|
|
awesome_default_api_level(void)
|
|
|
|
{
|
|
|
|
return AWESOME_API_LEVEL;
|
|
|
|
}
|
|
|
|
|
2011-09-11 16:50:01 +02:00
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|