mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Fix makefile indent
This commit is contained in:
parent
0adc78387e
commit
b3a77589eb
5 changed files with 127 additions and 127 deletions
|
@ -104,8 +104,6 @@ EXTRA_DIST=\
|
||||||
# Indent
|
# Indent
|
||||||
##
|
##
|
||||||
|
|
||||||
indent: ${rofi_SOURCES} ${top_srcdir}/config/config.def.c
|
|
||||||
uncrustify -c ${top_srcdir}/data/uncrustify.cfg --replace $^
|
|
||||||
|
|
||||||
update-manpage: ${top_srcdir}/doc/rofi-manpage.markdown
|
update-manpage: ${top_srcdir}/doc/rofi-manpage.markdown
|
||||||
ronn --roff --pipe $^ > ${top_srcdir}/doc/rofi.1
|
ronn --roff --pipe $^ > ${top_srcdir}/doc/rofi.1
|
||||||
|
@ -163,6 +161,10 @@ test-x: ${bin_PROGRAMS}
|
||||||
$(top_srcdir)/test/run_test.sh 205 $(top_srcdir)/test/run_script_test.sh $(top_builddir) $(top_srcdir)/doc/example.xresources
|
$(top_srcdir)/test/run_test.sh 205 $(top_srcdir)/test/run_script_test.sh $(top_builddir) $(top_srcdir)/doc/example.xresources
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: indent
|
||||||
|
indent: ${rofi_SOURCES} ${top_srcdir}/config/config.def.c ${helper_test_SOURCES} ${textbox_test_SOURCES} ${rofi_test_SOURCES}
|
||||||
|
uncrustify -c ${top_srcdir}/data/uncrustify.cfg --replace $^
|
||||||
|
|
||||||
.PHONY: cppcheck
|
.PHONY: cppcheck
|
||||||
|
|
||||||
cppcheck: ${rofi_SOURCES}
|
cppcheck: ${rofi_SOURCES}
|
||||||
|
|
|
@ -1057,7 +1057,7 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
|
||||||
// TODO calculate from top.
|
// TODO calculate from top.
|
||||||
textbox_move ( state.arrowbox_bottom,
|
textbox_move ( state.arrowbox_bottom,
|
||||||
state.w - config.padding - state.arrowbox_bottom->w,
|
state.w - config.padding - state.arrowbox_bottom->w,
|
||||||
state.top_offset + (state.max_rows-1) * element_height + LINE_MARGIN );
|
state.top_offset + ( state.max_rows - 1 ) * element_height + LINE_MARGIN );
|
||||||
|
|
||||||
// filtered list
|
// filtered list
|
||||||
state.line_map = g_malloc0_n ( state.num_lines, sizeof ( int ) );
|
state.line_map = g_malloc0_n ( state.num_lines, sizeof ( int ) );
|
||||||
|
|
|
@ -6,26 +6,26 @@
|
||||||
|
|
||||||
static int test = 0;
|
static int test = 0;
|
||||||
|
|
||||||
#define TASSERT(a) {\
|
#define TASSERT( a ) { \
|
||||||
assert ( a );\
|
assert ( a ); \
|
||||||
printf("Test %i passed (%s)\n", ++test, #a);\
|
printf ( "Test %i passed (%s)\n", ++test, # a ); \
|
||||||
}
|
}
|
||||||
int main ( int argc, char ** argv )
|
int main ( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
cmd_set_arguments(argc, argv);
|
cmd_set_arguments ( argc, argv );
|
||||||
char **list = NULL;
|
char **list = NULL;
|
||||||
int llength = 0;
|
int llength = 0;
|
||||||
char * test_str = "{host} {terminal} -e bash -c \"{ssh-client} {host}; echo '{terminal} {host}'\"";
|
char * test_str = "{host} {terminal} -e bash -c \"{ssh-client} {host}; echo '{terminal} {host}'\"";
|
||||||
helper_parse_setup( test_str, &list, &llength, "{host}", "chuck",
|
helper_parse_setup ( test_str, &list, &llength, "{host}", "chuck",
|
||||||
"{terminal}", "x-terminal-emulator", NULL);
|
"{terminal}", "x-terminal-emulator", NULL );
|
||||||
|
|
||||||
TASSERT ( llength == 6 );
|
TASSERT ( llength == 6 );
|
||||||
TASSERT ( strcmp(list[0], "chuck") == 0 );
|
TASSERT ( strcmp ( list[0], "chuck" ) == 0 );
|
||||||
TASSERT ( strcmp(list[1], "x-terminal-emulator") == 0 );
|
TASSERT ( strcmp ( list[1], "x-terminal-emulator" ) == 0 );
|
||||||
TASSERT ( strcmp(list[2], "-e") == 0 );
|
TASSERT ( strcmp ( list[2], "-e" ) == 0 );
|
||||||
TASSERT ( strcmp(list[3], "bash") == 0 );
|
TASSERT ( strcmp ( list[3], "bash" ) == 0 );
|
||||||
TASSERT ( strcmp(list[4], "-c") == 0 );
|
TASSERT ( strcmp ( list[4], "-c" ) == 0 );
|
||||||
TASSERT ( strcmp(list[5], "ssh chuck; echo 'x-terminal-emulator chuck'") == 0 );
|
TASSERT ( strcmp ( list[5], "ssh chuck; echo 'x-terminal-emulator chuck'" ) == 0 );
|
||||||
|
|
||||||
g_strfreev(list);
|
g_strfreev ( list );
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,85 +9,84 @@
|
||||||
|
|
||||||
static int test = 0;
|
static int test = 0;
|
||||||
|
|
||||||
#define TASSERT(a) {\
|
#define TASSERT( a ) { \
|
||||||
assert ( a );\
|
assert ( a ); \
|
||||||
printf("Test %i passed (%s)\n", ++test, #a);\
|
printf ( "Test %i passed (%s)\n", ++test, # a ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *file = "text";
|
const char *file = "text";
|
||||||
|
|
||||||
static void history_test( void )
|
static void history_test ( void )
|
||||||
{
|
{
|
||||||
unlink(file);
|
unlink ( file );
|
||||||
|
|
||||||
// Empty list.
|
// Empty list.
|
||||||
unsigned int length= 0;
|
unsigned int length = 0;
|
||||||
char **retv = history_get_list ( file, &length);
|
char **retv = history_get_list ( file, &length );
|
||||||
|
|
||||||
TASSERT ( retv == NULL );
|
TASSERT ( retv == NULL );
|
||||||
TASSERT ( length == 0 );
|
TASSERT ( length == 0 );
|
||||||
|
|
||||||
// 1 item
|
// 1 item
|
||||||
history_set( file, "aap");
|
history_set ( file, "aap" );
|
||||||
|
|
||||||
retv = history_get_list ( file, &length);
|
retv = history_get_list ( file, &length );
|
||||||
|
|
||||||
TASSERT ( retv != NULL );
|
TASSERT ( retv != NULL );
|
||||||
TASSERT ( length == 1 );
|
TASSERT ( length == 1 );
|
||||||
|
|
||||||
TASSERT ( strcmp(retv[0], "aap") == 0 );
|
TASSERT ( strcmp ( retv[0], "aap" ) == 0 );
|
||||||
|
|
||||||
g_strfreev(retv);
|
g_strfreev ( retv );
|
||||||
|
|
||||||
// Remove entry
|
// Remove entry
|
||||||
history_remove ( file, "aap" );
|
history_remove ( file, "aap" );
|
||||||
|
|
||||||
length= 0;
|
length = 0;
|
||||||
retv = history_get_list ( file, &length);
|
retv = history_get_list ( file, &length );
|
||||||
|
|
||||||
TASSERT ( retv == NULL );
|
TASSERT ( retv == NULL );
|
||||||
TASSERT ( length == 0 );
|
TASSERT ( length == 0 );
|
||||||
|
|
||||||
// 2 items
|
// 2 items
|
||||||
history_set( file, "aap");
|
history_set ( file, "aap" );
|
||||||
history_set( file, "aap");
|
history_set ( file, "aap" );
|
||||||
|
|
||||||
retv = history_get_list ( file, &length);
|
retv = history_get_list ( file, &length );
|
||||||
|
|
||||||
TASSERT ( retv != NULL );
|
TASSERT ( retv != NULL );
|
||||||
TASSERT ( length == 1 );
|
TASSERT ( length == 1 );
|
||||||
|
|
||||||
TASSERT ( strcmp(retv[0], "aap") == 0 );
|
TASSERT ( strcmp ( retv[0], "aap" ) == 0 );
|
||||||
|
|
||||||
g_strfreev(retv);
|
g_strfreev ( retv );
|
||||||
|
|
||||||
for(unsigned int in=length+1; in < 26; in++) {
|
for ( unsigned int in = length + 1; in < 26; in++ ) {
|
||||||
char *p = g_strdup_printf("aap%i", in);
|
char *p = g_strdup_printf ( "aap%i", in );
|
||||||
printf("%s- %d\n",p, in);
|
printf ( "%s- %d\n", p, in );
|
||||||
history_set( file, p);
|
history_set ( file, p );
|
||||||
retv = history_get_list ( file, &length);
|
retv = history_get_list ( file, &length );
|
||||||
|
|
||||||
TASSERT ( retv != NULL );
|
TASSERT ( retv != NULL );
|
||||||
TASSERT ( length == (in) );
|
TASSERT ( length == ( in ) );
|
||||||
|
|
||||||
g_strfreev(retv);
|
g_strfreev ( retv );
|
||||||
|
|
||||||
g_free(p);
|
g_free ( p );
|
||||||
}
|
}
|
||||||
// Max 25 entries.
|
// Max 25 entries.
|
||||||
history_set( file, "blaat" );
|
history_set ( file, "blaat" );
|
||||||
retv = history_get_list ( file, &length);
|
retv = history_get_list ( file, &length );
|
||||||
|
|
||||||
TASSERT ( retv != NULL );
|
TASSERT ( retv != NULL );
|
||||||
TASSERT ( length == 25 );
|
TASSERT ( length == 25 );
|
||||||
|
|
||||||
g_strfreev(retv);
|
|
||||||
|
|
||||||
|
g_strfreev ( retv );
|
||||||
}
|
}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
{
|
{
|
||||||
history_test();
|
history_test ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
|
|
||||||
static int test = 0;
|
static int test = 0;
|
||||||
|
|
||||||
#define TASSERT(a) {\
|
#define TASSERT( a ) { \
|
||||||
assert ( a );\
|
assert ( a ); \
|
||||||
printf("Test %3i passed (%s)\n", ++test, #a);\
|
printf ( "Test %3i passed (%s)\n", ++test, # a ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
Display *display = NULL;
|
Display *display = NULL;
|
||||||
Colormap map = None;
|
Colormap map = None;
|
||||||
XVisualInfo vinfo;
|
XVisualInfo vinfo;
|
||||||
|
|
||||||
static unsigned int color_get ( Display *display, const char *const name )
|
static unsigned int color_get ( Display *display, const char *const name )
|
||||||
|
@ -36,129 +36,128 @@ static unsigned int color_get ( Display *display, const char *const name )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_visual_and_colormap()
|
static void create_visual_and_colormap ()
|
||||||
{
|
{
|
||||||
map = None;
|
map = None;
|
||||||
// Try to create TrueColor map
|
// Try to create TrueColor map
|
||||||
if(XMatchVisualInfo ( display, DefaultScreen ( display ), 32, TrueColor, &vinfo )) {
|
if ( XMatchVisualInfo ( display, DefaultScreen ( display ), 32, TrueColor, &vinfo ) ) {
|
||||||
// Visual found, lets try to create map.
|
// Visual found, lets try to create map.
|
||||||
map = XCreateColormap ( display, DefaultRootWindow ( display ), vinfo.visual, AllocNone );
|
map = XCreateColormap ( display, DefaultRootWindow ( display ), vinfo.visual, AllocNone );
|
||||||
}
|
}
|
||||||
// Failed to create map.
|
// Failed to create map.
|
||||||
if (map == None ) {
|
if ( map == None ) {
|
||||||
// Two fields we use.
|
// Two fields we use.
|
||||||
vinfo.visual = DefaultVisual(display, DefaultScreen(display));
|
vinfo.visual = DefaultVisual ( display, DefaultScreen ( display ) );
|
||||||
vinfo.depth = DefaultDepth(display, DefaultScreen(display));
|
vinfo.depth = DefaultDepth ( display, DefaultScreen ( display ) );
|
||||||
map = DefaultColormap( display, DefaultScreen (display));
|
map = DefaultColormap ( display, DefaultScreen ( display ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get DISPLAY
|
// Get DISPLAY
|
||||||
const char *display_str = getenv ( "DISPLAY" );
|
const char *display_str = getenv ( "DISPLAY" );
|
||||||
if ( !( display = XOpenDisplay ( display_str ) ) ) {
|
if ( !( display = XOpenDisplay ( display_str ) ) ) {
|
||||||
fprintf ( stderr, "cannot open display!\n" );
|
fprintf ( stderr, "cannot open display!\n" );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
create_visual_and_colormap();
|
create_visual_and_colormap ();
|
||||||
|
|
||||||
setup_abe();
|
setup_abe ();
|
||||||
TASSERT( display != NULL );
|
TASSERT ( display != NULL );
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
attr.colormap = map;
|
attr.colormap = map;
|
||||||
attr.border_pixel = color_get ( display, "white" );
|
attr.border_pixel = color_get ( display, "white" );
|
||||||
attr.background_pixel = color_get ( display, "black");
|
attr.background_pixel = color_get ( display, "black" );
|
||||||
Window mw = XCreateWindow ( display, DefaultRootWindow ( display ),
|
Window mw = XCreateWindow ( display, DefaultRootWindow ( display ),
|
||||||
0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput,
|
0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput,
|
||||||
vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr );
|
vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr );
|
||||||
TASSERT( mw != None );
|
TASSERT ( mw != None );
|
||||||
// Set alternate row to normal row.
|
// Set alternate row to normal row.
|
||||||
config.menu_bg_alt = config.menu_bg;
|
config.menu_bg_alt = config.menu_bg;
|
||||||
textbox_setup ( &vinfo, map );
|
textbox_setup ( &vinfo, map );
|
||||||
textbox *box = textbox_create(mw , &vinfo, map, TB_EDITABLE|TB_AUTOWIDTH|TB_AUTOHEIGHT, 0,0, -1, -1, NORMAL, "test");
|
textbox *box = textbox_create ( mw, &vinfo, map, TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT, 0, 0, -1, -1, NORMAL, "test" );
|
||||||
TASSERT( box != NULL );
|
TASSERT ( box != NULL );
|
||||||
|
|
||||||
textbox_cursor_end ( box );
|
textbox_cursor_end ( box );
|
||||||
TASSERT ( box->cursor == 4);
|
TASSERT ( box->cursor == 4 );
|
||||||
textbox_cursor ( box, -1 );
|
textbox_cursor ( box, -1 );
|
||||||
TASSERT ( box->cursor == 0 );
|
TASSERT ( box->cursor == 0 );
|
||||||
textbox_cursor ( box, 8 );
|
textbox_cursor ( box, 8 );
|
||||||
TASSERT ( box->cursor == 4 );
|
TASSERT ( box->cursor == 4 );
|
||||||
textbox_cursor ( box, 2 );
|
textbox_cursor ( box, 2 );
|
||||||
TASSERT ( box->cursor == 2 );
|
TASSERT ( box->cursor == 2 );
|
||||||
textbox_insert ( box, 3, "bo");
|
textbox_insert ( box, 3, "bo" );
|
||||||
TASSERT ( strcmp(box->text, "tesbot") == 0 );
|
TASSERT ( strcmp ( box->text, "tesbot" ) == 0 );
|
||||||
textbox_cursor_end ( box );
|
textbox_cursor_end ( box );
|
||||||
TASSERT ( box->cursor == 6);
|
TASSERT ( box->cursor == 6 );
|
||||||
|
|
||||||
TASSERT( textbox_get_width( box) > 0 );
|
TASSERT ( textbox_get_width ( box ) > 0 );
|
||||||
TASSERT( textbox_get_height( box) > 0 );
|
TASSERT ( textbox_get_height ( box ) > 0 );
|
||||||
|
|
||||||
TASSERT( textbox_get_width( box) >= textbox_get_font_width( box) );
|
TASSERT ( textbox_get_width ( box ) >= textbox_get_font_width ( box ) );
|
||||||
TASSERT( textbox_get_height( box) >= textbox_get_font_height( box) );
|
TASSERT ( textbox_get_height ( box ) >= textbox_get_font_height ( box ) );
|
||||||
|
|
||||||
TASSERT( textbox_get_estimated_char_width ( ) > 0 );
|
TASSERT ( textbox_get_estimated_char_width ( ) > 0 );
|
||||||
|
|
||||||
textbox_cursor_bkspc ( box );
|
textbox_cursor_bkspc ( box );
|
||||||
TASSERT ( strcmp(box->text, "tesbo") == 0 );
|
TASSERT ( strcmp ( box->text, "tesbo" ) == 0 );
|
||||||
TASSERT ( box->cursor == 5);
|
TASSERT ( box->cursor == 5 );
|
||||||
|
|
||||||
textbox_cursor_dec ( box );
|
textbox_cursor_dec ( box );
|
||||||
TASSERT ( box->cursor == 4);
|
TASSERT ( box->cursor == 4 );
|
||||||
textbox_cursor_del ( box );
|
textbox_cursor_del ( box );
|
||||||
TASSERT ( strcmp(box->text, "tesb") == 0 );
|
TASSERT ( strcmp ( box->text, "tesb" ) == 0 );
|
||||||
textbox_cursor_dec ( box );
|
textbox_cursor_dec ( box );
|
||||||
TASSERT ( box->cursor == 3);
|
TASSERT ( box->cursor == 3 );
|
||||||
textbox_cursor_inc ( box );
|
textbox_cursor_inc ( box );
|
||||||
TASSERT ( box->cursor == 4);
|
TASSERT ( box->cursor == 4 );
|
||||||
textbox_cursor_inc ( box );
|
textbox_cursor_inc ( box );
|
||||||
TASSERT ( box->cursor == 4);
|
TASSERT ( box->cursor == 4 );
|
||||||
// Cursor after delete section.
|
// Cursor after delete section.
|
||||||
textbox_delete ( box, 0, 1 );
|
textbox_delete ( box, 0, 1 );
|
||||||
TASSERT ( strcmp(box->text, "esb") == 0 );
|
TASSERT ( strcmp ( box->text, "esb" ) == 0 );
|
||||||
TASSERT ( box->cursor == 3);
|
TASSERT ( box->cursor == 3 );
|
||||||
// Cursor before delete.
|
// Cursor before delete.
|
||||||
textbox_text( box, "aap noot mies");
|
textbox_text ( box, "aap noot mies" );
|
||||||
TASSERT ( strcmp(box->text, "aap noot mies") == 0 );
|
TASSERT ( strcmp ( box->text, "aap noot mies" ) == 0 );
|
||||||
textbox_cursor( box, 3 );
|
textbox_cursor ( box, 3 );
|
||||||
TASSERT ( box->cursor == 3);
|
TASSERT ( box->cursor == 3 );
|
||||||
textbox_delete ( box, 3, 6 );
|
textbox_delete ( box, 3, 6 );
|
||||||
TASSERT ( strcmp(box->text, "aapmies") == 0 );
|
TASSERT ( strcmp ( box->text, "aapmies" ) == 0 );
|
||||||
TASSERT ( box->cursor == 3);
|
TASSERT ( box->cursor == 3 );
|
||||||
|
|
||||||
// Cursor within delete
|
// Cursor within delete
|
||||||
textbox_text( box, "aap noot mies");
|
textbox_text ( box, "aap noot mies" );
|
||||||
TASSERT ( strcmp(box->text, "aap noot mies") == 0 );
|
TASSERT ( strcmp ( box->text, "aap noot mies" ) == 0 );
|
||||||
textbox_cursor( box, 5 );
|
textbox_cursor ( box, 5 );
|
||||||
TASSERT ( box->cursor == 5);
|
TASSERT ( box->cursor == 5 );
|
||||||
textbox_delete ( box, 3, 6 );
|
textbox_delete ( box, 3, 6 );
|
||||||
TASSERT ( strcmp(box->text, "aapmies") == 0 );
|
TASSERT ( strcmp ( box->text, "aapmies" ) == 0 );
|
||||||
TASSERT ( box->cursor == 3);
|
TASSERT ( box->cursor == 3 );
|
||||||
// Cursor after delete.
|
// Cursor after delete.
|
||||||
textbox_text( box, "aap noot mies");
|
textbox_text ( box, "aap noot mies" );
|
||||||
TASSERT ( strcmp(box->text, "aap noot mies") == 0 );
|
TASSERT ( strcmp ( box->text, "aap noot mies" ) == 0 );
|
||||||
textbox_cursor( box, 11 );
|
textbox_cursor ( box, 11 );
|
||||||
TASSERT ( box->cursor == 11);
|
TASSERT ( box->cursor == 11 );
|
||||||
textbox_delete ( box, 3, 6 );
|
textbox_delete ( box, 3, 6 );
|
||||||
TASSERT ( strcmp(box->text, "aapmies") == 0 );
|
TASSERT ( strcmp ( box->text, "aapmies" ) == 0 );
|
||||||
TASSERT ( box->cursor == 5);
|
TASSERT ( box->cursor == 5 );
|
||||||
|
|
||||||
|
|
||||||
textbox_font ( box, HIGHLIGHT );
|
textbox_font ( box, HIGHLIGHT );
|
||||||
textbox_draw( box);
|
textbox_draw ( box );
|
||||||
|
|
||||||
textbox_show( box );
|
textbox_show ( box );
|
||||||
textbox_move ( box, 12, 13);
|
textbox_move ( box, 12, 13 );
|
||||||
TASSERT ( box->x == 12 );
|
TASSERT ( box->x == 12 );
|
||||||
TASSERT ( box->y == 13 );
|
TASSERT ( box->y == 13 );
|
||||||
textbox_hide( box );
|
textbox_hide ( box );
|
||||||
|
|
||||||
textbox_free(box);
|
textbox_free ( box );
|
||||||
textbox_cleanup( );
|
textbox_cleanup ( );
|
||||||
|
|
||||||
cleanup_abe();
|
cleanup_abe ();
|
||||||
|
|
||||||
XDestroyWindow ( display, mw);
|
XDestroyWindow ( display, mw );
|
||||||
XCloseDisplay ( display );
|
XCloseDisplay ( display );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue