atoms: autogenerate atom list

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-30 20:05:53 +02:00
parent 1e4641389c
commit db49685413
7 changed files with 110 additions and 153 deletions

View File

@ -115,7 +115,7 @@ add_custom_command(
OUTPUT ${BUILD_DIR}/layoutgen.h OUTPUT ${BUILD_DIR}/layoutgen.h
WORKING_DIRECTORY ${SOURCE_DIR} WORKING_DIRECTORY ${SOURCE_DIR}
DEPENDS ${LAYOUTGEN_DEPS} DEPENDS ${LAYOUTGEN_DEPS}
COMMENT "Generating layoutgen.h." COMMENT "Generating layoutgen.h"
VERBATIM) VERBATIM)
add_custom_command( add_custom_command(
@ -124,12 +124,30 @@ add_custom_command(
OUTPUT ${BUILD_DIR}/widgetgen.h OUTPUT ${BUILD_DIR}/widgetgen.h
WORKING_DIRECTORY ${SOURCE_DIR} WORKING_DIRECTORY ${SOURCE_DIR}
DEPENDS ${SOURCE_DIR}/widget.h DEPENDS ${SOURCE_DIR}/widget.h
COMMENT "Generating widgetgen.h." COMMENT "Generating widgetgen.h"
VERBATIM)
# atoms
file(MAKE_DIRECTORY ${BUILD_DIR}/common)
add_custom_command(
COMMAND ${SOURCE_DIR}/build-utils/atoms-ext.sh ${SOURCE_DIR}/common/atoms.list
ARGS > ${BUILD_DIR}/common/atoms-extern.h
OUTPUT ${BUILD_DIR}/common/atoms-extern.h
WORKING_DIRECTORY ${SOURCE_DIR}
DEPENDS ${SOURCE_DIR}/common/atoms.list
COMMENT "Generating atoms-extern.h"
VERBATIM)
add_custom_command(
COMMAND ${SOURCE_DIR}/build-utils/atoms-int.sh ${SOURCE_DIR}/common/atoms.list
ARGS > ${BUILD_DIR}/common/atoms-intern.h
OUTPUT ${BUILD_DIR}/common/atoms-intern.h
WORKING_DIRECTORY ${SOURCE_DIR}
DEPENDS ${SOURCE_DIR}/common/atoms.list
COMMENT "Generating atoms-intern.h"
VERBATIM) VERBATIM)
# gperf # gperf
file(MAKE_DIRECTORY ${BUILD_DIR}/common)
add_custom_command( add_custom_command(
COMMAND ${SOURCE_DIR}/build-utils/gperf.sh COMMAND ${SOURCE_DIR}/build-utils/gperf.sh
ARGS ${SOURCE_DIR}/common/tokenize.gperf ARGS ${SOURCE_DIR}/common/tokenize.gperf
@ -151,6 +169,8 @@ add_custom_command(
add_custom_target(generated_sources add_custom_target(generated_sources
DEPENDS ${BUILD_DIR}/widgetgen.h DEPENDS ${BUILD_DIR}/widgetgen.h
${BUILD_DIR}/layoutgen.h ${BUILD_DIR}/layoutgen.h
${BUILD_DIR}/common/atoms-intern.h
${BUILD_DIR}/common/atoms-extern.h
${BUILD_DIR}/common/tokenize.c ${BUILD_DIR}/common/tokenize.c
${BUILD_DIR}/common/tokenize.h) ${BUILD_DIR}/common/tokenize.h)
@ -158,7 +178,7 @@ add_dependencies(${PROJECT_AWE_NAME} generated_sources)
add_dependencies(${PROJECT_AWECLIENT_NAME} generated_sources) add_dependencies(${PROJECT_AWECLIENT_NAME} generated_sources)
# }}} # }}}
# {{{ version stamp # {{{ Version stamp
if(BUILD_FROM_GIT) if(BUILD_FROM_GIT)
add_custom_target(version_stamp ALL add_custom_target(version_stamp ALL
COMMAND ${SOURCE_DIR}/build-utils/git-version-stamp.sh COMMAND ${SOURCE_DIR}/build-utils/git-version-stamp.sh
@ -171,7 +191,7 @@ if(BUILD_FROM_GIT)
endif() endif()
# }}} # }}}
# {{{ Manpages. # {{{ Manpages
if(GENERATE_MANPAGES) if(GENERATE_MANPAGES)
foreach(txtfile ${AWE_MAN_SRCS}) foreach(txtfile ${AWE_MAN_SRCS})
string(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile}) string(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile})
@ -289,7 +309,7 @@ if(GENERATE_LUADOC)
endif() endif()
# }}} # }}}
# {{{ compile Lua libs # {{{ Compile Lua libs
if(LUAC_EXECUTABLE) if(LUAC_EXECUTABLE)
foreach(luafile ${AWE_LUA_FILES}) foreach(luafile ${AWE_LUA_FILES})
string(REGEX REPLACE ".lua\$" ".luac" luacfile ${luafile}) string(REGEX REPLACE ".lua\$" ".luac" luacfile ${luafile})
@ -311,7 +331,7 @@ if(LUAC_EXECUTABLE)
endif() endif()
# }}} # }}}
# {{{ dist tarball # {{{ Dist tarball
if(BUILD_FROM_GIT) if(BUILD_FROM_GIT)
add_custom_target(dist add_custom_target(dist
COMMAND ${SOURCE_DIR}/build-utils/dist.sh ${VERSION} COMMAND ${SOURCE_DIR}/build-utils/dist.sh ${VERSION}
@ -319,7 +339,7 @@ if(BUILD_FROM_GIT)
endif() endif()
# }}} # }}}
# {{{ Installation. # {{{ Installation
install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin) install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin)
install(FILES ${AWE_LUA_FILES} ${AWE_LUAC_FILES} DESTINATION ${AWESOME_LUA_LIB_PATH}) install(FILES ${AWE_LUA_FILES} ${AWE_LUAC_FILES} DESTINATION ${AWESOME_LUA_LIB_PATH})
install(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_CONF_PATH}) install(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_CONF_PATH})

View File

@ -75,7 +75,7 @@ if(GENERATE_LUADOC)
endif() endif()
# }}} # }}}
# {{{ version stamp # {{{ Version stamp
if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE) if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
# get current version # get current version
execute_process( execute_process(
@ -170,7 +170,7 @@ set(AWESOMECLIENT_LIBRARIES
${LIB_NCURSES}) ${LIB_NCURSES})
# }}} # }}}
# {{{ Optional libraries. # {{{ Optional libraries
# #
# this sets up: # this sets up:
# AWESOME_OPTIONAL_LIBRARIES # AWESOME_OPTIONAL_LIBRARIES
@ -199,7 +199,7 @@ if(WITH_IMLIB2)
endif() endif()
# }}} # }}}
# {{{ Install path and configuration variables. # {{{ Install path and configuration variables
if(DEFINED PREFIX) if(DEFINED PREFIX)
set(PREFIX ${PREFIX} CACHE PATH "install prefix") set(PREFIX ${PREFIX} CACHE PATH "install prefix")
set(CMAKE_INSTALL_PREFIX ${PREFIX}) set(CMAKE_INSTALL_PREFIX ${PREFIX})
@ -215,7 +215,7 @@ else()
set(SYSCONFDIR ${PREFIX}/etc CACHE PATH "config directory") set(SYSCONFDIR ${PREFIX}/etc CACHE PATH "config directory")
endif() endif()
# hide to avoid confusion # Hide to avoid confusion
mark_as_advanced(CMAKE_INSTALL_PREFIX) mark_as_advanced(CMAKE_INSTALL_PREFIX)
set(AWESOME_VERSION ${VERSION}) set(AWESOME_VERSION ${VERSION})
@ -231,7 +231,7 @@ set(AWESOME_LUA_LIB_PATH ${AWESOME_DATA_PATH}/lib)
set(AWESOME_ICON_PATH ${AWESOME_DATA_PATH}/icons) set(AWESOME_ICON_PATH ${AWESOME_DATA_PATH}/icons)
# }}} # }}}
# {{{ Configure files. # {{{ Configure files
set(AWESOME_CONFIGURE_FILES set(AWESOME_CONFIGURE_FILES
config.h.in config.h.in
awesomerc.lua.in awesomerc.lua.in

9
build-utils/atoms-ext.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
echo "/* This file is autogenerated by $0 - do not edit */"
echo
while read atom
do
echo extern xcb_atom_t $atom\;
done < $1

20
build-utils/atoms-int.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
echo "/* This file is autogenerated by $0 - do not edit */"
echo
while read atom
do
echo xcb_atom_t $atom\;
done < $1
echo
echo 'static atom_item_t ATOM_LIST[] ='
echo '{'
while read atom
do
echo ' { "'$atom'", &'$atom' },'
done < $1
echo '};'

View File

@ -22,106 +22,13 @@
#include "common/atoms.h" #include "common/atoms.h"
#include "common/util.h" #include "common/util.h"
xcb_atom_t _NET_SUPPORTED;
xcb_atom_t _NET_CLIENT_LIST;
xcb_atom_t _NET_CLIENT_LIST_STACKING;
xcb_atom_t _NET_NUMBER_OF_DESKTOPS;
xcb_atom_t _NET_CURRENT_DESKTOP;
xcb_atom_t _NET_DESKTOP_NAMES;
xcb_atom_t _NET_ACTIVE_WINDOW;
xcb_atom_t _NET_WORKAREA;
xcb_atom_t _NET_SUPPORTING_WM_CHECK;
xcb_atom_t _NET_CLOSE_WINDOW;
xcb_atom_t _NET_WM_NAME;
xcb_atom_t _NET_WM_VISIBLE_NAME;
xcb_atom_t _NET_WM_DESKTOP;
xcb_atom_t _NET_WM_ICON_NAME;
xcb_atom_t _NET_WM_VISIBLE_ICON_NAME;
xcb_atom_t _NET_WM_WINDOW_TYPE;
xcb_atom_t _NET_WM_WINDOW_TYPE_NORMAL;
xcb_atom_t _NET_WM_WINDOW_TYPE_DESKTOP;
xcb_atom_t _NET_WM_WINDOW_TYPE_DOCK;
xcb_atom_t _NET_WM_WINDOW_TYPE_SPLASH;
xcb_atom_t _NET_WM_WINDOW_TYPE_DIALOG;
xcb_atom_t _NET_WM_ICON;
xcb_atom_t _NET_WM_PID;
xcb_atom_t _NET_WM_STATE;
xcb_atom_t _NET_WM_STATE_STICKY;
xcb_atom_t _NET_WM_STATE_SKIP_TASKBAR;
xcb_atom_t _NET_WM_STATE_FULLSCREEN;
xcb_atom_t _NET_WM_STATE_ABOVE;
xcb_atom_t _NET_WM_STATE_BELOW;
xcb_atom_t _NET_WM_STATE_MODAL;
xcb_atom_t _NET_WM_STATE_HIDDEN;
xcb_atom_t _NET_WM_STATE_DEMANDS_ATTENTION;
xcb_atom_t UTF8_STRING;
xcb_atom_t _AWESOME_PROPERTIES;
xcb_atom_t WM_PROTOCOLS;
xcb_atom_t WM_DELETE_WINDOW;
xcb_atom_t _XEMBED;
xcb_atom_t _XEMBED_INFO;
xcb_atom_t _NET_SYSTEM_TRAY_OPCODE;
xcb_atom_t _KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR;
xcb_atom_t MANAGER;
xcb_atom_t _XROOTPMAP_ID;
xcb_atom_t WM_STATE;
xcb_atom_t _NET_WM_WINDOW_OPACITY;
xcb_atom_t _NET_SYSTEM_TRAY_ORIENTATION;
typedef struct typedef struct
{ {
const char *name; const char *name;
xcb_atom_t *atom; xcb_atom_t *atom;
} atom_item_t; } atom_item_t;
static atom_item_t ATOM_LIST[] = #include "common/atoms-intern.h"
{
{ "_NET_SUPPORTED", &_NET_SUPPORTED },
{ "_NET_CLIENT_LIST", &_NET_CLIENT_LIST },
{ "_NET_CLIENT_LIST_STACKING", &_NET_CLIENT_LIST_STACKING },
{ "_NET_NUMBER_OF_DESKTOPS", &_NET_NUMBER_OF_DESKTOPS },
{ "_NET_CURRENT_DESKTOP", &_NET_CURRENT_DESKTOP },
{ "_NET_DESKTOP_NAMES", &_NET_DESKTOP_NAMES },
{ "_NET_ACTIVE_WINDOW", &_NET_ACTIVE_WINDOW },
{ "_NET_WORKAREA", &_NET_WORKAREA },
{ "_NET_SUPPORTING_WM_CHECK", &_NET_SUPPORTING_WM_CHECK },
{ "_NET_CLOSE_WINDOW", &_NET_CLOSE_WINDOW },
{ "_NET_WM_NAME", &_NET_WM_NAME },
{ "_NET_WM_VISIBLE_NAME", &_NET_WM_VISIBLE_NAME },
{ "_NET_WM_DESKTOP", &_NET_WM_DESKTOP },
{ "_NET_WM_ICON_NAME", &_NET_WM_ICON_NAME },
{ "_NET_WM_VISIBLE_ICON_NAME", &_NET_WM_VISIBLE_ICON_NAME },
{ "_NET_WM_WINDOW_TYPE", &_NET_WM_WINDOW_TYPE },
{ "_NET_WM_WINDOW_TYPE_NORMAL", &_NET_WM_WINDOW_TYPE_NORMAL },
{ "_NET_WM_WINDOW_TYPE_DESKTOP", &_NET_WM_WINDOW_TYPE_DESKTOP },
{ "_NET_WM_WINDOW_TYPE_DOCK", &_NET_WM_WINDOW_TYPE_DOCK },
{ "_NET_WM_WINDOW_TYPE_SPLASH", &_NET_WM_WINDOW_TYPE_SPLASH },
{ "_NET_WM_WINDOW_TYPE_DIALOG", &_NET_WM_WINDOW_TYPE_DIALOG },
{ "_NET_WM_ICON", &_NET_WM_ICON },
{ "_NET_WM_PID", &_NET_WM_PID },
{ "_NET_WM_STATE", &_NET_WM_STATE },
{ "_NET_WM_STATE_STICKY", &_NET_WM_STATE_STICKY },
{ "_NET_WM_STATE_SKIP_TASKBAR", &_NET_WM_STATE_SKIP_TASKBAR },
{ "_NET_WM_STATE_FULLSCREEN", &_NET_WM_STATE_FULLSCREEN },
{ "_NET_WM_STATE_ABOVE", &_NET_WM_STATE_ABOVE },
{ "_NET_WM_STATE_BELOW", &_NET_WM_STATE_BELOW },
{ "_NET_WM_STATE_MODAL", &_NET_WM_STATE_MODAL },
{ "_NET_WM_STATE_HIDDEN", &_NET_WM_STATE_HIDDEN },
{ "_NET_WM_STATE_DEMANDS_ATTENTION", &_NET_WM_STATE_DEMANDS_ATTENTION },
{ "UTF8_STRING", &UTF8_STRING },
{ "_AWESOME_PROPERTIES", &_AWESOME_PROPERTIES },
{ "WM_PROTOCOLS", &WM_PROTOCOLS },
{ "WM_DELETE_WINDOW", &WM_DELETE_WINDOW },
{ "_XEMBED", &_XEMBED },
{ "_XEMBED_INFO", &_XEMBED_INFO },
{ "_NET_SYSTEM_TRAY_OPCODE", &_NET_SYSTEM_TRAY_OPCODE },
{ "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", &_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR },
{ "MANAGER", &MANAGER },
{ "_XROOTPMAP_ID", &_XROOTPMAP_ID },
{ "WM_STATE", &WM_STATE },
{ "_NET_WM_WINDOW_OPACITY", &_NET_WM_WINDOW_OPACITY },
{ "_NET_SYSTEM_TRAY_ORIENTATION", &_NET_SYSTEM_TRAY_ORIENTATION },
};
void void
atoms_init(xcb_connection_t *conn) atoms_init(xcb_connection_t *conn)

View File

@ -24,51 +24,7 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
extern xcb_atom_t _NET_SUPPORTED; #include "common/atoms-extern.h"
extern xcb_atom_t _NET_CLIENT_LIST;
extern xcb_atom_t _NET_CLIENT_LIST_STACKING;
extern xcb_atom_t _NET_NUMBER_OF_DESKTOPS;
extern xcb_atom_t _NET_CURRENT_DESKTOP;
extern xcb_atom_t _NET_DESKTOP_NAMES;
extern xcb_atom_t _NET_ACTIVE_WINDOW;
extern xcb_atom_t _NET_WORKAREA;
extern xcb_atom_t _NET_SUPPORTING_WM_CHECK;
extern xcb_atom_t _NET_CLOSE_WINDOW;
extern xcb_atom_t _NET_WM_NAME;
extern xcb_atom_t _NET_WM_VISIBLE_NAME;
extern xcb_atom_t _NET_WM_DESKTOP;
extern xcb_atom_t _NET_WM_ICON_NAME;
extern xcb_atom_t _NET_WM_VISIBLE_ICON_NAME;
extern xcb_atom_t _NET_WM_WINDOW_TYPE;
extern xcb_atom_t _NET_WM_WINDOW_TYPE_NORMAL;
extern xcb_atom_t _NET_WM_WINDOW_TYPE_DESKTOP;
extern xcb_atom_t _NET_WM_WINDOW_TYPE_DOCK;
extern xcb_atom_t _NET_WM_WINDOW_TYPE_SPLASH;
extern xcb_atom_t _NET_WM_WINDOW_TYPE_DIALOG;
extern xcb_atom_t _NET_WM_ICON;
extern xcb_atom_t _NET_WM_PID;
extern xcb_atom_t _NET_WM_STATE;
extern xcb_atom_t _NET_WM_STATE_STICKY;
extern xcb_atom_t _NET_WM_STATE_SKIP_TASKBAR;
extern xcb_atom_t _NET_WM_STATE_FULLSCREEN;
extern xcb_atom_t _NET_WM_STATE_ABOVE;
extern xcb_atom_t _NET_WM_STATE_BELOW;
extern xcb_atom_t _NET_WM_STATE_MODAL;
extern xcb_atom_t _NET_WM_STATE_HIDDEN;
extern xcb_atom_t _NET_WM_STATE_DEMANDS_ATTENTION;
extern xcb_atom_t UTF8_STRING;
extern xcb_atom_t _AWESOME_PROPERTIES;
extern xcb_atom_t WM_PROTOCOLS;
extern xcb_atom_t WM_DELETE_WINDOW;
extern xcb_atom_t _XEMBED;
extern xcb_atom_t _XEMBED_INFO;
extern xcb_atom_t _NET_SYSTEM_TRAY_OPCODE;
extern xcb_atom_t _KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR;
extern xcb_atom_t MANAGER;
extern xcb_atom_t _XROOTPMAP_ID;
extern xcb_atom_t WM_STATE;
extern xcb_atom_t _NET_WM_WINDOW_OPACITY;
extern xcb_atom_t _NET_SYSTEM_TRAY_ORIENTATION;
void atoms_init(xcb_connection_t *); void atoms_init(xcb_connection_t *);

45
common/atoms.list Normal file
View File

@ -0,0 +1,45 @@
_NET_SUPPORTED
_NET_CLIENT_LIST
_NET_CLIENT_LIST_STACKING
_NET_NUMBER_OF_DESKTOPS
_NET_CURRENT_DESKTOP
_NET_DESKTOP_NAMES
_NET_ACTIVE_WINDOW
_NET_WORKAREA
_NET_SUPPORTING_WM_CHECK
_NET_CLOSE_WINDOW
_NET_WM_NAME
_NET_WM_VISIBLE_NAME
_NET_WM_DESKTOP
_NET_WM_ICON_NAME
_NET_WM_VISIBLE_ICON_NAME
_NET_WM_WINDOW_TYPE
_NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_WINDOW_TYPE_DESKTOP
_NET_WM_WINDOW_TYPE_DOCK
_NET_WM_WINDOW_TYPE_SPLASH
_NET_WM_WINDOW_TYPE_DIALOG
_NET_WM_ICON
_NET_WM_PID
_NET_WM_STATE
_NET_WM_STATE_STICKY
_NET_WM_STATE_SKIP_TASKBAR
_NET_WM_STATE_FULLSCREEN
_NET_WM_STATE_ABOVE
_NET_WM_STATE_BELOW
_NET_WM_STATE_MODAL
_NET_WM_STATE_HIDDEN
_NET_WM_STATE_DEMANDS_ATTENTION
UTF8_STRING
_AWESOME_PROPERTIES
WM_PROTOCOLS
WM_DELETE_WINDOW
_XEMBED
_XEMBED_INFO
_NET_SYSTEM_TRAY_OPCODE
_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR
MANAGER
_XROOTPMAP_ID
WM_STATE
_NET_WM_WINDOW_OPACITY
_NET_SYSTEM_TRAY_ORIENTATION