Cleanup whitespace
This commit is contained in:
parent
d398795202
commit
7b6ce97940
24 changed files with 294 additions and 180 deletions
|
@ -156,9 +156,9 @@ 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_uwheel_command || battery_dwheel_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)
|
||||
battery->area._get_tooltip_text = battery_get_tooltip;
|
||||
|
@ -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());
|
||||
|
|
|
@ -732,7 +732,7 @@ void add_entry(char *key, char *value)
|
|||
panel_config.g_taskbar.background_name[TASKBAR_NORMAL] = &g_array_index(backgrounds, Background, id);
|
||||
if (panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] == 0)
|
||||
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] =
|
||||
panel_config.g_taskbar.background_name[TASKBAR_NORMAL];
|
||||
panel_config.g_taskbar.background_name[TASKBAR_NORMAL];
|
||||
} else if (strcmp(key, "taskbar_name_active_background_id") == 0) {
|
||||
int id = atoi(value);
|
||||
id = (id < backgrounds->len && id >= 0) ? id : 0;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
static gint compare_strings(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
return strnatcasecmp((const char*)a, (const char*)b);
|
||||
return strnatcasecmp((const char *)a, (const char *)b);
|
||||
}
|
||||
|
||||
int parse_dektop_line(char *line, char **key, char **value)
|
||||
|
|
|
@ -346,9 +346,9 @@ void test_launcher_read_theme_file()
|
|||
dir->max_size,
|
||||
dir->threshold,
|
||||
dir->type == ICON_DIR_TYPE_FIXED ? "Fixed" : dir->type == ICON_DIR_TYPE_SCALABLE
|
||||
? "Scalable"
|
||||
: dir->type == ICON_DIR_TYPE_THRESHOLD ? "Threshold"
|
||||
: "?????");
|
||||
? "Scalable"
|
||||
: dir->type == ICON_DIR_TYPE_THRESHOLD ? "Threshold"
|
||||
: "?????");
|
||||
item = g_slist_next(item);
|
||||
}
|
||||
fprintf(stdout, "\033[0m");
|
||||
|
@ -585,9 +585,9 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
|||
|
||||
for (theme = themes; theme; theme = g_slist_next(theme)) {
|
||||
((IconTheme *)theme->data)->list_directories =
|
||||
g_slist_sort_with_data(((IconTheme *)theme->data)->list_directories,
|
||||
compare_theme_directories,
|
||||
GINT_TO_POINTER(size));
|
||||
g_slist_sort_with_data(((IconTheme *)theme->data)->list_directories,
|
||||
compare_theme_directories,
|
||||
GINT_TO_POINTER(size));
|
||||
GSList *dir;
|
||||
for (dir = ((IconTheme *)theme->data)->list_directories; dir; dir = g_slist_next(dir)) {
|
||||
// Closest match
|
||||
|
@ -607,7 +607,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
|||
char *dir_name = ((IconThemeDir *)dir->data)->name;
|
||||
char *extension = (char *)ext->data;
|
||||
if (strlen(base_name) + strlen(theme_name) + strlen(dir_name) + strlen(icon_name) +
|
||||
strlen(extension) + 100 >
|
||||
strlen(extension) + 100 >
|
||||
file_name_size) {
|
||||
file_name_size = strlen(base_name) + strlen(theme_name) + strlen(dir_name) + strlen(icon_name) +
|
||||
strlen(extension) + 100;
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ gboolean resize_launcher(void *obj)
|
|||
|
||||
// Get the path for an icon file with the new size
|
||||
char *new_icon_path =
|
||||
get_icon_path(launcher->icon_theme_wrapper, launcherIcon->icon_name, launcherIcon->icon_size);
|
||||
get_icon_path(launcher->icon_theme_wrapper, launcherIcon->icon_name, launcherIcon->icon_size);
|
||||
if (!new_icon_path) {
|
||||
// Draw a blank icon
|
||||
free_icon(launcherIcon->image);
|
||||
|
@ -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);
|
||||
|
|
|
@ -350,17 +350,17 @@ static void read_settings(XSettingsClient *client)
|
|||
|
||||
old_handler = XSetErrorHandler(ignore_errors);
|
||||
int result = XGetWindowProperty(client->display,
|
||||
client->manager_window,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
0,
|
||||
LONG_MAX,
|
||||
False,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
&type,
|
||||
&format,
|
||||
&n_items,
|
||||
&bytes_after,
|
||||
&data);
|
||||
client->manager_window,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
0,
|
||||
LONG_MAX,
|
||||
False,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
&type,
|
||||
&format,
|
||||
&n_items,
|
||||
&bytes_after,
|
||||
&data);
|
||||
XSetErrorHandler(old_handler);
|
||||
|
||||
if (result == Success && type == server.atom._XSETTINGS_SETTINGS) {
|
||||
|
|
17
src/panel.c
17
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;
|
||||
}
|
||||
|
@ -349,7 +352,7 @@ void init_panel_size_and_position(Panel *panel)
|
|||
panel->area.height - panel->marginy;
|
||||
} else {
|
||||
panel->posy =
|
||||
server.monitors[panel->monitor].y + ((server.monitors[panel->monitor].height - panel->area.height) / 2);
|
||||
server.monitors[panel->monitor].y + ((server.monitors[panel->monitor].height - panel->area.height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -564,7 +567,7 @@ void set_panel_items_order(Panel *p)
|
|||
GList *item = g_list_nth(p->execp_list, i_execp);
|
||||
i_execp++;
|
||||
if (item)
|
||||
p->area.children = g_list_append(p->area.children, (Area*)item->data);
|
||||
p->area.children = g_list_append(p->area.children, (Area *)item->data);
|
||||
}
|
||||
}
|
||||
initialize_positions(&p->area, 0);
|
||||
|
|
24
src/server.c
24
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];
|
||||
|
@ -505,10 +510,10 @@ int get_current_desktop()
|
|||
|
||||
int ncols = x_screen_width / work_area_width;
|
||||
|
||||
// fprintf(stderr, "\n");
|
||||
// fprintf(stderr, "Work area size: %d x %d\n", work_area_width, work_area_height);
|
||||
// fprintf(stderr, "Viewport pos: %d x %d\n", viewport_x, viewport_y);
|
||||
// fprintf(stderr, "Viewport i: %d\n", (viewport_y / work_area_height) * ncols + viewport_x / work_area_width);
|
||||
// fprintf(stderr, "\n");
|
||||
// fprintf(stderr, "Work area size: %d x %d\n", work_area_width, work_area_height);
|
||||
// fprintf(stderr, "Viewport pos: %d x %d\n", viewport_x, viewport_y);
|
||||
// fprintf(stderr, "Viewport i: %d\n", (viewport_y / work_area_height) * ncols + viewport_x / work_area_width);
|
||||
|
||||
int result = (viewport_y / work_area_height) * ncols + viewport_x / work_area_width;
|
||||
return MAX(0, MIN(server.num_desktops - 1, result));
|
||||
|
@ -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();
|
||||
|
@ -126,20 +127,20 @@ Task *add_task(Window win)
|
|||
*key = task_template.win;
|
||||
g_hash_table_insert(win_to_task, key, task_buttons);
|
||||
|
||||
set_task_state((Task*)g_ptr_array_index(task_buttons, 0), task_template.current_state);
|
||||
set_task_state((Task *)g_ptr_array_index(task_buttons, 0), task_template.current_state);
|
||||
|
||||
sort_taskbar_for_win(win);
|
||||
|
||||
if (taskbar_mode == MULTI_DESKTOP) {
|
||||
Panel *panel = (Panel*)task_template.area.panel;
|
||||
Panel *panel = (Panel *)task_template.area.panel;
|
||||
panel->area.resize_needed = TRUE;
|
||||
}
|
||||
|
||||
if (window_is_urgent(win)) {
|
||||
add_urgent((Task*)g_ptr_array_index(task_buttons, 0));
|
||||
add_urgent((Task *)g_ptr_array_index(task_buttons, 0));
|
||||
}
|
||||
|
||||
return (Task*)g_ptr_array_index(task_buttons, 0);
|
||||
return (Task *)g_ptr_array_index(task_buttons, 0);
|
||||
}
|
||||
|
||||
void remove_task(Task *task)
|
||||
|
@ -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;
|
||||
|
@ -299,7 +301,7 @@ void task_update_icon(Task *task)
|
|||
int w = imlib_image_get_width();
|
||||
int h = imlib_image_get_height();
|
||||
Imlib_Image orig_image =
|
||||
imlib_create_cropped_scaled_image(0, 0, w, h, panel->g_task.icon_size1, panel->g_task.icon_size1);
|
||||
imlib_create_cropped_scaled_image(0, 0, w, h, panel->g_task.icon_size1, panel->g_task.icon_size1);
|
||||
imlib_free_image();
|
||||
|
||||
imlib_context_set_image(orig_image);
|
||||
|
@ -322,13 +324,13 @@ void task_update_icon(Task *task)
|
|||
}
|
||||
if (panel_config.mouse_effects) {
|
||||
task->icon_hover[k] = adjust_icon(task->icon[k],
|
||||
panel_config.mouse_over_alpha,
|
||||
panel_config.mouse_over_saturation,
|
||||
panel_config.mouse_over_brightness);
|
||||
panel_config.mouse_over_alpha,
|
||||
panel_config.mouse_over_saturation,
|
||||
panel_config.mouse_over_brightness);
|
||||
task->icon_press[k] = adjust_icon(task->icon[k],
|
||||
panel_config.mouse_pressed_alpha,
|
||||
panel_config.mouse_pressed_saturation,
|
||||
panel_config.mouse_pressed_brightness);
|
||||
panel_config.mouse_pressed_alpha,
|
||||
panel_config.mouse_pressed_saturation,
|
||||
panel_config.mouse_pressed_brightness);
|
||||
}
|
||||
}
|
||||
imlib_context_set_image(orig_image);
|
||||
|
|
|
@ -265,8 +265,9 @@ 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)) -
|
||||
(2 * panel->g_task.area.paddingy) - 2 * panel->g_task.area.bg->border.width;
|
||||
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;
|
||||
}
|
||||
|
|
166
src/tint.c
166
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 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 SIGPWR: return "SIGPWR: Power failure restart (System V).";
|
||||
case SIGSYS: return "SIGSYS: Bad system call.";
|
||||
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 SIGPWR: return "SIGPWR: Power failure restart (System V).";
|
||||
case SIGSYS:
|
||||
return "SIGSYS: Bad system call.";
|
||||
}
|
||||
static char s[64];
|
||||
sprintf(s, "SIG=%d: Unknown", sig);
|
||||
|
@ -203,7 +232,7 @@ void dump_backtrace(int log_fd)
|
|||
unw_word_t offset;
|
||||
char fname[128];
|
||||
fname[0] = '\0';
|
||||
(void) unw_get_proc_name(&cursor, fname, sizeof(fname), &offset);
|
||||
(void)unw_get_proc_name(&cursor, fname, sizeof(fname), &offset);
|
||||
log_string(log_fd, fname);
|
||||
log_string(log_fd, "\n");
|
||||
}
|
||||
|
@ -245,7 +274,7 @@ void handle_crash(const char *reason)
|
|||
// We are going to crash, so restart the panel
|
||||
char path[4096];
|
||||
sprintf(path, "%s/.tint2-crash.log", get_home_dir());
|
||||
int log_fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0600);
|
||||
int log_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
log_string(log_fd, RED "tint2 crashed, reason: ");
|
||||
log_string(log_fd, reason);
|
||||
log_string(log_fd, RESET "\n");
|
||||
|
@ -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,8 +1490,9 @@ start:
|
|||
init_X11_pre_config();
|
||||
|
||||
if (!config_read()) {
|
||||
fprintf(stderr, "Could not read config file.\n"
|
||||
"Usage: tint2 [[-c] <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;
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ void adjust_asb(DATA32 *data, int w, int h, float alpha_adjust, float satur_adju
|
|||
continue;
|
||||
int r = (argb >> 16) & 0xff;
|
||||
int g = (argb >> 8) & 0xff;
|
||||
int b = (argb) & 0xff;
|
||||
int b = (argb)&0xff;
|
||||
|
||||
// Convert RGB to HSV
|
||||
int cmax = MAX3(r, g, b);
|
||||
|
@ -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);
|
||||
|
@ -417,8 +423,8 @@ void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color
|
|||
0.0,
|
||||
0.0,
|
||||
1.0 -
|
||||
(1.0 - shadow_edge_alpha) *
|
||||
sqrt((i * i + j * j) / (double)(shadow_size * shadow_size)));
|
||||
(1.0 - shadow_edge_alpha) *
|
||||
sqrt((i * i + j * j) / (double)(shadow_size * shadow_size)));
|
||||
pango_cairo_update_layout(c, layout);
|
||||
cairo_move_to(c, posx + i, posy + j);
|
||||
pango_cairo_show_layout(c, layout);
|
||||
|
@ -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);
|
||||
|
@ -569,7 +576,7 @@ void get_text_size2(PangoFontDescription *font,
|
|||
XFreePixmap(server.display, pmap);
|
||||
}
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 33, 4)
|
||||
#if !GLIB_CHECK_VERSION(2, 33, 4)
|
||||
GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data)
|
||||
{
|
||||
list = g_list_copy(list);
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#include <pango/pangocairo.h>
|
||||
#include "area.h"
|
||||
|
||||
#define GREEN "\033[1;32m"
|
||||
#define GREEN "\033[1;32m"
|
||||
#define YELLOW "\033[1;33m"
|
||||
#define RED "\033[1;31m"
|
||||
#define BLUE "\033[1;34m"
|
||||
#define RESET "\033[0m"
|
||||
#define RED "\033[1;31m"
|
||||
#define BLUE "\033[1;34m"
|
||||
#define RESET "\033[0m"
|
||||
|
||||
#define MAX3(a, b, c) MAX(MAX(a, b), c)
|
||||
#define MIN3(a, b, c) MIN(MIN(a, b), c)
|
||||
#define MAX3(a, b, c) MAX(MAX(a, b), c)
|
||||
#define MIN3(a, b, c) MIN(MIN(a, b), c)
|
||||
|
||||
// mouse actions
|
||||
typedef enum MouseAction {
|
||||
|
@ -39,7 +39,7 @@ typedef enum MouseAction {
|
|||
PREV_TASK
|
||||
} MouseAction;
|
||||
|
||||
#define ALL_DESKTOPS 0xFFFFFFFF
|
||||
#define ALL_DESKTOPS 0xFFFFFFFF
|
||||
|
||||
// Copies a file to another path
|
||||
void copy_file(const char *path_src, const char *path_dest);
|
||||
|
@ -119,13 +119,17 @@ 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)
|
||||
#if !GLIB_CHECK_VERSION(2, 33, 4)
|
||||
GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data);
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 38, 0)
|
||||
#if !GLIB_CHECK_VERSION(2, 38, 0)
|
||||
#define g_assert_null(expr) g_assert((expr) == NULL)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ void add_timeout_intern(int value_msec, int interval_msec, void (*_callback)(),
|
|||
|
||||
gint compare_timeouts(gconstpointer t1, gconstpointer t2)
|
||||
{
|
||||
return compare_timespecs(&((const timeout *)t1)->timeout_expires, &((const timeout *)t2)->timeout_expires);
|
||||
return compare_timespecs(&((const timeout *)t1)->timeout_expires, &((const timeout *)t2)->timeout_expires);
|
||||
}
|
||||
|
||||
gint compare_timespecs(const struct timespec *t1, const struct timespec *t2)
|
||||
|
@ -257,7 +257,7 @@ int align_with_existing_timeouts(timeout *t)
|
|||
timeout *t2 = it->data;
|
||||
if (t2->interval_msec > 0) {
|
||||
if (t->interval_msec % t2->interval_msec == 0 || t2->interval_msec % t->interval_msec == 0) {
|
||||
if (!multi_timeouts)
|
||||
if (!multi_timeouts)
|
||||
multi_timeouts = g_hash_table_new(0, 0);
|
||||
if (!t->multi_timeout && !t2->multi_timeout) {
|
||||
// both timeouts can be aligned, but there is no multi timeout for them
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
enum uevent_action {
|
||||
UEVENT_UNKNOWN = 0x01,
|
||||
UEVENT_ADD = 0x02,
|
||||
UEVENT_REMOVE = 0x04,
|
||||
UEVENT_CHANGE = 0x08,
|
||||
UEVENT_ADD = 0x02,
|
||||
UEVENT_REMOVE = 0x04,
|
||||
UEVENT_CHANGE = 0x08,
|
||||
};
|
||||
|
||||
struct uevent_parameter {
|
||||
|
@ -41,7 +41,7 @@ struct uevent {
|
|||
};
|
||||
|
||||
struct uevent_notify {
|
||||
int action; /* bitfield */
|
||||
int action; /* bitfield */
|
||||
char *subsystem; /* NULL => any */
|
||||
void *userdata;
|
||||
|
||||
|
@ -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