all repos — tint2 @ 00a18033488d72aa68a2f5e23a9bb7157abb96e1

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

if( -> if (
o9000 o9000
commit

00a18033488d72aa68a2f5e23a9bb7157abb96e1

parent

03dd8b848340be20fd17ab566a051954ab87866a

6 files changed, 25 insertions(+), 25 deletions(-)

jump to
M src/battery/battery.csrc/battery/battery.c

@@ -75,7 +75,7 @@ init_battery();

} if (old_ac_connected != battery_state.ac_connected) { - if(battery_state.ac_connected) + if (battery_state.ac_connected) tint_exec(ac_connected_cmd); else tint_exec(ac_disconnected_cmd);
M src/battery/linux.csrc/battery/linux.c

@@ -82,7 +82,7 @@ NULL,

uevent_battery_plug }; -#define RETURN_ON_ERROR(err) if(error) { g_error_free(err); return FALSE; } +#define RETURN_ON_ERROR(err) if (error) { g_error_free(err); return FALSE; } static GList *batteries = NULL; static GList *mains = NULL;

@@ -104,12 +104,12 @@ g_error_free(error);

return PSY_UNKNOWN; } - if(!g_strcmp0(type, "Battery\n")) { + if (!g_strcmp0(type, "Battery\n")) { g_free(type); return PSY_BATTERY; } - if(!g_strcmp0(type, "Mains\n")) { + if (!g_strcmp0(type, "Mains\n")) { g_free(type); return PSY_MAINS; }

@@ -140,7 +140,7 @@ if (!g_file_test(bat->path_energy_now, G_FILE_TEST_EXISTS)) {

goto err1; } - if(!bat->energy_in_uamp) { + if (!bat->energy_in_uamp) { bat->path_energy_full = g_build_filename("/sys/class/power_supply", entryname, "energy_full", NULL); if (!g_file_test(bat->path_energy_full, G_FILE_TEST_EXISTS)) goto err2;

@@ -234,7 +234,7 @@ static void add_battery(const char *entryname) {

struct psy_battery *bat = g_malloc0(sizeof(*bat)); bat->name = g_strdup(entryname); - if(init_linux_battery(bat)) { + if (init_linux_battery(bat)) { batteries = g_list_append(batteries, bat); fprintf(stdout, "found battery \"%s\"\n", bat->name); } else {

@@ -247,7 +247,7 @@ static void add_mains(const char *entryname) {

struct psy_mains *ac = g_malloc0(sizeof(*ac)); ac->name = g_strdup(entryname); - if(init_linux_mains(ac)) { + if (init_linux_mains(ac)) { mains = g_list_append(mains, ac); fprintf(stdout, "found mains \"%s\"\n", ac->name); } else {

@@ -308,7 +308,7 @@ bat->present = (atoi(data) == 1);

g_free(data); /* we are done, if battery is not present */ - if(!bat->present) + if (!bat->present) return TRUE; /* status */

@@ -403,9 +403,9 @@ state->state = BATTERY_FULL;

/* calculate seconds */ if (total_power_now > 0) { - if(state->state == BATTERY_CHARGING) + if (state->state == BATTERY_CHARGING) 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; } batstate_set_time(state, seconds);
M src/config.csrc/config.c

@@ -354,7 +354,7 @@ /* Battery */

else if (strcmp (key, "battery_low_status") == 0) { #ifdef ENABLE_BATTERY battery_low_status = atoi(value); - if(battery_low_status < 0 || battery_low_status > 100) + if (battery_low_status < 0 || battery_low_status > 100) battery_low_status = 0; #endif }
M src/tint.csrc/tint.c

@@ -438,7 +438,7 @@ int tint2_handles_click(Panel* panel, XButtonEvent* e)

{ Task* task = click_task(panel, e->x, e->y); if (task) { - if( (e->button == 1 && mouse_left != 0) + if ( (e->button == 1 && mouse_left != 0) || (e->button == 2 && mouse_middle != 0) || (e->button == 3 && mouse_right != 0) || (e->button == 4 && mouse_scroll_up != 0)

@@ -521,27 +521,27 @@

void event_button_motion_notify (XEvent *e) { Panel * panel = get_panel(e->xany.window); - if(!panel || !task_drag) + if (!panel || !task_drag) return; // Find the taskbar on the event's location Taskbar * event_taskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y); - if(event_taskbar == NULL) + if (event_taskbar == NULL) return; // Find the task on the event's location Task * event_task = click_task(panel, e->xbutton.x, e->xbutton.y); // If the event takes place on the same taskbar as the task being dragged - if(event_taskbar == task_drag->area.parent) { + if (event_taskbar == task_drag->area.parent) { if (taskbar_sort_method != TASKBAR_NOSORT) { sort_tasks(event_taskbar); } else { // Swap the task_drag with the task on the event's location (if they differ) - if(event_task && event_task != task_drag) { + if (event_task && event_task != task_drag) { GList * drag_iter = g_list_find(event_taskbar->area.list, task_drag); GList * task_iter = g_list_find(event_taskbar->area.list, event_task); - if(drag_iter && task_iter) { + if (drag_iter && task_iter) { gpointer temp = task_iter->data; task_iter->data = drag_iter->data; drag_iter->data = temp;

@@ -553,13 +553,13 @@ }

} } else { // The event is on another taskbar than the task being dragged - if(task_drag->desktop == ALLDESKTOP || panel_mode != MULTI_DESKTOP) + if (task_drag->desktop == ALLDESKTOP || panel_mode != MULTI_DESKTOP) return; Taskbar * drag_taskbar = (Taskbar*)task_drag->area.parent; drag_taskbar->area.list = g_list_remove(drag_taskbar->area.list, task_drag); - if(event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) { + if (event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) { int i = (taskbarname_enabled) ? 1 : 0; event_taskbar->area.list = g_list_insert(event_taskbar->area.list, task_drag, i); }
M src/util/common.hsrc/util/common.h

@@ -20,15 +20,15 @@ #define RESET "\033[0m"

/* void fxfree(void** ptr){ - if(*ptr){ + if (*ptr){ free(*ptr); *ptr=NULL; } } FXint fxmalloc(void** ptr,unsigned long size){ *ptr=NULL; - if(size!=0){ - if((*ptr=malloc(size))==NULL) return FALSE; + if (size!=0){ + if ((*ptr=malloc(size))==NULL) return FALSE; } return TRUE; }
M src/util/uevent.csrc/util/uevent.c

@@ -108,7 +108,7 @@ } else {

val = strchr(s, '='); if (val) { struct uevent_parameter *param = malloc(sizeof(*param)); - if(param) { + if (param) { param->key = strndup(s, val-s); param->val = strdup(val+1); ev->params = g_list_append(ev->params, param);

@@ -132,7 +132,7 @@ while (l != NULL) {

GList *next = l->next; struct uevent_notify *lnb = l->data; - if(memcmp(nb, lnb, sizeof(struct uevent_notify)) == 0) + if (memcmp(nb, lnb, sizeof(struct uevent_notify)) == 0) notifiers = g_list_delete_link(notifiers, l); l = next;

@@ -152,7 +152,7 @@ if (len < 0)

return; ev = uevent_new(buf, len); - if(ev) { + if (ev) { for (l = notifiers; l != NULL; l = l->next) { struct uevent_notify *nb = l->data;