From 8f6c9ee070b60af7f93ca3a44fc0a58df4623272 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 8 May 2016 11:13:11 +0200 Subject: [PATCH] Fix indenting --- include/view-internal.h | 74 ++++++++++++++++++++--------------------- source/keyb.c | 9 +++-- source/rofi.c | 2 +- source/textbox.c | 6 ++-- source/view.c | 22 ++++++------ source/x11-helper.c | 6 ++-- 6 files changed, 59 insertions(+), 60 deletions(-) diff --git a/include/view-internal.h b/include/view-internal.h index 80ae7805..d041023a 100644 --- a/include/view-internal.h +++ b/include/view-internal.h @@ -15,60 +15,60 @@ struct RofiViewState { - Mode *sw; - unsigned int menu_lines; - unsigned int max_elements; - unsigned int max_rows; - unsigned int columns; + Mode *sw; + unsigned int menu_lines; + unsigned int max_elements; + unsigned int max_rows; + unsigned int columns; - unsigned int element_width; - int top_offset; + unsigned int element_width; + int top_offset; // Update/Refilter list. - int update; - int refilter; - int rchanged; - int cur_page; + int update; + int refilter; + int rchanged; + int cur_page; // Entries - textbox *text; - textbox *prompt_tb; - textbox *message_tb; - textbox *case_indicator; - textbox **boxes; - scrollbar *scrollbar; - int *distance; - unsigned int *line_map; + textbox *text; + textbox *prompt_tb; + textbox *message_tb; + textbox *case_indicator; + textbox **boxes; + scrollbar *scrollbar; + int *distance; + unsigned int *line_map; - unsigned int num_lines; + unsigned int num_lines; // Selected element. - unsigned int selected; - unsigned int filtered_lines; + unsigned int selected; + unsigned int filtered_lines; // Last offset in paginating. - unsigned int last_offset; + unsigned int last_offset; KeyBindingAction prev_action; - xcb_timestamp_t last_button_press; + xcb_timestamp_t last_button_press; - int quit; - int skip_absorb; + int quit; + int skip_absorb; // Return state - unsigned int selected_line; - MenuReturn retv; - int *lines_not_ascii; - int line_height; - unsigned int border; - workarea mon; + unsigned int selected_line; + MenuReturn retv; + int *lines_not_ascii; + int line_height; + unsigned int border; + workarea mon; // Sidebar view - unsigned int num_modi; - textbox **modi; + unsigned int num_modi; + textbox **modi; - MenuFlags menu_flags; + MenuFlags menu_flags; // Handlers. - void ( *x11_event_loop )( struct RofiViewState *state, xcb_generic_event_t *ev, xkb_stuff *xkb ); - void ( *finalize )( struct RofiViewState *state ); + void ( *x11_event_loop )( struct RofiViewState *state, xcb_generic_event_t *ev, xkb_stuff *xkb ); + void ( *finalize )( struct RofiViewState *state ); }; /** @} */ #endif diff --git a/source/keyb.c b/source/keyb.c index c9fe83dc..c0e3bc5a 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -115,7 +115,7 @@ gboolean parse_keys_abe ( void ) for ( char *entry = strtok_r ( keystr, sep, &sp ); entry != NULL; entry = strtok_r ( NULL, sep, &sp ) ) { abe[iter].kb = g_realloc ( abe[iter].kb, ( abe[iter].num_bindings + 1 ) * sizeof ( KeyBinding ) ); KeyBinding *kb = &( abe[iter].kb[abe[iter].num_bindings] ); - memset(kb, 0, sizeof(KeyBinding)); + memset ( kb, 0, sizeof ( KeyBinding ) ); if ( !x11_parse_key ( entry, &( kb->modmask ), &( kb->keysym ), &( kb->release ) ) ) { g_free ( keystr ); return FALSE; @@ -158,12 +158,11 @@ static gboolean abe_test_action ( KeyBindingAction action, unsigned int mask, xk return FALSE; } - KeyBindingAction abe_find_action ( unsigned int mask, xkb_keysym_t key ) { KeyBindingAction action; - for ( action = 0 ; action < NUM_ABE ; ++action ) { + for ( action = 0; action < NUM_ABE; ++action ) { if ( abe_test_action ( action, mask, key ) ) { break; } @@ -174,11 +173,11 @@ KeyBindingAction abe_find_action ( unsigned int mask, xkb_keysym_t key ) void abe_trigger_release ( void ) { - RofiViewState *state; + RofiViewState *state; KeyBindingAction action; state = rofi_view_get_active ( ); - for ( action = 0 ; action < NUM_ABE ; ++action ) { + for ( action = 0; action < NUM_ABE; ++action ) { if ( _abe_trigger_on_release[action] ) { rofi_view_trigger_action ( state, action ); _abe_trigger_on_release[action] = FALSE; diff --git a/source/rofi.c b/source/rofi.c index b293c570..b71dd4c0 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -439,7 +439,7 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN case XCB_XKB_STATE_NOTIFY: { xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev; - guint modmask; + guint modmask; xkb_state_update_mask ( xkb.state, ksne->baseMods, ksne->latchedMods, diff --git a/source/textbox.c b/source/textbox.c index c3d254fb..3a27bf93 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -528,7 +528,7 @@ static void textbox_cursor_del_word ( textbox *tb ) int textbox_keybinding ( textbox *tb, KeyBindingAction action ) { if ( !( tb->flags & TB_EDITABLE ) ) { - g_return_val_if_reached(0); + g_return_val_if_reached ( 0 ); } switch ( action ) @@ -582,10 +582,10 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action ) case ACCEPT_ENTRY: return -1; default: - g_return_val_if_reached(0); + g_return_val_if_reached ( 0 ); } - g_return_val_if_reached(0); + g_return_val_if_reached ( 0 ); } gboolean textbox_append ( textbox *tb, char *pad, int pad_len ) diff --git a/source/view.c b/source/view.c index 885b8051..18e98704 100644 --- a/source/view.c +++ b/source/view.c @@ -1154,7 +1154,7 @@ static void rofi_view_keyboard_navigation ( RofiViewState *state, KeyBindingActi } break; default: - g_return_if_reached(); + g_return_if_reached (); } } @@ -1461,9 +1461,9 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction actio static void rofi_view_handle_keypress ( RofiViewState *state, xkb_stuff *xkb, xcb_key_press_event_t *xkpe ) { - xcb_keysym_t key; - char pad[32]; - int len = 0; + xcb_keysym_t key; + char pad[32]; + int len = 0; key = xkb_state_key_get_one_sym ( xkb->state, xkpe->detail ); @@ -1544,11 +1544,11 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t break; case XCB_KEYMAP_NOTIFY: { - xcb_keymap_notify_event_t *kne = (xcb_keymap_notify_event_t *) ev; - guint modstate = x11_get_current_mask ( xkb ); - for ( gint32 by = 0 ; by < 32 ; ++by ) { - for ( gint8 bi = 0 ; bi < 7 ; ++bi ) { - if ( kne->keys[by] & (1 << bi) ) { + xcb_keymap_notify_event_t *kne = (xcb_keymap_notify_event_t *) ev; + guint modstate = x11_get_current_mask ( xkb ); + for ( gint32 by = 0; by < 32; ++by ) { + for ( gint8 bi = 0; bi < 7; ++bi ) { + if ( kne->keys[by] & ( 1 << bi ) ) { // X11 keycodes starts at 8 xkb_keysym_t key = xkb_state_key_get_one_sym ( xkb->state, ( 8 * by + bi ) + 8 ); abe_find_action ( modstate, key ); @@ -1562,8 +1562,8 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t break; case XCB_KEY_RELEASE: { - xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) ev; - unsigned int modstate = x11_canonalize_mask ( xkre->state ); + xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) ev; + unsigned int modstate = x11_canonalize_mask ( xkre->state ); if ( modstate == 0 ) { abe_trigger_release ( ); } diff --git a/source/x11-helper.c b/source/x11-helper.c index a0ab25d7..1ed84c95 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -440,7 +440,7 @@ unsigned int x11_canonalize_mask ( unsigned int mask ) unsigned int x11_get_current_mask ( xkb_stuff *xkb ) { unsigned int mask = 0; - for ( gsize i = 0 ; i < xkb_keymap_num_mods(xkb->keymap) ; ++i ) { + for ( gsize i = 0; i < xkb_keymap_num_mods ( xkb->keymap ); ++i ) { if ( xkb_state_mod_index_is_active ( xkb->state, i, XKB_STATE_MODS_EFFECTIVE ) ) { mask |= ( 1 << i ); } @@ -454,7 +454,7 @@ gboolean x11_parse_key ( char *combo, unsigned int *mod, xkb_keysym_t *key, gboo GString *str = g_string_new ( "" ); unsigned int modmask = 0; - if ( g_str_has_prefix(combo, "!") ) { + if ( g_str_has_prefix ( combo, "!" ) ) { ++combo; *release = TRUE; } @@ -508,7 +508,7 @@ gboolean x11_parse_key ( char *combo, unsigned int *mod, xkb_keysym_t *key, gboo } // if there's no "-" or "+", we might be binding directly to a modifier key - no modmask - if( i == 0 ) { + if ( i == 0 ) { *mod = 0; } else {