mirror of
https://github.com/lbonn/rofi
synced 2024-11-23 12:23:02 +00:00
Indent code.
This commit is contained in:
parent
8ee37012d1
commit
3f4d58ef53
16 changed files with 89 additions and 91 deletions
|
@ -219,7 +219,6 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st
|
|||
*/
|
||||
int utf8_strncmp ( const char *a, const char* b, size_t n );
|
||||
|
||||
|
||||
/**
|
||||
* @param wd The work directory (optional)
|
||||
* @param cmd The cmd to execute
|
||||
|
|
|
@ -262,8 +262,8 @@ int x11_modifier_active ( unsigned int mask, int key );
|
|||
*/
|
||||
void x11_disable_decoration ( xcb_window_t window );
|
||||
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
/** Default EWHM compatible window manager */
|
||||
WM_EWHM = 0,
|
||||
/** I3 Window manager */
|
||||
|
|
|
@ -72,13 +72,15 @@ static void combi_mode_parse_switchers ( Mode *sw )
|
|||
if ( mode ) {
|
||||
pd->switchers[pd->num_switchers].disable = FALSE;
|
||||
pd->switchers[pd->num_switchers++].mode = mode;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// If not build in, use custom switchers.
|
||||
Mode *sw = script_switcher_parse_setup ( token );
|
||||
if ( sw != NULL ) {
|
||||
pd->switchers[pd->num_switchers].disable = FALSE;
|
||||
pd->switchers[pd->num_switchers++].mode = sw;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Report error, don't continue.
|
||||
fprintf ( stderr, "Invalid script switcher: %s\n", token );
|
||||
token = NULL;
|
||||
|
|
|
@ -70,7 +70,6 @@ typedef struct
|
|||
unsigned int cmd_list_length;
|
||||
} RunModePrivateData;
|
||||
|
||||
|
||||
/**
|
||||
* @param cmd The cmd to execute
|
||||
* @param run_in_term Indicate if command should be run in a terminal
|
||||
|
|
|
@ -76,11 +76,9 @@ static char **get_script_output ( const char *command, unsigned int *length )
|
|||
|
||||
static char **execute_executor ( Mode *sw, const char *result, unsigned int *length )
|
||||
{
|
||||
char **retv = NULL;
|
||||
|
||||
char *arg = g_shell_quote ( result );
|
||||
char *command = g_strdup_printf ( "%s %s", (const char *) sw->ed, arg );
|
||||
retv = get_script_output ( command, length );
|
||||
char **retv = get_script_output ( command, length );
|
||||
g_free ( command );
|
||||
g_free ( arg );
|
||||
return retv;
|
||||
|
|
|
@ -284,10 +284,9 @@ static char ** get_ssh ( unsigned int *length )
|
|||
retv = read_hosts_file ( retv, length );
|
||||
}
|
||||
|
||||
FILE *fd = NULL;
|
||||
const char *hd = g_get_home_dir ();
|
||||
path = g_build_filename ( hd, ".ssh", "config", NULL );
|
||||
fd = fopen ( path, "r" );
|
||||
FILE *fd = fopen ( path, "r" );
|
||||
|
||||
if ( fd != NULL ) {
|
||||
char *buffer = NULL;
|
||||
|
|
|
@ -338,7 +338,7 @@ static int window_match ( const Mode *sw, GRegex **tokens, unsigned int index )
|
|||
// If hack not in place it would not match queries spanning multiple fields.
|
||||
// e.g. when searching 'title element' and 'class element'
|
||||
GRegex *ftokens[2] = { tokens[j], NULL };
|
||||
if ( !test && c->title != NULL && c->title[0] != '\0' ) {
|
||||
if ( c->title != NULL && c->title[0] != '\0' ) {
|
||||
test = helper_token_match ( ftokens, c->title );
|
||||
}
|
||||
|
||||
|
@ -578,8 +578,7 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
|
|||
}
|
||||
else {
|
||||
rofi_view_hide ();
|
||||
if ( (current_window_manager&(WM_AWESOME|WM_OPENBOX)) != 0 )
|
||||
{
|
||||
if ( ( current_window_manager & ( WM_AWESOME | WM_OPENBOX ) ) != 0 ) {
|
||||
// Get the desktop of the client to switch to
|
||||
uint32_t wmdesktop = 0;
|
||||
xcb_get_property_cookie_t cookie;
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
|
||||
#include <libgwater-xcb.h>
|
||||
|
||||
|
||||
#include "xcb-internal.h"
|
||||
#include "xkb-internal.h"
|
||||
|
||||
|
@ -445,8 +444,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
|
|||
GDir *dir = g_dir_open ( base_dir, 0, NULL );
|
||||
if ( dir ) {
|
||||
const char *dn = NULL;
|
||||
while ( ( dn = g_dir_read_name ( dir ) ) )
|
||||
{
|
||||
while ( ( dn = g_dir_read_name ( dir ) ) ) {
|
||||
if ( !g_str_has_suffix ( dn, G_MODULE_SUFFIX ) ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -458,13 +456,15 @@ static void rofi_collect_modi_dir ( const char *base_dir )
|
|||
if ( m->abi_version != ABI_VERSION ) {
|
||||
fprintf ( stderr, "ABI version of plugin does not match: %08X expecting: %08X\n", m->abi_version, ABI_VERSION );
|
||||
g_module_close ( mod );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m->module = mod;
|
||||
if ( !rofi_collect_modi_add ( m ) ) {
|
||||
g_module_close ( mod );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fprintf ( stderr, "Symbol 'mode' not found in module: %s\n", fn );
|
||||
g_module_close ( mod );
|
||||
}
|
||||
|
@ -533,14 +533,16 @@ static int add_mode ( const char * token )
|
|||
if ( mode ) {
|
||||
modi[num_modi] = mode;
|
||||
num_modi++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// If not build in, use custom modi.
|
||||
Mode *sw = script_switcher_parse_setup ( token );
|
||||
if ( sw != NULL ) {
|
||||
modi[num_modi] = sw;
|
||||
mode_set_config ( sw );
|
||||
num_modi++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Report error, don't continue.
|
||||
fprintf ( stderr, "Invalid script switcher: %s\n", token );
|
||||
}
|
||||
|
|
|
@ -374,7 +374,6 @@ static void rofi_view_window_update_size ( RofiViewState * state )
|
|||
widget_resize ( WIDGET ( state->main_window ), state->width, state->height );
|
||||
}
|
||||
|
||||
|
||||
static void rofi_view_reload_message_bar ( RofiViewState *state )
|
||||
{
|
||||
if ( state->mesg_box == NULL ) {
|
||||
|
@ -385,7 +384,8 @@ static void rofi_view_reload_message_bar ( RofiViewState *state )
|
|||
textbox_text ( state->mesg_tb, msg );
|
||||
widget_enable ( WIDGET ( state->mesg_box ) );
|
||||
g_free ( msg );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
widget_disable ( WIDGET ( state->mesg_box ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@ static int box_get_desired_height ( widget *wid )
|
|||
{
|
||||
box *b = (box *) wid;
|
||||
int spacing = distance_get_pixel ( b->spacing, b->type == BOX_VERTICAL ? ORIENTATION_VERTICAL : ORIENTATION_HORIZONTAL );
|
||||
int active_widgets = 0;
|
||||
int height = 0;
|
||||
if ( b->type == BOX_VERTICAL ) {
|
||||
int active_widgets = 0;
|
||||
for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
widget * child = (widget *) iter->data;
|
||||
if ( !child->enabled ) {
|
||||
|
|
|
@ -336,7 +336,6 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
|
||||
int cursor_x = 0;
|
||||
int cursor_y = 0;
|
||||
int cursor_width = 2; //MAX ( 2, font_height / 10 );
|
||||
int cursor_height = font_height;
|
||||
|
||||
if ( tb->changed ) {
|
||||
|
@ -380,6 +379,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
rofi_theme_get_color ( WIDGET ( tb ), "text", draw );
|
||||
// draw the cursor
|
||||
if ( tb->flags & TB_EDITABLE && tb->blink ) {
|
||||
int cursor_width = 2; //MAX ( 2, font_height / 10 );
|
||||
cairo_rectangle ( draw, x + cursor_x, y + cursor_y, cursor_width, cursor_height );
|
||||
cairo_fill ( draw );
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
/** Log domain for this module */
|
||||
#define LOG_DOMAIN "X11Helper"
|
||||
|
||||
|
||||
WindowManager current_window_manager = WM_EWHM;
|
||||
|
||||
/**
|
||||
|
@ -933,15 +932,16 @@ void x11_helper_discover_window_manager ( void )
|
|||
if ( xcb_ewmh_get_supporting_wm_check_reply ( &xcb->ewmh, cc, &wm_win, NULL ) ) {
|
||||
xcb_ewmh_get_utf8_strings_reply_t wtitle;
|
||||
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked ( &( xcb->ewmh ), wm_win );
|
||||
if ( xcb_ewmh_get_wm_name_reply(&(xcb->ewmh), cookie, &wtitle, (void *)0))
|
||||
{
|
||||
if ( xcb_ewmh_get_wm_name_reply ( &( xcb->ewmh ), cookie, &wtitle, (void *) 0 ) ) {
|
||||
if ( wtitle.strings_len > 0 ) {
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Found window manager: %s", wtitle.strings );
|
||||
if ( g_strcmp0 ( wtitle.strings, "i3" ) == 0 ) {
|
||||
current_window_manager = WM_I3;
|
||||
} else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ){
|
||||
}
|
||||
else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ) {
|
||||
current_window_manager = WM_AWESOME;
|
||||
} else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ){
|
||||
}
|
||||
else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ) {
|
||||
current_window_manager = WM_OPENBOX;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue