diff options
author | Dave Davenport <qball@gmpclient.org> | 2019-08-19 21:59:27 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2019-08-19 21:59:27 +0200 |
commit | ae47b2e0635250d74d1f61719bec9afeebec5b7f (patch) | |
tree | bb3a0af33f4a3ae99586aeb132b3ca3f8de72d77 | |
parent | 9049eaf9968d6b35eedb89b057f325bb4d04d21e (diff) |
[Theme] @media limit to px.
-rw-r--r-- | include/theme.h | 2 | ||||
-rw-r--r-- | lexer/theme-lexer.l | 4 | ||||
-rw-r--r-- | lexer/theme-parser.y | 25 | ||||
-rw-r--r-- | source/theme.c | 8 |
4 files changed, 19 insertions, 20 deletions
diff --git a/include/theme.h b/include/theme.h index 1dbbb403..9bcf6d8d 100644 --- a/include/theme.h +++ b/include/theme.h @@ -43,7 +43,7 @@ typedef enum { typedef struct ThemeMedia { ThemeMediaType type; - RofiDistance value; + int value; } ThemeMedia; /** diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index a4db7c3f..cf287371 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -449,8 +449,8 @@ if ( queue == NULL ){ return T_LINK; } -<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{EM} { return T_UNIT_EM; } -<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{CH} { return T_UNIT_CH; } +<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{EM} { return T_UNIT_EM; } +<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CH} { return T_UNIT_CH; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{PX} { return T_UNIT_PX; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{PERCENT} { return T_PERCENT; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{LS_SOLID} { return T_SOLID; } diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 23c3e627..0c95442f 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -233,7 +233,6 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %token T_MEDIA_SEP "-" %type <sval> t_entry -%type <sval> t_entry_my %type <theme> t_entry_list %type <theme> t_media_entry_list %type <list> t_entry_name_path @@ -355,47 +354,47 @@ t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optio g_hash_table_destroy ( $3 ); } } -| T_MEDIA T_PARENT_LEFT T_MEDIA_MIN T_MEDIA_SEP T_MEDIA_WIDTH T_PSEP t_property_distance T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { +| T_MEDIA T_PARENT_LEFT T_MEDIA_MIN T_MEDIA_SEP T_MEDIA_WIDTH T_PSEP T_INT T_UNIT_PX T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, "min-width" ); widget->set = TRUE; widget->media = g_malloc0(sizeof(ThemeMedia)); widget->media->type = THEME_MEDIA_TYPE_MIN_WIDTH; widget->media->value = $7; - for ( unsigned int i = 0; i < $10->num_widgets;i++) { - ThemeWidget *d = $10->widgets[i]; + for ( unsigned int i = 0; i < $11->num_widgets;i++) { + ThemeWidget *d = $11->widgets[i]; rofi_theme_parse_merge_widgets(widget, d); } } -| T_MEDIA T_PARENT_LEFT T_MEDIA_MIN T_MEDIA_SEP T_MEDIA_HEIGHT T_PSEP t_property_distance T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { +| T_MEDIA T_PARENT_LEFT T_MEDIA_MIN T_MEDIA_SEP T_MEDIA_HEIGHT T_PSEP T_INT T_UNIT_PX T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, "min-height" ); widget->set = TRUE; widget->media = g_malloc0(sizeof(ThemeMedia)); widget->media->type = THEME_MEDIA_TYPE_MIN_HEIGHT; widget->media->value = $7; - for ( unsigned int i = 0; i < $10->num_widgets;i++) { - ThemeWidget *d = $10->widgets[i]; + for ( unsigned int i = 0; i < $11->num_widgets;i++) { + ThemeWidget *d = $11->widgets[i]; rofi_theme_parse_merge_widgets(widget, d); } } -| T_MEDIA T_PARENT_LEFT T_MEDIA_MAX T_MEDIA_SEP T_MEDIA_WIDTH T_PSEP t_property_distance T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { +| T_MEDIA T_PARENT_LEFT T_MEDIA_MAX T_MEDIA_SEP T_MEDIA_WIDTH T_PSEP T_INT T_UNIT_PX T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, "max-width" ); widget->set = TRUE; widget->media = g_malloc0(sizeof(ThemeMedia)); widget->media->type = THEME_MEDIA_TYPE_MAX_WIDTH; widget->media->value = $7; - for ( unsigned int i = 0; i < $10->num_widgets;i++) { - ThemeWidget *d = $10->widgets[i]; + for ( unsigned int i = 0; i < $11->num_widgets;i++) { + ThemeWidget *d = $11->widgets[i]; rofi_theme_parse_merge_widgets(widget, d); } } -| T_MEDIA T_PARENT_LEFT T_MEDIA_MAX T_MEDIA_SEP T_MEDIA_HEIGHT T_PSEP t_property_distance T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { +| T_MEDIA T_PARENT_LEFT T_MEDIA_MAX T_MEDIA_SEP T_MEDIA_HEIGHT T_PSEP T_INT T_UNIT_PX T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE { ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, "max-height"); widget->set = TRUE; widget->media = g_malloc0(sizeof(ThemeMedia)); widget->media->type = THEME_MEDIA_TYPE_MAX_HEIGHT; widget->media->value = $7; - for ( unsigned int i = 0; i < $10->num_widgets;i++) { - ThemeWidget *d = $10->widgets[i]; + for ( unsigned int i = 0; i < $11->num_widgets;i++) { + ThemeWidget *d = $11->widgets[i]; rofi_theme_parse_merge_widgets(widget, d); } } diff --git a/source/theme.c b/source/theme.c index b0a84e68..3206bbfd 100644 --- a/source/theme.c +++ b/source/theme.c @@ -1049,7 +1049,7 @@ void rofi_theme_parse_process_conditionals ( void ) { case THEME_MEDIA_TYPE_MIN_WIDTH: { - int w = distance_get_pixel ( widget->media->value,ROFI_ORIENTATION_HORIZONTAL); + int w = widget->media->value; if ( mon.w >= w ){ printf("merge accepted\n"); for ( unsigned int x =0; x < widget->num_widgets; x++) { @@ -1060,7 +1060,7 @@ void rofi_theme_parse_process_conditionals ( void ) } case THEME_MEDIA_TYPE_MAX_WIDTH: { - int w = distance_get_pixel ( widget->media->value,ROFI_ORIENTATION_HORIZONTAL); + int w = widget->media->value; if ( mon.w < w ){ printf("merge accepted\n"); for ( unsigned int x =0; x < widget->num_widgets; x++) { @@ -1071,7 +1071,7 @@ void rofi_theme_parse_process_conditionals ( void ) } case THEME_MEDIA_TYPE_MIN_HEIGHT: { - int h = distance_get_pixel ( widget->media->value,ROFI_ORIENTATION_VERTICAL ); + int h = widget->media->value; if ( mon.h >= h ){ printf("merge accepted\n"); for ( unsigned int x =0; x < widget->num_widgets; x++) { @@ -1082,7 +1082,7 @@ void rofi_theme_parse_process_conditionals ( void ) } case THEME_MEDIA_TYPE_MAX_HEIGHT: { - int h = distance_get_pixel ( widget->media->value,ROFI_ORIENTATION_VERTICAL); + int h = widget->media->value; if ( mon.h < h ){ printf("merge accepted\n"); for ( unsigned int x =0; x < widget->num_widgets; x++) { |