1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-03 15:34:54 -05:00

Indent magic, rework makefile so lexer and yacc file are not passed.

This commit is contained in:
Dave Davenport 2017-01-08 21:36:06 +01:00
parent 8c0c43952d
commit baab2047ad
25 changed files with 834 additions and 809 deletions

View file

@ -27,7 +27,7 @@ dist_bin_SCRIPTS=\
nodist_rofi_SOURCES=\
$(top_builddir)/gitconfig.h
rofi_SOURCES=\
SOURCES=\
source/rofi.c\
source/view.c\
source/mode.c\
@ -53,8 +53,6 @@ rofi_SOURCES=\
source/dialogs/window.c\
source/dialogs/script.c\
source/dialogs/help-keys.c\
lexer/theme-parser.y\
lexer/theme-lexer.l\
include/xcb.h\
include/xcb-internal.h\
include/rofi.h\
@ -89,6 +87,11 @@ rofi_SOURCES=\
include/xkb.h\
include/xkb-internal.h
rofi_SOURCES=\
lexer/theme-parser.y\
lexer/theme-lexer.l\
$(SOURCES)
rofi_CFLAGS=\
$(AM_CFLAGS)\
$(glib_CFLAGS)\
@ -448,7 +451,7 @@ test-x1: $(bin_PROGRAMS)
.PHONY: indent
indent: $(rofi_SOURCES) $(helper_test_SOURCES) $(textbox_test_SOURCES) $(history_test_SOURCES) $(helper_expand_SOURCES)
indent: $(SOURCES)
uncrustify -c $(top_srcdir)/data/uncrustify.cfg --replace $^
.PHONY: cppcheck

View file

@ -6,7 +6,8 @@
#include <settings.h>
/** Style of line */
typedef enum {
typedef enum
{
/** Solid line */
SOLID,
/** Dashed line */
@ -16,7 +17,8 @@ typedef enum {
/**
* Distance unit type.
*/
typedef enum {
typedef enum
{
/** PixelWidth in pixels. */
PW_PX,
/** PixelWidth in EM. */
@ -28,7 +30,8 @@ typedef enum {
/**
* Structure representing a distance.
*/
typedef struct {
typedef struct
{
/** Distance */
double distance;
/** Unit type of the distance */
@ -40,14 +43,16 @@ typedef struct {
/**
* Type of orientation.
*/
typedef enum {
typedef enum
{
ORIENTATION_VERTICAL,
ORIENTATION_HORIZONTAL
} Orientation;
/**
* Type of property
*/
typedef enum {
typedef enum
{
/** Integer */
P_INTEGER,
/** Double */
@ -95,13 +100,15 @@ typedef struct
/**
* Property structure.
*/
typedef struct Property {
typedef struct Property
{
/** Name of property */
char *name;
/** Type of property. */
PropertyType type;
/** Value */
union {
union
{
/** integer */
int i;
/** Double */
@ -115,7 +122,8 @@ typedef struct Property {
/** Padding */
Padding padding;
/** Reference */
struct {
struct
{
/** Name */
char *name;
/** Cached looked up ref */
@ -126,7 +134,8 @@ typedef struct Property {
/**
* ThemeWidget.
*/
typedef struct ThemeWidget {
typedef struct ThemeWidget
{
int set;
char *name;
@ -138,7 +147,6 @@ typedef struct ThemeWidget {
struct ThemeWidget *parent;
} ThemeWidget;
/**
* Global pointer to the current active theme.
*/

View file

@ -111,7 +111,6 @@ unsigned int rofi_view_get_selected_line ( const RofiViewState *state );
*/
void rofi_view_restart ( RofiViewState *state );
/**
* @param state The handle to the view
* @param action The keyboard action

View file

@ -174,7 +174,6 @@ void widget_set_clicked_handler ( widget *wid, widget_clicked_cb cb, void *udata
*/
gboolean widget_motion_notify ( widget *wid, xcb_motion_notify_event_t *xme );
/**
* @param wid The widget handle
* @param name The name of the widget.

View file

@ -137,7 +137,8 @@ static void async_read_callback ( GObject *source_object, GAsyncResult *res, gpo
g_data_input_stream_read_upto_async ( pd->data_input_stream, &( pd->separator ), 1, G_PRIORITY_LOW, pd->cancel,
async_read_callback, pd );
return;
} else {
}
else {
GError *error = NULL;
// Absorb separator, already in buffer so should not block.
// If error == NULL end of stream..
@ -150,7 +151,8 @@ static void async_read_callback ( GObject *source_object, GAsyncResult *res, gpo
g_data_input_stream_read_upto_async ( pd->data_input_stream, &( pd->separator ), 1, G_PRIORITY_LOW, pd->cancel,
async_read_callback, pd );
return;
} else {
}
else {
g_error_free ( error );
}
}

View file

@ -405,7 +405,6 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
g_free ( i3_socket_path );
}
// Create cache
x11_cache_create ();
@ -495,8 +494,8 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
else {
c->wmdesktopstr = g_strdup ( "Invalid name" );
}
} else {
}
else {
c->wmdesktopstr = g_strdup ( _window_name_list_entry ( names.strings, names.strings_len, c->wmdesktop ) );
}
}

View file

@ -185,7 +185,9 @@ static gchar *fuzzy_to_regex ( const char * input )
g_string_append_c ( str, '\\' );
iter = g_utf8_next_char ( iter );
// If EOL, break out of for loop.
if ( (*iter) == '\0' ) break;
if ( ( *iter ) == '\0' ) {
break;
}
}
g_string_append_unichar ( str, g_utf8_get_char ( iter ) );
g_string_append ( str, ")" );

View file

@ -308,7 +308,8 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
printf ( " %s#rofi @ freenode.net%s\n", is_term ? color_bold : "", is_term ? color_reset : "" );
if ( find_arg ( "-no-config" ) < 0 ) {
printf ( " Configuration file: %s%s%s\n", is_term ? color_bold : "", config_path, is_term ? color_reset : "" );
} else {
}
else {
printf ( " Configuration file: %sDisabled%s\n", is_term ? color_bold : "", is_term ? color_reset : "" );
}
}
@ -489,7 +490,8 @@ static inline void load_configuration_dynamic ( )
/**
* Process X11 events in the main-loop (gui-thread) of the application.
*/
static void main_loop_x11_event_handler_view ( xcb_generic_event_t *ev){
static void main_loop_x11_event_handler_view ( xcb_generic_event_t *ev )
{
RofiViewState *state = rofi_view_get_active ();
if ( state != NULL ) {
rofi_view_itterrate ( state, ev, &xkb );
@ -636,7 +638,8 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
if ( !take_pointer ( xcb_stuff_get_root_window ( xcb ), 0 ) ) {
g_timeout_add ( 1, lazy_grab_pointer, NULL );
}
} else {
}
else {
if ( !take_keyboard ( xcb_stuff_get_root_window ( xcb ), 500 ) ) {
fprintf ( stderr, "Failed to grab keyboard, even after %d uS.", 500 * 1000 );
g_main_loop_quit ( main_loop );
@ -645,7 +648,6 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
if ( !take_pointer ( xcb_stuff_get_root_window ( xcb ), 100 ) ) {
fprintf ( stderr, "Failed to grab mouse pointer, even after %d uS.", 100 * 1000 );
}
}
}
TICK_N ( "Grab keyboard" );
@ -949,7 +951,8 @@ int main ( int argc, char *argv[] )
TICK_N ( "Parse theme" );
rofi_theme_parse_file ( config.theme );
TICK_N ( "Parsed theme" );
} else {
}
else {
rofi_theme_convert_old_theme ( );
}
@ -964,8 +967,6 @@ int main ( int argc, char *argv[] )
g_free ( theme_str );
}
if ( find_arg ( "-dump-theme" ) >= 0 ) {
rofi_theme_print ( rofi_theme );
exit ( EXIT_SUCCESS );

View file

@ -15,7 +15,7 @@
void yyerror ( YYLTYPE *ylloc, const char * );
static gboolean distance_compare ( Distance d, Distance e )
{
return ( d.type == e.type && d.distance == e.distance && d.style == e.style );
return d.type == e.type && d.distance == e.distance && d.style == e.style;
}
ThemeWidget *rofi_theme_find_or_create_name ( ThemeWidget *base, const char *name )
@ -51,7 +51,8 @@ void rofi_theme_property_free ( Property *p )
g_free ( p->name );
if ( p->type == P_STRING ) {
g_free ( p->value.s );
} else if ( p->type == P_LINK ) {
}
else if ( p->type == P_LINK ) {
g_free ( p->value.link.name );
}
g_free ( p );
@ -80,9 +81,11 @@ static void rofi_theme_print_distance ( Distance d )
{
if ( d.type == PW_PX ) {
printf ( "%upx ", (int) d.distance );
} else if ( d.type == PW_PERCENT ) {
}
else if ( d.type == PW_PERCENT ) {
printf ( "%f%% ", d.distance );
} else {
}
else {
printf ( "%fem ", d.distance );
}
if ( d.style == DASH ) {
@ -135,16 +138,19 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
distance_compare ( p->value.padding.left, p->value.padding.right ) &&
distance_compare ( p->value.padding.left, p->value.padding.top ) ) {
rofi_theme_print_distance ( p->value.padding.left );
} else if ( distance_compare ( p->value.padding.top, p->value.padding.bottom) &&
}
else if ( distance_compare ( p->value.padding.top, p->value.padding.bottom ) &&
distance_compare ( p->value.padding.left, p->value.padding.right ) ) {
rofi_theme_print_distance ( p->value.padding.top );
rofi_theme_print_distance ( p->value.padding.left );
} else if ( !distance_compare ( p->value.padding.top, p->value.padding.bottom) &&
}
else if ( !distance_compare ( p->value.padding.top, p->value.padding.bottom ) &&
distance_compare ( p->value.padding.left, p->value.padding.right ) ) {
rofi_theme_print_distance ( p->value.padding.top );
rofi_theme_print_distance ( p->value.padding.left );
rofi_theme_print_distance ( p->value.padding.bottom );
} else {
}
else {
rofi_theme_print_distance ( p->value.padding.top );
rofi_theme_print_distance ( p->value.padding.right );
rofi_theme_print_distance ( p->value.padding.bottom );
@ -187,20 +193,19 @@ static void rofi_theme_print_index ( ThemeWidget *widget )
}
}
printf ( " {\n" );
} else {
}
else {
index = 4;
printf ( "* {\n" );
}
size_t property_name_length = 0;
g_hash_table_iter_init ( &iter, widget->properties );
while (g_hash_table_iter_next (&iter, &key, &value))
{
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
Property *p = (Property *) value;
property_name_length = MAX ( strlen ( p->name ), property_name_length );
}
g_hash_table_iter_init ( &iter, widget->properties );
while (g_hash_table_iter_next (&iter, &key, &value))
{
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
Property *p = (Property *) value;
rofi_theme_print_property_index ( property_name_length, index, p );
}
@ -237,7 +242,8 @@ extern FILE* yyin;
*
* Error handler for the lex parser.
*/
void yyerror(YYLTYPE *yylloc, const char* s) {
void yyerror ( YYLTYPE *yylloc, const char* s )
{
fprintf ( stderr, "Parse error: %s\n", s );
fprintf ( stderr, "From line %d column %d to line %d column %d\n", yylloc->first_line, yylloc->first_column, yylloc->last_line, yylloc->last_column );
exit ( EXIT_FAILURE );
@ -262,7 +268,6 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
g_hash_table_destroy ( table );
}
/**
* Public API
*/
@ -295,7 +300,8 @@ static ThemeWidget *rofi_theme_find ( ThemeWidget *widget , const char *name, co
g_strfreev ( names );
if ( !exact || found ) {
return widget;
} else {
}
else {
return NULL;
}
}
@ -320,7 +326,8 @@ static void rofi_theme_resolve_link_property ( Property *p, int depth )
p->value.link.ref = pr->value.link.ref;
return;
}
} else {
}
else {
p->value.link.ref = pr;
return;
}
@ -407,7 +414,8 @@ Distance rofi_theme_get_distance ( const widget *widget, const char *property, i
if ( p ) {
if ( p->type == P_INTEGER ) {
return (Distance){ p->value.i, PW_PX, SOLID };
} else {
}
else {
return p->value.padding.left;
}
}
@ -457,7 +465,8 @@ void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t
p->value.color.blue,
p->value.color.alpha
);
} else {
}
else {
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
}
}
@ -468,7 +477,8 @@ Padding rofi_theme_get_padding ( const widget *widget, const char *property, Pad
if ( p ) {
if ( p->type == P_PADDING ) {
pad = p->value.padding;
} else {
}
else {
Distance d = (Distance){ p->value.i, PW_PX, SOLID };
return (Padding){ d, d, d, d };
}
@ -480,16 +490,17 @@ int distance_get_pixel ( Distance d, Orientation ori )
{
if ( d.type == PW_EM ) {
return d.distance * textbox_get_estimated_char_height ();
} else if ( d.type == PW_PERCENT ) {
}
else if ( d.type == PW_PERCENT ) {
if ( ori == ORIENTATION_VERTICAL ) {
int height = 0;
rofi_view_get_current_monitor ( NULL, &height );
return ( d.distance * height ) / ( 100.0 );
} else {
}
else {
int width = 0;
rofi_view_get_current_monitor ( &width, NULL );
return ( d.distance * width ) / ( 100.0 );
}
}
return d.distance;
@ -500,7 +511,8 @@ void distance_get_linestyle ( Distance d, cairo_t *draw )
if ( d.style == DASH ) {
const double dashes[1] = { 4 };
cairo_set_dash ( draw, dashes, 1, 0.0 );
} else {
}
else {
cairo_set_dash ( draw, NULL, 0, 0.0 );
}
}
@ -584,7 +596,6 @@ void rofi_theme_convert_old_theme ( void )
p->value.i = 0;
g_hash_table_replace ( inputbar_widget->properties, p->name, p );
LineStyle style = ( g_strcmp0 ( config.separator_style, "dash" ) == 0 ) ? DASH : SOLID;
int place_end = ( config.location == WL_SOUTH_EAST || config.location == WL_SOUTH || config.location == WL_SOUTH_WEST );
p = rofi_theme_property_create ( P_PADDING );
@ -592,18 +603,19 @@ void rofi_theme_convert_old_theme ( void )
Distance d = (Distance){ config.menu_bw, PW_PX, style };
if ( place_end ) {
p->value.padding.bottom = d;
} else {
}
else {
p->value.padding.top = d;
}
g_hash_table_replace ( listview_widget->properties, p->name, p );
p = rofi_theme_property_create ( P_PADDING );
p->name = g_strdup ( "border" );
d = (Distance){ config.menu_bw, PW_PX, style };
if ( place_end ) {
p->value.padding.bottom = d;
} else {
}
else {
p->value.padding.top = d;
}
g_hash_table_replace ( message_box->properties, p->name, p );
@ -622,7 +634,8 @@ void rofi_theme_convert_old_theme ( void )
d = (Distance){ config.line_margin, PW_PX, SOLID };
if ( place_end ) {
p->value.padding.bottom = d;
} else {
}
else {
p->value.padding.top = d;
}
g_hash_table_replace ( listview_widget->properties, p->name, p );
@ -632,11 +645,11 @@ void rofi_theme_convert_old_theme ( void )
d = (Distance){ config.line_margin, PW_PX, SOLID };
if ( place_end ) {
p->value.padding.bottom = d;
} else {
}
else {
p->value.padding.top = d;
}
g_hash_table_replace ( message_box->properties, p->name, p );
}
{
Property *p = rofi_theme_property_create ( P_INTEGER );
@ -679,12 +692,12 @@ void rofi_theme_convert_old_theme ( void )
if ( vals[2] != NULL ) {
p = rofi_theme_convert_get_color ( vals[2], "foreground" );
g_hash_table_replace ( window_widget->properties, p->name, p );
} else {
}
else {
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
g_hash_table_replace ( window_widget->properties, p->name, p );
}
}
}
}
g_strfreev ( vals );
@ -693,7 +706,6 @@ void rofi_theme_convert_old_theme ( void )
ThemeWidget *widget = rofi_theme_find_or_create_name ( listview_widget, "element" );
ThemeWidget *scrollbar = rofi_theme_find_or_create_name ( listview_widget, "scrollbar" );
ThemeWidget *wnormal = rofi_theme_find_or_create_name ( widget, "normal" );
ThemeWidget *wselected = rofi_theme_find_or_create_name ( widget, "selected" );
ThemeWidget *walternate = rofi_theme_find_or_create_name ( widget, "alternate" );
@ -714,7 +726,6 @@ void rofi_theme_convert_old_theme ( void )
p->value.i = 0;
g_hash_table_replace ( scrollbar->properties, p->name, p );
gchar **vals = g_strsplit ( config.color_normal, ",", 5 );
if ( g_strv_length ( vals ) == 5 ) {
ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "normal" );
@ -820,7 +831,9 @@ gboolean rofi_theme_parse_file ( const char *file )
extern const char*input_str;
str_len = 0;
input_str = NULL;
while ( yyparse() );
while ( yyparse () ) {
;
}
yylex_destroy ();
g_free ( filename );
yyin = NULL;
@ -833,7 +846,9 @@ gboolean rofi_theme_parse_string ( const char *string )
yyin = NULL;
input_str = string;
str_len = strlen ( string );
while ( yyparse () );
while ( yyparse () ) {
;
}
yylex_destroy ();
return TRUE;
}

View file

@ -262,9 +262,11 @@ static void rofi_view_calculate_window_position ( RofiViewState *state )
anchor = location;
if ( location == WL_CENTER ) {
anchor = WL_NORTH;
} else if ( location == WL_EAST ) {
}
else if ( location == WL_EAST ) {
anchor = WL_NORTH_EAST;
} else if (location == WL_WEST ) {
}
else if ( location == WL_WEST ) {
anchor = WL_NORTH_WEST;
}
}
@ -1498,7 +1500,6 @@ RofiViewState *rofi_view_create ( Mode *sw,
state->main_box = box_create ( "window.mainbox.box", BOX_VERTICAL );
container_add ( state->main_window, WIDGET ( state->main_box ) );
state->input_bar = box_create ( "window.mainbox.inputbar.box", BOX_HORIZONTAL );
// Only enable widget when sidebar is enabled.
@ -1600,7 +1601,6 @@ int rofi_view_error_dialog ( const char *msg, int markup )
NORMAL, ( msg != NULL ) ? msg : "" );
box_add ( state->main_box, WIDGET ( state->text ), TRUE, 1 );
// Make sure we enable fixed num lines when in normal window mode.
if ( ( CacheState.flags & MENU_NORMAL_WINDOW ) == MENU_NORMAL_WINDOW ) {
listview_set_fixed_num_lines ( state->list_view );

View file

@ -71,7 +71,8 @@ static int box_get_desired_height ( widget *wid )
if ( active_widgets > 0 ) {
height += ( active_widgets - 1 ) * spacing;
}
} else {
}
else {
for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
widget * child = (widget *) iter->data;
if ( !child->enabled ) {
@ -84,7 +85,6 @@ static int box_get_desired_height ( widget *wid )
return height;
}
static void vert_calculate_size ( box *b )
{
int spacing = distance_get_pixel ( b->spacing, ORIENTATION_VERTICAL );
@ -252,7 +252,8 @@ void box_add ( box *box, widget *child, gboolean expand, int index )
int width = box->widget.w;
width = MAX ( width, child->w + widget_padding_get_padding_width ( WIDGET ( box ) ) );
box->widget.w = width;
} else {
}
else {
int height = box->widget.h;
height = MAX ( height, child->h + widget_padding_get_padding_height ( WIDGET ( box ) ) );
box->widget.h = height;

View file

@ -44,7 +44,6 @@ struct _window
static void container_update ( widget *wid );
static int container_get_desired_height ( widget *widget )
{
container *b = (container *) widget;
@ -56,7 +55,6 @@ static int container_get_desired_height ( widget *widget )
return height;
}
static void container_draw ( widget *wid, cairo_t *draw )
{
container *b = (container *) wid;
@ -145,4 +143,3 @@ static void container_update ( widget *wid )
);
}
}

View file

@ -81,7 +81,6 @@ struct _listview
listview_mouse_activated_cb mouse_activated;
void *mouse_activated_data;
char *listview_name;
};
@ -169,7 +168,8 @@ static void listview_draw ( widget *wid, cairo_t *draw )
scrollbar_set_handle_length ( lv->scrollbar, lv->cur_columns * lv->max_rows );
if ( lv->reverse ) {
scrollbar_set_handle ( lv->scrollbar, lv->req_elements - lv->selected - 1 );
} else {
}
else {
scrollbar_set_handle ( lv->scrollbar, lv->selected );
}
lv->last_offset = offset;
@ -197,7 +197,8 @@ static void listview_draw ( widget *wid, cairo_t *draw )
if ( lv->reverse ) {
unsigned int ey = wid->h - ( widget_padding_get_bottom ( wid ) + ( ( i ) % lv->max_rows ) * ( lv->element_height + spacing_vert ) ) - lv->element_height;
textbox_moveresize ( lv->boxes[i], ex, ey, element_width, lv->element_height );
} else {
}
else {
unsigned int ey = top_offset + ( ( i ) % lv->max_rows ) * ( lv->element_height + spacing_vert );
textbox_moveresize ( lv->boxes[i], ex, ey, element_width, lv->element_height );
}
@ -285,7 +286,8 @@ static void listview_resize ( widget *wid, short w, short h )
widget_move ( WIDGET ( lv->scrollbar ),
widget_padding_get_left ( WIDGET ( lv ) ),
widget_padding_get_top ( WIDGET ( lv ) ) );
} else {
}
else {
widget_move ( WIDGET ( lv->scrollbar ),
lv->widget.w - widget_padding_get_right ( WIDGET ( lv ) ) - widget_get_width ( WIDGET ( lv->scrollbar ) ),
widget_padding_get_top ( WIDGET ( lv ) ) );
@ -394,7 +396,6 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", !config.hide_scrollbar ) );
lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle );
return lv;
}
@ -433,7 +434,8 @@ void listview_nav_up ( listview *lv )
{
if ( lv->reverse ) {
listview_nav_down_int ( lv );
} else {
}
else {
listview_nav_up_int ( lv );
}
}
@ -441,7 +443,8 @@ void listview_nav_down ( listview *lv )
{
if ( lv->reverse ) {
listview_nav_up_int ( lv );
} else {
}
else {
listview_nav_down_int ( lv );
}
}
@ -512,7 +515,8 @@ void listview_nav_page_prev ( listview *lv )
{
if ( lv->reverse ) {
listview_nav_page_next_int ( lv );
} else {
}
else {
listview_nav_page_prev_int ( lv );
}
}
@ -520,7 +524,8 @@ void listview_nav_page_next ( listview *lv )
{
if ( lv->reverse ) {
listview_nav_page_prev_int ( lv );
} else {
}
else {
listview_nav_page_next_int ( lv );
}
}
@ -536,7 +541,8 @@ static int listview_get_desired_height ( widget *wid )
if ( !( lv->fixed_num_lines ) ) {
if ( lv->dynamic ) {
h = MIN ( lv->menu_lines, lv->req_elements );
} else {
}
else {
h = MIN ( lv->menu_lines, lv->max_displayed_lines );
}
}

View file

@ -36,7 +36,6 @@ static void scrollbar_draw ( widget *, cairo_t * );
static void scrollbar_free ( widget * );
static gboolean scrollbar_motion_notify ( widget *wid, xcb_motion_notify_event_t *xme );
static int scrollbar_get_desired_height ( widget *wid )
{
// Want height we are.
@ -159,4 +158,3 @@ unsigned int scrollbar_clicked ( const scrollbar *sb, int y )
}
return 0;
}

View file

@ -80,8 +80,7 @@ static void textbox_resize ( widget *wid, short w, short h )
static int textbox_get_desired_height ( widget *wid )
{
textbox *tb = (textbox *) wid;
if ( (tb->flags & TB_AUTOHEIGHT) == 0 )
{
if ( ( tb->flags & TB_AUTOHEIGHT ) == 0 ) {
return tb->widget.h;
}
if ( tb->changed ) {
@ -378,7 +377,6 @@ static void texbox_update ( textbox *tb )
pango_cairo_show_layout ( tb->main_draw, tb->layout );
if ( ( tb->flags & TB_INDICATOR ) == TB_INDICATOR && ( tb->tbft & ( SELECTED ) ) ) {
cairo_arc ( tb->main_draw, DOT_OFFSET / 2.0, tb->widget.h / 2.0, 2.0, 0, 2.0 * M_PI );
cairo_fill ( tb->main_draw );
}

View file

@ -3,7 +3,6 @@
#include "widgets/widget-internal.h"
#include "theme.h"
void widget_init ( widget *widget, const char *name )
{
widget->name = g_strdup ( name );
@ -329,11 +328,9 @@ int widget_padding_get_padding_width ( const widget *wid )
return width;
}
int widget_get_desired_height ( widget *wid )
{
if ( wid && wid->get_desired_height )
{
if ( wid && wid->get_desired_height ) {
return wid->get_desired_height ( wid );
}
return 0;