1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

conky back under WM control for own_window yes

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@541 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2006-03-06 05:58:58 +00:00
parent 838da14952
commit d265a2d05a
4 changed files with 45 additions and 12 deletions

View File

@ -3,6 +3,8 @@
2006-03-05
* Added patch to make $cpu stuff work on alpha (thanks Thomas Cort)
http://bugs.gentoo.org/show_bug.cgi?id=122637#c3
* Stop using override_redirect true -- conky back under WM control
when using 'own_window yes'.
2006-02-14
* Drastically simplified own_window=yes window creation code.

View File

@ -4550,6 +4550,16 @@ static void main_loop()
set_font();
}
break;
case ButtonPress:
if (own_window)
{
/* forward the click to the root window */
XUngrabPointer(display, ev.xbutton.time);
ev.xbutton.window = window.root;
XSendEvent(display, ev.xbutton.window, False, ButtonPressMask, &ev);
}
break;
#endif
default:
@ -5587,7 +5597,7 @@ int main(int argc, char **argv)
(own_window,
text_width + border_margin * 2 + 1,
text_height + border_margin * 2 + 1,
set_transparent, background_colour, info.uname_s.nodename);
set_transparent, background_colour, info.uname_s.nodename, argv, argc);
update_text_area(); /* to position text/window on screen */
#endif /* X11 */

View File

@ -337,7 +337,8 @@ extern int workarea[4];
extern struct conky_window window;
void init_X11();
void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, char * nodename);
void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, char * nodename,
char **argv, int argc);
void create_gc();
void set_transparent_background(Window win);
long get_x11_color(const char *);

View File

@ -173,7 +173,8 @@ inline void set_transparent_background(Window win)
//XClearWindow(display, win); not sure why this was here
}
void init_window(int own_window, int w, int h, int set_trans, int back_colour, char * nodename)
void init_window(int own_window, int w, int h, int set_trans, int back_colour, char * nodename,
char **argv, int argc)
{
/* There seems to be some problems with setting transparent background (on
* fluxbox this time). It doesn't happen always and I don't know why it
@ -186,15 +187,19 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, c
#ifdef OWN_WINDOW
if (own_window) {
{
/* DRASTICALLY SIMPLIFIED -
* override_redirect=True impedes the WM from manipulating
* the window, adding decorations, etc. we do not register
* for button events so you should have menu clicking over
* the conky window now too. PHK. */
/* Allow WM control of conky again. Shielding conky from the WM
* via override redirect creates more problems than it's worth and
* makes it impossible to use tools like devilspie to manage the
* conky windows beyond the parametsrs we offer. Also, button
* press events are now explicitly forwarded to the root window. */
XSetWindowAttributes attrs = {
ParentRelative,0L,0,0L,0,0,Always,0L,0L,False,
StructureNotifyMask|ExposureMask,
0L,True,0,0 };
StructureNotifyMask|ExposureMask|ButtonPressMask,
0L,False,0,0 };
XClassHint classHint;
XWMHints wmHint;
char window_title[256];
window.root = find_desktop_window();
@ -207,8 +212,23 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, c
fprintf(stderr, "Conky: drawing to created window (%lx)\n", window.window);
XLowerWindow(display, window.window);
classHint.res_name = "conky";
classHint.res_class = classHint.res_name;
wmHint.flags = InputHint | StateHint;
wmHint.input = False;
wmHint.initial_state = NormalState;
sprintf(window_title,WINDOW_NAME_FMT,nodename);
XmbSetWMProperties (display, window.window, window_title, NULL,
argv, argc,
NULL, &wmHint, &classHint);
/* Sets an empty WM_PROTOCOLS property */
XSetWMProtocols(display,window.window,NULL,0);
XLowerWindow(display, window.window);
XMapWindow(display, window.window);
}
@ -269,7 +289,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, c
XSelectInput(display, window.window, ExposureMask
#ifdef OWN_WINDOW
| (own_window
? (StructureNotifyMask | PropertyChangeMask) : 0)
? (StructureNotifyMask | PropertyChangeMask | ButtonPressMask) : 0)
#endif
);
}