Fix indenting

This commit is contained in:
Dave Davenport 2016-05-08 11:13:11 +02:00
parent 8af7f014cd
commit 8f6c9ee070
6 changed files with 59 additions and 60 deletions

View File

@ -15,60 +15,60 @@
struct RofiViewState struct RofiViewState
{ {
Mode *sw; Mode *sw;
unsigned int menu_lines; unsigned int menu_lines;
unsigned int max_elements; unsigned int max_elements;
unsigned int max_rows; unsigned int max_rows;
unsigned int columns; unsigned int columns;
unsigned int element_width; unsigned int element_width;
int top_offset; int top_offset;
// Update/Refilter list. // Update/Refilter list.
int update; int update;
int refilter; int refilter;
int rchanged; int rchanged;
int cur_page; int cur_page;
// Entries // Entries
textbox *text; textbox *text;
textbox *prompt_tb; textbox *prompt_tb;
textbox *message_tb; textbox *message_tb;
textbox *case_indicator; textbox *case_indicator;
textbox **boxes; textbox **boxes;
scrollbar *scrollbar; scrollbar *scrollbar;
int *distance; int *distance;
unsigned int *line_map; unsigned int *line_map;
unsigned int num_lines; unsigned int num_lines;
// Selected element. // Selected element.
unsigned int selected; unsigned int selected;
unsigned int filtered_lines; unsigned int filtered_lines;
// Last offset in paginating. // Last offset in paginating.
unsigned int last_offset; unsigned int last_offset;
KeyBindingAction prev_action; KeyBindingAction prev_action;
xcb_timestamp_t last_button_press; xcb_timestamp_t last_button_press;
int quit; int quit;
int skip_absorb; int skip_absorb;
// Return state // Return state
unsigned int selected_line; unsigned int selected_line;
MenuReturn retv; MenuReturn retv;
int *lines_not_ascii; int *lines_not_ascii;
int line_height; int line_height;
unsigned int border; unsigned int border;
workarea mon; workarea mon;
// Sidebar view // Sidebar view
unsigned int num_modi; unsigned int num_modi;
textbox **modi; textbox **modi;
MenuFlags menu_flags; MenuFlags menu_flags;
// Handlers. // Handlers.
void ( *x11_event_loop )( struct RofiViewState *state, xcb_generic_event_t *ev, xkb_stuff *xkb ); void ( *x11_event_loop )( struct RofiViewState *state, xcb_generic_event_t *ev, xkb_stuff *xkb );
void ( *finalize )( struct RofiViewState *state ); void ( *finalize )( struct RofiViewState *state );
}; };
/** @} */ /** @} */
#endif #endif

View File

@ -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 ) ) { 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 ) ); abe[iter].kb = g_realloc ( abe[iter].kb, ( abe[iter].num_bindings + 1 ) * sizeof ( KeyBinding ) );
KeyBinding *kb = &( abe[iter].kb[abe[iter].num_bindings] ); 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 ) ) ) { if ( !x11_parse_key ( entry, &( kb->modmask ), &( kb->keysym ), &( kb->release ) ) ) {
g_free ( keystr ); g_free ( keystr );
return FALSE; return FALSE;
@ -158,12 +158,11 @@ static gboolean abe_test_action ( KeyBindingAction action, unsigned int mask, xk
return FALSE; return FALSE;
} }
KeyBindingAction abe_find_action ( unsigned int mask, xkb_keysym_t key ) KeyBindingAction abe_find_action ( unsigned int mask, xkb_keysym_t key )
{ {
KeyBindingAction action; KeyBindingAction action;
for ( action = 0 ; action < NUM_ABE ; ++action ) { for ( action = 0; action < NUM_ABE; ++action ) {
if ( abe_test_action ( action, mask, key ) ) { if ( abe_test_action ( action, mask, key ) ) {
break; break;
} }
@ -174,11 +173,11 @@ KeyBindingAction abe_find_action ( unsigned int mask, xkb_keysym_t key )
void abe_trigger_release ( void ) void abe_trigger_release ( void )
{ {
RofiViewState *state; RofiViewState *state;
KeyBindingAction action; KeyBindingAction action;
state = rofi_view_get_active ( ); 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] ) { if ( _abe_trigger_on_release[action] ) {
rofi_view_trigger_action ( state, action ); rofi_view_trigger_action ( state, action );
_abe_trigger_on_release[action] = FALSE; _abe_trigger_on_release[action] = FALSE;

View File

@ -439,7 +439,7 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
case XCB_XKB_STATE_NOTIFY: case XCB_XKB_STATE_NOTIFY:
{ {
xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev; xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
guint modmask; guint modmask;
xkb_state_update_mask ( xkb.state, xkb_state_update_mask ( xkb.state,
ksne->baseMods, ksne->baseMods,
ksne->latchedMods, ksne->latchedMods,

View File

@ -528,7 +528,7 @@ static void textbox_cursor_del_word ( textbox *tb )
int textbox_keybinding ( textbox *tb, KeyBindingAction action ) int textbox_keybinding ( textbox *tb, KeyBindingAction action )
{ {
if ( !( tb->flags & TB_EDITABLE ) ) { if ( !( tb->flags & TB_EDITABLE ) ) {
g_return_val_if_reached(0); g_return_val_if_reached ( 0 );
} }
switch ( action ) switch ( action )
@ -582,10 +582,10 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action )
case ACCEPT_ENTRY: case ACCEPT_ENTRY:
return -1; return -1;
default: 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 ) gboolean textbox_append ( textbox *tb, char *pad, int pad_len )

View File

@ -1154,7 +1154,7 @@ static void rofi_view_keyboard_navigation ( RofiViewState *state, KeyBindingActi
} }
break; break;
default: 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 ) static void rofi_view_handle_keypress ( RofiViewState *state, xkb_stuff *xkb, xcb_key_press_event_t *xkpe )
{ {
xcb_keysym_t key; xcb_keysym_t key;
char pad[32]; char pad[32];
int len = 0; int len = 0;
key = xkb_state_key_get_one_sym ( xkb->state, xkpe->detail ); 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; break;
case XCB_KEYMAP_NOTIFY: case XCB_KEYMAP_NOTIFY:
{ {
xcb_keymap_notify_event_t *kne = (xcb_keymap_notify_event_t *) ev; xcb_keymap_notify_event_t *kne = (xcb_keymap_notify_event_t *) ev;
guint modstate = x11_get_current_mask ( xkb ); guint modstate = x11_get_current_mask ( xkb );
for ( gint32 by = 0 ; by < 32 ; ++by ) { for ( gint32 by = 0; by < 32; ++by ) {
for ( gint8 bi = 0 ; bi < 7 ; ++bi ) { for ( gint8 bi = 0; bi < 7; ++bi ) {
if ( kne->keys[by] & (1 << bi) ) { if ( kne->keys[by] & ( 1 << bi ) ) {
// X11 keycodes starts at 8 // X11 keycodes starts at 8
xkb_keysym_t key = xkb_state_key_get_one_sym ( xkb->state, ( 8 * by + bi ) + 8 ); xkb_keysym_t key = xkb_state_key_get_one_sym ( xkb->state, ( 8 * by + bi ) + 8 );
abe_find_action ( modstate, key ); abe_find_action ( modstate, key );
@ -1562,8 +1562,8 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t
break; break;
case XCB_KEY_RELEASE: case XCB_KEY_RELEASE:
{ {
xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) ev; xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) ev;
unsigned int modstate = x11_canonalize_mask ( xkre->state ); unsigned int modstate = x11_canonalize_mask ( xkre->state );
if ( modstate == 0 ) { if ( modstate == 0 ) {
abe_trigger_release ( ); abe_trigger_release ( );
} }

View File

@ -440,7 +440,7 @@ unsigned int x11_canonalize_mask ( unsigned int mask )
unsigned int x11_get_current_mask ( xkb_stuff *xkb ) unsigned int x11_get_current_mask ( xkb_stuff *xkb )
{ {
unsigned int mask = 0; 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 ) ) { if ( xkb_state_mod_index_is_active ( xkb->state, i, XKB_STATE_MODS_EFFECTIVE ) ) {
mask |= ( 1 << i ); 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 ( "" ); GString *str = g_string_new ( "" );
unsigned int modmask = 0; unsigned int modmask = 0;
if ( g_str_has_prefix(combo, "!") ) { if ( g_str_has_prefix ( combo, "!" ) ) {
++combo; ++combo;
*release = TRUE; *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 there's no "-" or "+", we might be binding directly to a modifier key - no modmask
if( i == 0 ) { if ( i == 0 ) {
*mod = 0; *mod = 0;
} }
else { else {