mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
Add debug output.
This commit is contained in:
parent
5646adc34d
commit
c099aaeabf
6 changed files with 44 additions and 41 deletions
|
@ -39,16 +39,16 @@ 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_PASSWORD = 1 << 22,
|
||||
TB_INDICATOR = 1 << 23,
|
||||
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_PASSWORD = 1 << 22,
|
||||
TB_INDICATOR = 1 << 23,
|
||||
} TextboxFlags;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "dialogs/drun.h"
|
||||
|
||||
#define DRUN_CACHE_FILE "rofi2.druncache"
|
||||
#define LOG_DOMAIN "Dialogs.DRun"
|
||||
|
||||
static inline int execsh ( const char *cmd, int run_in_term )
|
||||
{
|
||||
|
@ -231,7 +232,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
|
|||
g_key_file_load_from_file ( kf, path, 0, &error );
|
||||
// If error, skip to next entry
|
||||
if ( error != NULL ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Failed to parse desktop file: %s because: %s", path, error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to parse desktop file: %s because: %s", path, error->message );
|
||||
g_error_free ( error );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
|
@ -240,12 +241,12 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
|
|||
gchar *key = g_key_file_get_string ( kf, "Desktop Entry", "Type", NULL );
|
||||
if ( key == NULL ) {
|
||||
// No type? ignore.
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: No type indicated", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: No type indicated", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
if ( g_strcmp0 ( key, "Application" ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Not of type application (%s)", path, key );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Not of type application (%s)", path, key );
|
||||
g_free ( key );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
|
@ -253,25 +254,25 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
|
|||
g_free ( key );
|
||||
// Skip hidden entries.
|
||||
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "Hidden", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Hidden", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: Hidden", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
// Skip entries that have NoDisplay set.
|
||||
if ( g_key_file_get_boolean ( kf, "Desktop Entry", "NoDisplay", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: NoDisplay", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Skipping desktop file: %s because: NoDisplay", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
// Name key is required.
|
||||
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Name", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Invalid DesktopFile: '%s', no 'Name' key present.\n", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Invalid DesktopFile: '%s', no 'Name' key present.\n", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
// We need Exec, don't support DBusActivatable
|
||||
if ( !g_key_file_has_key ( kf, "Desktop Entry", "Exec", NULL ) ) {
|
||||
g_log ( "Dialogs.DRun", G_LOG_LEVEL_DEBUG, "Unsupported DesktopFile: '%s', no 'Exec' key present.\n", path );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Unsupported DesktopFile: '%s', no 'Exec' key present.\n", path );
|
||||
g_key_file_free ( kf );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
* Name of the history file where previously choosen commands are stored.
|
||||
*/
|
||||
#define RUN_CACHE_FILE "rofi-3.runcache"
|
||||
#define LOG_DOMAIN "Dialogs.Run"
|
||||
|
||||
/**
|
||||
* The internal data structure holding the private data of the Run Mode.
|
||||
|
@ -249,7 +250,7 @@ static char ** get_apps ( unsigned int *length )
|
|||
gsize l = 0;
|
||||
gchar *homedir = g_locale_to_utf8 ( g_get_home_dir (), -1, NULL, &l, &error );
|
||||
if ( error != NULL ) {
|
||||
fprintf ( stderr, "Failed to convert homedir to UTF-8: %s\n", error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to convert homedir to UTF-8: %s", error->message );
|
||||
g_clear_error ( &error );
|
||||
g_free ( homedir );
|
||||
return NULL;
|
||||
|
@ -259,12 +260,13 @@ static char ** get_apps ( unsigned int *length )
|
|||
for ( const char *dirname = strtok ( path, sep ); dirname != NULL; dirname = strtok ( NULL, sep ) ) {
|
||||
DIR *dir = opendir ( dirname );
|
||||
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Checking path %s for executable.", dirname );
|
||||
if ( dir != NULL ) {
|
||||
struct dirent *dent;
|
||||
gsize dirn_len = 0;
|
||||
gchar *dirn = g_locale_to_utf8 ( dirname, -1, NULL, &dirn_len, &error );
|
||||
if ( error != NULL ) {
|
||||
fprintf ( stderr, "Failed to convert directory name to UTF-8: %s\n", error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to convert directory name to UTF-8: %s", error->message );
|
||||
g_clear_error ( &error );
|
||||
continue;
|
||||
}
|
||||
|
@ -291,7 +293,7 @@ static char ** get_apps ( unsigned int *length )
|
|||
gsize name_len;
|
||||
gchar *name = g_filename_to_utf8 ( dent->d_name, -1, NULL, &name_len, &error );
|
||||
if ( error != NULL ) {
|
||||
fprintf ( stderr, "Failed to convert filename to UTF-8: %s\n", error->message );
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Failed to convert filename to UTF-8: %s", error->message );
|
||||
g_clear_error ( &error );
|
||||
g_free ( name );
|
||||
continue;
|
||||
|
|
|
@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
|
|||
// Reading one line per time.
|
||||
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
|
||||
// Evaluate one line.
|
||||
unsigned int index = 0, ti = 0;
|
||||
unsigned int index = 0, ti = 0;
|
||||
char *token = buffer;
|
||||
|
||||
// Tokenize it.
|
||||
|
|
|
@ -194,7 +194,7 @@ static GRegex * create_regex ( const char *input, int case_sensitive )
|
|||
{
|
||||
#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL )
|
||||
GRegex * retv = NULL;
|
||||
gchar *r;
|
||||
gchar *r;
|
||||
switch ( config.matching_method )
|
||||
{
|
||||
case MM_GLOB:
|
||||
|
@ -234,7 +234,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
|
|||
}
|
||||
|
||||
char *saveptr = NULL, *token;
|
||||
GRegex **retv = NULL;
|
||||
GRegex **retv = NULL;
|
||||
if ( !config.tokenize ) {
|
||||
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
|
||||
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
|
||||
|
|
|
@ -73,9 +73,9 @@ struct xkb_stuff xkb = {
|
|||
.keymap = NULL,
|
||||
.state = NULL,
|
||||
.compose = {
|
||||
.table = NULL,
|
||||
.state = NULL
|
||||
}
|
||||
.table = NULL,
|
||||
.state = NULL
|
||||
}
|
||||
};
|
||||
char *config_path = NULL;
|
||||
// Array of modi.
|
||||
|
@ -470,22 +470,22 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
|
|||
xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id );
|
||||
break;
|
||||
case XCB_XKB_STATE_NOTIFY:
|
||||
{
|
||||
xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
|
||||
guint modmask;
|
||||
xkb_state_update_mask ( xkb.state,
|
||||
ksne->baseMods,
|
||||
ksne->latchedMods,
|
||||
ksne->lockedMods,
|
||||
ksne->baseGroup,
|
||||
ksne->latchedGroup,
|
||||
ksne->lockedGroup );
|
||||
modmask = x11_get_current_mask ( &xkb );
|
||||
if ( modmask == 0 ) {
|
||||
abe_trigger_release ( );
|
||||
{
|
||||
xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
|
||||
guint modmask;
|
||||
xkb_state_update_mask ( xkb.state,
|
||||
ksne->baseMods,
|
||||
ksne->latchedMods,
|
||||
ksne->lockedMods,
|
||||
ksne->baseGroup,
|
||||
ksne->latchedGroup,
|
||||
ksne->lockedGroup );
|
||||
modmask = x11_get_current_mask ( &xkb );
|
||||
if ( modmask == 0 ) {
|
||||
abe_trigger_release ( );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue