mirror of
https://github.com/davatorium/rofi.git
synced 2025-07-31 21:59:25 -04:00
[BarView] Use exact match for entry width.
This commit is contained in:
parent
7639153ad6
commit
da092c53ac
3 changed files with 26 additions and 7 deletions
|
@ -293,6 +293,16 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
|
||||||
* @returns The distance value of this property for this widget.
|
* @returns The distance value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def );
|
Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def );
|
||||||
|
/**
|
||||||
|
* @param widget The widget to query
|
||||||
|
* @param property The property to query.
|
||||||
|
* @param def The default value.
|
||||||
|
*
|
||||||
|
* Obtain the distance of the widget.
|
||||||
|
*
|
||||||
|
* @returns The distance value of this property for this widget.
|
||||||
|
*/
|
||||||
|
Distance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -354,7 +364,7 @@ const char *rofi_theme_get_string ( const widget *widget, const char *property
|
||||||
* @param property The property to query.
|
* @param property The property to query.
|
||||||
* @param def The default value.
|
* @param def The default value.
|
||||||
*
|
*
|
||||||
* Obtain the padding of the widget.
|
* Obtain the double of the widget.
|
||||||
*
|
*
|
||||||
* @returns The double value of this property for this widget.
|
* @returns The double value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -502,11 +502,10 @@ 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 );
|
g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
static Distance _rofi_theme_get_distance ( const widget *widget, const char *property, int def , gboolean exact)
|
||||||
Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def )
|
|
||||||
{
|
{
|
||||||
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
|
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, exact );
|
||||||
Property *p = rofi_theme_find_property ( wid, P_PADDING, property, FALSE );
|
Property *p = rofi_theme_find_property ( wid, P_PADDING, property, exact );
|
||||||
if ( p ) {
|
if ( p ) {
|
||||||
if ( p->type == P_INTEGER ) {
|
if ( p->type == P_INTEGER ) {
|
||||||
return (Distance){ p->value.i, PW_PX, SOLID };
|
return (Distance){ p->value.i, PW_PX, SOLID };
|
||||||
|
@ -519,6 +518,16 @@ Distance rofi_theme_get_distance ( const widget *widget, const char *property, i
|
||||||
return (Distance){ def, PW_PX, SOLID };
|
return (Distance){ def, PW_PX, SOLID };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Distance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def )
|
||||||
|
{
|
||||||
|
return _rofi_theme_get_distance ( widget, property, def , TRUE );
|
||||||
|
}
|
||||||
|
Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def )
|
||||||
|
{
|
||||||
|
return _rofi_theme_get_distance ( widget, property, def , FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
int rofi_theme_get_boolean ( const widget *widget, const char *property, int def )
|
int rofi_theme_get_boolean ( const widget *widget, const char *property, int def )
|
||||||
{
|
{
|
||||||
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
|
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
|
||||||
|
|
|
@ -1667,10 +1667,10 @@ RofiViewState *rofi_view_create ( Mode *sw,
|
||||||
listview_set_num_lines ( state->list_view, lines );
|
listview_set_num_lines ( state->list_view, lines );
|
||||||
listview_set_max_lines ( state->list_view, state->num_lines );
|
listview_set_max_lines ( state->list_view, state->num_lines );
|
||||||
|
|
||||||
if ( rofi_theme_get_boolean ( state->main_window, "listview-in-inputbar", FALSE)){
|
if ( rofi_theme_get_boolean ( WIDGET ( state->main_window ), "listview-in-inputbar", FALSE)){
|
||||||
box_add ( state->input_bar, WIDGET ( state->list_view ), TRUE, 3 );
|
box_add ( state->input_bar, WIDGET ( state->list_view ), TRUE, 3 );
|
||||||
|
|
||||||
Distance d = rofi_theme_get_distance ( WIDGET ( state->text ) , "width", 150);
|
Distance d = rofi_theme_get_distance_exact ( WIDGET ( state->text ) , "width", 150);
|
||||||
state->text->widget.expand = FALSE;
|
state->text->widget.expand = FALSE;
|
||||||
widget_resize ( WIDGET( state->text ), distance_get_pixel ( d, ORIENTATION_HORIZONTAL ), -1);
|
widget_resize ( WIDGET( state->text ), distance_get_pixel ( d, ORIENTATION_HORIZONTAL ), -1);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue