mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -05:00
Remove old cairo color set functions
This commit is contained in:
parent
78916c6a94
commit
f42e4ffbd7
8 changed files with 16 additions and 114 deletions
|
@ -48,16 +48,16 @@ typedef struct
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TB_AUTOHEIGHT = 1 << 0,
|
TB_AUTOHEIGHT = 1 << 0,
|
||||||
TB_AUTOWIDTH = 1 << 1,
|
TB_AUTOWIDTH = 1 << 1,
|
||||||
TB_LEFT = 1 << 16,
|
TB_LEFT = 1 << 16,
|
||||||
TB_RIGHT = 1 << 17,
|
TB_RIGHT = 1 << 17,
|
||||||
TB_CENTER = 1 << 18,
|
TB_CENTER = 1 << 18,
|
||||||
TB_EDITABLE = 1 << 19,
|
TB_EDITABLE = 1 << 19,
|
||||||
TB_MARKUP = 1 << 20,
|
TB_MARKUP = 1 << 20,
|
||||||
TB_WRAP = 1 << 21,
|
TB_WRAP = 1 << 21,
|
||||||
TB_PASSWORD = 1 << 22,
|
TB_PASSWORD = 1 << 22,
|
||||||
TB_INDICATOR = 1 << 23,
|
TB_INDICATOR = 1 << 23,
|
||||||
} TextboxFlags;
|
} TextboxFlags;
|
||||||
/**
|
/**
|
||||||
* Flags indicating current state of the textbox.
|
* Flags indicating current state of the textbox.
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct _widget
|
||||||
/** Handle mouse motion, used for dragging */
|
/** Handle mouse motion, used for dragging */
|
||||||
gboolean ( *motion_notify )( struct _widget *, xcb_motion_notify_event_t * );
|
gboolean ( *motion_notify )( struct _widget *, xcb_motion_notify_event_t * );
|
||||||
|
|
||||||
int (*get_desired_height) ( struct _widget * );
|
int ( *get_desired_height )( struct _widget * );
|
||||||
|
|
||||||
/** widget clicked callback */
|
/** widget clicked callback */
|
||||||
widget_clicked_cb clicked;
|
widget_clicked_cb clicked;
|
||||||
|
|
|
@ -216,34 +216,6 @@ typedef struct
|
||||||
*/
|
*/
|
||||||
Color color_get ( const char *const name );
|
Color color_get ( const char *const name );
|
||||||
|
|
||||||
/**
|
|
||||||
* @param d cairo drawing context to set color on
|
|
||||||
*
|
|
||||||
* Set cairo drawing context source color to the background color.
|
|
||||||
*/
|
|
||||||
void color_background ( cairo_t *d );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param d cairo drawing context to set color on
|
|
||||||
*
|
|
||||||
* Set cairo drawing context source color to the border color.
|
|
||||||
*/
|
|
||||||
void color_border ( cairo_t *d );
|
|
||||||
/**
|
|
||||||
* @param d cairo drawing context to set color on
|
|
||||||
*
|
|
||||||
* Set cairo drawing context source color to the separator color.
|
|
||||||
*/
|
|
||||||
void color_separator ( cairo_t *d );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param d cairo drawing context to set color on.
|
|
||||||
* @param col The color to set.
|
|
||||||
*
|
|
||||||
* Sets col as cairo source color.
|
|
||||||
*/
|
|
||||||
void x11_helper_set_cairo_rgba ( cairo_t *d, Color col );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a surface containing the background image of the desktop.
|
* Gets a surface containing the background image of the desktop.
|
||||||
*
|
*
|
||||||
|
|
|
@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
|
||||||
// Reading one line per time.
|
// Reading one line per time.
|
||||||
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
|
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
|
||||||
// Evaluate one line.
|
// Evaluate one line.
|
||||||
unsigned int index = 0, ti = 0;
|
unsigned int index = 0, ti = 0;
|
||||||
char *token = buffer;
|
char *token = buffer;
|
||||||
|
|
||||||
// Tokenize it.
|
// Tokenize it.
|
||||||
|
|
|
@ -248,7 +248,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
|
||||||
}
|
}
|
||||||
|
|
||||||
char *saveptr = NULL, *token;
|
char *saveptr = NULL, *token;
|
||||||
GRegex **retv = NULL;
|
GRegex **retv = NULL;
|
||||||
if ( !config.tokenize ) {
|
if ( !config.tokenize ) {
|
||||||
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
|
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
|
||||||
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
|
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
|
||||||
|
|
|
@ -397,7 +397,7 @@ static int add_mode ( const char * token )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // WINDOW_MODE
|
#endif // WINDOW_MODE
|
||||||
// SSh dialog
|
// SSh dialog
|
||||||
if ( strcasecmp ( token, "ssh" ) == 0 ) {
|
if ( strcasecmp ( token, "ssh" ) == 0 ) {
|
||||||
modi[num_modi] = &ssh_mode;
|
modi[num_modi] = &ssh_mode;
|
||||||
num_modi++;
|
num_modi++;
|
||||||
|
@ -608,7 +608,7 @@ static gboolean lazy_grab_keyboard ( G_GNUC_UNUSED gpointer data )
|
||||||
if ( take_keyboard ( xcb_stuff_get_root_window ( xcb ), 0 ) ) {
|
if ( take_keyboard ( xcb_stuff_get_root_window ( xcb ), 0 ) ) {
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
lazy_grab_retry_count_kb ++;
|
lazy_grab_retry_count_kb++;
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ static void texbox_update ( textbox *tb )
|
||||||
|
|
||||||
int cursor_x = 0;
|
int cursor_x = 0;
|
||||||
int cursor_y = 0;
|
int cursor_y = 0;
|
||||||
int cursor_width = 2;//MAX ( 2, font_height / 10 );
|
int cursor_width = 2; //MAX ( 2, font_height / 10 );
|
||||||
int cursor_height = font_height;
|
int cursor_height = font_height;
|
||||||
|
|
||||||
if ( tb->changed ) {
|
if ( tb->changed ) {
|
||||||
|
|
|
@ -851,76 +851,6 @@ Color color_get ( const char *const name )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void x11_helper_set_cairo_rgba ( cairo_t *d, Color col )
|
|
||||||
{
|
|
||||||
cairo_set_source_rgba ( d, col.red, col.green, col.blue, col.alpha );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of colors stored
|
|
||||||
*/
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
BACKGROUND,
|
|
||||||
BORDER,
|
|
||||||
SEPARATOR
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Color cache.
|
|
||||||
*
|
|
||||||
* This stores the current color until
|
|
||||||
*/
|
|
||||||
static struct
|
|
||||||
{
|
|
||||||
/** The color */
|
|
||||||
Color color;
|
|
||||||
/** Flag indicating it is set. */
|
|
||||||
unsigned int set;
|
|
||||||
} color_cache[3];
|
|
||||||
|
|
||||||
void color_background ( cairo_t *d )
|
|
||||||
{
|
|
||||||
if ( !color_cache[BACKGROUND].set ) {
|
|
||||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
|
||||||
if ( vals != NULL && vals[0] != NULL ) {
|
|
||||||
color_cache[BACKGROUND].color = color_get ( vals[0] );
|
|
||||||
}
|
|
||||||
g_strfreev ( vals );
|
|
||||||
color_cache[BACKGROUND].set = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
x11_helper_set_cairo_rgba ( d, color_cache[BACKGROUND].color );
|
|
||||||
}
|
|
||||||
|
|
||||||
void color_border ( cairo_t *d )
|
|
||||||
{
|
|
||||||
if ( !color_cache[BORDER].set ) {
|
|
||||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
|
||||||
if ( vals != NULL && vals[0] != NULL && vals[1] != NULL ) {
|
|
||||||
color_cache[BORDER].color = color_get ( vals[1] );
|
|
||||||
}
|
|
||||||
g_strfreev ( vals );
|
|
||||||
color_cache[BORDER].set = TRUE;
|
|
||||||
}
|
|
||||||
x11_helper_set_cairo_rgba ( d, color_cache[BORDER].color );
|
|
||||||
}
|
|
||||||
|
|
||||||
void color_separator ( cairo_t *d )
|
|
||||||
{
|
|
||||||
if ( !color_cache[SEPARATOR].set ) {
|
|
||||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
|
||||||
if ( vals != NULL && vals[0] != NULL && vals[1] != NULL && vals[2] != NULL ) {
|
|
||||||
color_cache[SEPARATOR].color = color_get ( vals[2] );
|
|
||||||
}
|
|
||||||
else if ( vals != NULL && vals[0] != NULL && vals[1] != NULL ) {
|
|
||||||
color_cache[SEPARATOR].color = color_get ( vals[1] );
|
|
||||||
}
|
|
||||||
g_strfreev ( vals );
|
|
||||||
color_cache[SEPARATOR].set = TRUE;
|
|
||||||
}
|
|
||||||
x11_helper_set_cairo_rgba ( d, color_cache[SEPARATOR].color );
|
|
||||||
}
|
|
||||||
|
|
||||||
xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb )
|
xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb )
|
||||||
{
|
{
|
||||||
return xcb->screen->root;
|
return xcb->screen->root;
|
||||||
|
|
Loading…
Add table
Reference in a new issue