1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00
This commit is contained in:
Dave Davenport 2017-01-11 23:19:29 +01:00
parent d8ca3e01de
commit 63d8bfb071
3 changed files with 17 additions and 14 deletions

View file

@ -140,8 +140,8 @@ may not contain any whitespace.
The current theme format support different type of properties: The current theme format support different type of properties:
* a string. * a string.
* an integer positive number. * an integer number.
* a positive fractional number. * a fractional number.
* a boolean value. * a boolean value.
* a color. * a color.
* text style. * text style.
@ -166,7 +166,7 @@ font: "Awasome 12";
###### Integer ###### Integer
* Format: `[:digit:]+` * Format: `[-+]?[:digit:]+`
An integer may contain any number. An integer may contain any number.
@ -178,7 +178,7 @@ lines: 12;
##### Real ##### Real
* Format: `[:digit:]+(\.[:digit:]+)?` * Format: `[-+]?[:digit:]+(\.[:digit:]+)?`
A real is an integer with an optional fraction. A real is an integer with an optional fraction.

View file

@ -55,7 +55,8 @@ WORD [[:alnum:]-]+
STRING [[:print:]]+ STRING [[:print:]]+
HEX [[:xdigit:]] HEX [[:xdigit:]]
NUMBER [[:digit:]] NUMBER [[:digit:]]
REAL [[:digit:]]+(\.[[:digit:]]+)? PNNUMBER [-+]?[[:digit:]]+
REAL [-+]?[[:digit:]]+(\.[[:digit:]]+)?
PX (px) PX (px)
EM (em) EM (em)
PERCENT (\%) PERCENT (\%)
@ -164,8 +165,8 @@ if ( queue == NULL ){
<INITIAL,ENTRY>":" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES); return PSEP; } <INITIAL,ENTRY>":" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES); return PSEP; }
<PROPERTIES>";" { BEGIN(GPOINTER_TO_INT ( g_queue_pop_head ( queue ))); return PCLOSE;} <PROPERTIES>";" { BEGIN(GPOINTER_TO_INT ( g_queue_pop_head ( queue ))); return PCLOSE;}
<PROPERTIES>(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;} <PROPERTIES>(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;}
<PROPERTIES>{NUMBER}+ { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;} <PROPERTIES>{PNNUMBER}+ { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;}
<PROPERTIES>{NUMBER}+\.{NUMBER}+ { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;} <PROPERTIES>{PNNUMBER}+\.{NUMBER}+ { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;}
<PROPERTIES>\"{STRING}\" { yytext[yyleng-1] = '\0'; yylval->sval = g_strdup(&yytext[1]); return T_STRING;} <PROPERTIES>\"{STRING}\" { yytext[yyleng-1] = '\0'; yylval->sval = g_strdup(&yytext[1]); return T_STRING;}
<PROPERTIES>@{WORD} { <PROPERTIES>@{WORD} {
yylval->sval = g_strdup(yytext); yylval->sval = g_strdup(yytext);
@ -178,31 +179,31 @@ if ( queue == NULL ){
yylval->distance.style = SOLID; yylval->distance.style = SOLID;
return T_PIXEL; return T_PIXEL;
} }
<PROPERTIES>{NUMBER}+{PX} { <PROPERTIES>{PNNUMBER}{PX} {
yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10);
yylval->distance.type = PW_PX; yylval->distance.type = PW_PX;
yylval->distance.style = SOLID; yylval->distance.style = SOLID;
return T_PIXEL; return T_PIXEL;
} }
<PROPERTIES>{NUMBER}+{PX}{WHITESPACE}{LS_DASH} { <PROPERTIES>{PNNUMBER}+{PX}{WHITESPACE}{LS_DASH} {
yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10);
yylval->distance.type = PW_PX; yylval->distance.type = PW_PX;
yylval->distance.style = DASH; yylval->distance.style = DASH;
return T_PIXEL; return T_PIXEL;
} }
<PROPERTIES>{NUMBER}+{EM}{WHITESPACE}{LS_DASH} { <PROPERTIES>{PNNUMBER}+{EM}{WHITESPACE}{LS_DASH} {
yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10);
yylval->distance.type = PW_PX; yylval->distance.type = PW_PX;
yylval->distance.style = DASH; yylval->distance.style = DASH;
return T_PIXEL; return T_PIXEL;
} }
<PROPERTIES>{NUMBER}+{PX}{WHITESPACE}{LS_SOLID} { <PROPERTIES>{PNNUMBER}+{PX}{WHITESPACE}{LS_SOLID} {
yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10);
yylval->distance.type = PW_PX; yylval->distance.type = PW_PX;
yylval->distance.style = SOLID; yylval->distance.style = SOLID;
return T_PIXEL; return T_PIXEL;
} }
<PROPERTIES>{NUMBER}+{EM}{WHITESPACE}{LS_SOLID} { <PROPERTIES>{PNNUMBER}+{EM}{WHITESPACE}{LS_SOLID} {
yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10); yylval->distance.distance = (double)g_ascii_strtoll(yytext, NULL, 10);
yylval->distance.type = PW_PX; yylval->distance.type = PW_PX;
yylval->distance.style = SOLID; yylval->distance.style = SOLID;

View file

@ -343,8 +343,10 @@ static void rofi_view_calculate_window_position ( RofiViewState *state )
break; break;
} }
// Apply offset. // Apply offset.
state->x += config.x_offset; Distance x = rofi_theme_get_distance ( WIDGET ( state->main_window), "x-offset", config.x_offset );
state->y += config.y_offset; Distance y = rofi_theme_get_distance ( WIDGET ( state->main_window), "y-offset", config.y_offset );
state->x += distance_get_pixel(x, ORIENTATION_HORIZONTAL);
state->y += distance_get_pixel(y, ORIENTATION_VERTICAL);
} }
static void rofi_view_window_update_size ( RofiViewState * state ) static void rofi_view_window_update_size ( RofiViewState * state )