Re-Indent code

This commit is contained in:
Dave Davenport 2017-04-27 22:59:14 +02:00
parent b1ecb6ca77
commit ce4b1b23b4
17 changed files with 118 additions and 105 deletions

View File

@ -116,7 +116,6 @@ typedef enum
P_HIGHLIGHT, P_HIGHLIGHT,
} PropertyType; } PropertyType;
/** /**
* Represent the color in theme. * Represent the color in theme.
*/ */

View File

@ -280,5 +280,10 @@ void rofi_view_workers_finalize ( void );
* @returns the current monitor workarea * @returns the current monitor workarea
*/ */
void rofi_view_get_current_monitor ( int *width, int *height ); void rofi_view_get_current_monitor ( int *width, int *height );
/**
* Takes a screenshot.
*/
void rofi_capture_screenshot ( void );
/**@}*/ /**@}*/
#endif #endif

View File

@ -964,7 +964,6 @@ int helper_execute_command ( const char *wd, const char *cmd, int run_in_term )
return retv; return retv;
} }
char *helper_get_theme_path ( const char *file ) char *helper_get_theme_path ( const char *file )
{ {
char *filename = rofi_expand_path ( file ); char *filename = rofi_expand_path ( file );
@ -975,7 +974,8 @@ char *helper_get_theme_path ( const char *file )
if ( g_str_has_suffix ( file, ".rasi" ) ) { if ( g_str_has_suffix ( file, ".rasi" ) ) {
filename = g_strdup ( file ); filename = g_strdup ( file );
} else { }
else {
filename = g_strconcat ( file, ".rasi", NULL ); filename = g_strconcat ( file, ".rasi", NULL );
} }
// Check config directory. // Check config directory.

View File

@ -289,7 +289,6 @@ static void print_list_of_modi ( int is_term )
is_term ? color_reset : "" is_term ? color_reset : ""
); );
} }
} }
static void print_main_application_options ( int is_term ) static void print_main_application_options ( int is_term )
{ {
@ -684,7 +683,8 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
g_warning ( "The XCB connection to X server had a fatal error: %d", status ); g_warning ( "The XCB connection to X server had a fatal error: %d", status );
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} else { }
else {
g_warning ( "main_loop_x11_event_handler: ev == NULL, status == %d", status ); g_warning ( "main_loop_x11_event_handler: ev == NULL, status == %d", status );
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
} }
@ -908,6 +908,11 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
static gboolean record ( void )
{
rofi_capture_screenshot ();
return G_SOURCE_CONTINUE;
}
/** /**
* @param argc number of input arguments. * @param argc number of input arguments.
* @param argv array of the input arguments. * @param argv array of the input arguments.
@ -1163,8 +1168,7 @@ int main ( int argc, char *argv[] )
if ( !dmenu_mode ) { if ( !dmenu_mode ) {
// setup_modi // setup_modi
if ( setup_modi () ) if ( setup_modi () ) {
{
cleanup (); cleanup ();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -1215,6 +1219,11 @@ int main ( int argc, char *argv[] )
cleanup (); cleanup ();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
unsigned int interval = 1;
if ( find_arg_uint ( "-record-screenshots", &interval ) ) {
g_timeout_add ( 1000 / (double) interval, record, NULL );
}
main_loop_source = g_water_xcb_source_new_for_connection ( NULL, xcb->connection, main_loop_x11_event_handler, NULL, NULL ); main_loop_source = g_water_xcb_source_new_for_connection ( NULL, xcb->connection, main_loop_x11_event_handler, NULL, NULL );
TICK_N ( "X11 Setup " ); TICK_N ( "X11 Setup " );

View File

@ -173,7 +173,7 @@ static int lev_sort ( const void *p1, const void *p2, void *arg )
/** /**
* Stores a screenshot of Rofi at that point in time. * Stores a screenshot of Rofi at that point in time.
*/ */
static void menu_capture_screenshot ( void ) void rofi_capture_screenshot ( void )
{ {
const char *outp = g_getenv ( "ROFI_PNG_OUTPUT" ); const char *outp = g_getenv ( "ROFI_PNG_OUTPUT" );
if ( CacheState.edit_surf == NULL ) { if ( CacheState.edit_surf == NULL ) {
@ -190,7 +190,7 @@ static void menu_capture_screenshot ( void )
GDateTime *now = g_date_time_new_now_local (); GDateTime *now = g_date_time_new_now_local ();
// Format filename. // Format filename.
char *timestmp = g_date_time_format ( now, "rofi-%Y-%m-%d-%H%M" ); char *timestmp = g_date_time_format ( now, "rofi-%Y-%m-%d-%H%M" );
char *filename = g_strdup_printf ( "%s.png", timestmp ); char *filename = g_strdup_printf ( "%s-%05d.png", timestmp, 0 );
// Build full path // Build full path
char *fpath = NULL; char *fpath = NULL;
if ( outp == NULL ) { if ( outp == NULL ) {
@ -202,7 +202,7 @@ static void menu_capture_screenshot ( void )
// Try the next index. // Try the next index.
index++; index++;
// Format filename. // Format filename.
filename = g_strdup_printf ( "%s-%d.png", timestmp, index ); filename = g_strdup_printf ( "%s-%05d.png", timestmp, index );
// Build full path // Build full path
fpath = g_build_filename ( xdg_pict_dir, filename, NULL ); fpath = g_build_filename ( xdg_pict_dir, filename, NULL );
} }
@ -1164,7 +1164,7 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction actio
xcb_flush ( xcb->connection ); xcb_flush ( xcb->connection );
break; break;
case SCREENSHOT: case SCREENSHOT:
menu_capture_screenshot ( ); rofi_capture_screenshot ( );
break; break;
case TOGGLE_SORT: case TOGGLE_SORT:
if ( state->case_indicator != NULL ) { if ( state->case_indicator != NULL ) {