From 41bd981b3804bc2f596973baad506c6f81906f5b Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 4 Jan 2016 07:59:30 +0100 Subject: [PATCH] Initialize Xrm only once. --- Changelog | 4 ++++ include/textbox.h | 16 ++++++++-------- include/xrmoptions.h | 4 ++++ source/rofi.c | 4 ++++ source/xrmoptions.c | 9 +++++---- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Changelog b/Changelog index a29de920..5c92cd99 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,10 @@ - Have separate config file. Bug fixes: - Fix subpixel rendering. (#303) + - Fix basic tests on OpenBSD (#272) + - Fix wong use of memcpy. + - Work around for sigwaitinfo on OpenBSD. + 0.15.12: New features: - Initial `-dump` command for dmenu mode. (#216) diff --git a/include/textbox.h b/include/textbox.h index e7aef209..2aa7c4f8 100644 --- a/include/textbox.h +++ b/include/textbox.h @@ -32,14 +32,14 @@ typedef struct typedef enum { - TB_AUTOHEIGHT = 1 << 0, - TB_AUTOWIDTH = 1 << 1, - TB_LEFT = 1 << 16, - TB_RIGHT = 1 << 17, - TB_CENTER = 1 << 18, - TB_EDITABLE = 1 << 19, - TB_MARKUP = 1 << 20, - TB_WRAP = 1 << 21, + TB_AUTOHEIGHT = 1 << 0, + TB_AUTOWIDTH = 1 << 1, + TB_LEFT = 1 << 16, + TB_RIGHT = 1 << 17, + TB_CENTER = 1 << 18, + TB_EDITABLE = 1 << 19, + TB_MARKUP = 1 << 20, + TB_WRAP = 1 << 21, } TextboxFlags; typedef enum diff --git a/include/xrmoptions.h b/include/xrmoptions.h index ab621cae..0d4ffdac 100644 --- a/include/xrmoptions.h +++ b/include/xrmoptions.h @@ -38,6 +38,10 @@ void config_parse_cmd_options_dynamic ( void ); void config_parse_xresource_options_dynamic ( Display *display ); void config_parse_xresource_options_dynamic_file ( const char *filename ); +/** + * Initializes the Xresourced system. + */ +void config_parse_xresource_init ( void ); /** * Free any allocated memory. */ diff --git a/source/rofi.c b/source/rofi.c index b830114a..0714b1cd 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -2473,6 +2473,10 @@ int main ( int argc, char *argv[] ) sncontext = sn_launchee_context_new_from_environment ( sndisplay, DefaultScreen ( display ) ); } TICK_N ( "Startup Notification" ); + + // Initialize Xresources subsystem. + config_parse_xresource_init (); + TICK_N ( "Initialize Xresources system" ); // Setup keybinding setup_abe (); TICK_N ( "Setup abe" ); diff --git a/source/xrmoptions.c b/source/xrmoptions.c index d81053a2..f09b61b9 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -221,7 +221,6 @@ void config_parse_xresource_options ( Display *display ) { char *xRMS; // Map Xresource entries to rofi config options. - XrmInitialize (); xRMS = XResourceManagerString ( display ); if ( xRMS == NULL ) { @@ -237,7 +236,6 @@ void config_parse_xresource_options_file ( const char *filename ) return; } // Map Xresource entries to rofi config options. - XrmInitialize (); XrmDatabase xDB = XrmGetFileDatabase ( filename ); if ( xDB == NULL ) { return; @@ -331,7 +329,6 @@ void config_parse_xresource_options_dynamic ( Display *display ) { char *xRMS; // Map Xresource entries to rofi config options. - XrmInitialize (); xRMS = XResourceManagerString ( display ); if ( xRMS == NULL ) { @@ -347,7 +344,6 @@ void config_parse_xresource_options_dynamic_file ( const char *filename ) return; } // Map Xresource entries to rofi config options. - XrmInitialize (); XrmDatabase xDB = XrmGetFileDatabase ( filename ); if ( xDB == NULL ) { return; @@ -568,3 +564,8 @@ void print_xresources_theme ( void ) } } } + +void config_parse_xresource_init ( void ) +{ + XrmInitialize (); +}