mirror of
https://github.com/lbonn/rofi
synced 2024-11-29 23:30:27 +00:00
Indenting, comments
This commit is contained in:
parent
9293c8b8ce
commit
f0981d6697
14 changed files with 113 additions and 42 deletions
|
@ -87,7 +87,7 @@ typedef ModeMode ( *_mode_result )( Mode *sw, int menu_retv, char **input, unsig
|
|||
*
|
||||
* Preprocess the input for sorting.
|
||||
*
|
||||
* @returns Entry stripped from markup for sorting
|
||||
* @returns Entry stripped from markup for sorting
|
||||
*/
|
||||
typedef char* ( *_mode_preprocess_input )( Mode *sw, const char *input );
|
||||
|
||||
|
|
|
@ -8,21 +8,62 @@
|
|||
* @{
|
||||
*/
|
||||
#if TIMINGS
|
||||
|
||||
/**
|
||||
* Init the timestamping mechanism .
|
||||
* implementation.
|
||||
*/
|
||||
void rofi_timings_init ( void );
|
||||
/**
|
||||
* @param str function name.
|
||||
* @param line line number
|
||||
* @param msg message
|
||||
*
|
||||
* Report a tick.
|
||||
*/
|
||||
void rofi_timings_tick ( char const *str, int line, char const *msg );
|
||||
/**
|
||||
* Stop the timestamping mechanism
|
||||
*/
|
||||
void rofi_timings_quit ( void );
|
||||
|
||||
/**
|
||||
* Start timestamping mechanism.
|
||||
* Call to this function is time 0.
|
||||
*/
|
||||
#define TIMINGS_START() rofi_timings_init ()
|
||||
/**
|
||||
* Report current time since TIMINGS_START
|
||||
*/
|
||||
#define TICK() rofi_timings_tick ( __func__, __LINE__, "" )
|
||||
/**
|
||||
* @param a an string
|
||||
* Report current time since TIMINGS_START
|
||||
*/
|
||||
#define TICK_N( a ) rofi_timings_tick ( __func__, __LINE__, a )
|
||||
/**
|
||||
* Stop timestamping mechanism.
|
||||
*/
|
||||
#define TIMINGS_STOP() rofi_timings_quit ()
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
* Start timestamping mechanism.
|
||||
* Call to this function is time 0.
|
||||
*/
|
||||
#define TIMINGS_START()
|
||||
/**
|
||||
* Stop timestamping mechanism.
|
||||
*/
|
||||
#define TIMINGS_STOP()
|
||||
/**
|
||||
* Report current time since TIMINGS_START
|
||||
*/
|
||||
#define TICK()
|
||||
/**
|
||||
* @param a an string
|
||||
* Report current time since TIMINGS_START
|
||||
*/
|
||||
#define TICK_N( a )
|
||||
|
||||
#endif // TIMINGS
|
||||
|
|
|
@ -83,7 +83,7 @@ void listview_set_padding ( listview *lv, unsigned int padding );
|
|||
|
||||
/**
|
||||
* @param lv Handler to the listview object
|
||||
* @param lines The maximum number of lines
|
||||
* @param lines The maximum number of lines
|
||||
*
|
||||
* Set the maximum number of lines to show.
|
||||
*/
|
||||
|
@ -91,7 +91,7 @@ void listview_set_max_lines ( listview *lv, unsigned int lines );
|
|||
|
||||
/**
|
||||
* @param lv Handler to the listview object
|
||||
* @param columns The maximum number of columns
|
||||
* @param columns The maximum number of columns
|
||||
*
|
||||
* Set the maximum number of columns to show.
|
||||
*/
|
||||
|
@ -123,7 +123,7 @@ void listview_set_scrollbar_width ( listview *lv, unsigned int width );
|
|||
* @param lv Handler to the listview object
|
||||
* @param cycle True for cycle mode
|
||||
*
|
||||
* Set cycle mode. On last entry go to first.
|
||||
* Set cycle mode. On last entry go to first.
|
||||
*/
|
||||
void listview_set_cycle ( listview *lv, gboolean cycle );
|
||||
/**
|
||||
|
|
|
@ -46,16 +46,16 @@ typedef struct
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
TB_AUTOHEIGHT = 1 << 0,
|
||||
TB_AUTOWIDTH = 1 << 1,
|
||||
TB_LEFT = 1 << 16,
|
||||
TB_RIGHT = 1 << 17,
|
||||
TB_CENTER = 1 << 18,
|
||||
TB_EDITABLE = 1 << 19,
|
||||
TB_MARKUP = 1 << 20,
|
||||
TB_WRAP = 1 << 21,
|
||||
TB_PASSWORD = 1 << 22,
|
||||
TB_INDICATOR = 1 << 23,
|
||||
TB_AUTOHEIGHT = 1 << 0,
|
||||
TB_AUTOWIDTH = 1 << 1,
|
||||
TB_LEFT = 1 << 16,
|
||||
TB_RIGHT = 1 << 17,
|
||||
TB_CENTER = 1 << 18,
|
||||
TB_EDITABLE = 1 << 19,
|
||||
TB_MARKUP = 1 << 20,
|
||||
TB_WRAP = 1 << 21,
|
||||
TB_PASSWORD = 1 << 22,
|
||||
TB_INDICATOR = 1 << 23,
|
||||
} TextboxFlags;
|
||||
/**
|
||||
* Flags indicating current state of the textbox.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef ROFI_XCB_INTERNAL_H
|
||||
#define ROFI_XCB_INTERNAL_H
|
||||
|
||||
/** Indication we accept that startup notification api is not yet frozen */
|
||||
#define SN_API_NOT_YET_FROZEN
|
||||
#include <libsn/sn.h>
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
|||
/**
|
||||
* Structure to keep xcb stuff around.
|
||||
*/
|
||||
|
||||
struct _xcb_stuff
|
||||
{
|
||||
xcb_connection_t *connection;
|
||||
|
|
|
@ -1,10 +1,27 @@
|
|||
#ifndef ROFI_XCB_H
|
||||
#define ROFI_XCB_H
|
||||
|
||||
/**
|
||||
* xcb data structure type declaration.
|
||||
*/
|
||||
typedef struct _xcb_stuff xcb_stuff;
|
||||
|
||||
/**
|
||||
* Global pointer to xcb_stuff instance.
|
||||
*/
|
||||
extern xcb_stuff *xcb;
|
||||
|
||||
xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb );
|
||||
/**
|
||||
* @param xcb the xcb data structure
|
||||
*
|
||||
* Get the root window.
|
||||
*
|
||||
* @returns the root window.
|
||||
xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb );
|
||||
/**
|
||||
* @param xcb The xcb data structure.
|
||||
*
|
||||
* Disconnect and free all xcb connections and references.
|
||||
*/
|
||||
void xcb_stuff_wipe ( xcb_stuff *xcb );
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#ifndef ROFI_XKB_H
|
||||
#define ROFI_XKB_H
|
||||
|
||||
/**
|
||||
* Structure holding xkb related state.
|
||||
*/
|
||||
typedef struct xkb_stuff xkb_stuff;
|
||||
#endif
|
||||
|
|
|
@ -63,6 +63,9 @@ typedef enum
|
|||
void config_parse_xresource_options ( xcb_stuff *xcb );
|
||||
|
||||
/**
|
||||
* @param filename The xresources file to parse
|
||||
*
|
||||
* Parses filename and updates the config
|
||||
* @ingroup CONFFile
|
||||
*/
|
||||
void config_parse_xresource_options_file ( const char *filename );
|
||||
|
@ -90,6 +93,9 @@ void config_parse_cmd_options_dynamic ( void );
|
|||
void config_parse_xresource_options_dynamic ( xcb_stuff *xcb );
|
||||
|
||||
/**
|
||||
* @param filename The xresources file to parse
|
||||
*
|
||||
* Parses filename and updates the config. For dynamic options.
|
||||
* @ingroup CONFFile
|
||||
*/
|
||||
void config_parse_xresource_options_dynamic_file ( const char *filename );
|
||||
|
|
|
@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
|
|||
// Reading one line per time.
|
||||
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
|
||||
// Evaluate one line.
|
||||
unsigned int index = 0, ti = 0;
|
||||
unsigned int index = 0, ti = 0;
|
||||
char *token = buffer;
|
||||
|
||||
// Tokenize it.
|
||||
|
|
|
@ -194,7 +194,7 @@ static GRegex * create_regex ( const char *input, int case_sensitive )
|
|||
{
|
||||
#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL )
|
||||
GRegex * retv = NULL;
|
||||
gchar *r;
|
||||
gchar *r;
|
||||
switch ( config.matching_method )
|
||||
{
|
||||
case MM_GLOB:
|
||||
|
@ -234,7 +234,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
|
|||
}
|
||||
|
||||
char *saveptr = NULL, *token;
|
||||
GRegex **retv = NULL;
|
||||
GRegex **retv = NULL;
|
||||
if ( !config.tokenize ) {
|
||||
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
|
||||
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
|
||||
|
|
|
@ -73,9 +73,9 @@ struct xkb_stuff xkb = {
|
|||
.keymap = NULL,
|
||||
.state = NULL,
|
||||
.compose = {
|
||||
.table = NULL,
|
||||
.state = NULL
|
||||
}
|
||||
.table = NULL,
|
||||
.state = NULL
|
||||
}
|
||||
};
|
||||
char *config_path = NULL;
|
||||
// Array of modi.
|
||||
|
@ -456,22 +456,22 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
|
|||
xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id );
|
||||
break;
|
||||
case XCB_XKB_STATE_NOTIFY:
|
||||
{
|
||||
xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
|
||||
guint modmask;
|
||||
xkb_state_update_mask ( xkb.state,
|
||||
ksne->baseMods,
|
||||
ksne->latchedMods,
|
||||
ksne->lockedMods,
|
||||
ksne->baseGroup,
|
||||
ksne->latchedGroup,
|
||||
ksne->lockedGroup );
|
||||
modmask = x11_get_current_mask ( &xkb );
|
||||
if ( modmask == 0 ) {
|
||||
abe_trigger_release ( );
|
||||
{
|
||||
xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
|
||||
guint modmask;
|
||||
xkb_state_update_mask ( xkb.state,
|
||||
ksne->baseMods,
|
||||
ksne->latchedMods,
|
||||
ksne->lockedMods,
|
||||
ksne->baseGroup,
|
||||
ksne->latchedGroup,
|
||||
ksne->lockedGroup );
|
||||
modmask = x11_get_current_mask ( &xkb );
|
||||
if ( modmask == 0 ) {
|
||||
abe_trigger_release ( );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
|
|
@ -281,12 +281,15 @@ static void box_update ( widget *wid )
|
|||
}
|
||||
int box_get_fixed_pixels ( box *box )
|
||||
{
|
||||
return box->max_size;
|
||||
if ( box != NULL ) {
|
||||
return box->max_size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void box_set_padding ( box * box, unsigned int padding )
|
||||
{
|
||||
if ( box ) {
|
||||
if ( box != NULL ) {
|
||||
box->padding = padding;
|
||||
widget_queue_redraw ( WIDGET ( box ) );
|
||||
}
|
||||
|
|
|
@ -41,7 +41,9 @@ struct _separator
|
|||
separator_type type;
|
||||
};
|
||||
|
||||
/** Configuration value for separator style indicating no line */
|
||||
const char *const _separator_style_none = "none";
|
||||
/** Configuration value for separator style indicating dashed line. */
|
||||
const char *const _separator_style_dash = "dash";
|
||||
static void separator_draw ( widget *, cairo_t * );
|
||||
static void separator_free ( widget * );
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef struct
|
|||
/**
|
||||
* Different colors for the different states
|
||||
*/
|
||||
RowColor colors[num_states];
|
||||
RowColor colors[num_states];
|
||||
|
||||
/** Default pango context */
|
||||
static PangoContext *p_context = NULL;
|
||||
|
|
Loading…
Reference in a new issue