*fix* use XFlush to really make use of the tooltip timeouts and do not rely on some timer running in the background
*fix* moved panel_refresh in the mainloop to the top for panels without a clock for updating first and then going to the pselect statement *changed* battery updates every 5 secs (I do not know if this is a good value...) *fix* blinking urgent windows has a panel_refresh now git-svn-id: http://tint2.googlecode.com/svn/trunk@270 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
12a882e31c
commit
d1e7d189bf
4 changed files with 48 additions and 47 deletions
|
@ -131,7 +131,7 @@ void init_battery()
|
|||
g_free(battery_dir);
|
||||
|
||||
if (battery_enabled)
|
||||
install_timer(0, 1000000, 3, 0, update_batterys);
|
||||
install_timer(0, 1000000, 5, 0, update_batterys);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -424,6 +424,7 @@ void blink_urgent()
|
|||
}
|
||||
urgent_task = urgent_task->next;
|
||||
}
|
||||
panel_refresh = 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
83
src/tint.c
83
src/tint.c
|
@ -610,15 +610,11 @@ void event_property_notify (XEvent *e)
|
|||
|
||||
void event_expose (XEvent *e)
|
||||
{
|
||||
if (e->xany.window == g_tooltip.window)
|
||||
tooltip_update();
|
||||
else {
|
||||
Panel *panel;
|
||||
panel = get_panel(e->xany.window);
|
||||
if (!panel) return;
|
||||
// TODO : one panel_refresh per panel ?
|
||||
panel_refresh = 1;
|
||||
}
|
||||
Panel *panel;
|
||||
panel = get_panel(e->xany.window);
|
||||
if (!panel) return;
|
||||
// TODO : one panel_refresh per panel ?
|
||||
panel_refresh = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -666,11 +662,6 @@ void event_configure_notify (Window win)
|
|||
}
|
||||
|
||||
|
||||
void event_timer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void dnd_message(XClientMessageEvent *e)
|
||||
{
|
||||
Panel *panel = get_panel(e->window);
|
||||
|
@ -739,6 +730,34 @@ int main (int argc, char *argv[])
|
|||
sigemptyset(&empty_mask);
|
||||
|
||||
while (1) {
|
||||
if (panel_refresh) {
|
||||
panel_refresh = 0;
|
||||
|
||||
if (refresh_systray) {
|
||||
panel = (Panel*)systray.area.panel;
|
||||
XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
|
||||
}
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
panel = &panel1[i];
|
||||
|
||||
if (panel->temp_pmap) XFreePixmap(server.dsp, panel->temp_pmap);
|
||||
panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
|
||||
refresh(&panel->area);
|
||||
XCopyArea(server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
|
||||
}
|
||||
XFlush (server.dsp);
|
||||
|
||||
if (refresh_systray) {
|
||||
refresh_systray = 0;
|
||||
panel = (Panel*)systray.area.panel;
|
||||
// tint2 doen't draw systray icons. it just redraw background.
|
||||
XSetWindowBackgroundPixmap (server.dsp, panel->main_win, panel->temp_pmap);
|
||||
// force icon's refresh
|
||||
refresh_systray_icon();
|
||||
}
|
||||
}
|
||||
|
||||
// thanks to AngryLlama for the timer
|
||||
// Create a File Description Set containing x11_fd, and every timer_fd
|
||||
FD_ZERO (&fdset);
|
||||
|
@ -786,6 +805,12 @@ int main (int argc, char *argv[])
|
|||
event_expose(&e);
|
||||
break;
|
||||
|
||||
case MapNotify:
|
||||
if (e.xany.window == g_tooltip.window)
|
||||
tooltip_update();
|
||||
break;
|
||||
|
||||
|
||||
case PropertyNotify:
|
||||
event_property_notify(&e);
|
||||
break;
|
||||
|
@ -804,7 +829,7 @@ int main (int argc, char *argv[])
|
|||
break;
|
||||
case UnmapNotify:
|
||||
case DestroyNotify:
|
||||
if (!systray.area.on_screen)
|
||||
if (e.xany.window == g_tooltip.window || !systray.area.on_screen)
|
||||
break;
|
||||
for (it = systray.list_icons; it; it = g_slist_next(it)) {
|
||||
if (((TrayWindow*)it->data)->id == e.xany.window) {
|
||||
|
@ -854,34 +879,6 @@ int main (int argc, char *argv[])
|
|||
cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (panel_refresh) {
|
||||
panel_refresh = 0;
|
||||
|
||||
if (refresh_systray) {
|
||||
panel = (Panel*)systray.area.panel;
|
||||
XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
|
||||
}
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
panel = &panel1[i];
|
||||
|
||||
if (panel->temp_pmap) XFreePixmap(server.dsp, panel->temp_pmap);
|
||||
panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
|
||||
refresh(&panel->area);
|
||||
XCopyArea(server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
|
||||
}
|
||||
XFlush (server.dsp);
|
||||
|
||||
if (refresh_systray) {
|
||||
refresh_systray = 0;
|
||||
panel = (Panel*)systray.area.panel;
|
||||
// tint2 doen't draw systray icons. it just redraw background.
|
||||
XSetWindowBackgroundPixmap (server.dsp, panel->main_win, panel->temp_pmap);
|
||||
// force icon's refresh
|
||||
refresh_systray_icon();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ void init_tooltip()
|
|||
|
||||
XSetWindowAttributes attr;
|
||||
attr.override_redirect = True;
|
||||
attr.event_mask = ExposureMask;
|
||||
attr.event_mask = StructureNotifyMask;
|
||||
if (g_tooltip.window) XDestroyWindow(server.dsp, g_tooltip.window);
|
||||
g_tooltip.window = XCreateWindow(server.dsp, server.root_win, 0, 0, 100, 20, 0, server.depth, InputOutput, CopyFromParent, CWOverrideRedirect|CWEventMask, &attr);
|
||||
}
|
||||
|
@ -106,10 +106,11 @@ void tooltip_trigger_show(Task* task, int x_root, int y_root)
|
|||
|
||||
void tooltip_show()
|
||||
{
|
||||
stop_timeouts();
|
||||
if (!g_tooltip.mapped) {
|
||||
g_tooltip.mapped = True;
|
||||
XMapWindow(server.dsp, g_tooltip.window);
|
||||
//tooltip_update();
|
||||
XFlush(server.dsp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +199,7 @@ void tooltip_update()
|
|||
return;
|
||||
}
|
||||
|
||||
//printf("tooltip_update\n");
|
||||
// printf("tooltip_update\n");
|
||||
tooltip_update_geometry();
|
||||
tooltip_adjust_geometry();
|
||||
XMoveResizeWindow(server.dsp, g_tooltip.window, x, y, width, height);
|
||||
|
@ -254,9 +255,11 @@ void tooltip_trigger_hide(Tooltip* tooltip)
|
|||
|
||||
void tooltip_hide()
|
||||
{
|
||||
stop_timeouts();
|
||||
if (g_tooltip.mapped) {
|
||||
g_tooltip.mapped = False;
|
||||
XUnmapWindow(server.dsp, g_tooltip.window);
|
||||
XFlush(server.dsp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue