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

Merge branch 'next' of github:DaveDavenport/rofi into next

This commit is contained in:
Dave Davenport 2017-09-18 07:31:33 +02:00
commit af2492b353
12 changed files with 63 additions and 63 deletions

View file

@ -91,7 +91,7 @@ name
The preferred file extension for the new theme format is \fBrasi\fR\. This is an abbreviation for \fBr\fRofi \fBa\fRdvanced \fBs\fRtyle \fBi\fRnformation\.
.
.SH "BASIC STRUCTURE"
Each element has a section with defined properties\. Properties can be inherited to sub\-sections\. Global properties can be defined in section \fB* { }\fR\. Sub\-section names begin with a hash symbol \fB#\fR\.
Each element has a section with defined properties\. Global properties can be defined in section \fB* { }\fR\. Sub\-section names begin with a hash symbol \fB#\fR\.
.
.P
It is advised to define the \fIglobal properties section\fR on top of the file to make inheritance of properties clearer\.
@ -133,7 +133,7 @@ A global properties section is indicated with a \fB*\fR as element path\.
A theme can have multiple element theme sections\.
.
.P
The element path can consist of multiple names separated by whitespace or dots\. Each element may contain any number of letters, numbers and \fB\-\fR\'s\. The first element in the element path should always start with a \fB#\fR\.
The element path can consist of multiple names separated by whitespace or dots\. Each element may contain any number of letters, numbers and \fB\-\fR\'s\. The first element in the element path should always start with a \fB#\fR\. Multiple elements can be specified by a \fB,\fR\.
.
.P
This is a valid element name:
@ -142,7 +142,11 @@ This is a valid element name:
.
.nf
#window mainbox listview element normal\.normal {
#element normal\.normal {
background\-color: blue;
}
#button {
background\-color: blue;
}
.
.fi
@ -156,7 +160,8 @@ And is identical to:
.
.nf
#window\.mainbox\.listview\.element normal\.normal {
#element normal normal, button {
background\-color: blue;
}
.
.fi
@ -164,10 +169,7 @@ And is identical to:
.IP "" 0
.
.P
Each section inherits the properties of its parents\. Inherited properties can be overridden by defining them again in the section itself\. So \fB#window mainbox\fR will contain all properties of \fB#window\fR and \fB#window mainbox\fR\.
.
.P
In the following example:
Each section inherits the global properties\. Properties can be explicitely inherited from there parent with the \fBinherit\fR keyword\. In the following example:
.
.IP "" 4
.
@ -177,7 +179,8 @@ In the following example:
a: 1;
b: 2;
}
#window mainbox {
#mainbox {
a: inherit;
b: 4;
c: 8;
}
@ -187,7 +190,7 @@ In the following example:
.IP "" 0
.
.P
The element \fB#window mainbox\fR will have the following set of properties:
The element \fB#mainbox\fR will have the following set of properties (if \fBmainbox\fR is a child of \fBwindow\fR):
.
.IP "" 4
.
@ -865,7 +868,7 @@ Example:
.IP "" 0
.
.P
Sets all selected textboxes marked active to the given foreground and background color\.
Sets all selected textboxes marked active to the given foreground and background color\. Note that a state modifies the original element, it therefor contains all the properties of that element\.
.
.SS "Scrollbar"
The scrollbar uses the \fBhandle\fR state when drawing the small scrollbar handle\. This allows the colors used for drawing the handle to be set independently\.

View file

@ -66,8 +66,7 @@ abbreviation for **r**ofi **a**dvanced **s**tyle **i**nformation.
## BASIC STRUCTURE
Each element has a section with defined properties. Properties can be inherited
to sub-sections. Global properties can be defined in section `* { }`.
Each element has a section with defined properties. Global properties can be defined in section `* { }`.
Sub-section names begin with a hash symbol `#`.
It is advised to define the *global properties section* on top of the file to
@ -109,26 +108,29 @@ A theme can have multiple element theme sections.
The element path can consist of multiple names separated by whitespace or dots.
Each element may contain any number of letters, numbers and `-`'s.
The first element in the element path should always start with a `#`.
Multiple elements can be specified by a `,`.
This is a valid element name:
```
#window mainbox listview element normal.normal {
#element normal.normal {
background-color: blue;
}
#button {
background-color: blue;
}
```
And is identical to:
```
#window.mainbox.listview.element normal.normal {
#element normal normal, button {
background-color: blue;
}
```
Each section inherits the properties of its parents. Inherited properties
can be overridden by defining them again in the section itself.
So `#window mainbox` will contain all properties of `#window` and `#window
mainbox`.
Each section inherits the global properties. Properties can be explicitely inherited from there parent with the
`inherit` keyword.
In the following example:
```
@ -136,13 +138,14 @@ In the following example:
a: 1;
b: 2;
}
#window mainbox {
#mainbox {
a: inherit;
b: 4;
c: 8;
}
```
The element `#window mainbox` will have the following set of properties:
The element `#mainbox` will have the following set of properties (if `mainbox` is a child of `window`):
```
a: 1;
@ -477,7 +480,7 @@ The current widgets available in **rofi**:
* `#case-indicator`: the case/sort indicator @textbox
* `#prompt`: the prompt @textbox
* `#entry`: the main entry @textbox
* `#listview`: The listview.
* `#listview`: The listview.
* `#scrollbar`: the listview scrollbar
* `#element`: the entries in the listview
* `#sidebar`: the main horizontal @box packing the buttons.
@ -531,6 +534,7 @@ Example:
```
Sets all selected textboxes marked active to the given foreground and background color.
Note that a state modifies the original element, it therefor contains all the properties of that element.
### Scrollbar

View file

@ -168,21 +168,17 @@ void x11_disable_decoration ( xcb_window_t window );
typedef enum
{
/** Default EWHM compatible window manager */
WM_EWHM = 0,
WM_EWHM = 0,
/** I3 Window manager */
WM_I3 = 1,
/** Awesome window manager */
WM_AWESOME = 2,
/** Openbox window manager */
WM_OPENBOX = 4,
/** Xfwm4 */
WM_XFWM4 = 8,
} WindowManager;
WM_DO_NOT_CHANGE_CURRENT_DESKTOP = 1,
/** PANGO WORKSPACE NAMES */
WM_PANGO_WORKSPACE_NAMES = 2,
} WindowManagerQuirk;
/**
* Indicates the current window manager.
* This is used for work-arounds.
*/
extern WindowManager current_window_manager;
extern WindowManagerQuirk current_window_manager;
#endif

View file

@ -482,7 +482,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
}
if ( c->wmdesktop != 0xFFFFFFFF ) {
if ( has_names ) {
if ( current_window_manager == WM_I3 ) {
if ( (current_window_manager&WM_PANGO_WORKSPACE_NAMES) == WM_PANGO_WORKSPACE_NAMES ) {
char *output = NULL;
if ( pango_parse_markup ( _window_name_list_entry ( names.strings, names.strings_len,
c->wmdesktop ), -1, 0, NULL, &output, NULL, NULL ) ) {
@ -584,7 +584,7 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
}
else {
rofi_view_hide ();
if ( ( current_window_manager & ( WM_AWESOME | WM_OPENBOX | WM_XFWM4 ) ) != 0 ) {
if ( ( current_window_manager&WM_DO_NOT_CHANGE_CURRENT_DESKTOP ) == 0 ) {
// Get the desktop of the client to switch to
uint32_t wmdesktop = 0;
xcb_get_property_cookie_t cookie;

View file

@ -250,6 +250,11 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
case P_LINK:
printf ( "%s;", p->value.link.name );
break;
case P_INHERIT:
printf ( "inherit;" );
break;
default:
break;
}
putchar ( '\n' );
}
@ -354,7 +359,7 @@ void yyerror ( YYLTYPE *yylloc, const char *what, const char* s )
rofi_add_error_message ( str );
}
static void rofi_theme_copy_property_int ( gpointer key, gpointer value, gpointer user_data )
static void rofi_theme_copy_property_int ( G_GNUC_UNUSED gpointer key, gpointer value, gpointer user_data )
{
GHashTable *table = (GHashTable *) user_data;
Property *p = rofi_theme_property_copy( (Property*) value);

View file

@ -308,30 +308,31 @@ static void rofi_view_calculate_window_position ( RofiViewState *state )
{
case WL_NORTH_WEST:
state->x = CacheState.mon.x;
__attribute__ ( ( fallthrough ) );
/* FALLTHRU */
case WL_NORTH:
state->y = CacheState.mon.y;
break;
case WL_NORTH_EAST:
state->y = CacheState.mon.y;
__attribute__ ( ( fallthrough ) );
/* FALLTHRU */
case WL_EAST:
state->x = CacheState.mon.x + CacheState.mon.w;
break;
case WL_SOUTH_EAST:
state->x = CacheState.mon.x + CacheState.mon.w;
__attribute__ ( ( fallthrough ) );
/* FALLTHRU */
case WL_SOUTH:
state->y = CacheState.mon.y + CacheState.mon.h;
break;
case WL_SOUTH_WEST:
state->y = CacheState.mon.y + CacheState.mon.h;
__attribute__ ( ( fallthrough ) );
/* FALLTHRU */
case WL_WEST:
state->x = CacheState.mon.x;
break;
case WL_CENTER:
; __attribute__ ( ( fallthrough ) );
;
/* FALLTHRU */
default:
break;
}
@ -1363,10 +1364,10 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, g
return FALSE;
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END:
target = NULL;
__attribute__ ( ( fallthrough ) );
/* FALLTHRU */
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN:
state->mouse.motion_target = target;
__attribute__ ( ( fallthrough ) );
/* FALLTHRU */
case WIDGET_TRIGGER_ACTION_RESULT_HANDLED:
return TRUE;
}
@ -1516,7 +1517,7 @@ static void rofi_view_listview_mouse_activated_cb ( listview *lv, gboolean custo
state->skip_absorb = TRUE;
}
static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, const char *parent, const char *name )
static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, const char *name )
{
char *defaults = NULL;
widget *wid = NULL;
@ -1587,7 +1588,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
return;
}
state->mesg_box = container_create ( parent_widget, name );
state->mesg_tb = textbox_create ( state->mesg_box, WIDGET_TYPE_TEXTBOX_TEXT, "textbox", TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, NORMAL, NULL, 0, 0 );
state->mesg_tb = textbox_create ( WIDGET ( state->mesg_box ), WIDGET_TYPE_TEXTBOX_TEXT, "textbox", TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, NORMAL, NULL, 0, 0 );
container_add ( state->mesg_box, WIDGET ( state->mesg_tb ) );
rofi_view_reload_message_bar ( state );
box_add ( (box *) parent_widget, WIDGET ( state->mesg_box ), FALSE );
@ -1645,7 +1646,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
if ( wid ) {
GList *list = rofi_theme_get_list ( wid, "children", defaults );
for ( const GList *iter = list; iter != NULL; iter = g_list_next ( iter ) ) {
rofi_view_add_widget ( state, wid, "", (const char *) iter->data );
rofi_view_add_widget ( state, wid, (const char *) iter->data );
}
g_list_free_full ( list, g_free );
}
@ -1682,7 +1683,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
// Get children.
GList *list = rofi_theme_get_list ( WIDGET ( state->main_window ), "children", "mainbox" );
for ( const GList *iter = list; iter != NULL; iter = g_list_next ( iter ) ) {
rofi_view_add_widget ( state, WIDGET ( state->main_window ), "window", (const char *) iter->data );
rofi_view_add_widget ( state, WIDGET ( state->main_window ), (const char *) iter->data );
}
g_list_free_full ( list, g_free );

View file

@ -502,7 +502,7 @@ static WidgetTriggerActionResult listview_element_trigger_action ( widget *wid,
break;
case ACCEPT_HOVERED_CUSTOM:
custom = TRUE;
__attribute__ ( ( fallthrough ) );
/* FALLTHRU */
case ACCEPT_HOVERED_ENTRY:
listview_set_selected ( lv, lv->last_offset + i );
lv->mouse_activated ( lv, custom, lv->mouse_activated_data );

View file

@ -64,7 +64,7 @@
#include <rofi.h>
/** Checks if the if x and y is inside rectangle. */
#define INTERSECT( x, y, x1, y1, w1, h1 ) ( ( ( ( x ) >= ( x1 ) ) && ( ( x ) < ( x1 + w1 ) ) ) && ( ( ( y ) >= ( y1 ) ) && ( ( y ) < ( y1 + h1 ) ) ) )
WindowManager current_window_manager = WM_EWHM;
WindowManagerQuirk current_window_manager = WM_EWHM;
/**
* Structure holding xcb objects needed to function.
@ -912,16 +912,7 @@ static void x11_helper_discover_window_manager ( void )
if ( wtitle.strings_len > 0 ) {
g_debug ( "Found window manager: %s", wtitle.strings );
if ( g_strcmp0 ( wtitle.strings, "i3" ) == 0 ) {
current_window_manager = WM_I3;
}
else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ) {
current_window_manager = WM_AWESOME;
}
else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ) {
current_window_manager = WM_OPENBOX;
}
else if ( g_strcmp0 ( wtitle.strings, "Xfwm4" ) == 0 ) {
current_window_manager = WM_XFWM4;
current_window_manager = WM_DO_NOT_CHANGE_CURRENT_DESKTOP|WM_PANGO_WORKSPACE_NAMES;
}
}
xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle );

View file

@ -63,7 +63,7 @@ unsigned int test =0;
} \
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;
}

View file

@ -59,7 +59,7 @@ char * helper_get_theme_path ( const char *file )
{
return g_strdup ( file );
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;
}

View file

@ -52,7 +52,7 @@ unsigned int normal_window_mode = 0;
#include "view.h"
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;
}

View file

@ -43,7 +43,7 @@ unsigned int test =0;
assert ( a ); \
printf ( "Test %3i passed (%s)\n", ++test, # a ); \
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, char **error )
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;
}