mirror of https://github.com/davatorium/rofi.git
Remove duplicate code.
This commit is contained in:
parent
238a34162a
commit
b70421e75b
|
@ -33,14 +33,14 @@ 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,
|
||||||
} TextboxFlags;
|
} TextboxFlags;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
|
@ -1110,6 +1110,25 @@ static void menu_resize ( MenuState *state )
|
||||||
state->update = TRUE;
|
state->update = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void menu_setup_fake_transparency ( Display *display, MenuState *state )
|
||||||
|
{
|
||||||
|
Window root = DefaultRootWindow ( display );
|
||||||
|
int screen = DefaultScreen ( display );
|
||||||
|
cairo_surface_t *s = cairo_xlib_surface_create ( display,
|
||||||
|
root,
|
||||||
|
DefaultVisual ( display, screen ),
|
||||||
|
DisplayWidth ( display, screen ),
|
||||||
|
DisplayHeight ( display, screen ) );
|
||||||
|
|
||||||
|
state->bg = cairo_image_surface_create ( get_format (), state->mon.w, state->mon.h );
|
||||||
|
cairo_t *dr = cairo_create ( state->bg );
|
||||||
|
cairo_set_source_surface ( dr, s, -state->mon.x, -state->mon.y );
|
||||||
|
cairo_paint ( dr );
|
||||||
|
cairo_destroy ( dr );
|
||||||
|
cairo_surface_destroy ( s );
|
||||||
|
TICK_N ( "Fake transparency" )
|
||||||
|
}
|
||||||
|
|
||||||
MenuReturn menu ( Switcher *sw, char **input, char *prompt, unsigned int *selected_line, unsigned int *next_pos, const char *message )
|
MenuReturn menu ( Switcher *sw, char **input, char *prompt, unsigned int *selected_line, unsigned int *next_pos, const char *message )
|
||||||
{
|
{
|
||||||
TICK ()
|
TICK ()
|
||||||
|
@ -1203,21 +1222,7 @@ MenuReturn menu ( Switcher *sw, char **input, char *prompt, unsigned int *select
|
||||||
monitor_active ( display, &( state.mon ) );
|
monitor_active ( display, &( state.mon ) );
|
||||||
TICK_N ( "Get active monitor" )
|
TICK_N ( "Get active monitor" )
|
||||||
if ( config.fake_transparency ) {
|
if ( config.fake_transparency ) {
|
||||||
Window root = DefaultRootWindow ( display );
|
menu_setup_fake_transparency ( display, &state );
|
||||||
int screen = DefaultScreen ( display );
|
|
||||||
cairo_surface_t *s = cairo_xlib_surface_create ( display,
|
|
||||||
root,
|
|
||||||
DefaultVisual ( display, screen ),
|
|
||||||
DisplayWidth ( display, screen ),
|
|
||||||
DisplayHeight ( display, screen ) );
|
|
||||||
|
|
||||||
state.bg = cairo_image_surface_create ( get_format (), state.mon.w, state.mon.h );
|
|
||||||
cairo_t *dr = cairo_create ( state.bg );
|
|
||||||
cairo_set_source_surface ( dr, s, -state.mon.x, -state.mon.y );
|
|
||||||
cairo_paint ( dr );
|
|
||||||
cairo_destroy ( dr );
|
|
||||||
cairo_surface_destroy ( s );
|
|
||||||
TICK_N ( "Fake transparency" )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need this at this point so we can get height.
|
// we need this at this point so we can get height.
|
||||||
|
@ -1614,20 +1619,7 @@ void error_dialog ( const char *msg, int markup )
|
||||||
// Get active monitor size.
|
// Get active monitor size.
|
||||||
monitor_active ( display, &( state.mon ) );
|
monitor_active ( display, &( state.mon ) );
|
||||||
if ( config.fake_transparency ) {
|
if ( config.fake_transparency ) {
|
||||||
Window root = DefaultRootWindow ( display );
|
menu_setup_fake_transparency ( display, &state );
|
||||||
int screen = DefaultScreen ( display );
|
|
||||||
cairo_surface_t *s = cairo_xlib_surface_create ( display,
|
|
||||||
root,
|
|
||||||
DefaultVisual ( display, screen ),
|
|
||||||
DisplayWidth ( display, screen ),
|
|
||||||
DisplayHeight ( display, screen ) );
|
|
||||||
|
|
||||||
state.bg = cairo_image_surface_create ( get_format (), state.mon.w, state.mon.h );
|
|
||||||
cairo_t *dr = cairo_create ( state.bg );
|
|
||||||
cairo_set_source_surface ( dr, s, -state.mon.x, -state.mon.y );
|
|
||||||
cairo_paint ( dr );
|
|
||||||
cairo_destroy ( dr );
|
|
||||||
cairo_surface_destroy ( s );
|
|
||||||
}
|
}
|
||||||
// main window isn't explicitly destroyed in case we switch modes. Reusing it prevents flicker
|
// main window isn't explicitly destroyed in case we switch modes. Reusing it prevents flicker
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
|
Loading…
Reference in New Issue