1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Indent file, split out opacity code.

This commit is contained in:
QC 2014-07-30 20:54:16 +02:00
parent f1f4e55d43
commit c2ccd37312
2 changed files with 24 additions and 16 deletions

View file

@ -97,6 +97,10 @@ typedef struct _Switcher
Switcher *switchers = NULL;
int num_switchers = 0;
void window_set_opacity ( Display *display, Window box, unsigned int opacity );
int switcher_get ( const char *name )
{
for ( int i = 0; i < num_switchers; i++ ) {
@ -969,6 +973,15 @@ static int levenshtein ( const char *s, const char *t )
return dist ( 0, 0 );
}
void window_set_opacity ( Display *display, Window box, unsigned int opacity )
{
// Hack to set window opacity.
unsigned int opacity_set = ( unsigned int ) ( ( opacity / 100.0 ) * UINT32_MAX );
XChangeProperty ( display, box, netatoms[_NET_WM_WINDOW_OPACITY],
XA_CARDINAL, 32, PropModeReplace,
( unsigned char * ) &opacity_set, 1L );
}
Window create_window ( Display *display )
{
Screen *screen = DefaultScreenOfDisplay ( display );
@ -991,12 +1004,7 @@ Window create_window ( Display *display )
// Set the WM_NAME
XStoreName ( display, box, "rofi" );
// Hack to set window opacity.
unsigned int opacity_set = ( unsigned int ) ( ( config.window_opacity / 100.0 ) * UINT32_MAX );
XChangeProperty ( display, box, netatoms[_NET_WM_WINDOW_OPACITY],
XA_CARDINAL, 32, PropModeReplace,
( unsigned char * ) &opacity_set, 1L );
window_set_opacity ( display, box, config.window_opacity );
return box;
}