mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -05:00
Indent file, split out opacity code.
This commit is contained in:
parent
f1f4e55d43
commit
c2ccd37312
2 changed files with 24 additions and 16 deletions
|
@ -97,6 +97,10 @@ typedef struct _Switcher
|
||||||
Switcher *switchers = NULL;
|
Switcher *switchers = NULL;
|
||||||
int num_switchers = 0;
|
int num_switchers = 0;
|
||||||
|
|
||||||
|
|
||||||
|
void window_set_opacity ( Display *display, Window box, unsigned int opacity );
|
||||||
|
|
||||||
|
|
||||||
int switcher_get ( const char *name )
|
int switcher_get ( const char *name )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < num_switchers; i++ ) {
|
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 );
|
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 )
|
Window create_window ( Display *display )
|
||||||
{
|
{
|
||||||
Screen *screen = DefaultScreenOfDisplay ( display );
|
Screen *screen = DefaultScreenOfDisplay ( display );
|
||||||
|
@ -991,12 +1004,7 @@ Window create_window ( Display *display )
|
||||||
// Set the WM_NAME
|
// Set the WM_NAME
|
||||||
XStoreName ( display, box, "rofi" );
|
XStoreName ( display, box, "rofi" );
|
||||||
|
|
||||||
// Hack to set window opacity.
|
window_set_opacity ( display, box, config.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 );
|
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue