fixed some bugs
git-svn-id: http://tint2.googlecode.com/svn/trunk@69 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
@@ -177,6 +177,7 @@ void resize_clock (void *obj)
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
panel1[i].area.resize = 1;
|
||||
}
|
||||
systray.area.resize = 1;
|
||||
panel_refresh = 1;
|
||||
}
|
||||
|
||||
|
||||
11
src/config.c
11
src/config.c
@@ -309,9 +309,14 @@ void add_entry (char *key, char *value)
|
||||
/* Clock */
|
||||
else if (strcmp (key, "time1_format") == 0) {
|
||||
if (time1_format) g_free(time1_format);
|
||||
if (strlen(value) > 0) time1_format = strdup (value);
|
||||
else time1_format = 0;
|
||||
panel_config->clock.area.on_screen = 1;
|
||||
if (strlen(value) > 0) {
|
||||
time1_format = strdup (value);
|
||||
panel_config->clock.area.on_screen = 1;
|
||||
}
|
||||
else {
|
||||
time1_format = 0;
|
||||
panel_config->clock.area.on_screen = 0;
|
||||
}
|
||||
}
|
||||
else if (strcmp (key, "time2_format") == 0) {
|
||||
if (time2_format) g_free(time2_format);
|
||||
|
||||
@@ -134,6 +134,7 @@ void cleanup_panel()
|
||||
{
|
||||
if (!panel1) return;
|
||||
|
||||
cleanup_systray();
|
||||
cleanup_taskbar();
|
||||
|
||||
// font allocated once
|
||||
|
||||
@@ -45,23 +45,14 @@ Systraybar systray;
|
||||
|
||||
void init_systray()
|
||||
{
|
||||
cleanup_systray();
|
||||
|
||||
Panel *panel = &panel1[0];
|
||||
systray.area.parent = panel;
|
||||
systray.area.panel = panel;
|
||||
systray.area._draw_foreground = draw_systray;
|
||||
systray.area._resize = resize_systray;
|
||||
|
||||
if (systray.area.on_screen) {
|
||||
if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != None) {
|
||||
fprintf(stderr, "tint2 : another systray is running\n");
|
||||
systray.area.on_screen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (systray.area.on_screen)
|
||||
systray.area.on_screen = net_init();
|
||||
systray.area.on_screen = init_net();
|
||||
|
||||
if (!systray.area.on_screen)
|
||||
return;
|
||||
@@ -94,10 +85,7 @@ void cleanup_systray()
|
||||
|
||||
free_area(&systray.area);
|
||||
|
||||
if (net_sel_win != None) {
|
||||
XDestroyWindow(server.dsp, net_sel_win);
|
||||
net_sel_win = None;
|
||||
}
|
||||
cleanup_net();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,11 +97,11 @@ void draw_systray(void *obj, cairo_t *c, int active)
|
||||
GSList *l;
|
||||
int icon_size;
|
||||
|
||||
printf("draw_systray %d %d\n", systray.area.posx, systray.area.width);
|
||||
icon_size = sysbar->area.height - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy);
|
||||
for (l = systray.list_icons; l ; l = l->next) {
|
||||
traywin = (TrayWindow*)l->data;
|
||||
|
||||
printf("draw_systray %d %d\n", systray.area.posx, systray.area.width);
|
||||
// watch for the icon trying to resize itself!
|
||||
XSelectInput(server.dsp, traywin->id, StructureNotifyMask);
|
||||
|
||||
@@ -171,8 +159,13 @@ void resize_systray(void *obj)
|
||||
}
|
||||
|
||||
|
||||
int net_init()
|
||||
int init_net()
|
||||
{
|
||||
if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != None) {
|
||||
fprintf(stderr, "tint2 : another systray is running\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// init systray protocol
|
||||
net_sel_win = XCreateSimpleWindow(server.dsp, server.root_win, -1, -1, 1, 1, 0, 0, 0);
|
||||
|
||||
@@ -202,7 +195,13 @@ int net_init()
|
||||
}
|
||||
|
||||
|
||||
//int width, height;
|
||||
void cleanup_net()
|
||||
{
|
||||
if (net_sel_win != None) {
|
||||
XDestroyWindow(server.dsp, net_sel_win);
|
||||
net_sel_win = None;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void fix_geometry()
|
||||
|
||||
@@ -37,8 +37,11 @@ extern Systraybar systray;
|
||||
|
||||
void init_systray();
|
||||
void cleanup_systray();
|
||||
int net_init();
|
||||
|
||||
int init_net();
|
||||
void cleanup_net();
|
||||
void net_message(XClientMessageEvent *e);
|
||||
|
||||
void remove_icon(TrayWindow *traywin);
|
||||
|
||||
void draw_systray(void *obj, cairo_t *c, int active);
|
||||
|
||||
@@ -86,7 +86,6 @@ void init ()
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
cleanup_systray();
|
||||
cleanup_panel();
|
||||
|
||||
if (time1_font_desc) pango_font_description_free(time1_font_desc);
|
||||
@@ -549,6 +548,7 @@ load_config:
|
||||
|
||||
case UnmapNotify:
|
||||
case DestroyNotify:
|
||||
if (!systray.area.on_screen) break;
|
||||
for (it = systray.list_icons; it; it = g_slist_next(it)) {
|
||||
if (((TrayWindow*)it->data)->id == e.xany.window) {
|
||||
remove_icon((TrayWindow*)it->data);
|
||||
@@ -558,6 +558,7 @@ load_config:
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
if (!systray.area.on_screen) break;
|
||||
//printf("ClientMessage\n");
|
||||
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);
|
||||
|
||||
@@ -65,6 +65,22 @@ void window_toggle_shade (Window win)
|
||||
send_event32 (win, server.atom._NET_WM_STATE, 2, server.atom._NET_WM_STATE_SHADED);
|
||||
}
|
||||
|
||||
/*
|
||||
int x11_send_expose(Display *dpy, Window dst, int x, int y, int width, int height)
|
||||
{
|
||||
XEvent xe;
|
||||
int rc;
|
||||
xe.type = Expose;
|
||||
xe.xexpose.window = dst;
|
||||
xe.xexpose.x = x;
|
||||
xe.xexpose.y = y;
|
||||
xe.xexpose.width = width;
|
||||
xe.xexpose.height = height;
|
||||
xe.xexpose.count = 0;
|
||||
rc = XSendEvent(tray_data.dpy, dst, True, NoEventMask, &xe);
|
||||
return x11_ok() && rc != 0;
|
||||
}
|
||||
*/
|
||||
|
||||
int window_is_hidden (Window win)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user