1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Re-indent the code using indenter.

This commit is contained in:
Dave Davenport 2021-06-01 10:44:23 +02:00
parent 5a7df38ccd
commit 3b297ee80d
19 changed files with 206 additions and 196 deletions

View file

@ -78,7 +78,7 @@ typedef enum
/** User wants to jump to another switcher. */ /** User wants to jump to another switcher. */
MENU_QUICK_SWITCH = 0x00200000, MENU_QUICK_SWITCH = 0x00200000,
/** User wants to jump to custom command. */ /** User wants to jump to custom command. */
MENU_CUSTOM_COMMAND= 0x00800000, MENU_CUSTOM_COMMAND = 0x00800000,
/** Go to the previous menu. */ /** Go to the previous menu. */
MENU_PREVIOUS = 0x00400000, MENU_PREVIOUS = 0x00400000,
/** Bindings specifics */ /** Bindings specifics */

View file

@ -132,12 +132,12 @@ int monitor_active ( workarea *mon );
* *
* Stores old input focus for reverting and set focus to rofi. * Stores old input focus for reverting and set focus to rofi.
*/ */
void rofi_xcb_set_input_focus(xcb_window_t w); void rofi_xcb_set_input_focus ( xcb_window_t w );
/** /**
* IF set, revert the focus back to the original applications. * IF set, revert the focus back to the original applications.
*/ */
void rofi_xcb_revert_input_focus(void); void rofi_xcb_revert_input_focus ( void );
/** /**
* Depth of visual * Depth of visual
@ -235,6 +235,6 @@ cairo_surface_t *x11_helper_get_screenshot_surface_window ( xcb_window_t window,
* *
* Blur the content of the surface with radius and deviation. * Blur the content of the surface with radius and deviation.
*/ */
void cairo_image_surface_blur(cairo_surface_t* surface, double radius, double deviation); void cairo_image_surface_blur ( cairo_surface_t* surface, double radius, double deviation );
#endif #endif

View file

@ -400,7 +400,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
} }
else if ( !g_strcmp0 ( key, "Service" ) ) { else if ( !g_strcmp0 ( key, "Service" ) ) {
desktop_entry_type = DRUN_DESKTOP_ENTRY_TYPE_SERVICE; desktop_entry_type = DRUN_DESKTOP_ENTRY_TYPE_SERVICE;
g_debug("Service file detected."); g_debug ( "Service file detected." );
} }
else { else {
g_debug ( "[%s] [%s] Skipping desktop file: Not of type Application or Link (%s)", id, path, key ); g_debug ( "[%s] [%s] Skipping desktop file: Not of type Application or Link (%s)", id, path, key );
@ -575,7 +575,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
pd->entry_list[pd->cmd_list_length].type = desktop_entry_type; pd->entry_list[pd->cmd_list_length].type = desktop_entry_type;
if ( desktop_entry_type == DRUN_DESKTOP_ENTRY_TYPE_APPLICATION || if ( desktop_entry_type == DRUN_DESKTOP_ENTRY_TYPE_APPLICATION ||
desktop_entry_type == DRUN_DESKTOP_ENTRY_TYPE_SERVICE) { desktop_entry_type == DRUN_DESKTOP_ENTRY_TYPE_SERVICE ) {
pd->entry_list[pd->cmd_list_length].exec = g_key_file_get_string ( kf, action, "Exec", NULL ); pd->entry_list[pd->cmd_list_length].exec = g_key_file_get_string ( kf, action, "Exec", NULL );
} }
else { else {
@ -726,9 +726,11 @@ static gint drun_int_sort_list ( gconstpointer a, gconstpointer b, G_GNUC_UNUSED
if ( da->sort_index < 0 && db->sort_index < 0 ) { if ( da->sort_index < 0 && db->sort_index < 0 ) {
if ( da->name == NULL && db->name == NULL ) { if ( da->name == NULL && db->name == NULL ) {
return 0; return 0;
} else if ( da->name == NULL ) { }
else if ( da->name == NULL ) {
return -1; return -1;
} else if ( db->name == NULL ) { }
else if ( db->name == NULL ) {
return 1; return 1;
} }
return g_utf8_collate ( da->name, db->name ); return g_utf8_collate ( da->name, db->name );
@ -1078,7 +1080,8 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
rmpd->cmd_list_length--; rmpd->cmd_list_length--;
} }
retv = RELOAD_DIALOG; retv = RELOAD_DIALOG;
} else if ( mretv & MENU_CUSTOM_COMMAND ) { }
else if ( mretv & MENU_CUSTOM_COMMAND ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} }
return retv; return retv;

View file

@ -97,8 +97,8 @@ static void free_list ( FileBrowserModePrivateData *pd )
static gint compare ( gconstpointer a, gconstpointer b, G_GNUC_UNUSED gpointer data ) static gint compare ( gconstpointer a, gconstpointer b, G_GNUC_UNUSED gpointer data )
{ {
FBFile *fa = (FBFile*) a; FBFile *fa = (FBFile *) a;
FBFile *fb = (FBFile*) b; FBFile *fb = (FBFile *) b;
if ( fa->type != fb->type ) { if ( fa->type != fb->type ) {
return fa->type - fb->type; return fa->type - fb->type;
} }
@ -239,9 +239,11 @@ static ModeMode file_browser_mode_result ( Mode *sw, int mretv, char **input, un
} }
else if ( mretv & MENU_QUICK_SWITCH ) { else if ( mretv & MENU_QUICK_SWITCH ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} else if ( mretv & MENU_CUSTOM_COMMAND ) { }
else if ( mretv & MENU_CUSTOM_COMMAND ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} else if ( ( mretv & MENU_OK ) ) { }
else if ( ( mretv & MENU_OK ) ) {
if ( selected_line < pd->array_length ) { if ( selected_line < pd->array_length ) {
if ( pd->array[selected_line].type == UP ) { if ( pd->array[selected_line].type == UP ) {
GFile *new = g_file_get_parent ( pd->current_dir ); GFile *new = g_file_get_parent ( pd->current_dir );
@ -266,9 +268,9 @@ static ModeMode file_browser_mode_result ( Mode *sw, int mretv, char **input, un
} }
else if ( pd->array[selected_line].type == RFILE ) { else if ( pd->array[selected_line].type == RFILE ) {
char *d = g_filename_from_utf8 ( pd->array[selected_line].path, -1, NULL, NULL, NULL ); char *d = g_filename_from_utf8 ( pd->array[selected_line].path, -1, NULL, NULL, NULL );
char *d_esc = g_shell_quote(d); char *d_esc = g_shell_quote ( d );
char *cmd = g_strdup_printf ( "xdg-open %s", d_esc ); char *cmd = g_strdup_printf ( "xdg-open %s", d_esc );
g_free(d_esc); g_free ( d_esc );
g_free ( d ); g_free ( d );
char *cdir = g_file_get_path ( pd->current_dir ); char *cdir = g_file_get_path ( pd->current_dir );
helper_execute_command ( cdir, cmd, FALSE, NULL ); helper_execute_command ( cdir, cmd, FALSE, NULL );

View file

@ -71,7 +71,6 @@ static ModeMode help_keys_mode_result ( G_GNUC_UNUSED Mode *sw,
G_GNUC_UNUSED char **input, G_GNUC_UNUSED char **input,
G_GNUC_UNUSED unsigned int selected_line ) G_GNUC_UNUSED unsigned int selected_line )
{ {
if ( mretv & MENU_CUSTOM_COMMAND ) { if ( mretv & MENU_CUSTOM_COMMAND ) {
int retv = ( mretv & MENU_LOWER_MASK ); int retv = ( mretv & MENU_LOWER_MASK );
return retv; return retv;

View file

@ -391,8 +391,8 @@ static ModeMode run_mode_result ( Mode *sw, int mretv, char **input, unsigned in
retv = RELOAD_DIALOG; retv = RELOAD_DIALOG;
run_mode_destroy ( sw ); run_mode_destroy ( sw );
run_mode_init ( sw ); run_mode_init ( sw );
}
} else if ( mretv & MENU_CUSTOM_COMMAND ) { else if ( mretv & MENU_CUSTOM_COMMAND ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} }
return retv; return retv;

View file

@ -297,7 +297,8 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
return RELOAD_DIALOG; return RELOAD_DIALOG;
} }
} }
} else { }
else {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
return retv; return retv;
} }

View file

@ -606,7 +606,8 @@ static ModeMode ssh_mode_result ( Mode *sw, int mretv, char **input, unsigned in
retv = RELOAD_DIALOG; retv = RELOAD_DIALOG;
ssh_mode_destroy ( sw ); ssh_mode_destroy ( sw );
ssh_mode_init ( sw ); ssh_mode_init ( sw );
} else if ( mretv & MENU_CUSTOM_COMMAND ) { }
else if ( mretv & MENU_CUSTOM_COMMAND ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} }
return retv; return retv;

View file

@ -349,8 +349,8 @@ static client* window_client ( ModeModePrivateData *pd, xcb_window_t win )
cky = xcb_icccm_get_wm_class ( xcb->connection, c->window ); cky = xcb_icccm_get_wm_class ( xcb->connection, c->window );
xcb_icccm_get_wm_class_reply_t wcr; xcb_icccm_get_wm_class_reply_t wcr;
if ( xcb_icccm_get_wm_class_reply ( xcb->connection, cky, &wcr, NULL ) ) { if ( xcb_icccm_get_wm_class_reply ( xcb->connection, cky, &wcr, NULL ) ) {
c->class = g_markup_escape_text( wcr.class_name, -1 ); c->class = g_markup_escape_text ( wcr.class_name, -1 );
c->name = g_markup_escape_text( wcr.instance_name, -1 ); c->name = g_markup_escape_text ( wcr.instance_name, -1 );
pd->name_len = MAX ( c->name ? g_utf8_strlen ( c->name, -1 ) : 0, pd->name_len ); pd->name_len = MAX ( c->name ? g_utf8_strlen ( c->name, -1 ) : 0, pd->name_len );
xcb_icccm_get_wm_class_reply_wipe ( &wcr ); xcb_icccm_get_wm_class_reply_wipe ( &wcr );
} }
@ -496,7 +496,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
current_desktop = 0; current_desktop = 0;
} }
g_debug("Get list from: %d", xcb->screen_nbr); g_debug ( "Get list from: %d", xcb->screen_nbr );
c = xcb_ewmh_get_client_list_stacking ( &xcb->ewmh, xcb->screen_nbr ); c = xcb_ewmh_get_client_list_stacking ( &xcb->ewmh, xcb->screen_nbr );
xcb_ewmh_get_windows_reply_t clients = { 0, }; xcb_ewmh_get_windows_reply_t clients = { 0, };
if ( xcb_ewmh_get_client_list_stacking_reply ( &xcb->ewmh, c, &clients, NULL ) ) { if ( xcb_ewmh_get_client_list_stacking_reply ( &xcb->ewmh, c, &clients, NULL ) ) {
@ -727,7 +727,8 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
retv = RELOAD_DIALOG; retv = RELOAD_DIALOG;
} }
g_free ( lf_cmd ); g_free ( lf_cmd );
} else if ( mretv & MENU_CUSTOM_COMMAND ) { }
else if ( mretv & MENU_CUSTOM_COMMAND ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} }
return retv; return retv;

View file

@ -179,11 +179,11 @@ static gchar *fuzzy_to_regex ( const char * input )
return retv; return retv;
} }
static gchar *prefix_regex (const char * input) static gchar *prefix_regex ( const char * input )
{ {
gchar *r = g_regex_escape_string(input, -1); gchar *r = g_regex_escape_string ( input, -1 );
char *retv = g_strconcat("\\b", r, NULL); char *retv = g_strconcat ( "\\b", r, NULL );
g_free(r); g_free ( r );
return retv; return retv;
} }
@ -257,9 +257,9 @@ static rofi_int_matcher * create_regex ( const char *input, int case_sensitive )
g_free ( r ); g_free ( r );
break; break;
case MM_PREFIX: case MM_PREFIX:
r = prefix_regex(input); r = prefix_regex ( input );
retv = R(r, case_sensitive); retv = R ( r, case_sensitive );
g_free(r); g_free ( r );
break; break;
default: default:
r = g_regex_escape_string ( input, -1 ); r = g_regex_escape_string ( input, -1 );
@ -645,7 +645,7 @@ int config_sanity_check ( void )
else if ( g_strcmp0 ( config.matching, "normal" ) == 0 ) { else if ( g_strcmp0 ( config.matching, "normal" ) == 0 ) {
config.matching_method = MM_NORMAL;; config.matching_method = MM_NORMAL;;
} }
else if (g_strcmp0 (config.matching, "prefix") == 0) { else if ( g_strcmp0 ( config.matching, "prefix" ) == 0 ) {
config.matching_method = MM_PREFIX; config.matching_method = MM_PREFIX;
} }
else { else {

View file

@ -118,7 +118,6 @@ static int dmenu_mode = FALSE;
/** Rofi's return code */ /** Rofi's return code */
int return_code = EXIT_SUCCESS; int return_code = EXIT_SUCCESS;
void process_result ( RofiViewState *state ); void process_result ( RofiViewState *state );
void rofi_set_return_code ( int code ) void rofi_set_return_code ( int code )
@ -795,7 +794,6 @@ int main ( int argc, char *argv[] )
return EXIT_FAILURE; return EXIT_FAILURE;
} }
{ {
const char *ro_pid = g_getenv ( "ROFI_OUTSIDE" ); const char *ro_pid = g_getenv ( "ROFI_OUTSIDE" );
if ( ro_pid != NULL ) { if ( ro_pid != NULL ) {
@ -1067,7 +1065,6 @@ int main ( int argc, char *argv[] )
return return_code; return return_code;
} }
/** List of error messages.*/ /** List of error messages.*/
extern GList *list_of_error_msgs; extern GList *list_of_error_msgs;
int rofi_theme_rasi_validate ( const char *filename ) int rofi_theme_rasi_validate ( const char *filename )
@ -1079,7 +1076,7 @@ int rofi_theme_rasi_validate ( const char *filename )
for ( GList *iter = g_list_first ( list_of_error_msgs ); for ( GList *iter = g_list_first ( list_of_error_msgs );
iter != NULL; iter = g_list_next ( iter ) ) { iter != NULL; iter = g_list_next ( iter ) ) {
fputs ( ((GString*)iter->data)->str, stderr ); fputs ( ( (GString *) iter->data )->str, stderr );
} }
return EXIT_FAILURE; return EXIT_FAILURE;

View file

@ -736,9 +736,9 @@ static void rofi_view_setup_fake_transparency ( widget *win, const char* const f
cairo_paint ( dr ); cairo_paint ( dr );
cairo_destroy ( dr ); cairo_destroy ( dr );
cairo_surface_destroy ( s ); cairo_surface_destroy ( s );
if ( blur > 0 ){ if ( blur > 0 ) {
cairo_image_surface_blur( CacheState.fake_bg, (double)blur, 0 ); cairo_image_surface_blur ( CacheState.fake_bg, (double) blur, 0 );
TICK_N("BLUR"); TICK_N ( "BLUR" );
} }
} }
} }
@ -879,7 +879,7 @@ void __create_window ( MenuFlags menu_flags )
TICK_N ( "setup window name and class" ); TICK_N ( "setup window name and class" );
const char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL ); const char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL );
if ( transparency ) { if ( transparency ) {
rofi_view_setup_fake_transparency ( WIDGET (win), transparency ); rofi_view_setup_fake_transparency ( WIDGET ( win ), transparency );
} }
else if ( config.fake_transparency && config.fake_background ) { else if ( config.fake_transparency && config.fake_background ) {
rofi_view_setup_fake_transparency ( WIDGET ( win ), config.fake_background ); rofi_view_setup_fake_transparency ( WIDGET ( win ), config.fake_background );
@ -1517,7 +1517,8 @@ static X11CursorType rofi_cursor_type_to_x11_cursor_type ( RofiCursorType type )
return CURSOR_DEFAULT; return CURSOR_DEFAULT;
} }
static RofiCursorType rofi_view_resolve_cursor ( RofiViewState *state, gint x, gint y ) { static RofiCursorType rofi_view_resolve_cursor ( RofiViewState *state, gint x, gint y )
{
widget *target = widget_find_mouse_target ( WIDGET ( state->main_window ), WIDGET_TYPE_UNKNOWN, x, y ); widget *target = widget_find_mouse_target ( WIDGET ( state->main_window ), WIDGET_TYPE_UNKNOWN, x, y );
return target != NULL return target != NULL
@ -1986,7 +1987,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
/* When Override Redirect, the WM will not let us know we can take focus, so just steal it */ /* When Override Redirect, the WM will not let us know we can take focus, so just steal it */
if ( ( ( menu_flags & MENU_NORMAL_WINDOW ) == 0 ) ) { if ( ( ( menu_flags & MENU_NORMAL_WINDOW ) == 0 ) ) {
rofi_xcb_set_input_focus(CacheState.main_window); rofi_xcb_set_input_focus ( CacheState.main_window );
} }
if ( xcb->sncontext != NULL ) { if ( xcb->sncontext != NULL ) {
@ -2041,7 +2042,7 @@ int rofi_view_error_dialog ( const char *msg, int markup )
void rofi_view_hide ( void ) void rofi_view_hide ( void )
{ {
if ( CacheState.main_window != XCB_WINDOW_NONE ) { if ( CacheState.main_window != XCB_WINDOW_NONE ) {
rofi_xcb_revert_input_focus(); rofi_xcb_revert_input_focus ();
xcb_unmap_window ( xcb->connection, CacheState.main_window ); xcb_unmap_window ( xcb->connection, CacheState.main_window );
display_early_cleanup (); display_early_cleanup ();
} }
@ -2073,7 +2074,7 @@ void rofi_view_cleanup ()
if ( CacheState.main_window != XCB_WINDOW_NONE ) { if ( CacheState.main_window != XCB_WINDOW_NONE ) {
g_debug ( "Unmapping and free'ing window" ); g_debug ( "Unmapping and free'ing window" );
xcb_unmap_window ( xcb->connection, CacheState.main_window ); xcb_unmap_window ( xcb->connection, CacheState.main_window );
rofi_xcb_revert_input_focus(); rofi_xcb_revert_input_focus ();
xcb_free_gc ( xcb->connection, CacheState.gc ); xcb_free_gc ( xcb->connection, CacheState.gc );
xcb_free_pixmap ( xcb->connection, CacheState.edit_pixmap ); xcb_free_pixmap ( xcb->connection, CacheState.edit_pixmap );
xcb_destroy_window ( xcb->connection, CacheState.main_window ); xcb_destroy_window ( xcb->connection, CacheState.main_window );

View file

@ -188,10 +188,11 @@ textbox* textbox_create ( widget *parent, WidgetType type, const char *name, Tex
} }
// Allow overriding of markup. // Allow overriding of markup.
if ( rofi_theme_get_boolean ( WIDGET ( tb ), "markup", (tb->flags&TB_MARKUP) == TB_MARKUP ) ) { if ( rofi_theme_get_boolean ( WIDGET ( tb ), "markup", ( tb->flags & TB_MARKUP ) == TB_MARKUP ) ) {
tb->flags |= TB_MARKUP; tb->flags |= TB_MARKUP;
} else { }
tb->flags &= (~TB_MARKUP); else {
tb->flags &= ( ~TB_MARKUP );
} }
const char *txt = rofi_theme_get_string ( WIDGET ( tb ), "str", text ); const char *txt = rofi_theme_get_string ( WIDGET ( tb ), "str", text );

View file

@ -131,22 +131,23 @@ static xcb_visualtype_t * lookup_visual ( xcb_screen_t *s, xcb_visualid_t visu
* http://macslow.thepimp.net. I'm not entirely sure he's proud of it, but it has * http://macslow.thepimp.net. I'm not entirely sure he's proud of it, but it has
* proved immeasurably useful for me. */ * proved immeasurably useful for me. */
static uint32_t* create_kernel(double radius, double deviation, uint32_t *sum2) { static uint32_t* create_kernel ( double radius, double deviation, uint32_t *sum2 )
int size = 2 * (int)(radius) + 1; {
uint32_t* kernel = (uint32_t*)(g_malloc(sizeof(uint32_t) * (size + 1))); int size = 2 * (int) ( radius ) + 1;
double radiusf = fabs(radius) + 1.0; uint32_t* kernel = (uint32_t *) ( g_malloc ( sizeof ( uint32_t ) * ( size + 1 ) ) );
double radiusf = fabs ( radius ) + 1.0;
double value = -radius; double value = -radius;
double sum = 0.0; double sum = 0.0;
int i; int i;
if(deviation == 0.0) { if ( deviation == 0.0 ) {
deviation = sqrt( -(radiusf * radiusf) / (2.0 * log(1.0 / 255.0))); deviation = sqrt ( -( radiusf * radiusf ) / ( 2.0 * log ( 1.0 / 255.0 ) ) );
} }
kernel[0] = size; kernel[0] = size;
for(i = 0; i < size; i++) { for ( i = 0; i < size; i++ ) {
kernel[1 + i] = INT16_MAX / (2.506628275 * deviation) * exp(-((value * value) / (2.0 * (deviation * deviation)))) ; kernel[1 + i] = INT16_MAX / ( 2.506628275 * deviation ) * exp ( -( ( value * value ) / ( 2.0 * ( deviation * deviation ) ) ) );
sum += kernel[1 + i]; sum += kernel[1 + i];
value += 1.0; value += 1.0;
@ -157,45 +158,51 @@ static uint32_t* create_kernel(double radius, double deviation, uint32_t *sum2)
return kernel; return kernel;
} }
void cairo_image_surface_blur(cairo_surface_t* surface, double radius, double deviation) void cairo_image_surface_blur ( cairo_surface_t* surface, double radius, double deviation )
{ {
uint32_t* horzBlur; uint32_t * horzBlur;
uint32_t * kernel = 0; uint32_t * kernel = 0;
cairo_format_t format; cairo_format_t format;
unsigned int channels; unsigned int channels;
if(cairo_surface_status(surface)) return ; if ( cairo_surface_status ( surface ) ) {
return;
}
uint8_t *data = cairo_image_surface_get_data(surface); uint8_t *data = cairo_image_surface_get_data ( surface );
format = cairo_image_surface_get_format(surface); format = cairo_image_surface_get_format ( surface );
const int width = cairo_image_surface_get_width(surface); const int width = cairo_image_surface_get_width ( surface );
const int height = cairo_image_surface_get_height(surface); const int height = cairo_image_surface_get_height ( surface );
const int stride = cairo_image_surface_get_stride(surface); const int stride = cairo_image_surface_get_stride ( surface );
if(format == CAIRO_FORMAT_ARGB32) channels = 4; if ( format == CAIRO_FORMAT_ARGB32 ) {
else return ; channels = 4;
}
else{
return;
}
horzBlur = (uint32_t*)(g_malloc(sizeof(uint32_t) * height * stride)); horzBlur = (uint32_t *) ( g_malloc ( sizeof ( uint32_t ) * height * stride ) );
TICK(); TICK ();
uint32_t sum = 0; uint32_t sum = 0;
kernel = create_kernel(radius, deviation, &sum); kernel = create_kernel ( radius, deviation, &sum );
TICK_N("BLUR: kernel"); TICK_N ( "BLUR: kernel" );
/* Horizontal pass. */ /* Horizontal pass. */
uint32_t *horzBlur_ptr = horzBlur; uint32_t *horzBlur_ptr = horzBlur;
for(int iY = 0; iY < height; iY++) { for ( int iY = 0; iY < height; iY++ ) {
const int iYs = iY*stride; const int iYs = iY * stride;
for(int iX = 0; iX < width; iX++) { for ( int iX = 0; iX < width; iX++ ) {
uint32_t red = 0; uint32_t red = 0;
uint32_t green = 0; uint32_t green = 0;
uint32_t blue = 0; uint32_t blue = 0;
uint32_t alpha = 0; uint32_t alpha = 0;
int offset = (int)(kernel[0]) / -2; int offset = (int) ( kernel[0] ) / -2;
for(int i = 0; i < (int)(kernel[0]); i++) { for ( int i = 0; i < (int) ( kernel[0] ); i++ ) {
int x = iX + offset; int x = iX + offset;
if(x < 0 || x >= width){ if ( x < 0 || x >= width ) {
offset++; offset++;
continue; continue;
} }
@ -210,29 +217,28 @@ void cairo_image_surface_blur(cairo_surface_t* surface, double radius, double de
offset++; offset++;
} }
*horzBlur_ptr++ = blue / sum;
*horzBlur_ptr++ = blue/sum; *horzBlur_ptr++ = green / sum;
*horzBlur_ptr++ = green/sum; *horzBlur_ptr++ = red / sum;
*horzBlur_ptr++ = red/sum; *horzBlur_ptr++ = alpha / sum;
*horzBlur_ptr++ = alpha/sum;
} }
} }
TICK_N("BLUR: hori"); TICK_N ( "BLUR: hori" );
/* Vertical pass. */ /* Vertical pass. */
for(int iY = 0; iY < height; iY++) { for ( int iY = 0; iY < height; iY++ ) {
for(int iX = 0; iX < width; iX++) { for ( int iX = 0; iX < width; iX++ ) {
uint32_t red = 0; uint32_t red = 0;
uint32_t green = 0; uint32_t green = 0;
uint32_t blue = 0; uint32_t blue = 0;
uint32_t alpha = 0; uint32_t alpha = 0;
int offset = (int)(kernel[0]) / -2; int offset = (int) ( kernel[0] ) / -2;
const int iXs = iX*channels; const int iXs = iX * channels;
for(int i = 0; i < (int)(kernel[0]); i++) { for ( int i = 0; i < (int) ( kernel[0] ); i++ ) {
int y = iY + offset; int y = iY + offset;
if(y < 0 || y >= height) { if ( y < 0 || y >= height ) {
offset++; offset++;
continue; continue;
} }
@ -248,23 +254,20 @@ void cairo_image_surface_blur(cairo_surface_t* surface, double radius, double de
offset++; offset++;
} }
*data++ = blue / sum;
*data++ = blue/sum; *data++ = green / sum;
*data++ = green/sum; *data++ = red / sum;
*data++ = red/sum; *data++ = alpha / sum;
*data++ = alpha/sum;
} }
} }
TICK_N("BLUR: vert"); TICK_N ( "BLUR: vert" );
free(kernel); free ( kernel );
free(horzBlur); free ( horzBlur );
return ; return;
} }
cairo_surface_t *x11_helper_get_screenshot_surface_window ( xcb_window_t window, int size ) cairo_surface_t *x11_helper_get_screenshot_surface_window ( xcb_window_t window, int size )
{ {
xcb_get_geometry_cookie_t cookie; xcb_get_geometry_cookie_t cookie;
@ -824,11 +827,11 @@ static int monitor_active_from_id_focused ( int mon_id, workarea *mon )
mon->w = r->width; mon->w = r->width;
mon->h = r->height; mon->h = r->height;
retv = TRUE; retv = TRUE;
if ( (current_window_manager&WM_ROOT_WINDOW_OFFSET) == WM_ROOT_WINDOW_OFFSET ){ if ( ( current_window_manager & WM_ROOT_WINDOW_OFFSET ) == WM_ROOT_WINDOW_OFFSET ) {
mon->x += r->x; mon->x += r->x;
mon->y += r->y; mon->y += r->y;
} }
g_debug("mon pos: %d %d %d-%d", mon->x, mon->y, mon->w, mon->h); g_debug ( "mon pos: %d %d %d-%d", mon->x, mon->y, mon->w, mon->h );
} }
else if ( mon_id == -4 ) { else if ( mon_id == -4 ) {
monitor_dimensions ( t->dst_x, t->dst_y, mon ); monitor_dimensions ( t->dst_x, t->dst_y, mon );
@ -1053,8 +1056,7 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
xcb_client_message_event_t *cme = (xcb_client_message_event_t *) event; xcb_client_message_event_t *cme = (xcb_client_message_event_t *) event;
xcb_atom_t atom = cme->data.data32[0]; xcb_atom_t atom = cme->data.data32[0];
xcb_timestamp_t time = cme->data.data32[1]; xcb_timestamp_t time = cme->data.data32[1];
if ( atom == netatoms[WM_TAKE_FOCUS] ) if ( atom == netatoms[WM_TAKE_FOCUS] ) {
{
xcb_set_input_focus ( xcb->connection, XCB_INPUT_FOCUS_NONE, cme->window, time ); xcb_set_input_focus ( xcb->connection, XCB_INPUT_FOCUS_NONE, cme->window, time );
xcb_flush ( xcb->connection ); xcb_flush ( xcb->connection );
} }
@ -1219,17 +1221,19 @@ void rofi_xcb_set_input_focus ( xcb_window_t w )
g_warning ( "Could not get input focus (error %d), will revert focus to best effort", error->error_code ); g_warning ( "Could not get input focus (error %d), will revert focus to best effort", error->error_code );
free ( error ); free ( error );
xcb->focus_revert = 0; xcb->focus_revert = 0;
} else { }
else {
xcb->focus_revert = freply->focus; xcb->focus_revert = freply->focus;
} }
xcb_set_input_focus ( xcb->connection, XCB_INPUT_FOCUS_POINTER_ROOT, w, XCB_CURRENT_TIME ); xcb_set_input_focus ( xcb->connection, XCB_INPUT_FOCUS_POINTER_ROOT, w, XCB_CURRENT_TIME );
xcb_flush ( xcb->connection ); xcb_flush ( xcb->connection );
} }
void rofi_xcb_revert_input_focus (void) void rofi_xcb_revert_input_focus ( void )
{ {
if ( xcb->focus_revert == 0 ) if ( xcb->focus_revert == 0 ) {
return; return;
}
xcb_set_input_focus ( xcb->connection, XCB_INPUT_FOCUS_POINTER_ROOT, xcb->focus_revert, XCB_CURRENT_TIME ); xcb_set_input_focus ( xcb->connection, XCB_INPUT_FOCUS_POINTER_ROOT, xcb->focus_revert, XCB_CURRENT_TIME );
xcb_flush ( xcb->connection ); xcb_flush ( xcb->connection );
@ -1526,10 +1530,11 @@ static void x11_create_visual_and_colormap ( void )
} }
} }
static void x11_lookup_cursors ( void ) { static void x11_lookup_cursors ( void )
{
xcb_cursor_context_t *ctx; xcb_cursor_context_t *ctx;
if ( xcb_cursor_context_new( xcb->connection, xcb->screen, &ctx ) < 0 ) { if ( xcb_cursor_context_new ( xcb->connection, xcb->screen, &ctx ) < 0 ) {
return; return;
} }

View file

@ -259,7 +259,6 @@ void config_parser_add_option ( XrmOptionType type, const char *key, void **valu
num_extra_options++; num_extra_options++;
} }
/** /**
* Parse an option from the commandline vector. * Parse an option from the commandline vector.
*/ */