1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-07-31 21:59:25 -04:00

Indent the code.

This commit is contained in:
Dave Davenport 2018-08-08 15:55:13 +02:00
parent 4631ac711f
commit 859a9c79d6
21 changed files with 420 additions and 432 deletions

View file

@ -23,7 +23,6 @@ void rofi_icon_fetcher_init ( void );
*/ */
void rofi_icon_fetcher_destroy ( void ); void rofi_icon_fetcher_destroy ( void );
/** /**
* @param name The name of the icon to fetch. * @param name The name of the icon to fetch.
* @param size The size of the icon to fetch. * @param size The size of the icon to fetch.
@ -37,7 +36,6 @@ void rofi_icon_fetcher_destroy ( void );
*/ */
uint32_t rofi_icon_fetcher_query ( const char *name, const int size ); uint32_t rofi_icon_fetcher_query ( const char *name, const int size );
/** /**
* @param uid The unique id representing the matching request. * @param uid The unique id representing the matching request.
* *

View file

@ -59,7 +59,6 @@
char *DRUN_GROUP_NAME = "Desktop Entry"; char *DRUN_GROUP_NAME = "Desktop Entry";
typedef struct _DRunModePrivateData DRunModePrivateData; typedef struct _DRunModePrivateData DRunModePrivateData;
/** /**
* Store extra information about the entry. * Store extra information about the entry.
@ -618,7 +617,6 @@ static void get_apps ( DRunModePrivateData *pd )
TICK_N ( "Sorting done." ); TICK_N ( "Sorting done." );
} }
static void drun_mode_parse_entry_fields () static void drun_mode_parse_entry_fields ()
{ {
char *savept = NULL; char *savept = NULL;
@ -772,7 +770,9 @@ static cairo_surface_t *_get_icon ( const Mode *sw, unsigned int selected_line,
DRunModePrivateData *pd = (DRunModePrivateData *) mode_get_private_data ( sw ); DRunModePrivateData *pd = (DRunModePrivateData *) mode_get_private_data ( sw );
g_return_val_if_fail ( pd->entry_list != NULL, NULL ); g_return_val_if_fail ( pd->entry_list != NULL, NULL );
DRunModeEntry *dr = &( pd->entry_list[selected_line] ); DRunModeEntry *dr = &( pd->entry_list[selected_line] );
if ( dr->icon_name == NULL ) return NULL; if ( dr->icon_name == NULL ) {
return NULL;
}
if ( dr->icon_fetch_uid > 0 ) { if ( dr->icon_fetch_uid > 0 ) {
return rofi_icon_fetcher_get ( dr->icon_fetch_uid ); return rofi_icon_fetcher_get ( dr->icon_fetch_uid );
} }

View file

@ -198,7 +198,6 @@ static void script_mode_reset_highlight ( Mode *sw )
rmpd->num_active_list = 0; rmpd->num_active_list = 0;
g_free ( rmpd->active_list ); g_free ( rmpd->active_list );
rmpd->active_list = NULL; rmpd->active_list = NULL;
} }
static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line ) static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line )

View file

@ -487,7 +487,6 @@ static ModeMode ssh_mode_result ( Mode *sw, int mretv, char **input, unsigned in
return retv; return retv;
} }
/** /**
* @param sw Object handle to the SSH Mode object * @param sw Object handle to the SSH Mode object
* @param selected_line The line to view * @param selected_line The line to view

View file

@ -919,7 +919,6 @@ static cairo_surface_t *_get_icon ( const Mode *sw, unsigned int selected_line,
return rofi_icon_fetcher_get ( c->icon_fetch_uid ); return rofi_icon_fetcher_get ( c->icon_fetch_uid );
} }
c->icon_fetch_uid = rofi_icon_fetcher_query ( c->class, size ); c->icon_fetch_uid = rofi_icon_fetcher_query ( c->class, size );
} }
return c->icon; return c->icon;
} }

View file

@ -587,7 +587,8 @@ int config_sanity_check ( void )
} }
else if ( g_strcmp0 ( config.sorting_method, "fzf" ) == 0 ) { else if ( g_strcmp0 ( config.sorting_method, "fzf" ) == 0 ) {
config.sorting_method_enum = SORT_FZF; config.sorting_method_enum = SORT_FZF;
} else { }
else {
g_string_append_printf ( msg, "\t<b>config.sorting_method</b>=%s is not a valid sorting strategy.\nValid options are: normal or fzf.\n", g_string_append_printf ( msg, "\t<b>config.sorting_method</b>=%s is not a valid sorting strategy.\nValid options are: normal or fzf.\n",
config.sorting_method ); config.sorting_method );
found_error = 1; found_error = 1;

View file

@ -39,7 +39,8 @@
#include "nkutils-xdg-theme.h" #include "nkutils-xdg-theme.h"
typedef struct { typedef struct
{
// Context for icon-themes. // Context for icon-themes.
NkXdgThemeContext *xdg_context; NkXdgThemeContext *xdg_context;
@ -49,17 +50,16 @@ typedef struct {
GHashTable *icon_cache_uid; GHashTable *icon_cache_uid;
uint32_t last_uid; uint32_t last_uid;
} IconFetcher; } IconFetcher;
typedef struct
typedef struct { {
char *name; char *name;
GList *sizes; GList *sizes;
} IconFetcherNameEntry; } IconFetcherNameEntry;
typedef struct { typedef struct
{
thread_state state; thread_state state;
GCond *cond; GCond *cond;
@ -78,7 +78,6 @@ typedef struct {
*/ */
IconFetcher *rofi_icon_fetcher_data = NULL; IconFetcher *rofi_icon_fetcher_data = NULL;
static void rofi_icon_fetch_entry_free ( gpointer data ) static void rofi_icon_fetch_entry_free ( gpointer data )
{ {
IconFetcherNameEntry *entry = (IconFetcherNameEntry *) data; IconFetcherNameEntry *entry = (IconFetcherNameEntry *) data;
@ -86,7 +85,6 @@ static void rofi_icon_fetch_entry_free ( gpointer data )
// Free name/key. // Free name/key.
g_free ( entry->name ); g_free ( entry->name );
for ( GList *iter = g_list_first ( entry->sizes ); iter; iter = g_list_next ( iter ) ) { for ( GList *iter = g_list_first ( entry->sizes ); iter; iter = g_list_next ( iter ) ) {
IconFetcherEntry *sentry = (IconFetcherEntry *) ( iter->data ); IconFetcherEntry *sentry = (IconFetcherEntry *) ( iter->data );
@ -98,7 +96,6 @@ static void rofi_icon_fetch_entry_free ( gpointer data )
g_free ( entry ); g_free ( entry );
} }
void rofi_icon_fetcher_init ( void ) void rofi_icon_fetcher_init ( void )
{ {
g_assert ( rofi_icon_fetcher_data == NULL ); g_assert ( rofi_icon_fetcher_data == NULL );
@ -115,19 +112,18 @@ void rofi_icon_fetcher_init ( void )
rofi_icon_fetcher_data->xdg_context = nk_xdg_theme_context_new ( icon_fallback_themes, NULL ); rofi_icon_fetcher_data->xdg_context = nk_xdg_theme_context_new ( icon_fallback_themes, NULL );
nk_xdg_theme_preload_themes_icon ( rofi_icon_fetcher_data->xdg_context, themes ); nk_xdg_theme_preload_themes_icon ( rofi_icon_fetcher_data->xdg_context, themes );
rofi_icon_fetcher_data->icon_cache_uid = g_hash_table_new ( g_direct_hash, g_direct_equal ); rofi_icon_fetcher_data->icon_cache_uid = g_hash_table_new ( g_direct_hash, g_direct_equal );
rofi_icon_fetcher_data->icon_cache = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, rofi_icon_fetch_entry_free ); rofi_icon_fetcher_data->icon_cache = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, rofi_icon_fetch_entry_free );
} }
void rofi_icon_fetcher_destroy ( void ) void rofi_icon_fetcher_destroy ( void )
{ {
if ( rofi_icon_fetcher_data == NULL ) return; if ( rofi_icon_fetcher_data == NULL ) {
return;
}
nk_xdg_theme_context_free ( rofi_icon_fetcher_data->xdg_context ); nk_xdg_theme_context_free ( rofi_icon_fetcher_data->xdg_context );
g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache_uid ); g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache_uid );
g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache ); g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache );
@ -183,7 +179,6 @@ static void rofi_icon_fetcher_worker ( thread_state *sdata, G_GNUC_UNUSED gpoint
rofi_view_reload (); rofi_view_reload ();
} }
uint32_t rofi_icon_fetcher_query ( const char *name, const int size ) uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{ {
g_debug ( "Query: %s(%d)", name, size ); g_debug ( "Query: %s(%d)", name, size );
@ -218,7 +213,6 @@ uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
return sentry->uid; return sentry->uid;
} }
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid ) cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{ {
IconFetcherEntry *sentry = g_hash_table_lookup ( rofi_icon_fetcher_data->icon_cache_uid, GINT_TO_POINTER ( uid ) ); IconFetcherEntry *sentry = g_hash_table_lookup ( rofi_icon_fetcher_data->icon_cache_uid, GINT_TO_POINTER ( uid ) );

View file

@ -858,7 +858,8 @@ int main ( int argc, char *argv[] )
rofi_theme_free ( rofi_theme ); rofi_theme_free ( rofi_theme );
rofi_theme = NULL; rofi_theme = NULL;
} }
} else { }
else {
g_free ( config_path_new ); g_free ( config_path_new );
config_path_new = NULL; config_path_new = NULL;
config_parse_xresource_options_file ( config_path ); config_parse_xresource_options_file ( config_path );

View file

@ -581,7 +581,6 @@ typedef struct _thread_state_view
const char *pattern; const char *pattern;
/** Length of pattern. */ /** Length of pattern. */
glong plen; glong plen;
} thread_state_view; } thread_state_view;
/** /**
* @param data A thread_state object. * @param data A thread_state object.
@ -804,7 +803,8 @@ void __create_window ( MenuFlags menu_flags )
const char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL ); const char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL );
if ( transparency ) { if ( transparency ) {
rofi_view_setup_fake_transparency ( transparency ); rofi_view_setup_fake_transparency ( transparency );
} else if ( config.fake_transparency && config.fake_background ) { }
else if ( config.fake_transparency && config.fake_background ) {
rofi_view_setup_fake_transparency ( config.fake_background ); rofi_view_setup_fake_transparency ( config.fake_background );
} }
if ( xcb->sncontext != NULL ) { if ( xcb->sncontext != NULL ) {

View file

@ -50,7 +50,6 @@ struct _icon
cairo_surface_t *icon; cairo_surface_t *icon;
}; };
static int icon_get_desired_height ( widget *widget ) static int icon_get_desired_height ( widget *widget )
{ {
icon *b = (icon *) widget; icon *b = (icon *) widget;
@ -71,7 +70,6 @@ static void icon_draw ( widget *wid, cairo_t *draw )
icon *b = (icon *) wid; icon *b = (icon *) wid;
// If no icon is loaded. quit. // If no icon is loaded. quit.
if ( b->icon == NULL && b->icon_fetch_id > 0 ) { if ( b->icon == NULL && b->icon_fetch_id > 0 ) {
b->icon = rofi_icon_fetcher_get ( b->icon_fetch_id ); b->icon = rofi_icon_fetcher_get ( b->icon_fetch_id );
if ( b->icon ) { if ( b->icon ) {
cairo_surface_reference ( b->icon ); cairo_surface_reference ( b->icon );
@ -92,7 +90,6 @@ static void icon_draw ( widget *wid, cairo_t *draw )
cairo_set_source_surface ( draw, b->icon, 0, 0 ); cairo_set_source_surface ( draw, b->icon, 0, 0 );
cairo_paint ( draw ); cairo_paint ( draw );
cairo_restore ( draw ); cairo_restore ( draw );
} }
static void icon_free ( widget *wid ) static void icon_free ( widget *wid )
@ -143,7 +140,6 @@ icon * icon_create ( widget *parent, const char *name )
b->widget.get_desired_height = icon_get_desired_height; b->widget.get_desired_height = icon_get_desired_height;
b->widget.get_desired_width = icon_get_desired_width; b->widget.get_desired_width = icon_get_desired_width;
b->size = rofi_theme_get_integer ( WIDGET ( b ), "size", b->size ); b->size = rofi_theme_get_integer ( WIDGET ( b ), "size", b->size );
const char * filename = rofi_theme_get_string ( WIDGET ( b ), "filename", NULL ); const char * filename = rofi_theme_get_string ( WIDGET ( b ), "filename", NULL );
@ -151,7 +147,5 @@ icon * icon_create ( widget *parent, const char *name )
b->icon_fetch_id = rofi_icon_fetcher_query ( filename, b->size ); b->icon_fetch_id = rofi_icon_fetcher_query ( filename, b->size );
} }
return b; return b;
} }

View file

@ -39,7 +39,9 @@ void widget_init ( widget *wid, widget *parent, WidgetType type, const char *nam
wid->type = type; wid->type = type;
wid->parent = parent; wid->parent = parent;
wid->name = g_strdup ( name ); wid->name = g_strdup ( name );
wid->def_padding = (RofiPadding){ { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID } }; wid->def_padding =
(RofiPadding){ { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID },
{ WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID } };
wid->def_border = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; wid->def_border = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
wid->def_border_radius = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; wid->def_border_radius = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
wid->def_margin = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; wid->def_margin = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
@ -360,7 +362,6 @@ void widget_draw ( widget *widget, cairo_t *d )
} }
} }
void widget_free ( widget *wid ) void widget_free ( widget *wid )
{ {
if ( wid ) { if ( wid ) {

View file

@ -414,7 +414,6 @@ static void x11_build_monitor_layout ()
free ( pc_rep ); free ( pc_rep );
} }
free ( res_reply ); free ( res_reply );
} }
// Number monitor // Number monitor
@ -850,10 +849,12 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
xcb->last_timestamp = bpe->time; xcb->last_timestamp = bpe->time;
rofi_view_handle_mouse_motion ( state, bpe->event_x, bpe->event_y ); rofi_view_handle_mouse_motion ( state, bpe->event_x, bpe->event_y );
if ( x11_button_to_nk_bindings_button ( bpe->detail, &button ) ) if ( x11_button_to_nk_bindings_button ( bpe->detail, &button ) ) {
nk_bindings_seat_handle_button ( xcb->bindings_seat, NULL, button, NK_BINDINGS_BUTTON_STATE_PRESS, bpe->time ); nk_bindings_seat_handle_button ( xcb->bindings_seat, NULL, button, NK_BINDINGS_BUTTON_STATE_PRESS, bpe->time );
else if ( x11_button_to_nk_bindings_scroll ( bpe->detail, &axis, &steps) ) }
else if ( x11_button_to_nk_bindings_scroll ( bpe->detail, &axis, &steps ) ) {
nk_bindings_seat_handle_scroll ( xcb->bindings_seat, NULL, axis, steps ); nk_bindings_seat_handle_scroll ( xcb->bindings_seat, NULL, axis, steps );
}
break; break;
} }
case XCB_BUTTON_RELEASE: case XCB_BUTTON_RELEASE:
@ -862,8 +863,9 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
NkBindingsMouseButton button; NkBindingsMouseButton button;
xcb->last_timestamp = bre->time; xcb->last_timestamp = bre->time;
if ( x11_button_to_nk_bindings_button ( bre->detail, &button ) ) if ( x11_button_to_nk_bindings_button ( bre->detail, &button ) ) {
nk_bindings_seat_handle_button ( xcb->bindings_seat, NULL, button, NK_BINDINGS_BUTTON_STATE_RELEASE, bre->time ); nk_bindings_seat_handle_button ( xcb->bindings_seat, NULL, button, NK_BINDINGS_BUTTON_STATE_RELEASE, bre->time );
}
if ( config.click_to_exit == TRUE ) { if ( config.click_to_exit == TRUE ) {
if ( !xcb->mouse_seen ) { if ( !xcb->mouse_seen ) {
rofi_view_temp_click_to_exit ( state, bre->event ); rofi_view_temp_click_to_exit ( state, bre->event );