mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Indent files.
This commit is contained in:
parent
6ba31683c6
commit
9ae62960c1
20 changed files with 144 additions and 150 deletions
|
@ -141,5 +141,5 @@ Settings config = {
|
|||
.color_urgent = NULL,
|
||||
.color_window = NULL,
|
||||
.plugin_path = PLUGIN_PATH,
|
||||
.max_history_size = 25,
|
||||
.max_history_size = 25,
|
||||
};
|
||||
|
|
|
@ -316,7 +316,6 @@ gboolean helper_execute_command ( const char *wd, const char *cmd, gboolean run_
|
|||
*/
|
||||
cairo_surface_t *cairo_image_surface_create_from_svg ( const gchar* file, int height );
|
||||
|
||||
|
||||
/**
|
||||
* Ranges.
|
||||
*/
|
||||
|
|
|
@ -216,7 +216,6 @@ typedef struct Property
|
|||
PropertyValue value;
|
||||
} Property;
|
||||
|
||||
|
||||
/**
|
||||
* Structure to hold a range.
|
||||
*/
|
||||
|
@ -226,11 +225,11 @@ typedef struct rofi_range_pair
|
|||
unsigned int stop;
|
||||
} rofi_range_pair;
|
||||
|
||||
|
||||
/**
|
||||
* Internal structure for matching.
|
||||
*/
|
||||
typedef struct rofi_int_matcher_t {
|
||||
typedef struct rofi_int_matcher_t
|
||||
{
|
||||
GRegex *regex;
|
||||
gboolean invert;
|
||||
} rofi_int_matcher;
|
||||
|
|
|
@ -91,7 +91,7 @@ void rofi_theme_property_free ( Property *p );
|
|||
*
|
||||
* @returns a copy of p
|
||||
*/
|
||||
Property* rofi_theme_property_copy ( Property *p);
|
||||
Property* rofi_theme_property_copy ( Property *p );
|
||||
/**
|
||||
* @param widget
|
||||
*
|
||||
|
@ -162,7 +162,6 @@ int rofi_theme_get_integer ( const widget *widget, const char *property, int
|
|||
*/
|
||||
int rofi_theme_get_position ( const widget *widget, const char *property, int def );
|
||||
|
||||
|
||||
/**
|
||||
* @param widget The widget to query
|
||||
* @param property The property to query.
|
||||
|
@ -288,7 +287,6 @@ GList *rofi_theme_get_list ( const widget *widget, const char * property, const
|
|||
*/
|
||||
gboolean rofi_theme_is_empty ( void );
|
||||
|
||||
|
||||
/**
|
||||
* Reset the current theme.
|
||||
*/
|
||||
|
|
|
@ -123,7 +123,7 @@ struct RofiViewState
|
|||
int x;
|
||||
int y;
|
||||
widget *motion_target;
|
||||
} mouse;
|
||||
} mouse;
|
||||
|
||||
/** Regexs used for matching */
|
||||
rofi_int_matcher **tokens;
|
||||
|
|
|
@ -168,11 +168,11 @@ 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_DO_NOT_CHANGE_CURRENT_DESKTOP = 1,
|
||||
WM_DO_NOT_CHANGE_CURRENT_DESKTOP = 1,
|
||||
/** PANGO WORKSPACE NAMES */
|
||||
WM_PANGO_WORKSPACE_NAMES = 2,
|
||||
WM_PANGO_WORKSPACE_NAMES = 2,
|
||||
} WindowManagerQuirk;
|
||||
|
||||
/**
|
||||
|
|
|
@ -124,13 +124,13 @@ static int combi_mode_init ( Mode *sw )
|
|||
}
|
||||
static unsigned int combi_mode_get_num_entries ( const Mode *sw )
|
||||
{
|
||||
const CombiModePrivateData *pd = (const CombiModePrivateData *) mode_get_private_data ( sw );
|
||||
unsigned int length = 0;
|
||||
const CombiModePrivateData *pd = (const CombiModePrivateData *) mode_get_private_data ( sw );
|
||||
unsigned int length = 0;
|
||||
for ( unsigned int i = 0; i < pd->num_switchers; i++ ) {
|
||||
unsigned int entries = mode_get_num_entries ( pd->switchers[i].mode );
|
||||
pd->starts[i] = length;
|
||||
pd->lengths[i] = entries;
|
||||
length+=entries;
|
||||
pd->starts[i] = length;
|
||||
pd->lengths[i] = entries;
|
||||
length += entries;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -67,33 +67,33 @@ typedef struct
|
|||
{
|
||||
/** Settings */
|
||||
// Separator.
|
||||
char separator;
|
||||
char separator;
|
||||
|
||||
unsigned int selected_line;
|
||||
char *message;
|
||||
char *format;
|
||||
unsigned int selected_line;
|
||||
char *message;
|
||||
char *format;
|
||||
struct rofi_range_pair * urgent_list;
|
||||
unsigned int num_urgent_list;
|
||||
unsigned int num_urgent_list;
|
||||
struct rofi_range_pair * active_list;
|
||||
unsigned int num_active_list;
|
||||
uint32_t *selected_list;
|
||||
unsigned int num_selected_list;
|
||||
unsigned int do_markup;
|
||||
unsigned int num_active_list;
|
||||
uint32_t *selected_list;
|
||||
unsigned int num_selected_list;
|
||||
unsigned int do_markup;
|
||||
// List with entries.
|
||||
char **cmd_list;
|
||||
unsigned int cmd_list_real_length;
|
||||
unsigned int cmd_list_length;
|
||||
unsigned int only_selected;
|
||||
unsigned int selected_count;
|
||||
char **cmd_list;
|
||||
unsigned int cmd_list_real_length;
|
||||
unsigned int cmd_list_length;
|
||||
unsigned int only_selected;
|
||||
unsigned int selected_count;
|
||||
|
||||
gchar **columns;
|
||||
gchar *column_separator;
|
||||
gboolean multi_select;
|
||||
gchar **columns;
|
||||
gchar *column_separator;
|
||||
gboolean multi_select;
|
||||
|
||||
GCancellable *cancel;
|
||||
gulong cancel_source;
|
||||
GInputStream *input_stream;
|
||||
GDataInputStream *data_input_stream;
|
||||
GCancellable *cancel;
|
||||
gulong cancel_source;
|
||||
GInputStream *input_stream;
|
||||
GDataInputStream *data_input_stream;
|
||||
} DmenuModePrivateData;
|
||||
|
||||
static void async_close_callback ( GObject *source_object, GAsyncResult *res, G_GNUC_UNUSED gpointer user_data )
|
||||
|
@ -200,8 +200,6 @@ static unsigned int dmenu_mode_get_num_entries ( const Mode *sw )
|
|||
return rmpd->cmd_list_length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static gchar * dmenu_format_output_string ( const DmenuModePrivateData *pd, const char *input )
|
||||
{
|
||||
if ( pd->columns == NULL ) {
|
||||
|
@ -613,7 +611,7 @@ int dmenu_switcher_dialog ( void )
|
|||
find_arg_str ( "-select", &select );
|
||||
if ( select != NULL ) {
|
||||
rofi_int_matcher **tokens = helper_tokenize ( select, config.case_sensitive );
|
||||
unsigned int i = 0;
|
||||
unsigned int i = 0;
|
||||
for ( i = 0; i < cmd_list_length; i++ ) {
|
||||
if ( helper_token_match ( tokens, cmd_list[i] ) ) {
|
||||
pd->selected_line = i;
|
||||
|
@ -624,7 +622,7 @@ int dmenu_switcher_dialog ( void )
|
|||
}
|
||||
if ( find_arg ( "-dump" ) >= 0 ) {
|
||||
rofi_int_matcher **tokens = helper_tokenize ( config.filter ? config.filter : "", config.case_sensitive );
|
||||
unsigned int i = 0;
|
||||
unsigned int i = 0;
|
||||
for ( i = 0; i < cmd_list_length; i++ ) {
|
||||
if ( tokens == NULL || helper_token_match ( tokens, cmd_list[i] ) ) {
|
||||
rofi_output_formatted_line ( pd->format, cmd_list[i], i, config.filter );
|
||||
|
|
|
@ -87,7 +87,7 @@ typedef struct
|
|||
|
||||
GKeyFile *key_file;
|
||||
|
||||
gint sort_index;
|
||||
gint sort_index;
|
||||
} DRunModeEntry;
|
||||
|
||||
typedef struct
|
||||
|
@ -212,7 +212,7 @@ static void exec_cmd_entry ( DRunModeEntry *e )
|
|||
if ( helper_execute_command ( exec_path, fp, terminal, sn ? &context : NULL ) ) {
|
||||
char *path = g_build_filename ( cache_dir, DRUN_CACHE_FILE, NULL );
|
||||
// Store it based on the unique identifiers (desktop_id).
|
||||
history_set ( path, e->desktop_id);
|
||||
history_set ( path, e->desktop_id );
|
||||
g_free ( path );
|
||||
}
|
||||
g_free ( wmclass );
|
||||
|
@ -325,7 +325,8 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
|||
if ( G_UNLIKELY ( pd->cmd_list_length > INT_MAX ) ) {
|
||||
// Default to smallest value.
|
||||
pd->entry_list[pd->cmd_list_length].sort_index = INT_MIN;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
pd->entry_list[pd->cmd_list_length].sort_index = -pd->cmd_list_length;
|
||||
}
|
||||
pd->entry_list[pd->cmd_list_length].icon_size = 0;
|
||||
|
@ -441,10 +442,11 @@ static void get_apps_history ( DRunModePrivateData *pd )
|
|||
for ( unsigned int index = 0; index < length; index++ ) {
|
||||
for ( size_t i = 0; i < pd->cmd_list_length; i++ ) {
|
||||
if ( g_strcmp0 ( pd->entry_list[i].desktop_id, retv[index] ) == 0 ) {
|
||||
unsigned int sort_index = length-index;
|
||||
unsigned int sort_index = length - index;
|
||||
if ( G_LIKELY ( sort_index < INT_MAX ) ) {
|
||||
pd->entry_list[i].sort_index = sort_index;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// This won't sort right anymore, but never gonna hit it anyway.
|
||||
pd->entry_list[i].sort_index = INT_MAX;
|
||||
}
|
||||
|
@ -458,8 +460,8 @@ static void get_apps_history ( DRunModePrivateData *pd )
|
|||
|
||||
static gint drun_int_sort_list ( gconstpointer a, gconstpointer b, G_GNUC_UNUSED gpointer user_data )
|
||||
{
|
||||
DRunModeEntry *da = (DRunModeEntry *)a;
|
||||
DRunModeEntry *db = (DRunModeEntry *)b;
|
||||
DRunModeEntry *da = (DRunModeEntry *) a;
|
||||
DRunModeEntry *db = (DRunModeEntry *) b;
|
||||
|
||||
return db->sort_index - da->sort_index;
|
||||
}
|
||||
|
@ -494,8 +496,7 @@ static void get_apps ( DRunModePrivateData *pd )
|
|||
TICK_N ( "Get Desktop apps (system dirs)" );
|
||||
get_apps_history ( pd );
|
||||
|
||||
|
||||
g_qsort_with_data ( pd->entry_list, pd->cmd_list_length, sizeof ( DRunModeEntry ) , drun_int_sort_list, NULL );
|
||||
g_qsort_with_data ( pd->entry_list, pd->cmd_list_length, sizeof ( DRunModeEntry ), drun_int_sort_list, NULL );
|
||||
|
||||
TICK_N ( "Sorting done." );
|
||||
}
|
||||
|
@ -702,14 +703,14 @@ static int drun_token_match ( const Mode *data, rofi_int_matcher **tokens, unsig
|
|||
int match = 1;
|
||||
if ( tokens ) {
|
||||
for ( int j = 0; match && tokens != NULL && tokens[j] != NULL; j++ ) {
|
||||
int test = 0;
|
||||
int test = 0;
|
||||
rofi_int_matcher *ftokens[2] = { tokens[j], NULL };
|
||||
// Match name
|
||||
if ( rmpd->entry_list[index].name ) {
|
||||
test = helper_token_match ( ftokens, rmpd->entry_list[index].name );
|
||||
}
|
||||
// Match generic name
|
||||
if ( test == tokens[j]->invert && rmpd->entry_list[index].generic_name) {
|
||||
if ( test == tokens[j]->invert && rmpd->entry_list[index].generic_name ) {
|
||||
test = helper_token_match ( ftokens, rmpd->entry_list[index].generic_name );
|
||||
}
|
||||
// Match executable name.
|
||||
|
|
|
@ -47,65 +47,64 @@
|
|||
typedef struct
|
||||
{
|
||||
/** ID of the current script. */
|
||||
unsigned int id;
|
||||
unsigned int id;
|
||||
/** List of visible items. */
|
||||
char **cmd_list;
|
||||
char **cmd_list;
|
||||
/** length list of visible items. */
|
||||
unsigned int cmd_list_length;
|
||||
unsigned int cmd_list_length;
|
||||
|
||||
/** Urgent list */
|
||||
struct rofi_range_pair * urgent_list;
|
||||
unsigned int num_urgent_list;
|
||||
unsigned int num_urgent_list;
|
||||
/** Active list */
|
||||
struct rofi_range_pair * active_list;
|
||||
unsigned int num_active_list;
|
||||
unsigned int num_active_list;
|
||||
/** Configuration settings. */
|
||||
char *message;
|
||||
char *prompt;
|
||||
gboolean do_markup;
|
||||
|
||||
char *message;
|
||||
char *prompt;
|
||||
gboolean do_markup;
|
||||
} ScriptModePrivateData;
|
||||
|
||||
static void parse_header_entry ( Mode *sw, char *line, ssize_t length )
|
||||
{
|
||||
ScriptModePrivateData *pd = (ScriptModePrivateData *) sw->private_data;
|
||||
ssize_t length_key = 0;//strlen ( line );
|
||||
ScriptModePrivateData *pd = (ScriptModePrivateData *) sw->private_data;
|
||||
ssize_t length_key = 0;//strlen ( line );
|
||||
while ( line[length_key] != '\x1f' && length_key <= length ) {
|
||||
length_key++;
|
||||
}
|
||||
|
||||
if ( length_key < length )
|
||||
{
|
||||
if ( length_key < length ) {
|
||||
line[length_key] = '\0';
|
||||
char *value = line+length_key+1;
|
||||
char *value = line + length_key + 1;
|
||||
if ( strcasecmp ( line, "message" ) == 0 ) {
|
||||
g_free ( pd->message );
|
||||
pd->message = g_strdup ( value );
|
||||
} else if ( strcasecmp ( line, "prompt" ) == 0 ) {
|
||||
}
|
||||
else if ( strcasecmp ( line, "prompt" ) == 0 ) {
|
||||
g_free ( pd->prompt );
|
||||
pd->prompt = g_strdup ( value );
|
||||
pd->prompt = g_strdup ( value );
|
||||
sw->display_name = pd->prompt;
|
||||
} else if ( strcasecmp ( line, "markup-rows" ) == 0 ) {
|
||||
}
|
||||
else if ( strcasecmp ( line, "markup-rows" ) == 0 ) {
|
||||
pd->do_markup = ( strcasecmp ( value, "true" ) == 0 );
|
||||
} else if ( strcasecmp ( line, "urgent" ) == 0 ) {
|
||||
}
|
||||
else if ( strcasecmp ( line, "urgent" ) == 0 ) {
|
||||
parse_ranges ( value, &( pd->urgent_list ), &( pd->num_urgent_list ) );
|
||||
} else if ( strcasecmp ( line, "active" ) == 0 ) {
|
||||
}
|
||||
else if ( strcasecmp ( line, "active" ) == 0 ) {
|
||||
parse_ranges ( value, &( pd->active_list ), &( pd->num_active_list ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static char **get_script_output ( Mode *sw, char *command, char *arg, unsigned int *length )
|
||||
{
|
||||
size_t actual_size = 0;
|
||||
int fd = -1;
|
||||
GError *error = NULL;
|
||||
char **retv = NULL;
|
||||
char **argv = NULL;
|
||||
int argc = 0;
|
||||
int fd = -1;
|
||||
GError *error = NULL;
|
||||
char **retv = NULL;
|
||||
char **argv = NULL;
|
||||
int argc = 0;
|
||||
*length = 0;
|
||||
if ( g_shell_parse_argv ( command, &argc, &argv, &error ) ) {
|
||||
argv = g_realloc ( argv, ( argc + 2 ) * sizeof ( char* ) );
|
||||
|
@ -124,20 +123,21 @@ static char **get_script_output ( Mode *sw, char *command, char *arg, unsigned i
|
|||
if ( fd >= 0 ) {
|
||||
FILE *inp = fdopen ( fd, "r" );
|
||||
if ( inp ) {
|
||||
char *buffer = NULL;
|
||||
size_t buffer_length = 0;
|
||||
ssize_t read_length = 0;
|
||||
while ( (read_length = getline ( &buffer, &buffer_length, inp ) ) > 0 ) {
|
||||
char *buffer = NULL;
|
||||
size_t buffer_length = 0;
|
||||
ssize_t read_length = 0;
|
||||
while ( ( read_length = getline ( &buffer, &buffer_length, inp ) ) > 0 ) {
|
||||
// Filter out line-end.
|
||||
if ( buffer[read_length-1] == '\n' ) {
|
||||
buffer[read_length-1] = '\0';
|
||||
if ( buffer[read_length - 1] == '\n' ) {
|
||||
buffer[read_length - 1] = '\0';
|
||||
}
|
||||
if ( buffer[0] == '\0' ) {
|
||||
parse_header_entry ( sw, &buffer[1], read_length-1 );
|
||||
} else {
|
||||
if ( actual_size < ((*length)+2) ){
|
||||
parse_header_entry ( sw, &buffer[1], read_length - 1 );
|
||||
}
|
||||
else {
|
||||
if ( actual_size < ( ( *length ) + 2 ) ) {
|
||||
actual_size += 256;
|
||||
retv = g_realloc ( retv, ( actual_size ) * sizeof ( char* ) );
|
||||
retv = g_realloc ( retv, ( actual_size ) * sizeof ( char* ) );
|
||||
}
|
||||
retv[( *length )] = g_strdup ( buffer );
|
||||
retv[( *length ) + 1] = NULL;
|
||||
|
@ -172,7 +172,6 @@ static void script_switcher_free ( Mode *sw )
|
|||
g_free ( sw );
|
||||
}
|
||||
|
||||
|
||||
static int script_mode_init ( Mode *sw )
|
||||
{
|
||||
if ( sw->private_data == NULL ) {
|
||||
|
|
|
@ -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_PANGO_WORKSPACE_NAMES) == WM_PANGO_WORKSPACE_NAMES ) {
|
||||
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_DO_NOT_CHANGE_CURRENT_DESKTOP ) == 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;
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "rofi.h"
|
||||
#include "view.h"
|
||||
|
||||
|
||||
/**
|
||||
* Textual description of positioning rofi.
|
||||
*/
|
||||
|
@ -158,7 +157,6 @@ void helper_tokenize_free ( rofi_int_matcher ** tokens )
|
|||
for ( size_t i = 0; tokens && tokens[i]; i++ ) {
|
||||
g_regex_unref ( (GRegex *) tokens[i]->regex );
|
||||
g_free ( tokens[i] );
|
||||
|
||||
}
|
||||
g_free ( tokens );
|
||||
}
|
||||
|
@ -219,10 +217,10 @@ static inline GRegex * R ( const char *s, int case_sensitive )
|
|||
|
||||
static rofi_int_matcher * create_regex ( const char *input, int case_sensitive )
|
||||
{
|
||||
GRegex * retv = NULL;
|
||||
gchar *r;
|
||||
rofi_int_matcher *rv = g_malloc0(sizeof(rofi_int_matcher));
|
||||
if ( input && input[0] == '-') {
|
||||
GRegex * retv = NULL;
|
||||
gchar *r;
|
||||
rofi_int_matcher *rv = g_malloc0 ( sizeof ( rofi_int_matcher ) );
|
||||
if ( input && input[0] == '-' ) {
|
||||
rv->invert = 1;
|
||||
input++;
|
||||
}
|
||||
|
@ -265,7 +263,7 @@ rofi_int_matcher **helper_tokenize ( const char *input, int case_sensitive )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
char *saveptr = NULL, *token;
|
||||
char *saveptr = NULL, *token;
|
||||
rofi_int_matcher **retv = NULL;
|
||||
if ( !config.tokenize ) {
|
||||
retv = g_malloc0 ( sizeof ( rofi_int_matcher* ) * 2 );
|
||||
|
@ -415,7 +413,9 @@ PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, r
|
|||
if ( tokens ) {
|
||||
for ( int j = 0; tokens[j]; j++ ) {
|
||||
GMatchInfo *gmi = NULL;
|
||||
if ( tokens[j]->invert ) continue;
|
||||
if ( tokens[j]->invert ) {
|
||||
continue;
|
||||
}
|
||||
g_regex_match ( tokens[j]->regex, input, G_REGEX_MATCH_PARTIAL, &gmi );
|
||||
while ( g_match_info_matches ( gmi ) ) {
|
||||
int count = g_match_info_get_match_count ( gmi );
|
||||
|
@ -476,7 +476,7 @@ int helper_token_match ( rofi_int_matcher* const *tokens, const char *input )
|
|||
// Do a tokenized match.
|
||||
if ( tokens ) {
|
||||
for ( int j = 0; match && tokens[j]; j++ ) {
|
||||
match = g_regex_match ( tokens[j]->regex, input, 0, NULL );
|
||||
match = g_regex_match ( tokens[j]->regex, input, 0, NULL );
|
||||
match ^= tokens[j]->invert;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i
|
|||
int min_value = list[length - 1]->index;
|
||||
|
||||
// Set the max length of the list.
|
||||
length = ( length > config.max_history_size ) ? config.max_history_size: length;
|
||||
length = ( length > config.max_history_size ) ? config.max_history_size : length;
|
||||
|
||||
// Write out entries.
|
||||
for ( unsigned int iter = 0; iter < length; iter++ ) {
|
||||
|
@ -79,7 +79,7 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i
|
|||
static _element ** __history_get_element_list ( FILE *fd, unsigned int *length )
|
||||
{
|
||||
unsigned int real_length = 0;
|
||||
_element **retv = NULL;
|
||||
_element **retv = NULL;
|
||||
|
||||
if ( length == NULL ) {
|
||||
return NULL;
|
||||
|
@ -107,8 +107,7 @@ static _element ** __history_get_element_list ( FILE *fd, unsigned int *length )
|
|||
if ( ( l - ( start - buffer ) ) < 2 ) {
|
||||
continue;
|
||||
}
|
||||
if ( real_length < (*length+2) )
|
||||
{
|
||||
if ( real_length < ( *length + 2 ) ) {
|
||||
real_length += 15;
|
||||
// Resize and check.
|
||||
retv = g_realloc ( retv, ( real_length ) * sizeof ( _element* ) );
|
||||
|
|
|
@ -551,7 +551,7 @@ static void rofi_collect_modi_destroy ( void )
|
|||
g_module_close ( mod );
|
||||
}
|
||||
if ( available_modi[i] ) {
|
||||
mode_free ( &(available_modi[i]) );
|
||||
mode_free ( &( available_modi[i] ) );
|
||||
}
|
||||
}
|
||||
g_free ( available_modi );
|
||||
|
@ -582,7 +582,7 @@ static int add_mode ( const char * token )
|
|||
Mode *sw = script_switcher_parse_setup ( token );
|
||||
if ( sw != NULL ) {
|
||||
// Add to available list, so combi can find it.
|
||||
rofi_collect_modi_add(sw);
|
||||
rofi_collect_modi_add ( sw );
|
||||
modi[num_modi] = sw;
|
||||
num_modi++;
|
||||
}
|
||||
|
|
|
@ -74,24 +74,25 @@ Property *rofi_theme_property_create ( PropertyType type )
|
|||
retv->type = type;
|
||||
return retv;
|
||||
}
|
||||
Property* rofi_theme_property_copy ( Property *p)
|
||||
Property* rofi_theme_property_copy ( Property *p )
|
||||
{
|
||||
Property *retv = rofi_theme_property_create ( p->type );
|
||||
retv->name = g_strdup ( p->name );
|
||||
|
||||
switch ( p->type ) {
|
||||
case P_STRING:
|
||||
retv->value.s = g_strdup ( p->value.s );
|
||||
break;
|
||||
case P_LIST:
|
||||
retv->value.list = g_list_copy_deep ( p->value.list, (GCopyFunc)g_strdup, NULL );
|
||||
break;
|
||||
case P_LINK:
|
||||
retv->value.link.name = g_strdup ( p->value.link.name );
|
||||
retv->value.link.ref = NULL;
|
||||
break;
|
||||
default:
|
||||
retv->value = p->value;
|
||||
switch ( p->type )
|
||||
{
|
||||
case P_STRING:
|
||||
retv->value.s = g_strdup ( p->value.s );
|
||||
break;
|
||||
case P_LIST:
|
||||
retv->value.list = g_list_copy_deep ( p->value.list, (GCopyFunc) g_strdup, NULL );
|
||||
break;
|
||||
case P_LINK:
|
||||
retv->value.link.name = g_strdup ( p->value.link.name );
|
||||
retv->value.link.ref = NULL;
|
||||
break;
|
||||
default:
|
||||
retv->value = p->value;
|
||||
}
|
||||
return retv;
|
||||
}
|
||||
|
@ -114,8 +115,8 @@ void rofi_theme_property_free ( Property *p )
|
|||
void rofi_theme_reset ( void )
|
||||
{
|
||||
rofi_theme_free ( rofi_theme );
|
||||
rofi_theme = g_slice_new0 ( ThemeWidget );
|
||||
rofi_theme->name = g_strdup("Root");
|
||||
rofi_theme = g_slice_new0 ( ThemeWidget );
|
||||
rofi_theme->name = g_strdup ( "Root" );
|
||||
}
|
||||
|
||||
void rofi_theme_free ( ThemeWidget *widget )
|
||||
|
@ -369,7 +370,7 @@ void yyerror ( YYLTYPE *yylloc, const char *what, const char* s )
|
|||
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);
|
||||
Property *p = rofi_theme_property_copy ( (Property *) value );
|
||||
g_hash_table_replace ( table, p->name, p );
|
||||
}
|
||||
void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
|
||||
|
@ -378,7 +379,7 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
|
|||
return;
|
||||
}
|
||||
if ( widget->properties == NULL ) {
|
||||
widget->properties = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify)rofi_theme_property_free );
|
||||
widget->properties = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) rofi_theme_property_free );
|
||||
}
|
||||
g_hash_table_foreach ( table, rofi_theme_copy_property_int, widget->properties );
|
||||
}
|
||||
|
@ -461,7 +462,7 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
|
|||
while ( widget ) {
|
||||
if ( widget->properties && g_hash_table_contains ( widget->properties, property ) ) {
|
||||
Property *p = g_hash_table_lookup ( widget->properties, property );
|
||||
if ( p ->type == P_INHERIT ) {
|
||||
if ( p->type == P_INHERIT ) {
|
||||
return p;
|
||||
}
|
||||
if ( p->type == P_LINK ) {
|
||||
|
@ -632,7 +633,7 @@ void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t
|
|||
if ( widget->parent ) {
|
||||
rofi_theme_get_color ( widget->parent, property, d );
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
cairo_set_source_rgba ( d,
|
||||
p->value.color.red,
|
||||
|
@ -677,7 +678,8 @@ GList *rofi_theme_get_list ( const widget *widget, const char * property, const
|
|||
if ( widget->parent ) {
|
||||
return rofi_theme_get_list ( widget->parent, property, defaults );
|
||||
}
|
||||
} else if ( p->type == P_LIST ) {
|
||||
}
|
||||
else if ( p->type == P_LIST ) {
|
||||
return g_list_copy_deep ( p->value.list, (GCopyFunc) g_strdup, NULL );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -308,31 +308,31 @@ static void rofi_view_calculate_window_position ( RofiViewState *state )
|
|||
{
|
||||
case WL_NORTH_WEST:
|
||||
state->x = CacheState.mon.x;
|
||||
/* FALLTHRU */
|
||||
/* FALLTHRU */
|
||||
case WL_NORTH:
|
||||
state->y = CacheState.mon.y;
|
||||
break;
|
||||
case WL_NORTH_EAST:
|
||||
state->y = CacheState.mon.y;
|
||||
/* FALLTHRU */
|
||||
/* 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;
|
||||
/* FALLTHRU */
|
||||
/* 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;
|
||||
/* FALLTHRU */
|
||||
/* FALLTHRU */
|
||||
case WL_WEST:
|
||||
state->x = CacheState.mon.x;
|
||||
break;
|
||||
case WL_CENTER:
|
||||
;
|
||||
/* FALLTHRU */
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1364,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;
|
||||
/* FALLTHRU */
|
||||
/* FALLTHRU */
|
||||
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN:
|
||||
state->mouse.motion_target = target;
|
||||
/* FALLTHRU */
|
||||
/* FALLTHRU */
|
||||
case WIDGET_TRIGGER_ACTION_RESULT_HANDLED:
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1621,7 +1621,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
|
|||
return;
|
||||
}
|
||||
if ( config.sidebar_mode ) {
|
||||
state->sidebar_bar = box_create ( parent_widget, name,ROFI_ORIENTATION_HORIZONTAL );
|
||||
state->sidebar_bar = box_create ( parent_widget, name, ROFI_ORIENTATION_HORIZONTAL );
|
||||
box_add ( (box *) parent_widget, WIDGET ( state->sidebar_bar ), FALSE );
|
||||
state->num_modi = rofi_get_num_enabled_modi ();
|
||||
state->modi = g_malloc0 ( state->num_modi * sizeof ( textbox * ) );
|
||||
|
@ -1692,7 +1692,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
|
|||
textbox_cursor_end ( state->text );
|
||||
}
|
||||
|
||||
state->overlay = textbox_create ( WIDGET ( state->main_window), WIDGET_TYPE_TEXTBOX_TEXT, "overlay", TB_AUTOWIDTH | TB_AUTOHEIGHT, URGENT, "blaat", 0.5, 0 );
|
||||
state->overlay = textbox_create ( WIDGET ( state->main_window ), WIDGET_TYPE_TEXTBOX_TEXT, "overlay", TB_AUTOWIDTH | TB_AUTOHEIGHT, URGENT, "blaat", 0.5, 0 );
|
||||
widget_disable ( WIDGET ( state->overlay ) );
|
||||
|
||||
// filtered list
|
||||
|
|
|
@ -74,7 +74,7 @@ void container_add ( container *container, widget *child )
|
|||
return;
|
||||
}
|
||||
container->child = child;
|
||||
g_assert ( child->parent == WIDGET ( container ));
|
||||
g_assert ( child->parent == WIDGET ( container ) );
|
||||
widget_update ( WIDGET ( container ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ static void listview_recompute_elements ( listview *lv )
|
|||
for ( unsigned int i = lv->cur_elements; i < newne; i++ ) {
|
||||
TextboxFlags flags = ( lv->multi_select ) ? TB_INDICATOR : 0;
|
||||
flags |= ( ( config.show_icons ) ? TB_ICON : 0 );
|
||||
lv->boxes[i] = textbox_create ( WIDGET (lv), WIDGET_TYPE_LISTVIEW_ELEMENT, "element", flags, NORMAL, "", 0, 0 );
|
||||
lv->boxes[i] = textbox_create ( WIDGET ( lv ), WIDGET_TYPE_LISTVIEW_ELEMENT, "element", flags, NORMAL, "", 0, 0 );
|
||||
widget_set_trigger_action_handler ( WIDGET ( lv->boxes[i] ), listview_element_trigger_action, lv );
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ static WidgetTriggerActionResult listview_element_trigger_action ( widget *wid,
|
|||
break;
|
||||
case ACCEPT_HOVERED_CUSTOM:
|
||||
custom = TRUE;
|
||||
/* FALLTHRU */
|
||||
/* FALLTHRU */
|
||||
case ACCEPT_HOVERED_ENTRY:
|
||||
listview_set_selected ( lv, lv->last_offset + i );
|
||||
lv->mouse_activated ( lv, custom, lv->mouse_activated_data );
|
||||
|
@ -513,8 +513,8 @@ static WidgetTriggerActionResult listview_element_trigger_action ( widget *wid,
|
|||
|
||||
listview *listview_create ( widget *parent, const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse )
|
||||
{
|
||||
listview *lv = g_malloc0 ( sizeof ( listview ) );
|
||||
widget_init ( WIDGET ( lv ), parent, WIDGET_TYPE_LISTVIEW, name );
|
||||
listview *lv = g_malloc0 ( sizeof ( listview ) );
|
||||
widget_init ( WIDGET ( lv ), parent, WIDGET_TYPE_LISTVIEW, name );
|
||||
lv->listview_name = g_strdup ( name );
|
||||
lv->widget.free = listview_free;
|
||||
lv->widget.resize = listview_resize;
|
||||
|
@ -524,10 +524,10 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca
|
|||
lv->widget.get_desired_height = listview_get_desired_height;
|
||||
lv->eh = eh;
|
||||
|
||||
lv->scrollbar = scrollbar_create ( WIDGET ( lv ) , "scrollbar" );
|
||||
lv->scrollbar = scrollbar_create ( WIDGET ( lv ), "scrollbar" );
|
||||
// Calculate height of an element.
|
||||
//
|
||||
textbox *tb = textbox_create ( WIDGET (lv), WIDGET_TYPE_LISTVIEW_ELEMENT, "element", 0, NORMAL, "", 0, 0 );
|
||||
textbox *tb = textbox_create ( WIDGET ( lv ), WIDGET_TYPE_LISTVIEW_ELEMENT, "element", 0, NORMAL, "", 0, 0 );
|
||||
lv->element_height = textbox_get_estimated_height ( tb, lv->eh );
|
||||
widget_free ( WIDGET ( tb ) );
|
||||
|
||||
|
|
|
@ -182,7 +182,6 @@ textbox* textbox_create ( widget *parent, WidgetType type, const char *name, Tex
|
|||
tb->layout = pango_layout_new ( p_context );
|
||||
textbox_font ( tb, tbft );
|
||||
|
||||
|
||||
textbox_initialize_font ( tb );
|
||||
|
||||
if ( ( tb->flags & TB_ICON ) != TB_ICON ) {
|
||||
|
@ -431,11 +430,11 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
|
||||
int iconh = cairo_image_surface_get_height ( tb->icon );
|
||||
int iconw = cairo_image_surface_get_width ( tb->icon );
|
||||
int icons = MAX(iconh, iconw);
|
||||
int icons = MAX ( iconh, iconw );
|
||||
double scale = (double) iconheight / icons;
|
||||
cairo_translate ( draw, x+(iconheight-iconw*scale)/2.0, y+(iconheight-iconh*scale)/2.0 );
|
||||
cairo_translate ( draw, x + ( iconheight - iconw * scale ) / 2.0, y + ( iconheight - iconh * scale ) / 2.0 );
|
||||
cairo_scale ( draw, scale, scale );
|
||||
cairo_set_source_surface ( draw, tb->icon, 0,0);
|
||||
cairo_set_source_surface ( draw, tb->icon, 0, 0 );
|
||||
cairo_paint ( draw );
|
||||
cairo_restore ( draw );
|
||||
}
|
||||
|
|
|
@ -912,7 +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_DO_NOT_CHANGE_CURRENT_DESKTOP|WM_PANGO_WORKSPACE_NAMES;
|
||||
current_window_manager = WM_DO_NOT_CHANGE_CURRENT_DESKTOP | WM_PANGO_WORKSPACE_NAMES;
|
||||
}
|
||||
}
|
||||
xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle );
|
||||
|
|
Loading…
Reference in a new issue