mirror of
https://github.com/lbonn/rofi
synced 2024-11-15 08:37:17 +00:00
Get color type.
This commit is contained in:
parent
eba2170241
commit
6061e046de
4 changed files with 16 additions and 3 deletions
|
@ -151,4 +151,6 @@ unsigned int color_get ( Display *display, const char *const name, const char *
|
|||
unsigned int color_background ( Display *display );
|
||||
unsigned int color_border ( Display *display );
|
||||
unsigned int color_separator ( Display *display );
|
||||
|
||||
cairo_format_t get_format(void);
|
||||
#endif
|
||||
|
|
|
@ -853,7 +853,7 @@ static void menu_draw ( MenuState *state, cairo_t *draw )
|
|||
|
||||
static void menu_update ( MenuState *state )
|
||||
{
|
||||
cairo_surface_t *surf = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, state->w, state->h );
|
||||
cairo_surface_t *surf = cairo_image_surface_create ( get_format(), state->w, state->h );
|
||||
cairo_t *d = cairo_create ( surf );
|
||||
cairo_set_operator ( d, CAIRO_OPERATOR_SOURCE );
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ textbox* textbox_create ( TextboxFlags flags, short x, short y, short w, short h
|
|||
|
||||
tb->changed = FALSE;
|
||||
|
||||
tb->main_surface = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, tb->w, tb->h );
|
||||
tb->main_surface = cairo_image_surface_create ( get_format(), tb->w, tb->h );
|
||||
tb->main_draw = cairo_create ( tb->main_surface );
|
||||
tb->layout = pango_cairo_create_layout ( tb->main_draw );
|
||||
PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font );
|
||||
|
@ -224,7 +224,7 @@ static void texbox_update ( textbox *tb )
|
|||
tb->main_draw = NULL;
|
||||
tb->main_surface = NULL;
|
||||
}
|
||||
tb->main_surface = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, tb->w, tb->h );
|
||||
tb->main_surface = cairo_image_surface_create ( get_format(), tb->w, tb->h );
|
||||
tb->main_draw = cairo_create ( tb->main_surface );
|
||||
PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font );
|
||||
pango_font_description_free ( pfd );
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <glib.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
@ -487,6 +488,16 @@ void create_visual_and_colormap ( Display *display )
|
|||
map = DefaultColormap ( display, screen );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cairo_format_t get_format(void)
|
||||
{
|
||||
if(truecolor){
|
||||
return CAIRO_FORMAT_ARGB32;
|
||||
}
|
||||
return CAIRO_FORMAT_RGB24;
|
||||
}
|
||||
|
||||
unsigned int color_get ( Display *display, const char *const name, const char * const defn )
|
||||
{
|
||||
XColor color = { 0, 0, 0, 0, 0, 0 };
|
||||
|
|
Loading…
Reference in a new issue