Compare commits

..

5 Commits

Author SHA1 Message Date
o9000
4ee1e8f2fa Release 0.12.10 2016-05-07 09:34:12 +02:00
o9000
690f30308f Fixed crash in systray with non-Latin languagess (thanks zcodes) 2016-05-07 00:38:52 +02:00
o9000
fea91746a4 Battery: do not show negative durations when the sensors return garbage 2016-04-23 11:54:38 +02:00
o9000
9d8350dabc Invalidate cached pixmaps on resize/move (issue #576) 2016-04-22 23:47:28 +02:00
o9000
a6879ea2a5 Proper workaround for issue #555 2016-04-22 23:16:26 +02:00
10 changed files with 101 additions and 47 deletions

View File

@@ -1,3 +1,10 @@
2016-05-07 0.12.10
- Fixes:
- Fixed crash in systray with non-Latin languagess (thanks zcodes)
- Invalidate cached pixmaps on resize/move (issue #576)
- Battery: do not show negative durations when the sensors return garbage
- Proper workaround for issue #555
2016-04-02 0.12.9 2016-04-02 0.12.9
- Fixes: - Fixes:
- Regression: Do not detect empty areas as clickable (issue #572) - Regression: Do not detect empty areas as clickable (issue #572)

View File

@@ -1,5 +1,5 @@
# New stable release: 0.12.9 # Latest stable release: 0.12.10
Changes: https://gitlab.com/o9000/tint2/blob/0.12.9/ChangeLog Changes: https://gitlab.com/o9000/tint2/blob/0.12.10/ChangeLog
Documentation: https://gitlab.com/o9000/tint2/wikis/Configure Documentation: https://gitlab.com/o9000/tint2/wikis/Configure
@@ -7,7 +7,7 @@ Compile it with (see also [dependencies](https://gitlab.com/o9000/tint2/wikis/In
``` ```
git clone https://gitlab.com/o9000/tint2.git git clone https://gitlab.com/o9000/tint2.git
cd tint2 cd tint2
git checkout 0.12.9 git checkout 0.12.10
mkdir build mkdir build
cd build cd build
cmake .. cmake ..
@@ -69,10 +69,10 @@ tint2 is a simple panel/taskbar made for modern X window managers. It was specif
# Screenshots # Screenshots
## Default config of the latest release: ## Default config:
![Screenshot_2016-01-23_14-42-57](https://gitlab.com/o9000/tint2/uploads/948fa74eca60864352a033580350b4c3/Screenshot_2016-01-23_14-42-57.png) ![Screenshot_2016-01-23_14-42-57](https://gitlab.com/o9000/tint2/uploads/948fa74eca60864352a033580350b4c3/Screenshot_2016-01-23_14-42-57.png)
## Various configurations: ## Various configs:
![screenshot](https://gitlab.com/o9000/tint2/wikis/screenshot.png) ![screenshot](https://gitlab.com/o9000/tint2/wikis/screenshot.png)

View File

@@ -437,6 +437,7 @@ int battery_os_update(BatteryState *state)
seconds = 3600 * (total_energy_full - total_energy_now) / total_power_now; seconds = 3600 * (total_energy_full - total_energy_now) / total_power_now;
else if (state->state == BATTERY_DISCHARGING) else if (state->state == BATTERY_DISCHARGING)
seconds = 3600 * total_energy_now / total_power_now; seconds = 3600 * total_energy_now / total_power_now;
seconds = MAX(0, seconds);
} }
battery_state_set_time(state, seconds); battery_state_set_time(state, seconds);

View File

@@ -603,6 +603,21 @@ void place_panel_all_desktops(Panel *p)
num_atoms); num_atoms);
} }
void replace_panel_all_desktops(Panel *p)
{
XClientMessageEvent m;
memset(&m, 0, sizeof(m));
m.type = ClientMessage;
m.send_event = True;
m.display = server.display;
m.window = p->main_win;
m.message_type = server.atom._NET_WM_DESKTOP;
m.format = 32;
m.data.l[0] = ALL_DESKTOPS;
XSendEvent(server.display, server.root_win, False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&m);
XSync(server.display, False);
}
void set_panel_properties(Panel *p) void set_panel_properties(Panel *p)
{ {
XStoreName(server.display, p->main_win, panel_window_name); XStoreName(server.display, p->main_win, panel_window_name);

View File

@@ -155,6 +155,7 @@ void render_panel(Panel *panel);
void set_panel_items_order(Panel *p); void set_panel_items_order(Panel *p);
void place_panel_all_desktops(Panel *p); void place_panel_all_desktops(Panel *p);
void replace_panel_all_desktops(Panel *p);
void set_panel_properties(Panel *p); void set_panel_properties(Panel *p);
// draw background panel // draw background panel

View File

@@ -33,6 +33,7 @@
#include "systraybar.h" #include "systraybar.h"
#include "server.h" #include "server.h"
#include "panel.h" #include "panel.h"
#include "window.h"
GSList *icons; GSList *icons;
@@ -534,15 +535,7 @@ gboolean add_icon(Window win)
XSelectInput(server.display, win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask); XSelectInput(server.display, win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
XTextProperty xname; char *name = get_window_name(win);
char *name;
if (XGetWMName(server.display, win, &xname)) {
name = strdup((char *)xname.value);
XFree(xname.value);
} else {
name = strdup("");
}
if (systray_profile) if (systray_profile)
fprintf(stderr, "[%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name); fprintf(stderr, "[%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name);
Panel *panel = systray.area.panel; Panel *panel = systray.area.panel;
@@ -1068,15 +1061,7 @@ void systray_property_notify(TrayWindow *traywin, XEvent *e)
Atom at = e->xproperty.atom; Atom at = e->xproperty.atom;
if (at == server.atom.WM_NAME) { if (at == server.atom.WM_NAME) {
free(traywin->name); free(traywin->name);
traywin->name = get_window_name(traywin->win);
XTextProperty xname;
if (XGetWMName(server.display, traywin->win, &xname)) {
traywin->name = strdup((char *)xname.value);
XFree(xname.value);
} else {
traywin->name = strdup("");
}
if (systray.sort == SYSTRAY_SORT_ASCENDING || systray.sort == SYSTRAY_SORT_DESCENDING) { if (systray.sort == SYSTRAY_SORT_ASCENDING || systray.sort == SYSTRAY_SORT_DESCENDING) {
systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows); systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows);
// print_icons(); // print_icons();

View File

@@ -985,7 +985,7 @@ void event_property_notify(XEvent *e)
Panel *p = &panels[i]; Panel *p = &panels[i];
if (win == p->main_win) { if (win == p->main_win) {
if (at == server.atom._NET_WM_DESKTOP && get_window_desktop(p->main_win) != ALL_DESKTOPS) if (at == server.atom._NET_WM_DESKTOP && get_window_desktop(p->main_win) != ALL_DESKTOPS)
place_panel_all_desktops(p); replace_panel_all_desktops(p);
return; return;
} }
} }

View File

@@ -70,17 +70,15 @@ void relayout_fixed(Area *a)
relayout_fixed(l->data); relayout_fixed(l->data);
// Recalculate size // Recalculate size
a->_changed = 0; a->_changed = FALSE;
if (a->resize_needed && a->size_mode == LAYOUT_FIXED) { if (a->resize_needed && a->size_mode == LAYOUT_FIXED) {
a->resize_needed = 0; a->resize_needed = FALSE;
if (a->_resize) { if (a->_resize && a->_resize(a)) {
if (a->_resize(a)) { // The size has changed => resize needed for the parent
// The size hash changed => resize needed for the parent
if (a->parent) if (a->parent)
((Area *)a->parent)->resize_needed = 1; ((Area *)a->parent)->resize_needed = TRUE;
a->_changed = 1; a->_changed = TRUE;
}
} }
} }
} }
@@ -92,10 +90,11 @@ void relayout_dynamic(Area *a, int level)
// Area is resized before its children // Area is resized before its children
if (a->resize_needed && a->size_mode == LAYOUT_DYNAMIC) { if (a->resize_needed && a->size_mode == LAYOUT_DYNAMIC) {
a->resize_needed = 0; a->resize_needed = FALSE;
if (a->_resize) { if (a->_resize) {
a->_resize(a); if (a->_resize(a))
a->_changed = TRUE;
// resize children with LAYOUT_DYNAMIC // resize children with LAYOUT_DYNAMIC
for (GList *l = a->children; l; l = l->next) { for (GList *l = a->children; l; l = l->next) {
Area *child = ((Area *)l->data); Area *child = ((Area *)l->data);
@@ -119,13 +118,13 @@ void relayout_dynamic(Area *a, int level)
if (pos != child->posx) { if (pos != child->posx) {
// pos changed => redraw // pos changed => redraw
child->posx = pos; child->posx = pos;
child->_changed = 1; child->_changed = TRUE;
} }
} else { } else {
if (pos != child->posy) { if (pos != child->posy) {
// pos changed => redraw // pos changed => redraw
child->posy = pos; child->posy = pos;
child->_changed = 1; child->_changed = TRUE;
} }
} }
@@ -148,13 +147,13 @@ void relayout_dynamic(Area *a, int level)
if (pos != child->posx) { if (pos != child->posx) {
// pos changed => redraw // pos changed => redraw
child->posx = pos; child->posx = pos;
child->_changed = 1; child->_changed = TRUE;
} }
} else { } else {
if (pos != child->posy) { if (pos != child->posy) {
// pos changed => redraw // pos changed => redraw
child->posy = pos; child->posy = pos;
child->_changed = 1; child->_changed = TRUE;
} }
} }
@@ -187,13 +186,13 @@ void relayout_dynamic(Area *a, int level)
if (pos != child->posx) { if (pos != child->posx) {
// pos changed => redraw // pos changed => redraw
child->posx = pos; child->posx = pos;
child->_changed = 1; child->_changed = TRUE;
} }
} else { } else {
if (pos != child->posy) { if (pos != child->posy) {
// pos changed => redraw // pos changed => redraw
child->posy = pos; child->posy = pos;
child->_changed = 1; child->_changed = TRUE;
} }
} }
@@ -224,7 +223,7 @@ void draw_tree(Area *a)
return; return;
if (a->_redraw_needed) { if (a->_redraw_needed) {
a->_redraw_needed = 0; a->_redraw_needed = FALSE;
draw(a); draw(a);
} }
@@ -286,7 +285,7 @@ int relayout_with_constraint(Area *a, int maximum_size)
modulo--; modulo--;
} }
if (child->width != old_width) if (child->width != old_width)
child->_changed = 1; child->_changed = TRUE;
} }
} }
} else { } else {
@@ -326,7 +325,7 @@ int relayout_with_constraint(Area *a, int maximum_size)
modulo--; modulo--;
} }
if (child->height != old_height) if (child->height != old_height)
child->_changed = 1; child->_changed = TRUE;
} }
} }
} }
@@ -361,7 +360,7 @@ void hide(Area *a)
a->on_screen = FALSE; a->on_screen = FALSE;
if (parent) if (parent)
parent->resize_needed = 1; parent->resize_needed = TRUE;
if (panel_horizontal) if (panel_horizontal)
a->width = 0; a->width = 0;
else else
@@ -374,12 +373,27 @@ void show(Area *a)
a->on_screen = TRUE; a->on_screen = TRUE;
if (parent) if (parent)
parent->resize_needed = 1; parent->resize_needed = TRUE;
a->resize_needed = 1; a->resize_needed = TRUE;
} }
void draw(Area *a) void draw(Area *a)
{ {
if (a->_changed) {
// On resize/move, invalidate cached pixmaps
for (int i = 0; i < MOUSE_STATE_COUNT; i++) {
XFreePixmap(server.display, a->pix_by_state[i]);
if (a->pix == a->pix_by_state[i]) {
a->pix = None;
}
a->pix_by_state[i] = None;
}
if (a->pix) {
XFreePixmap(server.display, a->pix);
a->pix = None;
}
}
if (a->pix) { if (a->pix) {
XFreePixmap(server.display, a->pix); XFreePixmap(server.display, a->pix);
if (a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0] != a->pix) if (a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0] != a->pix)

View File

@@ -320,3 +320,32 @@ gulong *get_best_icon(gulong *data, int icon_count, int num, int *iw, int *ih, i
*ih = height[icon_num]; *ih = height[icon_num];
return icon_data[icon_num]; return icon_data[icon_num];
} }
// Thanks zcodes!
char *get_window_name(Window win)
{
XTextProperty text_property;
Status status = XGetWMName(server.display, win, &text_property);
if (!status || !text_property.value || !text_property.nitems) {
return strdup("");
}
char **name_list;
int count;
status = Xutf8TextPropertyToTextList(server.display, &text_property, &name_list, &count);
if (status < Success || !count) {
XFree(text_property.value);
return strdup("");
}
if (!name_list[0]) {
XFreeStringList(name_list);
XFree(text_property.value);
return strdup("");
}
char *result = strdup(name_list[0]);
XFreeStringList(name_list);
XFree(text_property.value);
return result;
}

View File

@@ -33,4 +33,6 @@ void change_window_desktop(Window win, int desktop);
int get_icon_count(gulong *data, int num); int get_icon_count(gulong *data, int num);
gulong *get_best_icon(gulong *data, int icon_count, int num, int *iw, int *ih, int best_icon_size); gulong *get_best_icon(gulong *data, int icon_count, int num, int *iw, int *ih, int best_icon_size);
char *get_window_name(Window win);
#endif #endif