diff options
-rw-r--r-- | include/display.h | 8 | ||||
-rw-r--r-- | include/mode.h | 2 | ||||
-rw-r--r-- | include/theme.h | 33 | ||||
-rw-r--r-- | include/view.h | 4 | ||||
-rw-r--r-- | include/widgets/box.h | 2 | ||||
-rw-r--r-- | include/widgets/container.h | 2 | ||||
-rw-r--r-- | include/widgets/listview.h | 2 | ||||
-rw-r--r-- | include/widgets/scrollbar.h | 2 | ||||
-rw-r--r-- | include/widgets/textbox.h | 2 | ||||
-rw-r--r-- | include/widgets/widget-internal.h | 20 | ||||
-rw-r--r-- | include/widgets/widget.h | 2 | ||||
-rw-r--r-- | include/xcb.h | 2 | ||||
-rw-r--r-- | source/dialogs/drun.c | 56 | ||||
-rw-r--r-- | source/dialogs/run.c | 2 | ||||
-rw-r--r-- | source/dialogs/ssh.c | 2 | ||||
-rw-r--r-- | source/helper.c | 6 | ||||
-rw-r--r-- | source/rofi.c | 4 | ||||
-rw-r--r-- | source/theme.c | 24 | ||||
-rw-r--r-- | source/view.c | 109 | ||||
-rw-r--r-- | source/widgets/box.c | 19 | ||||
-rw-r--r-- | source/widgets/listview.c | 131 | ||||
-rw-r--r-- | source/widgets/textbox.c | 81 | ||||
-rw-r--r-- | source/xcb.c | 10 |
23 files changed, 263 insertions, 262 deletions
diff --git a/include/display.h b/include/display.h index a6977808..bad1210e 100644 --- a/include/display.h +++ b/include/display.h @@ -40,24 +40,24 @@ * * @returns Whether the setup succeeded or not */ -gboolean display_setup(GMainLoop *main_loop, NkBindings *bindings); +gboolean display_setup ( GMainLoop *main_loop, NkBindings *bindings ); /** * Do some late setup of the display backend * * @returns Whether the setup succeeded or not */ -gboolean display_late_setup(void); +gboolean display_late_setup ( void ); /** * Do some early cleanup, like unmapping the surface */ -void display_early_cleanup(void); +void display_early_cleanup ( void ); /** * Cleanup any remaining display related stuff */ -void display_cleanup(void); +void display_cleanup ( void ); /** * Dumps the display layout for -help output diff --git a/include/mode.h b/include/mode.h index 9b013ef3..111a0353 100644 --- a/include/mode.h +++ b/include/mode.h @@ -40,7 +40,7 @@ * Type of a mode. * Access should be done via mode_* functions. */ -typedef struct rofi_mode Mode; +typedef struct rofi_mode Mode; /** * Enum used to sum the possible states of ROFI. diff --git a/include/theme.h b/include/theme.h index 5afa982d..eae2e7e1 100644 --- a/include/theme.h +++ b/include/theme.h @@ -80,11 +80,11 @@ typedef enum typedef struct { /** Distance */ - double distance; + double distance; /** Unit type of the distance */ - RofiPixelUnit type; + RofiPixelUnit type; /** Style of the line (optional)*/ - RofiLineStyle style; + RofiLineStyle style; } RofiDistance; /** @@ -158,22 +158,23 @@ typedef struct /** style to display */ RofiHighlightStyle style; /** Color */ - ThemeColor color; + ThemeColor color; } RofiHighlightColorStyle; -typedef union { +typedef union +{ /** integer */ - int i; + int i; /** Double */ - double f; + double f; /** String */ - char *s; + char *s; /** boolean */ - gboolean b; + gboolean b; /** Color */ - ThemeColor color; + ThemeColor color; /** RofiPadding */ - RofiPadding padding; + RofiPadding padding; /** Reference */ struct { @@ -181,11 +182,11 @@ typedef union { char *name; /** Cached looked up ref */ struct Property *ref; - } link; + } link; /** Highlight Style */ RofiHighlightColorStyle highlight; /** List */ - GList *list; + GList *list; } PropertyValue; /** @@ -194,9 +195,9 @@ typedef union { typedef struct Property { /** Name of property */ - char *name; + char *name; /** Type of property. */ - PropertyType type; + PropertyType type; /** Value */ PropertyValue value; } Property; @@ -463,7 +464,7 @@ ThemeWidget *rofi_theme_find_widget ( const char *name, const char *state, gbool */ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, const char *property, gboolean exact ); -GList *rofi_theme_get_list ( const widget *widget, const char * property, const char *defaults); +GList *rofi_theme_get_list ( const widget *widget, const char * property, const char *defaults ); /** * Checks if a theme is set, or is empty. * @returns TRUE when empty. diff --git a/include/view.h b/include/view.h index fbcfaae7..5a3a0855 100644 --- a/include/view.h +++ b/include/view.h @@ -39,7 +39,7 @@ * * @{ */ -typedef struct RofiViewState RofiViewState; +typedef struct RofiViewState RofiViewState; typedef enum { /** Create a menu for entering text */ @@ -105,7 +105,7 @@ void rofi_view_handle_text ( RofiViewState *state, char *text ); * * Update the state if needed. */ -void rofi_view_handle_mouse_motion( RofiViewState *state, gint x, gint y ); +void rofi_view_handle_mouse_motion ( RofiViewState *state, gint x, gint y ); /** * @param state the Menu handle * diff --git a/include/widgets/box.h b/include/widgets/box.h index 21724b1a..2cf4618a 100644 --- a/include/widgets/box.h +++ b/include/widgets/box.h @@ -45,7 +45,7 @@ /** * Abstract handle to the box widget internal state. */ -typedef struct _box box; +typedef struct _box box; /** * @param name The name of the widget. diff --git a/include/widgets/container.h b/include/widgets/container.h index 60c0b258..e94d50f2 100644 --- a/include/widgets/container.h +++ b/include/widgets/container.h @@ -41,7 +41,7 @@ /** * Abstract handle to the container widget internal state. */ -typedef struct _window container; +typedef struct _window container; /** * @param name The name of the widget. diff --git a/include/widgets/listview.h b/include/widgets/listview.h index 81d705b1..a2fe6989 100644 --- a/include/widgets/listview.h +++ b/include/widgets/listview.h @@ -39,7 +39,7 @@ * Handle to the listview. * No internal fields should be accessed directly. */ -typedef struct _listview listview; +typedef struct _listview listview; /** * The scrolling type used in the list view diff --git a/include/widgets/scrollbar.h b/include/widgets/scrollbar.h index 2806bc3f..6c7af7c8 100644 --- a/include/widgets/scrollbar.h +++ b/include/widgets/scrollbar.h @@ -46,7 +46,7 @@ typedef struct _scrollbar unsigned int length; unsigned int pos; unsigned int pos_length; - RofiDistance width; + RofiDistance width; } scrollbar; /** diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index 9648cbaf..57e92911 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -64,7 +64,7 @@ typedef struct int blink; guint blink_timeout; - double yalign ; + double yalign; PangoFontMetrics *metrics; int left_offset; diff --git a/include/widgets/widget-internal.h b/include/widgets/widget-internal.h index 08c910af..8ae1f823 100644 --- a/include/widgets/widget-internal.h +++ b/include/widgets/widget-internal.h @@ -45,14 +45,14 @@ struct _widget /** Height of the widget */ short h; /** RofiPadding */ - RofiPadding def_margin; - RofiPadding def_padding; - RofiPadding def_border; - RofiPadding def_border_radius; - RofiPadding margin; - RofiPadding padding; - RofiPadding border; - RofiPadding border_radius; + RofiPadding def_margin; + RofiPadding def_padding; + RofiPadding def_border; + RofiPadding def_border_radius; + RofiPadding margin; + RofiPadding padding; + RofiPadding border; + RofiPadding border_radius; /** enabled or not */ gboolean enabled; @@ -78,8 +78,8 @@ struct _widget /** Handle mouse motion, used for dragging */ gboolean ( *motion_notify )( struct _widget *, gint x, gint y ); - int ( *get_desired_height )( struct _widget * ); - int ( *get_desired_width )( struct _widget * ); + int ( *get_desired_height )( struct _widget * ); + int ( *get_desired_width )( struct _widget * ); /** widget find_mouse_target callback */ widget_find_mouse_target_cb find_mouse_target; diff --git a/include/widgets/widget.h b/include/widgets/widget.h index 4fc99cfa..322ef64d 100644 --- a/include/widgets/widget.h +++ b/include/widgets/widget.h @@ -48,7 +48,7 @@ * Abstract structure holding internal state of a widget. * Structure is elaborated in widget-internal.h */ -typedef struct _widget widget; +typedef struct _widget widget; /** * Type of the widget. It is used to bubble events to the relevant widget. diff --git a/include/xcb.h b/include/xcb.h index b1154d58..94f14c3d 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -34,7 +34,7 @@ /** * xcb data structure type declaration. */ -typedef struct _xcb_stuff xcb_stuff; +typedef struct _xcb_stuff xcb_stuff; /** * Global pointer to xcb_stuff instance. diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 12c37185..707bfdc3 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -54,7 +54,6 @@ #define DRUN_CACHE_FILE "rofi2.druncache" - /** * Store extra information about the entry. * Currently the executable and if it should run in terminal. @@ -62,13 +61,13 @@ typedef struct { /* Root */ - char *root; + char *root; /* Path to desktop file */ - char *path; + char *path; /* Application id (.desktop filename) */ - char *app_id; + char *app_id; /* Icon stuff */ - char *icon_name; + char *icon_name; /* Icon size is used to indicate what size is requested by the gui. * secondary it indicates if the request for a lookup has been issued (0 not issued ) */ @@ -97,12 +96,12 @@ typedef struct GHashTable *disabled_entries; unsigned int disabled_entries_length; GThread *thread; - GAsyncQueue *icon_fetch_queue; + GAsyncQueue *icon_fetch_queue; unsigned int expected_line_height; - DRunModeEntry quit_entry; + DRunModeEntry quit_entry; // Theme - const gchar *icon_theme; + const gchar *icon_theme; } DRunModePrivateData; struct RegexEvalArg @@ -194,12 +193,12 @@ static void exec_cmd_entry ( DRunModeEntry *e ) } RofiHelperExecuteContext context = { - .name = e->name, - .icon = e->icon_name, + .name = e->name, + .icon = e->icon_name, .app_id = e->app_id, }; - gboolean sn = g_key_file_get_boolean ( e->key_file, "Desktop Entry", "StartupNotify", NULL ); - gchar *wmclass = NULL; + gboolean sn = g_key_file_get_boolean ( e->key_file, "Desktop Entry", "StartupNotify", NULL ); + gchar *wmclass = NULL; if ( sn && g_key_file_has_key ( e->key_file, "Desktop Entry", "StartupWMClass", NULL ) ) { context.wmclass = wmclass = g_key_file_get_string ( e->key_file, "Desktop Entry", "StartupWMClass", NULL ); } @@ -298,15 +297,15 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c pd->entry_list = g_realloc ( pd->entry_list, pd->cmd_list_length_actual * sizeof ( *( pd->entry_list ) ) ); } pd->entry_list[pd->cmd_list_length].icon_size = 0; - pd->entry_list[pd->cmd_list_length].root = g_strdup ( root ); - pd->entry_list[pd->cmd_list_length].path = g_strdup ( path ); - pd->entry_list[pd->cmd_list_length].app_id = g_strndup ( basename, strlen ( basename ) - strlen ( ".desktop" ) ); + pd->entry_list[pd->cmd_list_length].root = g_strdup ( root ); + pd->entry_list[pd->cmd_list_length].path = g_strdup ( path ); + pd->entry_list[pd->cmd_list_length].app_id = g_strndup ( basename, strlen ( basename ) - strlen ( ".desktop" ) ); gchar *n = g_key_file_get_locale_string ( kf, "Desktop Entry", "Name", NULL, NULL ); pd->entry_list[pd->cmd_list_length].name = n; gchar *gn = g_key_file_get_locale_string ( kf, "Desktop Entry", "GenericName", NULL, NULL ); pd->entry_list[pd->cmd_list_length].generic_name = gn; - pd->entry_list[pd->cmd_list_length].categories = g_key_file_get_locale_string_list ( kf, "Desktop Entry", "Categories", NULL, NULL, NULL ); - pd->entry_list[pd->cmd_list_length].exec = g_key_file_get_string ( kf, "Desktop Entry", "Exec", NULL ); + pd->entry_list[pd->cmd_list_length].categories = g_key_file_get_locale_string_list ( kf, "Desktop Entry", "Categories", NULL, NULL, NULL ); + pd->entry_list[pd->cmd_list_length].exec = g_key_file_get_string ( kf, "Desktop Entry", "Exec", NULL ); if ( config.show_icons ) { pd->entry_list[pd->cmd_list_length].icon_name = g_key_file_get_locale_string ( kf, "Desktop Entry", "Icon", NULL, NULL ); @@ -435,16 +434,16 @@ static void get_apps ( DRunModePrivateData *pd ) TICK_N ( "Get Desktop apps (user dir)" ); // Then read thee system data dirs. const gchar * const * sys = g_get_system_data_dirs (); - for (const gchar * const *iter = sys ; *iter != NULL; ++iter ) { + for ( const gchar * const *iter = sys; *iter != NULL; ++iter ) { gboolean unique = TRUE; // Stupid duplicate detection, better then walking dir. - for ( const gchar *const *iterd = sys ; iterd != iter; ++iterd ){ + for ( const gchar *const *iterd = sys; iterd != iter; ++iterd ) { if ( g_strcmp0 ( *iter, *iterd ) == 0 ) { unique = FALSE; } } // Check, we seem to be getting empty string... - if ( unique && (**iter) != '\0') { + if ( unique && ( **iter ) != '\0' ) { dir = g_build_filename ( *iter, "applications", NULL ); walk_dir ( pd, dir, dir ); g_free ( dir ); @@ -459,9 +458,8 @@ static gpointer drun_icon_fetch ( gpointer data ) // as long as dr->icon is updated atomicly.. (is a pointer write atomic?) // this should be fine running in another thread. DRunModePrivateData *pd = (DRunModePrivateData *) data; - DRunModeEntry *dr; - while ( ( dr = g_async_queue_pop ( pd->icon_fetch_queue )) != &(pd->quit_entry) ) - { + DRunModeEntry *dr; + while ( ( dr = g_async_queue_pop ( pd->icon_fetch_queue ) ) != &( pd->quit_entry ) ) { if ( dr->icon_name == NULL ) { continue; } @@ -478,7 +476,7 @@ static gpointer drun_icon_fetch ( gpointer data ) icon_surf = cairo_image_surface_create_from_png ( icon_path ); } else if ( g_str_has_suffix ( icon_path, ".svg" ) ) { - icon_surf = cairo_image_surface_create_from_svg ( icon_path, dr->icon_size); + icon_surf = cairo_image_surface_create_from_svg ( icon_path, dr->icon_size ); } else { g_debug ( "Icon type not yet supported: %s", icon_path ); @@ -488,7 +486,7 @@ static gpointer drun_icon_fetch ( gpointer data ) if ( cairo_surface_status ( icon_surf ) != CAIRO_STATUS_SUCCESS ) { g_debug ( "Icon failed to open: %s(%d): %s", dr->icon_name, dr->icon_size, icon_path ); cairo_surface_destroy ( icon_surf ); - icon_surf = NULL; + icon_surf = NULL; } dr->icon = icon_surf; } @@ -556,7 +554,7 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i if ( rmpd->thread ) { g_async_queue_lock ( rmpd->icon_fetch_queue ); DRunModeEntry *dr; - while ( (dr = g_async_queue_try_pop_unlocked ( rmpd->icon_fetch_queue )) != NULL ){ + while ( ( dr = g_async_queue_try_pop_unlocked ( rmpd->icon_fetch_queue ) ) != NULL ) { // Reset for possible re-fetch. dr->icon_size = 0; } @@ -578,9 +576,11 @@ static void drun_mode_destroy ( Mode *sw ) if ( rmpd != NULL ) { if ( rmpd->thread ) { g_async_queue_lock ( rmpd->icon_fetch_queue ); - while ( g_async_queue_try_pop_unlocked ( rmpd->icon_fetch_queue ) ); + while ( g_async_queue_try_pop_unlocked ( rmpd->icon_fetch_queue ) ) { + ; + } // Make the thread quit. - g_async_queue_push_unlocked ( rmpd->icon_fetch_queue, (gpointer) &(rmpd->quit_entry)); + g_async_queue_push_unlocked ( rmpd->icon_fetch_queue, ( gpointer ) & ( rmpd->quit_entry ) ); g_async_queue_unlock ( rmpd->icon_fetch_queue ); g_thread_join ( rmpd->thread ); rmpd->thread = NULL; diff --git a/source/dialogs/run.c b/source/dialogs/run.c index 8b20c290..1d482f04 100644 --- a/source/dialogs/run.c +++ b/source/dialogs/run.c @@ -91,7 +91,7 @@ static void exec_cmd ( const char *cmd, int run_in_term ) return; } - char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL ); + char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL ); RofiHelperExecuteContext context = { .name = NULL }; // FIXME: assume startup notification support for terminals if ( helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) { diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index ccba8eb9..1aa0da0d 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -201,7 +201,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length ) // Reading one line per time. while ( getline ( &buffer, &buffer_length, fd ) > 0 ) { // Evaluate one line. - unsigned int index = 0, ti = 0; + unsigned int index = 0, ti = 0; char *token = buffer; // Tokenize it. diff --git a/source/helper.c b/source/helper.c index 33180096..76835538 100644 --- a/source/helper.c +++ b/source/helper.c @@ -257,7 +257,7 @@ GRegex **tokenize ( const char *input, int case_sensitive ) } char *saveptr = NULL, *token; - GRegex **retv = NULL; + GRegex **retv = NULL; if ( !config.tokenize ) { retv = g_malloc0 ( sizeof ( GRegex* ) * 2 ); retv[0] = (GRegex *) create_regex ( input, case_sensitive ); @@ -896,8 +896,8 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st // uleft: value of the upper left cell; ulefts: maximum value of uleft and cells on the left. The arbitrary initial // values suppress warnings. int uleft = 0, ulefts = 0, left, lefts; - const gchar *pit = pattern, *sit; - enum CharClass prev = NON_WORD; + const gchar *pit = pattern, *sit; + enum CharClass prev = NON_WORD; for ( si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char ( sit ) ) { enum CharClass cur = rofi_scorer_get_character_class ( g_utf8_get_char ( sit ) ); score[si] = rofi_scorer_get_score_for ( prev, cur ); diff --git a/source/rofi.c b/source/rofi.c index 18eb01a5..07639164 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -95,10 +95,10 @@ unsigned int num_modi = 0; /** Current selected mode */ unsigned int curr_switcher = 0; -NkBindings *bindings = NULL; +NkBindings *bindings = NULL; /** Glib main loop. */ -GMainLoop *main_loop = NULL; +GMainLoop *main_loop = NULL; /** Flag indicating we are in dmenu mode. */ static int dmenu_mode = FALSE; diff --git a/source/theme.c b/source/theme.c index f4f41003..3cc64a29 100644 --- a/source/theme.c +++ b/source/theme.c @@ -386,7 +386,8 @@ static ThemeWidget *rofi_theme_find ( ThemeWidget *widget, const char *name, con if ( f != widget ) { widget = f; found = TRUE; - } else if ( exact ) { + } + else if ( exact ) { break; } } @@ -505,7 +506,7 @@ int rofi_theme_get_integer_exact ( const widget *widget, const char *property, i g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property ); return def; } -static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char *property, int def , gboolean exact) +static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char *property, int def, gboolean exact ) { ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, exact ); Property *p = rofi_theme_find_property ( wid, P_PADDING, property, exact ); @@ -521,14 +522,13 @@ static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char return (RofiDistance){ def, ROFI_PU_PX, ROFI_HL_SOLID }; } - RofiDistance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def ) { - return _rofi_theme_get_distance ( widget, property, def , TRUE ); + return _rofi_theme_get_distance ( widget, property, def, TRUE ); } RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def ) { - return _rofi_theme_get_distance ( widget, property, def , FALSE); + return _rofi_theme_get_distance ( widget, property, def, FALSE ); } int rofi_theme_get_boolean ( const widget *widget, const char *property, int def ) @@ -608,19 +608,19 @@ RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property, GList *rofi_theme_get_list ( const widget *widget, const char * property, const char *defaults ) { ThemeWidget *wid2 = rofi_theme_find_widget ( widget->name, widget->state, TRUE ); - Property *p = rofi_theme_find_property ( wid2, P_LIST, property, TRUE); + Property *p = rofi_theme_find_property ( wid2, P_LIST, property, TRUE ); if ( p ) { - if ( p->type == P_LIST ){ + if ( p->type == P_LIST ) { return g_list_copy_deep ( p->value.list, g_strdup, NULL ); } } - char **r = defaults?g_strsplit (defaults, ",",0):NULL; - if ( r ){ + char **r = defaults ? g_strsplit ( defaults, ",", 0 ) : NULL; + if ( r ) { GList *l = NULL; - for ( int i =0; r[i] != NULL; i++){ - l = g_list_append(l, r[i]); + for ( int i = 0; r[i] != NULL; i++ ) { + l = g_list_append ( l, r[i] ); } - g_free(r); + g_free ( r ); return l; } return NULL; diff --git a/source/view.c b/source/view.c index ef31c738..04c53130 100644 --- a/source/view.c +++ b/source/view.c @@ -652,9 +652,9 @@ void __create_window ( MenuFlags menu_flags ) }; xcb_window_t box_window = xcb_generate_id ( xcb->connection ); - xcb_void_cookie_t cc = xcb_create_window_checked ( xcb->connection, depth->depth, box_window, xcb_stuff_get_root_window ( ), - 0, 0, 200, 100, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, - visual->visual_id, selmask, selval ); + xcb_void_cookie_t cc = xcb_create_window_checked ( xcb->connection, depth->depth, box_window, xcb_stuff_get_root_window ( ), + 0, 0, 200, 100, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, + visual->visual_id, selmask, selval ); xcb_generic_error_t *error; error = xcb_request_check ( xcb->connection, cc ); if ( error ) { @@ -709,7 +709,7 @@ void __create_window ( MenuFlags menu_flags ) } // Setup font. // Dummy widget. - box *win = box_create ( "window.box_window", ROFI_ORIENTATION_HORIZONTAL); + box *win = box_create ( "window.box_window", ROFI_ORIENTATION_HORIZONTAL ); const char *font = rofi_theme_get_string ( WIDGET ( win ), "font", config.menu_font ); if ( font ) { PangoFontDescription *pfd = pango_font_description_from_string ( font ); @@ -1325,7 +1325,7 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, g case SCOPE_MOUSE_SCROLLBAR: case SCOPE_MOUSE_SIDEBAR_MODI: { - gint x = state->mouse.x, y = state->mouse.y; + gint x = state->mouse.x, y = state->mouse.y; widget *target = widget_find_mouse_target ( WIDGET ( state->main_window ), scope, x, y ); if ( target == NULL ) { return FALSE; @@ -1355,7 +1355,7 @@ void rofi_view_handle_text ( RofiViewState *state, char *text ) } } -void rofi_view_handle_mouse_motion( RofiViewState *state, gint x, gint y ) +void rofi_view_handle_mouse_motion ( RofiViewState *state, gint x, gint y ) { state->mouse.x = x; state->mouse.y = y; @@ -1372,7 +1372,7 @@ void rofi_view_maybe_update ( RofiViewState *state ) rofi_view_finalize ( state ); // cleanup if ( rofi_view_get_active () == NULL ) { - rofi_quit_main_loop(); + rofi_quit_main_loop (); return; } } @@ -1484,78 +1484,77 @@ static void rofi_view_listview_mouse_activated_cb ( listview *lv, gboolean custo state->skip_absorb = TRUE; } - static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, const char *parent, const char *name ) { - char *defaults = NULL; - widget *wid = NULL; - char *str= g_strjoin ( "." , parent, name, NULL ); - char *strbox= g_strjoin ( "." , str, "box",NULL ); + char *defaults = NULL; + widget *wid = NULL; + char *str = g_strjoin ( ".", parent, name, NULL ); + char *strbox = g_strjoin ( ".", str, "box", NULL ); /** * MAINBOX */ - if ( strcmp ( name, "mainbox") == 0 ){ - wid = (widget *)box_create ( strbox, ROFI_ORIENTATION_VERTICAL ); - box_add ( (box *)parent_widget, WIDGET ( wid ), TRUE ); + if ( strcmp ( name, "mainbox" ) == 0 ) { + wid = (widget *) box_create ( strbox, ROFI_ORIENTATION_VERTICAL ); + box_add ( (box *) parent_widget, WIDGET ( wid ), TRUE ); defaults = "inputbar,message,listview,sidebar"; } /** * INPUTBAR */ - else if ( strcmp ( name, "inputbar" ) == 0 ){ - wid = (widget *)box_create ( strbox, ROFI_ORIENTATION_HORIZONTAL ); + else if ( strcmp ( name, "inputbar" ) == 0 ) { + wid = (widget *) box_create ( strbox, ROFI_ORIENTATION_HORIZONTAL ); defaults = "prompt,entry,case-indicator"; - box_add ( (box *)parent_widget, WIDGET ( wid ), FALSE ); + box_add ( (box *) parent_widget, WIDGET ( wid ), FALSE ); } /** * PROMPT */ - else if ( strcmp ( name, "prompt" ) == 0 ){ + else if ( strcmp ( name, "prompt" ) == 0 ) { // Prompt box. state->prompt = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, str, TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "" ); rofi_view_update_prompt ( state ); - box_add ( (box *)parent_widget, WIDGET ( state->prompt ), FALSE ); + box_add ( (box *) parent_widget, WIDGET ( state->prompt ), FALSE ); defaults = NULL; } /** * CASE INDICATOR */ - else if ( strcmp ( name, "case-indicator") == 0 ){ + else if ( strcmp ( name, "case-indicator" ) == 0 ) { state->case_indicator = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, str, TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "*" ); // Add small separator between case indicator and text box. - box_add ( (box *)parent_widget, WIDGET ( state->case_indicator ), FALSE ); + box_add ( (box *) parent_widget, WIDGET ( state->case_indicator ), FALSE ); textbox_text ( state->case_indicator, get_matching_state () ); } /** * ENTRY BOX */ - else if ( strcmp ( name, "entry" ) == 0 ){ + else if ( strcmp ( name, "entry" ) == 0 ) { // Entry box TextboxFlags tfl = TB_EDITABLE; tfl |= ( ( state->menu_flags & MENU_PASSWORD ) == MENU_PASSWORD ) ? TB_PASSWORD : 0; - state->text = textbox_create ( WIDGET_TYPE_EDITBOX, str, tfl | TB_AUTOHEIGHT, NORMAL, NULL); - box_add ( (box*)parent_widget, WIDGET ( state->text ), TRUE ); + state->text = textbox_create ( WIDGET_TYPE_EDITBOX, str, tfl | TB_AUTOHEIGHT, NORMAL, NULL ); + box_add ( (box *) parent_widget, WIDGET ( state->text ), TRUE ); } /** * MESSAGE */ - else if ( strcmp ( name, "message") == 0 ){ - char *strmsg= g_strjoin ( "." , str, "textbox",NULL ); + else if ( strcmp ( name, "message" ) == 0 ) { + char *strmsg = g_strjoin ( ".", str, "textbox", NULL ); state->mesg_box = container_create ( strbox ); state->mesg_tb = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, strmsg, TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, NORMAL, NULL ); container_add ( state->mesg_box, WIDGET ( state->mesg_tb ) ); rofi_view_reload_message_bar ( state ); - box_add ( (box*)parent_widget, WIDGET ( state->mesg_box ), FALSE ); - g_free(strmsg); + box_add ( (box *) parent_widget, WIDGET ( state->mesg_box ), FALSE ); + g_free ( strmsg ); } /** * LISTVIEW */ else if ( strcmp ( name, "listview" ) == 0 ) { - state->list_view = listview_create ( str, update_callback, state, config.element_height, 0); - box_add ( (box*)parent_widget, WIDGET ( state->list_view ), TRUE ); + state->list_view = listview_create ( str, update_callback, state, config.element_height, 0 ); + box_add ( (box *) parent_widget, WIDGET ( state->list_view ), TRUE ); // Set configuration listview_set_multi_select ( state->list_view, ( state->menu_flags & MENU_INDICATOR ) == MENU_INDICATOR ); listview_set_scroll_type ( state->list_view, config.scroll_method ); @@ -1568,39 +1567,41 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, /** * SIDEBAR */ - else if ( strcmp( name, "sidebar" ) == 0 ) { - if ( config.sidebar_mode ){ + else if ( strcmp ( name, "sidebar" ) == 0 ) { + if ( config.sidebar_mode ) { state->sidebar_bar = box_create ( strbox, ROFI_ORIENTATION_HORIZONTAL ); - box_add ( (box* |