summaryrefslogtreecommitdiffstats
path: root/source/dialogs
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-02 17:03:45 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-02 17:03:45 +0200
commit2578817db77af4d98104656bdcd215647b2ff915 (patch)
tree8a7b5a1837632f55dfb4bf6991b093362cf9c96a /source/dialogs
parent4bd9828aa706ec3721e7122a30aee334175eea84 (diff)
DonĀ“t always fetch icon size 32, but estimated based on character height
Diffstat (limited to 'source/dialogs')
-rw-r--r--source/dialogs/drun.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c
index 83aabef4..009a8ddc 100644
--- a/source/dialogs/drun.c
+++ b/source/dialogs/drun.c
@@ -93,6 +93,8 @@ typedef struct
GHashTable *disabled_entries;
unsigned int disabled_entries_length;
GThread *thread;
+
+ unsigned int expected_line_height;
} DRunModePrivateData;
struct RegexEvalArg
@@ -431,21 +433,21 @@ static void drun_icon_fetch ( gpointer data )
if ( dr->icon_name == NULL ) {
continue;
}
- gchar *icon_path = nk_xdg_theme_get_icon ( pd->xdg_context, NULL, "Applications", dr->icon_name, 32, 1, TRUE );
+ gchar *icon_path = nk_xdg_theme_get_icon ( pd->xdg_context, NULL, "Applications", dr->icon_name, pd->expected_line_height, 1, TRUE );
if ( icon_path == NULL ) {
g_free ( dr->icon_name );
dr->icon_name = NULL;
continue;
}
else{
- g_log ( G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Found Icon %s(%d): %s", dr->icon_name, 32, icon_path );
+ g_log ( G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Found Icon %s(%d): %s", dr->icon_name, pd->expected_line_height, icon_path );
}
if ( g_str_has_suffix ( icon_path, ".png" ) ) {
dr->icon = cairo_image_surface_create_from_png ( icon_path );
}
else if ( g_str_has_suffix ( icon_path, ".svg" ) ) {
- dr->icon = cairo_image_surface_create_from_svg ( icon_path, 32 );
+ dr->icon = cairo_image_surface_create_from_svg ( icon_path, pd->expected_line_height );
}
else {
g_log ( G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Icon type not yet supported: %s", icon_path );
@@ -454,12 +456,8 @@ static void drun_icon_fetch ( gpointer data )
g_free ( r );
}
g_free ( icon_path );
- // if ( (i%100) == 99 )
- {
- rofi_view_reload ();
- }
+ rofi_view_reload ();
}
- rofi_view_reload ();
g_log ( G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "elapsed: %f\n", g_timer_elapsed ( t, NULL ) );
g_timer_destroy ( t );
}
@@ -468,6 +466,7 @@ static int drun_mode_init ( Mode *sw )
{
if ( mode_get_private_data ( sw ) == NULL ) {
DRunModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) );
+ pd->expected_line_height = ceil ( textbox_get_estimated_char_height ( ) );
pd->disabled_entries = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, NULL );
mode_set_private_data ( sw, (void *) pd );
pd->xdg_context = nk_xdg_theme_context_new ();