From 1edaf21bde888ae8f1fff03fff4076b2bfd51528 Mon Sep 17 00:00:00 2001 From: o9000 Date: Fri, 25 Mar 2016 11:13:05 +0100 Subject: [PATCH] Add area.name, useful for debugging --- src/battery/battery.c | 1 + src/clock/clock.c | 1 + src/execplugin/execplugin.c | 2 +- src/freespace/freespace.c | 1 + src/launcher/launcher.c | 2 ++ src/panel.c | 2 ++ src/systray/systraybar.c | 1 + src/taskbar/task.c | 2 ++ src/taskbar/taskbar.c | 3 +++ src/util/area.h | 1 + 10 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/battery/battery.c b/src/battery/battery.c index ca663a8..6271c66 100644 --- a/src/battery/battery.c +++ b/src/battery/battery.c @@ -150,6 +150,7 @@ void init_battery_panel(void *p) battery->area.parent = p; battery->area.panel = p; + snprintf(battery->area.name, sizeof(battery->area.name), "Battery"); battery->area._draw_foreground = draw_battery; battery->area.size_mode = LAYOUT_FIXED; battery->area._resize = resize_battery; diff --git a/src/clock/clock.c b/src/clock/clock.c index 9b1422e..2d554aa 100644 --- a/src/clock/clock.c +++ b/src/clock/clock.c @@ -180,6 +180,7 @@ void init_clock_panel(void *p) clock_init_fonts(); clock->area.parent = p; clock->area.panel = p; + snprintf(clock->area.name, sizeof(clock->area.name), "Clock"); 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 || diff --git a/src/execplugin/execplugin.c b/src/execplugin/execplugin.c index 070e341..efc3d84 100644 --- a/src/execplugin/execplugin.c +++ b/src/execplugin/execplugin.c @@ -155,9 +155,9 @@ void init_execp_panel(void *p) execp->area.paddingx = execp->backend->paddingx; execp->area.paddingy = execp->backend->paddingy; execp->area.paddingxlr = execp->backend->paddingxlr; - execp->area.parent = panel; execp->area.panel = panel; + snprintf(execp->area.name, sizeof(execp->area.name), "Execp %s", execp->backend->command ? execp->backend->command : "null"); execp->area._draw_foreground = draw_execp; execp->area.size_mode = LAYOUT_FIXED; execp->area._resize = resize_execp; diff --git a/src/freespace/freespace.c b/src/freespace/freespace.c index 56b81a6..1dea9a2 100644 --- a/src/freespace/freespace.c +++ b/src/freespace/freespace.c @@ -39,6 +39,7 @@ void init_freespace_panel(void *p) freespace->area.bg = &g_array_index(backgrounds, Background, 0); freespace->area.parent = p; freespace->area.panel = p; + snprintf(freespace->area.name, sizeof(freespace->area.name), "Freespace"); freespace->area.size_mode = LAYOUT_FIXED; freespace->area.resize_needed = 1; freespace->area.on_screen = TRUE; diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index bbb6663..bea6e19 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -83,6 +83,7 @@ void init_launcher_panel(void *p) launcher->area.parent = p; launcher->area.panel = p; + snprintf(launcher->area.name, sizeof(launcher->area.name), "Launcher"); launcher->area._draw_foreground = NULL; launcher->area.size_mode = LAYOUT_FIXED; launcher->area._resize = resize_launcher; @@ -452,6 +453,7 @@ void launcher_load_icons(Launcher *launcher) if (entry.exec) { LauncherIcon *launcherIcon = calloc(1, sizeof(LauncherIcon)); launcherIcon->area.panel = launcher->area.panel; + snprintf(launcherIcon->area.name, sizeof(launcherIcon->area.name), "LauncherIcon %s", entry.name ? entry.name : "null"); launcherIcon->area._draw_foreground = draw_launcher_icon; launcherIcon->area.size_mode = LAYOUT_FIXED; launcherIcon->area._resize = NULL; diff --git a/src/panel.c b/src/panel.c index 6489656..658d88b 100644 --- a/src/panel.c +++ b/src/panel.c @@ -99,6 +99,7 @@ void default_panel() backgrounds = g_array_new(0, 0, sizeof(Background)); memset(&panel_config, 0, sizeof(Panel)); + snprintf(panel_config.area.name, sizeof(panel_config.area.name), "Panel"); panel_config.mouse_over_alpha = 100; panel_config.mouse_over_saturation = 0; panel_config.mouse_over_brightness = 10; @@ -196,6 +197,7 @@ void init_panel() p->area.bg = &g_array_index(backgrounds, Background, 0); p->area.parent = p; p->area.panel = p; + snprintf(p->area.name, sizeof(p->area.name), "Panel %d", i); p->area.on_screen = TRUE; p->area.resize_needed = 1; p->area.size_mode = LAYOUT_DYNAMIC; diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index b6fef2b..52a60b5 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -113,6 +113,7 @@ void init_systray_panel(void *p) Panel *panel = (Panel *)p; systray.area.parent = panel; systray.area.panel = panel; + snprintf(systray.area.name, sizeof(systray.area.name), "Systray"); if (!systray.area.bg) systray.area.bg = &g_array_index(backgrounds, Background, 0); show(&systray.area); diff --git a/src/taskbar/task.c b/src/taskbar/task.c index 9083e98..9858cf1 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -65,6 +65,7 @@ Task *add_task(Window win) Task task_template; memset(&task_template, 0, sizeof(task_template)); + snprintf(task_template.area.name, sizeof(task_template.area.name), "Task %d", (int)win); task_template.area.has_mouse_over_effect = panel_config.mouse_effects; task_template.area.has_mouse_press_effect = panel_config.mouse_effects; task_template.area._is_under_mouse = full_width_area_is_under_mouse; @@ -82,6 +83,7 @@ Task *add_task(Window win) } task_update_title(&task_template); task_update_icon(&task_template); + snprintf(task_template.area.name, sizeof(task_template.area.name), "Task %d %s", (int)win, task_template.title ? task_template.title : "null"); // fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ? // task_template.title : "??"); diff --git a/src/taskbar/taskbar.c b/src/taskbar/taskbar.c index 6afcbfe..de7ed4c 100644 --- a/src/taskbar/taskbar.c +++ b/src/taskbar/taskbar.c @@ -147,6 +147,7 @@ void init_taskbar_panel(void *p) // taskbar name panel->g_taskbar.area_name.panel = panel; + snprintf(panel->g_taskbar.area_name.name, sizeof(panel->g_taskbar.area_name.name), "Taskbarname"); panel->g_taskbar.area_name.size_mode = LAYOUT_FIXED; panel->g_taskbar.area_name._resize = resize_taskbarname; panel->g_taskbar.area_name._is_under_mouse = full_width_area_is_under_mouse; @@ -158,6 +159,7 @@ void init_taskbar_panel(void *p) // taskbar panel->g_taskbar.area.parent = panel; panel->g_taskbar.area.panel = panel; + snprintf(panel->g_taskbar.area.name, sizeof(panel->g_taskbar.area.name), "Taskbar"); panel->g_taskbar.area.size_mode = LAYOUT_DYNAMIC; panel->g_taskbar.area.alignment = taskbar_alignment; panel->g_taskbar.area._resize = resize_taskbar; @@ -178,6 +180,7 @@ void init_taskbar_panel(void *p) // task panel->g_task.area.panel = panel; + snprintf(panel->g_task.area.name, sizeof(panel->g_task.area.name), "Task"); panel->g_task.area.size_mode = LAYOUT_DYNAMIC; panel->g_task.area._draw_foreground = draw_task; panel->g_task.area._on_change_layout = on_change_task; diff --git a/src/util/area.h b/src/util/area.h index 0b83a38..62ae306 100644 --- a/src/util/area.h +++ b/src/util/area.h @@ -194,6 +194,7 @@ typedef struct Area { // This is the pixmap on which the Area is rendered. Render to it directly if needed. Pixmap pix; Pixmap pix_by_state[MOUSE_STATE_COUNT]; + char name[32]; // Callbacks