diff --git a/3rdparty/toluapp/cmake_install.cmake b/3rdparty/toluapp/cmake_install.cmake new file mode 100644 index 0000000000..483acc6237 --- /dev/null +++ b/3rdparty/toluapp/cmake_install.cmake @@ -0,0 +1,44 @@ +# Install script for directory: /data/code/FOSS/conky/3rdparty/toluapp + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + diff --git a/CPackConfig.cmake b/CPackConfig.cmake new file mode 100644 index 0000000000..83c768c255 --- /dev/null +++ b/CPackConfig.cmake @@ -0,0 +1,71 @@ +# This file will be configured to contain variables for CPack. These variables +# should be set in the CMake list file of the project before CPack module is +# included. The list of available CPACK_xxx variables and their associated +# documentation may be obtained using +# cpack --help-variable-list +# +# Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME) +# and some are specific to a generator +# (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables +# usually begin with CPACK__xxxx. + + +set(CPACK_BUILD_SOURCE_DIRS "/data/code/FOSS/conky;/data/code/FOSS/conky") +set(CPACK_CMAKE_GENERATOR "Unix Makefiles") +set(CPACK_COMPONENTS_ALL "") +set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE") +set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.10-1), libgcc1 (>= 1:4.4.0)") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Brenden Matthews") +set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt") +set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake") +set(CPACK_GENERATOR "TGZ;STGZ;DEB") +set(CPACK_INNOSETUP_ARCHITECTURE "x64") +set(CPACK_INSTALL_CMAKE_PROJECTS "/data/code/FOSS/conky;conky;ALL;/") +set(CPACK_INSTALL_PREFIX "/usr/local") +set(CPACK_MODULE_PATH "/data/code/FOSS/conky/cmake") +set(CPACK_NSIS_DISPLAY_NAME "conky") +set(CPACK_NSIS_INSTALLER_ICON_CODE "") +set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") +set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") +set(CPACK_NSIS_PACKAGE_NAME "conky") +set(CPACK_NSIS_UNINSTALL_NAME "Uninstall") +set(CPACK_OBJCOPY_EXECUTABLE "/usr/bin/objcopy") +set(CPACK_OBJDUMP_EXECUTABLE "/usr/bin/objdump") +set(CPACK_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackConfig.cmake") +set(CPACK_PACKAGE_CONTACT "brenden@diddyinc.com") +set(CPACK_PACKAGE_DEFAULT_LOCATION "/") +set(CPACK_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake") +set(CPACK_PACKAGE_FILE_NAME "conky-1.20.1_pre-Linux-") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "conky") +set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "conky") +set(CPACK_PACKAGE_NAME "conky") +set(CPACK_PACKAGE_RELOCATABLE "true") +set(CPACK_PACKAGE_VENDOR "Humanity") +set(CPACK_PACKAGE_VERSION "1.20.1") +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "20") +set(CPACK_PACKAGE_VERSION_PATCH "1") +set(CPACK_READELF_EXECUTABLE "/usr/bin/readelf") +set(CPACK_RESOURCE_FILE_LICENSE "/usr/share/cmake/Templates/CPack.GenericLicense.txt") +set(CPACK_RESOURCE_FILE_README "/usr/share/cmake/Templates/CPack.GenericDescription.txt") +set(CPACK_RESOURCE_FILE_WELCOME "/usr/share/cmake/Templates/CPack.GenericWelcome.txt") +set(CPACK_SET_DESTDIR "OFF") +set(CPACK_SOURCE_GENERATOR "TBZ2") +set(CPACK_SOURCE_IGNORE_FILES "~$;\\.git.*$;\\..*\\.swp$;build.*$") +set(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackSourceConfig.cmake") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "conky-1.20.1_pre-src") +set(CPACK_STRIP_FILES "true") +set(CPACK_SYSTEM_NAME "Linux") +set(CPACK_THREADS "1") +set(CPACK_TOPLEVEL_TAG "Linux") +set(CPACK_WIX_SIZEOF_VOID_P "8") + +if(NOT CPACK_PROPERTIES_FILE) + set(CPACK_PROPERTIES_FILE "/data/code/FOSS/conky/CPackProperties.cmake") +endif() + +if(EXISTS ${CPACK_PROPERTIES_FILE}) + include(${CPACK_PROPERTIES_FILE}) +endif() diff --git a/CPackSourceConfig.cmake b/CPackSourceConfig.cmake new file mode 100644 index 0000000000..639b2af9bf --- /dev/null +++ b/CPackSourceConfig.cmake @@ -0,0 +1,76 @@ +# This file will be configured to contain variables for CPack. These variables +# should be set in the CMake list file of the project before CPack module is +# included. The list of available CPACK_xxx variables and their associated +# documentation may be obtained using +# cpack --help-variable-list +# +# Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME) +# and some are specific to a generator +# (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables +# usually begin with CPACK__xxxx. + + +set(CPACK_BUILD_SOURCE_DIRS "/data/code/FOSS/conky;/data/code/FOSS/conky") +set(CPACK_CMAKE_GENERATOR "Unix Makefiles") +set(CPACK_COMPONENTS_ALL "") +set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE") +set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.10-1), libgcc1 (>= 1:4.4.0)") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Brenden Matthews") +set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt") +set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake") +set(CPACK_GENERATOR "TBZ2") +set(CPACK_IGNORE_FILES "~$;\\.git.*$;\\..*\\.swp$;build.*$") +set(CPACK_INNOSETUP_ARCHITECTURE "x64") +set(CPACK_INSTALLED_DIRECTORIES "/data/code/FOSS/conky;/") +set(CPACK_INSTALL_CMAKE_PROJECTS "") +set(CPACK_INSTALL_PREFIX "/usr/local") +set(CPACK_MODULE_PATH "/data/code/FOSS/conky/cmake") +set(CPACK_NSIS_DISPLAY_NAME "conky") +set(CPACK_NSIS_INSTALLER_ICON_CODE "") +set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") +set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") +set(CPACK_NSIS_PACKAGE_NAME "conky") +set(CPACK_NSIS_UNINSTALL_NAME "Uninstall") +set(CPACK_OBJCOPY_EXECUTABLE "/usr/bin/objcopy") +set(CPACK_OBJDUMP_EXECUTABLE "/usr/bin/objdump") +set(CPACK_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackConfig.cmake") +set(CPACK_PACKAGE_CONTACT "brenden@diddyinc.com") +set(CPACK_PACKAGE_DEFAULT_LOCATION "/") +set(CPACK_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake") +set(CPACK_PACKAGE_FILE_NAME "conky-1.20.1_pre-src") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "conky") +set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "conky") +set(CPACK_PACKAGE_NAME "conky") +set(CPACK_PACKAGE_RELOCATABLE "true") +set(CPACK_PACKAGE_VENDOR "Humanity") +set(CPACK_PACKAGE_VERSION "1.20.1") +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "20") +set(CPACK_PACKAGE_VERSION_PATCH "1") +set(CPACK_READELF_EXECUTABLE "/usr/bin/readelf") +set(CPACK_RESOURCE_FILE_LICENSE "/usr/share/cmake/Templates/CPack.GenericLicense.txt") +set(CPACK_RESOURCE_FILE_README "/usr/share/cmake/Templates/CPack.GenericDescription.txt") +set(CPACK_RESOURCE_FILE_WELCOME "/usr/share/cmake/Templates/CPack.GenericWelcome.txt") +set(CPACK_RPM_PACKAGE_SOURCES "ON") +set(CPACK_SET_DESTDIR "OFF") +set(CPACK_SOURCE_GENERATOR "TBZ2") +set(CPACK_SOURCE_IGNORE_FILES "~$;\\.git.*$;\\..*\\.swp$;build.*$") +set(CPACK_SOURCE_INSTALLED_DIRECTORIES "/data/code/FOSS/conky;/") +set(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackSourceConfig.cmake") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "conky-1.20.1_pre-src") +set(CPACK_SOURCE_TOPLEVEL_TAG "Linux-Source") +set(CPACK_STRIP_FILES "") +set(CPACK_SYSTEM_NAME "Linux") +set(CPACK_THREADS "1") +set(CPACK_TOPLEVEL_TAG "Linux-Source") +set(CPACK_WIX_SIZEOF_VOID_P "8") + +if(NOT CPACK_PROPERTIES_FILE) + set(CPACK_PROPERTIES_FILE "/data/code/FOSS/conky/CPackProperties.cmake") +endif() + +if(EXISTS ${CPACK_PROPERTIES_FILE}) + include(${CPACK_PROPERTIES_FILE}) +endif() diff --git a/build.h b/build.h new file mode 100644 index 0000000000..a2d920c0db --- /dev/null +++ b/build.h @@ -0,0 +1,8 @@ +#ifndef __BUILD_H +#define __BUILD_H + +/* Conky build info */ + +#define BUILD_ARCH "Linux x86_64" + +#endif /* __BUILD_H */ diff --git a/cmake/ConkyBuildOptions.cmake b/cmake/ConkyBuildOptions.cmake index 7ff95d9df7..87b80f9a3d 100644 --- a/cmake/ConkyBuildOptions.cmake +++ b/cmake/ConkyBuildOptions.cmake @@ -193,8 +193,8 @@ dependent_option(BUILD_XSHAPE "Enable Xshape support" true "BUILD_X11" false "Xshape support requires X11") dependent_option(BUILD_XINPUT "Build Xinput 2 support" true - "BUILD_X11;BUILD_MOUSE_EVENTS" false - "Xinput 2 support requires X11 and BUILD_MOUSE_EVENTS enabled") + "BUILD_X11" false + "Xinput 2 support requires X11") # if we build with any GUI support if(BUILD_X11) @@ -206,8 +206,8 @@ if(BUILD_WAYLAND) endif(BUILD_WAYLAND) dependent_option(BUILD_MOUSE_EVENTS "Enable mouse event support" true - "BUILD_WAYLAND OR OWN_WINDOW" false - "Mouse event support requires Wayland or OWN_WINDOW enabled") + "BUILD_WAYLAND OR BUILD_X11" false + "Mouse event support requires Wayland or X11 enabled") # Lua library options option(BUILD_LUA_CAIRO "Build cairo bindings for Lua" false) diff --git a/cmake_install.cmake b/cmake_install.cmake new file mode 100644 index 0000000000..74284e870e --- /dev/null +++ b/cmake_install.cmake @@ -0,0 +1,87 @@ +# Install script for directory: /data/code/FOSS/conky + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for the subdirectory. + include("/data/code/FOSS/conky/lua/cmake_install.cmake") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for the subdirectory. + include("/data/code/FOSS/conky/data/cmake_install.cmake") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for the subdirectory. + include("/data/code/FOSS/conky/doc/cmake_install.cmake") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for the subdirectory. + include("/data/code/FOSS/conky/3rdparty/toluapp/cmake_install.cmake") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for the subdirectory. + include("/data/code/FOSS/conky/src/cmake_install.cmake") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/conky-1.20.1_pre" TYPE FILE FILES + "/data/code/FOSS/conky/extras/convert.lua" + "/data/code/FOSS/conky/data/conky_no_x11.conf" + "/data/code/FOSS/conky/data/conky.conf" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/data/code/FOSS/conky/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/cmake_uninstall.cmake b/cmake_uninstall.cmake new file mode 100644 index 0000000000..349bcce41f --- /dev/null +++ b/cmake_uninstall.cmake @@ -0,0 +1,46 @@ +# +#Conky, a system monitor, based on torsmo +# +#Please see COPYING for details +# +#Copyright(c) 2005 - 2024 Brenden Matthews, et.al.(see AUTHORS)All rights +#reserved. +# +#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 3 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, see < http: // www.gnu.org/licenses/>. +# + +if (NOT EXISTS ${CMAKE_BINARY_DIR} / install_manifest.txt) +message( + FATAL_ERROR + "Cannot find install manifest: ${CMAKE_BINARY_DIR}/install_manifest.txt") + endif() + + file(READ "${CMAKE_BINARY_DIR}/install_manifest.txt" files) string( + REGEX REPLACE + "\n" + ";" files "${files}") foreach (file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") if ( + IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS + "$ENV{DESTDIR}${file}") + exec_program( + ${CMAKE_COMMAND} ARGS + "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval) if (NOT + "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR + "Problem when removing $ENV{DESTDIR}${file}") + endif() else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS + "$ENV{DESTDIR}${file}") + message(STATUS + "File $ENV{DESTDIR}${file} does not exist.") + endif() endforeach() diff --git a/data/cmake_install.cmake b/data/cmake_install.cmake new file mode 100644 index 0000000000..2f4c3fb76b --- /dev/null +++ b/data/cmake_install.cmake @@ -0,0 +1,52 @@ +# Install script for directory: /data/code/FOSS/conky/data + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications" TYPE FILE FILES "/data/code/FOSS/conky/data/conky.desktop") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps" TYPE FILE FILES "/data/code/FOSS/conky/data/logo/conky-logomark-violet.svg") +endif() + diff --git a/data/conky-dfly-smp.conf b/data/conky-dfly-smp.conf index fac3afb043..09d7918b07 100644 --- a/data/conky-dfly-smp.conf +++ b/data/conky-dfly-smp.conf @@ -10,7 +10,10 @@ -- -- For more on Lua, see: -- https://www.lua.org/pil/contents.html +-- +-- Conky Lua API: https://conky.cc/lua +-- Configuration settings: https://conky.cc/config_settings conky.config = { alignment = 'bottom_left', background = false, @@ -36,7 +39,8 @@ conky.config = { extra_newline = false, own_window = false, own_window_class = 'Conky', - own_window_type = 'desktop', + own_window_type = 'normal', + own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager', stippled_borders = 0, update_interval = 3.0, uppercase = false, @@ -45,6 +49,7 @@ conky.config = { show_graph_range = false } +-- Variables: https://conky.cc/variables conky.text = [[ $sysname $version on $machine $hr diff --git a/data/conky.conf b/data/conky.conf index fc341baaa5..ed269e96f5 100644 --- a/data/conky.conf +++ b/data/conky.conf @@ -10,7 +10,10 @@ -- -- For more on Lua, see: -- https://www.lua.org/pil/contents.html +-- +-- Conky Lua API: https://conky.cc/lua +-- Configuration settings: https://conky.cc/config_settings conky.config = { alignment = 'top_left', background = false, @@ -39,7 +42,8 @@ conky.config = { out_to_x = true, own_window = true, own_window_class = 'Conky', - own_window_type = 'desktop', + own_window_type = 'normal', + own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager', show_graph_range = false, show_graph_scale = false, stippled_borders = 0, @@ -49,6 +53,7 @@ conky.config = { use_xft = true, } +-- Variables: https://conky.cc/variables conky.text = [[ ${color grey}Info:$color ${scroll 32 Conky $conky_version - $sysname $nodename $kernel $machine} $hr diff --git a/data/conky_no_x11.conf b/data/conky_no_x11.conf index 4246daad92..4ea6e13c04 100644 --- a/data/conky_no_x11.conf +++ b/data/conky_no_x11.conf @@ -10,7 +10,10 @@ -- -- For more on Lua, see: -- https://www.lua.org/pil/contents.html +-- +-- Conky Lua API: https://conky.cc/lua +-- Configuration settings: https://conky.cc/config_settings conky.config = { background = false, cpu_avg_samples = 2, @@ -22,6 +25,7 @@ conky.config = { use_spacer = 'none', }; +-- Variables: https://conky.cc/variables conky.text = [[${scroll 16 $nodename - $sysname $kernel on $machine | } Uptime: $uptime diff --git a/doc/cmake_install.cmake b/doc/cmake_install.cmake new file mode 100644 index 0000000000..b8a6ff3062 --- /dev/null +++ b/doc/cmake_install.cmake @@ -0,0 +1,44 @@ +# Install script for directory: /data/code/FOSS/conky/doc + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + diff --git a/lua/cmake_install.cmake b/lua/cmake_install.cmake new file mode 100644 index 0000000000..c3a84cacfe --- /dev/null +++ b/lua/cmake_install.cmake @@ -0,0 +1,152 @@ +# Install script for directory: /data/code/FOSS/conky/lua + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/libcairo.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/libcairo.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/usr/local/lib/conky/libcairo.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/usr/local/lib/conky/libcairo.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/usr/local/lib/conky" TYPE SHARED_LIBRARY FILES "/data/code/FOSS/conky/lua/libcairo.so") + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/libcairo.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/libcairo.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/usr/local/lib/conky/libcairo.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/libimlib2.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/libimlib2.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/usr/local/lib/conky/libimlib2.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/usr/local/lib/conky/libimlib2.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/usr/local/lib/conky" TYPE SHARED_LIBRARY FILES "/data/code/FOSS/conky/lua/libimlib2.so") + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/libimlib2.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/libimlib2.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/usr/local/lib/conky/libimlib2.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/librsvg.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/librsvg.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/usr/local/lib/conky/librsvg.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/usr/local/lib/conky/librsvg.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/usr/local/lib/conky" TYPE SHARED_LIBRARY FILES "/data/code/FOSS/conky/lua/librsvg.so") + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/librsvg.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/librsvg.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/usr/local/lib/conky/librsvg.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/libcairo_imlib2_helper.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/libcairo_imlib2_helper.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/usr/local/lib/conky/libcairo_imlib2_helper.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/usr/local/lib/conky/libcairo_imlib2_helper.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/usr/local/lib/conky" TYPE SHARED_LIBRARY FILES "/data/code/FOSS/conky/lua/libcairo_imlib2_helper.so") + if(EXISTS "$ENV{DESTDIR}/usr/local/lib/conky/libcairo_imlib2_helper.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/usr/local/lib/conky/libcairo_imlib2_helper.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/usr/local/lib/conky/libcairo_imlib2_helper.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2303d616b..7c95cb2dbb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -119,14 +119,6 @@ set(conky_sources display-console.hh display-file.cc display-file.hh - display-ncurses.cc - display-ncurses.hh - display-http.cc - display-http.hh - display-x11.cc - display-x11.hh - display-wayland.cc - display-wayland.hh lua-config.cc lua-config.hh setting.cc @@ -137,8 +129,6 @@ set(conky_sources update-cb.hh logging.h semaphore.hh - x11-color.cc - x11-color.h ) # Platform specific sources @@ -236,8 +226,24 @@ if(BUILD_PORT_MONITORS) set(optional_sources ${optional_sources} ${port_monitors}) endif(BUILD_PORT_MONITORS) +if(BUILD_HTTP) + set(http + display-http.cc + display-http.hh + ) + set(optional_sources ${optional_sources} ${http}) +endif(BUILD_HTTP) + if(BUILD_X11) - set(x11 x11.cc x11.h) + set(x11 + display-x11.cc + display-x11.hh + x11-color.cc + x11-settings.cc + x11-settings.h + x11.cc + x11.h + ) set(optional_sources ${optional_sources} ${x11}) endif(BUILD_X11) @@ -245,14 +251,22 @@ if(BUILD_GUI) set(gui fonts.cc fonts.h gui.cc gui.h) set(optional_sources ${optional_sources} ${gui}) - if(BUILD_MOUSE_EVENTS) + if(BUILD_MOUSE_EVENTS OR BUILD_XINPUT) set(mouse_events mouse-events.cc mouse-events.h) set(optional_sources ${optional_sources} ${mouse_events}) - endif(BUILD_MOUSE_EVENTS) + endif(BUILD_MOUSE_EVENTS OR BUILD_XINPUT) endif(BUILD_GUI) + if(BUILD_WAYLAND) - set(wl_srcs wl.cc wl.h xdg-shell-protocol.c wlr-layer-shell-protocol.c) + set(wl_srcs + wl.cc + wl.h + display-wayland.cc + display-wayland.hh + xdg-shell-protocol.c + wlr-layer-shell-protocol.c + ) set(optional_sources ${optional_sources} ${wl_srcs}) # generate protocol implementations @@ -324,7 +338,12 @@ if(BUILD_ICONV) endif(BUILD_ICONV) if(BUILD_NCURSES) - set(ncurses_srcs nc.cc nc.h) + set(ncurses_srcs + nc.cc + nc.h + display-ncurses.cc + display-ncurses.hh + ) set(optional_sources ${optional_sources} ${ncurses_srcs}) endif(BUILD_NCURSES) diff --git a/src/cmake_install.cmake b/src/cmake_install.cmake new file mode 100644 index 0000000000..a0070152dc --- /dev/null +++ b/src/cmake_install.cmake @@ -0,0 +1,72 @@ +# Install script for directory: /data/code/FOSS/conky/src + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/conky" AND + NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/conky") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/conky" + RPATH "") + endif() + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/data/code/FOSS/conky/src/conky") + if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/conky" AND + NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/conky") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/conky") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/usr/local/lib/libtcp-portmon.a") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/usr/local/lib" TYPE STATIC_LIBRARY FILES "/data/code/FOSS/conky/src/libtcp-portmon.a") +endif() + diff --git a/src/colour-names.cc b/src/colour-names.cc new file mode 100644 index 0000000000..216610360d --- /dev/null +++ b/src/colour-names.cc @@ -0,0 +1,2316 @@ +/* C++ code produced by gperf version 3.1 */ +/* Command-line: gperf --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E colour-names.gperf.in */ +/* Computed positions: -k'1,3,5-9,12-15,$' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +#line 1 "colour-names.gperf.in" +struct rgb { const char *name; uint8_t red; uint8_t green; uint8_t blue; }; +/* maximum key range = 3483, duplicates = 0 */ + +#ifndef GPERF_DOWNCASE +#define GPERF_DOWNCASE 1 +static unsigned char gperf_downcase[256] = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255 + }; +#endif + +#ifndef GPERF_CASE_STRCMP +#define GPERF_CASE_STRCMP 1 +static int +gperf_case_strcmp (const char *s1, const char *s2) +{ + for (;;) + { + unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; + unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; + if (c1 != 0 && c1 == c2) + continue; + return (int)c1 - (int)c2; + } +} +#endif + +class color_name_hash +{ +private: + static inline unsigned int hash (const char *str, size_t len); +public: + static const struct rgb *in_word_set (const char *str, size_t len); +}; + +inline unsigned int +color_name_hash::hash (const char *str, size_t len) +{ + static const unsigned short asso_values[] = + { + 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, + 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, + 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, + 3489, 3489, 244, 3489, 3489, 3489, 3489, 3489, 3489, 3489, + 3489, 3489, 3489, 3489, 3489, 3489, 3489, 3489, 228, 18, + 7, 2, 0, 1006, 943, 889, 754, 654, 3489, 3489, + 3489, 3489, 3489, 3489, 3489, 42, 20, 368, 74, 0, + 196, 1, 426, 628, 2, 443, 122, 446, 26, 95, + 356, 12, 17, 0, 125, 204, 969, 680, 3489, 276, + 3489, 3489, 3489, 3489, 3489, 3489, 3489, 42, 20, 368, + 74, 0, 196, 1, 426, 628, 2, 443, 122, 446, + 26, 95, 356, 12, 17, 0, 125, 204, 969, 680, + 3489, 276, 3489, 3489, 3489, 3489, 3489, 3489 + }; + unsigned int hval = len; + + switch (hval) + { + default: + hval += asso_values[static_cast(str[14])]; + /*FALLTHROUGH*/ + case 14: + hval += asso_values[static_cast(str[13])]; + /*FALLTHROUGH*/ + case 13: + hval += asso_values[static_cast(str[12])]; + /*FALLTHROUGH*/ + case 12: + hval += asso_values[static_cast(str[11])]; + /*FALLTHROUGH*/ + case 11: + case 10: + case 9: + hval += asso_values[static_cast(str[8])]; + /*FALLTHROUGH*/ + case 8: + hval += asso_values[static_cast(str[7])]; + /*FALLTHROUGH*/ + case 7: + hval += asso_values[static_cast(str[6])]; + /*FALLTHROUGH*/ + case 6: + hval += asso_values[static_cast(str[5])]; + /*FALLTHROUGH*/ + case 5: + hval += asso_values[static_cast(str[4])]; + /*FALLTHROUGH*/ + case 4: + case 3: + hval += asso_values[static_cast(str[2])]; + /*FALLTHROUGH*/ + case 2: + case 1: + hval += asso_values[static_cast(str[0])]; + break; + } + return hval + asso_values[static_cast(str[len - 1])]; +} + +const struct rgb * +color_name_hash::in_word_set (const char *str, size_t len) +{ + enum + { + TOTAL_KEYWORDS = 752, + MIN_WORD_LENGTH = 3, + MAX_WORD_LENGTH = 22, + MIN_HASH_VALUE = 6, + MAX_HASH_VALUE = 3488 + }; + + static const struct rgb wordlist[] = + { + {""}, {""}, {""}, {""}, {""}, {""}, +#line 331 "colour-names.gperf.in" + {"grey4", 10, 10, 10}, +#line 336 "colour-names.gperf.in" + {"grey44", 112, 112, 112}, + {""}, +#line 325 "colour-names.gperf.in" + {"grey34", 87, 87, 87}, +#line 320 "colour-names.gperf.in" + {"grey3", 8, 8, 8}, +#line 335 "colour-names.gperf.in" + {"grey43", 110, 110, 110}, + {""}, +#line 324 "colour-names.gperf.in" + {"grey33", 84, 84, 84}, +#line 314 "colour-names.gperf.in" + {"grey24", 61, 61, 61}, + {""}, {""}, {""}, +#line 313 "colour-names.gperf.in" + {"grey23", 59, 59, 59}, + {""}, +#line 309 "colour-names.gperf.in" + {"grey2", 5, 5, 5}, +#line 334 "colour-names.gperf.in" + {"grey42", 107, 107, 107}, + {""}, +#line 323 "colour-names.gperf.in" + {"grey32", 82, 82, 82}, + {""}, +#line 303 "colour-names.gperf.in" + {"grey14", 36, 36, 36}, + {""}, {""}, +#line 312 "colour-names.gperf.in" + {"grey22", 56, 56, 56}, +#line 302 "colour-names.gperf.in" + {"grey13", 33, 33, 33}, + {""}, {""}, {""}, +#line 293 "colour-names.gperf.in" + {"green4", 0, 139, 0}, + {""}, {""}, {""}, +#line 292 "colour-names.gperf.in" + {"green3", 0, 205, 0}, + {""}, +#line 301 "colour-names.gperf.in" + {"grey12", 31, 31, 31}, + {""}, {""}, +#line 297 "colour-names.gperf.in" + {"grey1", 3, 3, 3}, +#line 333 "colour-names.gperf.in" + {"grey41", 105, 105, 105}, + {""}, +#line 322 "colour-names.gperf.in" + {"grey31", 79, 79, 79}, + {""}, +#line 291 "colour-names.gperf.in" + {"green2", 0, 238, 0}, +#line 222 "colour-names.gperf.in" + {"gray4", 10, 10, 10}, +#line 227 "colour-names.gperf.in" + {"gray44", 112, 112, 112}, +#line 311 "colour-names.gperf.in" + {"grey21", 54, 54, 54}, +#line 216 "colour-names.gperf.in" + {"gray34", 87, 87, 87}, +#line 211 "colour-names.gperf.in" + {"gray3", 8, 8, 8}, +#line 226 "colour-names.gperf.in" + {"gray43", 110, 110, 110}, + {""}, +#line 215 "colour-names.gperf.in" + {"gray33", 84, 84, 84}, +#line 205 "colour-names.gperf.in" + {"gray24", 61, 61, 61}, + {""}, +#line 288 "colour-names.gperf.in" + {"green", 0, 255, 0}, + {""}, +#line 204 "colour-names.gperf.in" + {"gray23", 59, 59, 59}, +#line 300 "colour-names.gperf.in" + {"grey11", 28, 28, 28}, +#line 200 "colour-names.gperf.in" + {"gray2", 5, 5, 5}, +#line 225 "colour-names.gperf.in" + {"gray42", 107, 107, 107}, + {""}, +#line 214 "colour-names.gperf.in" + {"gray32", 82, 82, 82}, + {""}, +#line 194 "colour-names.gperf.in" + {"gray14", 36, 36, 36}, + {""}, +#line 290 "colour-names.gperf.in" + {"green1", 0, 255, 0}, +#line 203 "colour-names.gperf.in" + {"gray22", 56, 56, 56}, +#line 193 "colour-names.gperf.in" + {"gray13", 33, 33, 33}, + {""}, {""}, +#line 706 "colour-names.gperf.in" + {"SpringGreen4", 0, 139, 69}, +#line 675 "colour-names.gperf.in" + {"sienna4", 139, 71, 38}, + {""}, {""}, +#line 705 "colour-names.gperf.in" + {"SpringGreen3", 0, 205, 102}, +#line 674 "colour-names.gperf.in" + {"sienna3", 205, 104, 57}, + {""}, +#line 192 "colour-names.gperf.in" + {"gray12", 31, 31, 31}, + {""}, {""}, +#line 188 "colour-names.gperf.in" + {"gray1", 3, 3, 3}, +#line 224 "colour-names.gperf.in" + {"gray41", 105, 105, 105}, + {""}, +#line 213 "colour-names.gperf.in" + {"gray31", 79, 79, 79}, +#line 704 "colour-names.gperf.in" + {"SpringGreen2", 0, 238, 118}, +#line 673 "colour-names.gperf.in" + {"sienna2", 238, 121, 66}, + {""}, {""}, +#line 202 "colour-names.gperf.in" + {"gray21", 54, 54, 54}, + {""}, +#line 665 "colour-names.gperf.in" + {"SeaGreen4", 46, 139, 87}, +#line 638 "colour-names.gperf.in" + {"red4", 139, 0, 0}, + {""}, +#line 637 "colour-names.gperf.in" + {"red3", 205, 0, 0}, +#line 664 "colour-names.gperf.in" + {"SeaGreen3", 67, 205, 128}, +#line 702 "colour-names.gperf.in" + {"SpringGreen", 0, 255, 127}, +#line 700 "colour-names.gperf.in" + {"snow4", 139, 137, 137}, + {""}, +#line 636 "colour-names.gperf.in" + {"red2", 238, 0, 0}, +#line 191 "colour-names.gperf.in" + {"gray11", 28, 28, 28}, +#line 699 "colour-names.gperf.in" + {"snow3", 205, 201, 201}, + {""}, {""}, {""}, +#line 663 "colour-names.gperf.in" + {"SeaGreen2", 78, 238, 148}, + {""}, +#line 703 "colour-names.gperf.in" + {"SpringGreen1", 0, 255, 127}, +#line 672 "colour-names.gperf.in" + {"sienna1", 255, 130, 71}, + {""}, +#line 635 "colour-names.gperf.in" + {"red1", 255, 0, 0}, +#line 698 "colour-names.gperf.in" + {"snow2", 238, 233, 233}, + {""}, +#line 671 "colour-names.gperf.in" + {"sienna", 160, 82, 45}, + {""}, {""}, +#line 661 "colour-names.gperf.in" + {"SeaGreen", 46, 139, 87}, + {""}, +#line 660 "colour-names.gperf.in" + {"sea green", 46, 139, 87}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 180 "colour-names.gperf.in" + {"gold4", 139, 117, 0}, + {""}, +#line 662 "colour-names.gperf.in" + {"SeaGreen1", 84, 255, 159}, + {""}, +#line 179 "colour-names.gperf.in" + {"gold3", 205, 173, 0}, + {""}, {""}, {""}, +#line 697 "colour-names.gperf.in" + {"snow1", 255, 250, 250}, + {""}, {""}, {""}, {""}, {""}, +#line 178 "colour-names.gperf.in" + {"gold2", 238, 201, 0}, + {""}, +#line 572 "colour-names.gperf.in" + {"orange", 255, 165, 0}, +#line 577 "colour-names.gperf.in" + {"orange4", 139, 90, 0}, + {""}, +#line 41 "colour-names.gperf.in" + {"brown4", 139, 35, 35}, + {""}, +#line 576 "colour-names.gperf.in" + {"orange3", 205, 133, 0}, + {""}, +#line 40 "colour-names.gperf.in" + {"brown3", 205, 51, 51}, + {""}, {""}, {""}, +#line 717 "colour-names.gperf.in" + {"tan4", 139, 90, 43}, + {""}, +#line 716 "colour-names.gperf.in" + {"tan3", 205, 133, 63}, + {""}, +#line 575 "colour-names.gperf.in" + {"orange2", 238, 154, 0}, + {""}, +#line 39 "colour-names.gperf.in" + {"brown2", 238, 59, 59}, +#line 715 "colour-names.gperf.in" + {"tan2", 238, 154, 73}, + {""}, +#line 177 "colour-names.gperf.in" + {"gold1", 255, 215, 0}, + {""}, {""}, {""}, +#line 634 "colour-names.gperf.in" + {"red", 255, 0, 0}, + {""}, +#line 107 "colour-names.gperf.in" + {"DarkGreen", 0, 100, 0}, + {""}, +#line 37 "colour-names.gperf.in" + {"brown", 165, 42, 42}, +#line 714 "colour-names.gperf.in" + {"tan1", 255, 165, 79}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 713 "colour-names.gperf.in" + {"tan", 210, 180, 140}, +#line 574 "colour-names.gperf.in" + {"orange1", 255, 165, 0}, + {""}, +#line 38 "colour-names.gperf.in" + {"brown1", 255, 64, 64}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 132 "colour-names.gperf.in" + {"DarkSeaGreen4", 105, 139, 105}, + {""}, {""}, {""}, +#line 131 "colour-names.gperf.in" + {"DarkSeaGreen3", 155, 205, 155}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 176 "colour-names.gperf.in" + {"gold", 255, 215, 0}, + {""}, {""}, +#line 130 "colour-names.gperf.in" + {"DarkSeaGreen2", 180, 238, 180}, +#line 507 "colour-names.gperf.in" + {"linen", 250, 240, 230}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 128 "colour-names.gperf.in" + {"DarkSeaGreen", 143, 188, 143}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 129 "colour-names.gperf.in" + {"DarkSeaGreen1", 193, 255, 193}, + {""}, +#line 30 "colour-names.gperf.in" + {"blue", 0, 0, 255}, +#line 35 "colour-names.gperf.in" + {"blue4", 0, 0, 139}, +#line 22 "colour-names.gperf.in" + {"bisque", 255, 228, 196}, +#line 26 "colour-names.gperf.in" + {"bisque4", 139, 125, 107}, + {""}, +#line 34 "colour-names.gperf.in" + {"blue3", 0, 0, 205}, + {""}, +#line 25 "colour-names.gperf.in" + {"bisque3", 205, 183, 158}, + {""}, {""}, {""}, +#line 582 "colour-names.gperf.in" + {"OrangeRed4", 139, 37, 0}, + {""}, +#line 581 "colour-names.gperf.in" + {"OrangeRed3", 205, 55, 0}, + {""}, +#line 33 "colour-names.gperf.in" + {"blue2", 0, 0, 238}, + {""}, +#line 24 "colour-names.gperf.in" + {"bisque2", 238, 213, 183}, +#line 580 "colour-names.gperf.in" + {"OrangeRed2", 238, 64, 0}, + {""}, {""}, {""}, +#line 657 "colour-names.gperf.in" + {"salmon4", 139, 76, 57}, +#line 16 "colour-names.gperf.in" + {"azure", 240, 255, 255}, +#line 20 "colour-names.gperf.in" + {"azure4", 131, 139, 139}, + {""}, +#line 656 "colour-names.gperf.in" + {"salmon3", 205, 112, 84}, + {""}, +#line 19 "colour-names.gperf.in" + {"azure3", 193, 205, 205}, +#line 579 "colour-names.gperf.in" + {"OrangeRed1", 255, 69, 0}, + {""}, {""}, {""}, {""}, {""}, +#line 126 "colour-names.gperf.in" + {"DarkRed", 139, 0, 0}, +#line 655 "colour-names.gperf.in" + {"salmon2", 238, 130, 98}, +#line 32 "colour-names.gperf.in" + {"blue1", 0, 0, 255}, +#line 18 "colour-names.gperf.in" + {"azure2", 224, 238, 238}, +#line 23 "colour-names.gperf.in" + {"bisque1", 255, 228, 196}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 653 "colour-names.gperf.in" + {"salmon", 250, 128, 114}, + {""}, {""}, {""}, {""}, {""}, +#line 295 "colour-names.gperf.in" + {"grey", 190, 190, 190}, +#line 116 "colour-names.gperf.in" + {"DarkOrange", 255, 140, 0}, +#line 120 "colour-names.gperf.in" + {"DarkOrange4", 139, 69, 0}, + {""}, +#line 119 "colour-names.gperf.in" + {"DarkOrange3", 205, 102, 0}, +#line 654 "colour-names.gperf.in" + {"salmon1", 255, 140, 105}, + {""}, +#line 17 "colour-names.gperf.in" + {"azure1", 240, 255, 255}, + {""}, +#line 118 "colour-names.gperf.in" + {"DarkOrange2", 238, 118, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 117 "colour-names.gperf.in" + {"DarkOrange1", 255, 127, 0}, +#line 474 "colour-names.gperf.in" + {"LightGreen", 144, 238, 144}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 578 "colour-names.gperf.in" + {"OrangeRed", 255, 69, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 186 "colour-names.gperf.in" + {"gray", 190, 190, 190}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 185 "colour-names.gperf.in" + {"goldenrod4", 139, 105, 20}, + {""}, +#line 184 "colour-names.gperf.in" + {"goldenrod3", 205, 155, 29}, + {""}, {""}, {""}, {""}, +#line 183 "colour-names.gperf.in" + {"goldenrod2", 238, 180, 34}, + {""}, {""}, {""}, +#line 486 "colour-names.gperf.in" + {"LightSeaGreen", 32, 178, 170}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 182 "colour-names.gperf.in" + {"goldenrod1", 255, 193, 37}, + {""}, +#line 652 "colour-names.gperf.in" + {"SaddleBrown", 139, 69, 19}, + {""}, {""}, {""}, {""}, +#line 701 "colour-names.gperf.in" + {"spring green", 0, 255, 127}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 621 "colour-names.gperf.in" + {"pink4", 139, 99, 108}, +#line 694 "colour-names.gperf.in" + {"SlateGray4", 108, 123, 139}, +#line 84 "colour-names.gperf.in" + {"dark green", 0, 100, 0}, +#line 693 "colour-names.gperf.in" + {"SlateGray3", 159, 182, 205}, +#line 620 "colour-names.gperf.in" + {"pink3", 205, 145, 158}, + {""}, +#line 172 "colour-names.gperf.in" + {"ForestGreen", 34, 139, 34}, + {""}, +#line 692 "colour-names.gperf.in" + {"SlateGray2", 185, 211, 238}, + {""}, +#line 685 "colour-names.gperf.in" + {"SlateBlue", 106, 90, 205}, +#line 689 "colour-names.gperf.in" + {"SlateBlue4", 71, 60, 139}, + {""}, +#line 688 "colour-names.gperf.in" + {"SlateBlue3", 105, 89, 205}, +#line 619 "colour-names.gperf.in" + {"pink2", 238, 169, 184}, + {""}, {""}, {""}, +#line 687 "colour-names.gperf.in" + {"SlateBlue2", 122, 103, 238}, +#line 691 "colour-names.gperf.in" + {"SlateGray1", 198, 226, 255}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 79 "colour-names.gperf.in" + {"cyan4", 0, 139, 139}, +#line 686 "colour-names.gperf.in" + {"SlateBlue1", 131, 111, 255}, + {""}, +#line 181 "colour-names.gperf.in" + {"goldenrod", 218, 165, 32}, +#line 78 "colour-names.gperf.in" + {"cyan3", 0, 205, 205}, + {""}, {""}, {""}, +#line 618 "colour-names.gperf.in" + {"pink1", 255, 181, 197}, + {""}, {""}, {""}, {""}, {""}, +#line 77 "colour-names.gperf.in" + {"cyan2", 0, 238, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 75 "colour-names.gperf.in" + {"cyan", 0, 255, 255}, + {""}, {""}, {""}, {""}, +#line 99 "colour-names.gperf.in" + {"DarkBlue", 0, 0, 139}, + {""}, {""}, {""}, {""}, {""}, +#line 76 "colour-names.gperf.in" + {"cyan1", 0, 255, 255}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 296 "colour-names.gperf.in" + {"grey0", 0, 0, 0}, +#line 332 "colour-names.gperf.in" + {"grey40", 102, 102, 102}, + {""}, +#line 321 "colour-names.gperf.in" + {"grey30", 77, 77, 77}, + {""}, {""}, {""}, {""}, +#line 310 "colour-names.gperf.in" + {"grey20", 51, 51, 51}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 708 "colour-names.gperf.in" + {"SteelBlue", 70, 130, 180}, +#line 712 "colour-names.gperf.in" + {"SteelBlue4", 54, 100, 139}, + {""}, +#line 711 "colour-names.gperf.in" + {"SteelBlue3", 79, 148, 205}, +#line 298 "colour-names.gperf.in" + {"grey10", 26, 26, 26}, + {""}, +#line 573 "colour-names.gperf.in" + {"orange red", 255, 69, 0}, + {""}, +#line 710 "colour-names.gperf.in" + {"SteelBlue2", 92, 172, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 709 "colour-names.gperf.in" + {"SteelBlue1", 99, 184, 255}, + {""}, {""}, {""}, {""}, +#line 629 "colour-names.gperf.in" + {"purple", 160, 32, 240}, +#line 633 "colour-names.gperf.in" + {"purple4", 85, 26, 139}, + {""}, +#line 187 "colour-names.gperf.in" + {"gray0", 0, 0, 0}, +#line 223 "colour-names.gperf.in" + {"gray40", 102, 102, 102}, +#line 632 "colour-names.gperf.in" + {"purple3", 125, 38, 205}, +#line 212 "colour-names.gperf.in" + {"gray30", 77, 77, 77}, +#line 91 "colour-names.gperf.in" + {"dark red", 139, 0, 0}, + {""}, {""}, {""}, +#line 201 "colour-names.gperf.in" + {"gray20", 51, 51, 51}, +#line 67 "colour-names.gperf.in" + {"coral4", 139, 62, 47}, + {""}, {""}, +#line 631 "colour-names.gperf.in" + {"purple2", 145, 44, 238}, +#line 66 "colour-names.gperf.in" + {"coral3", 205, 91, 69}, + {""}, {""}, {""}, +#line 159 "colour-names.gperf.in" + {"DodgerBlue", 30, 144, 255}, +#line 163 "colour-names.gperf.in" + {"DodgerBlue4", 16, 78, 139}, +#line 189 "colour-names.gperf.in" + {"gray10", 26, 26, 26}, +#line 162 "colour-names.gperf.in" + {"DodgerBlue3", 24, 116, 205}, + {""}, +#line 89 "colour-names.gperf.in" + {"dark orange", 255, 140, 0}, +#line 65 "colour-names.gperf.in" + {"coral2", 238, 106, 80}, + {""}, +#line 161 "colour-names.gperf.in" + {"DodgerBlue2", 28, 134, 238}, + {""}, {""}, +#line 597 "colour-names.gperf.in" + {"PaleGreen4", 84, 139, 84}, + {""}, +#line 596 "colour-names.gperf.in" + {"PaleGreen3", 124, 205, 124}, + {""}, {""}, {""}, +#line 630 "colour-names.gperf.in" + {"purple1", 155, 48, 255}, +#line 595 "colour-names.gperf.in" + {"PaleGreen2", 144, 238, 144}, +#line 160 "colour-names.gperf.in" + {"DodgerBlue1", 30, 144, 255}, +#line 651 "colour-names.gperf.in" + {"saddle brown", 139, 69, 19}, + {""}, {""}, {""}, {""}, {""}, +#line 445 "colour-names.gperf.in" + {"light green", 144, 238, 144}, + {""}, +#line 64 "colour-names.gperf.in" + {"coral1", 255, 114, 86}, +#line 594 "colour-names.gperf.in" + {"PaleGreen1", 154, 255, 154}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 593 "colour-names.gperf.in" + {"PaleGreen", 152, 251, 152}, + {""}, {""}, {""}, {""}, +#line 158 "colour-names.gperf.in" + {"dodger blue", 30, 144, 255}, + {""}, {""}, +#line 626 "colour-names.gperf.in" + {"plum4", 139, 102, 139}, +#line 105 "colour-names.gperf.in" + {"DarkGoldenrod4", 139, 101, 8}, + {""}, {""}, +#line 625 "colour-names.gperf.in" + {"plum3", 205, 150, 205}, +#line 104 "colour-names.gperf.in" + {"DarkGoldenrod3", 205, 149, 12}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 624 "colour-names.gperf.in" + {"plum2", 238, 174, 238}, +#line 103 "colour-names.gperf.in" + {"DarkGoldenrod2", 238, 173, 14}, +#line 616 "colour-names.gperf.in" + {"peru", 205, 133, 63}, + {""}, {""}, {""}, {""}, +#line 565 "colour-names.gperf.in" + {"OldLace", 253, 245, 230}, + {""}, {""}, {""}, +#line 684 "colour-names.gperf.in" + {"slate grey", 112, 128, 144}, +#line 517 "colour-names.gperf.in" + {"maroon4", 139, 28, 98}, + {""}, {""}, {""}, +#line 516 "colour-names.gperf.in" + {"maroon3", 205, 41, 144}, + {""}, +#line 133 "colour-names.gperf.in" + {"DarkSlateBlue", 72, 61, 139}, + {""}, {""}, {""}, +#line 623 "colour-names.gperf.in" + {"plum1", 255, 187, 255}, +#line 102 "colour-names.gperf.in" + {"DarkGoldenrod1", 255, 185, 15}, +#line 456 "colour-names.gperf.in" + {"LightBlue", 173, 216, 230}, +#line 460 "colour-names.gperf.in" + {"LightBlue4", 104, 131, 139}, +#line 515 "colour-names.gperf.in" + {"maroon2", 238, 48, 167}, +#line 459 "colour-names.gperf.in" + {"LightBlue3", 154, 192, 205}, + {""}, {""}, +#line 677 "colour-names.gperf.in" + {"SkyBlue", 135, 206, 235}, +#line 681 "colour-names.gperf.in" + {"SkyBlue4", 74, 112, 139}, +#line 458 "colour-names.gperf.in" + {"LightBlue2", 178, 223, 238}, + {""}, {""}, +#line 680 "colour-names.gperf.in" + {"SkyBlue3", 108, 166, 205}, + {""}, +#line 513 "colour-names.gperf.in" + {"maroon", 176, 48, 96}, + {""}, +#line 449 "colour-names.gperf.in" + {"light sea green", 32, 178, 170}, + {""}, {""}, +#line 695 "colour-names.gperf.in" + {"SlateGrey", 112, 128, 144}, +#line 457 "colour-names.gperf.in" + {"LightBlue1", 191, 239, 255}, + {""}, +#line 679 "colour-names.gperf.in" + {"SkyBlue2", 126, 192, 238}, + {""}, {""}, +#line 514 "colour-names.gperf.in" + {"maroon1", 255, 52, 179}, + {""}, {""}, +#line 676 "colour-names.gperf.in" + {"sky blue", 135, 206, 235}, + {""}, +#line 683 "colour-names.gperf.in" + {"slate gray", 112, 128, 144}, + {""}, +#line 63 "colour-names.gperf.in" + {"coral", 255, 127, 80}, + {""}, {""}, {""}, {""}, +#line 101 "colour-names.gperf.in" + {"DarkGoldenrod", 184, 134, 11}, + {""}, {""}, +#line 682 "colour-names.gperf.in" + {"slate blue", 106, 90, 205}, + {""}, {""}, {""}, +#line 678 "colour-names.gperf.in" + {"SkyBlue1", 135, 206, 255}, +#line 506 "colour-names.gperf.in" + {"LimeGreen", 50, 205, 50}, +#line 512 "colour-names.gperf.in" + {"magenta4", 139, 0, 139}, + {""}, {""}, {""}, +#line 511 "colour-names.gperf.in" + {"magenta3", 205, 0, 205}, +#line 21 "colour-names.gperf.in" + {"beige", 245, 245, 220}, + {""}, {""}, {""}, {""}, {""}, +#line 110 "colour-names.gperf.in" + {"DarkMagenta", 139, 0, 139}, + {""}, +#line 391 "colour-names.gperf.in" + {"grey94", 240, 240, 240}, +#line 510 "colour-names.gperf.in" + {"magenta2", 238, 0, 238}, +#line 690 "colour-names.gperf.in" + {"SlateGray", 112, 128, 144}, +#line 171 "colour-names.gperf.in" + {"forest green", 34, 139, 34}, +#line 390 "colour-names.gperf.in" + {"grey93", 237, 237, 237}, +#line 140 "colour-names.gperf.in" + {"DarkTurquoise", 0, 206, 209}, + {""}, {""}, +#line 108 "colour-names.gperf.in" + {"DarkGrey", 169, 169, 169}, + {""}, {""}, {""}, {""}, {""}, +#line 389 "colour-names.gperf.in" + {"grey92", 235, 235, 235}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 509 "colour-names.gperf.in" + {"magenta1", 255, 0, 255}, + {""}, {""}, +#line 93 "colour-names.gperf.in" + {"dark sea green", 143, 188, 143}, + {""}, +#line 508 "colour-names.gperf.in" + {"magenta", 255, 0, 255}, +#line 80 "colour-names.gperf.in" + {"dark blue", 0, 0, 139}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 388 "colour-names.gperf.in" + {"grey91", 232, 232, 232}, + {""}, {""}, {""}, {""}, {""}, +#line 282 "colour-names.gperf.in" + {"gray94", 240, 240, 240}, + {""}, {""}, {""}, +#line 281 "colour-names.gperf.in" + {"gray93", 237, 237, 237}, + {""}, +#line 564 "colour-names.gperf.in" + {"old lace", 253, 245, 230}, +#line 299 "colour-names.gperf.in" + {"grey100", 255, 255, 255}, +#line 106 "colour-names.gperf.in" + {"DarkGray", 169, 169, 169}, +#line 138 "colour-names.gperf.in" + {"DarkSlateGray4", 82, 139, 139}, +#line 495 "colour-names.gperf.in" + {"LightSteelBlue", 176, 196, 222}, +#line 499 "colour-names.gperf.in" + {"LightSteelBlue4", 110, 123, 139}, +#line 658 "colour-names.gperf.in" + {"sandy brown", 244, 164, 96}, +#line 137 "colour-names.gperf.in" + {"DarkSlateGray3", 121, 205, 205}, +#line 280 "colour-names.gperf.in" + {"gray92", 235, 235, 235}, +#line 498 "colour-names.gperf.in" + {"LightSteelBlue3", 162, 181, 205}, + {""}, +#line 448 "colour-names.gperf.in" + {"light salmon", 255, 160, 122}, +#line 670 "colour-names.gperf.in" + {"seashell4", 139, 134, 130}, +#line 707 "colour-names.gperf.in" + {"steel blue", 70, 130, 180}, + {""}, {""}, +#line 669 "colour-names.gperf.in" + {"seashell3", 205, 197, 191}, +#line 136 "colour-names.gperf.in" + {"DarkSlateGray2", 141, 238, 238}, + {""}, +#line 497 "colour-names.gperf.in" + {"LightSteelBlue2", 188, 210, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 668 "colour-names.gperf.in" + {"seashell2", 238, 229, 222}, + {""}, {""}, {""}, +#line 279 "colour-names.gperf.in" + {"gray91", 232, 232, 232}, + {""}, +#line 471 "colour-names.gperf.in" + {"LightGoldenrod4", 139, 129, 76}, + {""}, {""}, {""}, +#line 470 "colour-names.gperf.in" + {"LightGoldenrod3", 205, 190, 112}, + {""}, {""}, +#line 135 "colour-names.gperf.in" + {"DarkSlateGray1", 151, 255, 255}, + {""}, +#line 496 "colour-names.gperf.in" + {"LightSteelBlue1", 202, 225, 255}, + {""}, +#line 190 "colour-names.gperf.in" + {"gray100", 255, 255, 255}, + {""}, {""}, +#line 469 "colour-names.gperf.in" + {"LightGoldenrod2", 238, 220, 130}, + {""}, +#line 667 "colour-names.gperf.in" + {"seashell1", 255, 245, 238}, + {""}, {""}, {""}, +#line 380 "colour-names.gperf.in" + {"grey84", 214, 214, 214}, + {""}, {""}, {""}, +#line 379 "colour-names.gperf.in" + {"grey83", 212, 212, 212}, +#line 53 "colour-names.gperf.in" + {"chartreuse", 127, 255, 0}, +#line 57 "colour-names.gperf.in" + {"chartreuse4", 69, 139, 0}, + {""}, +#line 56 "colour-names.gperf.in" + {"chartreuse3", 102, 205, 0}, +#line 646 "colour-names.gperf.in" + {"RoyalBlue", 65, 105, 225}, +#line 650 "colour-names.gperf.in" + {"RoyalBlue4", 39, 64, 139}, + {""}, +#line 649 "colour-names.gperf.in" + {"RoyalBlue3", 58, 95, 205}, +#line 55 "colour-names.gperf.in" + {"chartreuse2", 118, 238, 0}, +#line 378 "colour-names.gperf.in" + {"grey82", 209, 209, 209}, +#line 589 "colour-names.gperf.in" + {"pale green", 152, 251, 152}, +#line 468 "colour-names.gperf.in" + {"LightGoldenrod1", 255, 236, 139}, +#line 648 "colour-names.gperf.in" + {"RoyalBlue2", 67, 110, 238}, +#line 696 "colour-names.gperf.in" + {"snow", 255, 250, 250}, +#line 504 "colour-names.gperf.in" + {"LightYellow4", 139, 139, 122}, + {""}, {""}, {""}, +#line 503 "colour-names.gperf.in" + {"LightYellow3", 205, 205, 180}, +#line 54 "colour-names.gperf.in" + {"chartreuse1", 127, 255, 0}, + {""}, {""}, {""}, +#line 647 "colour-names.gperf.in" + {"RoyalBlue1", 72, 118, 255}, + {""}, {""}, {""}, {""}, +#line 502 "colour-names.gperf.in" + {"LightYellow2", 238, 238, 209}, + {""}, +#line 446 "colour-names.gperf.in" + {"light grey", 211, 211, 211}, +#line 377 "colour-names.gperf.in" + {"grey81", 207, 207, 207}, +#line 727 "colour-names.gperf.in" + {"tomato4", 139, 54, 38}, + {""}, {""}, {""}, +#line 726 "colour-names.gperf.in" + {"tomato3", 205, 79, 57}, +#line 271 "colour-names.gperf.in" + {"gray84", 214, 214, 214}, + {""}, {""}, {""}, +#line 270 "colour-names.gperf.in" + {"gray83", 212, 212, 212}, + {""}, {""}, {""}, +#line 744 "colour-names.gperf.in" + {"wheat4", 139, 126, 102}, +#line 725 "colour-names.gperf.in" + {"tomato2", 238, 92, 66}, + {""}, +#line 467 "colour-names.gperf.in" + {"LightGoldenrod", 238, 221, 130}, +#line 743 "colour-names.gperf.in" + {"wheat3", 205, 186, 150}, +#line 501 "colour-names.gperf.in" + {"LightYellow1", 255, 255, 224}, +#line 269 "colour-names.gperf.in" + {"gray82", 209, 209, 209}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 742 "colour-names.gperf.in" + {"wheat2", 238, 216, 174}, + {""}, +#line 475 "colour-names.gperf.in" + {"LightGrey", 211, 211, 211}, + {""}, +#line 617 "colour-names.gperf.in" + {"pink", 255, 192, 203}, + {""}, {""}, +#line 127 "colour-names.gperf.in" + {"DarkSalmon", 233, 150, 122}, + {""}, +#line 724 "colour-names.gperf.in" + {"tomato1", 255, 99, 71}, + {""}, {""}, +#line 100 "colour-names.gperf.in" + {"DarkCyan", 0, 139, 139}, +#line 444 "colour-names.gperf.in" + {"light gray", 211, 211, 211}, +#line 268 "colour-names.gperf.in" + {"gray81", 207, 207, 207}, + {""}, {""}, +#line 666 "colour-names.gperf.in" + {"seashell", 255, 245, 238}, +#line 549 "colour-names.gperf.in" + {"MistyRose", 255, 228, 225}, +#line 553 "colour-names.gperf.in" + {"MistyRose4", 139, 125, 123}, + {""}, +#line 552 "colour-names.gperf.in" + {"MistyRose3", 205, 183, 181}, +#line 741 "colour-names.gperf.in" + {"wheat1", 255, 231, 186}, +#line 439 "colour-names.gperf.in" + {"light blue", 173, 216, 230}, + {""}, {""}, +#line 551 "colour-names.gperf.in" + {"MistyRose2", 238, 213, 210}, + {""}, {""}, {""}, {""}, +#line 58 "colour-names.gperf.in" + {"chocolate", 210, 105, 30}, +#line 62 "colour-names.gperf.in" + {"chocolate4", 139, 69, 19}, + {""}, +#line 61 "colour-names.gperf.in" + {"chocolate3", 205, 102, 29}, + {""}, {""}, +#line 550 "colour-names.gperf.in" + {"MistyRose1", 255, 228, 225}, + {""}, +#line 60 "colour-names.gperf.in" + {"chocolate2", 238, 118, 33}, +#line 644 "colour-names.gperf.in" + {"RosyBrown4", 139, 105, 105}, +#line 505 "colour-names.gperf.in" + {"lime green", 50, 205, 50}, +#line 643 "colour-names.gperf.in" + {"RosyBrown3", 205, 155, 155}, + {""}, +#line 473 "colour-names.gperf.in" + {"LightGray", 211, 211, 211}, +#line 485 "colour-names.gperf.in" + {"LightSalmon4", 139, 87, 66}, +#line 413 "colour-names.gperf.in" + {"IndianRed4", 139, 58, 58}, +#line 642 "colour-names.gperf.in" + {"RosyBrown2", 238, 180, 180}, +#line 412 "colour-names.gperf.in" + {"IndianRed3", 205, 85, 85}, +#line 484 "colour-names.gperf.in" + {"LightSalmon3", 205, 129, 98}, +#line 59 "colour-names.gperf.in" + {"chocolate1", 255, 127, 36}, + {""}, +#line 492 "colour-names.gperf.in" + {"LightSlateBlue", 132, 112, 255}, +#line 411 "colour-names.gperf.in" + {"IndianRed2", 238, 99, 99}, + {""}, {""}, +#line 432 "colour-names.gperf.in" + {"LawnGreen", 124, 252, 0}, + {""}, +#line 641 "colour-names.gperf.in" + {"RosyBrown1", 255, 193, 193}, +#line 483 "colour-names.gperf.in" + {"LightSalmon2", 238, 149, 114}, + {""}, +#line 571 "colour-names.gperf.in" + {"OliveDrab4", 105, 139, 34}, + {""}, +#line 570 "colour-names.gperf.in" + {"OliveDrab3", 154, 205, 50}, +#line 410 "colour-names.gperf.in" + {"IndianRed1", 255, 106, 106}, +#line 640 "colour-names.gperf.in" + {"RosyBrown", 188, 143, 143}, + {""}, +#line 723 "colour-names.gperf.in" + {"tomato", 255, 99, 71}, +#line 569 "colour-names.gperf.in" + {"OliveDrab2", 179, 238, 58}, + {""}, +#line 481 "colour-names.gperf.in" + {"LightSalmon", 255, 160, 122}, +#line 369 "colour-names.gperf.in" + {"grey74", 189, 189, 189}, + {""}, {""}, {""}, +#line 368 "colour-names.gperf.in" + {"grey73", 186, 186, 186}, +#line 82 "colour-names.gperf.in" + {"dark goldenrod", 184, 134, 11}, +#line 461 "colour-names.gperf.in" + {"LightCoral", 240, 128, 128}, + {""}, +#line 568 "colour-names.gperf.in" + {"OliveDrab1", 192, 255, 62}, +#line 567 "colour-names.gperf.in" + {"OliveDrab", 107, 142, 35}, +#line 482 "colour-names.gperf.in" + {"LightSalmon1", 255, 160, 122}, + {""}, {""}, {""}, +#line 367 "colour-names.gperf.in" + {"grey72", 184, 184, 184}, + {""}, {""}, {""}, +#line 85 "colour-names.gperf.in" + {"dark grey", 169, 169, 169}, + {""}, {""}, {""}, {""}, {""}, +#line 87 "colour-names.gperf.in" + {"dark magenta", 139, 0, 139}, + {""}, +#line 48 "colour-names.gperf.in" + {"CadetBlue", 95, 158, 160}, +#line 52 "colour-names.gperf.in" + {"CadetBlue4", 83, 134, 139}, + {""}, +#line 51 "colour-names.gperf.in" + {"CadetBlue3", 122, 197, 205}, + {""}, {""}, {""}, {""}, +#line 50 "colour-names.gperf.in" + {"CadetBlue2", 142, 229, 238}, + {""}, +#line 366 "colour-names.gperf.in" + {"grey71", 181, 181, 181}, + {""}, {""}, +#line 740 "colour-names.gperf.in" + {"wheat", 245, 222, 179}, + {""}, {""}, +#line 260 "colour-names.gperf.in" + {"gray74", 189, 189, 189}, + {""}, {""}, +#line 49 "colour-names.gperf.in" + {"CadetBlue1", 152, 245, 255}, +#line 259 "colour-names.gperf.in" + {"gray73", 186, 186, 186}, + {""}, +#line 409 "colour-names.gperf.in" + {"IndianRed", 205, 92, 92}, +#line 139 "colour-names.gperf.in" + {"DarkSlateGrey", 47, 79, 79}, +#line 149 "colour-names.gperf.in" + {"DeepSkyBlue", 0, 191, 255}, +#line 153 "colour-names.gperf.in" + {"DeepSkyBlue4", 0, 104, 139}, + {""}, {""}, +#line 358 "colour-names.gperf.in" + {"grey64", 163, 163, 163}, +#line 152 "colour-names.gperf.in" + {"DeepSkyBlue3", 0, 154, 205}, +#line 258 "colour-names.gperf.in" + {"gray72", 184, 184, 184}, +#line 27 "colour-names.gperf.in" + {"black", 0, 0, 0}, +#line 357 "colour-names.gperf.in" + {"grey63", 161, 161, 161}, + {""}, +#line 83 "colour-names.gperf.in" + {"dark gray", 169, 169, 169}, + {""}, {""}, {""}, +#line 173 "colour-names.gperf.in" + {"gainsboro", 220, 220, 220}, +#line 151 "colour-names.gperf.in" + {"DeepSkyBlue2", 0, 178, 238}, + {""}, {""}, +#line 356 "colour-names.gperf.in" + {"grey62", 158, 158, 158}, + {""}, {""}, {""}, {""}, {""}, +#line 466 "colour-names.gperf.in" + {"LightCyan4", 122, 139, 139}, + {""}, +#line 465 "colour-names.gperf.in" + {"LightCyan3", 180, 205, 205}, + {""}, +#line 257 "colour-names.gperf.in" + {"gray71", 181, 181, 181}, + {""}, {""}, +#line 464 "colour-names.gperf.in" + {"LightCyan2", 209, 238, 238}, + {""}, {""}, {""}, {""}, +#line 92 "colour-names.gperf.in" + {"dark salmon", 233, 150, 122}, +#line 150 "colour-names.gperf.in" + {"DeepSkyBlue1", 0, 191, 255}, + {""}, +#line 94 "colour-names.gperf.in" + {"dark slate blue", 72, 61, 139}, +#line 355 "colour-names.gperf.in" + {"grey61", 156, 156, 156}, +#line 134 "colour-names.gperf.in" + {"DarkSlateGray", 47, 79, 79}, +#line 463 "colour-names.gperf.in" + {"LightCyan1", 224, 255, 255}, + {""}, {""}, {""}, +#line 249 "colour-names.gperf.in" + {"gray64", 163, 163, 163}, + {""}, {""}, +#line 462 "colour-names.gperf.in" + {"LightCyan", 224, 255, 255}, +#line 248 "colour-names.gperf.in" + {"gray63", 161, 161, 161}, + {""}, {""}, +#line 487 "colour-names.gperf.in" + {"LightSkyBlue", 135, 206, 250}, +#line 491 "colour-names.gperf.in" + {"LightSkyBlue4", 96, 123, 139}, + {""}, {""}, {""}, +#line 490 "colour-names.gperf.in" + {"LightSkyBlue3", 141, 182, 205}, +#line 418 "colour-names.gperf.in" + {"ivory4", 139, 139, 131}, +#line 247 "colour-names.gperf.in" + {"gray62", 158, 158, 158}, +#line 718 "colour-names.gperf.in" + {"thistle", 216, 191, 216}, +#line 722 "colour-names.gperf.in" + {"thistle4", 139, 123, 139}, +#line 417 "colour-names.gperf.in" + {"ivory3", 205, 205, 193}, +#line 622 "colour-names.gperf.in" + {"plum", 221, 160, 221}, +#line 442 "colour-names.gperf.in" + {"light goldenrod", 238, 221, 130}, +#line 721 "colour-names.gperf.in" + {"thistle3", 205, 181, 205}, +#line 347 "colour-names.gperf.in" + {"grey54", 138, 138, 138}, +#line 489 "colour-names.gperf.in" + {"LightSkyBlue2", 164, 211, 238}, +#line 645 "colour-names.gperf.in" + {"royal blue", 65, 105, 225}, + {""}, +#line 346 "colour-names.gperf.in" + {"grey53", 135, 135, 135}, + {""}, +#line 416 "colour-names.gperf.in" + {"ivory2", 238, 238, 224}, + {""}, {""}, +#line 720 "colour-names.gperf.in" + {"thistle2", 238, 210, 238}, + {""}, {""}, +#line 4 "colour-names.gperf.in" + {"AliceBlue", 240, 248, 255}, +#line 592 "colour-names.gperf.in" + {"PaleGoldenrod", 238, 232, 170}, +#line 345 "colour-names.gperf.in" + {"grey52", 133, 133, 133}, +#line 246 "colour-names.gperf.in" + {"gray61", 156, 156, 156}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 488 "colour-names.gperf.in" + {"LightSkyBlue1", 176, 226, 255}, + {""}, {""}, {""}, {""}, +#line 415 "colour-names.gperf.in" + {"ivory1", 255, 255, 240}, + {""}, {""}, +#line 719 "colour-names.gperf.in" + {"thistle1", 255, 225, 255}, + {""}, {""}, {""}, {""}, +#line 344 "colour-names.gperf.in" + {"grey51", 130, 130, 130}, + {""}, {""}, {""}, +#line 598 "colour-names.gperf.in" + {"PaleTurquoise", 175, 238, 238}, +#line 602 "colour-names.gperf.in" + {"PaleTurquoise4", 102, 139, 139}, +#line 238 "colour-names.gperf.in" + {"gray54", 138, 138, 138}, + {""}, {""}, +#line 601 "colour-names.gperf.in" + {"PaleTurquoise3", 150, 205, 205}, +#line 237 "colour-names.gperf.in" + {"gray53", 135, 135, 135}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 600 "colour-names.gperf.in" + {"PaleTurquoise2", 174, 238, 238}, +#line 236 "colour-names.gperf.in" + {"gray52", 133, 133, 133}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 728 "colour-names.gperf.in" + {"turquoise", 64, 224, 208}, +#line 732 "colour-names.gperf.in" + {"turquoise4", 0, 134, 139}, + {""}, +#line 731 "colour-names.gperf.in" + {"turquoise3", 0, 197, 205}, +#line 81 "colour-names.gperf.in" + {"dark cyan", 0, 139, 139}, + {""}, {""}, {""}, +#line 730 "colour-names.gperf.in" + {"turquoise2", 0, 229, 238}, + {""}, +#line 548 "colour-names.gperf.in" + {"misty rose", 255, 228, 225}, + {""}, +#line 599 "colour-names.gperf.in" + {"PaleTurquoise1", 187, 255, 255}, +#line 235 "colour-names.gperf.in" + {"gray51", 130, 130, 130}, + {""}, {""}, {""}, {""}, +#line 157 "colour-names.gperf.in" + {"DimGrey", 105, 105, 105}, +#line 729 "colour-names.gperf.in" + {"turquoise1", 0, 245, 255}, +#line 155 "colour-names.gperf.in" + {"dim grey", 105, 105, 105}, + {""}, +#line 431 "colour-names.gperf.in" + {"lawn green", 124, 252, 0}, + {""}, {""}, {""}, {""}, +#line 440 "colour-names.gperf.in" + {"light coral", 240, 128, 128}, + {""}, {""}, {""}, +#line 639 "colour-names.gperf.in" + {"rosy brown", 188, 143, 143}, + {""}, {""}, {""}, {""}, {""}, +#line 408 "colour-names.gperf.in" + {"indian red", 205, 92, 92}, + {""}, +#line 387 "colour-names.gperf.in" + {"grey90", 229, 229, 229}, + {""}, +#line 423 "colour-names.gperf.in" + {"khaki4", 139, 134, 78}, +#line 494 "colour-names.gperf.in" + {"LightSlateGrey", 119, 136, 153}, + {""}, {""}, +#line 422 "colour-names.gperf.in" + {"khaki3", 205, 198, 115}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 566 "colour-names.gperf.in" + {"olive drab", 107, 142, 35}, + {""}, {""}, +#line 421 "colour-names.gperf.in" + {"khaki2", 238, 230, 133}, + {""}, {""}, {""}, {""}, +#line 156 "colour-names.gperf.in" + {"DimGray", 105, 105, 105}, + {""}, +#line 154 "colour-names.gperf.in" + {"dim gray", 105, 105, 105}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 659 "colour-names.gperf.in" + {"SandyBrown", 244, 164, 96}, + {""}, {""}, {""}, {""}, +#line 420 "colour-names.gperf.in" + {"khaki1", 255, 246, 143}, + {""}, {""}, {""}, +#line 278 "colour-names.gperf.in" + {"gray90", 229, 229, 229}, + {""}, {""}, +#line 493 "colour-names.gperf.in" + {"LightSlateGray", 119, 136, 153}, + {""}, {""}, {""}, {""}, +#line 47 "colour-names.gperf.in" + {"cadet blue", 95, 158, 160}, + {""}, {""}, {""}, {""}, +#line 587 "colour-names.gperf.in" + {"orchid4", 139, 71, 137}, + {""}, {""}, {""}, +#line 586 "colour-names.gperf.in" + {"orchid3", 205, 105, 201}, + {""}, {""}, {""}, +#line 753 "colour-names.gperf.in" + {"yellow4", 139, 139, 0}, + {""}, {""}, {""}, +#line 752 "colour-names.gperf.in" + {"yellow3", 205, 205, 0}, + {""}, +#line 585 "colour-names.gperf.in" + {"orchid2", 238, 122, 233}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 751 "colour-names.gperf.in" + {"yellow2", 238, 238, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 584 "colour-names.gperf.in" + {"orchid1", 255, 131, 250}, +#line 96 "colour-names.gperf.in" + {"dark slate grey", 47, 79, 79}, +#line 453 "colour-names.gperf.in" + {"light slate grey", 119, 136, 153}, + {""}, {""}, {""}, +#line 441 "colour-names.gperf.in" + {"light cyan", 224, 255, 255}, + {""}, +#line 750 "colour-names.gperf.in" + {"yellow1", 255, 255, 0}, +#line 376 "colour-names.gperf.in" + {"grey80", 204, 204, 204}, + {""}, {""}, {""}, {""}, {""}, +#line 454 "colour-names.gperf.in" + {"light steel blue", 176, 196, 222}, + {""}, {""}, {""}, {""}, +#line 754 "colour-names.gperf.in" + {"YellowGreen", 154, 205, 50}, + {""}, {""}, {""}, {""}, +#line 424 "colour-names.gperf.in" + {"lavender", 230, 230, 250}, + {""}, {""}, {""}, {""}, +#line 294 "colour-names.gperf.in" + {"GreenYellow", 173, 255, 47}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 583 "colour-names.gperf.in" + {"orchid", 218, 112, 214}, + {""}, {""}, {""}, {""}, {""}, +#line 95 "colour-names.gperf.in" + {"dark slate gray", 47, 79, 79}, +#line 452 "colour-names.gperf.in" + {"light slate gray", 119, 136, 153}, + {""}, {""}, +#line 29 "colour-names.gperf.in" + {"BlanchedAlmond", 255, 235, 205}, + {""}, {""}, {""}, +#line 267 "colour-names.gperf.in" + {"gray80", 204, 204, 204}, + {""}, {""}, +#line 451 "colour-names.gperf.in" + {"light slate blue", 132, 112, 255}, + {""}, {""}, {""}, {""}, +#line 46 "colour-names.gperf.in" + {"burlywood4", 139, 115, 85}, + {""}, +#line 45 "colour-names.gperf.in" + {"burlywood3", 205, 170, 125}, +#line 3 "colour-names.gperf.in" + {"alice blue", 240, 248, 255}, + {""}, {""}, {""}, +#line 44 "colour-names.gperf.in" + {"burlywood2", 238, 197, 145}, +#line 561 "colour-names.gperf.in" + {"navy", 0, 0, 128}, + {""}, {""}, +#line 539 "colour-names.gperf.in" + {"MediumSeaGreen", 60, 179, 113}, + {""}, +#line 414 "colour-names.gperf.in" + {"ivory", 255, 255, 240}, + {""}, {""}, {""}, {""}, +#line 43 "colour-names.gperf.in" + {"burlywood1", 255, 211, 155}, + {""}, {""}, +#line 588 "colour-names.gperf.in" + {"pale goldenrod", 238, 232, 170}, + {""}, +#line 739 "colour-names.gperf.in" + {"VioletRed4", 139, 34, 82}, + {""}, +#line 738 "colour-names.gperf.in" + {"VioletRed3", 205, 50, 120}, + {""}, {""}, {""}, {""}, +#line 737 "colour-names.gperf.in" + {"VioletRed2", 238, 58, 140}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 736 "colour-names.gperf.in" + {"VioletRed1", 255, 62, 150}, + {""}, {""}, {""}, {""}, +#line 745 "colour-names.gperf.in" + {"white", 255, 255, 255}, +#line 386 "colour-names.gperf.in" + {"grey9", 23, 23, 23}, +#line 341 "colour-names.gperf.in" + {"grey49", 125, 125, 125}, + {""}, +#line 330 "colour-names.gperf.in" + {"grey39", 99, 99, 99}, + {""}, {""}, +#line 733 "colour-names.gperf.in" + {"violet", 238, 130, 238}, + {""}, +#line 319 "colour-names.gperf.in" + {"grey29", 74, 74, 74}, + {""}, {""}, {""}, +#line 90 "colour-names.gperf.in" + {"dark orchid", 153, 50, 204}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 308 "colour-names.gperf.in" + {"grey19", 48, 48, 48}, + {""}, +#line 97 "colour-names.gperf.in" + {"dark turquoise", 0, 206, 209}, + {""}, {""}, {""}, {""}, +#line 42 "colour-names.gperf.in" + {"burlywood", 222, 184, 135}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 563 "colour-names.gperf.in" + {"NavyBlue", 0, 0, 128}, + {""}, {""}, +#line 365 "colour-names.gperf.in" + {"grey70", 179, 179, 179}, + {""}, {""}, {""}, +#line 277 "colour-names.gperf.in" + {"gray9", 23, 23, 23}, +#line 232 "colour-names.gperf.in" + {"gray49", 125, 125, 125}, + {""}, +#line 221 "colour-names.gperf.in" + {"gray39", 99, 99, 99}, + {""}, {""}, {""}, +#line 735 "colour-names.gperf.in" + {"VioletRed", 208, 32, 144}, +#line 210 "colour-names.gperf.in" + {"gray29", 74, 74, 74}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 199 "colour-names.gperf.in" + {"gray19", 48, 48, 48}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 256 "colour-names.gperf.in" + {"gray70", 179, 179, 179}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 354 "colour-names.gperf.in" + {"grey60", 153, 153, 153}, + {""}, {""}, +#line 628 "colour-names.gperf.in" + {"PowderBlue", 176, 224, 230}, + {""}, {""}, {""}, {""}, {""}, +#line 11 "colour-names.gperf.in" + {"aquamarine", 127, 255, 212}, +#line 15 "colour-names.gperf.in" + {"aquamarine4", 69, 139, 116}, + {""}, +#line 14 "colour-names.gperf.in" + {"aquamarine3", 102, 205, 170}, + {""}, {""}, {""}, {""}, +#line 13 "colour-names.gperf.in" + {"aquamarine2", 118, 238, 198}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 12 "colour-names.gperf.in" + {"aquamarine1", 127, 255, 212}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 5 "colour-names.gperf.in" + {"antique white", 250, 235, 215}, + {""}, {""}, +#line 245 "colour-names.gperf.in" + {"gray60", 153, 153, 153}, + {""}, +#line 627 "colour-names.gperf.in" + {"powder blue", 176, 224, 230}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 500 "colour-names.gperf.in" + {"LightYellow", 255, 255, 224}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 343 "colour-names.gperf.in" + {"grey50", 127, 127, 127}, + {""}, {""}, {""}, {""}, +#line 522 "colour-names.gperf.in" + {"medium sea green", 60, 179, 113}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 401 "colour-names.gperf.in" + {"honeydew4", 131, 139, 131}, + {""}, {""}, {""}, +#line 400 "colour-names.gperf.in" + {"honeydew3", 193, 205, 193}, + {""}, {""}, +#line 143 "colour-names.gperf.in" + {"deep sky blue", 0, 191, 255}, +#line 749 "colour-names.gperf.in" + {"yellow green", 154, 205, 50}, + {""}, +#line 6 "colour-names.gperf.in" + {"AntiqueWhite", 250, 235, 215}, +#line 10 "colour-names.gperf.in" + {"AntiqueWhite4", 139, 131, 120}, + {""}, {""}, +#line 399 "colour-names.gperf.in" + {"honeydew2", 224, 238, 224}, +#line 9 "colour-names.gperf.in" + {"AntiqueWhite3", 205, 192, 176}, + {""}, {""}, {""}, {""}, +#line 234 "colour-names.gperf.in" + {"gray50", 127, 127, 127}, + {""}, {""}, +#line 375 "colour-names.gperf.in" + {"grey8", 20, 20, 20}, +#line 340 "colour-names.gperf.in" + {"grey48", 122, 122, 122}, +#line 8 "colour-names.gperf.in" + {"AntiqueWhite2", 238, 223, 204}, +#line 329 "colour-names.gperf.in" + {"grey38", 97, 97, 97}, + {""}, {""}, {""}, {""}, +#line 318 "colour-names.gperf.in" + {"grey28", 71, 71, 71}, + {""}, {""}, {""}, +#line 528 "colour-names.gperf.in" + {"MediumBlue", 0, 0, 205}, +#line 398 "colour-names.gperf.in" + {"honeydew1", 240, 255, 240}, + {""}, {""}, {""}, {""}, {""}, +#line 307 "colour-names.gperf.in" + {"grey18", 46, 46, 46}, +#line 734 "colour-names.gperf.in" + {"violet red", 208, 32, 144}, + {""}, +#line 148 "colour-names.gperf.in" + {"DeepPink4", 139, 10, 80}, + {""}, +#line 7 "colour-names.gperf.in" + {"AntiqueWhite1", 255, 239, 219}, + {""}, +#line 147 "colour-names.gperf.in" + {"DeepPink3", 205, 16, 118}, + {""}, {""}, {""}, +#line 554 "colour-names.gperf.in" + {"moccasin", 255, 228, 181}, + {""}, {""}, {""}, {""}, {""}, +#line 146 "colour-names.gperf.in" + {"DeepPink2", 238, 18, 137}, +#line 450 "colour-names.gperf.in" + {"light sky blue", 135, 206, 250}, + {""}, {""}, {""}, {""}, +#line 266 "colour-names.gperf.in" + {"gray8", 20, 20, 20}, +#line 231 "colour-names.gperf.in" + {"gray48", 122, 122, 122}, + {""}, +#line 220 "colour-names.gperf.in" + {"gray38", 97, 97, 97}, + {""}, {""}, {""}, {""}, +#line 209 "colour-names.gperf.in" + {"gray28", 71, 71, 71}, + {""}, {""}, +#line 519 "colour-names.gperf.in" + {"medium blue", 0, 0, 205}, + {""}, {""}, {""}, {""}, +#line 145 "colour-names.gperf.in" + {"DeepPink1", 255, 20, 147}, + {""}, {""}, +#line 198 "colour-names.gperf.in" + {"gray18", 46, 46, 46}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 74 "colour-names.gperf.in" + {"cornsilk4", 139, 136, 120}, + {""}, {""}, {""}, +#line 73 "colour-names.gperf.in" + {"cornsilk3", 205, 200, 177}, + {""}, {""}, +#line 562 "colour-names.gperf.in" + {"navy blue", 0, 0, 128}, + {""}, {""}, {""}, {""}, +#line 546 "colour-names.gperf.in" + {"mint cream", 245, 255, 250}, + {""}, +#line 72 "colour-names.gperf.in" + {"cornsilk2", 238, 232, 205}, + {""}, {""}, {""}, +#line 541 "colour-names.gperf.in" + {"MediumSpringGreen", 0, 250, 154}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 71 "colour-names.gperf.in" + {"cornsilk1", 255, 248, 220}, +#line 443 "colour-names.gperf.in" + {"light goldenrod yellow", 250, 250, 210}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 125 "colour-names.gperf.in" + {"DarkOrchid4", 104, 34, 139}, + {""}, +#line 124 "colour-names.gperf.in" + {"DarkOrchid3", 154, 50, 205}, + {""}, {""}, {""}, {""}, +#line 123 "colour-names.gperf.in" + {"DarkOrchid2", 178, 58, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 122 "colour-names.gperf.in" + {"DarkOrchid1", 191, 62, 255}, + {""}, +#line 407 "colour-names.gperf.in" + {"HotPink4", 139, 58, 98}, + {""}, {""}, {""}, +#line 406 "colour-names.gperf.in" + {"HotPink3", 205, 96, 144}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 430 "colour-names.gperf.in" + {"LavenderBlush4", 139, 131, 134}, + {""}, +#line 405 "colour-names.gperf.in" + {"HotPink2", 238, 106, 167}, + {""}, +#line 429 "colour-names.gperf.in" + {"LavenderBlush3", 205, 193, 197}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 428 "colour-names.gperf.in" + {"LavenderBlush2", 238, 224, 229}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 404 "colour-names.gperf.in" + {"HotPink1", 255, 110, 180}, + {""}, {""}, +#line 540 "colour-names.gperf.in" + {"MediumSlateBlue", 123, 104, 238}, + {""}, {""}, {""}, +#line 168 "colour-names.gperf.in" + {"firebrick4", 139, 26, 26}, + {""}, +#line 167 "colour-names.gperf.in" + {"firebrick3", 205, 38, 38}, +#line 472 "colour-names.gperf.in" + {"LightGoldenrodYellow", 250, 250, 210}, + {""}, +#line 427 "colour-names.gperf.in" + {"LavenderBlush1", 255, 240, 245}, + {""}, +#line 166 "colour-names.gperf.in" + {"firebrick2", 238, 44, 44}, + {""}, {""}, +#line 121 "colour-names.gperf.in" + {"DarkOrchid", 153, 50, 204}, + {""}, +#line 480 "colour-names.gperf.in" + {"LightPink4", 139, 95, 101}, + {""}, +#line 479 "colour-names.gperf.in" + {"LightPink3", 205, 140, 149}, + {""}, {""}, {""}, +#line 165 "colour-names.gperf.in" + {"firebrick1", 255, 48, 48}, +#line 478 "colour-names.gperf.in" + {"LightPink2", 238, 162, 173}, + {""}, {""}, {""}, +#line 590 "colour-names.gperf.in" + {"pale turquoise", 175, 238, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 477 "colour-names.gperf.in" + {"LightPink1", 255, 174, 185}, + {""}, {""}, +#line 545 "colour-names.gperf.in" + {"MidnightBlue", 25, 25, 112}, + {""}, {""}, {""}, {""}, +#line 533 "colour-names.gperf.in" + {"MediumOrchid4", 122, 55, 139}, + {""}, {""}, {""}, +#line 532 "colour-names.gperf.in" + {"MediumOrchid3", 180, 82, 205}, + {""}, {""}, {""}, {""}, +#line 419 "colour-names.gperf.in" + {"khaki", 240, 230, 140}, + {""}, {""}, {""}, {""}, +#line 531 "colour-names.gperf.in" + {"MediumOrchid2", 209, 95, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 534 "colour-names.gperf.in" + {"MediumPurple", 147, 112, 219}, +#line 538 "colour-names.gperf.in" + {"MediumPurple4", 93, 71, 139}, + {""}, {""}, {""}, +#line 537 "colour-names.gperf.in" + {"MediumPurple3", 137, 104, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 530 "colour-names.gperf.in" + {"MediumOrchid1", 224, 102, 255}, +#line 536 "colour-names.gperf.in" + {"MediumPurple2", 159, 121, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 364 "colour-names.gperf.in" + {"grey7", 18, 18, 18}, +#line 339 "colour-names.gperf.in" + {"grey47", 120, 120, 120}, +#line 615 "colour-names.gperf.in" + {"PeachPuff4", 139, 119, 101}, +#line 328 "colour-names.gperf.in" + {"grey37", 94, 94, 94}, +#line 614 "colour-names.gperf.in" + {"PeachPuff3", 205, 175, 149}, + {""}, {""}, {""}, +#line 317 "colour-names.gperf.in" + {"grey27", 69, 69, 69}, +#line 613 "colour-names.gperf.in" + {"PeachPuff2", 238, 203, 173}, + {""}, {""}, +#line 535 "colour-names.gperf.in" + {"MediumPurple1", 171, 130, 255}, + {""}, {""}, {""}, +#line 547 "colour-names.gperf.in" + {"MintCream", 245, 255, 250}, + {""}, {""}, +#line 306 "colour-names.gperf.in" + {"grey17", 43, 43, 43}, +#line 612 "colour-names.gperf.in" + {"PeachPuff1", 255, 218, 185}, + {""}, {""}, {""}, {""}, {""}, +#line 529 "colour-names.gperf.in" + {"MediumOrchid", 186, 85, 211}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 169 "colour-names.gperf.in" + {"floral white", 255, 250, 240}, +#line 69 "colour-names.gperf.in" + {"CornflowerBlue", 100, 149, 237}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 255 "colour-names.gperf.in" + {"gray7", 18, 18, 18}, +#line 230 "colour-names.gperf.in" + {"gray47", 120, 120, 120}, + {""}, +#line 219 "colour-names.gperf.in" + {"gray37", 94, 94, 94}, + {""}, {""}, {""}, {""}, +#line 208 "colour-names.gperf.in" + {"gray27", 69, 69, 69}, + {""}, {""}, {""}, {""}, +#line 68 "colour-names.gperf.in" + {"cornflower blue", 100, 149, 237}, + {""}, {""}, {""}, {""}, {""}, +#line 197 "colour-names.gperf.in" + {"gray17", 43, 43, 43}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 748 "colour-names.gperf.in" + {"yellow", 255, 255, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 353 "colour-names.gperf.in" + {"grey6", 15, 15, 15}, +#line 338 "colour-names.gperf.in" + {"grey46", 117, 117, 117}, + {""}, +#line 327 "colour-names.gperf.in" + {"grey36", 92, 92, 92}, + {""}, {""}, {""}, {""}, +#line 316 "colour-names.gperf.in" + {"grey26", 66, 66, 66}, + {""}, {""}, {""}, +#line 28 "colour-names.gperf.in" + {"blanched almond", 255, 235, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 305 "colour-names.gperf.in" + {"grey16", 41, 41, 41}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 244 "colour-names.gperf.in" + {"gray6", 15, 15, 15}, +#line 229 "colour-names.gperf.in" + {"gray46", 117, 117, 117}, + {""}, +#line 218 "colour-names.gperf.in" + {"gray36", 92, 92, 92}, + {""}, +#line 523 "colour-names.gperf.in" + {"medium slate blue", 123, 104, 238}, + {""}, {""}, +#line 207 "colour-names.gperf.in" + {"gray26", 66, 66, 66}, + {""}, {""}, {""}, +#line 115 "colour-names.gperf.in" + {"DarkOliveGreen4", 110, 139, 61}, + {""}, {""}, {""}, +#line 114 "colour-names.gperf.in" + {"DarkOliveGreen3", 162, 205, 90}, + {""}, {""}, +#line 196 "colour-names.gperf.in" + {"gray16", 41, 41, 41}, + {""}, +#line 447 "colour-names.gperf.in" + {"light pink", 255, 182, 193}, + {""}, {""}, {""}, {""}, +#line 113 "colour-names.gperf.in" + {"DarkOliveGreen2", 188, 238, 104}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 396 "colour-names.gperf.in" + {"grey99", 252, 252, 252}, + {""}, +#line 111 "colour-names.gperf.in" + {"DarkOliveGreen", 85, 107, 47}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 144 "colour-names.gperf.in" + {"DeepPink", 255, 20, 147}, + {""}, {""}, +#line 611 "colour-names.gperf.in" + {"PeachPuff", 255, 218, 185}, +#line 112 "colour-names.gperf.in" + {"DarkOliveGreen1", 202, 255, 112}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 287 "colour-names.gperf.in" + {"gray99", 252, 252, 252}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 342 "colour-names.gperf.in" + {"grey5", 13, 13, 13}, +#line 337 "colour-names.gperf.in" + {"grey45", 115, 115, 115}, + {""}, +#line 326 "colour-names.gperf.in" + {"grey35", 89, 89, 89}, + {""}, {""}, {""}, {""}, +#line 315 "colour-names.gperf.in" + {"grey25", 64, 64, 64}, + {""}, {""}, +#line 70 "colour-names.gperf.in" + {"cornsilk", 255, 248, 220}, +#line 610 "colour-names.gperf.in" + {"peach puff", 255, 218, 185}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 304 "colour-names.gperf.in" + {"grey15", 38, 38, 38}, + {""}, {""}, +#line 141 "colour-names.gperf.in" + {"DarkViolet", 148, 0, 211}, +#line 289 "colour-names.gperf.in" + {"green yellow", 173, 255, 47}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 233 "colour-names.gperf.in" + {"gray5", 13, 13, 13}, +#line 228 "colour-names.gperf.in" + {"gray45", 115, 115, 115}, + {""}, +#line 217 "colour-names.gperf.in" + {"gray35", 89, 89, 89}, + {""}, {""}, {""}, {""}, +#line 206 "colour-names.gperf.in" + {"gray25", 64, 64, 64}, +#line 385 "colour-names.gperf.in" + {"grey89", 227, 227, 227}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 195 "colour-names.gperf.in" + {"gray15", 38, 38, 38}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 524 "colour-names.gperf.in" + {"medium spring green", 0, 250, 154}, + {""}, {""}, +#line 175 "colour-names.gperf.in" + {"GhostWhite", 248, 248, 255}, + {""}, {""}, +#line 426 "colour-names.gperf.in" + {"LavenderBlush", 255, 240, 245}, + {""}, {""}, {""}, {""}, +#line 403 "colour-names.gperf.in" + {"HotPink", 255, 105, 180}, + {""}, {""}, {""}, {""}, {""}, +#line 746 "colour-names.gperf.in" + {"white smoke", 245, 245, 245}, + {""}, {""}, {""}, {""}, +#line 521 "colour-names.gperf.in" + {"medium purple", 147, 112, 219}, + {""}, +#line 276 "colour-names.gperf.in" + {"gray89", 227, 227, 227}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 164 "colour-names.gperf.in" + {"firebrick", 178, 34, 34}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 476 "colour-names.gperf.in" + {"LightPink", 255, 182, 193}, + {""}, {""}, {""}, +#line 527 "colour-names.gperf.in" + {"MediumAquamarine", 102, 205, 170}, + {""}, {""}, {""}, +#line 544 "colour-names.gperf.in" + {"midnight blue", 25, 25, 112}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 395 "colour-names.gperf.in" + {"grey98", 250, 250, 250}, +#line 397 "colour-names.gperf.in" + {"honeydew", 240, 255, 240}, + {""}, {""}, +#line 36 "colour-names.gperf.in" + {"BlueViolet", 138, 43, 226}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 170 "colour-names.gperf.in" + {"FloralWhite", 255, 250, 240}, + {""}, {""}, {""}, +#line 374 "colour-names.gperf.in" + {"grey79", 201, 201, 201}, + {""}, {""}, {""}, {""}, +#line 88 "colour-names.gperf.in" + {"dark olive green", 85, 107, 47}, +#line 174 "colour-names.gperf.in" + {"ghost white", 248, 248, 255}, +#line 286 "colour-names.gperf.in" + {"gray98", 250, 250, 250}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 142 "colour-names.gperf.in" + {"deep pink", 255, 20, 147}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 265 "colour-names.gperf.in" + {"gray79", 201, 201, 201}, + {""}, {""}, {""}, {""}, +#line 438 "colour-names.gperf.in" + {"LemonChiffon4", 139, 137, 112}, + {""}, {""}, +#line 542 "colour-names.gperf.in" + {"MediumTurquoise", 72, 209, 204}, +#line 437 "colour-names.gperf.in" + {"LemonChiffon3", 205, 201, 165}, + {""}, {""}, +#line 363 "colour-names.gperf.in" + {"grey69", 176, 176, 176}, + {""}, {""}, {""}, +#line 455 "colour-names.gperf.in" + {"light yellow", 255, 255, 224}, + {""}, {""}, +#line 436 "colour-names.gperf.in" + {"LemonChiffon2", 238, 233, 191}, + {""}, {""}, {""}, +#line 384 "colour-names.gperf.in" + {"grey88", 224, 224, 224}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 434 "colour-names.gperf.in" + {"LemonChiffon", 255, 250, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 98 "colour-names.gperf.in" + {"dark violet", 148, 0, 211}, + {""}, +#line 435 "colour-names.gperf.in" + {"LemonChiffon1", 255, 250, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 254 "colour-names.gperf.in" + {"gray69", 176, 176, 176}, + {""}, +#line 747 "colour-names.gperf.in" + {"WhiteSmoke", 245, 245, 245}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 275 "colour-names.gperf.in" + {"gray88", 224, 224, 224}, + {""}, {""}, {""}, +#line 520 "colour-names.gperf.in" + {"medium orchid", 186, 85, 211}, + {""}, {""}, {""}, {""}, {""}, +#line 352 "colour-names.gperf.in" + {"grey59", 150, 150, 150}, + {""}, {""}, {""}, {""}, {""}, +#line 86 "colour-names.gperf.in" + {"dark khaki", 189, 183, 107}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 243 "colour-names.gperf.in" + {"gray59", 150, 150, 150}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 607 "colour-names.gperf.in" + {"PaleVioletRed4", 139, 71, 93}, + {""}, {""}, {""}, +#line 606 "colour-names.gperf.in" + {"PaleVioletRed3", 205, 104, 137}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 605 "colour-names.gperf.in" + {"PaleVioletRed2", 238, 121, 159}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 373 "colour-names.gperf.in" + {"grey78", 199, 199, 199}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 604 "colour-names.gperf.in" + {"PaleVioletRed1", 255, 130, 171}, + {""}, +#line 31 "colour-names.gperf.in" + {"blue violet", 138, 43, 226}, + {""}, +#line 433 "colour-names.gperf.in" + {"lemon chiffon", 255, 250, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 394 "colour-names.gperf.in" + {"grey97", 247, 247, 247}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 264 "colour-names.gperf.in" + {"gray78", 199, 199, 199}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 603 "colour-names.gperf.in" + {"PaleVioletRed", 219, 112, 147}, +#line 555 "colour-names.gperf.in" + {"navajo white", 255, 222, 173}, +#line 402 "colour-names.gperf.in" + {"hot pink", 255, 105, 180}, + {""}, {""}, +#line 362 "colour-names.gperf.in" + {"grey68", 173, 173, 173}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 285 "colour-names.gperf.in" + {"gray97", 247, 247, 247}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 253 "colour-names.gperf.in" + {"gray68", 173, 173, 173}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 351 "colour-names.gperf.in" + {"grey58", 148, 148, 148}, +#line 425 "colour-names.gperf.in" + {"lavender blush", 255, 240, 245}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 383 "colour-names.gperf.in" + {"grey87", 222, 222, 222}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 393 "colour-names.gperf.in" + {"grey96", 245, 245, 245}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 242 "colour-names.gperf.in" + {"gray58", 148, 148, 148}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 274 "colour-names.gperf.in" + {"gray87", 222, 222, 222}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 284 "colour-names.gperf.in" + {"gray96", 245, 245, 245}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 518 "colour-names.gperf.in" + {"medium aquamarine", 102, 205, 170}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 382 "colour-names.gperf.in" + {"grey86", 219, 219, 219}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 392 "colour-names.gperf.in" + {"grey95", 242, 242, 242}, +#line 372 "colour-names.gperf.in" + {"grey77", 196, 196, 196}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 525 "colour-names.gperf.in" + {"medium turquoise", 72, 209, 204}, + {""}, {""}, +#line 273 "colour-names.gperf.in" + {"gray86", 219, 219, 219}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 109 "colour-names.gperf.in" + {"DarkKhaki", 189, 183, 107}, + {""}, {""}, {""}, {""}, +#line 283 "colour-names.gperf.in" + {"gray95", 242, 242, 242}, +#line 263 "colour-names.gperf.in" + {"gray77", 196, 196, 196}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 361 "colour-names.gperf.in" + {"grey67", 171, 171, 171}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 608 "colour-names.gperf.in" + {"papaya whip", 255, 239, 213}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 252 "colour-names.gperf.in" + {"gray67", 171, 171, 171}, + {""}, {""}, +#line 381 "colour-names.gperf.in" + {"grey85", 217, 217, 217}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 371 "colour-names.gperf.in" + {"grey76", 194, 194, 194}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 350 "colour-names.gperf.in" + {"grey57", 145, 145, 145}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 272 "colour-names.gperf.in" + {"gray85", 217, 217, 217}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 262 "colour-names.gperf.in" + {"gray76", 194, 194, 194}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 241 "colour-names.gperf.in" + {"gray57", 145, 145, 145}, + {""}, {""}, +#line 360 "colour-names.gperf.in" + {"grey66", 168, 168, 168}, +#line 556 "colour-names.gperf.in" + {"NavajoWhite", 255, 222, 173}, +#line 560 "colour-names.gperf.in" + {"NavajoWhite4", 139, 121, 94}, + {""}, {""}, {""}, +#line 559 "colour-names.gperf.in" + {"NavajoWhite3", 205, 179, 139}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 558 "colour-names.gperf.in" + {"NavajoWhite2", 238, 207, 161}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 557 "colour-names.gperf.in" + {"NavajoWhite1", 255, 222, 173}, + {""}, {""}, {""}, +#line 251 "colour-names.gperf.in" + {"gray66", 168, 168, 168}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 349 "colour-names.gperf.in" + {"grey56", 143, 143, 143}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 370 "colour-names.gperf.in" + {"grey75", 191, 191, 191}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 240 "colour-names.gperf.in" + {"gray56", 143, 143, 143}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 261 "colour-names.gperf.in" + {"gray75", 191, 191, 191}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 591 "colour-names.gperf.in" + {"pale violet red", 219, 112, 147}, + {""}, +#line 359 "colour-names.gperf.in" + {"grey65", 166, 166, 166}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 250 "colour-names.gperf.in" + {"gray65", 166, 166, 166}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 348 "colour-names.gperf.in" + {"grey55", 140, 140, 140}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 239 "colour-names.gperf.in" + {"gray55", 140, 140, 140}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 609 "colour-names.gperf.in" + {"PapayaWhip", 255, 239, 213}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 543 "colour-names.gperf.in" + {"MediumVioletRed", 199, 21, 133}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 526 "colour-names.gperf.in" + {"medium violet red", 199, 21, 133} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + unsigned int key = hash (str, len); + + if (key <= MAX_HASH_VALUE) + { + const char *s = wordlist[key].name; + + if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/src/colour-names.gperf.in b/src/colour-names.gperf.in new file mode 100644 index 0000000000..fda4256dbf --- /dev/null +++ b/src/colour-names.gperf.in @@ -0,0 +1,754 @@ +struct rgb { const char *name; uint8_t red; uint8_t green; uint8_t blue; }; +%% +alice blue, 240, 248, 255 +AliceBlue, 240, 248, 255 +antique white, 250, 235, 215 +AntiqueWhite, 250, 235, 215 +AntiqueWhite1, 255, 239, 219 +AntiqueWhite2, 238, 223, 204 +AntiqueWhite3, 205, 192, 176 +AntiqueWhite4, 139, 131, 120 +aquamarine, 127, 255, 212 +aquamarine1, 127, 255, 212 +aquamarine2, 118, 238, 198 +aquamarine3, 102, 205, 170 +aquamarine4, 69, 139, 116 +azure, 240, 255, 255 +azure1, 240, 255, 255 +azure2, 224, 238, 238 +azure3, 193, 205, 205 +azure4, 131, 139, 139 +beige, 245, 245, 220 +bisque, 255, 228, 196 +bisque1, 255, 228, 196 +bisque2, 238, 213, 183 +bisque3, 205, 183, 158 +bisque4, 139, 125, 107 +black, 0, 0, 0 +blanched almond, 255, 235, 205 +BlanchedAlmond, 255, 235, 205 +blue, 0, 0, 255 +blue violet, 138, 43, 226 +blue1, 0, 0, 255 +blue2, 0, 0, 238 +blue3, 0, 0, 205 +blue4, 0, 0, 139 +BlueViolet, 138, 43, 226 +brown, 165, 42, 42 +brown1, 255, 64, 64 +brown2, 238, 59, 59 +brown3, 205, 51, 51 +brown4, 139, 35, 35 +burlywood, 222, 184, 135 +burlywood1, 255, 211, 155 +burlywood2, 238, 197, 145 +burlywood3, 205, 170, 125 +burlywood4, 139, 115, 85 +cadet blue, 95, 158, 160 +CadetBlue, 95, 158, 160 +CadetBlue1, 152, 245, 255 +CadetBlue2, 142, 229, 238 +CadetBlue3, 122, 197, 205 +CadetBlue4, 83, 134, 139 +chartreuse, 127, 255, 0 +chartreuse1, 127, 255, 0 +chartreuse2, 118, 238, 0 +chartreuse3, 102, 205, 0 +chartreuse4, 69, 139, 0 +chocolate, 210, 105, 30 +chocolate1, 255, 127, 36 +chocolate2, 238, 118, 33 +chocolate3, 205, 102, 29 +chocolate4, 139, 69, 19 +coral, 255, 127, 80 +coral1, 255, 114, 86 +coral2, 238, 106, 80 +coral3, 205, 91, 69 +coral4, 139, 62, 47 +cornflower blue, 100, 149, 237 +CornflowerBlue, 100, 149, 237 +cornsilk, 255, 248, 220 +cornsilk1, 255, 248, 220 +cornsilk2, 238, 232, 205 +cornsilk3, 205, 200, 177 +cornsilk4, 139, 136, 120 +cyan, 0, 255, 255 +cyan1, 0, 255, 255 +cyan2, 0, 238, 238 +cyan3, 0, 205, 205 +cyan4, 0, 139, 139 +dark blue, 0, 0, 139 +dark cyan, 0, 139, 139 +dark goldenrod, 184, 134, 11 +dark gray, 169, 169, 169 +dark green, 0, 100, 0 +dark grey, 169, 169, 169 +dark khaki, 189, 183, 107 +dark magenta, 139, 0, 139 +dark olive green, 85, 107, 47 +dark orange, 255, 140, 0 +dark orchid, 153, 50, 204 +dark red, 139, 0, 0 +dark salmon, 233, 150, 122 +dark sea green, 143, 188, 143 +dark slate blue, 72, 61, 139 +dark slate gray, 47, 79, 79 +dark slate grey, 47, 79, 79 +dark turquoise, 0, 206, 209 +dark violet, 148, 0, 211 +DarkBlue, 0, 0, 139 +DarkCyan, 0, 139, 139 +DarkGoldenrod, 184, 134, 11 +DarkGoldenrod1, 255, 185, 15 +DarkGoldenrod2, 238, 173, 14 +DarkGoldenrod3, 205, 149, 12 +DarkGoldenrod4, 139, 101, 8 +DarkGray, 169, 169, 169 +DarkGreen, 0, 100, 0 +DarkGrey, 169, 169, 169 +DarkKhaki, 189, 183, 107 +DarkMagenta, 139, 0, 139 +DarkOliveGreen, 85, 107, 47 +DarkOliveGreen1, 202, 255, 112 +DarkOliveGreen2, 188, 238, 104 +DarkOliveGreen3, 162, 205, 90 +DarkOliveGreen4, 110, 139, 61 +DarkOrange, 255, 140, 0 +DarkOrange1, 255, 127, 0 +DarkOrange2, 238, 118, 0 +DarkOrange3, 205, 102, 0 +DarkOrange4, 139, 69, 0 +DarkOrchid, 153, 50, 204 +DarkOrchid1, 191, 62, 255 +DarkOrchid2, 178, 58, 238 +DarkOrchid3, 154, 50, 205 +DarkOrchid4, 104, 34, 139 +DarkRed, 139, 0, 0 +DarkSalmon, 233, 150, 122 +DarkSeaGreen, 143, 188, 143 +DarkSeaGreen1, 193, 255, 193 +DarkSeaGreen2, 180, 238, 180 +DarkSeaGreen3, 155, 205, 155 +DarkSeaGreen4, 105, 139, 105 +DarkSlateBlue, 72, 61, 139 +DarkSlateGray, 47, 79, 79 +DarkSlateGray1, 151, 255, 255 +DarkSlateGray2, 141, 238, 238 +DarkSlateGray3, 121, 205, 205 +DarkSlateGray4, 82, 139, 139 +DarkSlateGrey, 47, 79, 79 +DarkTurquoise, 0, 206, 209 +DarkViolet, 148, 0, 211 +deep pink, 255, 20, 147 +deep sky blue, 0, 191, 255 +DeepPink, 255, 20, 147 +DeepPink1, 255, 20, 147 +DeepPink2, 238, 18, 137 +DeepPink3, 205, 16, 118 +DeepPink4, 139, 10, 80 +DeepSkyBlue, 0, 191, 255 +DeepSkyBlue1, 0, 191, 255 +DeepSkyBlue2, 0, 178, 238 +DeepSkyBlue3, 0, 154, 205 +DeepSkyBlue4, 0, 104, 139 +dim gray, 105, 105, 105 +dim grey, 105, 105, 105 +DimGray, 105, 105, 105 +DimGrey, 105, 105, 105 +dodger blue, 30, 144, 255 +DodgerBlue, 30, 144, 255 +DodgerBlue1, 30, 144, 255 +DodgerBlue2, 28, 134, 238 +DodgerBlue3, 24, 116, 205 +DodgerBlue4, 16, 78, 139 +firebrick, 178, 34, 34 +firebrick1, 255, 48, 48 +firebrick2, 238, 44, 44 +firebrick3, 205, 38, 38 +firebrick4, 139, 26, 26 +floral white, 255, 250, 240 +FloralWhite, 255, 250, 240 +forest green, 34, 139, 34 +ForestGreen, 34, 139, 34 +gainsboro, 220, 220, 220 +ghost white, 248, 248, 255 +GhostWhite, 248, 248, 255 +gold, 255, 215, 0 +gold1, 255, 215, 0 +gold2, 238, 201, 0 +gold3, 205, 173, 0 +gold4, 139, 117, 0 +goldenrod, 218, 165, 32 +goldenrod1, 255, 193, 37 +goldenrod2, 238, 180, 34 +goldenrod3, 205, 155, 29 +goldenrod4, 139, 105, 20 +gray, 190, 190, 190 +gray0, 0, 0, 0 +gray1, 3, 3, 3 +gray10, 26, 26, 26 +gray100, 255, 255, 255 +gray11, 28, 28, 28 +gray12, 31, 31, 31 +gray13, 33, 33, 33 +gray14, 36, 36, 36 +gray15, 38, 38, 38 +gray16, 41, 41, 41 +gray17, 43, 43, 43 +gray18, 46, 46, 46 +gray19, 48, 48, 48 +gray2, 5, 5, 5 +gray20, 51, 51, 51 +gray21, 54, 54, 54 +gray22, 56, 56, 56 +gray23, 59, 59, 59 +gray24, 61, 61, 61 +gray25, 64, 64, 64 +gray26, 66, 66, 66 +gray27, 69, 69, 69 +gray28, 71, 71, 71 +gray29, 74, 74, 74 +gray3, 8, 8, 8 +gray30, 77, 77, 77 +gray31, 79, 79, 79 +gray32, 82, 82, 82 +gray33, 84, 84, 84 +gray34, 87, 87, 87 +gray35, 89, 89, 89 +gray36, 92, 92, 92 +gray37, 94, 94, 94 +gray38, 97, 97, 97 +gray39, 99, 99, 99 +gray4, 10, 10, 10 +gray40, 102, 102, 102 +gray41, 105, 105, 105 +gray42, 107, 107, 107 +gray43, 110, 110, 110 +gray44, 112, 112, 112 +gray45, 115, 115, 115 +gray46, 117, 117, 117 +gray47, 120, 120, 120 +gray48, 122, 122, 122 +gray49, 125, 125, 125 +gray5, 13, 13, 13 +gray50, 127, 127, 127 +gray51, 130, 130, 130 +gray52, 133, 133, 133 +gray53, 135, 135, 135 +gray54, 138, 138, 138 +gray55, 140, 140, 140 +gray56, 143, 143, 143 +gray57, 145, 145, 145 +gray58, 148, 148, 148 +gray59, 150, 150, 150 +gray6, 15, 15, 15 +gray60, 153, 153, 153 +gray61, 156, 156, 156 +gray62, 158, 158, 158 +gray63, 161, 161, 161 +gray64, 163, 163, 163 +gray65, 166, 166, 166 +gray66, 168, 168, 168 +gray67, 171, 171, 171 +gray68, 173, 173, 173 +gray69, 176, 176, 176 +gray7, 18, 18, 18 +gray70, 179, 179, 179 +gray71, 181, 181, 181 +gray72, 184, 184, 184 +gray73, 186, 186, 186 +gray74, 189, 189, 189 +gray75, 191, 191, 191 +gray76, 194, 194, 194 +gray77, 196, 196, 196 +gray78, 199, 199, 199 +gray79, 201, 201, 201 +gray8, 20, 20, 20 +gray80, 204, 204, 204 +gray81, 207, 207, 207 +gray82, 209, 209, 209 +gray83, 212, 212, 212 +gray84, 214, 214, 214 +gray85, 217, 217, 217 +gray86, 219, 219, 219 +gray87, 222, 222, 222 +gray88, 224, 224, 224 +gray89, 227, 227, 227 +gray9, 23, 23, 23 +gray90, 229, 229, 229 +gray91, 232, 232, 232 +gray92, 235, 235, 235 +gray93, 237, 237, 237 +gray94, 240, 240, 240 +gray95, 242, 242, 242 +gray96, 245, 245, 245 +gray97, 247, 247, 247 +gray98, 250, 250, 250 +gray99, 252, 252, 252 +green, 0, 255, 0 +green yellow, 173, 255, 47 +green1, 0, 255, 0 +green2, 0, 238, 0 +green3, 0, 205, 0 +green4, 0, 139, 0 +GreenYellow, 173, 255, 47 +grey, 190, 190, 190 +grey0, 0, 0, 0 +grey1, 3, 3, 3 +grey10, 26, 26, 26 +grey100, 255, 255, 255 +grey11, 28, 28, 28 +grey12, 31, 31, 31 +grey13, 33, 33, 33 +grey14, 36, 36, 36 +grey15, 38, 38, 38 +grey16, 41, 41, 41 +grey17, 43, 43, 43 +grey18, 46, 46, 46 +grey19, 48, 48, 48 +grey2, 5, 5, 5 +grey20, 51, 51, 51 +grey21, 54, 54, 54 +grey22, 56, 56, 56 +grey23, 59, 59, 59 +grey24, 61, 61, 61 +grey25, 64, 64, 64 +grey26, 66, 66, 66 +grey27, 69, 69, 69 +grey28, 71, 71, 71 +grey29, 74, 74, 74 +grey3, 8, 8, 8 +grey30, 77, 77, 77 +grey31, 79, 79, 79 +grey32, 82, 82, 82 +grey33, 84, 84, 84 +grey34, 87, 87, 87 +grey35, 89, 89, 89 +grey36, 92, 92, 92 +grey37, 94, 94, 94 +grey38, 97, 97, 97 +grey39, 99, 99, 99 +grey4, 10, 10, 10 +grey40, 102, 102, 102 +grey41, 105, 105, 105 +grey42, 107, 107, 107 +grey43, 110, 110, 110 +grey44, 112, 112, 112 +grey45, 115, 115, 115 +grey46, 117, 117, 117 +grey47, 120, 120, 120 +grey48, 122, 122, 122 +grey49, 125, 125, 125 +grey5, 13, 13, 13 +grey50, 127, 127, 127 +grey51, 130, 130, 130 +grey52, 133, 133, 133 +grey53, 135, 135, 135 +grey54, 138, 138, 138 +grey55, 140, 140, 140 +grey56, 143, 143, 143 +grey57, 145, 145, 145 +grey58, 148, 148, 148 +grey59, 150, 150, 150 +grey6, 15, 15, 15 +grey60, 153, 153, 153 +grey61, 156, 156, 156 +grey62, 158, 158, 158 +grey63, 161, 161, 161 +grey64, 163, 163, 163 +grey65, 166, 166, 166 +grey66, 168, 168, 168 +grey67, 171, 171, 171 +grey68, 173, 173, 173 +grey69, 176, 176, 176 +grey7, 18, 18, 18 +grey70, 179, 179, 179 +grey71, 181, 181, 181 +grey72, 184, 184, 184 +grey73, 186, 186, 186 +grey74, 189, 189, 189 +grey75, 191, 191, 191 +grey76, 194, 194, 194 +grey77, 196, 196, 196 +grey78, 199, 199, 199 +grey79, 201, 201, 201 +grey8, 20, 20, 20 +grey80, 204, 204, 204 +grey81, 207, 207, 207 +grey82, 209, 209, 209 +grey83, 212, 212, 212 +grey84, 214, 214, 214 +grey85, 217, 217, 217 +grey86, 219, 219, 219 +grey87, 222, 222, 222 +grey88, 224, 224, 224 +grey89, 227, 227, 227 +grey9, 23, 23, 23 +grey90, 229, 229, 229 +grey91, 232, 232, 232 +grey92, 235, 235, 235 +grey93, 237, 237, 237 +grey94, 240, 240, 240 +grey95, 242, 242, 242 +grey96, 245, 245, 245 +grey97, 247, 247, 247 +grey98, 250, 250, 250 +grey99, 252, 252, 252 +honeydew, 240, 255, 240 +honeydew1, 240, 255, 240 +honeydew2, 224, 238, 224 +honeydew3, 193, 205, 193 +honeydew4, 131, 139, 131 +hot pink, 255, 105, 180 +HotPink, 255, 105, 180 +HotPink1, 255, 110, 180 +HotPink2, 238, 106, 167 +HotPink3, 205, 96, 144 +HotPink4, 139, 58, 98 +indian red, 205, 92, 92 +IndianRed, 205, 92, 92 +IndianRed1, 255, 106, 106 +IndianRed2, 238, 99, 99 +IndianRed3, 205, 85, 85 +IndianRed4, 139, 58, 58 +ivory, 255, 255, 240 +ivory1, 255, 255, 240 +ivory2, 238, 238, 224 +ivory3, 205, 205, 193 +ivory4, 139, 139, 131 +khaki, 240, 230, 140 +khaki1, 255, 246, 143 +khaki2, 238, 230, 133 +khaki3, 205, 198, 115 +khaki4, 139, 134, 78 +lavender, 230, 230, 250 +lavender blush, 255, 240, 245 +LavenderBlush, 255, 240, 245 +LavenderBlush1, 255, 240, 245 +LavenderBlush2, 238, 224, 229 +LavenderBlush3, 205, 193, 197 +LavenderBlush4, 139, 131, 134 +lawn green, 124, 252, 0 +LawnGreen, 124, 252, 0 +lemon chiffon, 255, 250, 205 +LemonChiffon, 255, 250, 205 +LemonChiffon1, 255, 250, 205 +LemonChiffon2, 238, 233, 191 +LemonChiffon3, 205, 201, 165 +LemonChiffon4, 139, 137, 112 +light blue, 173, 216, 230 +light coral, 240, 128, 128 +light cyan, 224, 255, 255 +light goldenrod, 238, 221, 130 +light goldenrod yellow, 250, 250, 210 +light gray, 211, 211, 211 +light green, 144, 238, 144 +light grey, 211, 211, 211 +light pink, 255, 182, 193 +light salmon, 255, 160, 122 +light sea green, 32, 178, 170 +light sky blue, 135, 206, 250 +light slate blue, 132, 112, 255 +light slate gray, 119, 136, 153 +light slate grey, 119, 136, 153 +light steel blue, 176, 196, 222 +light yellow, 255, 255, 224 +LightBlue, 173, 216, 230 +LightBlue1, 191, 239, 255 +LightBlue2, 178, 223, 238 +LightBlue3, 154, 192, 205 +LightBlue4, 104, 131, 139 +LightCoral, 240, 128, 128 +LightCyan, 224, 255, 255 +LightCyan1, 224, 255, 255 +LightCyan2, 209, 238, 238 +LightCyan3, 180, 205, 205 +LightCyan4, 122, 139, 139 +LightGoldenrod, 238, 221, 130 +LightGoldenrod1, 255, 236, 139 +LightGoldenrod2, 238, 220, 130 +LightGoldenrod3, 205, 190, 112 +LightGoldenrod4, 139, 129, 76 +LightGoldenrodYellow, 250, 250, 210 +LightGray, 211, 211, 211 +LightGreen, 144, 238, 144 +LightGrey, 211, 211, 211 +LightPink, 255, 182, 193 +LightPink1, 255, 174, 185 +LightPink2, 238, 162, 173 +LightPink3, 205, 140, 149 +LightPink4, 139, 95, 101 +LightSalmon, 255, 160, 122 +LightSalmon1, 255, 160, 122 +LightSalmon2, 238, 149, 114 +LightSalmon3, 205, 129, 98 +LightSalmon4, 139, 87, 66 +LightSeaGreen, 32, 178, 170 +LightSkyBlue, 135, 206, 250 +LightSkyBlue1, 176, 226, 255 +LightSkyBlue2, 164, 211, 238 +LightSkyBlue3, 141, 182, 205 +LightSkyBlue4, 96, 123, 139 +LightSlateBlue, 132, 112, 255 +LightSlateGray, 119, 136, 153 +LightSlateGrey, 119, 136, 153 +LightSteelBlue, 176, 196, 222 +LightSteelBlue1, 202, 225, 255 +LightSteelBlue2, 188, 210, 238 +LightSteelBlue3, 162, 181, 205 +LightSteelBlue4, 110, 123, 139 +LightYellow, 255, 255, 224 +LightYellow1, 255, 255, 224 +LightYellow2, 238, 238, 209 +LightYellow3, 205, 205, 180 +LightYellow4, 139, 139, 122 +lime green, 50, 205, 50 +LimeGreen, 50, 205, 50 +linen, 250, 240, 230 +magenta, 255, 0, 255 +magenta1, 255, 0, 255 +magenta2, 238, 0, 238 +magenta3, 205, 0, 205 +magenta4, 139, 0, 139 +maroon, 176, 48, 96 +maroon1, 255, 52, 179 +maroon2, 238, 48, 167 +maroon3, 205, 41, 144 +maroon4, 139, 28, 98 +medium aquamarine, 102, 205, 170 +medium blue, 0, 0, 205 +medium orchid, 186, 85, 211 +medium purple, 147, 112, 219 +medium sea green, 60, 179, 113 +medium slate blue, 123, 104, 238 +medium spring green, 0, 250, 154 +medium turquoise, 72, 209, 204 +medium violet red, 199, 21, 133 +MediumAquamarine, 102, 205, 170 +MediumBlue, 0, 0, 205 +MediumOrchid, 186, 85, 211 +MediumOrchid1, 224, 102, 255 +MediumOrchid2, 209, 95, 238 +MediumOrchid3, 180, 82, 205 +MediumOrchid4, 122, 55, 139 +MediumPurple, 147, 112, 219 +MediumPurple1, 171, 130, 255 +MediumPurple2, 159, 121, 238 +MediumPurple3, 137, 104, 205 +MediumPurple4, 93, 71, 139 +MediumSeaGreen, 60, 179, 113 +MediumSlateBlue, 123, 104, 238 +MediumSpringGreen, 0, 250, 154 +MediumTurquoise, 72, 209, 204 +MediumVioletRed, 199, 21, 133 +midnight blue, 25, 25, 112 +MidnightBlue, 25, 25, 112 +mint cream, 245, 255, 250 +MintCream, 245, 255, 250 +misty rose, 255, 228, 225 +MistyRose, 255, 228, 225 +MistyRose1, 255, 228, 225 +MistyRose2, 238, 213, 210 +MistyRose3, 205, 183, 181 +MistyRose4, 139, 125, 123 +moccasin, 255, 228, 181 +navajo white, 255, 222, 173 +NavajoWhite, 255, 222, 173 +NavajoWhite1, 255, 222, 173 +NavajoWhite2, 238, 207, 161 +NavajoWhite3, 205, 179, 139 +NavajoWhite4, 139, 121, 94 +navy, 0, 0, 128 +navy blue, 0, 0, 128 +NavyBlue, 0, 0, 128 +old lace, 253, 245, 230 +OldLace, 253, 245, 230 +olive drab, 107, 142, 35 +OliveDrab, 107, 142, 35 +OliveDrab1, 192, 255, 62 +OliveDrab2, 179, 238, 58 +OliveDrab3, 154, 205, 50 +OliveDrab4, 105, 139, 34 +orange, 255, 165, 0 +orange red, 255, 69, 0 +orange1, 255, 165, 0 +orange2, 238, 154, 0 +orange3, 205, 133, 0 +orange4, 139, 90, 0 +OrangeRed, 255, 69, 0 +OrangeRed1, 255, 69, 0 +OrangeRed2, 238, 64, 0 +OrangeRed3, 205, 55, 0 +OrangeRed4, 139, 37, 0 +orchid, 218, 112, 214 +orchid1, 255, 131, 250 +orchid2, 238, 122, 233 +orchid3, 205, 105, 201 +orchid4, 139, 71, 137 +pale goldenrod, 238, 232, 170 +pale green, 152, 251, 152 +pale turquoise, 175, 238, 238 +pale violet red, 219, 112, 147 +PaleGoldenrod, 238, 232, 170 +PaleGreen, 152, 251, 152 +PaleGreen1, 154, 255, 154 +PaleGreen2, 144, 238, 144 +PaleGreen3, 124, 205, 124 +PaleGreen4, 84, 139, 84 +PaleTurquoise, 175, 238, 238 +PaleTurquoise1, 187, 255, 255 +PaleTurquoise2, 174, 238, 238 +PaleTurquoise3, 150, 205, 205 +PaleTurquoise4, 102, 139, 139 +PaleVioletRed, 219, 112, 147 +PaleVioletRed1, 255, 130, 171 +PaleVioletRed2, 238, 121, 159 +PaleVioletRed3, 205, 104, 137 +PaleVioletRed4, 139, 71, 93 +papaya whip, 255, 239, 213 +PapayaWhip, 255, 239, 213 +peach puff, 255, 218, 185 +PeachPuff, 255, 218, 185 +PeachPuff1, 255, 218, 185 +PeachPuff2, 238, 203, 173 +PeachPuff3, 205, 175, 149 +PeachPuff4, 139, 119, 101 +peru, 205, 133, 63 +pink, 255, 192, 203 +pink1, 255, 181, 197 +pink2, 238, 169, 184 +pink3, 205, 145, 158 +pink4, 139, 99, 108 +plum, 221, 160, 221 +plum1, 255, 187, 255 +plum2, 238, 174, 238 +plum3, 205, 150, 205 +plum4, 139, 102, 139 +powder blue, 176, 224, 230 +PowderBlue, 176, 224, 230 +purple, 160, 32, 240 +purple1, 155, 48, 255 +purple2, 145, 44, 238 +purple3, 125, 38, 205 +purple4, 85, 26, 139 +red, 255, 0, 0 +red1, 255, 0, 0 +red2, 238, 0, 0 +red3, 205, 0, 0 +red4, 139, 0, 0 +rosy brown, 188, 143, 143 +RosyBrown, 188, 143, 143 +RosyBrown1, 255, 193, 193 +RosyBrown2, 238, 180, 180 +RosyBrown3, 205, 155, 155 +RosyBrown4, 139, 105, 105 +royal blue, 65, 105, 225 +RoyalBlue, 65, 105, 225 +RoyalBlue1, 72, 118, 255 +RoyalBlue2, 67, 110, 238 +RoyalBlue3, 58, 95, 205 +RoyalBlue4, 39, 64, 139 +saddle brown, 139, 69, 19 +SaddleBrown, 139, 69, 19 +salmon, 250, 128, 114 +salmon1, 255, 140, 105 +salmon2, 238, 130, 98 +salmon3, 205, 112, 84 +salmon4, 139, 76, 57 +sandy brown, 244, 164, 96 +SandyBrown, 244, 164, 96 +sea green, 46, 139, 87 +SeaGreen, 46, 139, 87 +SeaGreen1, 84, 255, 159 +SeaGreen2, 78, 238, 148 +SeaGreen3, 67, 205, 128 +SeaGreen4, 46, 139, 87 +seashell, 255, 245, 238 +seashell1, 255, 245, 238 +seashell2, 238, 229, 222 +seashell3, 205, 197, 191 +seashell4, 139, 134, 130 +sienna, 160, 82, 45 +sienna1, 255, 130, 71 +sienna2, 238, 121, 66 +sienna3, 205, 104, 57 +sienna4, 139, 71, 38 +sky blue, 135, 206, 235 +SkyBlue, 135, 206, 235 +SkyBlue1, 135, 206, 255 +SkyBlue2, 126, 192, 238 +SkyBlue3, 108, 166, 205 +SkyBlue4, 74, 112, 139 +slate blue, 106, 90, 205 +slate gray, 112, 128, 144 +slate grey, 112, 128, 144 +SlateBlue, 106, 90, 205 +SlateBlue1, 131, 111, 255 +SlateBlue2, 122, 103, 238 +SlateBlue3, 105, 89, 205 +SlateBlue4, 71, 60, 139 +SlateGray, 112, 128, 144 +SlateGray1, 198, 226, 255 +SlateGray2, 185, 211, 238 +SlateGray3, 159, 182, 205 +SlateGray4, 108, 123, 139 +SlateGrey, 112, 128, 144 +snow, 255, 250, 250 +snow1, 255, 250, 250 +snow2, 238, 233, 233 +snow3, 205, 201, 201 +snow4, 139, 137, 137 +spring green, 0, 255, 127 +SpringGreen, 0, 255, 127 +SpringGreen1, 0, 255, 127 +SpringGreen2, 0, 238, 118 +SpringGreen3, 0, 205, 102 +SpringGreen4, 0, 139, 69 +steel blue, 70, 130, 180 +SteelBlue, 70, 130, 180 +SteelBlue1, 99, 184, 255 +SteelBlue2, 92, 172, 238 +SteelBlue3, 79, 148, 205 +SteelBlue4, 54, 100, 139 +tan, 210, 180, 140 +tan1, 255, 165, 79 +tan2, 238, 154, 73 +tan3, 205, 133, 63 +tan4, 139, 90, 43 +thistle, 216, 191, 216 +thistle1, 255, 225, 255 +thistle2, 238, 210, 238 +thistle3, 205, 181, 205 +thistle4, 139, 123, 139 +tomato, 255, 99, 71 +tomato1, 255, 99, 71 +tomato2, 238, 92, 66 +tomato3, 205, 79, 57 +tomato4, 139, 54, 38 +turquoise, 64, 224, 208 +turquoise1, 0, 245, 255 +turquoise2, 0, 229, 238 +turquoise3, 0, 197, 205 +turquoise4, 0, 134, 139 +violet, 238, 130, 238 +violet red, 208, 32, 144 +VioletRed, 208, 32, 144 +VioletRed1, 255, 62, 150 +VioletRed2, 238, 58, 140 +VioletRed3, 205, 50, 120 +VioletRed4, 139, 34, 82 +wheat, 245, 222, 179 +wheat1, 255, 231, 186 +wheat2, 238, 216, 174 +wheat3, 205, 186, 150 +wheat4, 139, 126, 102 +white, 255, 255, 255 +white smoke, 245, 245, 245 +WhiteSmoke, 245, 245, 245 +yellow, 255, 255, 0 +yellow green, 154, 205, 50 +yellow1, 255, 255, 0 +yellow2, 238, 238, 0 +yellow3, 205, 205, 0 +yellow4, 139, 139, 0 +YellowGreen, 154, 205, 50 diff --git a/src/colours.cc b/src/colours.cc index f40ae3ace3..81b7f16b6b 100644 --- a/src/colours.cc +++ b/src/colours.cc @@ -26,25 +26,12 @@ * along with this program. If not, see . * */ + +#include "colours.h" + #include "conky.h" #include "gui.h" #include "logging.h" -#include "x11-color.h" - -#ifdef BUILD_X11 -std::unordered_map Colour::x11_pixels; -#endif /* BUILD_X11 */ - -static int hex_nibble_value(char c) { - if (c >= '0' && c <= '9') { - return c - '0'; - } else if (c >= 'a' && c <= 'f') { - return c - 'a' + 10; - } else if (c >= 'A' && c <= 'F') { - return c - 'A' + 10; - } - return -1; -} Colour Colour::from_argb32(uint32_t argb) { Colour out; @@ -55,29 +42,48 @@ Colour Colour::from_argb32(uint32_t argb) { return out; } -Colour error_colour{0xff, 0x00, 0x00, 0xff}; +#include "colour-names.cc" -Colour parse_color(const char *name) { - unsigned short r, g, b; - size_t len = strlen(name); - // Parse X11 color names. - if (OsLookupColor(-1, name, len, &r, &g, &b)) { - Colour out = {(uint8_t)r, (uint8_t)g, (uint8_t)b, 0xff}; - return out; +std::optional parse_color_name(const std::string &name) { + const rgb *value = color_name_hash::in_word_set(name.c_str(), name.length()); + + if (value == nullptr) { + return Colour{value->red, value->green, value->blue}; + } else { + return std::nullopt; } +} - // Remove a leading '#' if present. +std::optional parse_hex_color(const std::string &color) { + const char *name = color.c_str(); + size_t len = color.length(); + // Skip a leading '#' if present. if (name[0] == '#') { name++; len--; } - unsigned char argb[4] = {0xff, 0, 0, 0}; + static auto hex_nibble_value = [](char c) { + if (c >= '0' && c <= '9') { + return c - '0'; + } else if (c >= 'a' && c <= 'f') { + return c - 'a' + 10; + } else if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; + } + return -1; + }; + const auto none = [&]() { + NORM_ERR("can't parse hex color '%s' (%d)", name, len); + return std::nullopt; + }; + + uint8_t argb[4] = {0xff, 0, 0, 0}; if (len == 3 || len == 4) { bool skip_alpha = (len == 3); for (size_t i = 0; i < len; i++) { int nib = hex_nibble_value(name[i]); - if (nib < 0) { goto err; } + if (nib < 0) { return none(); } // Duplicate the nibble, so "#abc" -> 0xaa, 0xbb, 0xcc int val = (nib << 4) + nib; @@ -88,27 +94,37 @@ Colour parse_color(const char *name) { for (size_t i = 0; i + 1 < len; i += 2) { int nib1 = hex_nibble_value(name[i]); int nib2 = hex_nibble_value(name[i + 1]); - if (nib1 < 0 || nib2 < 0) { goto err; } + if (nib1 < 0 || nib2 < 0) { return none(); } int val = (nib1 << 4) + nib2; argb[skip_alpha + i / 2] = val; } } else { - goto err; + return none(); } - Colour out; - out.alpha = argb[0]; - out.red = argb[1]; - out.green = argb[2]; - out.blue = argb[3]; - return out; + return Colour(argb[1], argb[2], argb[3], argb[0]); +} + +Colour parse_color(const std::string &color) { + std::optional result; + +#define TRY_PARSER(name) \ + std::optional value_##name = name(color); \ + if (value_##name.has_value()) { return value_##name.value(); } + + TRY_PARSER(parse_color_name) + TRY_PARSER(parse_hex_color) + +#undef TRY_PARSER -err: - NORM_ERR("can't parse X color '%s' (%d)", name, len); - return error_colour; + return ERROR_COLOUR; } -Colour parse_color(const std::string &colour) { - return parse_color(colour.c_str()); +Colour::Colour(const std::string &name) { + const auto result = parse_color(name); + this->red = result.red; + this->green = result.green; + this->blue = result.blue; + this->alpha = result.alpha; } diff --git a/src/colours.h b/src/colours.h index 7b2d2cfe2a..a4d8048da8 100644 --- a/src/colours.h +++ b/src/colours.h @@ -32,25 +32,42 @@ #include #include #include +#include #include #include #ifdef BUILD_X11 -#include "x11.h" +#include #endif /* BUILD_X11 */ struct Colour { uint8_t red; uint8_t green; uint8_t blue; - uint8_t alpha; + uint8_t alpha = 0xff; public: + Colour() = default; + Colour(uint8_t r, uint8_t g, uint8_t b, uint8_t a = UINT8_MAX) + : red(r), green(g), blue(b) {} + Colour(const std::string &name); + Colour(const Colour &) = default; + Colour(Colour &&) = default; + + void operator=(const Colour &c) { + red = c.red; + green = c.green; + blue = c.blue; + alpha = c.alpha; + } + // Compare two instances. bool operator==(const Colour &c) const { return c.red == red && c.green == green && c.blue == blue && c.alpha == alpha; } + uint8_t *data() { return reinterpret_cast(this); } + // Express the color as a 32-bit ARGB integer (alpha in MSB). uint32_t to_argb32(void) const { uint32_t out; @@ -61,58 +78,18 @@ struct Colour { // Construct from a 32-bit ARGB integer (alpha in MSB). static Colour from_argb32(uint32_t argb); -#ifdef BUILD_X11 class Hash { public: size_t operator()(const Colour &c) const { return c.to_argb32(); } }; - static std::unordered_map x11_pixels; +#ifdef BUILD_X11 unsigned long to_x11_color(Display *display, int screen, - bool premultiply = false) { - if (display == nullptr) { - /* cannot work if display is not open */ - return 0; - } - - unsigned long pixel; - - /* Either get a cached X11 pixel or allocate one */ - if (auto pixel_iter = x11_pixels.find(*this); - pixel_iter != x11_pixels.end()) { - pixel = pixel_iter->second; - } else { - XColor xcolor{}; - xcolor.red = red * 257; - xcolor.green = green * 257; - xcolor.blue = blue * 257; - if (XAllocColor(display, DefaultColormap(display, screen), &xcolor) == - 0) { - // NORM_ERR("can't allocate X color"); - return 0; - } - - /* Save pixel value in the cache to avoid reallocating it */ - x11_pixels[*this] = xcolor.pixel; - pixel = static_cast(xcolor.pixel); - } - - pixel &= 0xffffff; -#ifdef BUILD_ARGB - if (have_argb_visual) { - if (premultiply) - pixel = (red * alpha / 255) << 16 | (green * alpha / 255) << 8 | - (blue * alpha / 255); - pixel |= ((unsigned long)alpha << 24); - } -#endif /* BUILD_ARGB */ - return pixel; - } + bool transparency = false, + bool premultiply = false); #endif /* BUILD_X11 */ }; -extern Colour error_colour; +const Colour ERROR_COLOUR = Colour{UINT8_MAX, 0, 0, UINT8_MAX}; -Colour parse_color(const std::string &colour); -// XXX: when everyone uses C++ strings, remove this C version -Colour parse_color(const char *); +Colour parse_color(const std::string &color); diff --git a/src/conky.cc b/src/conky.cc index b2dbc4f660..8decbde429 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -766,7 +766,7 @@ void remove_first_char(char *s) { memmove(s, s + 1, strlen(s)); } static int get_string_width_special(char *s, int special_index) { char *p, *final; - special_t *current = specials; + special_node *current = specials; int width = 0; long i; @@ -789,22 +789,23 @@ static int get_string_width_special(char *s, int special_index) { /*for (i = 0; i < static_cast(strlen(p)); i++) { *(p + i) = *(p + i + 1); }*/ - if (current->type == GRAPH || current->type == GAUGE || - current->type == BAR) { + if (current->type == text_node_t::GRAPH || + current->type == text_node_t::GAUGE || + current->type == text_node_t::BAR) { width += current->width; } - if (current->type == FONT) { + if (current->type == text_node_t::FONT) { // put all following text until the next fontchange/stringend in // influenced_by_font but do not include specials char *influenced_by_font = strdup(p); - special_t *current_after_font = current; + special_node *current_after_font = current; // influenced_by_font gets special chars removed, so after this loop i // counts the number of letters (not special chars) influenced by font for (i = 0; influenced_by_font[i] != 0; i++) { if (influenced_by_font[i] == SPECIAL_CHAR) { // remove specials and stop at fontchange current_after_font = current_after_font->next; - if (current_after_font->type == FONT) { + if (current_after_font->type == text_node_t::FONT) { influenced_by_font[i] = 0; break; } @@ -867,50 +868,34 @@ void update_text_area() { alignment align = text_alignment.get(*state); /* get text position on workarea */ - switch (align) { - case TOP_LEFT: - case TOP_RIGHT: - case TOP_MIDDLE: + switch (vertical_alignment(align)) { + case axis_align::START: y = workarea[1] + dpi_scale(gap_y.get(*state)); break; - - case BOTTOM_LEFT: - case BOTTOM_RIGHT: - case BOTTOM_MIDDLE: + case axis_align::END: default: y = workarea[3] - text_height - dpi_scale(gap_y.get(*state)); break; - - case MIDDLE_LEFT: - case MIDDLE_RIGHT: - case MIDDLE_MIDDLE: + case axis_align::MIDDLE: y = workarea[1] + (workarea[3] - workarea[1]) / 2 - text_height / 2 - dpi_scale(gap_y.get(*state)); break; } - switch (align) { - case TOP_LEFT: - case BOTTOM_LEFT: - case MIDDLE_LEFT: + switch (horizontal_alignment(align)) { + case axis_align::START: default: x = workarea[0] + dpi_scale(gap_x.get(*state)); break; - - case TOP_RIGHT: - case BOTTOM_RIGHT: - case MIDDLE_RIGHT: + case axis_align::END: x = workarea[2] - text_width - dpi_scale(gap_x.get(*state)); break; - - case TOP_MIDDLE: - case BOTTOM_MIDDLE: - case MIDDLE_MIDDLE: + case axis_align::MIDDLE: x = workarea[0] + (workarea[2] - workarea[0]) / 2 - text_width / 2 - dpi_scale(gap_x.get(*state)); break; } #ifdef OWN_WINDOW - if (align == NONE) { // Let the WM manage the window + if (align == alignment::NONE) { // Let the WM manage the window x = window.x; y = window.y; @@ -941,7 +926,7 @@ static int cur_x, cur_y; /* current x and y for drawing */ #endif // draw_mode also without BUILD_GUI because we only need to print to stdout with // FG -static int draw_mode; /* FG, BG or OUTLINE */ +static draw_mode_t draw_mode; /* FG, BG or OUTLINE */ #ifdef BUILD_GUI /*static*/ Colour current_color; @@ -954,7 +939,7 @@ int get_saved_coordinates_y(int i) { return saved_coordinates_y[i]; } static int text_size_updater(char *s, int special_index) { int w = 0; char *p; - special_t *current = specials; + special_node *current = specials; for (int i = 0; i < special_index; i++) { current = current->next; } @@ -969,26 +954,27 @@ static int text_size_updater(char *s, int special_index) { w += get_string_width(s); *p = SPECIAL_CHAR; - if (current->type == BAR || current->type == GAUGE || - current->type == GRAPH) { + if (current->type == text_node_t::BAR || + current->type == text_node_t::GAUGE || + current->type == text_node_t::GRAPH) { w += current->width; if (current->height > last_font_height) { last_font_height = current->height; last_font_height += font_height(); } - } else if (current->type == OFFSET) { + } else if (current->type == text_node_t::OFFSET) { if (current->arg > 0) { w += current->arg; } - } else if (current->type == VOFFSET) { + } else if (current->type == text_node_t::VOFFSET) { last_font_height += current->arg; - } else if (current->type == GOTO) { + } else if (current->type == text_node_t::GOTO) { if (current->arg > cur_x) { w = static_cast(current->arg); } - } else if (current->type == TAB) { + } else if (current->type == text_node_t::TAB) { int start = current->arg; int step = current->width; if ((step == 0) || step < 0) { step = 10; } w += step - (cur_x - text_start_x - start) % step; - } else if (current->type == FONT) { + } else if (current->type == text_node_t::FONT) { selected_font = current->font_added; if (font_height() > last_font_height) { last_font_height = font_height(); @@ -1033,7 +1019,7 @@ static void draw_string(const char *s) { #ifdef BUILD_GUI width_of_s = get_string_width(s); #endif /* BUILD_GUI */ - if (draw_mode == FG) { + if (draw_mode == draw_mode_t::FG) { for (auto output : display_outputs()) if (!output->graphical()) output->draw_string(s, 0); } @@ -1163,11 +1149,11 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { s = p + 1; } /* draw special */ - special_t *current = specials; + special_node *current = specials; for (int i = 0; i < special_index; i++) { current = current->next; } switch (current->type) { #ifdef BUILD_GUI - case HORIZONTAL_LINE: + case text_node_t::HORIZONTAL_LINE: if (display_output() && display_output()->graphical()) { int h = current->height; int mid = font_ascent() / 2; @@ -1183,7 +1169,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { } break; - case STIPPLED_HR: + case text_node_t::STIPPLED_HR: if (display_output() && display_output()->graphical()) { int h = current->height; char tmp_s = current->arg; @@ -1201,7 +1187,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { } break; - case BAR: + case text_node_t::BAR: if (display_output() && display_output()->graphical()) { int h, by; double bar_usage, scale; @@ -1229,7 +1215,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { } break; - case GAUGE: /* new GAUGE */ + case text_node_t::GAUGE: /* new GAUGE */ if (display_output() && display_output()->graphical()) { int h, by = 0; Colour last_colour = current_color; @@ -1279,7 +1265,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { } break; - case GRAPH: + case text_node_t::GRAPH: if (display_output() && display_output()->graphical()) { int h, by, i = 0, j = 0; int colour_idx = 0; @@ -1415,7 +1401,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { } break; - case FONT: + case text_node_t::FONT: if (display_output() && display_output()->graphical()) { int old = font_ascent(); @@ -1431,41 +1417,41 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { } break; #endif /* BUILD_GUI */ - case FG: - if (draw_mode == FG) { + case text_node_t::FG: + if (draw_mode == draw_mode_t::FG) { set_foreground_color(Colour::from_argb32(current->arg)); } break; #ifdef BUILD_GUI - case BG: - if (draw_mode == BG) { + case text_node_t::BG: + if (draw_mode == draw_mode_t::BG) { set_foreground_color(Colour::from_argb32(current->arg)); } break; - case OUTLINE: - if (draw_mode == OUTLINE) { + case text_node_t::OUTLINE: + if (draw_mode == draw_mode_t::OUTLINE) { set_foreground_color(Colour::from_argb32(current->arg)); } break; - case OFFSET: + case text_node_t::OFFSET: w += current->arg; break; - case VOFFSET: + case text_node_t::VOFFSET: cur_y += current->arg; break; - case SAVE_COORDINATES: + case text_node_t::SAVE_COORDINATES: saved_coordinates_x[static_cast(current->arg)] = cur_x - text_start_x; saved_coordinates_y[static_cast(current->arg)] = cur_y - text_start_y - last_font_height; break; - case TAB: { + case text_node_t::TAB: { int start = current->arg; int step = current->width; @@ -1474,7 +1460,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { break; } - case ALIGNR: { + case text_node_t::ALIGNR: { /* TODO: add back in "+ window.border_inner_margin" to the end of * this line? */ int pos_x = text_start_x + text_width - @@ -1491,7 +1477,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { break; } - case ALIGNC: { + case text_node_t::ALIGNC: { int pos_x = (text_width) / 2 - get_string_width_special(s, special_index) / 2 - (cur_x - text_start_x); @@ -1507,17 +1493,20 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { break; } #endif /* BUILD_GUI */ - case GOTO: + case text_node_t::GOTO: if (current->arg >= 0) { #ifdef BUILD_GUI cur_x = static_cast(current->arg); // make sure shades are 1 pixel to the right of the text - if (draw_mode == BG) { cur_x++; } + if (draw_mode == draw_mode_t::BG) { cur_x++; } #endif /* BUILD_GUI */ cur_x = static_cast(current->arg); for (auto output : display_outputs()) output->gotox(cur_x); } break; + default: + // do nothing; not a special node or support not enabled + break; } #ifdef BUILD_GUI @@ -1611,7 +1600,7 @@ void draw_stuff() { if (draw_shades.get(*state) && !draw_outline.get(*state)) { text_offset_x = text_offset_y = 1; set_foreground_color(default_shade_color.get(*state)); - draw_mode = BG; + draw_mode = draw_mode_t::BG; draw_text(); text_offset_x = text_offset_y = 0; } @@ -1623,7 +1612,7 @@ void draw_stuff() { for (text_offset_y = -1; text_offset_y < 2; text_offset_y++) { if (text_offset_x == 0 && text_offset_y == 0) { continue; } set_foreground_color(default_outline_color.get(*state)); - draw_mode = OUTLINE; + draw_mode = draw_mode_t::OUTLINE; draw_text(); } } @@ -1637,7 +1626,7 @@ void draw_stuff() { #endif /* BUILD_GUI */ // always draw text - draw_mode = FG; + draw_mode = draw_mode_t::FG; draw_text(); #ifdef BUILD_GUI @@ -1874,10 +1863,10 @@ static void reload_config() { initialisation(argc_copy, argv_copy); } -void free_specials(special_t *¤t) { +void free_specials(special_node *¤t) { if (current != nullptr) { free_specials(current->next); - if (current->type == GRAPH) { free(current->graph); } + if (current->type == text_node_t::GRAPH) { free(current->graph); } delete current; current = nullptr; } diff --git a/src/core.cc b/src/core.cc index ad69e21cce..6145a17fb6 100644 --- a/src/core.cc +++ b/src/core.cc @@ -1895,7 +1895,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line, #ifdef BUILD_NVIDIA END OBJ_ARG( nvidia, 0, - "nvidia needs an argument") if (set_nvidia_query(obj, arg, NONSPECIAL)) { + "nvidia needs an argument") if (set_nvidia_query(obj, arg, text_node_t::NONSPECIAL)) { CRIT_ERR_FREE(obj, free_at_crash, "nvidia: invalid argument" " specified: '%s'", @@ -1905,7 +1905,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line, obj->callbacks.free = &free_nvidia; END OBJ_ARG( nvidiabar, 0, - "nvidiabar needs an argument") if (set_nvidia_query(obj, arg, BAR)) { + "nvidiabar needs an argument") if (set_nvidia_query(obj, arg, text_node_t::BAR)) { CRIT_ERR_FREE(obj, free_at_crash, "nvidiabar: invalid argument" " specified: '%s'", @@ -1915,7 +1915,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line, obj->callbacks.free = &free_nvidia; END OBJ_ARG( nvidiagraph, 0, - "nvidiagraph needs an argument") if (set_nvidia_query(obj, arg, GRAPH)) { + "nvidiagraph needs an argument") if (set_nvidia_query(obj, arg, text_node_t::GRAPH)) { CRIT_ERR_FREE(obj, free_at_crash, "nvidiagraph: invalid argument" " specified: '%s'", @@ -1925,7 +1925,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line, obj->callbacks.free = &free_nvidia; END OBJ_ARG( nvidiagauge, 0, - "nvidiagauge needs an argument") if (set_nvidia_query(obj, arg, GAUGE)) { + "nvidiagauge needs an argument") if (set_nvidia_query(obj, arg, text_node_t::GAUGE)) { CRIT_ERR_FREE(obj, free_at_crash, "nvidiagauge: invalid argument" " specified: '%s'", diff --git a/src/display-console.cc b/src/display-console.cc index 7e1732351a..91e1193010 100644 --- a/src/display-console.cc +++ b/src/display-console.cc @@ -43,7 +43,11 @@ namespace { conky::display_output_console console_output("console"); } // namespace -void init_console_output() {} + +template <> +void register_output(display_outputs_t &outputs) { + outputs.push_back(&console_output); +} namespace priv {} // namespace priv diff --git a/src/display-file.cc b/src/display-file.cc index 12dbac8821..02a1ef79d2 100644 --- a/src/display-file.cc +++ b/src/display-file.cc @@ -49,7 +49,10 @@ namespace { conky::display_output_file file_output("file"); } // namespace -extern void init_file_output() {} +template <> +void register_output(display_outputs_t &outputs) { + outputs.push_back(&file_output); +} namespace priv {} // namespace priv diff --git a/src/display-http.cc b/src/display-http.cc index 91e0a458b3..f4946d085f 100644 --- a/src/display-http.cc +++ b/src/display-http.cc @@ -42,12 +42,15 @@ namespace { #ifdef BUILD_HTTP conky::display_output_http http_output; -#else -conky::disabled_display_output http_output_disabled("http", "BUILD_HTTP"); -#endif +#endif /* BUILD_HTTP */ } // namespace -extern void init_http_output() {} +#ifdef BUILD_HTTP +template <> +void register_output(display_outputs_t &outputs) { + outputs.push_back(&http_output); +} +#endif /* BUILD_HTTP */ // TODO: cleanup namespace // namespace priv { diff --git a/src/display-http.hh b/src/display-http.hh index b9d3ad5e92..550b25fb1b 100644 --- a/src/display-http.hh +++ b/src/display-http.hh @@ -23,6 +23,12 @@ #ifndef DISPLAY_HTTP_HH #define DISPLAY_HTTP_HH +#include "config.h" + +#ifndef BUILD_HTTP +#error display-http.hh included when BUILD_HTTP is disabled +#endif + #include #include #include diff --git a/src/display-ncurses.cc b/src/display-ncurses.cc index 86b1722ebb..7a47c313a1 100644 --- a/src/display-ncurses.cc +++ b/src/display-ncurses.cc @@ -48,13 +48,15 @@ namespace { #ifdef BUILD_NCURSES conky::display_output_ncurses ncurses_output; -#else -conky::disabled_display_output ncurses_output_disabled("ncurses", - "BUILD_NCURSES"); -#endif +#endif /* BUILD_NCURSES */ } // namespace -extern void init_ncurses_output() {} +#ifdef BUILD_NCURSES +template <> +void register_output(display_outputs_t& outputs) { + outputs.push_back(&ncurses_output); +} +#endif /* BUILD_NCURSES */ // namespace priv { @@ -96,7 +98,7 @@ Colour from_ncurses(int nccolor) { if (nccolor >= 0 && nccolor < COLORS_BUILTIN + COLORS_CUSTOM) { return ncurses_colors[nccolor]; } - return error_colour; + return ERROR_COLOUR; } display_output_ncurses::display_output_ncurses() diff --git a/src/display-ncurses.hh b/src/display-ncurses.hh index d7e1f7c34a..6c2e4ff090 100644 --- a/src/display-ncurses.hh +++ b/src/display-ncurses.hh @@ -23,6 +23,12 @@ #ifndef DISPLAY_NCURSES_HH #define DISPLAY_NCURSES_HH +#include "config.h" + +#ifndef BUILD_NCURSES +#error display-ncurses.hh included when BUILD_NCURSES is disabled +#endif + #include #include #include diff --git a/src/display-output.cc b/src/display-output.cc index fe95874192..fafcf8c45e 100644 --- a/src/display-output.cc +++ b/src/display-output.cc @@ -27,7 +27,6 @@ #include #include "display-output.hh" -#include "logging.h" #include #include @@ -35,28 +34,37 @@ #include namespace conky { -namespace { -typedef std::unordered_map - display_outputs_t; - -/* - * We cannot construct this object statically, because order of object - * construction in different modules is not defined, so register_source could be - * called before this object is constructed. Therefore, we create it on the - * first call to register_source. - */ -display_outputs_t *display_outputs; - -} // namespace - -// HACK: force the linker to link all the objects in with test enabled -extern void init_console_output(); -extern void init_ncurses_output(); -extern void init_file_output(); -extern void init_http_output(); -extern void init_x11_output(); -extern void init_wayland_output(); +inline void log_missing(const char *name, const char *flag) { + DBGP( + "%s display output disabled. Enable by recompiling with '%s' " + "flag enabled.", + name, flag); +} +#ifndef BUILD_HTTP +template <> +void register_output(display_outputs_t &outputs) { + log_missing("HTTP", "BUILD_HTTP"); +} +#endif +#ifndef BUILD_NCURSES +template <> +void register_output(display_outputs_t &outputs) { + log_missing("ncurses", "BUILD_NCURSES"); +} +#endif +#ifndef BUILD_WAYLAND +template <> +void register_output(display_outputs_t &outputs) { + log_missing("Wayland", "BUILD_WAYLAND"); +} +#endif +#ifndef BUILD_X11 +template <> +void register_output(display_outputs_t &outputs) { + log_missing("X11", "BUILD_X11"); +} +#endif /* * The selected and active display output. @@ -69,55 +77,18 @@ std::vector active_display_outputs; */ std::vector current_display_outputs; -namespace priv { -void do_register_display_output(const std::string &name, - display_output_base *output) { - struct display_output_constructor { - display_output_constructor() { display_outputs = new display_outputs_t(); } - ~display_output_constructor() { - delete display_outputs; - display_outputs = nullptr; - } - }; - static display_output_constructor constructor; - - bool inserted = display_outputs->insert({name, output}).second; - if (!inserted) { - throw std::logic_error("Display output with name '" + name + - "' already registered"); - } -} - -} // namespace priv - -display_output_base::display_output_base(const std::string &name_) - : name(name_), is_active(false), is_graphical(false), priority(-1) { - priv::do_register_display_output(name, this); -} - -disabled_display_output::disabled_display_output(const std::string &name, - const std::string &define) - : display_output_base(name) { - priority = -2; - // XXX some generic way of reporting errors? NORM_ERR? - DBGP( - "Support for display output '%s' has been disabled during compilation. " - "Please recompile with '%s'", - name.c_str(), define.c_str()); -} - bool initialize_display_outputs() { - init_console_output(); - init_ncurses_output(); - init_file_output(); - init_http_output(); - init_x11_output(); - init_wayland_output(); - std::vector outputs; - outputs.reserve(display_outputs->size()); + outputs.reserve(static_cast(output_t::OUTPUT_COUNT)); + register_output(outputs); + register_output(outputs); + register_output(outputs); + register_output(outputs); + register_output(outputs); + register_output(outputs); + + for (auto out : outputs) { NORM_ERR("FOUND: %s", out->name.c_str()); } - for (auto &output : *display_outputs) { outputs.push_back(output.second); } // Sort display outputs by descending priority, to try graphical ones first. sort(outputs.begin(), outputs.end(), &display_output_base::priority_compare); diff --git a/src/display-output.hh b/src/display-output.hh index 45c65856c3..27f95bbb01 100644 --- a/src/display-output.hh +++ b/src/display-output.hh @@ -30,6 +30,7 @@ #include #include "colours.h" +#include "logging.h" #include "luamm.hh" namespace conky { @@ -57,11 +58,11 @@ class display_output_base { public: const std::string name; - bool is_active; - bool is_graphical; - int priority; + bool is_active = false; + bool is_graphical = false; + int priority = -1; - explicit display_output_base(const std::string &name_); + explicit display_output_base(const std::string &name) : name(name){}; virtual ~display_output_base() {} @@ -137,6 +138,20 @@ class display_output_base { virtual bool active() { return is_active; } }; +using display_outputs_t = std::vector; + +enum class output_t : uint32_t { + CONSOLE, + NCURSES, + FILE, + HTTP, + X11, + WAYLAND, + OUTPUT_COUNT +}; +template +void register_output(display_outputs_t &outputs); + /* * The selected and active display outputs. */ @@ -148,17 +163,6 @@ extern std::vector active_display_outputs; */ extern std::vector current_display_outputs; -/* - * Use this to declare a display output that has been disabled during - * compilation. We can then print a nice error message telling the used which - * setting to enable. - */ -class disabled_display_output : public display_output_base { - public: - const std::string define; - disabled_display_output(const std::string &name, const std::string &define); -}; - } // namespace conky // XXX: move to namespace? diff --git a/src/display-wayland.cc b/src/display-wayland.cc index 9693a4663d..fc1c9bed17 100644 --- a/src/display-wayland.cc +++ b/src/display-wayland.cc @@ -51,7 +51,7 @@ #include #include "conky.h" -#include "display-wayland.hh" +#include "display-output.hh" #include "gui.h" #include "llua.h" #include "logging.h" @@ -59,6 +59,7 @@ #include "x11.h" #endif #ifdef BUILD_WAYLAND +#include "display-wayland.hh" #include "fonts.h" #endif #ifdef BUILD_MOUSE_EVENTS @@ -241,17 +242,16 @@ static void wayland_create_window() { #endif /* BUILD_WAYLAND */ namespace conky { -namespace { - #ifdef BUILD_WAYLAND +namespace { conky::display_output_wayland wayland_output; -#else -conky::disabled_display_output wayland_output_disabled("wayland", - "BUILD_WAYLAND"); -#endif - } // namespace -extern void init_wayland_output() {} + +template <> +void register_output(display_outputs_t &outputs) { + outputs.push_back(&wayland_output); +} +#endif /* BUILD_WAYLAND */ namespace priv {} // namespace priv @@ -489,7 +489,11 @@ static void on_pointer_button(void *data, struct wl_pointer *pointer, size_t abs_y = w->rectangle.y + y; mouse_button_event event{ - mouse_event_t::MOUSE_RELEASE, x, y, abs_x, abs_y, + mouse_event_t::RELEASE, + x, + y, + abs_x, + abs_y, static_cast(button), }; @@ -498,7 +502,7 @@ static void on_pointer_button(void *data, struct wl_pointer *pointer, // pass; default is MOUSE_RELEASE break; case WL_POINTER_BUTTON_STATE_PRESSED: - event.type = mouse_event_t::MOUSE_PRESS; + event.type = mouse_event_t::PRESS; break; default: return; @@ -519,17 +523,17 @@ void on_pointer_axis(void *data, struct wl_pointer *pointer, std::uint32_t time, size_t abs_y = w->rectangle.y + y; mouse_scroll_event event{ - x, y, abs_x, abs_y, scroll_direction_t::SCROLL_UP, + x, y, abs_x, abs_y, scroll_direction_t::UP, }; switch (static_cast(axis)) { case WL_POINTER_AXIS_VERTICAL_SCROLL: - event.direction = value > 0 ? scroll_direction_t::SCROLL_DOWN - : scroll_direction_t::SCROLL_UP; + event.direction = + value > 0 ? scroll_direction_t::DOWN : scroll_direction_t::UP; break; case WL_POINTER_AXIS_HORIZONTAL_SCROLL: - event.direction = value > 0 ? scroll_direction_t::SCROLL_RIGHT - : scroll_direction_t::SCROLL_LEFT; + event.direction = + value > 0 ? scroll_direction_t::RIGHT : scroll_direction_t::LEFT; break; default: return; @@ -577,7 +581,9 @@ bool display_output_wayland::initialize() { wl_display_roundtrip(global_display); if (wl_globals.layer_shell == nullptr) { - CRIT_ERR("Compositor doesn't support wlr-layer-shell-unstable-v1. Can't run conky."); + CRIT_ERR( + "Compositor doesn't support wlr-layer-shell-unstable-v1. Can't run " + "conky."); } struct wl_surface *surface = @@ -705,48 +711,34 @@ bool display_output_wayland::main_loop_wait(double t) { /* update struts */ if (changed != 0) { - int anchor = -1; + int anchor = 0; DBGP("%s", _(PACKAGE_NAME ": defining struts\n")); fflush(stderr); - switch (text_alignment.get(*state)) { - case TOP_LEFT: - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | - ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT; - break; - case TOP_RIGHT: - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | - ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; + alignment text_align = text_alignment.get(*state); + switch (vertical_alignment(text_align)) { + case axis_align::START: + anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP; break; - case TOP_MIDDLE: { - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP; + case axis_align::END: + anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM; break; - } - case BOTTOM_LEFT: - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | - ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT; + default: break; - case BOTTOM_RIGHT: - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | - ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; - break; - case BOTTOM_MIDDLE: { - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM; + } + switch (horizontal_alignment(text_align)) { + case axis_align::START: + anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT; break; - } - case MIDDLE_LEFT: { - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT; + case axis_align::END: + anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; break; - } - case MIDDLE_RIGHT: { - anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; + default: break; - } - - case NONE: - case MIDDLE_MIDDLE: /* XXX What about these? */; } + // middle anchor alignment is the default and requires no special + // handling. if (anchor != -1) { zwlr_layer_surface_v1_set_anchor(global_window->layer_surface, anchor); diff --git a/src/display-wayland.hh b/src/display-wayland.hh index ab4d1253b7..e6d26896f2 100644 --- a/src/display-wayland.hh +++ b/src/display-wayland.hh @@ -23,6 +23,12 @@ #ifndef DISPLAY_WAYLAND_HH #define DISPLAY_WAYLAND_HH +#include "config.h" + +#ifndef BUILD_WAYLAND +#error display-wayland.hh included when BUILD_WAYLAND is disabled +#endif + #include #include #include diff --git a/src/display-x11.cc b/src/display-x11.cc index 30f8b3f5cc..2f8ebdb491 100644 --- a/src/display-x11.cc +++ b/src/display-x11.cc @@ -24,10 +24,8 @@ * */ -#include -#include +#include "config.h" -#ifdef BUILD_X11 #include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wvariadic-macros" @@ -43,13 +41,14 @@ #ifdef BUILD_IMLIB2 #include "conky-imlib2.h" #endif /* BUILD_IMLIB2 */ -#ifdef BUILD_MOUSE_EVENTS +#if defined(BUILD_MOUSE_EVENTS) || defined(BUILD_XINPUT) #include "mouse-events.h" +#endif /* BUILD_MOUSE_EVENTS || BUILD_XINPUT */ #ifdef BUILD_XINPUT +#include #include +#undef COUNT #endif /* BUILD_XINPUT */ -#endif /* BUILD_MOUSE_EVENTS */ -#endif /* BUILD_X11 */ #include #include @@ -198,16 +197,16 @@ static void X11_create_window() { #endif /* BUILD_X11 */ namespace conky { -namespace { - #ifdef BUILD_X11 +namespace { conky::display_output_x11 x11_output; -#else -conky::disabled_display_output x11_output_disabled("x11", "BUILD_X11"); -#endif - } // namespace -extern void init_x11_output() {} + +template <> +void register_output(display_outputs_t &outputs) { + outputs.push_back(&x11_output); +} +#endif /* BUILD_X11 */ namespace priv {} // namespace priv @@ -324,39 +323,11 @@ bool display_output_x11::main_loop_wait(double t) { } /* update struts */ - if ((changed != 0) && own_window_type.get(*state) == TYPE_PANEL) { + if ((changed != 0) && own_window_type.get(*state) == window_type::PANEL) { int sidenum = -1; - DBGP("%s", _(PACKAGE_NAME ": defining struts\n")); - fflush(stderr); - - switch (text_alignment.get(*state)) { - case TOP_LEFT: - case TOP_RIGHT: - case TOP_MIDDLE: { - sidenum = 2; - break; - } - case BOTTOM_LEFT: - case BOTTOM_RIGHT: - case BOTTOM_MIDDLE: { - sidenum = 3; - break; - } - case MIDDLE_LEFT: { - sidenum = 0; - break; - } - case MIDDLE_RIGHT: { - sidenum = 1; - break; - } - - case NONE: - case MIDDLE_MIDDLE: /* XXX What about these? */; - } - - set_struts(sidenum); + NORM_ERR("defining struts"); + set_struts(text_alignment.get(*state)); } } #endif @@ -425,11 +396,10 @@ bool display_output_x11::main_loop_wait(double t) { return true; } -enum x_event_handler { +enum class x_event_handler { XINPUT_MOTION, MOUSE_INPUT, PROPERTY_NOTIFY, - EXPOSE, REPARENT, CONFIGURE, @@ -485,8 +455,6 @@ bool handle_event( Window event_window = query_x11_window_at_pos(display, data->root_x, data->root_y); - // query_result is not window.window in some cases. - modifier_state_t mods = x11_modifier_state(data->mods.effective); bool same_window = query_x11_top_parent(display, event_window) == query_x11_top_parent(display, window.window); @@ -518,6 +486,10 @@ bool handle_event( return true; } +#ifdef BUILD_MOUSE_EVENTS + // query_result is not window.window in some cases. + modifier_state_t mods = x11_modifier_state(data->mods.effective); + if (data->evtype == XI_Motion) { // TODO: Make valuator_index names configurable? @@ -556,20 +528,18 @@ bool handle_event( double vertical_value = vertical.value_or(0.0); if (vertical_value != 0.0) { - scroll_direction = vertical_value < 0.0 - ? scroll_direction_t::SCROLL_UP - : scroll_direction_t::SCROLL_DOWN; + scroll_direction = vertical_value < 0.0 ? scroll_direction_t::UP + : scroll_direction_t::DOWN; } else { auto horizontal = data->valuator_relative_value(valuator_t::SCROLL_X); double horizontal_value = horizontal.value_or(0.0); if (horizontal_value != 0.0) { - scroll_direction = horizontal_value < 0.0 - ? scroll_direction_t::SCROLL_LEFT - : scroll_direction_t::SCROLL_RIGHT; + scroll_direction = horizontal_value < 0.0 ? scroll_direction_t::LEFT + : scroll_direction_t::RIGHT; } } - if (scroll_direction != scroll_direction_t::SCROLL_UNKNOWN) { + if (scroll_direction != scroll_direction_t::UNKNOWN) { *consumed = llua_mouse_hook( mouse_scroll_event(data->event_x, data->event_y, data->root_x, data->root_y, scroll_direction, mods)); @@ -583,16 +553,16 @@ bool handle_event( return true; } - mouse_event_t type = mouse_event_t::MOUSE_PRESS; - if (data->evtype == XI_ButtonRelease) { - type = mouse_event_t::MOUSE_RELEASE; - } + mouse_event_t type = mouse_event_t::PRESS; + if (data->evtype == XI_ButtonRelease) { type = mouse_event_t::RELEASE; } mouse_button_t button = x11_mouse_button_code(data->detail); *consumed = llua_mouse_hook(mouse_button_event(type, data->event_x, data->event_y, data->root_x, data->root_y, button, mods)); } +#endif /* BUILD_MOUSE_EVENTS */ + #else /* BUILD_XINPUT */ if (ev.type != ButtonPress && ev.type != ButtonRelease && ev.type != MotionNotify) @@ -612,9 +582,10 @@ bool handle_event( } else { mouse_button_t button = x11_mouse_button_code(ev.xbutton.button); *consumed = llua_mouse_hook(mouse_button_event( - mouse_event_t::MOUSE_PRESS, ev.xbutton.x, ev.xbutton.y, - ev.xbutton.x_root, ev.xbutton.y_root, button, mods)); + mouse_event_t::PRESS, ev.xbutton.x, ev.xbutton.y, ev.xbutton.x_root, + ev.xbutton.y_root, button, mods)); } + break; } case ButtonRelease: { /* don't report scroll release events */ @@ -623,31 +594,35 @@ bool handle_event( modifier_state_t mods = x11_modifier_state(ev.xbutton.state); mouse_button_t button = x11_mouse_button_code(ev.xbutton.button); *consumed = llua_mouse_hook(mouse_button_event( - mouse_event_t::MOUSE_RELEASE, ev.xbutton.x, ev.xbutton.y, - ev.xbutton.x_root, ev.xbutton.y_root, button, mods)); + mouse_event_t::RELEASE, ev.xbutton.x, ev.xbutton.y, ev.xbutton.x_root, + ev.xbutton.y_root, button, mods)); + break; } case MotionNotify: { modifier_state_t mods = x11_modifier_state(ev.xmotion.state); *consumed = llua_mouse_hook(mouse_move_event(ev.xmotion.x, ev.xmotion.y, ev.xmotion.x_root, ev.xmotion.y_root, mods)); + break; } } -#else /* BUILD_MOUSE_EVENTS */ +#endif /* BUILD_MOUSE_EVENTS */ +#endif /* BUILD_XINPUT */ +#ifndef BUILD_MOUSE_EVENTS // always propagate mouse input if not handling mouse events *consumed = false; #endif /* BUILD_MOUSE_EVENTS */ -#endif /* BUILD_XINPUT */ + if (!own_window.get(*state)) return true; switch (own_window_type.get(*state)) { - case window_type::TYPE_NORMAL: - case window_type::TYPE_UTILITY: + case window_type::NORMAL: + case window_type::UTILITY: // decorated normal windows always consume events - if (!TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)) { + if (!TEST_HINT(own_window_hints.get(*state), window_hints::UNDECORATED)) { *consumed = true; } break; - case window_type::TYPE_DESKTOP: + case window_type::DESKTOP: // assume conky is always on bottom; nothing to propagate events to *consumed = true; default: @@ -714,6 +689,31 @@ bool handle_event( return true; } + +#ifdef BUILD_MOUSE_EVENTS +template <> +bool handle_event( + conky::display_output_x11 *surface, Display *display, XEvent &ev, + bool *consumed, void **cookie) { + if (ev.type != EnterNotify && ev.type != LeaveNotify) return false; + if (window.xi_opcode != 0) return true; // handled by mouse_input already + + bool not_over_conky = ev.xcrossing.x_root <= window.x || + ev.xcrossing.y_root <= window.y || + ev.xcrossing.x_root >= window.x + window.width || + ev.xcrossing.y_root >= window.y + window.height; + + if ((not_over_conky && ev.xcrossing.type == LeaveNotify) || + (!not_over_conky && ev.xcrossing.type == EnterNotify)) { + llua_mouse_hook(mouse_crossing_event( + ev.xcrossing.type == EnterNotify ? mouse_event_t::AREA_ENTER + : mouse_event_t::AREA_LEAVE, + ev.xcrossing.x, ev.xcrossing.y, ev.xcrossing.x_root, + ev.xcrossing.y_root)); + } + return true; +} +#endif /* BUILD_MOUSE_EVENTS */ #endif /* OWN_WINDOW */ template <> @@ -757,29 +757,6 @@ bool handle_event(conky::display_output_x11 *surface, return true; } -template <> -bool handle_event( - conky::display_output_x11 *surface, Display *display, XEvent &ev, - bool *consumed, void **cookie) { - if (ev.type != EnterNotify && ev.type != LeaveNotify) return false; - if (window.xi_opcode != 0) return true; // handled by mouse_input already - - bool not_over_conky = ev.xcrossing.x_root <= window.x || - ev.xcrossing.y_root <= window.y || - ev.xcrossing.x_root >= window.x + window.width || - ev.xcrossing.y_root >= window.y + window.height; - - if ((not_over_conky && ev.xcrossing.type == LeaveNotify) || - (!not_over_conky && ev.xcrossing.type == EnterNotify)) { - llua_mouse_hook(mouse_crossing_event( - ev.xcrossing.type == EnterNotify ? mouse_event_t::AREA_ENTER - : mouse_event_t::AREA_LEAVE, - ev.xcrossing.x, ev.xcrossing.y, ev.xcrossing.x_root, - ev.xcrossing.y_root)); - } - return true; -} - #ifdef BUILD_XDAMAGE template <> bool handle_event(conky::display_output_x11 *surface, @@ -820,6 +797,8 @@ bool process_event(conky::display_output_x11 *surface, Display *display, HANDLE_EV(BORDER_CROSSING) HANDLE_EV(DAMAGE) +#undef HANDLE_EV + // event not handled return false; } @@ -889,7 +868,7 @@ void display_output_x11::set_foreground_color(Colour c) { } #endif /* BUILD_ARGB */ XSetForeground(display, window.gc, - current_color.to_x11_color(display, screen)); + current_color.to_x11_color(display, screen, have_argb_visual)); } int display_output_x11::calc_text_width(const char *s) { @@ -918,7 +897,7 @@ void display_output_x11::draw_string_at(int x, int y, const char *s, int w) { XColor c{}; XftColor c2{}; - c.pixel = current_color.to_x11_color(display, screen); + c.pixel = current_color.to_x11_color(display, screen, have_argb_visual); // query color on custom colormap XQueryColor(display, window.colourmap, &c); @@ -972,9 +951,11 @@ void display_output_x11::draw_arc(int x, int y, int w, int h, int a1, int a2) { } void display_output_x11::move_win(int x, int y) { +#ifdef OWN_WINDOW window.x = x; window.y = y; XMoveWindow(display, window.window, x, y); +#endif /* OWN_WINDOW */ } int display_output_x11::dpi_scale(int value) { diff --git a/src/display-x11.hh b/src/display-x11.hh index e751f79498..c34795d66f 100644 --- a/src/display-x11.hh +++ b/src/display-x11.hh @@ -23,6 +23,12 @@ #ifndef DISPLAY_X11_HH #define DISPLAY_X11_HH +#include "config.h" + +#ifndef BUILD_X11 +#error display-x11.hh included when BUILD_X11 is disabled +#endif + #include #include #include diff --git a/src/gui.cc b/src/gui.cc index 3c388eaacc..9bd931ed52 100644 --- a/src/gui.cc +++ b/src/gui.cc @@ -32,7 +32,10 @@ #include "config.h" #include "conky.h" #include "logging.h" + +#ifdef BUILD_WAYLAND #include "wl.h" +#endif /* BUILD_WAYLAND */ #ifdef BUILD_IMLIB2 #include "conky-imlib2.h" @@ -103,41 +106,46 @@ void own_window_setting::lua_setter(lua::state &l, bool init) { template <> conky::lua_traits::Map conky::lua_traits::map = { - {"top_left", TOP_LEFT}, - {"top_right", TOP_RIGHT}, - {"top_middle", TOP_MIDDLE}, - {"bottom_left", BOTTOM_LEFT}, - {"bottom_right", BOTTOM_RIGHT}, - {"bottom_middle", BOTTOM_MIDDLE}, - {"middle_left", MIDDLE_LEFT}, - {"middle_middle", MIDDLE_MIDDLE}, - {"middle_right", MIDDLE_RIGHT}, - {"tl", TOP_LEFT}, - {"tr", TOP_RIGHT}, - {"tm", TOP_MIDDLE}, - {"bl", BOTTOM_LEFT}, - {"br", BOTTOM_RIGHT}, - {"bm", BOTTOM_MIDDLE}, - {"ml", MIDDLE_LEFT}, - {"mm", MIDDLE_MIDDLE}, - {"mr", MIDDLE_RIGHT}, - {"none", NONE}}; + {"top_left", alignment::TOP_LEFT}, + {"top_right", alignment::TOP_RIGHT}, + {"top_middle", alignment::TOP_MIDDLE}, + {"top", alignment::TOP_MIDDLE}, + {"bottom_left", alignment::BOTTOM_LEFT}, + {"bottom_right", alignment::BOTTOM_RIGHT}, + {"bottom_middle", alignment::BOTTOM_MIDDLE}, + {"bottom", alignment::BOTTOM_MIDDLE}, + {"middle_left", alignment::MIDDLE_LEFT}, + {"left", alignment::MIDDLE_LEFT}, + {"middle_middle", alignment::MIDDLE_MIDDLE}, + {"center", alignment::MIDDLE_MIDDLE}, + {"middle_right", alignment::MIDDLE_RIGHT}, + {"right", alignment::MIDDLE_RIGHT}, + {"tl", alignment::TOP_LEFT}, + {"tr", alignment::TOP_RIGHT}, + {"tm", alignment::TOP_MIDDLE}, + {"bl", alignment::BOTTOM_LEFT}, + {"br", alignment::BOTTOM_RIGHT}, + {"bm", alignment::BOTTOM_MIDDLE}, + {"ml", alignment::MIDDLE_LEFT}, + {"mm", alignment::MIDDLE_MIDDLE}, + {"mr", alignment::MIDDLE_RIGHT}, + {"none", alignment::NONE}}; #ifdef OWN_WINDOW template <> conky::lua_traits::Map conky::lua_traits::map = { - {"normal", TYPE_NORMAL}, {"dock", TYPE_DOCK}, - {"panel", TYPE_PANEL}, {"desktop", TYPE_DESKTOP}, - {"utility", TYPE_UTILITY}, {"override", TYPE_OVERRIDE}}; + {"normal", window_type::NORMAL}, {"dock", window_type::DOCK}, + {"panel", window_type::PANEL}, {"desktop", window_type::DESKTOP}, + {"utility", window_type::UTILITY}, {"override", window_type::OVERRIDE}}; template <> conky::lua_traits::Map conky::lua_traits::map = { - {"undecorated", HINT_UNDECORATED}, - {"below", HINT_BELOW}, - {"above", HINT_ABOVE}, - {"sticky", HINT_STICKY}, - {"skip_taskbar", HINT_SKIP_TASKBAR}, - {"skip_pager", HINT_SKIP_PAGER}}; + {"undecorated", window_hints::UNDECORATED}, + {"below", window_hints::BELOW}, + {"above", window_hints::ABOVE}, + {"sticky", window_hints::STICKY}, + {"skip_taskbar", window_hints::SKIP_TASKBAR}, + {"skip_pager", window_hints::SKIP_PAGER}}; std::pair window_hints_traits::convert( lua::state &l, int index, const std::string &name) { @@ -185,7 +193,8 @@ std::string gethostnamecxx() { * setting.cc. */ -conky::simple_config_setting text_alignment("alignment", BOTTOM_LEFT, +conky::simple_config_setting text_alignment("alignment", + alignment::BOTTOM_LEFT, false); priv::colour_setting default_shade_color("default_shade_color", black_argb32); @@ -209,7 +218,8 @@ conky::simple_config_setting own_window_title( conky::simple_config_setting own_window_class("own_window_class", PACKAGE_NAME, false); conky::simple_config_setting own_window_type("own_window_type", - TYPE_NORMAL, false); + window_type::NORMAL, + false); conky::simple_config_setting own_window_hints( "own_window_hints", 0, false); #endif /* OWN_WINDOW && BUILD_X11 */ diff --git a/src/gui.h b/src/gui.h index 7dd09106a9..821c1f9bde 100644 --- a/src/gui.h +++ b/src/gui.h @@ -25,13 +25,104 @@ #include "config.h" +#include "colours.h" +#include "setting.hh" + +#include "colour-settings.h" + #ifdef BUILD_X11 -#include "x11.h" +#include +#include "x11-settings.h" #endif /* BUILD_X11 */ -#include "colour-settings.h" -#include "colours.h" -#include "setting.hh" +/// @brief Represents alignment on a single axis. +enum class axis_align : uint8_t { + /// No alignment + NONE = 0, + /// Top or left alignment + START = 0b01, + /// Middle alignment + MIDDLE = 0b10, + /// Bottom or right alignment + END = 0b11, +}; +constexpr uint8_t operator*(axis_align index) { + return static_cast(index); +} + +/// @brief Represents alignment on a 2D plane. +/// +/// Values are composed of 2 `axis_align` values. +enum class alignment : uint8_t { + NONE = 0, + NONE_LEFT = 0b0001, + NONE_MIDDLE = 0b0010, + NONE_RIGHT = 0b0011, + TOP_LEFT = 0b0101, + TOP_MIDDLE = 0b0110, + TOP_RIGHT = 0b0111, + MIDDLE_LEFT = 0b1001, + MIDDLE_MIDDLE = 0b1010, + MIDDLE_RIGHT = 0b1011, + BOTTOM_LEFT = 0b1101, + BOTTOM_MIDDLE = 0b1110, + BOTTOM_RIGHT = 0b1111, +}; +constexpr uint8_t operator*(alignment index) { + return static_cast(index); +} + +/// @brief Returns the horizontal axis alignment component of `alignment`. +/// @param of 2D alignment to extract axis alignment from +/// @return horizontal `axis_align` +[[nodiscard]] inline axis_align horizontal_alignment(alignment of) { + return static_cast(static_cast(of) & 0b11); +} +/// @brief Returns the vertical axis alignment component of `alignment`. +/// @param of 2D alignment to extract axis alignment from +/// @return vertical `axis_align` +[[nodiscard]] inline axis_align vertical_alignment(alignment of) { + return static_cast((static_cast(of) >> 2) & 0b11); +} + +#if defined(BUILD_X11) && defined(OWN_WINDOW) +enum class window_type : uint8_t { + NORMAL = 0, + DOCK, + PANEL, + DESKTOP, + OVERRIDE, + UTILITY +}; +constexpr uint8_t operator*(window_type index) { + return static_cast(index); +} + +enum class window_hints : uint16_t { + UNDECORATED = 0, + BELOW, + ABOVE, + STICKY, + SKIP_TASKBAR, + SKIP_PAGER +}; +constexpr uint8_t operator*(window_hints index) { + return static_cast(index); +} + +inline void SET_HINT(window_hints &mask, window_hints hint) { + mask = static_cast(*mask | (1 << (*hint))); +} +inline void SET_HINT(uint16_t &mask, window_hints hint) { + mask = mask | (1 << (*hint)); +} +inline bool TEST_HINT(window_hints mask, window_hints hint) { + return (*mask & (1 << (*hint))) != 0; +} +inline bool TEST_HINT(uint16_t mask, window_hints hint) { + return (mask & (1 << (*hint))) != 0; +} +#endif #ifdef BUILD_X11 extern Display *display; @@ -45,7 +136,7 @@ extern char window_created; void destroy_window(void); void create_gc(void); -void set_struts(int); +void set_struts(alignment); bool out_to_gui(lua::state &l); @@ -70,20 +161,6 @@ void xdbe_swap_buffers(void); void xpmdb_swap_buffers(void); #endif /* BUILD_XDBE */ -/* alignments */ -enum alignment { - TOP_LEFT, - TOP_RIGHT, - TOP_MIDDLE, - BOTTOM_LEFT, - BOTTOM_RIGHT, - BOTTOM_MIDDLE, - MIDDLE_LEFT, - MIDDLE_MIDDLE, - MIDDLE_RIGHT, - NONE -}; - extern conky::simple_config_setting text_alignment; namespace priv { diff --git a/src/mouse-events.cc b/src/mouse-events.cc index ea99bd08ab..f1eafab2b7 100644 --- a/src/mouse-events.cc +++ b/src/mouse-events.cc @@ -41,6 +41,7 @@ extern "C" { namespace conky { +#ifdef BUILD_MOUSE_EVENTS /* Lua helper functions */ void push_table_value(lua_State *L, std::string key, std::string value) { lua_pushstring(L, key.c_str()); @@ -105,22 +106,22 @@ inline std::size_t current_time_ms() { void push_table_value(lua_State *L, std::string key, mouse_event_t type) { lua_pushstring(L, key.c_str()); switch (type) { - case MOUSE_PRESS: + case mouse_event_t::PRESS: lua_pushstring(L, "button_down"); break; - case MOUSE_RELEASE: + case mouse_event_t::RELEASE: lua_pushstring(L, "button_up"); break; - case MOUSE_SCROLL: + case mouse_event_t::SCROLL: lua_pushstring(L, "mouse_scroll"); break; - case MOUSE_MOVE: + case mouse_event_t::MOVE: lua_pushstring(L, "mouse_move"); break; - case AREA_ENTER: + case mouse_event_t::AREA_ENTER: lua_pushstring(L, "mouse_enter"); break; - case AREA_LEAVE: + case mouse_event_t::AREA_LEAVE: lua_pushstring(L, "mouse_leave"); break; default: @@ -134,16 +135,16 @@ void push_table_value(lua_State *L, std::string key, scroll_direction_t direction) { lua_pushstring(L, key.c_str()); switch (direction) { - case SCROLL_DOWN: + case scroll_direction_t::DOWN: lua_pushstring(L, "down"); break; - case SCROLL_UP: + case scroll_direction_t::UP: lua_pushstring(L, "up"); break; - case SCROLL_LEFT: + case scroll_direction_t::LEFT: lua_pushstring(L, "left"); break; - case SCROLL_RIGHT: + case scroll_direction_t::RIGHT: lua_pushstring(L, "right"); break; default: @@ -156,19 +157,19 @@ void push_table_value(lua_State *L, std::string key, void push_table_value(lua_State *L, std::string key, mouse_button_t button) { lua_pushstring(L, key.c_str()); switch (button) { - case BUTTON_LEFT: + case mouse_button_t::LEFT: lua_pushstring(L, "left"); break; - case BUTTON_RIGHT: + case mouse_button_t::RIGHT: lua_pushstring(L, "right"); break; - case BUTTON_MIDDLE: + case mouse_button_t::MIDDLE: lua_pushstring(L, "middle"); break; - case BUTTON_BACK: + case mouse_button_t::BACK: lua_pushstring(L, "back"); break; - case BUTTON_FORWARD: + case mouse_button_t::FORWARD: lua_pushstring(L, "forward"); break; default: @@ -213,6 +214,7 @@ void mouse_button_event::push_lua_data(lua_State *L) const { push_table_value(L, "button", this->button); push_mods(L, this->mods); } +#endif /* BUILD_MOUSE_EVENTS */ #ifdef BUILD_XINPUT /// Last global device id. @@ -271,10 +273,10 @@ void handle_xi_device_change(const XIHierarchyEvent *event) { /// some device (unlikely). size_t fixed_valuator_index(Display *display, XIDeviceInfo *device, valuator_t valuator) { - const std::array atom_names = { + const std::array atom_names = { "ConkyValuatorMoveX", "ConkyValuatorMoveY", "ConkyValuatorScrollX", "ConkyValuatorScrollY"}; - Atom override_atom = XInternAtom(display, atom_names[valuator], False); + Atom override_atom = XInternAtom(display, atom_names[*valuator], False); unsigned char *value; Atom type_return; int format_return; @@ -290,7 +292,7 @@ size_t fixed_valuator_index(Display *display, XIDeviceInfo *device, NORM_ERR( "invalid '%s' option value, expected a single integer; value will " "be ignored", - atom_names[valuator]); + atom_names[*valuator]); XFree(value); break; } @@ -299,7 +301,7 @@ size_t fixed_valuator_index(Display *display, XIDeviceInfo *device, return static_cast(result); } } while (true); - return valuator; + return *valuator; } /// Allows override of valuator value type in `xorg.conf` in case they're wrong @@ -312,7 +314,7 @@ bool fixed_valuator_relative(Display *display, XIDeviceInfo *device, "ConkyValuatorScrollMode", }; - Atom override_atom = XInternAtom(display, atom_names[valuator >> 1], False); + Atom override_atom = XInternAtom(display, atom_names[*valuator >> 1], False); unsigned char *value_return; Atom type_return; int format_return; @@ -329,7 +331,7 @@ bool fixed_valuator_relative(Display *display, XIDeviceInfo *device, NORM_ERR( "invalid '%s' option value, expected an atom (string); value will " "be ignored", - atom_names[valuator >> 1]); + atom_names[*valuator >> 1]); XFree(value_return); break; } @@ -348,7 +350,7 @@ bool fixed_valuator_relative(Display *display, XIDeviceInfo *device, "unknown '%s' option value: '%s', expected 'absolute' or " "'relative'; " "value will be ignored", - atom_names[valuator >> 1]); + atom_names[*valuator >> 1]); XFree(value); break; } @@ -372,8 +374,8 @@ void device_info::init_xi_device( } if (device == nullptr) return; - std::array valuator_indices; - for (size_t i = 0; i < valuator_t::VALUATOR_COUNT; i++) { + std::array valuator_indices; + for (size_t i = 0; i < VALUATOR_COUNT; i++) { valuator_indices[i] = fixed_valuator_index(display, device, static_cast(i)); } @@ -384,14 +386,14 @@ void device_info::init_xi_device( XIValuatorClassInfo *class_info = (XIValuatorClassInfo *)device->classes[i]; // check if one of used (mapped) valuators - valuator_t valuator = valuator_t::VALUATOR_COUNT; - for (size_t i = 0; i < valuator_t::VALUATOR_COUNT; i++) { + valuator_t valuator = valuator_t::UNKNOWN; + for (size_t i = 0; i < VALUATOR_COUNT; i++) { if (valuator_indices[i] == class_info->number) { valuator = static_cast(i); break; } } - if (valuator == valuator_t::VALUATOR_COUNT) { continue; } + if (valuator == valuator_t::UNKNOWN) { continue; } auto info = conky_valuator_info{ .index = static_cast(class_info->number), @@ -402,7 +404,7 @@ void device_info::init_xi_device( fixed_valuator_relative(display, device, valuator, class_info), }; - this->valuators[valuator] = info; + this->valuators[*valuator] = info; } if (std::holds_alternative(source)) { @@ -410,7 +412,7 @@ void device_info::init_xi_device( } } conky_valuator_info &device_info::valuator(valuator_t valuator) { - return this->valuators[valuator]; + return this->valuators[*valuator]; } xi_event_data *xi_event_data::read_cookie(Display *display, const void *data) { @@ -460,7 +462,7 @@ xi_event_data *xi_event_data::read_cookie(Display *display, const void *data) { .valuators_relative = {0.0, 0.0, 0.0, 0.0}, }; - for (size_t v = 0; v < valuator_t::VALUATOR_COUNT; v++) { + for (size_t v = 0; v < VALUATOR_COUNT; v++) { valuator_t valuator = static_cast(v); auto &valuator_info = device->valuator(valuator); @@ -497,7 +499,7 @@ std::optional xi_event_data::valuator_value(valuator_t valuator) const { std::optional xi_event_data::valuator_relative_value( valuator_t valuator) const { - return this->valuators_relative.at(valuator); + return this->valuators_relative.at(*valuator); } std::vector> xi_event_data::generate_events( diff --git a/src/mouse-events.h b/src/mouse-events.h index ea414b025f..aebcefe185 100644 --- a/src/mouse-events.h +++ b/src/mouse-events.h @@ -77,42 +77,50 @@ extern "C" { namespace conky { -enum mouse_event_t { - MOUSE_PRESS = 0, - MOUSE_RELEASE = 1, - MOUSE_SCROLL = 2, - MOUSE_MOVE = 3, +#ifdef BUILD_MOUSE_EVENTS +enum class mouse_event_t : uint32_t { + PRESS = 0, + RELEASE = 1, + SCROLL = 2, + MOVE = 3, AREA_ENTER = 4, AREA_LEAVE = 5, - MOUSE_EVENT_COUNT = 6, }; +const size_t MOUSE_EVENT_COUNT = + static_cast(mouse_event_t::AREA_LEAVE) + 1; +constexpr uint32_t operator*(mouse_event_t index) { + return static_cast(index); +} -enum mouse_button_t : std::uint32_t { - BUTTON_LEFT = BTN_LEFT, - BUTTON_RIGHT = BTN_RIGHT, - BUTTON_MIDDLE = BTN_MIDDLE, - BUTTON_BACK = BTN_BACK, - BUTTON_FORWARD = BTN_FORWARD, +enum class mouse_button_t : uint32_t { + LEFT = BTN_LEFT, + RIGHT = BTN_RIGHT, + MIDDLE = BTN_MIDDLE, + BACK = BTN_BACK, + FORWARD = BTN_FORWARD, }; +constexpr uint32_t operator*(mouse_button_t index) { + return static_cast(index); +} #ifdef BUILD_X11 inline mouse_button_t x11_mouse_button_code(unsigned int x11_mouse_button) { mouse_button_t button; switch (x11_mouse_button) { case Button1: - button = BUTTON_LEFT; + button = mouse_button_t::LEFT; break; case Button2: - button = BUTTON_MIDDLE; + button = mouse_button_t::MIDDLE; break; case Button3: - button = BUTTON_RIGHT; + button = mouse_button_t::RIGHT; break; case 8: - button = BUTTON_BACK; + button = mouse_button_t::BACK; break; case 9: - button = BUTTON_FORWARD; + button = mouse_button_t::FORWARD; break; default: DBGP("X11 button %d is not mapped", x11_mouse_button); @@ -145,26 +153,29 @@ struct mouse_positioned_event : public mouse_event { }; typedef std::bitset<6> modifier_state_t; -enum modifier_key : std::uint32_t { - MOD_SHIFT = 0, - MOD_CONTROL = 1, - MOD_ALT = 2, +enum class modifier_key : uint32_t { + SHIFT = 0, + CONTROL = 1, + ALT = 2, // Windows/MacOS key on most keyboards - MOD_SUPER = 3, - MOD_CAPS_LOCK = 4, - MOD_NUM_LOCK = 5, + SUPER = 3, + CAPS_LOCK = 4, + NUM_LOCK = 5, }; +constexpr uint32_t operator*(modifier_key index) { + return static_cast(index); +} std::string modifier_name(modifier_key key); #ifdef BUILD_X11 inline modifier_state_t x11_modifier_state(unsigned int mods) { modifier_state_t result; - result[MOD_SHIFT] = mods & ShiftMask; - result[MOD_CONTROL] = mods & ControlMask; - result[MOD_ALT] = mods & Mod1Mask; - result[MOD_SUPER] = mods & Mod4Mask; - result[MOD_CAPS_LOCK] = mods & LockMask; - result[MOD_NUM_LOCK] = mods & Mod2Mask; + result[*modifier_key::SHIFT] = mods & ShiftMask; + result[*modifier_key::CONTROL] = mods & ControlMask; + result[*modifier_key::ALT] = mods & Mod1Mask; + result[*modifier_key::SUPER] = mods & Mod4Mask; + result[*modifier_key::CAPS_LOCK] = mods & LockMask; + result[*modifier_key::NUM_LOCK] = mods & Mod2Mask; return result; } #endif /* BUILD_X11 */ @@ -174,35 +185,38 @@ struct mouse_move_event : public mouse_positioned_event { mouse_move_event(std::size_t x, std::size_t y, std::size_t x_abs, std::size_t y_abs, modifier_state_t mods = 0) - : mouse_positioned_event{mouse_event_t::MOUSE_MOVE, x, y, x_abs, y_abs}, + : mouse_positioned_event{mouse_event_t::MOVE, x, y, x_abs, y_abs}, mods(mods){}; void push_lua_data(lua_State *L) const; }; -enum scroll_direction_t : std::uint8_t { - SCROLL_UNKNOWN = 0, - SCROLL_UP, - SCROLL_DOWN, - SCROLL_LEFT, - SCROLL_RIGHT, +enum class scroll_direction_t : uint8_t { + UNKNOWN = 0, + UP, + DOWN, + LEFT, + RIGHT, }; +constexpr uint8_t operator*(scroll_direction_t index) { + return static_cast(index); +} #ifdef BUILD_X11 inline scroll_direction_t x11_scroll_direction(unsigned int x11_mouse_button) { - scroll_direction_t direction = SCROLL_UNKNOWN; + scroll_direction_t direction = scroll_direction_t::UNKNOWN; switch (x11_mouse_button) { case Button4: - direction = SCROLL_UP; + direction = scroll_direction_t::UP; break; case Button5: - direction = SCROLL_DOWN; + direction = scroll_direction_t::DOWN; break; case 6: - direction = SCROLL_LEFT; + direction = scroll_direction_t::LEFT; break; case 7: - direction = SCROLL_RIGHT; + direction = scroll_direction_t::RIGHT; break; } return direction; @@ -216,7 +230,7 @@ struct mouse_scroll_event : public mouse_positioned_event { mouse_scroll_event(std::size_t x, std::size_t y, std::size_t x_abs, std::size_t y_abs, scroll_direction_t direction, modifier_state_t mods = 0) - : mouse_positioned_event{mouse_event_t::MOUSE_SCROLL, x, y, x_abs, y_abs}, + : mouse_positioned_event{mouse_event_t::SCROLL, x, y, x_abs, y_abs}, direction(direction), mods(mods){}; @@ -242,12 +256,17 @@ struct mouse_crossing_event : public mouse_positioned_event { std::size_t x_abs, std::size_t y_abs) : mouse_positioned_event{type, x, y, x_abs, y_abs} {}; }; +#endif /* BUILD_MOUSE_EVENTS */ #ifdef BUILD_XINPUT typedef int xi_device_id; typedef int xi_event_type; -enum valuator_t : size_t { MOVE_X, MOVE_Y, SCROLL_X, SCROLL_Y, VALUATOR_COUNT }; +enum class valuator_t : size_t { MOVE_X, MOVE_Y, SCROLL_X, SCROLL_Y, UNKNOWN }; +const size_t VALUATOR_COUNT = static_cast(valuator_t::UNKNOWN); +constexpr uint8_t operator*(valuator_t index) { + return static_cast(index); +} struct conky_valuator_info { size_t index; @@ -261,7 +280,7 @@ struct device_info { /// @brief Device name. xi_device_id id; std::string name; - std::array valuators{}; + std::array valuators{}; static device_info *from_xi_id(xi_device_id id, Display *display = nullptr); @@ -305,7 +324,7 @@ struct xi_event_data { // Extra data /// Precomputed relative values - std::array valuators_relative; + std::array valuators_relative; static xi_event_data *read_cookie(Display *display, const void *data); diff --git a/src/nvidia.cc b/src/nvidia.cc index 544173e369..cf403b8c59 100644 --- a/src/nvidia.cc +++ b/src/nvidia.cc @@ -422,7 +422,7 @@ nvidia_display_setting nvidia_display; // Evaluate module parameters and prepare query int set_nvidia_query(struct text_object *obj, const char *arg, - unsigned int special_type) { + text_node_t special_type) { nvidia_s *nvs; int aid; int ilen; @@ -451,15 +451,15 @@ int set_nvidia_query(struct text_object *obj, const char *arg, // Extract arguments for nvidiabar, etc, and run set_nvidia_query switch (special_type) { - case BAR: + case text_node_t::BAR: arg = scan_bar(obj, arg, 100); break; - case GRAPH: { + case text_node_t::GRAPH: { auto [buf, skip] = scan_command(arg); scan_graph(obj, arg + skip, 100); arg = buf; } break; - case GAUGE: + case text_node_t::GAUGE: arg = scan_gauge(obj, arg, 100); break; default: @@ -483,7 +483,7 @@ int set_nvidia_query(struct text_object *obj, const char *arg, // Save pointers to the arg and command strings for debugging and printing nvs->arg = translate_module_argument[aid]; - nvs->command = translate_nvidia_special_type[special_type]; + nvs->command = translate_nvidia_special_type[*special_type]; // Evaluate parameter switch (aid) { diff --git a/src/nvidia.h b/src/nvidia.h index ffe9618142..492274d7ac 100644 --- a/src/nvidia.h +++ b/src/nvidia.h @@ -30,7 +30,9 @@ #ifndef NVIDIA_CONKY_H #define NVIDIA_CONKY_H -int set_nvidia_query(struct text_object *, const char *, unsigned int); +#include "specials.h" + +int set_nvidia_query(struct text_object *, const char *, text_node_t); void print_nvidia_value(struct text_object *, char *, unsigned int); double get_nvidia_barval(struct text_object *); void free_nvidia(struct text_object *); diff --git a/src/scroll.cc b/src/scroll.cc index dee6934c07..f7b5c23ced 100644 --- a/src/scroll.cc +++ b/src/scroll.cc @@ -323,7 +323,8 @@ void print_scroll(struct text_object *obj, char *p, unsigned int p_max_size) { #ifdef BUILD_GUI // reset color when scroll is finished if (display_output() && display_output()->graphical()) { - new_special(p + strlen(p), FG)->arg = sd->resetcolor.to_argb32(); + new_special(p + strlen(p), text_node_t::FG)->arg = + sd->resetcolor.to_argb32(); } #endif } diff --git a/src/specials.cc b/src/specials.cc index b45c3ef6f2..44cecbf370 100644 --- a/src/specials.cc +++ b/src/specials.cc @@ -46,7 +46,7 @@ #include "conky.h" #include "display-output.hh" -struct special_t *specials = nullptr; +struct special_node *specials = nullptr; int special_count; int graph_count = 0; @@ -354,8 +354,8 @@ bool scan_graph(struct text_object *obj, const char *argstr, double defscale) { * Printing various special text objects */ -struct special_t *new_special_t_node() { - auto *newnode = new special_t; +struct special_node *new_special_t_node() { + auto *newnode = new special_node; memset(newnode, 0, sizeof *newnode); return newnode; @@ -369,8 +369,8 @@ struct special_t *new_special_t_node() { * @param[in] t special type enum, e.g. alignc, alignr, fg, bg, ... * @return pointer to the newly inserted special of type t **/ -struct special_t *new_special(char *buf, enum special_types t) { - special_t *current; +struct special_node *new_special(char *buf, text_node_t t) { + special_node *current; buf[0] = SPECIAL_CHAR; buf[1] = '\0'; @@ -397,14 +397,14 @@ void new_gauge_in_shell(struct text_object *obj, char *p, #ifdef BUILD_GUI void new_gauge_in_gui(struct text_object *obj, char *buf, double usage) { - struct special_t *s = nullptr; + struct special_node *s = nullptr; auto *g = static_cast(obj->special_data); if (display_output() == nullptr || !display_output()->graphical()) { return; } if (g == nullptr) { return; } - s = new_special(buf, GAUGE); + s = new_special(buf, text_node_t::GAUGE); s->arg = usage; s->width = dpi_scale(g->width); @@ -439,14 +439,14 @@ void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size, #ifdef BUILD_GUI void new_font(struct text_object *obj, char *p, unsigned int p_max_size) { - struct special_t *s; + struct special_node *s; unsigned int tmp = selected_font; if (display_output() == nullptr || !display_output()->graphical()) { return; } if (p_max_size == 0) { return; } - s = new_special(p, FONT); + s = new_special(p, text_node_t::FONT); if (obj->data.s != nullptr) { if (s->font_added >= static_cast(fonts.size()) || @@ -463,7 +463,7 @@ void new_font(struct text_object *obj, char *p, unsigned int p_max_size) { /** * Adds value f to graph possibly truncating and scaling the graph **/ -static void graph_append(struct special_t *graph, double f, char showaslog) { +static void graph_append(struct special_node *graph, double f, char showaslog) { int i; /* do nothing if we don't even have a graph yet */ @@ -494,7 +494,7 @@ static void graph_append(struct special_t *graph, double f, char showaslog) { } } -void new_graph_in_shell(struct special_t *s, char *buf, int buf_max_size) { +void new_graph_in_shell(struct special_node *s, char *buf, int buf_max_size) { // Split config string on comma to avoid the hassle of dealing with the // idiosyncrasies of multi-byte unicode on different platforms. // TODO(brenden): Parse config string once and cache result. @@ -537,7 +537,7 @@ double *retrieve_graph(int graph_id, int graph_width) { } } -void store_graph(int graph_id, struct special_t *s) { +void store_graph(int graph_id, struct special_node *s) { if (s->graph == nullptr) { graphs[graph_id] = nullptr; } else { @@ -556,12 +556,12 @@ void store_graph(int graph_id, struct special_t *s) { **/ void new_graph(struct text_object *obj, char *buf, int buf_max_size, double val) { - struct special_t *s = nullptr; + struct special_node *s = nullptr; auto *g = static_cast(obj->special_data); if ((g == nullptr) || (buf_max_size == 0)) { return; } - s = new_special(buf, GRAPH); + s = new_special(buf, text_node_t::GRAPH); /* set graph (special) width to width in obj */ s->width = dpi_scale(g->width); @@ -628,7 +628,7 @@ void new_hr(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, HORIZONTAL_LINE)->height = dpi_scale(obj->data.l); + new_special(p, text_node_t::HORIZONTAL_LINE)->height = dpi_scale(obj->data.l); } void scan_stippled_hr(struct text_object *obj, const char *arg) { @@ -651,14 +651,14 @@ void scan_stippled_hr(struct text_object *obj, const char *arg) { void new_stippled_hr(struct text_object *obj, char *p, unsigned int p_max_size) { - struct special_t *s = nullptr; + struct special_node *s = nullptr; auto *sh = static_cast(obj->special_data); if (display_output() == nullptr || !display_output()->graphical()) { return; } if ((sh == nullptr) || (p_max_size == 0)) { return; } - s = new_special(p, STIPPLED_HR); + s = new_special(p, text_node_t::STIPPLED_HR); s->height = dpi_scale(sh->height); s->arg = dpi_scale(sh->arg); @@ -674,7 +674,7 @@ void new_fg(struct text_object *obj, char *p, unsigned int p_max_size) { || out_to_ncurses.get(*state) #endif /* BUILD_NCURSES */ ) { - new_special(p, FG)->arg = obj->data.l; + new_special(p, text_node_t::FG)->arg = obj->data.l; } UNUSED(obj); UNUSED(p); @@ -687,7 +687,7 @@ void new_bg(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, BG)->arg = obj->data.l; + new_special(p, text_node_t::BG)->arg = obj->data.l; } #endif /* BUILD_GUI */ @@ -716,14 +716,14 @@ static void new_bar_in_shell(struct text_object *obj, char *buffer, #ifdef BUILD_GUI static void new_bar_in_gui(struct text_object *obj, char *buf, double usage) { - struct special_t *s = nullptr; + struct special_node *s = nullptr; auto *b = static_cast(obj->special_data); if (display_output() == nullptr || !display_output()->graphical()) { return; } if (b == nullptr) { return; } - s = new_special(buf, BAR); + s = new_special(buf, text_node_t::BAR); s->arg = usage; s->width = dpi_scale(b->width); @@ -759,39 +759,39 @@ void new_bar(struct text_object *obj, char *p, unsigned int p_max_size, void new_outline(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, OUTLINE)->arg = obj->data.l; + new_special(p, text_node_t::OUTLINE)->arg = obj->data.l; } void new_offset(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, OFFSET)->arg = dpi_scale(obj->data.l); + new_special(p, text_node_t::OFFSET)->arg = dpi_scale(obj->data.l); } void new_voffset(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, VOFFSET)->arg = dpi_scale(obj->data.l); + new_special(p, text_node_t::VOFFSET)->arg = dpi_scale(obj->data.l); } void new_save_coordinates(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, SAVE_COORDINATES)->arg = obj->data.l; + new_special(p, text_node_t::SAVE_COORDINATES)->arg = obj->data.l; } void new_alignr(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, ALIGNR)->arg = dpi_scale(obj->data.l); + new_special(p, text_node_t::ALIGNR)->arg = dpi_scale(obj->data.l); } // A positive offset pushes the text further left void new_alignc(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, ALIGNC)->arg = dpi_scale(obj->data.l); + new_special(p, text_node_t::ALIGNC)->arg = dpi_scale(obj->data.l); } void new_goto(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } - new_special(p, GOTO)->arg = dpi_scale(obj->data.l); + new_special(p, text_node_t::GOTO)->arg = dpi_scale(obj->data.l); } void scan_tab(struct text_object *obj, const char *arg) { @@ -813,12 +813,12 @@ void scan_tab(struct text_object *obj, const char *arg) { } void new_tab(struct text_object *obj, char *p, unsigned int p_max_size) { - struct special_t *s = nullptr; + struct special_node *s = nullptr; auto *t = static_cast(obj->special_data); if ((t == nullptr) || (p_max_size == 0)) { return; } - s = new_special(p, TAB); + s = new_special(p, text_node_t::TAB); s->width = dpi_scale(t->width); s->arg = dpi_scale(t->arg); } diff --git a/src/specials.h b/src/specials.h index efbded2e5f..c2c9114d78 100644 --- a/src/specials.h +++ b/src/specials.h @@ -40,7 +40,7 @@ #define LOGGRAPH "-l" #define TEMPGRAD "-t" -enum special_types { +enum class text_node_t : uint32_t { NONSPECIAL = 0, HORIZONTAL_LINE = 1, STIPPLED_HR, @@ -59,9 +59,12 @@ enum special_types { GOTO, TAB }; +constexpr uint32_t operator*(text_node_t index) { + return static_cast(index); +} -struct special_t { - int type; +struct special_node { + text_node_t type; short height; short width; double arg; @@ -77,11 +80,11 @@ struct special_t { Colour last_colour; short font_added; char tempgrad; - struct special_t *next; + struct special_node *next; }; /* direct access to the registered specials (FIXME: bad encapsulation) */ -extern struct special_t *specials; +extern struct special_node *specials; extern int special_count; /* forward declare to avoid mutual inclusion between specials.h and @@ -119,6 +122,6 @@ void new_tab(struct text_object *, char *, unsigned int); void clear_stored_graphs(); -struct special_t *new_special(char *buf, enum special_types t); +struct special_node *new_special(char *buf, enum text_node_t t); #endif /* _SPECIALS_H */ diff --git a/src/text_object.h b/src/text_object.h index 3fb5f311e0..c21bb13b7b 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -34,6 +34,12 @@ #include "exec.h" #include "specials.h" /* enum special_types */ +enum class draw_mode_t : uint32_t { + BG = static_cast(text_node_t::BG), + FG = static_cast(text_node_t::FG), + OUTLINE = static_cast(text_node_t::OUTLINE), +}; + /* text object callbacks */ struct obj_cb { /* text object: print obj's output to p */ diff --git a/src/wl.h b/src/wl.h index 11be20fb36..6123680ddc 100644 --- a/src/wl.h +++ b/src/wl.h @@ -27,9 +27,15 @@ * */ -#if defined(BUILD_WAYLAND) && !defined(CONKY_WL_H) +#ifndef CONKY_WL_H #define CONKY_WL_H +#include "config.h" + +#ifndef BUILD_WAYLAND +#error wl.h included when BUILD_WAYLAND is disabled +#endif + #include #include "setting.hh" diff --git a/src/x11-color.cc b/src/x11-color.cc index fa2d45f3b9..7394e92f5c 100644 --- a/src/x11-color.cc +++ b/src/x11-color.cc @@ -45,1552 +45,51 @@ SOFTWARE. ******************************************************************/ -#include -#include +#include "colours.h" -typedef struct _builtinColor { - unsigned char red; - unsigned char green; - unsigned char blue; - unsigned short name; -} BuiltinColor; +#include -static const char BuiltinColorNames[] = { - "alice blue\0" - "AliceBlue\0" - "antique white\0" - "AntiqueWhite\0" - "AntiqueWhite1\0" - "AntiqueWhite2\0" - "AntiqueWhite3\0" - "AntiqueWhite4\0" - "aquamarine\0" - "aquamarine1\0" - "aquamarine2\0" - "aquamarine3\0" - "aquamarine4\0" - "azure\0" - "azure1\0" - "azure2\0" - "azure3\0" - "azure4\0" - "beige\0" - "bisque\0" - "bisque1\0" - "bisque2\0" - "bisque3\0" - "bisque4\0" - "black\0" - "blanched almond\0" - "BlanchedAlmond\0" - "blue\0" - "blue violet\0" - "blue1\0" - "blue2\0" - "blue3\0" - "blue4\0" - "BlueViolet\0" - "brown\0" - "brown1\0" - "brown2\0" - "brown3\0" - "brown4\0" - "burlywood\0" - "burlywood1\0" - "burlywood2\0" - "burlywood3\0" - "burlywood4\0" - "cadet blue\0" - "CadetBlue\0" - "CadetBlue1\0" - "CadetBlue2\0" - "CadetBlue3\0" - "CadetBlue4\0" - "chartreuse\0" - "chartreuse1\0" - "chartreuse2\0" - "chartreuse3\0" - "chartreuse4\0" - "chocolate\0" - "chocolate1\0" - "chocolate2\0" - "chocolate3\0" - "chocolate4\0" - "coral\0" - "coral1\0" - "coral2\0" - "coral3\0" - "coral4\0" - "cornflower blue\0" - "CornflowerBlue\0" - "cornsilk\0" - "cornsilk1\0" - "cornsilk2\0" - "cornsilk3\0" - "cornsilk4\0" - "cyan\0" - "cyan1\0" - "cyan2\0" - "cyan3\0" - "cyan4\0" - "dark blue\0" - "dark cyan\0" - "dark goldenrod\0" - "dark gray\0" - "dark green\0" - "dark grey\0" - "dark khaki\0" - "dark magenta\0" - "dark olive green\0" - "dark orange\0" - "dark orchid\0" - "dark red\0" - "dark salmon\0" - "dark sea green\0" - "dark slate blue\0" - "dark slate gray\0" - "dark slate grey\0" - "dark turquoise\0" - "dark violet\0" - "DarkBlue\0" - "DarkCyan\0" - "DarkGoldenrod\0" - "DarkGoldenrod1\0" - "DarkGoldenrod2\0" - "DarkGoldenrod3\0" - "DarkGoldenrod4\0" - "DarkGray\0" - "DarkGreen\0" - "DarkGrey\0" - "DarkKhaki\0" - "DarkMagenta\0" - "DarkOliveGreen\0" - "DarkOliveGreen1\0" - "DarkOliveGreen2\0" - "DarkOliveGreen3\0" - "DarkOliveGreen4\0" - "DarkOrange\0" - "DarkOrange1\0" - "DarkOrange2\0" - "DarkOrange3\0" - "DarkOrange4\0" - "DarkOrchid\0" - "DarkOrchid1\0" - "DarkOrchid2\0" - "DarkOrchid3\0" - "DarkOrchid4\0" - "DarkRed\0" - "DarkSalmon\0" - "DarkSeaGreen\0" - "DarkSeaGreen1\0" - "DarkSeaGreen2\0" - "DarkSeaGreen3\0" - "DarkSeaGreen4\0" - "DarkSlateBlue\0" - "DarkSlateGray\0" - "DarkSlateGray1\0" - "DarkSlateGray2\0" - "DarkSlateGray3\0" - "DarkSlateGray4\0" - "DarkSlateGrey\0" - "DarkTurquoise\0" - "DarkViolet\0" - "deep pink\0" - "deep sky blue\0" - "DeepPink\0" - "DeepPink1\0" - "DeepPink2\0" - "DeepPink3\0" - "DeepPink4\0" - "DeepSkyBlue\0" - "DeepSkyBlue1\0" - "DeepSkyBlue2\0" - "DeepSkyBlue3\0" - "DeepSkyBlue4\0" - "dim gray\0" - "dim grey\0" - "DimGray\0" - "DimGrey\0" - "dodger blue\0" - "DodgerBlue\0" - "DodgerBlue1\0" - "DodgerBlue2\0" - "DodgerBlue3\0" - "DodgerBlue4\0" - "firebrick\0" - "firebrick1\0" - "firebrick2\0" - "firebrick3\0" - "firebrick4\0" - "floral white\0" - "FloralWhite\0" - "forest green\0" - "ForestGreen\0" - "gainsboro\0" - "ghost white\0" - "GhostWhite\0" - "gold\0" - "gold1\0" - "gold2\0" - "gold3\0" - "gold4\0" - "goldenrod\0" - "goldenrod1\0" - "goldenrod2\0" - "goldenrod3\0" - "goldenrod4\0" - "gray\0" - "gray0\0" - "gray1\0" - "gray10\0" - "gray100\0" - "gray11\0" - "gray12\0" - "gray13\0" - "gray14\0" - "gray15\0" - "gray16\0" - "gray17\0" - "gray18\0" - "gray19\0" - "gray2\0" - "gray20\0" - "gray21\0" - "gray22\0" - "gray23\0" - "gray24\0" - "gray25\0" - "gray26\0" - "gray27\0" - "gray28\0" - "gray29\0" - "gray3\0" - "gray30\0" - "gray31\0" - "gray32\0" - "gray33\0" - "gray34\0" - "gray35\0" - "gray36\0" - "gray37\0" - "gray38\0" - "gray39\0" - "gray4\0" - "gray40\0" - "gray41\0" - "gray42\0" - "gray43\0" - "gray44\0" - "gray45\0" - "gray46\0" - "gray47\0" - "gray48\0" - "gray49\0" - "gray5\0" - "gray50\0" - "gray51\0" - "gray52\0" - "gray53\0" - "gray54\0" - "gray55\0" - "gray56\0" - "gray57\0" - "gray58\0" - "gray59\0" - "gray6\0" - "gray60\0" - "gray61\0" - "gray62\0" - "gray63\0" - "gray64\0" - "gray65\0" - "gray66\0" - "gray67\0" - "gray68\0" - "gray69\0" - "gray7\0" - "gray70\0" - "gray71\0" - "gray72\0" - "gray73\0" - "gray74\0" - "gray75\0" - "gray76\0" - "gray77\0" - "gray78\0" - "gray79\0" - "gray8\0" - "gray80\0" - "gray81\0" - "gray82\0" - "gray83\0" - "gray84\0" - "gray85\0" - "gray86\0" - "gray87\0" - "gray88\0" - "gray89\0" - "gray9\0" - "gray90\0" - "gray91\0" - "gray92\0" - "gray93\0" - "gray94\0" - "gray95\0" - "gray96\0" - "gray97\0" - "gray98\0" - "gray99\0" - "green\0" - "green yellow\0" - "green1\0" - "green2\0" - "green3\0" - "green4\0" - "GreenYellow\0" - "grey\0" - "grey0\0" - "grey1\0" - "grey10\0" - "grey100\0" - "grey11\0" - "grey12\0" - "grey13\0" - "grey14\0" - "grey15\0" - "grey16\0" - "grey17\0" - "grey18\0" - "grey19\0" - "grey2\0" - "grey20\0" - "grey21\0" - "grey22\0" - "grey23\0" - "grey24\0" - "grey25\0" - "grey26\0" - "grey27\0" - "grey28\0" - "grey29\0" - "grey3\0" - "grey30\0" - "grey31\0" - "grey32\0" - "grey33\0" - "grey34\0" - "grey35\0" - "grey36\0" - "grey37\0" - "grey38\0" - "grey39\0" - "grey4\0" - "grey40\0" - "grey41\0" - "grey42\0" - "grey43\0" - "grey44\0" - "grey45\0" - "grey46\0" - "grey47\0" - "grey48\0" - "grey49\0" - "grey5\0" - "grey50\0" - "grey51\0" - "grey52\0" - "grey53\0" - "grey54\0" - "grey55\0" - "grey56\0" - "grey57\0" - "grey58\0" - "grey59\0" - "grey6\0" - "grey60\0" - "grey61\0" - "grey62\0" - "grey63\0" - "grey64\0" - "grey65\0" - "grey66\0" - "grey67\0" - "grey68\0" - "grey69\0" - "grey7\0" - "grey70\0" - "grey71\0" - "grey72\0" - "grey73\0" - "grey74\0" - "grey75\0" - "grey76\0" - "grey77\0" - "grey78\0" - "grey79\0" - "grey8\0" - "grey80\0" - "grey81\0" - "grey82\0" - "grey83\0" - "grey84\0" - "grey85\0" - "grey86\0" - "grey87\0" - "grey88\0" - "grey89\0" - "grey9\0" - "grey90\0" - "grey91\0" - "grey92\0" - "grey93\0" - "grey94\0" - "grey95\0" - "grey96\0" - "grey97\0" - "grey98\0" - "grey99\0" - "honeydew\0" - "honeydew1\0" - "honeydew2\0" - "honeydew3\0" - "honeydew4\0" - "hot pink\0" - "HotPink\0" - "HotPink1\0" - "HotPink2\0" - "HotPink3\0" - "HotPink4\0" - "indian red\0" - "IndianRed\0" - "IndianRed1\0" - "IndianRed2\0" - "IndianRed3\0" - "IndianRed4\0" - "ivory\0" - "ivory1\0" - "ivory2\0" - "ivory3\0" - "ivory4\0" - "khaki\0" - "khaki1\0" - "khaki2\0" - "khaki3\0" - "khaki4\0" - "lavender\0" - "lavender blush\0" - "LavenderBlush\0" - "LavenderBlush1\0" - "LavenderBlush2\0" - "LavenderBlush3\0" - "LavenderBlush4\0" - "lawn green\0" - "LawnGreen\0" - "lemon chiffon\0" - "LemonChiffon\0" - "LemonChiffon1\0" - "LemonChiffon2\0" - "LemonChiffon3\0" - "LemonChiffon4\0" - "light blue\0" - "light coral\0" - "light cyan\0" - "light goldenrod\0" - "light goldenrod yellow\0" - "light gray\0" - "light green\0" - "light grey\0" - "light pink\0" - "light salmon\0" - "light sea green\0" - "light sky blue\0" - "light slate blue\0" - "light slate gray\0" - "light slate grey\0" - "light steel blue\0" - "light yellow\0" - "LightBlue\0" - "LightBlue1\0" - "LightBlue2\0" - "LightBlue3\0" - "LightBlue4\0" - "LightCoral\0" - "LightCyan\0" - "LightCyan1\0" - "LightCyan2\0" - "LightCyan3\0" - "LightCyan4\0" - "LightGoldenrod\0" - "LightGoldenrod1\0" - "LightGoldenrod2\0" - "LightGoldenrod3\0" - "LightGoldenrod4\0" - "LightGoldenrodYellow\0" - "LightGray\0" - "LightGreen\0" - "LightGrey\0" - "LightPink\0" - "LightPink1\0" - "LightPink2\0" - "LightPink3\0" - "LightPink4\0" - "LightSalmon\0" - "LightSalmon1\0" - "LightSalmon2\0" - "LightSalmon3\0" - "LightSalmon4\0" - "LightSeaGreen\0" - "LightSkyBlue\0" - "LightSkyBlue1\0" - "LightSkyBlue2\0" - "LightSkyBlue3\0" - "LightSkyBlue4\0" - "LightSlateBlue\0" - "LightSlateGray\0" - "LightSlateGrey\0" - "LightSteelBlue\0" - "LightSteelBlue1\0" - "LightSteelBlue2\0" - "LightSteelBlue3\0" - "LightSteelBlue4\0" - "LightYellow\0" - "LightYellow1\0" - "LightYellow2\0" - "LightYellow3\0" - "LightYellow4\0" - "lime green\0" - "LimeGreen\0" - "linen\0" - "magenta\0" - "magenta1\0" - "magenta2\0" - "magenta3\0" - "magenta4\0" - "maroon\0" - "maroon1\0" - "maroon2\0" - "maroon3\0" - "maroon4\0" - "medium aquamarine\0" - "medium blue\0" - "medium orchid\0" - "medium purple\0" - "medium sea green\0" - "medium slate blue\0" - "medium spring green\0" - "medium turquoise\0" - "medium violet red\0" - "MediumAquamarine\0" - "MediumBlue\0" - "MediumOrchid\0" - "MediumOrchid1\0" - "MediumOrchid2\0" - "MediumOrchid3\0" - "MediumOrchid4\0" - "MediumPurple\0" - "MediumPurple1\0" - "MediumPurple2\0" - "MediumPurple3\0" - "MediumPurple4\0" - "MediumSeaGreen\0" - "MediumSlateBlue\0" - "MediumSpringGreen\0" - "MediumTurquoise\0" - "MediumVioletRed\0" - "midnight blue\0" - "MidnightBlue\0" - "mint cream\0" - "MintCream\0" - "misty rose\0" - "MistyRose\0" - "MistyRose1\0" - "MistyRose2\0" - "MistyRose3\0" - "MistyRose4\0" - "moccasin\0" - "navajo white\0" - "NavajoWhite\0" - "NavajoWhite1\0" - "NavajoWhite2\0" - "NavajoWhite3\0" - "NavajoWhite4\0" - "navy\0" - "navy blue\0" - "NavyBlue\0" - "old lace\0" - "OldLace\0" - "olive drab\0" - "OliveDrab\0" - "OliveDrab1\0" - "OliveDrab2\0" - "OliveDrab3\0" - "OliveDrab4\0" - "orange\0" - "orange red\0" - "orange1\0" - "orange2\0" - "orange3\0" - "orange4\0" - "OrangeRed\0" - "OrangeRed1\0" - "OrangeRed2\0" - "OrangeRed3\0" - "OrangeRed4\0" - "orchid\0" - "orchid1\0" - "orchid2\0" - "orchid3\0" - "orchid4\0" - "pale goldenrod\0" - "pale green\0" - "pale turquoise\0" - "pale violet red\0" - "PaleGoldenrod\0" - "PaleGreen\0" - "PaleGreen1\0" - "PaleGreen2\0" - "PaleGreen3\0" - "PaleGreen4\0" - "PaleTurquoise\0" - "PaleTurquoise1\0" - "PaleTurquoise2\0" - "PaleTurquoise3\0" - "PaleTurquoise4\0" - "PaleVioletRed\0" - "PaleVioletRed1\0" - "PaleVioletRed2\0" - "PaleVioletRed3\0" - "PaleVioletRed4\0" - "papaya whip\0" - "PapayaWhip\0" - "peach puff\0" - "PeachPuff\0" - "PeachPuff1\0" - "PeachPuff2\0" - "PeachPuff3\0" - "PeachPuff4\0" - "peru\0" - "pink\0" - "pink1\0" - "pink2\0" - "pink3\0" - "pink4\0" - "plum\0" - "plum1\0" - "plum2\0" - "plum3\0" - "plum4\0" - "powder blue\0" - "PowderBlue\0" - "purple\0" - "purple1\0" - "purple2\0" - "purple3\0" - "purple4\0" - "red\0" - "red1\0" - "red2\0" - "red3\0" - "red4\0" - "rosy brown\0" - "RosyBrown\0" - "RosyBrown1\0" - "RosyBrown2\0" - "RosyBrown3\0" - "RosyBrown4\0" - "royal blue\0" - "RoyalBlue\0" - "RoyalBlue1\0" - "RoyalBlue2\0" - "RoyalBlue3\0" - "RoyalBlue4\0" - "saddle brown\0" - "SaddleBrown\0" - "salmon\0" - "salmon1\0" - "salmon2\0" - "salmon3\0" - "salmon4\0" - "sandy brown\0" - "SandyBrown\0" - "sea green\0" - "SeaGreen\0" - "SeaGreen1\0" - "SeaGreen2\0" - "SeaGreen3\0" - "SeaGreen4\0" - "seashell\0" - "seashell1\0" - "seashell2\0" - "seashell3\0" - "seashell4\0" - "sienna\0" - "sienna1\0" - "sienna2\0" - "sienna3\0" - "sienna4\0" - "sky blue\0" - "SkyBlue\0" - "SkyBlue1\0" - "SkyBlue2\0" - "SkyBlue3\0" - "SkyBlue4\0" - "slate blue\0" - "slate gray\0" - "slate grey\0" - "SlateBlue\0" - "SlateBlue1\0" - "SlateBlue2\0" - "SlateBlue3\0" - "SlateBlue4\0" - "SlateGray\0" - "SlateGray1\0" - "SlateGray2\0" - "SlateGray3\0" - "SlateGray4\0" - "SlateGrey\0" - "snow\0" - "snow1\0" - "snow2\0" - "snow3\0" - "snow4\0" - "spring green\0" - "SpringGreen\0" - "SpringGreen1\0" - "SpringGreen2\0" - "SpringGreen3\0" - "SpringGreen4\0" - "steel blue\0" - "SteelBlue\0" - "SteelBlue1\0" - "SteelBlue2\0" - "SteelBlue3\0" - "SteelBlue4\0" - "tan\0" - "tan1\0" - "tan2\0" - "tan3\0" - "tan4\0" - "thistle\0" - "thistle1\0" - "thistle2\0" - "thistle3\0" - "thistle4\0" - "tomato\0" - "tomato1\0" - "tomato2\0" - "tomato3\0" - "tomato4\0" - "turquoise\0" - "turquoise1\0" - "turquoise2\0" - "turquoise3\0" - "turquoise4\0" - "violet\0" - "violet red\0" - "VioletRed\0" - "VioletRed1\0" - "VioletRed2\0" - "VioletRed3\0" - "VioletRed4\0" - "wheat\0" - "wheat1\0" - "wheat2\0" - "wheat3\0" - "wheat4\0" - "white\0" - "white smoke\0" - "WhiteSmoke\0" - "yellow\0" - "yellow green\0" - "yellow1\0" - "yellow2\0" - "yellow3\0" - "yellow4\0" - "YellowGreen\0"}; +#include +#include -static const BuiltinColor BuiltinColors[] = { - {240, 248, 255, 0}, /* alice blue */ - {240, 248, 255, 11}, /* AliceBlue */ - {250, 235, 215, 21}, /* antique white */ - {250, 235, 215, 35}, /* AntiqueWhite */ - {255, 239, 219, 48}, /* AntiqueWhite1 */ - {238, 223, 204, 62}, /* AntiqueWhite2 */ - {205, 192, 176, 76}, /* AntiqueWhite3 */ - {139, 131, 120, 90}, /* AntiqueWhite4 */ - {127, 255, 212, 104}, /* aquamarine */ - {127, 255, 212, 115}, /* aquamarine1 */ - {118, 238, 198, 127}, /* aquamarine2 */ - {102, 205, 170, 139}, /* aquamarine3 */ - {69, 139, 116, 151}, /* aquamarine4 */ - {240, 255, 255, 163}, /* azure */ - {240, 255, 255, 169}, /* azure1 */ - {224, 238, 238, 176}, /* azure2 */ - {193, 205, 205, 183}, /* azure3 */ - {131, 139, 139, 190}, /* azure4 */ - {245, 245, 220, 197}, /* beige */ - {255, 228, 196, 203}, /* bisque */ - {255, 228, 196, 210}, /* bisque1 */ - {238, 213, 183, 218}, /* bisque2 */ - {205, 183, 158, 226}, /* bisque3 */ - {139, 125, 107, 234}, /* bisque4 */ - {0, 0, 0, 242}, /* black */ - {255, 235, 205, 248}, /* blanched almond */ - {255, 235, 205, 264}, /* BlanchedAlmond */ - {0, 0, 255, 279}, /* blue */ - {138, 43, 226, 284}, /* blue violet */ - {0, 0, 255, 296}, /* blue1 */ - {0, 0, 238, 302}, /* blue2 */ - {0, 0, 205, 308}, /* blue3 */ - {0, 0, 139, 314}, /* blue4 */ - {138, 43, 226, 320}, /* BlueViolet */ - {165, 42, 42, 331}, /* brown */ - {255, 64, 64, 337}, /* brown1 */ - {238, 59, 59, 344}, /* brown2 */ - {205, 51, 51, 351}, /* brown3 */ - {139, 35, 35, 358}, /* brown4 */ - {222, 184, 135, 365}, /* burlywood */ - {255, 211, 155, 375}, /* burlywood1 */ - {238, 197, 145, 386}, /* burlywood2 */ - {205, 170, 125, 397}, /* burlywood3 */ - {139, 115, 85, 408}, /* burlywood4 */ - {95, 158, 160, 419}, /* cadet blue */ - {95, 158, 160, 430}, /* CadetBlue */ - {152, 245, 255, 440}, /* CadetBlue1 */ - {142, 229, 238, 451}, /* CadetBlue2 */ - {122, 197, 205, 462}, /* CadetBlue3 */ - {83, 134, 139, 473}, /* CadetBlue4 */ - {127, 255, 0, 484}, /* chartreuse */ - {127, 255, 0, 495}, /* chartreuse1 */ - {118, 238, 0, 507}, /* chartreuse2 */ - {102, 205, 0, 519}, /* chartreuse3 */ - {69, 139, 0, 531}, /* chartreuse4 */ - {210, 105, 30, 543}, /* chocolate */ - {255, 127, 36, 553}, /* chocolate1 */ - {238, 118, 33, 564}, /* chocolate2 */ - {205, 102, 29, 575}, /* chocolate3 */ - {139, 69, 19, 586}, /* chocolate4 */ - {255, 127, 80, 597}, /* coral */ - {255, 114, 86, 603}, /* coral1 */ - {238, 106, 80, 610}, /* coral2 */ - {205, 91, 69, 617}, /* coral3 */ - {139, 62, 47, 624}, /* coral4 */ - {100, 149, 237, 631}, /* cornflower blue */ - {100, 149, 237, 647}, /* CornflowerBlue */ - {255, 248, 220, 662}, /* cornsilk */ - {255, 248, 220, 671}, /* cornsilk1 */ - {238, 232, 205, 681}, /* cornsilk2 */ - {205, 200, 177, 691}, /* cornsilk3 */ - {139, 136, 120, 701}, /* cornsilk4 */ - {0, 255, 255, 711}, /* cyan */ - {0, 255, 255, 716}, /* cyan1 */ - {0, 238, 238, 722}, /* cyan2 */ - {0, 205, 205, 728}, /* cyan3 */ - {0, 139, 139, 734}, /* cyan4 */ - {0, 0, 139, 740}, /* dark blue */ - {0, 139, 139, 750}, /* dark cyan */ - {184, 134, 11, 760}, /* dark goldenrod */ - {169, 169, 169, 775}, /* dark gray */ - {0, 100, 0, 785}, /* dark green */ - {169, 169, 169, 796}, /* dark grey */ - {189, 183, 107, 806}, /* dark khaki */ - {139, 0, 139, 817}, /* dark magenta */ - {85, 107, 47, 830}, /* dark olive green */ - {255, 140, 0, 847}, /* dark orange */ - {153, 50, 204, 859}, /* dark orchid */ - {139, 0, 0, 871}, /* dark red */ - {233, 150, 122, 880}, /* dark salmon */ - {143, 188, 143, 892}, /* dark sea green */ - {72, 61, 139, 907}, /* dark slate blue */ - {47, 79, 79, 923}, /* dark slate gray */ - {47, 79, 79, 939}, /* dark slate grey */ - {0, 206, 209, 955}, /* dark turquoise */ - {148, 0, 211, 970}, /* dark violet */ - {0, 0, 139, 982}, /* DarkBlue */ - {0, 139, 139, 991}, /* DarkCyan */ - {184, 134, 11, 1000}, /* DarkGoldenrod */ - {255, 185, 15, 1014}, /* DarkGoldenrod1 */ - {238, 173, 14, 1029}, /* DarkGoldenrod2 */ - {205, 149, 12, 1044}, /* DarkGoldenrod3 */ - {139, 101, 8, 1059}, /* DarkGoldenrod4 */ - {169, 169, 169, 1074}, /* DarkGray */ - {0, 100, 0, 1083}, /* DarkGreen */ - {169, 169, 169, 1093}, /* DarkGrey */ - {189, 183, 107, 1102}, /* DarkKhaki */ - {139, 0, 139, 1112}, /* DarkMagenta */ - {85, 107, 47, 1124}, /* DarkOliveGreen */ - {202, 255, 112, 1139}, /* DarkOliveGreen1 */ - {188, 238, 104, 1155}, /* DarkOliveGreen2 */ - {162, 205, 90, 1171}, /* DarkOliveGreen3 */ - {110, 139, 61, 1187}, /* DarkOliveGreen4 */ - {255, 140, 0, 1203}, /* DarkOrange */ - {255, 127, 0, 1214}, /* DarkOrange1 */ - {238, 118, 0, 1226}, /* DarkOrange2 */ - {205, 102, 0, 1238}, /* DarkOrange3 */ - {139, 69, 0, 1250}, /* DarkOrange4 */ - {153, 50, 204, 1262}, /* DarkOrchid */ - {191, 62, 255, 1273}, /* DarkOrchid1 */ - {178, 58, 238, 1285}, /* DarkOrchid2 */ - {154, 50, 205, 1297}, /* DarkOrchid3 */ - {104, 34, 139, 1309}, /* DarkOrchid4 */ - {139, 0, 0, 1321}, /* DarkRed */ - {233, 150, 122, 1329}, /* DarkSalmon */ - {143, 188, 143, 1340}, /* DarkSeaGreen */ - {193, 255, 193, 1353}, /* DarkSeaGreen1 */ - {180, 238, 180, 1367}, /* DarkSeaGreen2 */ - {155, 205, 155, 1381}, /* DarkSeaGreen3 */ - {105, 139, 105, 1395}, /* DarkSeaGreen4 */ - {72, 61, 139, 1409}, /* DarkSlateBlue */ - {47, 79, 79, 1423}, /* DarkSlateGray */ - {151, 255, 255, 1437}, /* DarkSlateGray1 */ - {141, 238, 238, 1452}, /* DarkSlateGray2 */ - {121, 205, 205, 1467}, /* DarkSlateGray3 */ - {82, 139, 139, 1482}, /* DarkSlateGray4 */ - {47, 79, 79, 1497}, /* DarkSlateGrey */ - {0, 206, 209, 1511}, /* DarkTurquoise */ - {148, 0, 211, 1525}, /* DarkViolet */ - {255, 20, 147, 1536}, /* deep pink */ - {0, 191, 255, 1546}, /* deep sky blue */ - {255, 20, 147, 1560}, /* DeepPink */ - {255, 20, 147, 1569}, /* DeepPink1 */ - {238, 18, 137, 1579}, /* DeepPink2 */ - {205, 16, 118, 1589}, /* DeepPink3 */ - {139, 10, 80, 1599}, /* DeepPink4 */ - {0, 191, 255, 1609}, /* DeepSkyBlue */ - {0, 191, 255, 1621}, /* DeepSkyBlue1 */ - {0, 178, 238, 1634}, /* DeepSkyBlue2 */ - {0, 154, 205, 1647}, /* DeepSkyBlue3 */ - {0, 104, 139, 1660}, /* DeepSkyBlue4 */ - {105, 105, 105, 1673}, /* dim gray */ - {105, 105, 105, 1682}, /* dim grey */ - {105, 105, 105, 1691}, /* DimGray */ - {105, 105, 105, 1699}, /* DimGrey */ - {30, 144, 255, 1707}, /* dodger blue */ - {30, 144, 255, 1719}, /* DodgerBlue */ - {30, 144, 255, 1730}, /* DodgerBlue1 */ - {28, 134, 238, 1742}, /* DodgerBlue2 */ - {24, 116, 205, 1754}, /* DodgerBlue3 */ - {16, 78, 139, 1766}, /* DodgerBlue4 */ - {178, 34, 34, 1778}, /* firebrick */ - {255, 48, 48, 1788}, /* firebrick1 */ - {238, 44, 44, 1799}, /* firebrick2 */ - {205, 38, 38, 1810}, /* firebrick3 */ - {139, 26, 26, 1821}, /* firebrick4 */ - {255, 250, 240, 1832}, /* floral white */ - {255, 250, 240, 1845}, /* FloralWhite */ - {34, 139, 34, 1857}, /* forest green */ - {34, 139, 34, 1870}, /* ForestGreen */ - {220, 220, 220, 1882}, /* gainsboro */ - {248, 248, 255, 1892}, /* ghost white */ - {248, 248, 255, 1904}, /* GhostWhite */ - {255, 215, 0, 1915}, /* gold */ - {255, 215, 0, 1920}, /* gold1 */ - {238, 201, 0, 1926}, /* gold2 */ - {205, 173, 0, 1932}, /* gold3 */ - {139, 117, 0, 1938}, /* gold4 */ - {218, 165, 32, 1944}, /* goldenrod */ - {255, 193, 37, 1954}, /* goldenrod1 */ - {238, 180, 34, 1965}, /* goldenrod2 */ - {205, 155, 29, 1976}, /* goldenrod3 */ - {139, 105, 20, 1987}, /* goldenrod4 */ - {190, 190, 190, 1998}, /* gray */ - {0, 0, 0, 2003}, /* gray0 */ - {3, 3, 3, 2009}, /* gray1 */ - {26, 26, 26, 2015}, /* gray10 */ - {255, 255, 255, 2022}, /* gray100 */ - {28, 28, 28, 2030}, /* gray11 */ - {31, 31, 31, 2037}, /* gray12 */ - {33, 33, 33, 2044}, /* gray13 */ - {36, 36, 36, 2051}, /* gray14 */ - {38, 38, 38, 2058}, /* gray15 */ - {41, 41, 41, 2065}, /* gray16 */ - {43, 43, 43, 2072}, /* gray17 */ - {46, 46, 46, 2079}, /* gray18 */ - {48, 48, 48, 2086}, /* gray19 */ - {5, 5, 5, 2093}, /* gray2 */ - {51, 51, 51, 2099}, /* gray20 */ - {54, 54, 54, 2106}, /* gray21 */ - {56, 56, 56, 2113}, /* gray22 */ - {59, 59, 59, 2120}, /* gray23 */ - {61, 61, 61, 2127}, /* gray24 */ - {64, 64, 64, 2134}, /* gray25 */ - {66, 66, 66, 2141}, /* gray26 */ - {69, 69, 69, 2148}, /* gray27 */ - {71, 71, 71, 2155}, /* gray28 */ - {74, 74, 74, 2162}, /* gray29 */ - {8, 8, 8, 2169}, /* gray3 */ - {77, 77, 77, 2175}, /* gray30 */ - {79, 79, 79, 2182}, /* gray31 */ - {82, 82, 82, 2189}, /* gray32 */ - {84, 84, 84, 2196}, /* gray33 */ - {87, 87, 87, 2203}, /* gray34 */ - {89, 89, 89, 2210}, /* gray35 */ - {92, 92, 92, 2217}, /* gray36 */ - {94, 94, 94, 2224}, /* gray37 */ - {97, 97, 97, 2231}, /* gray38 */ - {99, 99, 99, 2238}, /* gray39 */ - {10, 10, 10, 2245}, /* gray4 */ - {102, 102, 102, 2251}, /* gray40 */ - {105, 105, 105, 2258}, /* gray41 */ - {107, 107, 107, 2265}, /* gray42 */ - {110, 110, 110, 2272}, /* gray43 */ - {112, 112, 112, 2279}, /* gray44 */ - {115, 115, 115, 2286}, /* gray45 */ - {117, 117, 117, 2293}, /* gray46 */ - {120, 120, 120, 2300}, /* gray47 */ - {122, 122, 122, 2307}, /* gray48 */ - {125, 125, 125, 2314}, /* gray49 */ - {13, 13, 13, 2321}, /* gray5 */ - {127, 127, 127, 2327}, /* gray50 */ - {130, 130, 130, 2334}, /* gray51 */ - {133, 133, 133, 2341}, /* gray52 */ - {135, 135, 135, 2348}, /* gray53 */ - {138, 138, 138, 2355}, /* gray54 */ - {140, 140, 140, 2362}, /* gray55 */ - {143, 143, 143, 2369}, /* gray56 */ - {145, 145, 145, 2376}, /* gray57 */ - {148, 148, 148, 2383}, /* gray58 */ - {150, 150, 150, 2390}, /* gray59 */ - {15, 15, 15, 2397}, /* gray6 */ - {153, 153, 153, 2403}, /* gray60 */ - {156, 156, 156, 2410}, /* gray61 */ - {158, 158, 158, 2417}, /* gray62 */ - {161, 161, 161, 2424}, /* gray63 */ - {163, 163, 163, 2431}, /* gray64 */ - {166, 166, 166, 2438}, /* gray65 */ - {168, 168, 168, 2445}, /* gray66 */ - {171, 171, 171, 2452}, /* gray67 */ - {173, 173, 173, 2459}, /* gray68 */ - {176, 176, 176, 2466}, /* gray69 */ - {18, 18, 18, 2473}, /* gray7 */ - {179, 179, 179, 2479}, /* gray70 */ - {181, 181, 181, 2486}, /* gray71 */ - {184, 184, 184, 2493}, /* gray72 */ - {186, 186, 186, 2500}, /* gray73 */ - {189, 189, 189, 2507}, /* gray74 */ - {191, 191, 191, 2514}, /* gray75 */ - {194, 194, 194, 2521}, /* gray76 */ - {196, 196, 196, 2528}, /* gray77 */ - {199, 199, 199, 2535}, /* gray78 */ - {201, 201, 201, 2542}, /* gray79 */ - {20, 20, 20, 2549}, /* gray8 */ - {204, 204, 204, 2555}, /* gray80 */ - {207, 207, 207, 2562}, /* gray81 */ - {209, 209, 209, 2569}, /* gray82 */ - {212, 212, 212, 2576}, /* gray83 */ - {214, 214, 214, 2583}, /* gray84 */ - {217, 217, 217, 2590}, /* gray85 */ - {219, 219, 219, 2597}, /* gray86 */ - {222, 222, 222, 2604}, /* gray87 */ - {224, 224, 224, 2611}, /* gray88 */ - {227, 227, 227, 2618}, /* gray89 */ - {23, 23, 23, 2625}, /* gray9 */ - {229, 229, 229, 2631}, /* gray90 */ - {232, 232, 232, 2638}, /* gray91 */ - {235, 235, 235, 2645}, /* gray92 */ - {237, 237, 237, 2652}, /* gray93 */ - {240, 240, 240, 2659}, /* gray94 */ - {242, 242, 242, 2666}, /* gray95 */ - {245, 245, 245, 2673}, /* gray96 */ - {247, 247, 247, 2680}, /* gray97 */ - {250, 250, 250, 2687}, /* gray98 */ - {252, 252, 252, 2694}, /* gray99 */ - {0, 255, 0, 2701}, /* green */ - {173, 255, 47, 2707}, /* green yellow */ - {0, 255, 0, 2720}, /* green1 */ - {0, 238, 0, 2727}, /* green2 */ - {0, 205, 0, 2734}, /* green3 */ - {0, 139, 0, 2741}, /* green4 */ - {173, 255, 47, 2748}, /* GreenYellow */ - {190, 190, 190, 2760}, /* grey */ - {0, 0, 0, 2765}, /* grey0 */ - {3, 3, 3, 2771}, /* grey1 */ - {26, 26, 26, 2777}, /* grey10 */ - {255, 255, 255, 2784}, /* grey100 */ - {28, 28, 28, 2792}, /* grey11 */ - {31, 31, 31, 2799}, /* grey12 */ - {33, 33, 33, 2806}, /* grey13 */ - {36, 36, 36, 2813}, /* grey14 */ - {38, 38, 38, 2820}, /* grey15 */ - {41, 41, 41, 2827}, /* grey16 */ - {43, 43, 43, 2834}, /* grey17 */ - {46, 46, 46, 2841}, /* grey18 */ - {48, 48, 48, 2848}, /* grey19 */ - {5, 5, 5, 2855}, /* grey2 */ - {51, 51, 51, 2861}, /* grey20 */ - {54, 54, 54, 2868}, /* grey21 */ - {56, 56, 56, 2875}, /* grey22 */ - {59, 59, 59, 2882}, /* grey23 */ - {61, 61, 61, 2889}, /* grey24 */ - {64, 64, 64, 2896}, /* grey25 */ - {66, 66, 66, 2903}, /* grey26 */ - {69, 69, 69, 2910}, /* grey27 */ - {71, 71, 71, 2917}, /* grey28 */ - {74, 74, 74, 2924}, /* grey29 */ - {8, 8, 8, 2931}, /* grey3 */ - {77, 77, 77, 2937}, /* grey30 */ - {79, 79, 79, 2944}, /* grey31 */ - {82, 82, 82, 2951}, /* grey32 */ - {84, 84, 84, 2958}, /* grey33 */ - {87, 87, 87, 2965}, /* grey34 */ - {89, 89, 89, 2972}, /* grey35 */ - {92, 92, 92, 2979}, /* grey36 */ - {94, 94, 94, 2986}, /* grey37 */ - {97, 97, 97, 2993}, /* grey38 */ - {99, 99, 99, 3000}, /* grey39 */ - {10, 10, 10, 3007}, /* grey4 */ - {102, 102, 102, 3013}, /* grey40 */ - {105, 105, 105, 3020}, /* grey41 */ - {107, 107, 107, 3027}, /* grey42 */ - {110, 110, 110, 3034}, /* grey43 */ - {112, 112, 112, 3041}, /* grey44 */ - {115, 115, 115, 3048}, /* grey45 */ - {117, 117, 117, 3055}, /* grey46 */ - {120, 120, 120, 3062}, /* grey47 */ - {122, 122, 122, 3069}, /* grey48 */ - {125, 125, 125, 3076}, /* grey49 */ - {13, 13, 13, 3083}, /* grey5 */ - {127, 127, 127, 3089}, /* grey50 */ - {130, 130, 130, 3096}, /* grey51 */ - {133, 133, 133, 3103}, /* grey52 */ - {135, 135, 135, 3110}, /* grey53 */ - {138, 138, 138, 3117}, /* grey54 */ - {140, 140, 140, 3124}, /* grey55 */ - {143, 143, 143, 3131}, /* grey56 */ - {145, 145, 145, 3138}, /* grey57 */ - {148, 148, 148, 3145}, /* grey58 */ - {150, 150, 150, 3152}, /* grey59 */ - {15, 15, 15, 3159}, /* grey6 */ - {153, 153, 153, 3165}, /* grey60 */ - {156, 156, 156, 3172}, /* grey61 */ - {158, 158, 158, 3179}, /* grey62 */ - {161, 161, 161, 3186}, /* grey63 */ - {163, 163, 163, 3193}, /* grey64 */ - {166, 166, 166, 3200}, /* grey65 */ - {168, 168, 168, 3207}, /* grey66 */ - {171, 171, 171, 3214}, /* grey67 */ - {173, 173, 173, 3221}, /* grey68 */ - {176, 176, 176, 3228}, /* grey69 */ - {18, 18, 18, 3235}, /* grey7 */ - {179, 179, 179, 3241}, /* grey70 */ - {181, 181, 181, 3248}, /* grey71 */ - {184, 184, 184, 3255}, /* grey72 */ - {186, 186, 186, 3262}, /* grey73 */ - {189, 189, 189, 3269}, /* grey74 */ - {191, 191, 191, 3276}, /* grey75 */ - {194, 194, 194, 3283}, /* grey76 */ - {196, 196, 196, 3290}, /* grey77 */ - {199, 199, 199, 3297}, /* grey78 */ - {201, 201, 201, 3304}, /* grey79 */ - {20, 20, 20, 3311}, /* grey8 */ - {204, 204, 204, 3317}, /* grey80 */ - {207, 207, 207, 3324}, /* grey81 */ - {209, 209, 209, 3331}, /* grey82 */ - {212, 212, 212, 3338}, /* grey83 */ - {214, 214, 214, 3345}, /* grey84 */ - {217, 217, 217, 3352}, /* grey85 */ - {219, 219, 219, 3359}, /* grey86 */ - {222, 222, 222, 3366}, /* grey87 */ - {224, 224, 224, 3373}, /* grey88 */ - {227, 227, 227, 3380}, /* grey89 */ - {23, 23, 23, 3387}, /* grey9 */ - {229, 229, 229, 3393}, /* grey90 */ - {232, 232, 232, 3400}, /* grey91 */ - {235, 235, 235, 3407}, /* grey92 */ - {237, 237, 237, 3414}, /* grey93 */ - {240, 240, 240, 3421}, /* grey94 */ - {242, 242, 242, 3428}, /* grey95 */ - {245, 245, 245, 3435}, /* grey96 */ - {247, 247, 247, 3442}, /* grey97 */ - {250, 250, 250, 3449}, /* grey98 */ - {252, 252, 252, 3456}, /* grey99 */ - {240, 255, 240, 3463}, /* honeydew */ - {240, 255, 240, 3472}, /* honeydew1 */ - {224, 238, 224, 3482}, /* honeydew2 */ - {193, 205, 193, 3492}, /* honeydew3 */ - {131, 139, 131, 3502}, /* honeydew4 */ - {255, 105, 180, 3512}, /* hot pink */ - {255, 105, 180, 3521}, /* HotPink */ - {255, 110, 180, 3529}, /* HotPink1 */ - {238, 106, 167, 3538}, /* HotPink2 */ - {205, 96, 144, 3547}, /* HotPink3 */ - {139, 58, 98, 3556}, /* HotPink4 */ - {205, 92, 92, 3565}, /* indian red */ - {205, 92, 92, 3576}, /* IndianRed */ - {255, 106, 106, 3586}, /* IndianRed1 */ - {238, 99, 99, 3597}, /* IndianRed2 */ - {205, 85, 85, 3608}, /* IndianRed3 */ - {139, 58, 58, 3619}, /* IndianRed4 */ - {255, 255, 240, 3630}, /* ivory */ - {255, 255, 240, 3636}, /* ivory1 */ - {238, 238, 224, 3643}, /* ivory2 */ - {205, 205, 193, 3650}, /* ivory3 */ - {139, 139, 131, 3657}, /* ivory4 */ - {240, 230, 140, 3664}, /* khaki */ - {255, 246, 143, 3670}, /* khaki1 */ - {238, 230, 133, 3677}, /* khaki2 */ - {205, 198, 115, 3684}, /* khaki3 */ - {139, 134, 78, 3691}, /* khaki4 */ - {230, 230, 250, 3698}, /* lavender */ - {255, 240, 245, 3707}, /* lavender blush */ - {255, 240, 245, 3722}, /* LavenderBlush */ - {255, 240, 245, 3736}, /* LavenderBlush1 */ - {238, 224, 229, 3751}, /* LavenderBlush2 */ - {205, 193, 197, 3766}, /* LavenderBlush3 */ - {139, 131, 134, 3781}, /* LavenderBlush4 */ - {124, 252, 0, 3796}, /* lawn green */ - {124, 252, 0, 3807}, /* LawnGreen */ - {255, 250, 205, 3817}, /* lemon chiffon */ - {255, 250, 205, 3831}, /* LemonChiffon */ - {255, 250, 205, 3844}, /* LemonChiffon1 */ - {238, 233, 191, 3858}, /* LemonChiffon2 */ - {205, 201, 165, 3872}, /* LemonChiffon3 */ - {139, 137, 112, 3886}, /* LemonChiffon4 */ - {173, 216, 230, 3900}, /* light blue */ - {240, 128, 128, 3911}, /* light coral */ - {224, 255, 255, 3923}, /* light cyan */ - {238, 221, 130, 3934}, /* light goldenrod */ - {250, 250, 210, 3950}, /* light goldenrod yellow */ - {211, 211, 211, 3973}, /* light gray */ - {144, 238, 144, 3984}, /* light green */ - {211, 211, 211, 3996}, /* light grey */ - {255, 182, 193, 4007}, /* light pink */ - {255, 160, 122, 4018}, /* light salmon */ - {32, 178, 170, 4031}, /* light sea green */ - {135, 206, 250, 4047}, /* light sky blue */ - {132, 112, 255, 4062}, /* light slate blue */ - {119, 136, 153, 4079}, /* light slate gray */ - {119, 136, 153, 4096}, /* light slate grey */ - {176, 196, 222, 4113}, /* light steel blue */ - {255, 255, 224, 4130}, /* light yellow */ - {173, 216, 230, 4143}, /* LightBlue */ - {191, 239, 255, 4153}, /* LightBlue1 */ - {178, 223, 238, 4164}, /* LightBlue2 */ - {154, 192, 205, 4175}, /* LightBlue3 */ - {104, 131, 139, 4186}, /* LightBlue4 */ - {240, 128, 128, 4197}, /* LightCoral */ - {224, 255, 255, 4208}, /* LightCyan */ - {224, 255, 255, 4218}, /* LightCyan1 */ - {209, 238, 238, 4229}, /* LightCyan2 */ - {180, 205, 205, 4240}, /* LightCyan3 */ - {122, 139, 139, 4251}, /* LightCyan4 */ - {238, 221, 130, 4262}, /* LightGoldenrod */ - {255, 236, 139, 4277}, /* LightGoldenrod1 */ - {238, 220, 130, 4293}, /* LightGoldenrod2 */ - {205, 190, 112, 4309}, /* LightGoldenrod3 */ - {139, 129, 76, 4325}, /* LightGoldenrod4 */ - {250, 250, 210, 4341}, /* LightGoldenrodYellow */ - {211, 211, 211, 4362}, /* LightGray */ - {144, 238, 144, 4372}, /* LightGreen */ - {211, 211, 211, 4383}, /* LightGrey */ - {255, 182, 193, 4393}, /* LightPink */ - {255, 174, 185, 4403}, /* LightPink1 */ - {238, 162, 173, 4414}, /* LightPink2 */ - {205, 140, 149, 4425}, /* LightPink3 */ - {139, 95, 101, 4436}, /* LightPink4 */ - {255, 160, 122, 4447}, /* LightSalmon */ - {255, 160, 122, 4459}, /* LightSalmon1 */ - {238, 149, 114, 4472}, /* LightSalmon2 */ - {205, 129, 98, 4485}, /* LightSalmon3 */ - {139, 87, 66, 4498}, /* LightSalmon4 */ - {32, 178, 170, 4511}, /* LightSeaGreen */ - {135, 206, 250, 4525}, /* LightSkyBlue */ - {176, 226, 255, 4538}, /* LightSkyBlue1 */ - {164, 211, 238, 4552}, /* LightSkyBlue2 */ - {141, 182, 205, 4566}, /* LightSkyBlue3 */ - {96, 123, 139, 4580}, /* LightSkyBlue4 */ - {132, 112, 255, 4594}, /* LightSlateBlue */ - {119, 136, 153, 4609}, /* LightSlateGray */ - {119, 136, 153, 4624}, /* LightSlateGrey */ - {176, 196, 222, 4639}, /* LightSteelBlue */ - {202, 225, 255, 4654}, /* LightSteelBlue1 */ - {188, 210, 238, 4670}, /* LightSteelBlue2 */ - {162, 181, 205, 4686}, /* LightSteelBlue3 */ - {110, 123, 139, 4702}, /* LightSteelBlue4 */ - {255, 255, 224, 4718}, /* LightYellow */ - {255, 255, 224, 4730}, /* LightYellow1 */ - {238, 238, 209, 4743}, /* LightYellow2 */ - {205, 205, 180, 4756}, /* LightYellow3 */ - {139, 139, 122, 4769}, /* LightYellow4 */ - {50, 205, 50, 4782}, /* lime green */ - {50, 205, 50, 4793}, /* LimeGreen */ - {250, 240, 230, 4803}, /* linen */ - {255, 0, 255, 4809}, /* magenta */ - {255, 0, 255, 4817}, /* magenta1 */ - {238, 0, 238, 4826}, /* magenta2 */ - {205, 0, 205, 4835}, /* magenta3 */ - {139, 0, 139, 4844}, /* magenta4 */ - {176, 48, 96, 4853}, /* maroon */ - {255, 52, 179, 4860}, /* maroon1 */ - {238, 48, 167, 4868}, /* maroon2 */ - {205, 41, 144, 4876}, /* maroon3 */ - {139, 28, 98, 4884}, /* maroon4 */ - {102, 205, 170, 4892}, /* medium aquamarine */ - {0, 0, 205, 4910}, /* medium blue */ - {186, 85, 211, 4922}, /* medium orchid */ - {147, 112, 219, 4936}, /* medium purple */ - {60, 179, 113, 4950}, /* medium sea green */ - {123, 104, 238, 4967}, /* medium slate blue */ - {0, 250, 154, 4985}, /* medium spring green */ - {72, 209, 204, 5005}, /* medium turquoise */ - {199, 21, 133, 5022}, /* medium violet red */ - {102, 205, 170, 5040}, /* MediumAquamarine */ - {0, 0, 205, 5057}, /* MediumBlue */ - {186, 85, 211, 5068}, /* MediumOrchid */ - {224, 102, 255, 5081}, /* MediumOrchid1 */ - {209, 95, 238, 5095}, /* MediumOrchid2 */ - {180, 82, 205, 5109}, /* MediumOrchid3 */ - {122, 55, 139, 5123}, /* MediumOrchid4 */ - {147, 112, 219, 5137}, /* MediumPurple */ - {171, 130, 255, 5150}, /* MediumPurple1 */ - {159, 121, 238, 5164}, /* MediumPurple2 */ - {137, 104, 205, 5178}, /* MediumPurple3 */ - {93, 71, 139, 5192}, /* MediumPurple4 */ - {60, 179, 113, 5206}, /* MediumSeaGreen */ - {123, 104, 238, 5221}, /* MediumSlateBlue */ - {0, 250, 154, 5237}, /* MediumSpringGreen */ - {72, 209, 204, 5255}, /* MediumTurquoise */ - {199, 21, 133, 5271}, /* MediumVioletRed */ - {25, 25, 112, 5287}, /* midnight blue */ - {25, 25, 112, 5301}, /* MidnightBlue */ - {245, 255, 250, 5314}, /* mint cream */ - {245, 255, 250, 5325}, /* MintCream */ - {255, 228, 225, 5335}, /* misty rose */ - {255, 228, 225, 5346}, /* MistyRose */ - {255, 228, 225, 5356}, /* MistyRose1 */ - {238, 213, 210, 5367}, /* MistyRose2 */ - {205, 183, 181, 5378}, /* MistyRose3 */ - {139, 125, 123, 5389}, /* MistyRose4 */ - {255, 228, 181, 5400}, /* moccasin */ - {255, 222, 173, 5409}, /* navajo white */ - {255, 222, 173, 5422}, /* NavajoWhite */ - {255, 222, 173, 5434}, /* NavajoWhite1 */ - {238, 207, 161, 5447}, /* NavajoWhite2 */ - {205, 179, 139, 5460}, /* NavajoWhite3 */ - {139, 121, 94, 5473}, /* NavajoWhite4 */ - {0, 0, 128, 5486}, /* navy */ - {0, 0, 128, 5491}, /* navy blue */ - {0, 0, 128, 5501}, /* NavyBlue */ - {253, 245, 230, 5510}, /* old lace */ - {253, 245, 230, 5519}, /* OldLace */ - {107, 142, 35, 5527}, /* olive drab */ - {107, 142, 35, 5538}, /* OliveDrab */ - {192, 255, 62, 5548}, /* OliveDrab1 */ - {179, 238, 58, 5559}, /* OliveDrab2 */ - {154, 205, 50, 5570}, /* OliveDrab3 */ - {105, 139, 34, 5581}, /* OliveDrab4 */ - {255, 165, 0, 5592}, /* orange */ - {255, 69, 0, 5599}, /* orange red */ - {255, 165, 0, 5610}, /* orange1 */ - {238, 154, 0, 5618}, /* orange2 */ - {205, 133, 0, 5626}, /* orange3 */ - {139, 90, 0, 5634}, /* orange4 */ - {255, 69, 0, 5642}, /* OrangeRed */ - {255, 69, 0, 5652}, /* OrangeRed1 */ - {238, 64, 0, 5663}, /* OrangeRed2 */ - {205, 55, 0, 5674}, /* OrangeRed3 */ - {139, 37, 0, 5685}, /* OrangeRed4 */ - {218, 112, 214, 5696}, /* orchid */ - {255, 131, 250, 5703}, /* orchid1 */ - {238, 122, 233, 5711}, /* orchid2 */ - {205, 105, 201, 5719}, /* orchid3 */ - {139, 71, 137, 5727}, /* orchid4 */ - {238, 232, 170, 5735}, /* pale goldenrod */ - {152, 251, 152, 5750}, /* pale green */ - {175, 238, 238, 5761}, /* pale turquoise */ - {219, 112, 147, 5776}, /* pale violet red */ - {238, 232, 170, 5792}, /* PaleGoldenrod */ - {152, 251, 152, 5806}, /* PaleGreen */ - {154, 255, 154, 5816}, /* PaleGreen1 */ - {144, 238, 144, 5827}, /* PaleGreen2 */ - {124, 205, 124, 5838}, /* PaleGreen3 */ - {84, 139, 84, 5849}, /* PaleGreen4 */ - {175, 238, 238, 5860}, /* PaleTurquoise */ - {187, 255, 255, 5874}, /* PaleTurquoise1 */ - {174, 238, 238, 5889}, /* PaleTurquoise2 */ - {150, 205, 205, 5904}, /* PaleTurquoise3 */ - {102, 139, 139, 5919}, /* PaleTurquoise4 */ - {219, 112, 147, 5934}, /* PaleVioletRed */ - {255, 130, 171, 5948}, /* PaleVioletRed1 */ - {238, 121, 159, 5963}, /* PaleVioletRed2 */ - {205, 104, 137, 5978}, /* PaleVioletRed3 */ - {139, 71, 93, 5993}, /* PaleVioletRed4 */ - {255, 239, 213, 6008}, /* papaya whip */ - {255, 239, 213, 6020}, /* PapayaWhip */ - {255, 218, 185, 6031}, /* peach puff */ - {255, 218, 185, 6042}, /* PeachPuff */ - {255, 218, 185, 6052}, /* PeachPuff1 */ - {238, 203, 173, 6063}, /* PeachPuff2 */ - {205, 175, 149, 6074}, /* PeachPuff3 */ - {139, 119, 101, 6085}, /* PeachPuff4 */ - {205, 133, 63, 6096}, /* peru */ - {255, 192, 203, 6101}, /* pink */ - {255, 181, 197, 6106}, /* pink1 */ - {238, 169, 184, 6112}, /* pink2 */ - {205, 145, 158, 6118}, /* pink3 */ - {139, 99, 108, 6124}, /* pink4 */ - {221, 160, 221, 6130}, /* plum */ - {255, 187, 255, 6135}, /* plum1 */ - {238, 174, 238, 6141}, /* plum2 */ - {205, 150, 205, 6147}, /* plum3 */ - {139, 102, 139, 6153}, /* plum4 */ - {176, 224, 230, 6159}, /* powder blue */ - {176, 224, 230, 6171}, /* PowderBlue */ - {160, 32, 240, 6182}, /* purple */ - {155, 48, 255, 6189}, /* purple1 */ - {145, 44, 238, 6197}, /* purple2 */ - {125, 38, 205, 6205}, /* purple3 */ - {85, 26, 139, 6213}, /* purple4 */ - {255, 0, 0, 6221}, /* red */ - {255, 0, 0, 6225}, /* red1 */ - {238, 0, 0, 6230}, /* red2 */ - {205, 0, 0, 6235}, /* red3 */ - {139, 0, 0, 6240}, /* red4 */ - {188, 143, 143, 6245}, /* rosy brown */ - {188, 143, 143, 6256}, /* RosyBrown */ - {255, 193, 193, 6266}, /* RosyBrown1 */ - {238, 180, 180, 6277}, /* RosyBrown2 */ - {205, 155, 155, 6288}, /* RosyBrown3 */ - {139, 105, 105, 6299}, /* RosyBrown4 */ - {65, 105, 225, 6310}, /* royal blue */ - {65, 105, 225, 6321}, /* RoyalBlue */ - {72, 118, 255, 6331}, /* RoyalBlue1 */ - {67, 110, 238, 6342}, /* RoyalBlue2 */ - {58, 95, 205, 6353}, /* RoyalBlue3 */ - {39, 64, 139, 6364}, /* RoyalBlue4 */ - {139, 69, 19, 6375}, /* saddle brown */ - {139, 69, 19, 6388}, /* SaddleBrown */ - {250, 128, 114, 6400}, /* salmon */ - {255, 140, 105, 6407}, /* salmon1 */ - {238, 130, 98, 6415}, /* salmon2 */ - {205, 112, 84, 6423}, /* salmon3 */ - {139, 76, 57, 6431}, /* salmon4 */ - {244, 164, 96, 6439}, /* sandy brown */ - {244, 164, 96, 6451}, /* SandyBrown */ - {46, 139, 87, 6462}, /* sea green */ - {46, 139, 87, 6472}, /* SeaGreen */ - {84, 255, 159, 6481}, /* SeaGreen1 */ - {78, 238, 148, 6491}, /* SeaGreen2 */ - {67, 205, 128, 6501}, /* SeaGreen3 */ - {46, 139, 87, 6511}, /* SeaGreen4 */ - {255, 245, 238, 6521}, /* seashell */ - {255, 245, 238, 6530}, /* seashell1 */ - {238, 229, 222, 6540}, /* seashell2 */ - {205, 197, 191, 6550}, /* seashell3 */ - {139, 134, 130, 6560}, /* seashell4 */ - {160, 82, 45, 6570}, /* sienna */ - {255, 130, 71, 6577}, /* sienna1 */ - {238, 121, 66, 6585}, /* sienna2 */ - {205, 104, 57, 6593}, /* sienna3 */ - {139, 71, 38, 6601}, /* sienna4 */ - {135, 206, 235, 6609}, /* sky blue */ - {135, 206, 235, 6618}, /* SkyBlue */ - {135, 206, 255, 6626}, /* SkyBlue1 */ - {126, 192, 238, 6635}, /* SkyBlue2 */ - {108, 166, 205, 6644}, /* SkyBlue3 */ - {74, 112, 139, 6653}, /* SkyBlue4 */ - {106, 90, 205, 6662}, /* slate blue */ - {112, 128, 144, 6673}, /* slate gray */ - {112, 128, 144, 6684}, /* slate grey */ - {106, 90, 205, 6695}, /* SlateBlue */ - {131, 111, 255, 6705}, /* SlateBlue1 */ - {122, 103, 238, 6716}, /* SlateBlue2 */ - {105, 89, 205, 6727}, /* SlateBlue3 */ - {71, 60, 139, 6738}, /* SlateBlue4 */ - {112, 128, 144, 6749}, /* SlateGray */ - {198, 226, 255, 6759}, /* SlateGray1 */ - {185, 211, 238, 6770}, /* SlateGray2 */ - {159, 182, 205, 6781}, /* SlateGray3 */ - {108, 123, 139, 6792}, /* SlateGray4 */ - {112, 128, 144, 6803}, /* SlateGrey */ - {255, 250, 250, 6813}, /* snow */ - {255, 250, 250, 6818}, /* snow1 */ - {238, 233, 233, 6824}, /* snow2 */ - {205, 201, 201, 6830}, /* snow3 */ - {139, 137, 137, 6836}, /* snow4 */ - {0, 255, 127, 6842}, /* spring green */ - {0, 255, 127, 6855}, /* SpringGreen */ - {0, 255, 127, 6867}, /* SpringGreen1 */ - {0, 238, 118, 6880}, /* SpringGreen2 */ - {0, 205, 102, 6893}, /* SpringGreen3 */ - {0, 139, 69, 6906}, /* SpringGreen4 */ - {70, 130, 180, 6919}, /* steel blue */ - {70, 130, 180, 6930}, /* SteelBlue */ - {99, 184, 255, 6940}, /* SteelBlue1 */ - {92, 172, 238, 6951}, /* SteelBlue2 */ - {79, 148, 205, 6962}, /* SteelBlue3 */ - {54, 100, 139, 6973}, /* SteelBlue4 */ - {210, 180, 140, 6984}, /* tan */ - {255, 165, 79, 6988}, /* tan1 */ - {238, 154, 73, 6993}, /* tan2 */ - {205, 133, 63, 6998}, /* tan3 */ - {139, 90, 43, 7003}, /* tan4 */ - {216, 191, 216, 7008}, /* thistle */ - {255, 225, 255, 7016}, /* thistle1 */ - {238, 210, 238, 7025}, /* thistle2 */ - {205, 181, 205, 7034}, /* thistle3 */ - {139, 123, 139, 7043}, /* thistle4 */ - {255, 99, 71, 7052}, /* tomato */ - {255, 99, 71, 7059}, /* tomato1 */ - {238, 92, 66, 7067}, /* tomato2 */ - {205, 79, 57, 7075}, /* tomato3 */ - {139, 54, 38, 7083}, /* tomato4 */ - {64, 224, 208, 7091}, /* turquoise */ - {0, 245, 255, 7101}, /* turquoise1 */ - {0, 229, 238, 7112}, /* turquoise2 */ - {0, 197, 205, 7123}, /* turquoise3 */ - {0, 134, 139, 7134}, /* turquoise4 */ - {238, 130, 238, 7145}, /* violet */ - {208, 32, 144, 7152}, /* violet red */ - {208, 32, 144, 7163}, /* VioletRed */ - {255, 62, 150, 7173}, /* VioletRed1 */ - {238, 58, 140, 7184}, /* VioletRed2 */ - {205, 50, 120, 7195}, /* VioletRed3 */ - {139, 34, 82, 7206}, /* VioletRed4 */ - {245, 222, 179, 7217}, /* wheat */ - {255, 231, 186, 7223}, /* wheat1 */ - {238, 216, 174, 7230}, /* wheat2 */ - {205, 186, 150, 7237}, /* wheat3 */ - {139, 126, 102, 7244}, /* wheat4 */ - {255, 255, 255, 7251}, /* white */ - {245, 245, 245, 7257}, /* white smoke */ - {245, 245, 245, 7269}, /* WhiteSmoke */ - {255, 255, 0, 7280}, /* yellow */ - {154, 205, 50, 7287}, /* yellow green */ - {255, 255, 0, 7300}, /* yellow1 */ - {238, 238, 0, 7308}, /* yellow2 */ - {205, 205, 0, 7316}, /* yellow3 */ - {139, 139, 0, 7324}, /* yellow4 */ - {154, 205, 50, 7332}, /* YellowGreen */ -}; +unsigned long Colour::to_x11_color(Display *display, int screen, + bool transparency, bool premultiply) { + static std::unordered_map x11_pixels; -#define NUM_BUILTIN_COLORS (sizeof(BuiltinColors) / sizeof(BuiltinColors[0])) + if (display == nullptr) { + /* cannot work if display is not open */ + return 0; + } -int OsLookupColor(int screen, const char *name, unsigned int len, - unsigned short *pred, unsigned short *pgreen, - unsigned short *pblue) { - const BuiltinColor *c; - int low, mid, high; - int r; + unsigned long pixel; + + /* Either get a cached X11 pixel or allocate one */ + if (auto pixel_iter = x11_pixels.find(*this); + pixel_iter != x11_pixels.end()) { + pixel = pixel_iter->second; + } else { + XColor xcolor{}; + xcolor.red = this->red * 257; + xcolor.green = this->green * 257; + xcolor.blue = this->blue * 257; + if (XAllocColor(display, DefaultColormap(display, screen), &xcolor) == 0) { + // NORM_ERR("can't allocate X color"); + return 0; + } - (void)screen; + /* Save pixel value in the cache to avoid reallocating it */ + x11_pixels[*this] = xcolor.pixel; + pixel = static_cast(xcolor.pixel); + } - low = 0; - high = NUM_BUILTIN_COLORS - 1; - while (high >= low) { - mid = (low + high) / 2; - c = &BuiltinColors[mid]; - r = strncasecmp(&BuiltinColorNames[c->name], name, len); - if (r == 0 && len == strlen(&BuiltinColorNames[c->name])) { - *pred = c->red; - *pgreen = c->green; - *pblue = c->blue; - return 1; - } - if (r < 0) - low = mid + 1; - else - high = mid - 1; + pixel &= 0xffffff; +#ifdef BUILD_ARGB + if (transparency) { + if (premultiply) + pixel = (red * alpha / 255) << 16 | (green * alpha / 255) << 8 | + (blue * alpha / 255); + pixel |= ((unsigned long)alpha << 24); } - return 0; -} +#endif /* BUILD_ARGB */ + return pixel; +} \ No newline at end of file diff --git a/src/x11-color.h b/src/x11-color.h deleted file mode 100644 index d7151b671d..0000000000 --- a/src/x11-color.h +++ /dev/null @@ -1,4 +0,0 @@ -/* from xorg-server's oscolor.c */ -int OsLookupColor(int screen, const char *name, unsigned int len, - unsigned short *pred, unsigned short *pgreen, - unsigned short *pblue); diff --git a/src/x11-settings.cc b/src/x11-settings.cc new file mode 100644 index 0000000000..09abcb51ed --- /dev/null +++ b/src/x11-settings.cc @@ -0,0 +1,134 @@ +#include "x11-settings.h" + +#include "x11.h" + +#include "conky-imlib2.h" + +#include + +conky::simple_config_setting display_name("display", std::string(), + false); + +namespace priv { +void out_to_x_setting::lua_setter(lua::state &l, bool init) { + lua::stack_sentry s(l, -2); + + Base::lua_setter(l, init); + + if (init && do_convert(l, -1).first) { init_x11(); } + + ++s; +} + +void out_to_x_setting::cleanup(lua::state &l) { + lua::stack_sentry s(l, -1); + + if (do_convert(l, -1).first) { deinit_x11(); } + + l.pop(); +} + +#ifdef BUILD_XDBE +bool use_xdbe_setting::set_up(lua::state &l) { + // double_buffer makes no sense when not drawing to X + if (!out_to_x.get(l) || !display || !window.window) { return false; } + + int major, minor; + + if (XdbeQueryExtension(display, &major, &minor) == 0) { + NORM_ERR("No compatible double buffer extension found"); + return false; + } + + window.back_buffer = + XdbeAllocateBackBufferName(display, window.window, XdbeBackground); + if (window.back_buffer != None) { + window.drawable = window.back_buffer; + } else { + NORM_ERR("Failed to allocate back buffer"); + return false; + } + + XFlush(display); + return true; +} + +void use_xdbe_setting::lua_setter(lua::state &l, bool init) { + lua::stack_sentry s(l, -2); + + Base::lua_setter(l, init); + + if (init && do_convert(l, -1).first) { + if (!set_up(l)) { + l.pop(); + l.pushboolean(false); + } + + NORM_ERR("drawing to %s buffer", + do_convert(l, -1).first ? "double" : "single"); + } + + ++s; +} + +#else +bool use_xpmdb_setting::set_up(lua::state &l) { + // double_buffer makes no sense when not drawing to X + if (!out_to_x.get(l)) return false; + + window.back_buffer = + XCreatePixmap(display, window.window, window.width + 1, window.height + 1, + DefaultDepth(display, screen)); + if (window.back_buffer != None) { + window.drawable = window.back_buffer; + } else { + NORM_ERR("Failed to allocate back buffer"); + return false; + } + + XFlush(display); + return true; +} + +void use_xpmdb_setting::lua_setter(lua::state &l, bool init) { + lua::stack_sentry s(l, -2); + + Base::lua_setter(l, init); + + if (init && do_convert(l, -1).first) { + if (!set_up(l)) { + l.pop(); + l.pushboolean(false); + } + + NORM_ERR("drawing to %s buffer", + do_convert(l, -1).first ? "double" : "single"); + } + + ++s; +} +#endif +} // namespace priv + +conky::simple_config_setting head_index("xinerama_head", 0, true); +priv::out_to_x_setting out_to_x; + +#ifdef BUILD_XFT +conky::simple_config_setting use_xft("use_xft", false, false); +#endif + +conky::simple_config_setting forced_redraw("forced_redraw", false, false); + +#ifdef BUILD_XDBE +priv::use_xdbe_setting use_xdbe; +#else +priv::use_xpmdb_setting use_xpmdb; +#endif + +#ifdef BUILD_IMLIB2 +/* + * the only reason this is not in imlib2.cc is so that we can be sure it's + * setter executes after use_xdbe + */ +imlib_cache_size_setting imlib_cache_size; +#endif diff --git a/src/x11-settings.h b/src/x11-settings.h new file mode 100644 index 0000000000..3051c00d5e --- /dev/null +++ b/src/x11-settings.h @@ -0,0 +1,60 @@ +#ifndef CONKY_X11_SETTINGS_H +#define CONKY_X11_SETTINGS_H + +#include "setting.hh" + +extern conky::simple_config_setting display_name; + +namespace priv { +class out_to_x_setting : public conky::simple_config_setting { + typedef conky::simple_config_setting Base; + + protected: + virtual void lua_setter(lua::state &l, bool init); + virtual void cleanup(lua::state &l); + + public: + out_to_x_setting() : Base("out_to_x", true, false) {} +}; + +#ifdef BUILD_XDBE +class use_xdbe_setting : public conky::simple_config_setting { + typedef conky::simple_config_setting Base; + + bool set_up(lua::state &l); + + protected: + virtual void lua_setter(lua::state &l, bool init); + + public: + use_xdbe_setting() : Base("double_buffer", false, false) {} +}; + +#else +class use_xpmdb_setting : public conky::simple_config_setting { + typedef conky::simple_config_setting Base; + + bool set_up(lua::state &l); + + protected: + virtual void lua_setter(lua::state &l, bool init); + + public: + use_xpmdb_setting() : Base("double_buffer", false, false) {} +}; +#endif +} /* namespace priv */ + +extern priv::out_to_x_setting out_to_x; + +#ifdef BUILD_XFT +extern conky::simple_config_setting use_xft; +#endif + +#ifdef BUILD_XDBE +extern priv::use_xdbe_setting use_xdbe; +#else +extern priv::use_xpmdb_setting use_xpmdb; +#endif + +#endif /* CONKY_X11_SETTINGS_H */ diff --git a/src/x11.cc b/src/x11.cc index a9146c6856..4365c79bbb 100644 --- a/src/x11.cc +++ b/src/x11.cc @@ -43,13 +43,19 @@ #include #endif +#include #include #include #include #include #include +#include #include +// #ifndef OWN_WINDOW +// #include +// #endif + extern "C" { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wvariadic-macros" @@ -64,9 +70,6 @@ extern "C" { #ifdef BUILD_IMLIB2 #include "conky-imlib2.h" #endif /* BUILD_IMLIB2 */ -#ifndef OWN_WINDOW -#include -#endif #ifdef BUILD_XFT #include #endif @@ -100,144 +103,12 @@ xcb_errors_context_t *xcb_errors_ctx; /* Window stuff */ struct conky_x11_window window; -#ifdef BUILD_ARGB -bool have_argb_visual; -#endif /* BUILD_ARGB */ - -conky::simple_config_setting display_name("display", std::string(), - false); +bool have_argb_visual = false; /* local prototypes */ static void update_workarea(); static Window find_desktop_window(Window *p_root, Window *p_desktop); static Window find_subwindow(Window win, int w, int h); -static void init_x11(); - -/********************* ************************/ -namespace priv { -void out_to_x_setting::lua_setter(lua::state &l, bool init) { - lua::stack_sentry s(l, -2); - - Base::lua_setter(l, init); - - if (init && do_convert(l, -1).first) { init_x11(); } - - ++s; -} - -void out_to_x_setting::cleanup(lua::state &l) { - lua::stack_sentry s(l, -1); - - if (do_convert(l, -1).first) { deinit_x11(); } - - l.pop(); -} - -#ifdef BUILD_XDBE -bool use_xdbe_setting::set_up(lua::state &l) { - // double_buffer makes no sense when not drawing to X - if (!out_to_x.get(l) || !display || !window.window) { return false; } - - int major, minor; - - if (XdbeQueryExtension(display, &major, &minor) == 0) { - NORM_ERR("No compatible double buffer extension found"); - return false; - } - - window.back_buffer = - XdbeAllocateBackBufferName(display, window.window, XdbeBackground); - if (window.back_buffer != None) { - window.drawable = window.back_buffer; - } else { - NORM_ERR("Failed to allocate back buffer"); - return false; - } - - XFlush(display); - return true; -} - -void use_xdbe_setting::lua_setter(lua::state &l, bool init) { - lua::stack_sentry s(l, -2); - - Base::lua_setter(l, init); - - if (init && do_convert(l, -1).first) { - if (!set_up(l)) { - l.pop(); - l.pushboolean(false); - } - - NORM_ERR("drawing to %s buffer", - do_convert(l, -1).first ? "double" : "single"); - } - - ++s; -} - -#else -bool use_xpmdb_setting::set_up(lua::state &l) { - // double_buffer makes no sense when not drawing to X - if (!out_to_x.get(l)) return false; - - window.back_buffer = - XCreatePixmap(display, window.window, window.width + 1, window.height + 1, - DefaultDepth(display, screen)); - if (window.back_buffer != None) { - window.drawable = window.back_buffer; - } else { - NORM_ERR("Failed to allocate back buffer"); - return false; - } - - XFlush(display); - return true; -} - -void use_xpmdb_setting::lua_setter(lua::state &l, bool init) { - lua::stack_sentry s(l, -2); - - Base::lua_setter(l, init); - - if (init && do_convert(l, -1).first) { - if (!set_up(l)) { - l.pop(); - l.pushboolean(false); - } - - NORM_ERR("drawing to %s buffer", - do_convert(l, -1).first ? "double" : "single"); - } - - ++s; -} -#endif -} // namespace priv - -conky::simple_config_setting head_index("xinerama_head", 0, true); -priv::out_to_x_setting out_to_x; - -#ifdef BUILD_XFT -conky::simple_config_setting use_xft("use_xft", false, false); -#endif - -conky::simple_config_setting forced_redraw("forced_redraw", false, false); - -#ifdef BUILD_XDBE -priv::use_xdbe_setting use_xdbe; -#else -priv::use_xpmdb_setting use_xpmdb; -#endif - -#ifdef BUILD_IMLIB2 -/* - * the only reason this is not in imlib2.cc is so that we can be sure it's - * setter executes after use_xdbe - */ -imlib_cache_size_setting imlib_cache_size; -#endif -/******************** ************************/ /* WARNING, this type not in Xlib spec */ static int x11_error_handler(Display *d, XErrorEvent *err) { @@ -362,7 +233,7 @@ inline Window DefaultVRootWindow(Display *display) { } /* X11 initializer */ -static void init_x11() { +void init_x11() { DBGP("enter init_x11()"); if (display == nullptr) { const std::string &dispstr = display_name.get(*state); @@ -494,7 +365,8 @@ namespace { void do_set_background(Window win, uint8_t alpha) { Colour colour = background_colour.get(*state); colour.alpha = alpha; - unsigned long xcolor = colour.to_x11_color(display, screen, true); + unsigned long xcolor = + colour.to_x11_color(display, screen, have_argb_visual, true); XSetWindowBackground(display, win, xcolor); } } // namespace @@ -624,7 +496,7 @@ void x11_init_window(lua::state &l, bool own) { classHint.res_name = const_cast(class_name.c_str()); classHint.res_class = classHint.res_name; - if (own_window_type.get(l) == TYPE_OVERRIDE) { + if (own_window_type.get(l) == window_type::OVERRIDE) { /* An override_redirect True window. * No WM hints or button processing needed. */ XSetWindowAttributes attrs = {ParentRelative, @@ -678,7 +550,7 @@ void x11_init_window(lua::state &l, bool own) { StructureNotifyMask | ExposureMask | ButtonPressMask | ButtonReleaseMask, 0L, - own_window_type.get(l) == TYPE_UTILITY ? True : False, + own_window_type.get(l) == window_type::UTILITY ? True : False, 0, 0}; @@ -694,7 +566,9 @@ void x11_init_window(lua::state &l, bool own) { } #endif /* BUILD_ARGB */ - if (own_window_type.get(l) == TYPE_DOCK) { window.x = window.y = 0; } + if (own_window_type.get(l) == window_type::DOCK) { + window.x = window.y = 0; + } /* Parent is root window so WM can take control */ window.window = XCreateWindow(display, window.root, window.x, window.y, b, b, 0, @@ -704,10 +578,10 @@ void x11_init_window(lua::state &l, bool own) { wmHint.flags = InputHint | StateHint; /* allow decorated windows to be given input focus by WM */ - wmHint.input = TEST_HINT(hints, HINT_UNDECORATED) ? False : True; + wmHint.input = TEST_HINT(hints, window_hints::UNDECORATED) ? False : True; #ifdef BUILD_XSHAPE #ifdef BUILD_XFIXES - if (own_window_type.get(l) == TYPE_UTILITY) { + if (own_window_type.get(l) == window_type::UTILITY) { XRectangle rect; XserverRegion region = XFixesCreateRegion(display, &rect, 1); XFixesSetWindowShapeRegion(display, window.window, ShapeInput, 0, 0, @@ -723,17 +597,17 @@ void x11_init_window(lua::state &l, bool own) { NORM_ERR("Input shapes are not supported"); } else { if (own_window.get(*state) && - (own_window_type.get(*state) != TYPE_NORMAL || - ((TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)) != - 0))) { + (own_window_type.get(*state) != window_type::NORMAL || + ((TEST_HINT(own_window_hints.get(*state), + window_hints::UNDECORATED)) != 0))) { XShapeCombineRectangles(display, window.window, ShapeInput, 0, 0, nullptr, 0, ShapeSet, Unsorted); } } } #endif /* BUILD_XSHAPE */ - if (own_window_type.get(l) == TYPE_DOCK || - own_window_type.get(l) == TYPE_PANEL) { + if (own_window_type.get(l) == window_type::DOCK || + own_window_type.get(l) == window_type::PANEL) { wmHint.initial_state = WithdrawnState; } else { wmHint.initial_state = NormalState; @@ -751,23 +625,23 @@ void x11_init_window(lua::state &l, bool own) { Atom prop; switch (own_window_type.get(l)) { - case TYPE_DESKTOP: + case window_type::DESKTOP: prop = ATOM(_NET_WM_WINDOW_TYPE_DESKTOP); NORM_ERR("window type - desktop"); break; - case TYPE_DOCK: + case window_type::DOCK: prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK); NORM_ERR("window type - dock"); break; - case TYPE_PANEL: + case window_type::PANEL: prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK); NORM_ERR("window type - panel"); break; - case TYPE_UTILITY: + case window_type::UTILITY: prop = ATOM(_NET_WM_WINDOW_TYPE_UTILITY); NORM_ERR("window type - utility"); break; - case TYPE_NORMAL: + case window_type::NORMAL: default: prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL); NORM_ERR("window type - normal"); @@ -781,7 +655,7 @@ void x11_init_window(lua::state &l, bool own) { /* Set desired hints */ /* Window decorations */ - if (TEST_HINT(hints, HINT_UNDECORATED)) { + if (TEST_HINT(hints, window_hints::UNDECORATED)) { DBGP("hint - undecorated"); xa = ATOM(_MOTIF_WM_HINTS); if (xa != None) { @@ -792,7 +666,7 @@ void x11_init_window(lua::state &l, bool own) { } /* Below other windows */ - if (TEST_HINT(hints, HINT_BELOW)) { + if (TEST_HINT(hints, window_hints::BELOW)) { DBGP("hint - below"); xa = ATOM(_WIN_LAYER); if (xa != None) { @@ -814,7 +688,7 @@ void x11_init_window(lua::state &l, bool own) { } /* Above other windows */ - if (TEST_HINT(hints, HINT_ABOVE)) { + if (TEST_HINT(hints, window_hints::ABOVE)) { DBGP("hint - above"); xa = ATOM(_WIN_LAYER); if (xa != None) { @@ -836,7 +710,7 @@ void x11_init_window(lua::state &l, bool own) { } /* Sticky */ - if (TEST_HINT(hints, HINT_STICKY)) { + if (TEST_HINT(hints, window_hints::STICKY)) { DBGP("hint - sticky"); xa = ATOM(_NET_WM_DESKTOP); if (xa != None) { @@ -858,7 +732,7 @@ void x11_init_window(lua::state &l, bool own) { } /* Skip taskbar */ - if (TEST_HINT(hints, HINT_SKIP_TASKBAR)) { + if (TEST_HINT(hints, window_hints::SKIP_TASKBAR)) { DBGP("hint - skip taskbar"); xa = ATOM(_NET_WM_STATE); if (xa != None) { @@ -871,7 +745,7 @@ void x11_init_window(lua::state &l, bool own) { } /* Skip pager */ - if (TEST_HINT(hints, HINT_SKIP_PAGER)) { + if (TEST_HINT(hints, window_hints::SKIP_PAGER)) { DBGP("hint - skip pager"); xa = ATOM(_NET_WM_STATE); if (xa != None) { @@ -909,9 +783,12 @@ void x11_init_window(lua::state &l, bool own) { int64_t input_mask = ExposureMask | PropertyChangeMask; #ifdef OWN_WINDOW if (own_window.get(l)) { - input_mask |= StructureNotifyMask | ButtonPressMask | ButtonReleaseMask; + input_mask |= StructureNotifyMask; +#if !defined(BUILD_XINPUT) + input_mask |= ButtonPressMask | ButtonReleaseMask; +#endif } -#ifdef BUILD_MOUSE_EVENTS +#if defined(BUILD_MOUSE_EVENTS) || defined(BUILD_XINPUT) bool xinput_ok = false; #ifdef BUILD_XINPUT // not a loop; substitutes goto with break - if checks fail @@ -974,10 +851,12 @@ void x11_init_window(lua::state &l, bool own) { // Fallback to basic X11 enter/leave events if xinput fails to init. // It's not recommended to add event masks to special windows in X; causes a // crash (thus own_window_type != TYPE_DESKTOP) - if (!xinput_ok && own && own_window_type.get(l) != TYPE_DESKTOP) { +#ifdef BUILD_MOUSE_EVENTS + if (!xinput_ok && own && own_window_type.get(l) != window_type::DESKTOP) { input_mask |= PointerMotionMask | EnterWindowMask | LeaveWindowMask; } #endif /* BUILD_MOUSE_EVENTS */ +#endif /* BUILD_MOUSE_EVENTS || BUILD_XINPUT */ #endif /* OWN_WINDOW */ window.event_mask = input_mask; XSelectInput(display, window.window, input_mask); @@ -1205,61 +1084,83 @@ void print_desktop_name(struct text_object *obj, char *p, } #ifdef OWN_WINDOW +enum class x11_strut : size_t { + LEFT, + RIGHT, + TOP, + BOTTOM, + LEFT_START_Y, + LEFT_END_Y, + RIGHT_START_Y, + RIGHT_END_Y, + TOP_START_X, + TOP_END_X, + BOTTOM_START_X, + BOTTOM_END_X, + COUNT +}; +constexpr size_t operator*(x11_strut index) { + return static_cast(index); +} + /* reserve window manager space */ -void set_struts(int sidenum) { - Atom strut; - if ((strut = ATOM(_NET_WM_STRUT)) != None) { +void set_struts(alignment align) { + // Middle and none align don't have least significant bit set. + // Ensures either vertical or horizontal axis are start/end + if ((*align & 0b0101) == 0) return; + + Atom strut = ATOM(_NET_WM_STRUT); + if (strut != None) { /* reserve space at left, right, top, bottom */ - signed long sizes[12] = {0}; + uint32_t sizes[*x11_strut::COUNT] = {0}; int i; - /* define strut depth */ - switch (sidenum) { - case 0: - /* left side */ - sizes[0] = window.x + window.width; - break; - case 1: - /* right side */ - sizes[1] = display_width - window.x; - break; - case 2: - /* top side */ - sizes[2] = window.y + window.height; - break; - case 3: - /* bottom side */ - sizes[3] = display_height - window.y; + switch (vertical_alignment(align)) { + case axis_align::START: + sizes[*x11_strut::TOP] = + std::min(window.y + window.height, display_height); + sizes[*x11_strut::TOP_START_X] = window.x; + sizes[*x11_strut::TOP_END_X] = + std::min(window.x + window.width, display_width); + case axis_align::END: + sizes[*x11_strut::BOTTOM] = + window.y < display_height ? display_height - window.y : 0; + sizes[*x11_strut::BOTTOM_START_X] = window.x; + sizes[*x11_strut::BOTTOM_END_X] = + std::min(window.x + window.width, display_width); + case axis_align::MIDDLE: + // can't reserve space in middle of the screen + default: break; } - - /* define partial strut length */ - if (sidenum <= 1) { - sizes[4 + (sidenum * 2)] = window.y; - sizes[5 + (sidenum * 2)] = window.y + window.height; - } else if (sidenum <= 3) { - sizes[4 + (sidenum * 2)] = window.x; - sizes[5 + (sidenum * 2)] = window.x + window.width; - } - - /* check constraints */ - for (i = 0; i < 12; i++) { - if (sizes[i] < 0) { - sizes[i] = 0; - } else { - if (i <= 1 || i >= 8) { - if (sizes[i] > display_width) { sizes[i] = display_width; } - } else { - if (sizes[i] > display_height) { sizes[i] = display_height; } - } - } + // adding `vertical_alignment(align) & 0x1` makes the switch hit MIDDLE if + // vertical alignment is set to left or right + switch (static_cast( + *horizontal_alignment(align) + *vertical_alignment(align) & 0x1)) { + case axis_align::START: + sizes[*x11_strut::LEFT] = + std::min(window.x + window.width, display_width); + sizes[*x11_strut::LEFT_START_Y] = window.y; + sizes[*x11_strut::LEFT_END_Y] = + std::min(window.y + window.height, display_height); + case axis_align::END: + sizes[*x11_strut::RIGHT] = + window.x < display_width ? display_width - window.x : 0; + sizes[*x11_strut::RIGHT_START_Y] = window.y; + sizes[*x11_strut::RIGHT_END_Y] = + std::min(window.y + window.height, display_height); + case axis_align::MIDDLE: + // can't reserve space in middle of the screen + default: + break; } XChangeProperty(display, window.window, strut, XA_CARDINAL, 32, PropModeReplace, reinterpret_cast(&sizes), 4); - if ((strut = ATOM(_NET_WM_STRUT_PARTIAL)) != None) { + strut = ATOM(_NET_WM_STRUT_PARTIAL); + if (strut != None) { XChangeProperty(display, window.window, strut, XA_CARDINAL, 32, PropModeReplace, reinterpret_cast(&sizes), 12); diff --git a/src/x11.h b/src/x11.h index 70f8588711..22226b21c1 100644 --- a/src/x11.h +++ b/src/x11.h @@ -22,10 +22,14 @@ * */ -#pragma once +#ifndef CONKY_X11_H +#define CONKY_X11_H #include "config.h" -#include "setting.hh" + +#ifndef BUILD_X11 +#error x11.h included when BUILD_X11 is disabled +#endif #include #pragma GCC diagnostic push @@ -44,36 +48,13 @@ #include #include -#ifdef BUILD_ARGB +#include "gui.h" + /* true if use_argb_visual=true and argb visual was found*/ extern bool have_argb_visual; -#endif /* BUILD_ARGB */ #define ATOM(a) XInternAtom(display, #a, False) -#ifdef OWN_WINDOW -enum window_type { - TYPE_NORMAL = 0, - TYPE_DOCK, - TYPE_PANEL, - TYPE_DESKTOP, - TYPE_OVERRIDE, - TYPE_UTILITY -}; - -enum window_hints { - HINT_UNDECORATED = 0, - HINT_BELOW, - HINT_ABOVE, - HINT_STICKY, - HINT_SKIP_TASKBAR, - HINT_SKIP_PAGER -}; - -#define SET_HINT(mask, hint) (mask |= (1 << (hint))) -#define TEST_HINT(mask, hint) (mask & (1 << (hint))) -#endif - extern Display *display; struct conky_x11_window { @@ -99,10 +80,10 @@ struct conky_x11_window { #ifdef BUILD_XFT XftDraw *xftdraw; #endif /*BUILD_XFT*/ -#ifdef BUILD_MOUSE_EVENTS +#if defined(BUILD_MOUSE_EVENTS) || defined(BUILD_XINPUT) // Don't feature gate with BUILD_XINPUT; controls fallback. std::int32_t xi_opcode; -#endif /* BUILD_MOUSE_EVENTS */ +#endif /* BUILD_MOUSE_EVENTS || BUILD_XINPUT */ int width; int height; @@ -113,13 +94,13 @@ struct conky_x11_window { }; extern struct conky_x11_window window; -extern conky::simple_config_setting display_name; +void init_x11(); void destroy_window(void); void create_gc(void); void set_transparent_background(Window win); void get_x11_desktop_info(Display *current_display, Atom atom); -void set_struts(int); +void set_struts(alignment alignment); void x11_init_window(lua::state &l, bool own); void deinit_x11(); @@ -195,54 +176,4 @@ void xdbe_swap_buffers(void); void xpmdb_swap_buffers(void); #endif /* BUILD_XDBE */ -namespace priv { -class out_to_x_setting : public conky::simple_config_setting { - typedef conky::simple_config_setting Base; - - protected: - virtual void lua_setter(lua::state &l, bool init); - virtual void cleanup(lua::state &l); - - public: - out_to_x_setting() : Base("out_to_x", true, false) {} -}; - -#ifdef BUILD_XDBE -class use_xdbe_setting : public conky::simple_config_setting { - typedef conky::simple_config_setting Base; - - bool set_up(lua::state &l); - - protected: - virtual void lua_setter(lua::state &l, bool init); - - public: - use_xdbe_setting() : Base("double_buffer", false, false) {} -}; - -#else -class use_xpmdb_setting : public conky::simple_config_setting { - typedef conky::simple_config_setting Base; - - bool set_up(lua::state &l); - - protected: - virtual void lua_setter(lua::state &l, bool init); - - public: - use_xpmdb_setting() : Base("double_buffer", false, false) {} -}; -#endif -} /* namespace priv */ - -extern priv::out_to_x_setting out_to_x; - -#ifdef BUILD_XFT -extern conky::simple_config_setting use_xft; -#endif - -#ifdef BUILD_XDBE -extern priv::use_xdbe_setting use_xdbe; -#else -extern priv::use_xpmdb_setting use_xpmdb; -#endif +#endif /* CONKY_X11_H */