Cleanup whitespace
This commit is contained in:
parent
d398795202
commit
7b6ce97940
24 changed files with 294 additions and 180 deletions
|
@ -156,8 +156,8 @@ void init_battery_panel(void *p)
|
|||
battery->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
battery->area.on_screen = TRUE;
|
||||
battery->area.resize_needed = 1;
|
||||
battery->area.has_mouse_over_effect = panel_config.mouse_effects &&
|
||||
(battery_lclick_command || battery_mclick_command || battery_rclick_command ||
|
||||
battery->area.has_mouse_over_effect =
|
||||
panel_config.mouse_effects && (battery_lclick_command || battery_mclick_command || battery_rclick_command ||
|
||||
battery_uwheel_command || battery_dwheel_command);
|
||||
battery->area.has_mouse_press_effect = battery->area.has_mouse_over_effect;
|
||||
if (battery_tooltip_enabled)
|
||||
|
@ -168,13 +168,11 @@ void battery_init_fonts()
|
|||
{
|
||||
if (!bat1_font_desc) {
|
||||
bat1_font_desc = pango_font_description_from_string(get_default_font());
|
||||
pango_font_description_set_size(bat1_font_desc,
|
||||
pango_font_description_get_size(bat1_font_desc) - PANGO_SCALE);
|
||||
pango_font_description_set_size(bat1_font_desc, pango_font_description_get_size(bat1_font_desc) - PANGO_SCALE);
|
||||
}
|
||||
if (!bat2_font_desc) {
|
||||
bat2_font_desc = pango_font_description_from_string(get_default_font());
|
||||
pango_font_description_set_size(bat2_font_desc,
|
||||
pango_font_description_get_size(bat2_font_desc) - PANGO_SCALE);
|
||||
pango_font_description_set_size(bat2_font_desc, pango_font_description_get_size(bat2_font_desc) - PANGO_SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,8 +182,8 @@ void init_clock_panel(void *p)
|
|||
clock->area.panel = p;
|
||||
clock->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
clock->area.has_mouse_press_effect = clock->area.has_mouse_over_effect =
|
||||
panel_config.mouse_effects && (clock_lclick_command || clock_mclick_command || clock_rclick_command || clock_uwheel_command ||
|
||||
clock_dwheel_command);
|
||||
panel_config.mouse_effects && (clock_lclick_command || clock_mclick_command || clock_rclick_command ||
|
||||
clock_uwheel_command || clock_dwheel_command);
|
||||
clock->area._draw_foreground = draw_clock;
|
||||
clock->area.size_mode = LAYOUT_FIXED;
|
||||
clock->area._resize = resize_clock;
|
||||
|
@ -205,8 +205,7 @@ void clock_init_fonts()
|
|||
if (!time1_font_desc) {
|
||||
time1_font_desc = pango_font_description_from_string(get_default_font());
|
||||
pango_font_description_set_weight(time1_font_desc, PANGO_WEIGHT_BOLD);
|
||||
pango_font_description_set_size(time1_font_desc,
|
||||
pango_font_description_get_size(time1_font_desc));
|
||||
pango_font_description_set_size(time1_font_desc, pango_font_description_get_size(time1_font_desc));
|
||||
}
|
||||
if (!time2_font_desc) {
|
||||
time2_font_desc = pango_font_description_from_string(get_default_font());
|
||||
|
|
|
@ -163,9 +163,11 @@ void init_execp_panel(void *p)
|
|||
execp->area._resize = resize_execp;
|
||||
execp->area._get_tooltip_text = execp_get_tooltip;
|
||||
execp->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
execp->area.has_mouse_press_effect = panel_config.mouse_effects && (execp->area.has_mouse_over_effect =
|
||||
execp->backend->lclick_command || execp->backend->mclick_command || execp->backend->rclick_command ||
|
||||
execp->backend->uwheel_command || execp->backend->dwheel_command);
|
||||
execp->area.has_mouse_press_effect =
|
||||
panel_config.mouse_effects &&
|
||||
(execp->area.has_mouse_over_effect = execp->backend->lclick_command || execp->backend->mclick_command ||
|
||||
execp->backend->rclick_command || execp->backend->uwheel_command ||
|
||||
execp->backend->dwheel_command);
|
||||
|
||||
execp->area.resize_needed = TRUE;
|
||||
execp->area.on_screen = TRUE;
|
||||
|
@ -671,11 +673,7 @@ const char *time_to_string(int seconds, char *buffer)
|
|||
int m = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
int s = seconds;
|
||||
sprintf(buffer,
|
||||
"%d:%d:%ds",
|
||||
h,
|
||||
m,
|
||||
s);
|
||||
sprintf(buffer, "%d:%d:%ds", h, m, s);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@ typedef struct Execp {
|
|||
ExecpFrontend *frontend;
|
||||
} Execp;
|
||||
|
||||
|
||||
// Called before the config is read and panel_config/panels are created.
|
||||
// Afterwards, the config parsing code creates the array of Execp in panel_config and populates the configuration fields
|
||||
// in the backend.
|
||||
|
@ -121,7 +120,6 @@ void init_execp_panel(void *panel);
|
|||
// GUI element tree cleanup function (remove_area).
|
||||
void cleanup_execp();
|
||||
|
||||
|
||||
// Called on draw, obj = pointer to the front-end Execp item.
|
||||
void draw_execp(void *obj, cairo_t *c);
|
||||
|
||||
|
|
|
@ -714,7 +714,8 @@ char *get_icon_path_from_cache(IconThemeWrapper *wrapper, const char *icon_name,
|
|||
if (!g_file_test(value, G_FILE_TEST_EXISTS))
|
||||
return NULL;
|
||||
|
||||
// fprintf(stderr, "Icon path found in cache: theme = %s, icon = %s, size = %d, path = %s\n", wrapper->icon_theme_name, icon_name, size, value);
|
||||
// fprintf(stderr, "Icon path found in cache: theme = %s, icon = %s, size = %d, path = %s\n",
|
||||
// wrapper->icon_theme_name, icon_name, size, value);
|
||||
|
||||
return strdup(value);
|
||||
}
|
||||
|
@ -724,7 +725,12 @@ void add_icon_path_to_cache(IconThemeWrapper *wrapper, const char *icon_name, in
|
|||
if (!wrapper || !icon_name || strlen(icon_name) == 0 || !path || strlen(path) == 0)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "Adding icon path to cache: theme = %s, icon = %s, size = %d, path = %s\n", wrapper->icon_theme_name, icon_name, size, path);
|
||||
fprintf(stderr,
|
||||
"Adding icon path to cache: theme = %s, icon = %s, size = %d, path = %s\n",
|
||||
wrapper->icon_theme_name,
|
||||
icon_name,
|
||||
size,
|
||||
path);
|
||||
|
||||
load_icon_cache(wrapper);
|
||||
|
||||
|
|
|
@ -339,8 +339,12 @@ Imlib_Image scale_icon(Imlib_Image original, int icon_size)
|
|||
Imlib_Image icon_scaled;
|
||||
if (original) {
|
||||
imlib_context_set_image(original);
|
||||
icon_scaled =
|
||||
imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), icon_size, icon_size);
|
||||
icon_scaled = imlib_create_cropped_scaled_image(0,
|
||||
0,
|
||||
imlib_image_get_width(),
|
||||
imlib_image_get_height(),
|
||||
icon_size,
|
||||
icon_size);
|
||||
|
||||
imlib_context_set_image(icon_scaled);
|
||||
imlib_image_set_has_alpha(1);
|
||||
|
|
13
src/panel.c
13
src/panel.c
|
@ -247,7 +247,10 @@ void init_panel()
|
|||
event_mask |= PointerMotionMask | LeaveWindowMask;
|
||||
if (panel_autohide)
|
||||
event_mask |= LeaveWindowMask | EnterWindowMask;
|
||||
XChangeWindowAttributes(server.display, p->main_win, CWEventMask, &(XSetWindowAttributes){.event_mask = event_mask});
|
||||
XChangeWindowAttributes(server.display,
|
||||
p->main_win,
|
||||
CWEventMask,
|
||||
&(XSetWindowAttributes){.event_mask = event_mask});
|
||||
|
||||
if (!server.gc) {
|
||||
XGCValues gcv;
|
||||
|
@ -331,12 +334,12 @@ void init_panel_size_and_position(Panel *panel)
|
|||
panel->posx = server.monitors[panel->monitor].x + panel->marginx;
|
||||
} else {
|
||||
if (panel_position & RIGHT) {
|
||||
panel->posx = server.monitors[panel->monitor].x + server.monitors[panel->monitor].width - panel->area.width -
|
||||
panel->marginx;
|
||||
panel->posx = server.monitors[panel->monitor].x + server.monitors[panel->monitor].width -
|
||||
panel->area.width - panel->marginx;
|
||||
} else {
|
||||
if (panel_horizontal)
|
||||
panel->posx =
|
||||
server.monitors[panel->monitor].x + ((server.monitors[panel->monitor].width - panel->area.width) / 2);
|
||||
panel->posx = server.monitors[panel->monitor].x +
|
||||
((server.monitors[panel->monitor].width - panel->area.width) / 2);
|
||||
else
|
||||
panel->posx = server.monitors[panel->monitor].x + panel->marginx;
|
||||
}
|
||||
|
|
16
src/server.c
16
src/server.c
|
@ -419,7 +419,8 @@ void server_get_number_of_desktops()
|
|||
int work_area_height = work_area_size[1] + work_area_size[3];
|
||||
XFree(work_area_size);
|
||||
|
||||
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
long *x_screen_size =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
if (!x_screen_size)
|
||||
return;
|
||||
int x_screen_width = x_screen_size[0];
|
||||
|
@ -459,7 +460,8 @@ GSList *get_desktop_names()
|
|||
|
||||
int count;
|
||||
GSList *list = NULL;
|
||||
gchar *data_ptr = server_get_property(server.root_win, server.atom._NET_DESKTOP_NAMES, server.atom.UTF8_STRING, &count);
|
||||
gchar *data_ptr =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_NAMES, server.atom.UTF8_STRING, &count);
|
||||
if (data_ptr) {
|
||||
list = g_slist_append(list, g_strdup(data_ptr));
|
||||
for (int j = 0; j < count - 1; j++) {
|
||||
|
@ -476,7 +478,9 @@ GSList *get_desktop_names()
|
|||
int get_current_desktop()
|
||||
{
|
||||
if (!server.viewports) {
|
||||
return MAX(0, MIN(server.num_desktops - 1, get_property32(server.root_win, server.atom._NET_CURRENT_DESKTOP, XA_CARDINAL)));
|
||||
return MAX(0,
|
||||
MIN(server.num_desktops - 1,
|
||||
get_property32(server.root_win, server.atom._NET_CURRENT_DESKTOP, XA_CARDINAL)));
|
||||
}
|
||||
|
||||
int num_results;
|
||||
|
@ -497,7 +501,8 @@ int get_current_desktop()
|
|||
int viewport_y = viewport[1];
|
||||
XFree(viewport);
|
||||
|
||||
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
long *x_screen_size =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
if (!x_screen_size)
|
||||
return 0;
|
||||
int x_screen_width = x_screen_size[0];
|
||||
|
@ -548,7 +553,8 @@ void server_init_visual()
|
|||
// inspired by freedesktops fdclock ;)
|
||||
XVisualInfo templ = {.screen = server.screen, .depth = 32, .class = TrueColor};
|
||||
int nvi;
|
||||
XVisualInfo *xvi = XGetVisualInfo(server.display, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi);
|
||||
XVisualInfo *xvi =
|
||||
XGetVisualInfo(server.display, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi);
|
||||
|
||||
Visual *visual = NULL;
|
||||
if (xvi) {
|
||||
|
|
|
@ -166,5 +166,4 @@ GSList *get_desktop_names();
|
|||
int get_current_desktop();
|
||||
void change_desktop(int desktop);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1488,8 +1488,7 @@ void refresh_systray_icons()
|
|||
|
||||
gboolean systray_on_monitor(int i_monitor, int num_panels)
|
||||
{
|
||||
return (i_monitor == systray_monitor) ||
|
||||
(i_monitor == 0 && (systray_monitor >= num_panels || systray_monitor < 0));
|
||||
return (i_monitor == systray_monitor) || (i_monitor == 0 && (systray_monitor >= num_panels || systray_monitor < 0));
|
||||
}
|
||||
|
||||
TrayWindow *systray_find_icon(Window win)
|
||||
|
|
|
@ -83,7 +83,8 @@ Task *add_task(Window win)
|
|||
task_update_title(&task_template);
|
||||
task_update_icon(&task_template);
|
||||
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ? task_template.title : "??");
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ?
|
||||
// task_template.title : "??");
|
||||
// fprintf(stderr, "new task %s win %u: desktop %d, monitor %d\n", new_task.title, win, new_task.desktop, monitor);
|
||||
|
||||
GPtrArray *task_buttons = g_ptr_array_new();
|
||||
|
@ -147,7 +148,8 @@ void remove_task(Task *task)
|
|||
if (!task)
|
||||
return;
|
||||
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title : "??");
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title :
|
||||
// "??");
|
||||
|
||||
if (taskbar_mode == MULTI_DESKTOP) {
|
||||
Panel *panel = task->area.panel;
|
||||
|
|
|
@ -265,7 +265,8 @@ void init_taskbar_panel(void *p)
|
|||
panel->g_task.text_posx = panel->g_task.background[0]->border.width + panel->g_task.area.paddingxlr;
|
||||
panel->g_task.text_height = panel->g_task.area.height - (2 * panel->g_task.area.paddingy);
|
||||
if (panel->g_task.has_icon) {
|
||||
panel->g_task.icon_size1 = MIN(panel->g_task.maximum_width, MIN(panel->g_task.maximum_height, panel->g_task.area.height)) -
|
||||
panel->g_task.icon_size1 =
|
||||
MIN(panel->g_task.maximum_width, MIN(panel->g_task.maximum_height, panel->g_task.area.height)) -
|
||||
(2 * panel->g_task.area.paddingy) - 2 * panel->g_task.area.bg->border.width;
|
||||
panel->g_task.text_posx += panel->g_task.icon_size1 + panel->g_task.area.paddingx;
|
||||
panel->g_task.icon_posy = (panel->g_task.area.height - panel->g_task.icon_size1) / 2;
|
||||
|
|
156
src/tint.c
156
src/tint.c
|
@ -135,37 +135,66 @@ void write_string(int fd, const char *s)
|
|||
const char *signal_name(int sig)
|
||||
{
|
||||
switch (sig) {
|
||||
case SIGHUP: return "SIGHUP: Hangup (POSIX).";
|
||||
case SIGINT: return "SIGINT: Interrupt (ANSI).";
|
||||
case SIGQUIT: return "SIGQUIT: Quit (POSIX).";
|
||||
case SIGILL: return "SIGILL: Illegal instruction (ANSI).";
|
||||
case SIGTRAP: return "SIGTRAP: Trace trap (POSIX).";
|
||||
case SIGABRT: return "SIGABRT/SIGIOT: Abort (ANSI) / IOT trap (4.2 BSD).";
|
||||
case SIGBUS: return "SIGBUS: BUS error (4.2 BSD).";
|
||||
case SIGFPE: return "SIGFPE: Floating-point exception (ANSI).";
|
||||
case SIGKILL: return "SIGKILL: Kill, unblockable (POSIX).";
|
||||
case SIGUSR1: return "SIGUSR1: User-defined signal 1 (POSIX).";
|
||||
case SIGSEGV: return "SIGSEGV: Segmentation violation (ANSI).";
|
||||
case SIGUSR2: return "SIGUSR2: User-defined signal 2 (POSIX).";
|
||||
case SIGPIPE: return "SIGPIPE: Broken pipe (POSIX).";
|
||||
case SIGALRM: return "SIGALRM: Alarm clock (POSIX).";
|
||||
case SIGTERM: return "SIGTERM: Termination (ANSI).";
|
||||
case SIGHUP:
|
||||
return "SIGHUP: Hangup (POSIX).";
|
||||
case SIGINT:
|
||||
return "SIGINT: Interrupt (ANSI).";
|
||||
case SIGQUIT:
|
||||
return "SIGQUIT: Quit (POSIX).";
|
||||
case SIGILL:
|
||||
return "SIGILL: Illegal instruction (ANSI).";
|
||||
case SIGTRAP:
|
||||
return "SIGTRAP: Trace trap (POSIX).";
|
||||
case SIGABRT:
|
||||
return "SIGABRT/SIGIOT: Abort (ANSI) / IOT trap (4.2 BSD).";
|
||||
case SIGBUS:
|
||||
return "SIGBUS: BUS error (4.2 BSD).";
|
||||
case SIGFPE:
|
||||
return "SIGFPE: Floating-point exception (ANSI).";
|
||||
case SIGKILL:
|
||||
return "SIGKILL: Kill, unblockable (POSIX).";
|
||||
case SIGUSR1:
|
||||
return "SIGUSR1: User-defined signal 1 (POSIX).";
|
||||
case SIGSEGV:
|
||||
return "SIGSEGV: Segmentation violation (ANSI).";
|
||||
case SIGUSR2:
|
||||
return "SIGUSR2: User-defined signal 2 (POSIX).";
|
||||
case SIGPIPE:
|
||||
return "SIGPIPE: Broken pipe (POSIX).";
|
||||
case SIGALRM:
|
||||
return "SIGALRM: Alarm clock (POSIX).";
|
||||
case SIGTERM:
|
||||
return "SIGTERM: Termination (ANSI).";
|
||||
// case SIGSTKFLT: return "SIGSTKFLT: Stack fault.";
|
||||
case SIGCHLD: return "SIGCHLD: Child status has changed (POSIX).";
|
||||
case SIGCONT: return "SIGCONT: Continue (POSIX).";
|
||||
case SIGSTOP: return "SIGSTOP: Stop, unblockable (POSIX).";
|
||||
case SIGTSTP: return "SIGTSTP: Keyboard stop (POSIX).";
|
||||
case SIGTTIN: return "SIGTTIN: Background read from tty (POSIX).";
|
||||
case SIGTTOU: return "SIGTTOU: Background write to tty (POSIX).";
|
||||
case SIGURG: return "SIGURG: Urgent condition on socket (4.2 BSD).";
|
||||
case SIGXCPU: return "SIGXCPU: CPU limit exceeded (4.2 BSD).";
|
||||
case SIGXFSZ: return "SIGXFSZ: File size limit exceeded (4.2 BSD).";
|
||||
case SIGVTALRM: return "SIGVTALRM: Virtual alarm clock (4.2 BSD).";
|
||||
case SIGPROF: return "SIGPROF: Profiling alarm clock (4.2 BSD).";
|
||||
case SIGWINCH: return "SIGWINCH: Window size change (4.3 BSD, Sun).";
|
||||
case SIGIO: return "SIGIO: Pollable event occurred (System V) / I/O now possible (4.2 BSD).";
|
||||
case SIGCHLD:
|
||||
return "SIGCHLD: Child status has changed (POSIX).";
|
||||
case SIGCONT:
|
||||
return "SIGCONT: Continue (POSIX).";
|
||||
case SIGSTOP:
|
||||
return "SIGSTOP: Stop, unblockable (POSIX).";
|
||||
case SIGTSTP:
|
||||
return "SIGTSTP: Keyboard stop (POSIX).";
|
||||
case SIGTTIN:
|
||||
return "SIGTTIN: Background read from tty (POSIX).";
|
||||
case SIGTTOU:
|
||||
return "SIGTTOU: Background write to tty (POSIX).";
|
||||
case SIGURG:
|
||||
return "SIGURG: Urgent condition on socket (4.2 BSD).";
|
||||
case SIGXCPU:
|
||||
return "SIGXCPU: CPU limit exceeded (4.2 BSD).";
|
||||
case SIGXFSZ:
|
||||
return "SIGXFSZ: File size limit exceeded (4.2 BSD).";
|
||||
case SIGVTALRM:
|
||||
return "SIGVTALRM: Virtual alarm clock (4.2 BSD).";
|
||||
case SIGPROF:
|
||||
return "SIGPROF: Profiling alarm clock (4.2 BSD).";
|
||||
case SIGWINCH:
|
||||
return "SIGWINCH: Window size change (4.3 BSD, Sun).";
|
||||
case SIGIO:
|
||||
return "SIGIO: Pollable event occurred (System V) / I/O now possible (4.2 BSD).";
|
||||
// case SIGPWR: return "SIGPWR: Power failure restart (System V).";
|
||||
case SIGSYS: return "SIGSYS: Bad system call.";
|
||||
case SIGSYS:
|
||||
return "SIGSYS: Bad system call.";
|
||||
}
|
||||
static char s[64];
|
||||
sprintf(s, "SIG=%d: Unknown", sig);
|
||||
|
@ -528,7 +557,8 @@ void get_snapshot(const char *path)
|
|||
if (panel->area.width > server.monitors[0].width)
|
||||
panel->area.width = server.monitors[0].width;
|
||||
|
||||
panel->temp_pmap = XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
panel->temp_pmap =
|
||||
XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
render_panel(panel);
|
||||
|
||||
Imlib_Image img = NULL;
|
||||
|
@ -842,7 +872,8 @@ void event_button_release(XEvent *e)
|
|||
// switch desktop
|
||||
if (taskbar_mode == MULTI_DESKTOP) {
|
||||
gboolean diff_desktop = FALSE;
|
||||
if (taskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT && action != DESKTOP_RIGHT) {
|
||||
if (taskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT &&
|
||||
action != DESKTOP_RIGHT) {
|
||||
diff_desktop = TRUE;
|
||||
change_desktop(taskbar->desktop);
|
||||
}
|
||||
|
@ -940,10 +971,8 @@ void event_property_notify(XEvent *e)
|
|||
update_desktop_names();
|
||||
}
|
||||
// Change desktops
|
||||
else if (at == server.atom._NET_NUMBER_OF_DESKTOPS ||
|
||||
at == server.atom._NET_DESKTOP_GEOMETRY ||
|
||||
at == server.atom._NET_DESKTOP_VIEWPORT ||
|
||||
at == server.atom._NET_WORKAREA ||
|
||||
else if (at == server.atom._NET_NUMBER_OF_DESKTOPS || at == server.atom._NET_DESKTOP_GEOMETRY ||
|
||||
at == server.atom._NET_DESKTOP_VIEWPORT || at == server.atom._NET_WORKAREA ||
|
||||
at == server.atom._NET_CURRENT_DESKTOP) {
|
||||
if (debug)
|
||||
fprintf(stderr, "%s %d: win = root, atom = ?? desktops changed\n", __FUNCTION__, __LINE__);
|
||||
|
@ -1062,7 +1091,13 @@ void event_property_notify(XEvent *e)
|
|||
Task *task = get_task(win);
|
||||
if (debug) {
|
||||
char *atom_name = XGetAtomName(server.display, at);
|
||||
fprintf(stderr, "%s %d: win = %ld, task = %s, atom = %s\n", __FUNCTION__, __LINE__, win, task ? (task->title ? task->title : "??") : "null", atom_name);
|
||||
fprintf(stderr,
|
||||
"%s %d: win = %ld, task = %s, atom = %s\n",
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
win,
|
||||
task ? (task->title ? task->title : "??") : "null",
|
||||
atom_name);
|
||||
XFree(atom_name);
|
||||
}
|
||||
if (!task) {
|
||||
|
@ -1163,12 +1198,20 @@ void event_configure_notify(XEvent *e)
|
|||
|
||||
if (0) {
|
||||
Task *task = get_task(win);
|
||||
fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task ? (task->title ? task->title : "??") : "null");
|
||||
fprintf(stderr,
|
||||
"%s %d: win = %ld, task = %s\n",
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
win,
|
||||
task ? (task->title ? task->title : "??") : "null");
|
||||
}
|
||||
|
||||
// change in root window (xrandr)
|
||||
if (win == server.root_win) {
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to configuration change in the root window" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to configuration change in the root window" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
return;
|
||||
}
|
||||
|
@ -1447,7 +1490,8 @@ start:
|
|||
init_X11_pre_config();
|
||||
|
||||
if (!config_read()) {
|
||||
fprintf(stderr, "Could not read config file.\n"
|
||||
fprintf(stderr,
|
||||
"Could not read config file.\n"
|
||||
"Usage: tint2 [[-c] <config_file>]\n");
|
||||
cleanup();
|
||||
exit(1);
|
||||
|
@ -1484,7 +1528,11 @@ start:
|
|||
while (1) {
|
||||
if (panel_refresh) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, BLUE "[%f] %s:%d redrawing panel" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
fprintf(stderr,
|
||||
BLUE "[%f] %s:%d redrawing panel" RESET "\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__);
|
||||
panel_refresh = FALSE;
|
||||
|
||||
for (int i = 0; i < num_panels; i++) {
|
||||
|
@ -1492,7 +1540,11 @@ start:
|
|||
|
||||
if (panel->is_hidden) {
|
||||
if (!panel->hidden_pixmap) {
|
||||
panel->hidden_pixmap = XCreatePixmap(server.display, server.root_win, panel->hidden_width, panel->hidden_height, server.depth);
|
||||
panel->hidden_pixmap = XCreatePixmap(server.display,
|
||||
server.root_win,
|
||||
panel->hidden_width,
|
||||
panel->hidden_height,
|
||||
server.depth);
|
||||
int xoff = 0, yoff = 0;
|
||||
if (panel_horizontal && panel_position & BOTTOM)
|
||||
yoff = panel->area.height - panel->hidden_height;
|
||||
|
@ -1523,8 +1575,11 @@ start:
|
|||
} else {
|
||||
if (panel->temp_pmap)
|
||||
XFreePixmap(server.display, panel->temp_pmap);
|
||||
panel->temp_pmap =
|
||||
XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
panel->temp_pmap = XCreatePixmap(server.display,
|
||||
server.root_win,
|
||||
panel->area.width,
|
||||
panel->area.height,
|
||||
server.depth);
|
||||
render_panel(panel);
|
||||
if (panel == (Panel *)systray.area.panel) {
|
||||
if (refresh_systray && panel && !panel->is_hidden) {
|
||||
|
@ -1711,7 +1766,10 @@ start:
|
|||
case DestroyNotify:
|
||||
if (e.xany.window == server.composite_manager) {
|
||||
// Stop real_transparency
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to compositor shutdown" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to compositor shutdown" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
break;
|
||||
}
|
||||
|
@ -1730,11 +1788,17 @@ start:
|
|||
if (ev->data.l[1] == server.atom._NET_WM_CM_S0) {
|
||||
if (ev->data.l[2] == None) {
|
||||
// Stop real_transparency
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
} else {
|
||||
// Start real_transparency
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,6 @@ void tooltip_default_font_changed()
|
|||
tooltip_update();
|
||||
}
|
||||
|
||||
|
||||
void tooltip_trigger_show(Area *area, Panel *p, XEvent *e)
|
||||
{
|
||||
// Position the tooltip in the center of the area
|
||||
|
|
|
@ -134,7 +134,8 @@ void relayout_dynamic(Area *a, int level)
|
|||
pos += panel_horizontal ? child->width + a->paddingx : child->height + a->paddingx;
|
||||
}
|
||||
} else if (a->alignment == ALIGN_RIGHT) {
|
||||
int pos = (panel_horizontal ? a->posx + a->width : a->posy + a->height) - a->bg->border.width - a->paddingxlr;
|
||||
int pos =
|
||||
(panel_horizontal ? a->posx + a->width : a->posy + a->height) - a->bg->border.width - a->paddingxlr;
|
||||
|
||||
for (GList *l = g_list_last(a->children); l; l = l->prev) {
|
||||
Area *child = ((Area *)l->data);
|
||||
|
@ -228,7 +229,16 @@ void draw_tree(Area *a)
|
|||
}
|
||||
|
||||
if (a->pix)
|
||||
XCopyArea(server.display, a->pix, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
|
||||
XCopyArea(server.display,
|
||||
a->pix,
|
||||
((Panel *)a->panel)->temp_pmap,
|
||||
server.gc,
|
||||
0,
|
||||
0,
|
||||
a->width,
|
||||
a->height,
|
||||
a->posx,
|
||||
a->posy);
|
||||
|
||||
for (GList *l = a->children; l; l = l->next)
|
||||
draw_tree((Area *)l->data);
|
||||
|
@ -382,7 +392,16 @@ void draw(Area *a)
|
|||
// Add layer of root pixmap (or clear pixmap if real_transparency==true)
|
||||
if (server.real_transparency)
|
||||
clear_pixmap(a->pix, 0, 0, a->width, a->height);
|
||||
XCopyArea(server.display, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
|
||||
XCopyArea(server.display,
|
||||
((Panel *)a->panel)->temp_pmap,
|
||||
a->pix,
|
||||
server.gc,
|
||||
a->posx,
|
||||
a->posy,
|
||||
a->width,
|
||||
a->height,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
a->_clear(a);
|
||||
}
|
||||
|
@ -531,11 +550,8 @@ void mouse_over(Area *area, int pressed)
|
|||
if (!pressed) {
|
||||
new_state = area->has_mouse_over_effect ? MOUSE_OVER : MOUSE_NORMAL;
|
||||
} else {
|
||||
new_state = area->has_mouse_press_effect
|
||||
? MOUSE_DOWN
|
||||
: area->has_mouse_over_effect
|
||||
? MOUSE_OVER
|
||||
: MOUSE_NORMAL;
|
||||
new_state =
|
||||
area->has_mouse_press_effect ? MOUSE_DOWN : area->has_mouse_over_effect ? MOUSE_OVER : MOUSE_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,7 +563,8 @@ void mouse_over(Area *area, int pressed)
|
|||
mouse_over_area = area;
|
||||
|
||||
mouse_over_area->mouse_state = new_state;
|
||||
mouse_over_area->pix = mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
mouse_over_area->pix =
|
||||
mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
if (!mouse_over_area->pix)
|
||||
mouse_over_area->_redraw_needed = TRUE;
|
||||
panel_refresh = TRUE;
|
||||
|
@ -558,7 +575,8 @@ void mouse_out()
|
|||
if (!mouse_over_area)
|
||||
return;
|
||||
mouse_over_area->mouse_state = MOUSE_NORMAL;
|
||||
mouse_over_area->pix = mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
mouse_over_area->pix =
|
||||
mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
if (!mouse_over_area->pix)
|
||||
mouse_over_area->_redraw_needed = TRUE;
|
||||
panel_refresh = TRUE;
|
||||
|
|
|
@ -156,12 +156,7 @@ typedef enum Alignment {
|
|||
ALIGN_RIGHT = 2,
|
||||
} Alignment;
|
||||
|
||||
typedef enum MouseState {
|
||||
MOUSE_NORMAL = 0,
|
||||
MOUSE_OVER = 1,
|
||||
MOUSE_DOWN = 2,
|
||||
MOUSE_STATE_COUNT
|
||||
} MouseState;
|
||||
typedef enum MouseState { MOUSE_NORMAL = 0, MOUSE_OVER = 1, MOUSE_DOWN = 2, MOUSE_STATE_COUNT } MouseState;
|
||||
|
||||
struct Panel;
|
||||
|
||||
|
|
|
@ -392,9 +392,15 @@ void render_image(Drawable d, int x, int y)
|
|||
imlib_context_set_blend(0);
|
||||
imlib_render_image_on_drawable(0, 0);
|
||||
|
||||
Picture pict = XRenderCreatePicture(server.display, pixmap, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
Picture pict_drawable = XRenderCreatePicture(server.display, d, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
Picture pict_mask = XRenderCreatePicture(server.display, mask, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
Picture pict = XRenderCreatePicture(server.display,
|
||||
pixmap,
|
||||
XRenderFindStandardFormat(server.display, PictStandardARGB32),
|
||||
0,
|
||||
0);
|
||||
Picture pict_drawable =
|
||||
XRenderCreatePicture(server.display, d, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
Picture pict_mask =
|
||||
XRenderCreatePicture(server.display, mask, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
XRenderComposite(server.display, PictOpOver, pict, pict_mask, pict_drawable, 0, 0, 0, 0, x, y, w, h);
|
||||
|
||||
XRenderFreePicture(server.display, pict_mask);
|
||||
|
@ -520,7 +526,8 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r)
|
|||
|
||||
void clear_pixmap(Pixmap p, int x, int y, int w, int h)
|
||||
{
|
||||
Picture pict = XRenderCreatePicture(server.display, p, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
Picture pict =
|
||||
XRenderCreatePicture(server.display, p, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
XRenderColor col;
|
||||
col.red = col.green = col.blue = col.alpha = 0;
|
||||
XRenderFillRectangle(server.display, PictOpSrc, pict, &col, x, y, w, h);
|
||||
|
|
|
@ -119,7 +119,11 @@ GSList *load_locations_from_env(GSList *locations, const char *var, ...);
|
|||
|
||||
GSList *slist_remove_duplicates(GSList *list, GCompareFunc eq, GDestroyNotify fr);
|
||||
|
||||
#define free_and_null(p) { free(p); p = NULL; }
|
||||
#define free_and_null(p) \
|
||||
{ \
|
||||
free(p); \
|
||||
p = NULL; \
|
||||
}
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 33, 4)
|
||||
GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data);
|
||||
|
|
|
@ -56,15 +56,26 @@ void uevent_handler();
|
|||
void uevent_register_notifier(struct uevent_notify *nb);
|
||||
void uevent_unregister_notifier(struct uevent_notify *nb);
|
||||
#else
|
||||
static inline int uevent_init() {
|
||||
static inline int uevent_init()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline void uevent_cleanup() { }
|
||||
static inline void uevent_handler() { }
|
||||
static inline void uevent_cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
static inline void uevent_register_notifier(struct uevent_notify *nb) { }
|
||||
static inline void uevent_unregister_notifier(struct uevent_notify *nb) { }
|
||||
static inline void uevent_handler()
|
||||
{
|
||||
}
|
||||
|
||||
static inline void uevent_register_notifier(struct uevent_notify *nb)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void uevent_unregister_notifier(struct uevent_notify *nb)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -124,7 +124,8 @@ int get_window_desktop(Window win)
|
|||
|
||||
if (x < 0 || y < 0) {
|
||||
int num_results;
|
||||
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
long *x_screen_size =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
if (!x_screen_size)
|
||||
return 0;
|
||||
int x_screen_width = x_screen_size[0];
|
||||
|
@ -156,7 +157,8 @@ int get_window_desktop(Window win)
|
|||
|
||||
if (best_match < 0)
|
||||
best_match = 0;
|
||||
//fprintf(stderr, "window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
||||
// fprintf(stderr, "window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??",
|
||||
// best_match+1, x, y);
|
||||
return best_match;
|
||||
}
|
||||
|
||||
|
@ -183,7 +185,8 @@ int get_window_monitor(Window win)
|
|||
|
||||
if (best_match < 0)
|
||||
best_match = 0;
|
||||
//fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
||||
// fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win,
|
||||
// get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
||||
return best_match;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue