mirror of
https://github.com/lbonn/rofi
synced 2025-03-01 05:37:08 +00:00
Run indenter
This commit is contained in:
parent
dc1b15945a
commit
d3e96f2762
27 changed files with 938 additions and 882 deletions
|
@ -64,7 +64,7 @@ extern struct _display_proxy * const xcb_proxy;
|
|||
extern struct _display_proxy * const wayland_proxy;
|
||||
#endif
|
||||
|
||||
void display_init( const struct _display_proxy *disp_in );
|
||||
void display_init ( const struct _display_proxy *disp_in );
|
||||
|
||||
/**
|
||||
* @param mon workarea to be filled in.
|
||||
|
|
|
@ -104,22 +104,21 @@ typedef enum
|
|||
ROFI_DISTANCE_MODIFIER_GROUP,
|
||||
} RofiDistanceModifier;
|
||||
|
||||
typedef struct RofiDistanceUnit
|
||||
typedef struct RofiDistanceUnit
|
||||
{
|
||||
/** Distance */
|
||||
double distance;
|
||||
double distance;
|
||||
/** Unit type of the distance */
|
||||
RofiPixelUnit type;
|
||||
RofiPixelUnit type;
|
||||
|
||||
/** Type */
|
||||
RofiDistanceModifier modtype;
|
||||
RofiDistanceModifier modtype;
|
||||
|
||||
/** Modifier */
|
||||
struct RofiDistanceUnit *left;
|
||||
|
||||
/** Modifier */
|
||||
struct RofiDistanceUnit *right;
|
||||
|
||||
} RofiDistanceUnit;
|
||||
|
||||
typedef struct
|
||||
|
@ -127,7 +126,7 @@ typedef struct
|
|||
/** Base */
|
||||
RofiDistanceUnit base;
|
||||
/** Style of the line (optional)*/
|
||||
RofiLineStyle style;
|
||||
RofiLineStyle style;
|
||||
} RofiDistance;
|
||||
|
||||
/**
|
||||
|
|
|
@ -249,7 +249,6 @@ double rofi_theme_get_double ( const widget *widget, const char *property, doub
|
|||
*/
|
||||
void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t *d );
|
||||
|
||||
|
||||
/**
|
||||
* @param widget The widget to query
|
||||
* @param property The property to query.
|
||||
|
|
|
@ -132,7 +132,7 @@ struct RofiViewState
|
|||
#ifdef ENABLE_WAYLAND
|
||||
/** wayland */
|
||||
display_buffer_pool *pool;
|
||||
gboolean frame_callback;
|
||||
gboolean frame_callback;
|
||||
#endif
|
||||
|
||||
/** Position and target of the mouse. */
|
||||
|
@ -151,34 +151,35 @@ struct RofiViewState
|
|||
};
|
||||
/** @} */
|
||||
|
||||
typedef struct _view_proxy {
|
||||
void (*update) ( RofiViewState *state, gboolean qr );
|
||||
void (*maybe_update) ( RofiViewState *state );
|
||||
void (*temp_configure_notify) ( RofiViewState *state, xcb_configure_notify_event_t *xce );
|
||||
void (*temp_click_to_exit) ( RofiViewState *state, xcb_window_t target );
|
||||
void (*frame_callback) ( void );
|
||||
typedef struct _view_proxy
|
||||
{
|
||||
void ( *update )( RofiViewState *state, gboolean qr );
|
||||
void ( *maybe_update )( RofiViewState *state );
|
||||
void ( *temp_configure_notify )( RofiViewState *state, xcb_configure_notify_event_t *xce );
|
||||
void ( *temp_click_to_exit )( RofiViewState *state, xcb_window_t target );
|
||||
void ( *frame_callback )( void );
|
||||
|
||||
void (*queue_redraw) ( void );
|
||||
void ( *queue_redraw )( void );
|
||||
|
||||
void (*set_window_title) ( const char * title );
|
||||
void (*calculate_window_position) ( RofiViewState *state );
|
||||
void (*calculate_window_width) ( RofiViewState *state );
|
||||
int (*calculate_window_height) ( RofiViewState *state );
|
||||
void (*window_update_size) ( RofiViewState *state );
|
||||
void ( *set_window_title )( const char * title );
|
||||
void ( *calculate_window_position )( RofiViewState *state );
|
||||
void ( *calculate_window_width )( RofiViewState *state );
|
||||
int ( *calculate_window_height )( RofiViewState *state );
|
||||
void ( *window_update_size )( RofiViewState *state );
|
||||
|
||||
void (*cleanup) ( void );
|
||||
void (*hide) ( void );
|
||||
void (*reload) ( void );
|
||||
void (*__create_window) ( MenuFlags menu_flags );
|
||||
xcb_window_t (*get_window) ( void );
|
||||
void ( *cleanup )( void );
|
||||
void ( *hide )( void );
|
||||
void ( *reload )( void );
|
||||
void ( *__create_window )( MenuFlags menu_flags );
|
||||
xcb_window_t ( *get_window )( void );
|
||||
|
||||
void (*get_current_monitor) ( int *width, int *height );
|
||||
void (*capture_screenshot) ( void );
|
||||
void ( *get_current_monitor )( int *width, int *height );
|
||||
void ( *capture_screenshot )( void );
|
||||
|
||||
void (*set_size) ( RofiViewState * state, gint width, gint height );
|
||||
void (*get_size) ( RofiViewState * state, gint *width, gint *height );
|
||||
void ( *set_size )( RofiViewState * state, gint width, gint height );
|
||||
void ( *get_size )( RofiViewState * state, gint *width, gint *height );
|
||||
|
||||
void (*pool_refresh) ( );
|
||||
void ( *pool_refresh )( );
|
||||
} view_proxy;
|
||||
|
||||
/**
|
||||
|
@ -187,11 +188,11 @@ typedef struct _view_proxy {
|
|||
struct _rofi_view_cache_state
|
||||
{
|
||||
/** main x11 windows */
|
||||
xcb_window_t main_window;
|
||||
xcb_window_t main_window;
|
||||
/** Main flags */
|
||||
MenuFlags flags;
|
||||
MenuFlags flags;
|
||||
/** List of stacked views */
|
||||
GQueue views;
|
||||
GQueue views;
|
||||
};
|
||||
extern struct _rofi_view_cache_state CacheState;
|
||||
|
||||
|
|
|
@ -326,6 +326,6 @@ extern const struct _view_proxy *xcb_view_proxy;
|
|||
extern const struct _view_proxy *wayland_view_proxy;
|
||||
#endif
|
||||
|
||||
void view_init( const struct _view_proxy *view_in );
|
||||
void view_init ( const struct _view_proxy *view_in );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,94 +11,102 @@
|
|||
|
||||
#include "wayland.h"
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
WAYLAND_GLOBAL_COMPOSITOR,
|
||||
WAYLAND_GLOBAL_SHM,
|
||||
WAYLAND_GLOBAL_LAYER_SHELL,
|
||||
_WAYLAND_GLOBAL_SIZE,
|
||||
} wayland_global_name;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
uint32_t button;
|
||||
char modifiers;
|
||||
gint x, y;
|
||||
char modifiers;
|
||||
gint x, y;
|
||||
gboolean pressed;
|
||||
guint32 time;
|
||||
guint32 time;
|
||||
} widget_button_event;
|
||||
|
||||
typedef struct {
|
||||
gint x, y;
|
||||
typedef struct
|
||||
{
|
||||
gint x, y;
|
||||
guint32 time;
|
||||
} widget_motion_event;
|
||||
|
||||
typedef struct _wayland_seat wayland_seat;
|
||||
|
||||
typedef struct {
|
||||
GMainLoop *main_loop;
|
||||
GWaterWaylandSource *main_loop_source;
|
||||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
uint32_t global_names[_WAYLAND_GLOBAL_SIZE];
|
||||
struct wl_compositor *compositor;
|
||||
struct zww_launcher_menu_v1 *launcher_menu;
|
||||
typedef struct
|
||||
{
|
||||
GMainLoop *main_loop;
|
||||
GWaterWaylandSource *main_loop_source;
|
||||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
uint32_t global_names[_WAYLAND_GLOBAL_SIZE];
|
||||
struct wl_compositor *compositor;
|
||||
struct zww_launcher_menu_v1 *launcher_menu;
|
||||
struct zww_window_switcher_v1 *window_switcher;
|
||||
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
|
||||
struct wl_shm *shm;
|
||||
size_t buffer_count;
|
||||
struct {
|
||||
char *theme_name;
|
||||
char **name;
|
||||
struct wl_shm *shm;
|
||||
size_t buffer_count;
|
||||
struct
|
||||
{
|
||||
char *theme_name;
|
||||
char **name;
|
||||
struct wl_cursor_theme *theme;
|
||||
struct wl_cursor *cursor;
|
||||
struct wl_cursor *cursor;
|
||||
struct wl_cursor_image *image;
|
||||
struct wl_surface *surface;
|
||||
struct wl_callback *frame_cb;
|
||||
} cursor;
|
||||
GHashTable *seats;
|
||||
GHashTable *seats_by_name;
|
||||
wayland_seat *last_seat;
|
||||
GHashTable *outputs;
|
||||
struct wl_surface *surface;
|
||||
struct wl_surface *surface;
|
||||
struct wl_callback *frame_cb;
|
||||
} cursor;
|
||||
GHashTable *seats;
|
||||
GHashTable *seats_by_name;
|
||||
wayland_seat *last_seat;
|
||||
GHashTable *outputs;
|
||||
struct wl_surface *surface;
|
||||
struct zwlr_layer_surface_v1* wlr_surface;
|
||||
struct wl_callback *frame_cb;
|
||||
size_t scales[3];
|
||||
int32_t scale;
|
||||
NkBindingsSeat *bindings_seat;
|
||||
struct wl_callback *frame_cb;
|
||||
size_t scales[3];
|
||||
int32_t scale;
|
||||
NkBindingsSeat *bindings_seat;
|
||||
|
||||
uint32_t layer_width;
|
||||
uint32_t layer_height;
|
||||
uint32_t layer_width;
|
||||
uint32_t layer_height;
|
||||
} wayland_stuff;
|
||||
|
||||
struct _wayland_seat {
|
||||
wayland_stuff *context;
|
||||
uint32_t global_name;
|
||||
struct _wayland_seat
|
||||
{
|
||||
wayland_stuff *context;
|
||||
uint32_t global_name;
|
||||
struct wl_seat *seat;
|
||||
gchar *name;
|
||||
struct {
|
||||
gchar *name;
|
||||
struct
|
||||
{
|
||||
xkb_keycode_t key;
|
||||
GSource *source;
|
||||
int32_t rate;
|
||||
int32_t delay;
|
||||
} repeat;
|
||||
uint32_t serial;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct wl_pointer *pointer;
|
||||
GSource *source;
|
||||
int32_t rate;
|
||||
int32_t delay;
|
||||
} repeat;
|
||||
uint32_t serial;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct wl_pointer *pointer;
|
||||
widget_button_event button;
|
||||
widget_motion_event motion;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
gint vertical;
|
||||
gint horizontal;
|
||||
} wheel;
|
||||
};
|
||||
|
||||
/* Supported interface versions */
|
||||
#define WL_COMPOSITOR_INTERFACE_VERSION 3
|
||||
#define WL_SHM_INTERFACE_VERSION 1
|
||||
#define WL_SEAT_INTERFACE_VERSION 5
|
||||
#define WL_OUTPUT_INTERFACE_VERSION 2
|
||||
#define WL_LAYER_SHELL_INTERFACE_VERSION 1
|
||||
#define WL_COMPOSITOR_INTERFACE_VERSION 3
|
||||
#define WL_SHM_INTERFACE_VERSION 1
|
||||
#define WL_SEAT_INTERFACE_VERSION 5
|
||||
#define WL_OUTPUT_INTERFACE_VERSION 2
|
||||
#define WL_LAYER_SHELL_INTERFACE_VERSION 1
|
||||
|
||||
extern wayland_stuff *wayland;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ struct _widget
|
|||
int ( *get_desired_height )( struct _widget * );
|
||||
int ( *get_desired_width )( struct _widget * );
|
||||
|
||||
void ( *set_state ) ( struct _widget *, const char *);
|
||||
void ( *set_state ) ( struct _widget *, const char * );
|
||||
|
||||
/** widget find_mouse_target callback */
|
||||
widget_find_mouse_target_cb find_mouse_target;
|
||||
|
|
|
@ -172,7 +172,8 @@ void widget_set_enabled ( widget *widget, gboolean enabled );
|
|||
* Disable the widget.
|
||||
*/
|
||||
static inline
|
||||
void widget_disable ( widget *widget ) {
|
||||
void widget_disable ( widget *widget )
|
||||
{
|
||||
widget_set_enabled ( widget, FALSE );
|
||||
}
|
||||
/**
|
||||
|
@ -181,7 +182,8 @@ void widget_disable ( widget *widget ) {
|
|||
* Enable the widget.
|
||||
*/
|
||||
static inline
|
||||
void widget_enable ( widget *widget ) {
|
||||
void widget_enable ( widget *widget )
|
||||
{
|
||||
widget_set_enabled ( widget, TRUE );
|
||||
}
|
||||
|
||||
|
|
|
@ -155,11 +155,11 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||
CombiModePrivateData *pd = mode_get_private_data ( sw );
|
||||
|
||||
if ( input[0][0] == '!' ) {
|
||||
int switcher = -1;
|
||||
int switcher = -1;
|
||||
// Implement strchrnul behaviour.
|
||||
char *eob = g_utf8_strchr ( input[0], -1,' ' );
|
||||
char *eob = g_utf8_strchr ( input[0], -1, ' ' );
|
||||
if ( eob == NULL ) {
|
||||
eob = &(input[0][strlen(input[0])]);
|
||||
eob = &( input[0][strlen ( input[0] )] );
|
||||
}
|
||||
ssize_t bang_len = g_utf8_pointer_to_offset ( input[0], eob ) - 1;
|
||||
if ( bang_len > 0 ) {
|
||||
|
@ -282,10 +282,10 @@ static char * combi_preprocess_input ( Mode *sw, const char *input )
|
|||
}
|
||||
if ( input != NULL && input[0] == '!' ) {
|
||||
// Implement strchrnul behaviour.
|
||||
const char *eob = g_utf8_strchr ( input, -1, ' ' );
|
||||
const char *eob = g_utf8_strchr ( input, -1, ' ' );
|
||||
if ( eob == NULL ) {
|
||||
// Set it to end.
|
||||
eob = &(input[strlen(input)]);
|
||||
eob = &( input[strlen ( input )] );
|
||||
}
|
||||
ssize_t bang_len = g_utf8_pointer_to_offset ( input, eob ) - 1;
|
||||
if ( bang_len > 0 ) {
|
||||
|
|
|
@ -122,7 +122,7 @@ static void read_add ( DmenuModePrivateData * pd, char *data, gsize len )
|
|||
pd->cmd_list[pd->cmd_list_length].icon_fetch_uid = 0;
|
||||
pd->cmd_list[pd->cmd_list_length].icon_name = NULL;
|
||||
pd->cmd_list[pd->cmd_list_length].meta = NULL;
|
||||
pd->cmd_list[pd->cmd_list_length].info = NULL;
|
||||
pd->cmd_list[pd->cmd_list_length].info = NULL;
|
||||
char *end = strchr ( data, '\0' );
|
||||
if ( end != NULL ) {
|
||||
data_len = end - data;
|
||||
|
@ -736,7 +736,6 @@ int dmenu_switcher_dialog ( void )
|
|||
find_arg_str ( "-p", &( dmenu_mode.display_name ) );
|
||||
RofiViewState *state = rofi_view_create ( &dmenu_mode, input, menu_flags, dmenu_finalize );
|
||||
|
||||
|
||||
if ( find_arg ( "-keep-right" ) >= 0 ) {
|
||||
rofi_view_ellipsize_start ( state );
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ static gboolean drun_helper_eval_cb ( const GMatchInfo *info, GString *res, gpoi
|
|||
case 'm':
|
||||
break;
|
||||
case '%':
|
||||
g_string_append(res, "%");
|
||||
g_string_append ( res, "%" );
|
||||
break;
|
||||
case 'k':
|
||||
if ( e->e->path ) {
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct
|
|||
char *message;
|
||||
char *prompt;
|
||||
gboolean do_markup;
|
||||
char delim;
|
||||
char delim;
|
||||
/** no custom */
|
||||
gboolean no_custom;
|
||||
} ScriptModePrivateData;
|
||||
|
@ -80,10 +80,9 @@ void dmenuscript_parse_entry_extras ( G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *
|
|||
{
|
||||
gchar **extras = g_strsplit ( buffer, "\x1f", -1 );
|
||||
gchar **extra;
|
||||
for ( extra = extras ; *extra != NULL && *(extra + 1) != NULL ; extra += 2 )
|
||||
{
|
||||
gchar *key = *extra;
|
||||
gchar *value = *(extra + 1);
|
||||
for ( extra = extras; *extra != NULL && *( extra + 1 ) != NULL; extra += 2 ) {
|
||||
gchar *key = *extra;
|
||||
gchar *value = *( extra + 1 );
|
||||
if ( strcasecmp ( key, "icon" ) == 0 ) {
|
||||
entry->icon_name = value;
|
||||
}
|
||||
|
@ -95,14 +94,14 @@ void dmenuscript_parse_entry_extras ( G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *
|
|||
}
|
||||
else if ( strcasecmp ( key, "nonselectable" ) == 0 ) {
|
||||
entry->nonselectable = strcasecmp ( value, "true" ) == 0;
|
||||
g_free(value);
|
||||
g_free ( value );
|
||||
}
|
||||
else {
|
||||
g_free(value);
|
||||
g_free ( value );
|
||||
}
|
||||
g_free(key);
|
||||
g_free ( key );
|
||||
}
|
||||
g_free(extras);
|
||||
g_free ( extras );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,7 +116,7 @@ static void parse_header_entry ( Mode *sw, char *line, ssize_t length )
|
|||
length_key++;
|
||||
}
|
||||
|
||||
if ( (length_key+1) < length ) {
|
||||
if ( ( length_key + 1 ) < length ) {
|
||||
line[length_key] = '\0';
|
||||
char *value = line + length_key + 1;
|
||||
if ( strcasecmp ( line, "message" ) == 0 ) {
|
||||
|
@ -140,39 +139,38 @@ static void parse_header_entry ( Mode *sw, char *line, ssize_t length )
|
|||
}
|
||||
else if ( strcasecmp ( line, "delim" ) == 0 ) {
|
||||
pd->delim = helper_parse_char ( value );
|
||||
} else if ( strcasecmp ( line, "no-custom" ) == 0 ) {
|
||||
pd->no_custom = ( strcasecmp ( value, "true") == 0 );
|
||||
}
|
||||
else if ( strcasecmp ( line, "no-custom" ) == 0 ) {
|
||||
pd->no_custom = ( strcasecmp ( value, "true" ) == 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static DmenuScriptEntry *execute_executor ( Mode *sw, char *arg, unsigned int *length, int value, DmenuScriptEntry *entry )
|
||||
{
|
||||
ScriptModePrivateData *pd = (ScriptModePrivateData *) sw->private_data;
|
||||
int fd = -1;
|
||||
GError *error = NULL;
|
||||
DmenuScriptEntry *retv = NULL;
|
||||
char **argv = NULL;
|
||||
int argc = 0;
|
||||
ScriptModePrivateData *pd = (ScriptModePrivateData *) sw->private_data;
|
||||
int fd = -1;
|
||||
GError *error = NULL;
|
||||
DmenuScriptEntry *retv = NULL;
|
||||
char **argv = NULL;
|
||||
int argc = 0;
|
||||
*length = 0;
|
||||
|
||||
|
||||
// Environment
|
||||
char ** env = g_get_environ ();
|
||||
|
||||
char *str_value = g_strdup_printf("%d", value);
|
||||
env = g_environ_setenv ( env, "ROFI_RETV", str_value, TRUE);
|
||||
char *str_value = g_strdup_printf ( "%d", value );
|
||||
env = g_environ_setenv ( env, "ROFI_RETV", str_value, TRUE );
|
||||
g_free ( str_value );
|
||||
|
||||
str_value = g_strdup_printf("%d", (int) getpid());
|
||||
env = g_environ_setenv ( env, "ROFI_OUTSIDE", str_value, TRUE);
|
||||
str_value = g_strdup_printf ( "%d", (int) getpid () );
|
||||
env = g_environ_setenv ( env, "ROFI_OUTSIDE", str_value, TRUE );
|
||||
g_free ( str_value );
|
||||
|
||||
if ( entry && entry->info ) {
|
||||
env = g_environ_setenv ( env, "ROFI_INFO", entry->info, TRUE);
|
||||
env = g_environ_setenv ( env, "ROFI_INFO", entry->info, TRUE );
|
||||
}
|
||||
|
||||
|
||||
if ( g_shell_parse_argv ( sw->ed, &argc, &argv, &error ) ) {
|
||||
argv = g_realloc ( argv, ( argc + 2 ) * sizeof ( char* ) );
|
||||
argv[argc] = g_strdup ( arg );
|
||||
|
@ -181,7 +179,7 @@ static DmenuScriptEntry *execute_executor ( Mode *sw, char *arg, unsigned int *l
|
|||
}
|
||||
g_strfreev ( env );
|
||||
if ( error != NULL ) {
|
||||
char *msg = g_strdup_printf ( "Failed to execute: '%s'\nError: '%s'", (char*)sw->ed, error->message );
|
||||
char *msg = g_strdup_printf ( "Failed to execute: '%s'\nError: '%s'", (char*) sw->ed, error->message );
|
||||
rofi_view_error_dialog ( msg, FALSE );
|
||||
g_free ( msg );
|
||||
// print error.
|
||||
|
@ -249,7 +247,7 @@ static int script_mode_init ( Mode *sw )
|
|||
{
|
||||
if ( sw->private_data == NULL ) {
|
||||
ScriptModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) );
|
||||
pd->delim = '\n';
|
||||
pd->delim = '\n';
|
||||
sw->private_data = (void *) pd;
|
||||
pd->cmd_list = execute_executor ( sw, NULL, &( pd->cmd_list_length ), 0, NULL );
|
||||
}
|
||||
|
@ -290,11 +288,13 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||
//retv = 1+( mretv & MENU_LOWER_MASK );
|
||||
script_mode_reset_highlight ( sw );
|
||||
if ( selected_line != UINT32_MAX ) {
|
||||
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length,10+( mretv & MENU_LOWER_MASK ), &(rmpd->cmd_list[selected_line]) );
|
||||
} else {
|
||||
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), &( rmpd->cmd_list[selected_line] ) );
|
||||
}
|
||||
else {
|
||||
if ( rmpd->no_custom == FALSE ) {
|
||||
new_list = execute_executor ( sw, *input, &new_length,10+( mretv & MENU_LOWER_MASK ), NULL );
|
||||
} else {
|
||||
new_list = execute_executor ( sw, *input, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), NULL );
|
||||
}
|
||||
else {
|
||||
return RELOAD_DIALOG;
|
||||
}
|
||||
}
|
||||
|
@ -304,13 +304,14 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||
return RELOAD_DIALOG;
|
||||
}
|
||||
script_mode_reset_highlight ( sw );
|
||||
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 1, &(rmpd->cmd_list[selected_line]) );
|
||||
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 1, &( rmpd->cmd_list[selected_line] ) );
|
||||
}
|
||||
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
||||
if ( rmpd->no_custom == FALSE ) {
|
||||
script_mode_reset_highlight ( sw );
|
||||
new_list = execute_executor ( sw, *input, &new_length, 2 , NULL );
|
||||
} else {
|
||||
new_list = execute_executor ( sw, *input, &new_length, 2, NULL );
|
||||
}
|
||||
else {
|
||||
return RELOAD_DIALOG;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -464,7 +464,7 @@ static const char * _window_name_list_entry ( const char *str, uint32_t length,
|
|||
}
|
||||
offset++;
|
||||
}
|
||||
if ( offset >= length ){
|
||||
if ( offset >= length ) {
|
||||
return invalid_desktop_name;
|
||||
}
|
||||
return &str[offset];
|
||||
|
|
|
@ -10,22 +10,22 @@
|
|||
|
||||
static const display_proxy *proxy;
|
||||
|
||||
void display_init( const display_proxy *disp_in )
|
||||
void display_init ( const display_proxy *disp_in )
|
||||
{
|
||||
proxy = disp_in;
|
||||
view_init( proxy->view() );
|
||||
view_init ( proxy->view () );
|
||||
}
|
||||
|
||||
int
|
||||
monitor_active ( workarea *mon )
|
||||
{
|
||||
return proxy->monitor_active( mon );
|
||||
return proxy->monitor_active ( mon );
|
||||
}
|
||||
|
||||
gboolean
|
||||
display_setup ( GMainLoop *main_loop, NkBindings *bindings )
|
||||
{
|
||||
return proxy->setup( main_loop, bindings );
|
||||
return proxy->setup ( main_loop, bindings );
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -133,64 +133,66 @@ void rofi_icon_fetcher_destroy ( void )
|
|||
g_free ( rofi_icon_fetcher_data );
|
||||
}
|
||||
|
||||
static cairo_surface_t* cairo_image_surface_create_from_jpeg_private ( struct jpeg_decompress_struct* cinfo )
|
||||
{
|
||||
cairo_surface_t* surface = 0;
|
||||
unsigned char * data = 0;
|
||||
unsigned char * rgb = 0;
|
||||
|
||||
jpeg_read_header ( cinfo, TRUE );
|
||||
jpeg_start_decompress ( cinfo );
|
||||
|
||||
static cairo_surface_t* cairo_image_surface_create_from_jpeg_private(struct jpeg_decompress_struct* cinfo) {
|
||||
cairo_surface_t* surface = 0;
|
||||
unsigned char* data = 0;
|
||||
unsigned char* rgb = 0;
|
||||
surface = cairo_image_surface_create ( CAIRO_FORMAT_RGB24, cinfo->image_width, cinfo->image_height );
|
||||
data = cairo_image_surface_get_data ( surface );
|
||||
rgb = (unsigned char*) ( malloc ( cinfo->output_width * cinfo->output_components ) );
|
||||
|
||||
jpeg_read_header(cinfo, TRUE);
|
||||
jpeg_start_decompress(cinfo);
|
||||
while ( cinfo->output_scanline < cinfo->output_height ) {
|
||||
unsigned int i;
|
||||
int scanline = cinfo->output_scanline * cairo_image_surface_get_stride ( surface );
|
||||
|
||||
surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, cinfo->image_width, cinfo->image_height);
|
||||
data = cairo_image_surface_get_data(surface);
|
||||
rgb = (unsigned char*)(malloc(cinfo->output_width * cinfo->output_components));
|
||||
jpeg_read_scanlines ( cinfo, &rgb, 1 );
|
||||
|
||||
while(cinfo->output_scanline < cinfo->output_height) {
|
||||
unsigned int i;
|
||||
int scanline = cinfo->output_scanline * cairo_image_surface_get_stride(surface);
|
||||
for ( i = 0; i < cinfo->output_width; i++ ) {
|
||||
int offset = scanline + ( i * 4 );
|
||||
|
||||
jpeg_read_scanlines(cinfo, &rgb, 1);
|
||||
data[offset + 3] = 255;
|
||||
data[offset + 2] = rgb[( i * 3 )];
|
||||
data[offset + 1] = rgb[( i * 3 ) + 1];
|
||||
data[offset ] = rgb[( i * 3 ) + 2];
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < cinfo->output_width; i++) {
|
||||
int offset = scanline + (i * 4);
|
||||
free ( rgb );
|
||||
|
||||
data[offset + 3] = 255;
|
||||
data[offset + 2] = rgb[(i * 3)];
|
||||
data[offset + 1] = rgb[(i * 3) + 1];
|
||||
data[offset ] = rgb[(i * 3) + 2];
|
||||
}
|
||||
}
|
||||
jpeg_finish_decompress ( cinfo );
|
||||
jpeg_destroy_decompress ( cinfo );
|
||||
|
||||
free(rgb);
|
||||
cairo_surface_mark_dirty ( surface );
|
||||
|
||||
jpeg_finish_decompress(cinfo);
|
||||
jpeg_destroy_decompress(cinfo);
|
||||
|
||||
cairo_surface_mark_dirty(surface);
|
||||
|
||||
return surface;
|
||||
return surface;
|
||||
}
|
||||
|
||||
static cairo_surface_t* cairo_image_surface_create_from_jpeg(const char* file) {
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
cairo_surface_t* surface;
|
||||
FILE* infile;
|
||||
static cairo_surface_t* cairo_image_surface_create_from_jpeg ( const char* file )
|
||||
{
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
cairo_surface_t * surface;
|
||||
FILE * infile;
|
||||
|
||||
if((infile = fopen(file, "rb")) == NULL) return NULL;
|
||||
if ( ( infile = fopen ( file, "rb" ) ) == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
cinfo.err = jpeg_std_error ( &jerr );
|
||||
|
||||
jpeg_create_decompress(&cinfo);
|
||||
jpeg_stdio_src(&cinfo, infile);
|
||||
jpeg_create_decompress ( &cinfo );
|
||||
jpeg_stdio_src ( &cinfo, infile );
|
||||
|
||||
surface = cairo_image_surface_create_from_jpeg_private(&cinfo);
|
||||
surface = cairo_image_surface_create_from_jpeg_private ( &cinfo );
|
||||
|
||||
fclose(infile);
|
||||
fclose ( infile );
|
||||
|
||||
return surface;
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void rofi_icon_fetcher_worker ( thread_state *sdata, G_GNUC_UNUSED gpointer user_data )
|
||||
|
@ -235,29 +237,26 @@ static void rofi_icon_fetcher_worker ( thread_state *sdata, G_GNUC_UNUSED gpoint
|
|||
}
|
||||
if ( icon_surf ) {
|
||||
if ( cairo_surface_status ( icon_surf ) == CAIRO_STATUS_SUCCESS ) {
|
||||
float sw = sentry->size/(float)cairo_image_surface_get_width( icon_surf );
|
||||
float sh = sentry->size/(float)cairo_image_surface_get_height( icon_surf );
|
||||
float sw = sentry->size / (float) cairo_image_surface_get_width ( icon_surf );
|
||||
float sh = sentry->size / (float) cairo_image_surface_get_height ( icon_surf );
|
||||
|
||||
float scale = ( sw > sh)? sh:sw;
|
||||
if ( scale < 0.5 )
|
||||
{
|
||||
cairo_surface_t * surface = cairo_image_surface_create(
|
||||
cairo_image_surface_get_format( icon_surf ),
|
||||
cairo_image_surface_get_width( icon_surf )*scale,
|
||||
cairo_image_surface_get_height( icon_surf )*scale);
|
||||
float scale = ( sw > sh ) ? sh : sw;
|
||||
if ( scale < 0.5 ) {
|
||||
cairo_surface_t * surface = cairo_image_surface_create (
|
||||
cairo_image_surface_get_format ( icon_surf ),
|
||||
cairo_image_surface_get_width ( icon_surf ) * scale,
|
||||
cairo_image_surface_get_height ( icon_surf ) * scale );
|
||||
|
||||
cairo_t *d = cairo_create ( surface );
|
||||
cairo_scale ( d, scale, scale );
|
||||
cairo_set_source_surface ( d, icon_surf, 0.0,0.0);
|
||||
cairo_pattern_set_filter (cairo_get_source (d), CAIRO_FILTER_FAST);
|
||||
cairo_set_source_surface ( d, icon_surf, 0.0, 0.0 );
|
||||
cairo_pattern_set_filter ( cairo_get_source ( d ), CAIRO_FILTER_FAST );
|
||||
cairo_paint ( d );
|
||||
|
||||
cairo_destroy ( d );
|
||||
cairo_surface_destroy ( icon_surf );
|
||||
icon_surf = surface;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// check if surface is valid.
|
||||
if ( cairo_surface_status ( icon_surf ) != CAIRO_STATUS_SUCCESS ) {
|
||||
|
|
|
@ -193,10 +193,10 @@ static void run_switcher ( ModeMode mode )
|
|||
RofiViewState * state = rofi_view_create ( modi[mode], config.filter, 0, process_result );
|
||||
|
||||
// User can pre-select a row.
|
||||
if ( find_arg ( "-selected-row" ) >= 0 ){
|
||||
unsigned int sr = 0;
|
||||
find_arg_uint ( "-selected-row", &(sr) );
|
||||
rofi_view_set_selected_line ( state, sr );
|
||||
if ( find_arg ( "-selected-row" ) >= 0 ) {
|
||||
unsigned int sr = 0;
|
||||
find_arg_uint ( "-selected-row", &( sr ) );
|
||||
rofi_view_set_selected_line ( state, sr );
|
||||
}
|
||||
if ( state ) {
|
||||
rofi_view_set_active ( state );
|
||||
|
@ -512,7 +512,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
|
|||
if ( !g_str_has_suffix ( dn, G_MODULE_SUFFIX ) ) {
|
||||
continue;
|
||||
}
|
||||
char *fn = g_build_filename ( base_dir, dn, NULL );
|
||||
char *fn = g_build_filename ( base_dir, dn, NULL );
|
||||
g_debug ( "Trying to open: %s plugin", fn );
|
||||
GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
|
||||
if ( mod ) {
|
||||
|
@ -567,7 +567,7 @@ static void rofi_collect_modi ( void )
|
|||
g_debug ( "Parse plugin path: %s", config.plugin_path );
|
||||
rofi_collect_modi_dir ( config.plugin_path );
|
||||
/* ROFI_PLUGIN_PATH */
|
||||
const char *path = g_getenv("ROFI_PLUGIN_PATH");
|
||||
const char *path = g_getenv ( "ROFI_PLUGIN_PATH" );
|
||||
if ( path != NULL ) {
|
||||
gchar ** paths = g_strsplit ( path, ":", -1 );
|
||||
for ( unsigned int i = 0; paths[i]; i++ ) {
|
||||
|
@ -791,12 +791,12 @@ int main ( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
{
|
||||
const char *ro_pid = g_getenv("ROFI_OUTSIDE");
|
||||
const char *ro_pid = g_getenv ( "ROFI_OUTSIDE" );
|
||||
if ( ro_pid != NULL ) {
|
||||
int ro_pidi = g_ascii_strtoll ( ro_pid, NULL, 0 );
|
||||
if ( kill ( ro_pidi, 0 ) == 0 ) {
|
||||
printf ( "Do not launch rofi from inside rofi.\r\n" );
|
||||
return EXIT_FAILURE;
|
||||
printf ( "Do not launch rofi from inside rofi.\r\n" );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -855,9 +855,9 @@ int main ( int argc, char *argv[] )
|
|||
#ifdef ENABLE_WAYLAND
|
||||
if ( find_arg ( "-x11" ) < 0 ) {
|
||||
const gchar *d = g_getenv ( "WAYLAND_DISPLAY" );
|
||||
if ( d != NULL && strlen(d) != 0 ) {
|
||||
if ( d != NULL && strlen ( d ) != 0 ) {
|
||||
config.backend = DISPLAY_WAYLAND;
|
||||
proxy = wayland_proxy;
|
||||
proxy = wayland_proxy;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -897,40 +897,41 @@ int main ( int argc, char *argv[] )
|
|||
|
||||
if ( find_arg ( "-no-config" ) < 0 ) {
|
||||
// Load distro default settings
|
||||
gboolean found_system = FALSE;
|
||||
const char * const * dirs = g_get_system_config_dirs();
|
||||
if ( dirs )
|
||||
{
|
||||
for ( unsigned int i =0; !found_system && dirs[i]; i++ ) {
|
||||
gboolean found_system = FALSE;
|
||||
const char * const * dirs = g_get_system_config_dirs ();
|
||||
if ( dirs ) {
|
||||
for ( unsigned int i = 0; !found_system && dirs[i]; i++ ) {
|
||||
/** New format. */
|
||||
gchar *etc = g_build_filename ( dirs[i], "rofi.rasi", NULL );
|
||||
g_debug ( "Look for default config file: %s", etc );
|
||||
if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) {
|
||||
g_debug ( "Parsing: %s", etc );
|
||||
rofi_theme_parse_file ( etc );
|
||||
found_system = TRUE;
|
||||
} else {
|
||||
found_system = TRUE;
|
||||
}
|
||||
else {
|
||||
/** Old format. */
|
||||
gchar *xetc = g_build_filename ( dirs[i], "rofi.conf", NULL );
|
||||
g_debug ( "Look for default config file: %s", xetc );
|
||||
if ( g_file_test ( xetc, G_FILE_TEST_IS_REGULAR ) ) {
|
||||
config_parse_xresource_options_file ( xetc );
|
||||
old_config_format = TRUE;
|
||||
found_system = TRUE;
|
||||
found_system = TRUE;
|
||||
}
|
||||
g_free ( xetc );
|
||||
}
|
||||
g_free ( etc );
|
||||
}
|
||||
}
|
||||
if ( ! found_system ) {
|
||||
if ( !found_system ) {
|
||||
/** New format. */
|
||||
gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.rasi", NULL );
|
||||
g_debug ( "Look for default config file: %s", etc );
|
||||
if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) {
|
||||
g_debug ( "Look for default config file: %s", etc );
|
||||
rofi_theme_parse_file ( etc );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/** Old format. */
|
||||
gchar *xetc = g_build_filename ( SYSCONFDIR, "rofi.conf", NULL );
|
||||
g_debug ( "Look for default config file: %s", xetc );
|
||||
|
|
177
source/theme.c
177
source/theme.c
|
@ -85,25 +85,23 @@ Property *rofi_theme_property_create ( PropertyType type )
|
|||
|
||||
static RofiDistanceUnit *rofi_theme_property_copy_distance_unit ( RofiDistanceUnit *unit )
|
||||
{
|
||||
RofiDistanceUnit *retv = g_slice_new0( RofiDistanceUnit );
|
||||
*retv = *unit;
|
||||
RofiDistanceUnit *retv = g_slice_new0 ( RofiDistanceUnit );
|
||||
*retv = *unit;
|
||||
if ( unit->left ) {
|
||||
retv->left = rofi_theme_property_copy_distance_unit ( unit->left );
|
||||
retv->left = rofi_theme_property_copy_distance_unit ( unit->left );
|
||||
}
|
||||
if ( unit->right ) {
|
||||
retv->right = rofi_theme_property_copy_distance_unit ( unit->right );
|
||||
retv->right = rofi_theme_property_copy_distance_unit ( unit->right );
|
||||
}
|
||||
return retv;
|
||||
}
|
||||
RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance )
|
||||
{
|
||||
RofiDistance retv = distance;
|
||||
if ( distance.base.left )
|
||||
{
|
||||
if ( distance.base.left ) {
|
||||
retv.base.left = rofi_theme_property_copy_distance_unit ( distance.base.left );
|
||||
}
|
||||
if ( distance.base.right )
|
||||
{
|
||||
if ( distance.base.right ) {
|
||||
retv.base.right = rofi_theme_property_copy_distance_unit ( distance.base.right );
|
||||
}
|
||||
return retv;
|
||||
|
@ -130,14 +128,14 @@ Property* rofi_theme_property_copy ( Property *p )
|
|||
}
|
||||
break;
|
||||
case P_PADDING:
|
||||
{
|
||||
retv->value = p->value;
|
||||
retv->value.padding.top = rofi_theme_property_copy_distance ( p->value.padding.top);
|
||||
retv->value.padding.left = rofi_theme_property_copy_distance ( p->value.padding.left);
|
||||
retv->value.padding.bottom = rofi_theme_property_copy_distance ( p->value.padding.bottom);
|
||||
retv->value.padding.right = rofi_theme_property_copy_distance ( p->value.padding.right);
|
||||
break;
|
||||
}
|
||||
{
|
||||
retv->value = p->value;
|
||||
retv->value.padding.top = rofi_theme_property_copy_distance ( p->value.padding.top );
|
||||
retv->value.padding.left = rofi_theme_property_copy_distance ( p->value.padding.left );
|
||||
retv->value.padding.bottom = rofi_theme_property_copy_distance ( p->value.padding.bottom );
|
||||
retv->value.padding.right = rofi_theme_property_copy_distance ( p->value.padding.right );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
retv->value = p->value;
|
||||
}
|
||||
|
@ -154,7 +152,7 @@ static void rofi_theme_distance_unit_property_free ( RofiDistanceUnit *unit )
|
|||
rofi_theme_distance_unit_property_free ( unit->right );
|
||||
unit->right = NULL;
|
||||
}
|
||||
g_slice_free ( RofiDistanceUnit, unit);
|
||||
g_slice_free ( RofiDistanceUnit, unit );
|
||||
}
|
||||
static void rofi_theme_distance_property_free ( RofiDistance *distance )
|
||||
{
|
||||
|
@ -183,11 +181,11 @@ void rofi_theme_property_free ( Property *p )
|
|||
rofi_theme_property_free ( p->value.link.def_value );
|
||||
}
|
||||
}
|
||||
if ( p->type == P_PADDING) {
|
||||
rofi_theme_distance_property_free( &(p->value.padding.top));
|
||||
rofi_theme_distance_property_free( &(p->value.padding.right));
|
||||
rofi_theme_distance_property_free( &(p->value.padding.bottom));
|
||||
rofi_theme_distance_property_free( &(p->value.padding.left));
|
||||
if ( p->type == P_PADDING ) {
|
||||
rofi_theme_distance_property_free ( &( p->value.padding.top ) );
|
||||
rofi_theme_distance_property_free ( &( p->value.padding.right ) );
|
||||
rofi_theme_distance_property_free ( &( p->value.padding.bottom ) );
|
||||
rofi_theme_distance_property_free ( &( p->value.padding.left ) );
|
||||
}
|
||||
g_slice_free ( Property, p );
|
||||
}
|
||||
|
@ -217,7 +215,7 @@ static void rofi_theme_insert_listview_backwards_fix ( void )
|
|||
|
||||
rofi_theme_widget_add_properties ( tt, table );
|
||||
|
||||
RofiDistance dsize = (RofiDistance){ .base = {1.2, ROFI_PU_CH, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL}, .style = ROFI_HL_SOLID };
|
||||
RofiDistance dsize = (RofiDistance){ .base = { 1.2, ROFI_PU_CH, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, .style = ROFI_HL_SOLID };
|
||||
Property *pts = rofi_theme_property_create ( P_PADDING );
|
||||
pts->value.padding.top = pts->value.padding.right = pts->value.padding.bottom = pts->value.padding.left = dsize;
|
||||
pts->name = g_strdup ( "size" );
|
||||
|
@ -230,7 +228,7 @@ static void rofi_theme_insert_listview_backwards_fix ( void )
|
|||
table = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) rofi_theme_property_free );
|
||||
Property *psp = rofi_theme_property_create ( P_PADDING );
|
||||
psp->name = g_strdup ( "spacing" );
|
||||
RofiDistance d = (RofiDistance){ .base = {5, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL}, .style = ROFI_HL_SOLID };
|
||||
RofiDistance d = (RofiDistance){ .base = { 5, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, .style = ROFI_HL_SOLID };
|
||||
psp->value.padding = (RofiPadding){ d, d, d, d };
|
||||
g_hash_table_replace ( table, psp->name, psp );
|
||||
rofi_theme_widget_add_properties ( t, table );
|
||||
|
@ -278,27 +276,33 @@ inline static void printf_double ( double d )
|
|||
|
||||
static void rofi_theme_print_distance_unit ( RofiDistanceUnit *unit )
|
||||
{
|
||||
if ( unit->modtype == ROFI_DISTANCE_MODIFIER_GROUP )
|
||||
fputs("( " , stdout);
|
||||
if ( unit->left )
|
||||
if ( unit->modtype == ROFI_DISTANCE_MODIFIER_GROUP ) {
|
||||
fputs ( "( ", stdout );
|
||||
}
|
||||
if ( unit->left ) {
|
||||
rofi_theme_print_distance_unit ( unit->left );
|
||||
}
|
||||
|
||||
if ( unit->modtype == ROFI_DISTANCE_MODIFIER_ADD ) {
|
||||
fputs ( " + ", stdout );
|
||||
} else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_SUBTRACT ) {
|
||||
}
|
||||
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_SUBTRACT ) {
|
||||
fputs ( " - ", stdout );
|
||||
} else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_DIVIDE ) {
|
||||
}
|
||||
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_DIVIDE ) {
|
||||
fputs ( " / ", stdout );
|
||||
} else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MULTIPLY) {
|
||||
}
|
||||
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MULTIPLY ) {
|
||||
fputs ( " * ", stdout );
|
||||
} else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MODULO) {
|
||||
}
|
||||
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MODULO ) {
|
||||
fputs ( " % ", stdout );
|
||||
}
|
||||
if ( unit->right )
|
||||
}
|
||||
if ( unit->right ) {
|
||||
rofi_theme_print_distance_unit ( unit->right );
|
||||
|
||||
if ( unit->modtype == ROFI_DISTANCE_MODIFIER_NONE )
|
||||
{
|
||||
}
|
||||
|
||||
if ( unit->modtype == ROFI_DISTANCE_MODIFIER_NONE ) {
|
||||
if ( unit->type == ROFI_PU_PX ) {
|
||||
printf ( "%upx ", (unsigned int) unit->distance );
|
||||
}
|
||||
|
@ -319,18 +323,19 @@ static void rofi_theme_print_distance_unit ( RofiDistanceUnit *unit )
|
|||
fputs ( "em ", stdout );
|
||||
}
|
||||
}
|
||||
if ( unit->modtype == ROFI_DISTANCE_MODIFIER_GROUP )
|
||||
fputs(" )" , stdout);
|
||||
if ( unit->modtype == ROFI_DISTANCE_MODIFIER_GROUP ) {
|
||||
fputs ( " )", stdout );
|
||||
}
|
||||
}
|
||||
|
||||
static void rofi_theme_print_distance ( RofiDistance d )
|
||||
{
|
||||
if ( d.base.modtype == ROFI_DISTANCE_MODIFIER_GROUP ){
|
||||
fputs( "calc( ", stdout );
|
||||
if ( d.base.modtype == ROFI_DISTANCE_MODIFIER_GROUP ) {
|
||||
fputs ( "calc( ", stdout );
|
||||
}
|
||||
rofi_theme_print_distance_unit ( &(d.base) );
|
||||
if ( d.base.modtype == ROFI_DISTANCE_MODIFIER_GROUP ){
|
||||
fputs( ")", stdout );
|
||||
rofi_theme_print_distance_unit ( &( d.base ) );
|
||||
if ( d.base.modtype == ROFI_DISTANCE_MODIFIER_GROUP ) {
|
||||
fputs ( ")", stdout );
|
||||
}
|
||||
if ( d.style == ROFI_HL_DASH ) {
|
||||
printf ( "dash " );
|
||||
|
@ -747,17 +752,17 @@ RofiDistance rofi_theme_get_distance ( const widget *widget, const char *propert
|
|||
if ( widget->parent ) {
|
||||
return rofi_theme_get_distance ( widget->parent, property, def );
|
||||
}
|
||||
return (RofiDistance){ .base = {def, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL}, .style = ROFI_HL_SOLID };
|
||||
return (RofiDistance){ .base = { def, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, .style = ROFI_HL_SOLID };
|
||||
}
|
||||
if ( p->type == P_INTEGER ) {
|
||||
return (RofiDistance){ .base = { p->value.i, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL}, .style = ROFI_HL_SOLID };
|
||||
return (RofiDistance){ .base = { p->value.i, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, .style = ROFI_HL_SOLID };
|
||||
}
|
||||
else {
|
||||
return p->value.padding.left;
|
||||
}
|
||||
}
|
||||
g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
|
||||
return (RofiDistance){ .base = {def, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL}, .style = ROFI_HL_SOLID };
|
||||
return (RofiDistance){ .base = { def, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, .style = ROFI_HL_SOLID };
|
||||
}
|
||||
|
||||
int rofi_theme_get_boolean ( const widget *widget, const char *property, int def )
|
||||
|
@ -873,7 +878,7 @@ RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property,
|
|||
pad = p->value.padding;
|
||||
}
|
||||
else {
|
||||
RofiDistance d = (RofiDistance){ .base = {p->value.i, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL}, .style = ROFI_HL_SOLID };
|
||||
RofiDistance d = (RofiDistance){ .base = { p->value.i, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, .style = ROFI_HL_SOLID };
|
||||
return (RofiPadding){ d, d, d, d };
|
||||
}
|
||||
}
|
||||
|
@ -928,7 +933,6 @@ static int get_pixels ( RofiDistanceUnit *unit, RofiOrientation ori )
|
|||
{
|
||||
int val = unit->distance;
|
||||
|
||||
|
||||
if ( unit->type == ROFI_PU_EM ) {
|
||||
val = unit->distance * textbox_get_estimated_char_height ();
|
||||
}
|
||||
|
@ -953,48 +957,46 @@ static int get_pixels ( RofiDistanceUnit *unit, RofiOrientation ori )
|
|||
return val;
|
||||
}
|
||||
|
||||
|
||||
static int distance_unit_get_pixel ( RofiDistanceUnit *unit, RofiOrientation ori )
|
||||
{
|
||||
switch ( unit->modtype)
|
||||
switch ( unit->modtype )
|
||||
{
|
||||
case ROFI_DISTANCE_MODIFIER_GROUP:
|
||||
return distance_unit_get_pixel ( unit->left, ori );
|
||||
break;
|
||||
case ROFI_DISTANCE_MODIFIER_ADD:
|
||||
return distance_unit_get_pixel ( unit->left, ori)+ distance_unit_get_pixel ( unit->right, ori);
|
||||
case ROFI_DISTANCE_MODIFIER_SUBTRACT:
|
||||
return distance_unit_get_pixel ( unit->left, ori)- distance_unit_get_pixel ( unit->right, ori);
|
||||
case ROFI_DISTANCE_MODIFIER_MULTIPLY:
|
||||
return distance_unit_get_pixel ( unit->left, ori)* distance_unit_get_pixel ( unit->right, ori);
|
||||
case ROFI_DISTANCE_MODIFIER_DIVIDE:
|
||||
{
|
||||
int a = distance_unit_get_pixel ( unit->left, ori);
|
||||
int b = distance_unit_get_pixel ( unit->right, ori);
|
||||
if ( b != 0 ) {
|
||||
return a/b;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
case ROFI_DISTANCE_MODIFIER_MODULO:
|
||||
{
|
||||
int a = distance_unit_get_pixel ( unit->left, ori);
|
||||
int b = distance_unit_get_pixel ( unit->right, ori);
|
||||
if ( b != 0 ) {
|
||||
return a%b;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
case ROFI_DISTANCE_MODIFIER_GROUP:
|
||||
return distance_unit_get_pixel ( unit->left, ori );
|
||||
break;
|
||||
case ROFI_DISTANCE_MODIFIER_ADD:
|
||||
return distance_unit_get_pixel ( unit->left, ori ) + distance_unit_get_pixel ( unit->right, ori );
|
||||
case ROFI_DISTANCE_MODIFIER_SUBTRACT:
|
||||
return distance_unit_get_pixel ( unit->left, ori ) - distance_unit_get_pixel ( unit->right, ori );
|
||||
case ROFI_DISTANCE_MODIFIER_MULTIPLY:
|
||||
return distance_unit_get_pixel ( unit->left, ori ) * distance_unit_get_pixel ( unit->right, ori );
|
||||
case ROFI_DISTANCE_MODIFIER_DIVIDE:
|
||||
{
|
||||
int a = distance_unit_get_pixel ( unit->left, ori );
|
||||
int b = distance_unit_get_pixel ( unit->right, ori );
|
||||
if ( b != 0 ) {
|
||||
return a / b;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
case ROFI_DISTANCE_MODIFIER_MODULO:
|
||||
{
|
||||
int a = distance_unit_get_pixel ( unit->left, ori );
|
||||
int b = distance_unit_get_pixel ( unit->right, ori );
|
||||
if ( b != 0 ) {
|
||||
return a % b;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return get_pixels ( unit, ori );
|
||||
}
|
||||
|
||||
|
||||
int distance_get_pixel ( RofiDistance d, RofiOrientation ori )
|
||||
{
|
||||
return distance_unit_get_pixel ( &(d.base), ori);
|
||||
return distance_unit_get_pixel ( &( d.base ), ori );
|
||||
}
|
||||
|
||||
void distance_get_linestyle ( RofiDistance d, cairo_t *draw )
|
||||
|
@ -1017,13 +1019,13 @@ gboolean rofi_theme_is_empty ( void )
|
|||
return TRUE;
|
||||
}
|
||||
if ( rofi_theme->num_widgets == 3 ) {
|
||||
// HACK: check for default added elements.
|
||||
for ( unsigned int i = 0; i < rofi_theme->num_widgets;i++) {
|
||||
if ( strncmp ( rofi_theme->widgets[i]->name, "element", 7) != 0 ){
|
||||
return FALSE;
|
||||
// HACK: check for default added elements.
|
||||
for ( unsigned int i = 0; i < rofi_theme->num_widgets; i++ ) {
|
||||
if ( strncmp ( rofi_theme->widgets[i]->name, "element", 7 ) != 0 ) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -1320,7 +1322,6 @@ ThemeMediaType rofi_theme_parse_media_type ( const char *type )
|
|||
return THEME_MEDIA_TYPE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
gboolean rofi_theme_has_property ( const widget *widget, const char *property )
|
||||
{
|
||||
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
static const view_proxy *proxy;
|
||||
|
||||
void view_init( const view_proxy *view_in )
|
||||
void view_init ( const view_proxy *view_in )
|
||||
{
|
||||
proxy = view_in;
|
||||
}
|
||||
|
@ -76,12 +76,12 @@ void view_init( const view_proxy *view_in )
|
|||
GThreadPool *tpool = NULL;
|
||||
|
||||
/** Global pointer to the currently active RofiViewState */
|
||||
RofiViewState *current_active_menu = NULL;
|
||||
RofiViewState *current_active_menu = NULL;
|
||||
|
||||
struct _rofi_view_cache_state CacheState = {
|
||||
.main_window = XCB_WINDOW_NONE,
|
||||
.flags = MENU_NORMAL,
|
||||
.views = G_QUEUE_INIT,
|
||||
.main_window = XCB_WINDOW_NONE,
|
||||
.flags = MENU_NORMAL,
|
||||
.views = G_QUEUE_INIT,
|
||||
};
|
||||
|
||||
static char * get_matching_state ( void )
|
||||
|
@ -138,7 +138,8 @@ static void rofi_view_reload_message_bar ( RofiViewState *state )
|
|||
}
|
||||
}
|
||||
|
||||
void rofi_view_restart ( RofiViewState *state ) {
|
||||
void rofi_view_restart ( RofiViewState *state )
|
||||
{
|
||||
state->quit = FALSE;
|
||||
state->retv = MENU_CANCEL;
|
||||
}
|
||||
|
@ -1334,31 +1335,38 @@ void rofi_view_switch_mode ( RofiViewState *state, Mode *mode )
|
|||
|
||||
/** ------ */
|
||||
|
||||
void rofi_view_update ( RofiViewState *state, gboolean qr ) {
|
||||
void rofi_view_update ( RofiViewState *state, gboolean qr )
|
||||
{
|
||||
proxy->update ( state, qr );
|
||||
}
|
||||
|
||||
void rofi_view_maybe_update ( RofiViewState *state ) {
|
||||
void rofi_view_maybe_update ( RofiViewState *state )
|
||||
{
|
||||
proxy->maybe_update ( state );
|
||||
}
|
||||
|
||||
void rofi_view_temp_configure_notify ( RofiViewState *state, xcb_configure_notify_event_t *xce ) {
|
||||
void rofi_view_temp_configure_notify ( RofiViewState *state, xcb_configure_notify_event_t *xce )
|
||||
{
|
||||
proxy->temp_configure_notify ( state, xce );
|
||||
}
|
||||
|
||||
void rofi_view_temp_click_to_exit ( RofiViewState *state, xcb_window_t target ) {
|
||||
void rofi_view_temp_click_to_exit ( RofiViewState *state, xcb_window_t target )
|
||||
{
|
||||
proxy->temp_click_to_exit ( state, target );
|
||||
}
|
||||
|
||||
void rofi_view_frame_callback ( void ) {
|
||||
void rofi_view_frame_callback ( void )
|
||||
{
|
||||
proxy->frame_callback ( );
|
||||
}
|
||||
|
||||
void rofi_view_queue_redraw ( void ) {
|
||||
void rofi_view_queue_redraw ( void )
|
||||
{
|
||||
proxy->queue_redraw ( );
|
||||
}
|
||||
|
||||
void rofi_view_set_window_title ( const char * title ) {
|
||||
void rofi_view_set_window_title ( const char * title )
|
||||
{
|
||||
proxy->set_window_title ( title );
|
||||
}
|
||||
|
||||
|
@ -1367,7 +1375,8 @@ void rofi_view_calculate_window_position ( RofiViewState * state )
|
|||
proxy->calculate_window_position ( state );
|
||||
}
|
||||
|
||||
void rofi_view_calculate_window_width ( struct RofiViewState *state ) {
|
||||
void rofi_view_calculate_window_width ( struct RofiViewState *state )
|
||||
{
|
||||
proxy->calculate_window_width ( state );
|
||||
}
|
||||
|
||||
|
@ -1381,42 +1390,52 @@ void rofi_view_window_update_size ( RofiViewState * state )
|
|||
proxy->window_update_size ( state );
|
||||
}
|
||||
|
||||
void rofi_view_cleanup ( void ) {
|
||||
void rofi_view_cleanup ( void )
|
||||
{
|
||||
proxy->cleanup ( );
|
||||
}
|
||||
|
||||
void rofi_view_hide ( void ) {
|
||||
void rofi_view_hide ( void )
|
||||
{
|
||||
proxy->hide ( );
|
||||
}
|
||||
|
||||
void rofi_view_reload ( void ) {
|
||||
void rofi_view_reload ( void )
|
||||
{
|
||||
proxy->reload ( );
|
||||
}
|
||||
|
||||
void __create_window ( MenuFlags menu_flags ) {
|
||||
void __create_window ( MenuFlags menu_flags )
|
||||
{
|
||||
proxy->__create_window ( menu_flags );
|
||||
}
|
||||
|
||||
xcb_window_t rofi_view_get_window ( void ) {
|
||||
xcb_window_t rofi_view_get_window ( void )
|
||||
{
|
||||
return proxy->get_window ( );
|
||||
}
|
||||
|
||||
void rofi_view_get_current_monitor ( int *width, int *height ) {
|
||||
void rofi_view_get_current_monitor ( int *width, int *height )
|
||||
{
|
||||
proxy->get_current_monitor ( width, height );
|
||||
}
|
||||
|
||||
void rofi_capture_screenshot ( void ) {
|
||||
void rofi_capture_screenshot ( void )
|
||||
{
|
||||
proxy->capture_screenshot ( );
|
||||
}
|
||||
|
||||
void rofi_view_set_size ( RofiViewState * state, gint width, gint height ) {
|
||||
void rofi_view_set_size ( RofiViewState * state, gint width, gint height )
|
||||
{
|
||||
proxy->set_size ( state, width, height );
|
||||
}
|
||||
|
||||
void rofi_view_get_size ( RofiViewState * state, gint *width, gint *height ) {
|
||||
void rofi_view_get_size ( RofiViewState * state, gint *width, gint *height )
|
||||
{
|
||||
proxy->get_size ( state, width, height );
|
||||
}
|
||||
|
||||
void rofi_view_pool_refresh ( void ) {
|
||||
void rofi_view_pool_refresh ( void )
|
||||
{
|
||||
proxy->pool_refresh ( );
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -96,7 +96,7 @@ static struct
|
|||
|
||||
static void wayland_rofi_view_get_current_monitor ( int *width, int *height )
|
||||
{
|
||||
display_get_surface_dimensions( width, height );
|
||||
display_get_surface_dimensions ( width, height );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,12 +108,12 @@ static void wayland_rofi_view_capture_screenshot ( void )
|
|||
|
||||
static gboolean wayland_rofi_view_repaint ( G_GNUC_UNUSED void * data )
|
||||
{
|
||||
RofiViewState * state = rofi_view_get_active();
|
||||
RofiViewState * state = rofi_view_get_active ();
|
||||
if ( state ) {
|
||||
// Repaint the view (if needed).
|
||||
// After a resize the edit_pixmap surface might not contain anything anymore.
|
||||
// If we already re-painted, this does nothing.
|
||||
wayland_rofi_view_maybe_update( state );
|
||||
wayland_rofi_view_maybe_update ( state );
|
||||
WlState.repaint_source = 0;
|
||||
}
|
||||
return G_SOURCE_REMOVE;
|
||||
|
@ -143,21 +143,23 @@ static int rofi_get_location ( RofiViewState *state )
|
|||
static void wayland_rofi_view_window_update_size ( RofiViewState * state )
|
||||
{
|
||||
widget_resize ( WIDGET ( state->main_window ), state->width, state->height );
|
||||
display_set_surface_dimensions ( state->width, state->height, rofi_get_location(state) );
|
||||
display_set_surface_dimensions ( state->width, state->height, rofi_get_location ( state ) );
|
||||
}
|
||||
|
||||
static void wayland_rofi_view_set_size ( RofiViewState * state, gint width, gint height )
|
||||
{
|
||||
if ( width > -1 )
|
||||
if ( width > -1 ) {
|
||||
state->width = width;
|
||||
if ( height > -1 )
|
||||
}
|
||||
if ( height > -1 ) {
|
||||
state->height = height;
|
||||
wayland_rofi_view_window_update_size(state);
|
||||
}
|
||||
wayland_rofi_view_window_update_size ( state );
|
||||
}
|
||||
|
||||
static void wayland_rofi_view_get_size ( RofiViewState * state, gint *width, gint *height )
|
||||
{
|
||||
*width = state->width;
|
||||
*width = state->width;
|
||||
*height = state->height;
|
||||
}
|
||||
|
||||
|
@ -233,15 +235,15 @@ static void wayland___create_window ( MenuFlags menu_flags )
|
|||
TICK_N ( "create cairo surface" );
|
||||
// TODO should we update the drawable each time?
|
||||
PangoContext *p = pango_context_new ( );
|
||||
pango_context_set_font_map(p, pango_cairo_font_map_get_default());
|
||||
pango_context_set_font_map ( p, pango_cairo_font_map_get_default () );
|
||||
TICK_N ( "pango cairo font setup" );
|
||||
|
||||
WlState.flags = menu_flags;
|
||||
WlState.flags = menu_flags;
|
||||
// Setup dpi
|
||||
// FIXME: use scale, cairo_surface_set_device_scale
|
||||
// Setup font.
|
||||
// Dummy widget.
|
||||
container *win = container_create ( NULL, "window.box" );
|
||||
container *win = container_create ( NULL, "window.box" );
|
||||
const char *font = rofi_theme_get_string ( WIDGET ( win ), "font", config.menu_font );
|
||||
if ( font ) {
|
||||
PangoFontDescription *pfd = pango_font_description_from_string ( font );
|
||||
|
@ -278,8 +280,8 @@ static void wayland_rofi_view_calculate_window_width ( RofiViewState *state )
|
|||
else {
|
||||
int width = 1920;
|
||||
// Calculate as float to stop silly, big rounding down errors.
|
||||
display_get_surface_dimensions( &width, NULL );
|
||||
state->width = config.menu_width < 101 ? ( (float)width / 100.0f ) * ( float ) config.menu_width : config.menu_width;
|
||||
display_get_surface_dimensions ( &width, NULL );
|
||||
state->width = config.menu_width < 101 ? ( (float) width / 100.0f ) * ( float ) config.menu_width : config.menu_width;
|
||||
}
|
||||
// Use theme configured width, if set.
|
||||
RofiDistance width = rofi_theme_get_distance ( WIDGET ( state->main_window ), "width", state->width );
|
||||
|
@ -294,10 +296,10 @@ static void wayland_rofi_view_update ( RofiViewState *state, gboolean qr )
|
|||
g_debug ( "Redraw view" );
|
||||
TICK ();
|
||||
if ( state->pool == NULL ) {
|
||||
state->pool = display_buffer_pool_new(state->width, state->height);
|
||||
state->pool = display_buffer_pool_new ( state->width, state->height );
|
||||
}
|
||||
cairo_surface_t *surface = display_buffer_pool_get_next_buffer(state->pool);
|
||||
cairo_t *d = cairo_create(surface);
|
||||
cairo_surface_t *surface = display_buffer_pool_get_next_buffer ( state->pool );
|
||||
cairo_t *d = cairo_create ( surface );
|
||||
cairo_set_operator ( d, CAIRO_OPERATOR_SOURCE );
|
||||
// Paint the background transparent.
|
||||
cairo_set_source_rgba ( d, 0, 0, 0, 0.0 );
|
||||
|
@ -311,7 +313,7 @@ static void wayland_rofi_view_update ( RofiViewState *state, gboolean qr )
|
|||
widget_draw ( WIDGET ( state->main_window ), d );
|
||||
|
||||
TICK_N ( "widgets" );
|
||||
cairo_destroy(d);
|
||||
cairo_destroy ( d );
|
||||
display_surface_commit ( surface );
|
||||
|
||||
if ( qr ) {
|
||||
|
@ -360,7 +362,7 @@ static int wayland_rofi_view_calculate_window_height ( RofiViewState *state )
|
|||
{
|
||||
if ( WlState.fullscreen == TRUE ) {
|
||||
int height = 1080;
|
||||
display_get_surface_dimensions( NULL, &height );
|
||||
display_get_surface_dimensions ( NULL, &height );
|
||||
return height;
|
||||
}
|
||||
|
||||
|
@ -403,36 +405,36 @@ static void wayland_rofi_view_pool_refresh ( void )
|
|||
RofiViewState *state = rofi_view_get_active ();
|
||||
display_buffer_pool_free ( state->pool );
|
||||
state->pool = NULL;
|
||||
wayland_rofi_view_update ( state, TRUE);
|
||||
wayland_rofi_view_update ( state, TRUE );
|
||||
}
|
||||
|
||||
static view_proxy view_ = {
|
||||
.update = wayland_rofi_view_update,
|
||||
.maybe_update = wayland_rofi_view_maybe_update,
|
||||
.update = wayland_rofi_view_update,
|
||||
.maybe_update = wayland_rofi_view_maybe_update,
|
||||
.temp_configure_notify = NULL,
|
||||
.temp_click_to_exit = NULL,
|
||||
.frame_callback = wayland_rofi_view_frame_callback,
|
||||
.queue_redraw = wayland_rofi_view_queue_redraw,
|
||||
.temp_click_to_exit = NULL,
|
||||
.frame_callback = wayland_rofi_view_frame_callback,
|
||||
.queue_redraw = wayland_rofi_view_queue_redraw,
|
||||
|
||||
.set_window_title = wayland_rofi_view_set_window_title,
|
||||
.set_window_title = wayland_rofi_view_set_window_title,
|
||||
.calculate_window_position = wayland_rofi_view_calculate_window_position,
|
||||
.calculate_window_height = wayland_rofi_view_calculate_window_height,
|
||||
.calculate_window_width = wayland_rofi_view_calculate_window_width,
|
||||
.window_update_size = wayland_rofi_view_window_update_size,
|
||||
.calculate_window_height = wayland_rofi_view_calculate_window_height,
|
||||
.calculate_window_width = wayland_rofi_view_calculate_window_width,
|
||||
.window_update_size = wayland_rofi_view_window_update_size,
|
||||
|
||||
.cleanup = wayland_rofi_view_cleanup,
|
||||
.hide = wayland_rofi_view_hide,
|
||||
.reload = wayland_rofi_view_reload,
|
||||
.hide = wayland_rofi_view_hide,
|
||||
.reload = wayland_rofi_view_reload,
|
||||
|
||||
.__create_window = wayland___create_window,
|
||||
.get_window = NULL,
|
||||
.__create_window = wayland___create_window,
|
||||
.get_window = NULL,
|
||||
.get_current_monitor = wayland_rofi_view_get_current_monitor,
|
||||
.capture_screenshot = wayland_rofi_view_capture_screenshot,
|
||||
.capture_screenshot = wayland_rofi_view_capture_screenshot,
|
||||
|
||||
.set_size = wayland_rofi_view_set_size,
|
||||
.get_size = wayland_rofi_view_get_size,
|
||||
|
||||
.pool_refresh = wayland_rofi_view_pool_refresh,
|
||||
.pool_refresh = wayland_rofi_view_pool_refresh,
|
||||
};
|
||||
|
||||
const view_proxy *wayland_view_proxy = &view_;
|
||||
const view_proxy *wayland_view_proxy = &view_;
|
||||
|
|
|
@ -231,7 +231,9 @@ static void hori_calculate_size ( box *b )
|
|||
int left = widget_padding_get_left ( WIDGET ( b ) );
|
||||
double rem = rem_width - b->max_size;
|
||||
int index = 0;
|
||||
if ( rem < 0 ) rem = 0;
|
||||
if ( rem < 0 ) {
|
||||
rem = 0;
|
||||
}
|
||||
for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
widget * child = (widget *) iter->data;
|
||||
if ( child->enabled == FALSE ) {
|
||||
|
@ -332,7 +334,7 @@ static widget *box_find_mouse_target ( widget *wid, WidgetType type, gint x, gin
|
|||
|
||||
static void box_set_state ( widget *wid, const char *state )
|
||||
{
|
||||
for ( GList *iter = g_list_first ( ((box*)wid)->children ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
for ( GList *iter = g_list_first ( ( (box*) wid )->children ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
widget * child = (widget *) iter->data;
|
||||
widget_set_state ( child, state );
|
||||
}
|
||||
|
|
|
@ -45,10 +45,10 @@
|
|||
/**
|
||||
* Orientation of the listview
|
||||
*/
|
||||
/** Vertical (classical) list */
|
||||
#define LISTVIEW ROFI_ORIENTATION_VERTICAL
|
||||
/** Horizontal list. (barview) */
|
||||
#define BARVIEW ROFI_ORIENTATION_HORIZONTAL
|
||||
/** Vertical (classical) list */
|
||||
#define LISTVIEW ROFI_ORIENTATION_VERTICAL
|
||||
/** Horizontal list. (barview) */
|
||||
#define BARVIEW ROFI_ORIENTATION_HORIZONTAL
|
||||
|
||||
/**
|
||||
* The moving direction of the selection, this (in barview) affects the scrolling.
|
||||
|
@ -69,7 +69,7 @@ typedef struct
|
|||
|
||||
struct _listview
|
||||
{
|
||||
widget widget;
|
||||
widget widget;
|
||||
|
||||
RofiOrientation type;
|
||||
|
||||
|
@ -143,8 +143,8 @@ const char *const listview_theme_prop_names[][3] = {
|
|||
|
||||
static void listview_set_state ( _listview_row r, TextBoxFontType tbft )
|
||||
{
|
||||
widget *w = WIDGET(r.box);
|
||||
TextBoxFontType t = tbft & STATE_MASK;
|
||||
widget *w = WIDGET ( r.box );
|
||||
TextBoxFontType t = tbft & STATE_MASK;
|
||||
if ( w == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
@ -171,25 +171,25 @@ static void listview_add_widget ( listview *lv, _listview_row *row, widget *wid,
|
|||
if ( strcasecmp ( label, "element-icon" ) == 0 ) {
|
||||
if ( config.show_icons ) {
|
||||
row->icon = icon_create ( WIDGET ( wid ), "element-icon" );
|
||||
box_add ( (box *)wid, WIDGET ( row->icon ), FALSE );
|
||||
box_add ( (box *) wid, WIDGET ( row->icon ), FALSE );
|
||||
}
|
||||
}
|
||||
else if ( strcasecmp ( label, "element-text" ) == 0 ) {
|
||||
row->textbox = textbox_create ( WIDGET ( wid ), WIDGET_TYPE_TEXTBOX_TEXT, "element-text", TB_AUTOHEIGHT | flags, NORMAL, "DDD", 0, 0 );
|
||||
box_add ( (box *)wid, WIDGET ( row->textbox ), TRUE );
|
||||
box_add ( (box *) wid, WIDGET ( row->textbox ), TRUE );
|
||||
}
|
||||
else if ( strcasecmp ( label, "element-index" ) == 0 ) {
|
||||
row->index = textbox_create ( WIDGET ( wid ), WIDGET_TYPE_TEXTBOX_TEXT, "element-text", TB_AUTOHEIGHT, NORMAL, " ", 0, 0 );
|
||||
box_add ( (box *)wid, WIDGET ( row->index ), FALSE );
|
||||
} else {
|
||||
box_add ( (box *) wid, WIDGET ( row->index ), FALSE );
|
||||
}
|
||||
else {
|
||||
widget *wid2 = (widget *) box_create ( wid, label, ROFI_ORIENTATION_VERTICAL );
|
||||
box_add ( (box *) wid, WIDGET ( wid2 ), TRUE );
|
||||
GList *list = rofi_theme_get_list ( WIDGET ( wid2 ), "children", "" );
|
||||
GList *list = rofi_theme_get_list ( WIDGET ( wid2 ), "children", "" );
|
||||
for ( GList *iter = g_list_first ( list ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
listview_add_widget ( lv,row, wid2, (const char *)iter->data );
|
||||
listview_add_widget ( lv, row, wid2, (const char *) iter->data );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void listview_create_row ( listview *lv, _listview_row *row )
|
||||
|
@ -203,7 +203,7 @@ static void listview_create_row ( listview *lv, _listview_row *row )
|
|||
row->index = NULL;
|
||||
|
||||
for ( GList *iter = g_list_first ( list ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
listview_add_widget ( lv,row, WIDGET(row->box), (const char *)iter->data );
|
||||
listview_add_widget ( lv, row, WIDGET ( row->box ), (const char *) iter->data );
|
||||
}
|
||||
g_list_free_full ( list, g_free );
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ static void barview_draw ( widget *wid, cairo_t *draw )
|
|||
else {
|
||||
for ( unsigned int i = 0; i < lv->cur_elements && width > 0 && i <= offset; i++ ) {
|
||||
update_element ( lv, i, offset - i, TRUE );
|
||||
int twidth = widget_get_desired_width ( WIDGET ( lv->boxes[i].box ) );
|
||||
int twidth = widget_get_desired_width ( WIDGET ( lv->boxes[i].box ) );
|
||||
if ( twidth >= width ) {
|
||||
if ( !first ) {
|
||||
break;
|
||||
|
@ -553,8 +553,8 @@ static void listview_resize ( widget *wid, short w, short h )
|
|||
lv->max_elements = lv->max_rows * lv->menu_columns;
|
||||
|
||||
widget_move ( WIDGET ( lv->scrollbar ),
|
||||
lv->widget.w - widget_padding_get_right ( WIDGET ( lv ) ) - widget_get_width ( WIDGET ( lv->scrollbar ) ),
|
||||
widget_padding_get_top ( WIDGET ( lv ) ) );
|
||||
lv->widget.w - widget_padding_get_right ( WIDGET ( lv ) ) - widget_get_width ( WIDGET ( lv->scrollbar ) ),
|
||||
widget_padding_get_top ( WIDGET ( lv ) ) );
|
||||
|
||||
widget_resize ( WIDGET ( lv->scrollbar ), widget_get_width ( WIDGET ( lv->scrollbar ) ), height );
|
||||
|
||||
|
@ -661,10 +661,13 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca
|
|||
listview_create_row ( lv, &row );
|
||||
// FIXME: hack to scale hight correctly.
|
||||
if ( lv->eh > 1 && row.textbox ) {
|
||||
char buff[lv->eh*2+1] ;
|
||||
memset( buff, '\0', lv->eh*2+1);
|
||||
for ( unsigned int i = 0; i < (lv->eh-1); i++) { buff[i*2] = 'a'; buff[i*2+1] ='\n'; };
|
||||
textbox_text( row.textbox, buff);
|
||||
char buff[lv->eh * 2 + 1];
|
||||
memset ( buff, '\0', lv->eh * 2 + 1 );
|
||||
for ( unsigned int i = 0; i < ( lv->eh - 1 ); i++ ) {
|
||||
buff[i * 2] = 'a'; buff[i * 2 + 1] = '\n';
|
||||
}
|
||||
;
|
||||
textbox_text ( row.textbox, buff );
|
||||
}
|
||||
lv->element_height = widget_get_desired_height ( WIDGET ( row.box ) );
|
||||
widget_free ( WIDGET ( row.box ) );
|
||||
|
|
|
@ -914,7 +914,7 @@ double textbox_get_estimated_ch ( void )
|
|||
int textbox_get_estimated_height ( const textbox *tb, int eh )
|
||||
{
|
||||
int height = pango_font_metrics_get_ascent ( tb->metrics ) + pango_font_metrics_get_descent ( tb->metrics );
|
||||
return ceil(( eh * height ) / (double)PANGO_SCALE) + widget_padding_get_padding_height ( WIDGET ( tb ) );
|
||||
return ceil ( ( eh * height ) / (double) PANGO_SCALE ) + widget_padding_get_padding_height ( WIDGET ( tb ) );
|
||||
}
|
||||
int textbox_get_desired_width ( widget *wid )
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
/** Default padding. */
|
||||
#define WIDGET_DEFAULT_PADDING 0
|
||||
#define WIDGET_PADDING_INIT { { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, ROFI_HL_SOLID }
|
||||
#define WIDGET_PADDING_INIT { { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL }, ROFI_HL_SOLID }
|
||||
|
||||
/* Corner radius - tl, tr, br, bl */
|
||||
static void draw_rounded_rect ( cairo_t * d,
|
||||
|
@ -41,27 +41,31 @@ static void draw_rounded_rect ( cairo_t * d,
|
|||
double r0, double r1, double r2, double r3 )
|
||||
{
|
||||
if ( r0 > 0 ) {
|
||||
cairo_move_to ( d, x1, y1+r0 );
|
||||
cairo_arc ( d, x1+r0, y1+r0, r0, -G_PI, -G_PI_2 );
|
||||
} else {
|
||||
cairo_move_to ( d, x1, y1 + r0 );
|
||||
cairo_arc ( d, x1 + r0, y1 + r0, r0, -G_PI, -G_PI_2 );
|
||||
}
|
||||
else {
|
||||
cairo_move_to ( d, x1, y1 );
|
||||
}
|
||||
if ( r1 > 0 ) {
|
||||
cairo_line_to ( d, x2-r1, y1 );
|
||||
cairo_arc ( d, x2-r1, y1+r1, r1, -G_PI_2, 0.0 );
|
||||
} else {
|
||||
cairo_line_to ( d, x2 - r1, y1 );
|
||||
cairo_arc ( d, x2 - r1, y1 + r1, r1, -G_PI_2, 0.0 );
|
||||
}
|
||||
else {
|
||||
cairo_line_to ( d, x2, y1 );
|
||||
}
|
||||
if ( r2 > 0 ) {
|
||||
cairo_line_to ( d, x2, y2-r2 );
|
||||
cairo_arc ( d, x2-r2, y2-r2, r2, 0.0, G_PI_2 );
|
||||
} else {
|
||||
cairo_line_to ( d, x2, y2 - r2 );
|
||||
cairo_arc ( d, x2 - r2, y2 - r2, r2, 0.0, G_PI_2 );
|
||||
}
|
||||
else {
|
||||
cairo_line_to ( d, x2, y2 );
|
||||
}
|
||||
if ( r3 > 0 ) {
|
||||
cairo_line_to ( d, x1+r3, y2 );
|
||||
cairo_arc ( d, x1+r3, y2-r3, r3, G_PI_2, G_PI );
|
||||
} else {
|
||||
cairo_line_to ( d, x1 + r3, y2 );
|
||||
cairo_arc ( d, x1 + r3, y2 - r3, r3, G_PI_2, G_PI );
|
||||
}
|
||||
else {
|
||||
cairo_line_to ( d, x1, y2 );
|
||||
}
|
||||
cairo_close_path ( d );
|
||||
|
@ -69,9 +73,9 @@ static void draw_rounded_rect ( cairo_t * d,
|
|||
|
||||
void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name )
|
||||
{
|
||||
wid->type = type;
|
||||
wid->parent = parent;
|
||||
wid->name = g_strdup ( name );
|
||||
wid->type = type;
|
||||
wid->parent = parent;
|
||||
wid->name = g_strdup ( name );
|
||||
wid->def_padding = (RofiPadding) { WIDGET_PADDING_INIT, WIDGET_PADDING_INIT, WIDGET_PADDING_INIT, WIDGET_PADDING_INIT };
|
||||
wid->def_border = (RofiPadding) { WIDGET_PADDING_INIT, WIDGET_PADDING_INIT, WIDGET_PADDING_INIT, WIDGET_PADDING_INIT };
|
||||
wid->def_border_radius = (RofiPadding) { WIDGET_PADDING_INIT, WIDGET_PADDING_INIT, WIDGET_PADDING_INIT, WIDGET_PADDING_INIT };
|
||||
|
@ -205,23 +209,23 @@ void widget_draw ( widget *widget, cairo_t *d )
|
|||
int radius_tl = distance_get_pixel ( widget->border_radius.top, ROFI_ORIENTATION_VERTICAL );
|
||||
int radius_br = distance_get_pixel ( widget->border_radius.bottom, ROFI_ORIENTATION_VERTICAL );
|
||||
|
||||
double minof_tl, minof_tr, minof_br, minof_bl;
|
||||
double minof_tl, minof_tr, minof_br, minof_bl;
|
||||
{
|
||||
double left_2 = (double) left / 2;
|
||||
double top_2 = (double) top / 2;
|
||||
double right_2 = (double) right / 2;
|
||||
double left_2 = (double) left / 2;
|
||||
double top_2 = (double) top / 2;
|
||||
double right_2 = (double) right / 2;
|
||||
double bottom_2 = (double) bottom / 2;
|
||||
|
||||
// Calculate the different offsets for the corners.
|
||||
minof_tl = MIN ( left_2, top_2 );
|
||||
minof_tl = MIN ( left_2, top_2 );
|
||||
minof_tr = MIN ( right_2, top_2 );
|
||||
minof_br = MIN ( right_2, bottom_2 );
|
||||
minof_bl = MIN ( left_2, bottom_2 );
|
||||
minof_bl = MIN ( left_2, bottom_2 );
|
||||
|
||||
// Contain border radius in widget space
|
||||
double vspace, vspace_2, hspace, hspace_2;
|
||||
vspace = widget->h - ( margin_top + margin_bottom ) - ( top_2 + bottom_2 );
|
||||
hspace = widget->w - ( margin_left + margin_right ) - ( left_2 + right_2 );
|
||||
vspace = widget->h - ( margin_top + margin_bottom ) - ( top_2 + bottom_2 );
|
||||
hspace = widget->w - ( margin_left + margin_right ) - ( left_2 + right_2 );
|
||||
vspace_2 = vspace / 2;
|
||||
hspace_2 = hspace / 2;
|
||||
|
||||
|
@ -249,9 +253,9 @@ void widget_draw ( widget *widget, cairo_t *d )
|
|||
cairo_set_line_width ( d, 0 );
|
||||
|
||||
draw_rounded_rect ( d,
|
||||
margin_left + ( left > 2 ? left - 1 : left == 1 ? 0.5 : 0 ),
|
||||
margin_top + ( top > 2 ? top - 1 : top == 1 ? 0.5 : 0 ),
|
||||
widget->w - margin_right - ( right > 2 ? right - 1 : right == 1 ? 0.5 : 0 ),
|
||||
margin_left + ( left > 2 ? left - 1 : left == 1 ? 0.5 : 0 ),
|
||||
margin_top + ( top > 2 ? top - 1 : top == 1 ? 0.5 : 0 ),
|
||||
widget->w - margin_right - ( right > 2 ? right - 1 : right == 1 ? 0.5 : 0 ),
|
||||
widget->h - margin_bottom - ( bottom > 2 ? bottom - 1 : bottom == 1 ? 0.5 : 0 ),
|
||||
radius_tl - ( minof_tl > 1 ? minof_tl - 1 : 0 ),
|
||||
radius_tr - ( minof_tr > 1 ? minof_tr - 1 : 0 ),
|
||||
|
@ -277,28 +281,32 @@ void widget_draw ( widget *widget, cairo_t *d )
|
|||
double radius_int_tl, radius_int_tr, radius_int_br, radius_int_bl;
|
||||
double radius_out_tl, radius_out_tr, radius_out_br, radius_out_bl;
|
||||
|
||||
if (radius_tl > 0) {
|
||||
radius_out_tl = radius_tl + minof_tl ,
|
||||
if ( radius_tl > 0 ) {
|
||||
radius_out_tl = radius_tl + minof_tl,
|
||||
radius_int_tl = radius_tl - minof_tl;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
radius_out_tl = radius_int_tl = 0;
|
||||
}
|
||||
if (radius_tr > 0) {
|
||||
radius_out_tr = radius_tr + minof_tr ,
|
||||
if ( radius_tr > 0 ) {
|
||||
radius_out_tr = radius_tr + minof_tr,
|
||||
radius_int_tr = radius_tr - minof_tr;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
radius_out_tr = radius_int_tr = 0;
|
||||
}
|
||||
if (radius_br > 0) {
|
||||
radius_out_br = radius_br + minof_br ,
|
||||
if ( radius_br > 0 ) {
|
||||
radius_out_br = radius_br + minof_br,
|
||||
radius_int_br = radius_br - minof_br;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
radius_out_br = radius_int_br = 0;
|
||||
}
|
||||
if (radius_bl > 0) {
|
||||
radius_out_bl = radius_bl + minof_bl ,
|
||||
if ( radius_bl > 0 ) {
|
||||
radius_out_bl = radius_bl + minof_bl,
|
||||
radius_int_bl = radius_bl - minof_bl;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
radius_out_bl = radius_int_bl = 0;
|
||||
}
|
||||
|
||||
|
@ -314,7 +322,7 @@ void widget_draw ( widget *widget, cairo_t *d )
|
|||
cairo_new_sub_path ( d );
|
||||
draw_rounded_rect ( d,
|
||||
margin_left + left,
|
||||
margin_top + top,
|
||||
margin_top + top,
|
||||
widget->w - margin_right - right,
|
||||
widget->h - margin_bottom - bottom,
|
||||
radius_int_tl,
|
||||
|
@ -416,7 +424,7 @@ gboolean widget_need_redraw ( widget *wid )
|
|||
if ( wid == NULL ) {
|
||||
return FALSE;
|
||||
}
|
||||
if ( ! wid->enabled ) {
|
||||
if ( !wid->enabled ) {
|
||||
return FALSE;
|
||||
}
|
||||
return wid->need_redraw;
|
||||
|
|
|
@ -1460,16 +1460,16 @@ static const struct _view_proxy* xcb_display_view_proxy ( void )
|
|||
return xcb_view_proxy;
|
||||
}
|
||||
|
||||
static display_proxy display_ = {
|
||||
.setup = xcb_display_setup,
|
||||
.late_setup = xcb_display_late_setup,
|
||||
.early_cleanup = xcb_display_early_cleanup,
|
||||
.cleanup = xcb_display_cleanup,
|
||||
.dump_monitor_layout = xcb_display_dump_monitor_layout,
|
||||
static display_proxy display_ = {
|
||||
.setup = xcb_display_setup,
|
||||
.late_setup = xcb_display_late_setup,
|
||||
.early_cleanup = xcb_display_early_cleanup,
|
||||
.cleanup = xcb_display_cleanup,
|
||||
.dump_monitor_layout = xcb_display_dump_monitor_layout,
|
||||
.startup_notification = xcb_display_startup_notification,
|
||||
.monitor_active = xcb_display_monitor_active,
|
||||
.monitor_active = xcb_display_monitor_active,
|
||||
|
||||
.view = xcb_display_view_proxy,
|
||||
.view = xcb_display_view_proxy,
|
||||
};
|
||||
|
||||
display_proxy * const xcb_proxy = &display_;
|
||||
|
|
|
@ -185,21 +185,21 @@ static void xcb_rofi_view_capture_screenshot ( void )
|
|||
g_date_time_unref ( now );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Code used for benchmarking drawing the gui, this will keep updating the UI as fast as possible.
|
||||
*/
|
||||
gboolean do_bench = TRUE;
|
||||
struct {
|
||||
GTimer *time;
|
||||
struct
|
||||
{
|
||||
GTimer *time;
|
||||
uint64_t draws;
|
||||
double last_ts;
|
||||
double min;
|
||||
double last_ts;
|
||||
double min;
|
||||
} BenchMark = {
|
||||
.time = NULL,
|
||||
.draws = 0,
|
||||
.time = NULL,
|
||||
.draws = 0,
|
||||
.last_ts = 0.0,
|
||||
.min = G_MAXDOUBLE
|
||||
.min = G_MAXDOUBLE
|
||||
};
|
||||
|
||||
static gboolean bench_update ( void )
|
||||
|
@ -209,17 +209,17 @@ static gboolean bench_update ( void )
|
|||
}
|
||||
BenchMark.draws++;
|
||||
if ( BenchMark.time == NULL ) {
|
||||
BenchMark.time = g_timer_new();
|
||||
BenchMark.time = g_timer_new ();
|
||||
}
|
||||
|
||||
if ( (BenchMark.draws & 1023) == 0 ){
|
||||
double ts = g_timer_elapsed(BenchMark.time, NULL);
|
||||
double fps = 1024/(ts-BenchMark.last_ts);
|
||||
if ( ( BenchMark.draws & 1023 ) == 0 ) {
|
||||
double ts = g_timer_elapsed ( BenchMark.time, NULL );
|
||||
double fps = 1024 / ( ts - BenchMark.last_ts );
|
||||
|
||||
if ( fps < BenchMark.min ) {
|
||||
BenchMark.min = fps;
|
||||
}
|
||||
printf("current: %.2f fps, avg: %.2f fps, min: %.2f fps, %lu draws\r\n", fps, BenchMark.draws/ts, BenchMark.min, BenchMark.draws);
|
||||
printf ( "current: %.2f fps, avg: %.2f fps, min: %.2f fps, %lu draws\r\n", fps, BenchMark.draws / ts, BenchMark.min, BenchMark.draws );
|
||||
|
||||
BenchMark.last_ts = ts;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ static gboolean bench_update ( void )
|
|||
|
||||
static gboolean xcb_rofi_view_repaint ( G_GNUC_UNUSED void * data )
|
||||
{
|
||||
RofiViewState * state = rofi_view_get_active();
|
||||
RofiViewState * state = rofi_view_get_active ();
|
||||
if ( state ) {
|
||||
// Repaint the view (if needed).
|
||||
// After a resize the edit_pixmap surface might not contain anything anymore.
|
||||
|
@ -242,7 +242,7 @@ static gboolean xcb_rofi_view_repaint ( G_GNUC_UNUSED void * data )
|
|||
TICK_N ( "flush" );
|
||||
XcbState.repaint_source = 0;
|
||||
}
|
||||
return (bench_update () == TRUE )? G_SOURCE_CONTINUE:G_SOURCE_REMOVE;
|
||||
return ( bench_update () == TRUE ) ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void xcb_rofi_view_update ( RofiViewState *state, gboolean qr )
|
||||
|
@ -505,7 +505,7 @@ static void xcb_rofi_view_setup_fake_transparency ( const char* const fake_backg
|
|||
else {
|
||||
char *fpath = rofi_expand_path ( fake_background );
|
||||
g_debug ( "Opening %s to use as background.", fpath );
|
||||
s = cairo_image_surface_create_from_png ( fpath );
|
||||
s = cairo_image_surface_create_from_png ( fpath );
|
||||
XcbState.fake_bgrel = TRUE;
|
||||
g_free ( fpath );
|
||||
}
|
||||
|
@ -603,8 +603,9 @@ static void xcb___create_window ( MenuFlags menu_flags )
|
|||
PangoFontMap *font_map = pango_cairo_font_map_get_default ();
|
||||
pango_cairo_font_map_set_resolution ( (PangoCairoFontMap *) font_map, dpi );
|
||||
config.dpi = dpi;
|
||||
} else {
|
||||
// default pango is 96.
|
||||
}
|
||||
else {
|
||||
// default pango is 96.
|
||||
PangoFontMap *font_map = pango_cairo_font_map_get_default ();
|
||||
config.dpi = pango_cairo_font_map_get_resolution ( (PangoCairoFontMap *) font_map );
|
||||
}
|
||||
|
@ -842,30 +843,30 @@ static void xcb_rofi_view_set_window_title ( const char * title )
|
|||
}
|
||||
|
||||
static view_proxy view_ = {
|
||||
.update = xcb_rofi_view_update,
|
||||
.maybe_update = xcb_rofi_view_maybe_update,
|
||||
.update = xcb_rofi_view_update,
|
||||
.maybe_update = xcb_rofi_view_maybe_update,
|
||||
.temp_configure_notify = xcb_rofi_view_temp_configure_notify,
|
||||
.temp_click_to_exit = xcb_rofi_view_temp_click_to_exit,
|
||||
.frame_callback = xcb_rofi_view_frame_callback,
|
||||
.queue_redraw = xcb_rofi_view_queue_redraw,
|
||||
.temp_click_to_exit = xcb_rofi_view_temp_click_to_exit,
|
||||
.frame_callback = xcb_rofi_view_frame_callback,
|
||||
.queue_redraw = xcb_rofi_view_queue_redraw,
|
||||
|
||||
.set_window_title = xcb_rofi_view_set_window_title,
|
||||
.set_window_title = xcb_rofi_view_set_window_title,
|
||||
.calculate_window_position = xcb_rofi_view_calculate_window_position,
|
||||
.calculate_window_width = xcb_rofi_view_calculate_window_width,
|
||||
.calculate_window_height = xcb_rofi_view_calculate_window_height,
|
||||
.window_update_size = xcb_rofi_view_window_update_size,
|
||||
.calculate_window_width = xcb_rofi_view_calculate_window_width,
|
||||
.calculate_window_height = xcb_rofi_view_calculate_window_height,
|
||||
.window_update_size = xcb_rofi_view_window_update_size,
|
||||
|
||||
.cleanup = xcb_rofi_view_cleanup,
|
||||
.hide = xcb_rofi_view_hide,
|
||||
.reload = xcb_rofi_view_reload,
|
||||
.hide = xcb_rofi_view_hide,
|
||||
.reload = xcb_rofi_view_reload,
|
||||
|
||||
.__create_window = xcb___create_window,
|
||||
.get_window = xcb_rofi_view_get_window,
|
||||
.__create_window = xcb___create_window,
|
||||
.get_window = xcb_rofi_view_get_window,
|
||||
.get_current_monitor = xcb_rofi_view_get_current_monitor,
|
||||
.capture_screenshot = xcb_rofi_view_capture_screenshot,
|
||||
.capture_screenshot = xcb_rofi_view_capture_screenshot,
|
||||
|
||||
.set_size = NULL,
|
||||
.get_size = NULL,
|
||||
};
|
||||
|
||||
const view_proxy *xcb_view_proxy = &view_;
|
||||
const view_proxy *xcb_view_proxy = &view_;
|
||||
|
|
|
@ -483,7 +483,7 @@ static gboolean __config_parser_set_property ( XrmOption *option, const Property
|
|||
return TRUE;
|
||||
}
|
||||
*( option->value.charc ) = ( p->value.c );
|
||||
option->source = CONFIG_FILE_THEME;
|
||||
option->source = CONFIG_FILE_THEME;
|
||||
}
|
||||
else {
|
||||
// TODO add type
|
||||
|
|
Loading…
Add table
Reference in a new issue