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

Constness.

This commit is contained in:
Dave Davenport 2016-08-24 00:39:56 +02:00
parent ad53de507c
commit ef3c773097
9 changed files with 57 additions and 50 deletions

View file

@ -75,6 +75,7 @@ AC_CHECK_FUNC([strtok_r],, AC_MSG_ERROR("Could not find strtok_r"))
AC_CHECK_FUNC([flock],, AC_MSG_ERROR("Could not find flock"))
AC_CHECK_FUNC([ftruncate],,AC_MSG_ERROR("Could not find ftruncate"))
AC_CHECK_FUNC([fcntl],, AC_MSG_ERROR("Could not find fcntl"))
AC_CHECK_FUNC([setlocale],,AC_MSG_ERROR("Could not find setlocale"))
dnl ---------------------------------------------------------------------
dnl Check dependencies

View file

@ -85,6 +85,7 @@ int find_arg_str ( const char * const key, char** val );
*/
int find_arg ( const char * const key );
/**
* @param tokens List of (input) tokens to match.
* @param input The entry to match against.
@ -93,8 +94,7 @@ int find_arg ( const char * const key );
*
* @returns TRUE when matches, FALSE otherwise
*/
int token_match ( GRegex **tokens, const char *input );
int token_match ( GRegex * const *tokens, const char *input );
/**
* @param cmd The command to execute.
*

View file

@ -77,7 +77,7 @@ void scrollbar_draw ( scrollbar *sb, cairo_t *draw );
*
* Calculate the position of the click relative to the max value of bar
*/
unsigned int scrollbar_clicked ( scrollbar *sb, int y );
unsigned int scrollbar_clicked ( const scrollbar *sb, int y );
/**
* @param sb scrollbar object

View file

@ -113,7 +113,7 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action );
* The text should be one insert from a keypress.. the first gunichar is validated to be (or not) control
* return TRUE if inserted
*/
gboolean textbox_append_char ( textbox *tb, char *pad, int pad_len );
gboolean textbox_append_char ( textbox *tb, const char *pad, const int pad_len );
/**
* @param tb Handle to the textbox
@ -138,7 +138,7 @@ void textbox_cursor ( textbox *tb, int pos );
*
* Insert the string str at position pos.
*/
void textbox_insert ( textbox *tb, int pos, char *str, int slen );
void textbox_insert ( textbox *tb, const int pos, const char *str, const int slen );
/**
* Setup the cached fonts. This is required to do
@ -159,7 +159,7 @@ void textbox_cleanup ( void );
*
* @returns the height of the textbox in pixels.
*/
int textbox_get_height ( textbox *tb );
int textbox_get_height ( const textbox *tb );
/**
* @param tb Handle to the textbox
@ -168,7 +168,7 @@ int textbox_get_height ( textbox *tb );
*
* @returns the width of the textbox in pixels.
*/
int textbox_get_width ( textbox *tb );
int textbox_get_width ( const textbox *tb );
/**
* @param tb Handle to the textbox
@ -177,7 +177,7 @@ int textbox_get_width ( textbox *tb );
*
* @returns the height of the string in pixels.
*/
int textbox_get_font_height ( textbox *tb );
int textbox_get_font_height ( const textbox *tb );
/**
* @param tb Handle to the textbox
@ -186,7 +186,7 @@ int textbox_get_font_height ( textbox *tb );
*
* @returns the width of the string in pixels.
*/
int textbox_get_font_width ( textbox *tb );
int textbox_get_font_width ( const textbox *tb );
/**
* Estimate the width of a character.
@ -239,6 +239,11 @@ void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list );
PangoAttrList *textbox_get_pango_attributes ( textbox *tb );
const char *textbox_get_visible_text ( textbox *tb );
/**
* @param tb Handle to the textbox
*
* @returns the visible text.
*/
const char *textbox_get_visible_text ( const textbox *tb );
/*@}*/
#endif //ROFI_TEXTBOX_H

View file

@ -362,13 +362,14 @@ PangoAttrList *token_match_get_pango_attr ( GRegex **tokens, const char *input,
return retv;
}
int token_match ( GRegex **tokens, const char *input )
int token_match ( GRegex * const *tokens, const char *input )
{
int match = 1;
// Do a tokenized match.
if ( tokens ) {
for ( int j = 0; match && tokens[j]; j++ ) {
match = g_regex_match ( (GRegex *) tokens[j], input, 0, NULL );
match = g_regex_match ( (const GRegex *) tokens[j], input, 0, NULL );
}
}
return match;

View file

@ -75,7 +75,7 @@ struct xkb_stuff xkb = {
.compose = {
.table = NULL,
.state = NULL
}
}
};
char *config_path = NULL;
// Array of modi.

View file

@ -107,7 +107,7 @@ void scrollbar_resize ( scrollbar *sb, int w, int h )
}
}
}
unsigned int scrollbar_clicked ( scrollbar *sb, int y )
unsigned int scrollbar_clicked ( const scrollbar *sb, int y )
{
if ( sb != NULL ) {
if ( y >= sb->widget.y && y < ( sb->widget.y + sb->widget.h ) ) {

View file

@ -164,7 +164,7 @@ static void __textbox_update_pango_text ( textbox *tb )
pango_layout_set_text ( tb->layout, tb->text, -1 );
}
}
const char *textbox_get_visible_text ( textbox *tb )
const char *textbox_get_visible_text ( const textbox *tb )
{
return pango_layout_get_text ( tb->layout );
}
@ -464,7 +464,7 @@ void textbox_cursor_end ( textbox *tb )
}
// insert text
void textbox_insert ( textbox *tb, int char_pos, char *str, int slen )
void textbox_insert ( textbox *tb, const int char_pos, const char *str, const int slen )
{
char *c = g_utf8_offset_to_pointer ( tb->text, char_pos );
int pos = c - tb->text;
@ -634,7 +634,7 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action )
}
}
gboolean textbox_append_char ( textbox *tb, char *pad, int pad_len )
gboolean textbox_append_char ( textbox *tb, const char *pad, const int pad_len )
{
if ( !( tb->flags & TB_EDITABLE ) ) {
return FALSE;
@ -712,25 +712,25 @@ void textbox_cleanup ( void )
}
}
int textbox_get_width ( textbox *tb )
int textbox_get_width ( const textbox *tb )
{
unsigned int offset = ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0;
return textbox_get_font_width ( tb ) + 2 * SIDE_MARGIN + offset;
}
int textbox_get_height ( textbox *tb )
int textbox_get_height ( const textbox *tb )
{
return textbox_get_font_height ( tb ) + 2 * SIDE_MARGIN;
}
int textbox_get_font_height ( textbox *tb )
int textbox_get_font_height ( const textbox *tb )
{
int height;
pango_layout_get_pixel_size ( tb->layout, NULL, &height );
return height;
}
int textbox_get_font_width ( textbox *tb )
int textbox_get_font_width ( const textbox *tb )
{
int width;
pango_layout_get_pixel_size ( tb->layout, &width, NULL );