mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
make own_window a lua setting
This commit is contained in:
parent
12e98c7da5
commit
efac83e814
34
src/conky.cc
34
src/conky.cc
@ -365,7 +365,6 @@ long default_fg_color, default_bg_color, default_out_color;
|
|||||||
static int set_transparent = 0;
|
static int set_transparent = 0;
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
static int own_window = 0;
|
|
||||||
static int background_colour = 0;
|
static int background_colour = 0;
|
||||||
|
|
||||||
/* fixed size/pos is set if wm/user changes them */
|
/* fixed size/pos is set if wm/user changes them */
|
||||||
@ -973,7 +972,7 @@ static void update_text_area(void)
|
|||||||
#endif /* OWN_WINDOW */
|
#endif /* OWN_WINDOW */
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
|
|
||||||
if (own_window && !fixed_pos) {
|
if (own_window.get(*state) && !fixed_pos) {
|
||||||
x += workarea[0];
|
x += workarea[0];
|
||||||
y += workarea[1];
|
y += workarea[1];
|
||||||
text_start_x = window.border_inner_margin + window.border_outer_margin + window.border_width;
|
text_start_x = window.border_inner_margin + window.border_outer_margin + window.border_width;
|
||||||
@ -1956,7 +1955,7 @@ static void main_loop(void)
|
|||||||
selected_font = 0;
|
selected_font = 0;
|
||||||
update_text_area();
|
update_text_area();
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
if (own_window) {
|
if (own_window.get(*state)) {
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
|
||||||
/* resize window if it isn't right size */
|
/* resize window if it isn't right size */
|
||||||
@ -2071,13 +2070,13 @@ static void main_loop(void)
|
|||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
case ReparentNotify:
|
case ReparentNotify:
|
||||||
/* make background transparent */
|
/* make background transparent */
|
||||||
if (own_window) {
|
if (own_window.get(*state)) {
|
||||||
set_transparent_background(window.window, own_window_argb_value);
|
set_transparent_background(window.window, own_window_argb_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
if (own_window) {
|
if (own_window.get(*state)) {
|
||||||
/* if window size isn't what expected, set fixed size */
|
/* if window size isn't what expected, set fixed size */
|
||||||
if (ev.xconfigure.width != window.width
|
if (ev.xconfigure.width != window.width
|
||||||
|| ev.xconfigure.height != window.height) {
|
|| ev.xconfigure.height != window.height) {
|
||||||
@ -2121,7 +2120,7 @@ static void main_loop(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
if (own_window) {
|
if (own_window.get(*state)) {
|
||||||
/* if an ordinary window with decorations */
|
/* if an ordinary window with decorations */
|
||||||
if ((window.type == TYPE_NORMAL &&
|
if ((window.type == TYPE_NORMAL &&
|
||||||
(!TEST_HINT(window.hints,
|
(!TEST_HINT(window.hints,
|
||||||
@ -2144,7 +2143,7 @@ static void main_loop(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
if (own_window) {
|
if (own_window.get(*state)) {
|
||||||
/* if an ordinary window with decorations */
|
/* if an ordinary window with decorations */
|
||||||
if ((window.type == TYPE_NORMAL)
|
if ((window.type == TYPE_NORMAL)
|
||||||
&& (!TEST_HINT(window.hints,
|
&& (!TEST_HINT(window.hints,
|
||||||
@ -2573,7 +2572,6 @@ static void set_default_configurations(void)
|
|||||||
minimum_height = 5;
|
minimum_height = 5;
|
||||||
maximum_width = 0;
|
maximum_width = 0;
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
own_window = 0;
|
|
||||||
window.type = TYPE_NORMAL;
|
window.type = TYPE_NORMAL;
|
||||||
window.hints = 0;
|
window.hints = 0;
|
||||||
strcpy(window.class_name, PACKAGE_NAME);
|
strcpy(window.class_name, PACKAGE_NAME);
|
||||||
@ -2699,11 +2697,11 @@ static void X11_create_window(void)
|
|||||||
{
|
{
|
||||||
if (out_to_x.get(*state)) {
|
if (out_to_x.get(*state)) {
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
init_window(own_window, text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
||||||
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, background_colour,
|
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, background_colour,
|
||||||
xargv, xargc);
|
xargv, xargc);
|
||||||
#else /* OWN_WINDOW */
|
#else /* OWN_WINDOW */
|
||||||
init_window(0, text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
||||||
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, 0,
|
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, 0,
|
||||||
xargv, xargc);
|
xargv, xargc);
|
||||||
#endif /* OWN_WINDOW */
|
#endif /* OWN_WINDOW */
|
||||||
@ -2713,10 +2711,10 @@ static void X11_create_window(void)
|
|||||||
update_text_area(); /* to position text/window on screen */
|
update_text_area(); /* to position text/window on screen */
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
if (own_window && !fixed_pos) {
|
if (own_window.get(*state)) {
|
||||||
XMoveWindow(display, window.window, window.x, window.y);
|
if (not fixed_pos)
|
||||||
}
|
XMoveWindow(display, window.window, window.x, window.y);
|
||||||
if (own_window) {
|
|
||||||
set_transparent_background(window.window, own_window_argb_value);
|
set_transparent_background(window.window, own_window_argb_value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3245,11 +3243,6 @@ char load_config_file(const char *f)
|
|||||||
}
|
}
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
CONF("own_window") {
|
|
||||||
if (value) {
|
|
||||||
own_window = string_to_bool(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CONF("own_window_class") {
|
CONF("own_window_class") {
|
||||||
if (value) {
|
if (value) {
|
||||||
memset(window.class_name, 0, sizeof(window.class_name));
|
memset(window.class_name, 0, sizeof(window.class_name));
|
||||||
@ -3979,7 +3972,8 @@ void initialisation(int argc, char **argv) {
|
|||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
case 'o':
|
case 'o':
|
||||||
own_window = 1;
|
state->pushboolean(true);
|
||||||
|
own_window.lua_set(*state);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_XDBE
|
#ifdef BUILD_XDBE
|
||||||
|
10
src/x11.cc
10
src/x11.cc
@ -263,7 +263,7 @@ void destroy_window(void)
|
|||||||
colour_set = -1;
|
colour_set = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
void init_window(int w, int h, int set_trans, int back_colour,
|
||||||
char **argv, int argc)
|
char **argv, int argc)
|
||||||
{
|
{
|
||||||
/* There seems to be some problems with setting transparent background
|
/* There seems to be some problems with setting transparent background
|
||||||
@ -274,7 +274,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
|||||||
window_created = 1;
|
window_created = 1;
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
if (own_window) {
|
if (own_window.get(*state)) {
|
||||||
int depth = 0, flags;
|
int depth = 0, flags;
|
||||||
Visual *visual = NULL;
|
Visual *visual = NULL;
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
|||||||
|
|
||||||
XSelectInput(display, window.window, ExposureMask | PropertyChangeMask
|
XSelectInput(display, window.window, ExposureMask | PropertyChangeMask
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
| (own_window ? (StructureNotifyMask |
|
| (own_window.get(*state) ? (StructureNotifyMask |
|
||||||
ButtonPressMask | ButtonReleaseMask) : 0)
|
ButtonPressMask | ButtonReleaseMask) : 0)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@ -928,3 +928,7 @@ conky::lua_traits<alignment>::Map conky::lua_traits<alignment>::map = {
|
|||||||
conky::config_setting<alignment> text_alignment("alignment", conky::simple_accessors<alignment>(NONE, false));
|
conky::config_setting<alignment> text_alignment("alignment", conky::simple_accessors<alignment>(NONE, false));
|
||||||
|
|
||||||
conky::config_setting<bool> out_to_x("out_to_x", conky::simple_accessors<bool>(false, false));
|
conky::config_setting<bool> out_to_x("out_to_x", conky::simple_accessors<bool>(false, false));
|
||||||
|
|
||||||
|
#ifdef OWN_WINDOW
|
||||||
|
conky::config_setting<bool> own_window("own_window", conky::simple_accessors<bool>(false, false));
|
||||||
|
#endif
|
||||||
|
@ -120,7 +120,7 @@ extern struct conky_window window;
|
|||||||
extern char window_created;
|
extern char window_created;
|
||||||
|
|
||||||
void init_X11(const char*);
|
void init_X11(const char*);
|
||||||
void init_window(int use_own_window, int width, int height, int set_trans,
|
void init_window(int width, int height, int set_trans,
|
||||||
int back_colour, char **argv, int argc);
|
int back_colour, char **argv, int argc);
|
||||||
void destroy_window(void);
|
void destroy_window(void);
|
||||||
void create_gc(void);
|
void create_gc(void);
|
||||||
@ -156,5 +156,9 @@ enum alignment {
|
|||||||
extern conky::config_setting<alignment> text_alignment;
|
extern conky::config_setting<alignment> text_alignment;
|
||||||
extern conky::config_setting<bool> out_to_x;
|
extern conky::config_setting<bool> out_to_x;
|
||||||
|
|
||||||
|
#ifdef OWN_WINDOW
|
||||||
|
extern conky::config_setting<bool> own_window;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /*X11_H_*/
|
#endif /*X11_H_*/
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
Loading…
Reference in New Issue
Block a user