int panel_autohide_height;
int panel_strut_policy;
-Task *task_active;
-Task *task_drag;
int max_tick_urgent;
// panel's initial config
Imlib_Image default_icon;
-
-void autohide_hide(void* p);
-void autohide_show(void* p);
-
-
void default_panel()
{
panel1 = 0;
nb_panel = 0;
default_icon = NULL;
- task_active = 0;
- task_drag = 0;
task_dragged = 0;
panel_horizontal = 1;
panel_position = CENTER;
panel_autohide_show_timeout = 0;
panel_autohide_hide_timeout = 0;
panel_autohide_height = 5; // for vertical panels this is of course the width
- panel_strut_policy = STRUT_MINIMUM;
+ panel_strut_policy = STRUT_FOLLOW_SIZE;
panel_dock = 0; // default not in the dock
panel_layer = BOTTOM_LAYER; // default is bottom layer
wm_menu = 0;
- max_tick_urgent = 7;
+ max_tick_urgent = 14;
backgrounds = g_array_new(0, 0, sizeof(Background));
memset(&panel_config, 0, sizeof(Panel));
}
if (panel1) free(panel1);
- if (backgrounds) g_array_free(backgrounds, 1);
+ if (backgrounds)
+ g_array_free(backgrounds, 1);
if (panel_config.g_task.font_desc) pango_font_description_free(panel_config.g_task.font_desc);
}
init_tooltip();
init_systray();
+ init_launcher();
init_clock();
#ifdef ENABLE_BATTERY
init_battery();
if (panel_config.monitor < 0)
p->monitor = i;
+ if ( p->area.bg == 0 )
+ p->area.bg = &g_array_index(backgrounds, Background, 0);
p->area.parent = p;
p->area.panel = p;
p->area.on_screen = 1;
p->area.resize = 1;
+ p->area.size_mode = SIZE_BY_LAYOUT;
p->area._resize = resize_panel;
p->g_taskbar.area.parent = p;
p->g_taskbar.area.panel = p;
p->area.list = g_slist_append(p->area.list, &p->battery);
}
#endif
+ if (launcher_enabled) {
+ init_launcher_panel(p);
+ p->area.list = g_slist_append(p->area.list, &p->launcher);
+ }
// systray only on first panel
if (systray.area.on_screen && i == 0) {
init_systray_panel(p);
}
}
- if (panel_autohide) {
- int diff = (panel_horizontal ? panel->area.height : panel->area.width) - panel_autohide_height;
- if (panel_horizontal) {
- panel->hidden_width = panel->area.width;
- panel->hidden_height = panel->area.height - diff;
- }
- else {
- panel->hidden_width = panel->area.width - diff;
- panel->hidden_height = panel->area.height;
- }
+ // autohide or strut_policy=minimum
+ int diff = (panel_horizontal ? panel->area.height : panel->area.width) - panel_autohide_height;
+ if (panel_horizontal) {
+ panel->hidden_width = panel->area.width;
+ panel->hidden_height = panel->area.height - diff;
+ }
+ else {
+ panel->hidden_width = panel->area.width - diff;
+ panel->hidden_height = panel->area.height;
}
// printf("panel : posx %d, posy %d, width %d, height %d\n", panel->posx, panel->posy, panel->area.width, panel->area.height);
}
void resize_panel(void *obj)
{
Panel *panel = (Panel*)obj;
+//printf("resize_panel : taskbar\n");
if (panel_horizontal) {
int taskbar_width, modulo_width = 0;
taskbar_width = panel->area.width - (2 * panel->area.paddingxlr) - (2 * panel->area.bg->border.width);
if (panel->clock.area.on_screen && panel->clock.area.width)
taskbar_width -= (panel->clock.area.width + panel->area.paddingx);
+ if (panel->launcher.area.on_screen && panel->launcher.area.width)
+ taskbar_width -= (panel->launcher.area.width + panel->area.paddingx);
#ifdef ENABLE_BATTERY
if (panel->battery.area.on_screen && panel->battery.area.width)
taskbar_width -= (panel->battery.area.width + panel->area.paddingx);
// change posx and width for all taskbar
int i, posx;
posx = panel->area.bg->border.width + panel->area.paddingxlr;
+ if (panel->launcher.area.on_screen && panel->launcher.area.width)
+ posx += (panel->launcher.area.width + panel->area.paddingx);
for (i=0 ; i < panel->nb_desktop ; i++) {
panel->taskbar[i].area.posx = posx;
panel->taskbar[i].area.width = taskbar_width;
taskbar_height = panel->area.height - (2 * panel->area.paddingxlr) - (2 * panel->area.bg->border.width);
if (panel->clock.area.on_screen && panel->clock.area.height)
taskbar_height -= (panel->clock.area.height + panel->area.paddingx);
+ if (panel->launcher.area.on_screen && panel->launcher.area.height)
+ taskbar_height -= (panel->launcher.area.height + panel->area.paddingx);
#ifdef ENABLE_BATTERY
if (panel->battery.area.on_screen && panel->battery.area.height)
taskbar_height -= (panel->battery.area.height + panel->area.paddingx);
taskbar_height -= (systray.area.height + panel->area.paddingx);
posy = panel->area.height - panel->area.bg->border.width - panel->area.paddingxlr - taskbar_height;
+ if (panel->launcher.area.on_screen && panel->launcher.area.height)
+ posy -= (panel->launcher.area.height + panel->area.paddingx);
if (panel_mode == MULTI_DESKTOP) {
int height = taskbar_height - ((panel->nb_desktop-1) * panel->area.paddingx);
taskbar_height = height / panel->nb_desktop;
long struts [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
if (panel_horizontal) {
int height = p->area.height + p->marginy;
- if (panel_autohide && (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden)) )
+ if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden))
height = p->hidden_height;
if (panel_position & TOP) {
struts[2] = height + monitor.y;
}
else {
int width = p->area.width + p->marginx;
- if (panel_autohide && (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden)) )
+ if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden))
width = p->hidden_width;
if (panel_position & LEFT) {
struts[0] = width + monitor.x;
XChangeProperty(server.dsp, p->main_win, server.atom._MOTIF_WM_HINTS, server.atom._MOTIF_WM_HINTS, 32, PropModeReplace, (unsigned char *) prop, 5);
// XdndAware - Register for Xdnd events
- int version=5;
+ long version=5;
XChangeProperty(server.dsp, p->main_win, server.atom.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1);
update_strut(p);
}
+Launcher *click_launcher (Panel *panel, int x, int y)
+{
+ Launcher *launcher = &panel->launcher;
+
+ if (panel_horizontal) {
+ if (launcher->area.on_screen && x >= launcher->area.posx && x <= (launcher->area.posx + launcher->area.width))
+ return launcher;
+ }
+ else {
+ if (launcher->area.on_screen && y >= launcher->area.posy && y <= (launcher->area.posy + launcher->area.height))
+ return launcher;
+ }
+ return NULL;
+}
+
+
+LauncherIcon *click_launcher_icon (Panel *panel, int x, int y)
+{
+ GSList *l0;
+ Launcher *launcher;
+
+ //printf("Click x=%d y=%d\n", x, y);
+ if ( (launcher = click_launcher(panel, x, y)) ) {
+ LauncherIcon *icon;
+ for (l0 = launcher->list_icons; l0 ; l0 = l0->next) {
+ icon = l0->data;
+ if (x >= (launcher->area.posx + icon->x) && x <= (launcher->area.posx + icon->x + icon->icon_size) &&
+ y >= (launcher->area.posy + icon->y) && y <= (launcher->area.posy + icon->y + icon->icon_size)) {
+ //printf("Hit rect x=%d y=%d xmax=%d ymax=%d\n", launcher->area.posx + icon->x, launcher->area.posy + icon->y, launcher->area.posx + icon->x + icon->width, launcher->area.posy + icon->y + icon->height);
+ return icon;
+ }
+ }
+ }
+ return NULL;
+}
+
+
int click_padding(Panel *panel, int x, int y)
{
if (panel_horizontal) {