detect start/stop composite manager. and answer to question.
git-svn-id: http://tint2.googlecode.com/svn/trunk@359 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
8efe25f851
commit
5b645eeffb
3 changed files with 33 additions and 5 deletions
19
src/server.c
19
src/server.c
|
@ -92,6 +92,10 @@ void server_init_atoms ()
|
|||
server.atom.XdndAware = XInternAtom(server.dsp, "XdndAware", False);
|
||||
server.atom.XdndPosition = XInternAtom(server.dsp, "XdndPosition", False);
|
||||
server.atom.XdndStatus = XInternAtom(server.dsp, "XdndStatus", False);
|
||||
|
||||
server.colormap = 0;
|
||||
server.monitor = 0;
|
||||
server.gc = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,18 +332,23 @@ void server_init_visual()
|
|||
XFree (xvi);
|
||||
|
||||
// check composite manager
|
||||
if (XGetSelectionOwner(server.dsp, server.atom._NET_WM_CM_S0) == None)
|
||||
real_transparency = 0;
|
||||
else
|
||||
real_transparency = 1;
|
||||
server.composite_manager = XGetSelectionOwner(server.dsp, server.atom._NET_WM_CM_S0);
|
||||
if (server.colormap)
|
||||
XFreeColormap(server.dsp, server.colormap);
|
||||
|
||||
if (visual && real_transparency) {
|
||||
if (visual && server.composite_manager != None) {
|
||||
XSetWindowAttributes attrs;
|
||||
attrs.event_mask = StructureNotifyMask;
|
||||
XChangeWindowAttributes (server.dsp, server.composite_manager, CWEventMask, &attrs);
|
||||
|
||||
real_transparency = 1;
|
||||
server.depth = 32;
|
||||
printf("real transparency on... depth: %d\n", server.depth);
|
||||
server.colormap = XCreateColormap(server.dsp, server.root_win, visual, AllocNone);
|
||||
server.visual = visual;
|
||||
}
|
||||
else {
|
||||
real_transparency = 0;
|
||||
server.depth = DefaultDepth(server.dsp, server.screen);
|
||||
printf("real transparency off.... depth: %d\n", server.depth);
|
||||
server.colormap = DefaultColormap(server.dsp, server.screen);
|
||||
|
|
|
@ -84,6 +84,7 @@ typedef struct
|
|||
{
|
||||
Display *dsp;
|
||||
Window root_win;
|
||||
Window composite_manager;
|
||||
// current desktop
|
||||
int desktop;
|
||||
int screen;
|
||||
|
|
18
src/tint.c
18
src/tint.c
|
@ -636,6 +636,7 @@ void dnd_message(XClientMessageEvent *e)
|
|||
int main (int argc, char *argv[])
|
||||
{
|
||||
XEvent e;
|
||||
XClientMessageEvent *ev;
|
||||
fd_set fdset;
|
||||
int x11_fd, i;
|
||||
Panel *panel;
|
||||
|
@ -677,6 +678,8 @@ int main (int argc, char *argv[])
|
|||
panel_refresh = 0;
|
||||
|
||||
// QUESTION: do we need this first refresh_systray, because we check refresh_systray once again later...
|
||||
// ANSWER: yes, panel->temp_pmap is freeded in the loop.
|
||||
// we change background to None to avoid tray icon using freeded pixmap.
|
||||
if (refresh_systray) {
|
||||
panel = (Panel*)systray.area.panel;
|
||||
XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
|
||||
|
@ -781,6 +784,12 @@ int main (int argc, char *argv[])
|
|||
break;
|
||||
case UnmapNotify:
|
||||
case DestroyNotify:
|
||||
if (e.xany.window == server.composite_manager) {
|
||||
printf("Stop composite.\n");
|
||||
//signal_pending = SIGUSR2;
|
||||
server_init_visual();
|
||||
break;
|
||||
}
|
||||
if (e.xany.window == g_tooltip.window || !systray.area.on_screen)
|
||||
break;
|
||||
for (it = systray.list_icons; it; it = g_slist_next(it)) {
|
||||
|
@ -792,6 +801,15 @@ int main (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case ClientMessage:
|
||||
ev = &e;
|
||||
if (ev->data.l[1] == server.atom._NET_WM_CM_S0) {
|
||||
if (ev->data.l[2] == None)
|
||||
printf("Stop composite 2.\n");
|
||||
else
|
||||
printf("Start composite.\n");
|
||||
server_init_visual();
|
||||
//signal_pending = SIGUSR2;
|
||||
}
|
||||
if (!systray.area.on_screen) break;
|
||||
if (e.xclient.message_type == server.atom._NET_SYSTEM_TRAY_OPCODE && e.xclient.format == 32 && e.xclient.window == net_sel_win) {
|
||||
net_message(&e.xclient);
|
||||
|
|
Loading…
Reference in a new issue