mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Cleanups, fix arguments mismatch
This commit is contained in:
parent
dd715fa1ad
commit
fb318f0ff8
10 changed files with 34 additions and 35 deletions
|
@ -208,7 +208,7 @@ unsigned int levenshtein ( const char *needle, const glong needlelen, const char
|
|||
*
|
||||
* @returns the converted UTF-8 string
|
||||
*/
|
||||
char * rofi_force_utf8 ( gchar *data, ssize_t length );
|
||||
char * rofi_force_utf8 ( const gchar *data, ssize_t length );
|
||||
|
||||
/**
|
||||
* @param input the char array holding latin text
|
||||
|
|
|
@ -99,13 +99,13 @@ int mode_init ( Mode *mode );
|
|||
void mode_destroy ( Mode *mode );
|
||||
|
||||
/**
|
||||
* @param sw The mode to query
|
||||
* @param mode The mode to query
|
||||
*
|
||||
* Get the number of entries in the mode.
|
||||
*
|
||||
* @returns an unsigned in with the number of entries.
|
||||
*/
|
||||
unsigned int mode_get_num_entries ( const Mode *sw );
|
||||
unsigned int mode_get_num_entries ( const Mode *mode );
|
||||
|
||||
/**
|
||||
* @param mode The mode to query
|
||||
|
|
|
@ -244,11 +244,11 @@ Property *rofi_theme_property_create ( PropertyType type );
|
|||
void rofi_theme_property_free ( Property *p );
|
||||
|
||||
/**
|
||||
* @param wid
|
||||
* @param widget
|
||||
*
|
||||
* Free the widget and alll children.
|
||||
*/
|
||||
void rofi_theme_free ( ThemeWidget *wid );
|
||||
void rofi_theme_free ( ThemeWidget *widget );
|
||||
|
||||
/**
|
||||
* @param file filename to parse.
|
||||
|
@ -445,10 +445,10 @@ gboolean rofi_theme_is_empty ( void );
|
|||
void rofi_theme_convert_old ( void );
|
||||
|
||||
/**
|
||||
* @param filename File name passed to option.
|
||||
* @param file File name passed to option.
|
||||
*
|
||||
* @returns path to theme or copy of filename if not found.
|
||||
*/
|
||||
char *helper_get_theme_path ( const char *filename );
|
||||
char *helper_get_theme_path ( const char *file );
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -60,14 +60,14 @@ typedef enum
|
|||
/**
|
||||
* @param sw the Mode to show.
|
||||
* @param input A pointer to a string where the inputted data is placed.
|
||||
* @param flags Flags indicating state of the menu.
|
||||
* @param menu_flags Flags indicating state of the menu.
|
||||
* @param finalize the finailze callback
|
||||
*
|
||||
* Main menu callback.
|
||||
*
|
||||
* @returns The command issued (see MenuReturn)
|
||||
*/
|
||||
RofiViewState *rofi_view_create ( Mode *sw, const char *input, MenuFlags flags, void ( *finalize )( RofiViewState * ) );
|
||||
RofiViewState *rofi_view_create ( Mode *sw, const char *input, MenuFlags menu_flags, void ( *finalize )( RofiViewState * ) );
|
||||
|
||||
/**
|
||||
* @param state The Menu Handle
|
||||
|
|
|
@ -168,13 +168,13 @@ void textbox_cursor ( textbox *tb, int pos );
|
|||
|
||||
/**
|
||||
* @param tb Handle to the textbox
|
||||
* @param pos The position to insert the string at
|
||||
* @param char_pos The position to insert the string at
|
||||
* @param str The string to insert.
|
||||
* @param slen The length of the string.
|
||||
*
|
||||
* Insert the string str at position pos.
|
||||
*/
|
||||
void textbox_insert ( textbox *tb, const int pos, const char *str, const int slen );
|
||||
void textbox_insert ( textbox *tb, const int char_pos, const char *str, const int slen );
|
||||
|
||||
/**
|
||||
* Setup the cached fonts. This is required to do
|
||||
|
|
|
@ -98,7 +98,7 @@ void widget_disable ( widget *widget );
|
|||
void widget_enable ( widget *widget );
|
||||
|
||||
/**
|
||||
* @param widget tb Handle to the widget
|
||||
* @param widget widget Handle to the widget
|
||||
* @param d The cairo object used to draw itself.
|
||||
*
|
||||
* Render the textbox.
|
||||
|
@ -110,7 +110,7 @@ void widget_draw ( widget *widget, cairo_t *d );
|
|||
*
|
||||
* Free the widget and all allocated memory.
|
||||
*/
|
||||
void widget_free ( widget *widget );
|
||||
void widget_free ( widget *wid );
|
||||
|
||||
/**
|
||||
* @param widget The widget toresize
|
||||
|
@ -157,12 +157,12 @@ int widget_get_x_pos ( widget *widget );
|
|||
*/
|
||||
void widget_update ( widget *widget );
|
||||
/**
|
||||
* @param widget The widget handle
|
||||
* @param wid The widget handle
|
||||
*
|
||||
* Indicate that the widget needs to be redrawn.
|
||||
* This is done by setting the redraw flag on the toplevel widget.
|
||||
*/
|
||||
void widget_queue_redraw ( widget *widget );
|
||||
void widget_queue_redraw ( widget *wid );
|
||||
/**
|
||||
* @param wid The widget handle
|
||||
*
|
||||
|
|
|
@ -310,7 +310,7 @@ const char ** find_arg_strv ( const char *const key )
|
|||
const char **retv = NULL;
|
||||
int length = 0;
|
||||
for ( int i = 0; i < stored_argc; i++ ) {
|
||||
if ( strcasecmp ( stored_argv[i], key ) == 0 && i < ( stored_argc - 1 ) ) {
|
||||
if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ const char ** find_arg_strv ( const char *const key )
|
|||
retv = g_malloc0 ( ( length + 1 ) * sizeof ( char* ) );
|
||||
int index = 0;
|
||||
for ( int i = 0; i < stored_argc; i++ ) {
|
||||
if ( strcasecmp ( stored_argv[i], key ) == 0 && i < ( stored_argc - 1 ) ) {
|
||||
if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) {
|
||||
retv[index++] = stored_argv[i + 1];
|
||||
}
|
||||
}
|
||||
|
@ -715,17 +715,16 @@ char * rofi_latin_to_utf8_strdup ( const char *input, gssize length )
|
|||
return g_convert_with_fallback ( input, length, "UTF-8", "latin1", "\uFFFD", NULL, &slength, NULL );
|
||||
}
|
||||
|
||||
char * rofi_force_utf8 ( gchar *start, ssize_t length )
|
||||
char * rofi_force_utf8 ( const gchar *data, ssize_t length )
|
||||
{
|
||||
if ( start == NULL ) {
|
||||
if ( data == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
const char *data = start;
|
||||
const char *end;
|
||||
GString *string;
|
||||
|
||||
if ( g_utf8_validate ( data, length, &end ) ) {
|
||||
return g_memdup ( start, length + 1 );
|
||||
return g_memdup ( data, length + 1 );
|
||||
}
|
||||
string = g_string_sized_new ( length + 16 );
|
||||
|
||||
|
|
|
@ -61,13 +61,13 @@ unsigned int mode_get_num_entries ( const Mode *mode )
|
|||
return mode->_get_num_entries ( mode );
|
||||
}
|
||||
|
||||
char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, int *state, GList **list, int get_entry )
|
||||
char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, int *state, GList **attribute_list, int get_entry )
|
||||
{
|
||||
g_assert ( mode != NULL );
|
||||
g_assert ( state != NULL );
|
||||
g_assert ( mode->_get_display_value != NULL );
|
||||
|
||||
return mode->_get_display_value ( mode, selected_line, state, list, get_entry );
|
||||
return mode->_get_display_value ( mode, selected_line, state, attribute_list, get_entry );
|
||||
}
|
||||
|
||||
char * mode_get_completion ( const Mode *mode, unsigned int selected_line )
|
||||
|
|
|
@ -62,7 +62,7 @@ const char *PropertyTypeName[] = {
|
|||
/** Highlight */
|
||||
"Highlight",
|
||||
};
|
||||
void yyerror ( YYLTYPE *ylloc, const char *, const char * );
|
||||
void yyerror ( YYLTYPE *yylloc, const char *, const char * );
|
||||
static gboolean distance_compare ( Distance d, Distance e )
|
||||
{
|
||||
return d.type == e.type && d.distance == e.distance && d.style == e.style;
|
||||
|
|
|
@ -1416,13 +1416,13 @@ static void rofi_view_handle_keypress ( RofiViewState *state, xkb_stuff *xkb, xc
|
|||
}
|
||||
}
|
||||
|
||||
void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *ev, xkb_stuff *xkb )
|
||||
void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *event, xkb_stuff *xkb )
|
||||
{
|
||||
switch ( ev->response_type & ~0x80 )
|
||||
switch ( event->response_type & ~0x80 )
|
||||
{
|
||||
case XCB_CONFIGURE_NOTIFY:
|
||||
{
|
||||
xcb_configure_notify_event_t *xce = (xcb_configure_notify_event_t *) ev;
|
||||
xcb_configure_notify_event_t *xce = (xcb_configure_notify_event_t *) event;
|
||||
if ( xce->window == CacheState.main_window ) {
|
||||
if ( state->x != xce->x || state->y != xce->y ) {
|
||||
state->x = xce->x;
|
||||
|
@ -1454,19 +1454,19 @@ void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *ev, xkb_st
|
|||
if ( config.click_to_exit == TRUE ) {
|
||||
state->mouse_seen = TRUE;
|
||||
}
|
||||
xcb_motion_notify_event_t xme = *( (xcb_motion_notify_event_t *) ev );
|
||||
xcb_motion_notify_event_t xme = *( (xcb_motion_notify_event_t *) event );
|
||||
if ( widget_motion_notify ( WIDGET ( state->main_window ), &xme ) ) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XCB_BUTTON_PRESS:
|
||||
rofi_view_mouse_navigation ( state, (xcb_button_press_event_t *) ev );
|
||||
rofi_view_mouse_navigation ( state, (xcb_button_press_event_t *) event );
|
||||
break;
|
||||
case XCB_BUTTON_RELEASE:
|
||||
if ( config.click_to_exit == TRUE ) {
|
||||
if ( ( CacheState.flags & MENU_NORMAL_WINDOW ) == 0 ) {
|
||||
xcb_button_release_event_t *bre = (xcb_button_release_event_t *) ev;
|
||||
xcb_button_release_event_t *bre = (xcb_button_release_event_t *) event;
|
||||
if ( ( state->mouse_seen == FALSE ) && ( bre->event != CacheState.main_window ) ) {
|
||||
state->quit = TRUE;
|
||||
state->retv = MENU_CANCEL;
|
||||
|
@ -1477,11 +1477,11 @@ void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *ev, xkb_st
|
|||
break;
|
||||
// Paste event.
|
||||
case XCB_SELECTION_NOTIFY:
|
||||
rofi_view_paste ( state, (xcb_selection_notify_event_t *) ev );
|
||||
rofi_view_paste ( state, (xcb_selection_notify_event_t *) event );
|
||||
break;
|
||||
case XCB_KEYMAP_NOTIFY:
|
||||
{
|
||||
xcb_keymap_notify_event_t *kne = (xcb_keymap_notify_event_t *) ev;
|
||||
xcb_keymap_notify_event_t *kne = (xcb_keymap_notify_event_t *) event;
|
||||
guint modstate = x11_get_current_mask ( xkb );
|
||||
for ( gint32 by = 0; by < 31; ++by ) {
|
||||
for ( gint8 bi = 0; bi < 7; ++bi ) {
|
||||
|
@ -1495,11 +1495,11 @@ void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *ev, xkb_st
|
|||
break;
|
||||
}
|
||||
case XCB_KEY_PRESS:
|
||||
rofi_view_handle_keypress ( state, xkb, (xcb_key_press_event_t *) ev );
|
||||
rofi_view_handle_keypress ( state, xkb, (xcb_key_press_event_t *) event );
|
||||
break;
|
||||
case XCB_KEY_RELEASE:
|
||||
{
|
||||
xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) ev;
|
||||
xcb_key_release_event_t *xkre = (xcb_key_release_event_t *) event;
|
||||
unsigned int modstate = x11_canonalize_mask ( xkre->state );
|
||||
if ( modstate == 0 ) {
|
||||
abe_trigger_release ( );
|
||||
|
@ -1515,7 +1515,7 @@ void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *ev, xkb_st
|
|||
}
|
||||
rofi_view_update ( state, TRUE );
|
||||
|
||||
if ( ( ev->response_type & ~0x80 ) == XCB_EXPOSE && CacheState.repaint_source == 0 ) {
|
||||
if ( ( event->response_type & ~0x80 ) == XCB_EXPOSE && CacheState.repaint_source == 0 ) {
|
||||
CacheState.repaint_source = g_idle_add_full ( G_PRIORITY_HIGH_IDLE, rofi_view_repaint, NULL, NULL );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue