Consolidate logging

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2017-04-15 11:58:49 +02:00
parent ba9e1fb92a
commit cfbe4027bc
No known key found for this signature in database
GPG Key ID: AC203F96E2C34BB7
16 changed files with 121 additions and 123 deletions

View File

@ -24,6 +24,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
#define G_LOG_DOMAIN "Dialogs.Combi"
#include <config.h> #include <config.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -85,7 +88,7 @@ static void combi_mode_parse_switchers ( Mode *sw )
} }
else { else {
// Report error, don't continue. // Report error, don't continue.
fprintf ( stderr, "Invalid script switcher: %s\n", token ); g_warning ( "Invalid script switcher: %s", token );
token = NULL; token = NULL;
} }
} }
@ -240,7 +243,7 @@ static char * combi_get_completion ( const Mode *sw, unsigned int index )
} }
} }
// Should never get here. // Should never get here.
g_error ( "Failure, could not resolve sub-switcher." ); g_assert_not_reached ();
return NULL; return NULL;
} }

View File

@ -25,6 +25,8 @@
* *
*/ */
#define G_LOG_DOMAIN "Dialogs.DMenu"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -47,9 +49,6 @@
#include "xrmoptions.h" #include "xrmoptions.h"
#include "view.h" #include "view.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Dialogs.DMenu"
struct range_pair struct range_pair
{ {
unsigned int start; unsigned int start;
@ -444,7 +443,7 @@ static int dmenu_mode_init ( Mode *sw )
char *estr = rofi_expand_path ( str ); char *estr = rofi_expand_path ( str );
fd = open ( str, O_RDONLY ); fd = open ( str, O_RDONLY );
if ( fd < 0 ) { if ( fd < 0 ) {
char *msg = g_markup_printf_escaped ( "Failed to open file: <b>%s</b>:\n\t<i>%s</i>", estr, strerror ( errno ) ); char *msg = g_markup_printf_escaped ( "Failed to open file: <b>%s</b>:\n\t<i>%s</i>", estr, g_strerror ( errno ) );
rofi_view_error_dialog ( msg, TRUE ); rofi_view_error_dialog ( msg, TRUE );
g_free ( msg ); g_free ( msg );
g_free ( estr ); g_free ( estr );

View File

@ -24,6 +24,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
#define G_LOG_DOMAIN "Dialogs.DRun"
#include <config.h> #include <config.h>
#ifdef ENABLE_DRUN #ifdef ENABLE_DRUN
#include <stdlib.h> #include <stdlib.h>
@ -48,8 +51,6 @@
#include "dialogs/drun.h" #include "dialogs/drun.h"
#define DRUN_CACHE_FILE "rofi2.druncache" #define DRUN_CACHE_FILE "rofi2.druncache"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Dialogs.DRun"
#define GET_CAT_PARSE_TIME #define GET_CAT_PARSE_TIME
@ -147,24 +148,24 @@ static void exec_cmd_entry ( DRunModeEntry *e )
GError *error = NULL; GError *error = NULL;
GRegex *reg = g_regex_new ( "%[a-zA-Z]", 0, 0, &error ); GRegex *reg = g_regex_new ( "%[a-zA-Z]", 0, 0, &error );
if ( error != NULL ) { if ( error != NULL ) {
fprintf ( stderr, "Internal error, failed to create regex: %s.\n", error->message ); g_warning ( "Internal error, failed to create regex: %s.", error->message );
g_error_free ( error ); g_error_free ( error );
return; return;
} }
struct RegexEvalArg earg = { .e = e, .success = TRUE }; struct RegexEvalArg earg = { .e = e, .success = TRUE };
char *str = g_regex_replace_eval ( reg, e->exec, -1, 0, 0, drun_helper_eval_cb, &earg, &error ); char *str = g_regex_replace_eval ( reg, e->exec, -1, 0, 0, drun_helper_eval_cb, &earg, &error );
if ( error != NULL ) { if ( error != NULL ) {
fprintf ( stderr, "Internal error, failed replace field codes: %s.\n", error->message ); g_warning ( "Internal error, failed replace field codes: %s.", error->message );
g_error_free ( error ); g_error_free ( error );
return; return;
} }
g_regex_unref ( reg ); g_regex_unref ( reg );
if ( earg.success == FALSE ) { if ( earg.success == FALSE ) {
fprintf ( stderr, "Invalid field code in Exec line: %s.\n", e->exec );; g_warning ( "Invalid field code in Exec line: %s.", e->exec );;
return; return;
} }
if ( str == NULL ) { if ( str == NULL ) {
fprintf ( stderr, "Nothing to execute after processing: %s.\n", e->exec );; g_warning ( "Nothing to execute after processing: %s.", e->exec );;
return; return;
} }
gchar *fp = rofi_expand_path ( g_strstrip ( str ) ); gchar *fp = rofi_expand_path ( g_strstrip ( str ) );
@ -237,7 +238,7 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
// Name key is required. // Name key is required.
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Name", NULL ) ) { if ( !g_key_file_has_key ( kf, "Desktop Entry", "Name", NULL ) ) {
g_debug ( "Invalid DesktopFile: '%s', no 'Name' key present.\n", path ); g_debug ( "Invalid DesktopFile: '%s', no 'Name' key present.", path );
g_key_file_free ( kf ); g_key_file_free ( kf );
return FALSE; return FALSE;
} }
@ -258,7 +259,7 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
} }
// We need Exec, don't support DBusActivatable // We need Exec, don't support DBusActivatable
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Exec", NULL ) ) { if ( !g_key_file_has_key ( kf, "Desktop Entry", "Exec", NULL ) ) {
g_debug ( "Unsupported DesktopFile: '%s', no 'Exec' key present.\n", path ); g_debug ( "Unsupported DesktopFile: '%s', no 'Exec' key present.", path );
g_key_file_free ( kf ); g_key_file_free ( kf );
return FALSE; return FALSE;
} }

View File

@ -29,6 +29,10 @@
* \ingroup RUNMode * \ingroup RUNMode
* @{ * @{
*/ */
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.Run"
#include <config.h> #include <config.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -56,10 +60,6 @@
*/ */
#define RUN_CACHE_FILE "rofi-3.runcache" #define RUN_CACHE_FILE "rofi-3.runcache"
/** The log domain of this dialog. */
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Dialogs.Run"
/** /**
* The internal data structure holding the private data of the Run Mode. * The internal data structure holding the private data of the Run Mode.
*/ */
@ -86,7 +86,7 @@ static void exec_cmd ( const char *cmd, int run_in_term )
gsize lf_cmd_size = 0; gsize lf_cmd_size = 0;
gchar *lf_cmd = g_locale_from_utf8 ( cmd, -1, NULL, &lf_cmd_size, &error ); gchar *lf_cmd = g_locale_from_utf8 ( cmd, -1, NULL, &lf_cmd_size, &error );
if ( error != NULL ) { if ( error != NULL ) {
fprintf ( stderr, "Failed to convert command to locale encoding: %s\n", error->message ); g_warning ( "Failed to convert command to locale encoding: %s", error->message );
g_error_free ( error ); g_error_free ( error );
return; return;
} }
@ -188,8 +188,8 @@ static char ** get_apps_external ( char **retv, unsigned int *length, unsigned i
free ( buffer ); free ( buffer );
} }
if ( fclose ( inp ) != 0 ) { if ( fclose ( inp ) != 0 ) {
fprintf ( stderr, "Failed to close stdout off executor script: '%s'\n", g_warning ( "Failed to close stdout off executor script: '%s'",
strerror ( errno ) ); g_strerror ( errno ) );
} }
} }
} }

View File

@ -25,6 +25,8 @@
* *
*/ */
#define G_LOG_DOMAIN "Dialogs.Script"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -66,8 +68,8 @@ static char **get_script_output ( const char *command, unsigned int *length )
free ( buffer ); free ( buffer );
} }
if ( fclose ( inp ) != 0 ) { if ( fclose ( inp ) != 0 ) {
fprintf ( stderr, "Failed to close stdout off executor script: '%s'\n", g_warning ( "Failed to close stdout off executor script: '%s'",
strerror ( errno ) ); g_strerror ( errno ) );
} }
} }
} }
@ -201,7 +203,7 @@ Mode *script_switcher_parse_setup ( const char *str )
return sw; return sw;
} }
fprintf ( stderr, "The script command '%s' has %u options, but needs 2: <name>:<script>.\n", str, index ); g_warning ( "The script command '%s' has %u options, but needs 2: <name>:<script>.", str, index );
script_switcher_free ( sw ); script_switcher_free ( sw );
return NULL; return NULL;
} }

View File

@ -29,6 +29,12 @@
* \ingroup SSHMode * \ingroup SSHMode
* @{ * @{
*/ */
/**
* Log domain for the ssh modi.
*/
#define G_LOG_DOMAIN "Dialogs.Ssh"
#include <config.h> #include <config.h>
#include <glib.h> #include <glib.h>
#include <stdlib.h> #include <stdlib.h>
@ -50,13 +56,6 @@
#include "history.h" #include "history.h"
#include "dialogs/ssh.h" #include "dialogs/ssh.h"
/**
* Log domain for the ssh modi.
*/
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Dialogs.Ssh"
/** /**
* Name of the history file where previously choosen hosts are stored. * Name of the history file where previously choosen hosts are stored.
*/ */
@ -181,7 +180,7 @@ static char **read_known_hosts_file ( char ** retv, unsigned int *length )
free ( buffer ); free ( buffer );
} }
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close hosts file: '%s'\n", strerror ( errno ) ); g_warning ( "Failed to close hosts file: '%s'", g_strerror ( errno ) );
} }
} }
@ -256,7 +255,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
free ( buffer ); free ( buffer );
} }
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close hosts file: '%s'\n", strerror ( errno ) ); g_warning ( "Failed to close hosts file: '%s'", g_strerror ( errno ) );
} }
} }
@ -357,7 +356,7 @@ static void parse_ssh_config_file ( const char *filename, char ***retv, unsigned
} }
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close ssh configuration file: '%s'\n", strerror ( errno ) ); g_warning ( "Failed to close ssh configuration file: '%s'", g_strerror ( errno ) );
} }
} }
} }

View File

@ -24,6 +24,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
#define G_LOG_DOMAIN "Dialogs.Window"
#include <config.h> #include <config.h>
#ifdef WINDOW_MODE #ifdef WINDOW_MODE
@ -56,9 +59,6 @@
#define CLIENTSTATE 10 #define CLIENTSTATE 10
#define CLIENTWINDOWTYPE 10 #define CLIENTWINDOWTYPE 10
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Dialogs.Window"
// a manageable window // a manageable window
typedef struct typedef struct
{ {

View File

@ -25,6 +25,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
#define G_LOG_DOMAIN "Helper"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -51,9 +54,6 @@
#include "rofi.h" #include "rofi.h"
#include "view.h" #include "view.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Helper"
/** /**
* Textual description of positioning rofi. * Textual description of positioning rofi.
*/ */
@ -383,7 +383,7 @@ char helper_parse_char ( const char *arg )
if ( len > 2 && arg[0] == '\\' && arg[1] == 'x' ) { if ( len > 2 && arg[0] == '\\' && arg[1] == 'x' ) {
return (char) strtol ( &arg[2], NULL, 16 ); return (char) strtol ( &arg[2], NULL, 16 );
} }
fprintf ( stderr, "Failed to parse character string: \"%s\"\n", arg ); g_warning ( "Failed to parse character string: \"%s\"", arg );
// for now default to newline. // for now default to newline.
return '\n'; return '\n';
} }
@ -491,22 +491,22 @@ int create_pid_file ( const char *pidfile )
int fd = g_open ( pidfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR ); int fd = g_open ( pidfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR );
if ( fd < 0 ) { if ( fd < 0 ) {
fprintf ( stderr, "Failed to create pid file: '%s'.\n", pidfile ); g_warning ( "Failed to create pid file: '%s'.", pidfile );
return -1; return -1;
} }
// Set it to close the File Descriptor on exit. // Set it to close the File Descriptor on exit.
int flags = fcntl ( fd, F_GETFD, NULL ); int flags = fcntl ( fd, F_GETFD, NULL );
flags = flags | FD_CLOEXEC; flags = flags | FD_CLOEXEC;
if ( fcntl ( fd, F_SETFD, flags, NULL ) < 0 ) { if ( fcntl ( fd, F_SETFD, flags, NULL ) < 0 ) {
fprintf ( stderr, "Failed to set CLOEXEC on pidfile.\n" ); g_warning ( "Failed to set CLOEXEC on pidfile." );
remove_pid_file ( fd ); remove_pid_file ( fd );
return -1; return -1;
} }
// Try to get exclusive write lock on FD // Try to get exclusive write lock on FD
int retv = flock ( fd, LOCK_EX | LOCK_NB ); int retv = flock ( fd, LOCK_EX | LOCK_NB );
if ( retv != 0 ) { if ( retv != 0 ) {
fprintf ( stderr, "Failed to set lock on pidfile: Rofi already running?\n" ); g_warning ( "Failed to set lock on pidfile: Rofi already running?" );
fprintf ( stderr, "Got error: %d %s\n", retv, strerror ( errno ) ); g_warning ( "Got error: %d %s", retv, g_strerror ( errno ) );
remove_pid_file ( fd ); remove_pid_file ( fd );
return -1; return -1;
} }
@ -526,7 +526,7 @@ void remove_pid_file ( int fd )
{ {
if ( fd >= 0 ) { if ( fd >= 0 ) {
if ( close ( fd ) ) { if ( close ( fd ) ) {
fprintf ( stderr, "Failed to close pidfile: '%s'\n", strerror ( errno ) ); g_warning ( "Failed to close pidfile: '%s'", g_strerror ( errno ) );
} }
} }
} }

View File

@ -145,7 +145,7 @@ void history_set ( const char *filename, const char *entry )
list = __history_get_element_list ( fd, &length ); list = __history_get_element_list ( fd, &length );
// Close file, if fails let user know on stderr. // Close file, if fails let user know on stderr.
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close history file: %s\n", strerror ( errno ) ); g_warning ( "Failed to close history file: %s", g_strerror ( errno ) );
} }
} }
// Look if the entry exists. // Look if the entry exists.
@ -178,14 +178,14 @@ void history_set ( const char *filename, const char *entry )
fd = fopen ( filename, "w" ); fd = fopen ( filename, "w" );
if ( fd == NULL ) { if ( fd == NULL ) {
fprintf ( stderr, "Failed to open file: %s\n", strerror ( errno ) ); g_warning ( "Failed to open file: %s", g_strerror ( errno ) );
} }
else { else {
// Write list. // Write list.
__history_write_element_list ( fd, list, length ); __history_write_element_list ( fd, list, length );
// Close file, if fails let user know on stderr. // Close file, if fails let user know on stderr.
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close history file: %s\n", strerror ( errno ) ); g_warning ( "Failed to close history file: %s", g_strerror ( errno ) );
} }
} }
// Free the list. // Free the list.
@ -208,7 +208,7 @@ void history_remove ( const char *filename, const char *entry )
// Open file for reading and writing. // Open file for reading and writing.
FILE *fd = g_fopen ( filename, "r" ); FILE *fd = g_fopen ( filename, "r" );
if ( fd == NULL ) { if ( fd == NULL ) {
fprintf ( stderr, "Failed to open file: %s\n", strerror ( errno ) ); g_warning ( "Failed to open file: %s", g_strerror ( errno ) );
return; return;
} }
// Get list. // Get list.
@ -216,7 +216,7 @@ void history_remove ( const char *filename, const char *entry )
// Close file, if fails let user know on stderr. // Close file, if fails let user know on stderr.
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close history file: %s\n", strerror ( errno ) ); g_warning ( "Failed to close history file: %s", g_strerror ( errno ) );
} }
// Find entry. // Find entry.
for ( unsigned int iter = 0; !found && iter < length; iter++ ) { for ( unsigned int iter = 0; !found && iter < length; iter++ ) {
@ -244,11 +244,11 @@ void history_remove ( const char *filename, const char *entry )
__history_write_element_list ( fd, list, length ); __history_write_element_list ( fd, list, length );
// Close file, if fails let user know on stderr. // Close file, if fails let user know on stderr.
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close history file: %s\n", strerror ( errno ) ); g_warning ( "Failed to close history file: %s", g_strerror ( errno ) );
} }
} }
else{ else{
fprintf ( stderr, "Failed to open file: %s\n", strerror ( errno ) ); g_warning ( "Failed to open file: %s", g_strerror ( errno ) );
} }
} }
@ -277,7 +277,7 @@ char ** history_get_list ( const char *filename, unsigned int *length )
// File that does not exists is not an error, so ignore it. // File that does not exists is not an error, so ignore it.
// Everything else? panic. // Everything else? panic.
if ( errno != ENOENT ) { if ( errno != ENOENT ) {
fprintf ( stderr, "Failed to open file: %s\n", strerror ( errno ) ); g_warning ( "Failed to open file: %s", g_strerror ( errno ) );
} }
return NULL; return NULL;
} }
@ -298,7 +298,7 @@ char ** history_get_list ( const char *filename, unsigned int *length )
// Close file, if fails let user know on stderr. // Close file, if fails let user know on stderr.
if ( fclose ( fd ) != 0 ) { if ( fclose ( fd ) != 0 ) {
fprintf ( stderr, "Failed to close history file: %s\n", strerror ( errno ) ); g_warning ( "Failed to close history file: %s", g_strerror ( errno ) );
} }
return retv; return retv;
} }

View File

@ -25,6 +25,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#define G_LOG_DOMAIN "Rofi"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -75,9 +77,6 @@
// TODO: move this check to mode.c // TODO: move this check to mode.c
#include "mode-private.h" #include "mode-private.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Rofi"
// Pidfile. // Pidfile.
char *pidfile = NULL; char *pidfile = NULL;
const char *cache_dir = NULL; const char *cache_dir = NULL;
@ -310,7 +309,7 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
break; break;
} }
} }
fprintf ( stderr, " * %s%s%s%s\n", printf ( " * %s%s%s%s\n",
active?"+":"" , active?"+":"" ,
is_term ? (active?color_green:color_red) : "", is_term ? (active?color_green:color_red) : "",
available_modi[i]->name, available_modi[i]->name,
@ -367,9 +366,9 @@ static void help_print_disabled_mode ( const char *mode )
int is_term = isatty ( fileno ( stdout ) ); int is_term = isatty ( fileno ( stdout ) );
// Only output to terminal // Only output to terminal
if ( is_term ) { if ( is_term ) {
fprintf ( stderr, "Mode %s%s%s is not enabled. I have enabled it for now.\n", g_warning ( "Mode %s%s%s is not enabled. I have enabled it for now.",
color_red, mode, color_reset ); color_red, mode, color_reset );
fprintf ( stderr, "Please consider adding %s%s%s to the list of enabled modi: %smodi: %s%s%s,%s%s.\n", g_warning ( "Please consider adding %s%s%s to the list of enabled modi: %smodi: %s%s%s,%s%s.",
color_red, mode, color_reset, color_red, mode, color_reset,
color_green, config.modi, color_reset, color_green, config.modi, color_reset,
color_red, mode, color_reset color_red, mode, color_reset
@ -533,7 +532,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
Mode *m = NULL; Mode *m = NULL;
if ( g_module_symbol ( mod, "mode", (gpointer *) &m ) ) { if ( g_module_symbol ( mod, "mode", (gpointer *) &m ) ) {
if ( m->abi_version != ABI_VERSION ) { if ( m->abi_version != ABI_VERSION ) {
fprintf ( stderr, "ABI version of plugin does not match: %08X expecting: %08X\n", m->abi_version, ABI_VERSION ); g_warning ( "ABI version of plugin does not match: %08X expecting: %08X", m->abi_version, ABI_VERSION );
g_module_close ( mod ); g_module_close ( mod );
} }
else { else {
@ -544,7 +543,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
} }
} }
else { else {
fprintf ( stderr, "Symbol 'mode' not found in module: %s\n", fn ); g_warning ( "Symbol 'mode' not found in module: %s", fn );
g_module_close ( mod ); g_module_close ( mod );
} }
} }
@ -622,7 +621,7 @@ static int add_mode ( const char * token )
} }
else { else {
// Report error, don't continue. // Report error, don't continue.
fprintf ( stderr, "Invalid script mode: %s\n", token ); g_warning ( "Invalid script mode: %s", token );
} }
} }
return ( index == num_modi ) ? -1 : (int) index; return ( index == num_modi ) ? -1 : (int) index;
@ -664,7 +663,7 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
if ( ev == NULL ) { if ( ev == NULL ) {
int status = xcb_connection_has_error ( xcb->connection ); int status = xcb_connection_has_error ( xcb->connection );
if(status > 0) { if(status > 0) {
fprintf ( stderr, "The XCB connection to X server had a fatal error: %d\n", status ); g_warning ( "The XCB connection to X server had a fatal error: %d", status );
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} else { } else {
@ -732,7 +731,7 @@ static void error_trap_push ( G_GNUC_UNUSED SnDisplay *display, G_GNUC_UNUSED xc
static void error_trap_pop ( G_GNUC_UNUSED SnDisplay *display, xcb_connection_t *xdisplay ) static void error_trap_pop ( G_GNUC_UNUSED SnDisplay *display, xcb_connection_t *xdisplay )
{ {
if ( error_trap_depth == 0 ) { if ( error_trap_depth == 0 ) {
fprintf ( stderr, "Error trap underflow!\n" ); g_warning ( "Error trap underflow!" );
exit ( EXIT_FAILURE ); exit ( EXIT_FAILURE );
} }
@ -747,7 +746,7 @@ static gboolean lazy_grab_pointer ( G_GNUC_UNUSED gpointer data )
{ {
// After 5 sec. // After 5 sec.
if ( lazy_grab_retry_count_pt > ( 5 * 1000 ) ) { if ( lazy_grab_retry_count_pt > ( 5 * 1000 ) ) {
fprintf ( stderr, "Failed to grab pointer after %u times. Giving up.\n", lazy_grab_retry_count_pt ); g_warning ( "Failed to grab pointer after %u times. Giving up.", lazy_grab_retry_count_pt );
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
if ( take_pointer ( xcb_stuff_get_root_window ( xcb ), 0 ) ) { if ( take_pointer ( xcb_stuff_get_root_window ( xcb ), 0 ) ) {
@ -760,7 +759,7 @@ static gboolean lazy_grab_keyboard ( G_GNUC_UNUSED gpointer data )
{ {
// After 5 sec. // After 5 sec.
if ( lazy_grab_retry_count_kb > ( 5 * 1000 ) ) { if ( lazy_grab_retry_count_kb > ( 5 * 1000 ) ) {
fprintf ( stderr, "Failed to grab keyboard after %u times. Giving up.\n", lazy_grab_retry_count_kb ); g_warning ( "Failed to grab keyboard after %u times. Giving up.", lazy_grab_retry_count_kb );
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -792,12 +791,12 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
if ( ( window_flags & MENU_NORMAL_WINDOW ) == 0 ) { if ( ( window_flags & MENU_NORMAL_WINDOW ) == 0 ) {
if ( find_arg ( "-no-lazy-grab" ) >= 0 ) { if ( find_arg ( "-no-lazy-grab" ) >= 0 ) {
if ( !take_keyboard ( xcb_stuff_get_root_window ( xcb ), 500 ) ) { if ( !take_keyboard ( xcb_stuff_get_root_window ( xcb ), 500 ) ) {
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 ); g_warning ( "Failed to grab keyboard, even after %d uS.", 500 * 1000 );
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
if ( !take_pointer ( xcb_stuff_get_root_window ( xcb ), 100 ) ) { if ( !take_pointer ( xcb_stuff_get_root_window ( xcb ), 100 ) ) {
fprintf ( stderr, "Failed to grab mouse pointer, even after %d uS.", 100 * 1000 ); g_warning ( "Failed to grab mouse pointer, even after %d uS.", 100 * 1000 );
} }
} }
else { else {
@ -874,7 +873,7 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
run_switcher ( index ); run_switcher ( index );
} }
else { else {
fprintf ( stderr, "The %s mode has not been enabled\n", sname ); g_warning ( "The %s mode has not been enabled", sname );
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -908,9 +907,9 @@ int main ( int argc, char *argv[] )
// Version // Version
if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) { if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) {
#ifdef GIT_VERSION #ifdef GIT_VERSION
fprintf ( stdout, "Version: "GIT_VERSION "\n" ); g_print ( "Version: "GIT_VERSION "\n" );
#else #else
fprintf ( stdout, "Version: "VERSION "\n" ); g_print ( "Version: "VERSION "\n" );
#endif #endif
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -935,7 +934,7 @@ int main ( int argc, char *argv[] )
cache_dir = g_get_user_cache_dir (); cache_dir = g_get_user_cache_dir ();
if ( g_mkdir_with_parents ( cache_dir, 0700 ) < 0 ) { if ( g_mkdir_with_parents ( cache_dir, 0700 ) < 0 ) {
fprintf ( stderr, "Failed to create cache directory: %s\n", strerror ( errno ) ); g_warning ( "Failed to create cache directory: %s", g_strerror ( errno ) );
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -943,7 +942,7 @@ int main ( int argc, char *argv[] )
const char *path = g_get_user_runtime_dir (); const char *path = g_get_user_runtime_dir ();
if ( path ) { if ( path ) {
if ( g_mkdir_with_parents ( path, 0700 ) < 0 ) { if ( g_mkdir_with_parents ( path, 0700 ) < 0 ) {
g_warning ( "Failed to create user runtime directory: %s with error: %s\n", path, strerror ( errno ) ); g_warning ( "Failed to create user runtime directory: %s with error: %s", path, g_strerror ( errno ) );
pidfile = g_build_filename ( g_get_home_dir (), ".rofi.pid", NULL ); pidfile = g_build_filename ( g_get_home_dir (), ".rofi.pid", NULL );
} }
else { else {
@ -966,7 +965,7 @@ int main ( int argc, char *argv[] )
TICK (); TICK ();
if ( setlocale ( LC_ALL, "" ) == NULL ) { if ( setlocale ( LC_ALL, "" ) == NULL ) {
fprintf ( stderr, "Failed to set locale.\n" ); g_warning ( "Failed to set locale." );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -978,7 +977,7 @@ int main ( int argc, char *argv[] )
xcb->connection = xcb_connect ( display_str, &xcb->screen_nbr ); xcb->connection = xcb_connect ( display_str, &xcb->screen_nbr );
if ( xcb_connection_has_error ( xcb->connection ) ) { if ( xcb_connection_has_error ( xcb->connection ) ) {
fprintf ( stderr, "Failed to open display: %s", display_str ); g_warning( "Failed to open display: %s", display_str );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -996,7 +995,7 @@ int main ( int argc, char *argv[] )
xcb_generic_error_t *errors = NULL; xcb_generic_error_t *errors = NULL;
xcb_ewmh_init_atoms_replies ( &xcb->ewmh, ac, &errors ); xcb_ewmh_init_atoms_replies ( &xcb->ewmh, ac, &errors );
if ( errors ) { if ( errors ) {
fprintf ( stderr, "Failed to create EWMH atoms\n" ); g_warning ( "Failed to create EWMH atoms" );
free ( errors ); free ( errors );
} }
// Discover the current active window manager. // Discover the current active window manager.
@ -1005,14 +1004,14 @@ int main ( int argc, char *argv[] )
if ( xkb_x11_setup_xkb_extension ( xcb->connection, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION, if ( xkb_x11_setup_xkb_extension ( xcb->connection, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION,
XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS, NULL, NULL, &xkb.first_event, NULL ) < 0 ) { XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS, NULL, NULL, &xkb.first_event, NULL ) < 0 ) {
fprintf ( stderr, "cannot setup XKB extension!\n" ); g_warning ( "cannot setup XKB extension!" );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
xkb.context = xkb_context_new ( XKB_CONTEXT_NO_FLAGS ); xkb.context = xkb_context_new ( XKB_CONTEXT_NO_FLAGS );
if ( xkb.context == NULL ) { if ( xkb.context == NULL ) {
fprintf ( stderr, "cannot create XKB context!\n" ); g_warning ( "cannot create XKB context!" );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -1063,13 +1062,13 @@ int main ( int argc, char *argv[] )
xkb.keymap = xkb_x11_keymap_new_from_device ( xkb.context, xcb->connection, xkb.device_id, XKB_KEYMAP_COMPILE_NO_FLAGS ); xkb.keymap = xkb_x11_keymap_new_from_device ( xkb.context, xcb->connection, xkb.device_id, XKB_KEYMAP_COMPILE_NO_FLAGS );
if ( xkb.keymap == NULL ) { if ( xkb.keymap == NULL ) {
fprintf ( stderr, "Failed to get Keymap for current keyboard device.\n" ); g_warning ( "Failed to get Keymap for current keyboard device." );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id ); xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id );
if ( xkb.state == NULL ) { if ( xkb.state == NULL ) {
fprintf ( stderr, "Failed to get state object for current keyboard device.\n" ); g_warning ( "Failed to get state object for current keyboard device." );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -1079,18 +1078,18 @@ int main ( int argc, char *argv[] )
xkb.compose.state = xkb_compose_state_new ( xkb.compose.table, 0 ); xkb.compose.state = xkb_compose_state_new ( xkb.compose.table, 0 );
} }
else { else {
fprintf ( stderr, "Failed to get keyboard compose table. Trying to limp on.\n" ); g_warning ( "Failed to get keyboard compose table. Trying to limp on." );
} }
if ( xcb_connection_has_error ( xcb->connection ) ) { if ( xcb_connection_has_error ( xcb->connection ) ) {
fprintf ( stderr, "Connection has error\n" ); g_warning ( "Connection has error" );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
x11_setup ( &xkb ); x11_setup ( &xkb );
TICK_N ( "Setup xkb" ); TICK_N ( "Setup xkb" );
if ( xcb_connection_has_error ( xcb->connection ) ) { if ( xcb_connection_has_error ( xcb->connection ) ) {
fprintf ( stderr, "Connection has error\n" ); g_warning ( "Connection has error" );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -1100,7 +1099,7 @@ int main ( int argc, char *argv[] )
// startup not. // startup not.
xcb->sndisplay = sn_xcb_display_new ( xcb->connection, error_trap_push, error_trap_pop ); xcb->sndisplay = sn_xcb_display_new ( xcb->connection, error_trap_push, error_trap_pop );
if ( xcb_connection_has_error ( xcb->connection ) ) { if ( xcb_connection_has_error ( xcb->connection ) ) {
fprintf ( stderr, "Connection has error\n" ); g_warning ( "Connection has error" );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -1109,7 +1108,7 @@ int main ( int argc, char *argv[] )
xcb->sncontext = sn_launchee_context_new_from_environment ( xcb->sndisplay, xcb->screen_nbr ); xcb->sncontext = sn_launchee_context_new_from_environment ( xcb->sndisplay, xcb->screen_nbr );
} }
if ( xcb_connection_has_error ( xcb->connection ) ) { if ( xcb_connection_has_error ( xcb->connection ) ) {
fprintf ( stderr, "Connection has error\n" ); g_warning ( "Connection has error" );
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -1162,11 +1161,11 @@ int main ( int argc, char *argv[] )
} }
if ( rofi_theme_is_empty ( ) ) { if ( rofi_theme_is_empty ( ) ) {
if ( rofi_theme_parse_string ( default_theme ) ) { if ( rofi_theme_parse_string ( default_theme ) ) {
fprintf ( stderr, "Failed to parse default theme. Giving up..\n" ); g_warning ( "Failed to parse default theme. Giving up.." );
if ( list_of_error_msgs ) { if ( list_of_error_msgs ) {
for ( GList *iter = g_list_first ( list_of_error_msgs ); for ( GList *iter = g_list_first ( list_of_error_msgs );
iter != NULL; iter = g_list_next ( iter ) ) { iter != NULL; iter = g_list_next ( iter ) ) {
fprintf ( stderr, "Error: %s%s%s\n", g_warning ( "Error: %s%s%s",
color_bold, ( (GString *) iter->data )->str, color_reset ); color_bold, ( (GString *) iter->data )->str, color_reset );
} }
} }

View File

@ -1,3 +1,6 @@
#define G_LOG_DOMAIN "Theme"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
@ -10,10 +13,6 @@
#include "view.h" #include "view.h"
#include "rofi.h" #include "rofi.h"
/** Logging domain for theme */
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Theme"
/** /**
* Name of the property type * Name of the property type
*/ */

View File

@ -24,6 +24,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/** The Rofi View log domain */
#define G_LOG_DOMAIN "View"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -63,10 +66,6 @@
#include "theme.h" #include "theme.h"
/** The Rofi View log domain */
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "View"
#include "xcb.h" #include "xcb.h"
/** /**
* @param state The handle to the view * @param state The handle to the view
@ -178,12 +177,12 @@ static void menu_capture_screenshot ( void )
const char *outp = g_getenv ( "ROFI_PNG_OUTPUT" ); const char *outp = g_getenv ( "ROFI_PNG_OUTPUT" );
if ( CacheState.edit_surf == NULL ) { if ( CacheState.edit_surf == NULL ) {
// Nothing to store. // Nothing to store.
fprintf ( stderr, "There is no rofi surface to store\n" ); g_warning ( "There is no rofi surface to store" );
return; return;
} }
const char *xdg_pict_dir = g_get_user_special_dir ( G_USER_DIRECTORY_PICTURES ); const char *xdg_pict_dir = g_get_user_special_dir ( G_USER_DIRECTORY_PICTURES );
if ( outp == NULL && xdg_pict_dir == NULL ) { if ( outp == NULL && xdg_pict_dir == NULL ) {
fprintf ( stderr, "XDG user picture directory or ROFI_PNG_OUTPUT is not set. Cannot store screenshot.\n" ); g_warning ( "XDG user picture directory or ROFI_PNG_OUTPUT is not set. Cannot store screenshot." );
return; return;
} }
// Get current time. // Get current time.
@ -210,10 +209,10 @@ static void menu_capture_screenshot ( void )
else { else {
fpath = g_strdup ( outp ); fpath = g_strdup ( outp );
} }
fprintf ( stderr, color_green "Storing screenshot %s\n"color_reset, fpath ); g_warning ( color_green "Storing screenshot %s\n"color_reset, fpath );
cairo_status_t status = cairo_surface_write_to_png ( CacheState.edit_surf, fpath ); cairo_status_t status = cairo_surface_write_to_png ( CacheState.edit_surf, fpath );
if ( status != CAIRO_STATUS_SUCCESS ) { if ( status != CAIRO_STATUS_SUCCESS ) {
fprintf ( stderr, "Failed to produce screenshot '%s', got error: '%s'\n", fpath, g_warning ( "Failed to produce screenshot '%s', got error: '%s'", fpath,
cairo_status_to_string ( status ) ); cairo_status_to_string ( status ) );
} }
g_free ( fpath ); g_free ( fpath );
@ -978,7 +977,7 @@ void rofi_view_update ( RofiViewState *state, gboolean qr )
static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t *xse ) static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t *xse )
{ {
if ( xse->property == XCB_ATOM_NONE ) { if ( xse->property == XCB_ATOM_NONE ) {
fprintf ( stderr, "Failed to convert selection\n" ); g_warning ( "Failed to convert selection" );
} }
else if ( xse->property == xcb->ewmh.UTF8_STRING ) { else if ( xse->property == xcb->ewmh.UTF8_STRING ) {
gchar *text = window_get_text_prop ( CacheState.main_window, xcb->ewmh.UTF8_STRING ); gchar *text = window_get_text_prop ( CacheState.main_window, xcb->ewmh.UTF8_STRING );
@ -999,7 +998,7 @@ static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t
g_free ( text ); g_free ( text );
} }
else { else {
fprintf ( stderr, "Failed\n" ); g_warning ( "Failed" );
} }
} }
@ -1443,7 +1442,7 @@ void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *ev, xkb_st
CacheState.edit_surf = cairo_xcb_surface_create ( xcb->connection, CacheState.edit_pixmap, visual, state->width, state->height ); CacheState.edit_surf = cairo_xcb_surface_create ( xcb->connection, CacheState.edit_pixmap, visual, state->width, state->height );
CacheState.edit_draw = cairo_create ( CacheState.edit_surf ); CacheState.edit_draw = cairo_create ( CacheState.edit_surf );
g_debug ( "Re-size window based external request: %d %d\n", state->width, state->height ); g_debug ( "Re-size window based external request: %d %d", state->width, state->height );
widget_resize ( WIDGET ( state->main_window ), state->width, state->height ); widget_resize ( WIDGET ( state->main_window ), state->width, state->height );
} }
} }
@ -1791,7 +1790,7 @@ void rofi_view_workers_initialize ( void )
} }
// If error occured during setup of pool, tell user and exit. // If error occured during setup of pool, tell user and exit.
if ( error != NULL ) { if ( error != NULL ) {
fprintf ( stderr, "Failed to setup thread pool: '%s'", error->message ); g_warning ( "Failed to setup thread pool: '%s'", error->message );
g_error_free ( error ); g_error_free ( error );
exit ( EXIT_FAILURE ); exit ( EXIT_FAILURE );
} }

View File

@ -24,6 +24,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#define G_LOG_DOMAIN "Widgets.Box"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include "widgets/widget.h" #include "widgets/widget.h"
@ -31,9 +33,6 @@
#include "widgets/box.h" #include "widgets/box.h"
#include "theme.h" #include "theme.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Widgets.Box"
/** Default spacing used in the box*/ /** Default spacing used in the box*/
#define DEFAULT_SPACING 2 #define DEFAULT_SPACING 2

View File

@ -24,6 +24,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#define G_LOG_DOMAIN "Widgets.Window"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include "widgets/widget.h" #include "widgets/widget.h"
@ -31,9 +33,6 @@
#include "widgets/container.h" #include "widgets/container.h"
#include "theme.h" #include "theme.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Widgets.Window"
struct _window struct _window
{ {
widget widget; widget widget;

View File

@ -25,6 +25,10 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
/** Log domain for this module */
#define G_LOG_DOMAIN "X11Helper"
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -52,11 +56,6 @@
#define INTERSECT( x, y, x1, y1, w1, h1 ) ( ( ( ( x ) >= ( x1 ) ) && ( ( x ) < ( x1 + w1 ) ) ) && ( ( ( y ) >= ( y1 ) ) && ( ( y ) < ( y1 + h1 ) ) ) ) #define INTERSECT( x, y, x1, y1, w1, h1 ) ( ( ( ( x ) >= ( x1 ) ) && ( ( x ) < ( x1 + w1 ) ) ) && ( ( ( y ) >= ( y1 ) ) && ( ( y ) < ( y1 + h1 ) ) ) )
#include "x11-helper.h" #include "x11-helper.h"
#include "xkb-internal.h" #include "xkb-internal.h"
/** Log domain for this module */
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "X11Helper"
WindowManager current_window_manager = WM_EWHM; WindowManager current_window_manager = WM_EWHM;
/** /**
@ -523,7 +522,7 @@ int monitor_active ( workarea *mon )
if ( monitor_get_dimension ( mon_id, mon ) ) { if ( monitor_get_dimension ( mon_id, mon ) ) {
return TRUE; return TRUE;
} }
fprintf ( stderr, "Failed to find selected monitor.\n" ); g_warning ( "Failed to find selected monitor." );
} }
else { else {
return monitor_active_from_id ( mon_id, mon ); return monitor_active_from_id ( mon_id, mon );
@ -538,7 +537,7 @@ int take_pointer ( xcb_window_t w, int iters )
int i = 0; int i = 0;
while ( TRUE ) { while ( TRUE ) {
if ( xcb_connection_has_error ( xcb->connection ) ) { if ( xcb_connection_has_error ( xcb->connection ) ) {
fprintf ( stderr, "Connection has error\n" ); g_warning ( "Connection has error" );
exit ( EXIT_FAILURE ); exit ( EXIT_FAILURE );
} }
xcb_grab_pointer_cookie_t cc = xcb_grab_pointer ( xcb->connection, 1, w, XCB_EVENT_MASK_BUTTON_RELEASE, xcb_grab_pointer_cookie_t cc = xcb_grab_pointer ( xcb->connection, 1, w, XCB_EVENT_MASK_BUTTON_RELEASE,
@ -563,7 +562,7 @@ int take_keyboard ( xcb_window_t w, int iters )
int i = 0; int i = 0;
while ( TRUE ) { while ( TRUE ) {
if ( xcb_connection_has_error ( xcb->connection ) ) { if ( xcb_connection_has_error ( xcb->connection ) ) {
fprintf ( stderr, "Connection has error\n" ); g_warning ( "Connection has error" );
exit ( EXIT_FAILURE ); exit ( EXIT_FAILURE );
} }
xcb_grab_keyboard_cookie_t cc = xcb_grab_keyboard ( xcb->connection, xcb_grab_keyboard_cookie_t cc = xcb_grab_keyboard ( xcb->connection,

View File

@ -368,7 +368,7 @@ static void __config_parser_set_property ( XrmOption *option, const Property *p
{ {
if ( option->type == xrm_String ) { if ( option->type == xrm_String ) {
if ( p->type != P_STRING ) { if ( p->type != P_STRING ) {
fprintf ( stderr, "Option: %s needs to be set with a string.\n", option->name ); g_warning ( "Option: %s needs to be set with a string.", option->name );
return; return;
} }
if ( ( option )->mem != NULL ) { if ( ( option )->mem != NULL ) {
@ -383,7 +383,7 @@ static void __config_parser_set_property ( XrmOption *option, const Property *p
} }
else if ( option->type == xrm_Number ) { else if ( option->type == xrm_Number ) {
if ( p->type != P_INTEGER ) { if ( p->type != P_INTEGER ) {
fprintf ( stderr, "Option: %s needs to be set with a number.\n", option->name ); g_warning ( "Option: %s needs to be set with a number.", option->name );
return; return;
} }
*( option->value.snum ) = p->value.i; *( option->value.snum ) = p->value.i;
@ -391,7 +391,7 @@ static void __config_parser_set_property ( XrmOption *option, const Property *p
} }
else if ( option->type == xrm_SNumber ) { else if ( option->type == xrm_SNumber ) {
if ( p->type != P_INTEGER ) { if ( p->type != P_INTEGER ) {
fprintf ( stderr, "Option: %s needs to be set with a number.\n", option->name ); g_warning ( "Option: %s needs to be set with a number.", option->name );
return; return;
} }
*( option->value.num ) = (unsigned int ) ( p->value.i ); *( option->value.num ) = (unsigned int ) ( p->value.i );
@ -399,7 +399,7 @@ static void __config_parser_set_property ( XrmOption *option, const Property *p
} }
else if ( option->type == xrm_Boolean ) { else if ( option->type == xrm_Boolean ) {
if ( p->type != P_BOOLEAN ) { if ( p->type != P_BOOLEAN ) {
fprintf ( stderr, "Option: %s needs to be set with a boolean.\n", option->name ); g_warning ( "Option: %s needs to be set with a boolean.", option->name );
return; return;
} }
*( option->value.num ) = ( p->value.b ); *( option->value.num ) = ( p->value.b );