play with vertical panel
git-svn-id: http://tint2.googlecode.com/svn/trunk@121 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
98
src/panel.c
98
src/panel.c
@@ -42,6 +42,7 @@ int mouse_scroll_down;
|
||||
int panel_mode;
|
||||
int wm_menu;
|
||||
int panel_position;
|
||||
int panel_horizontal;
|
||||
int panel_refresh;
|
||||
|
||||
Task *task_active;
|
||||
@@ -83,22 +84,37 @@ void init_panel()
|
||||
if (systray.area.on_screen && i == 0)
|
||||
p->area.list = g_slist_append(p->area.list, &systray);
|
||||
|
||||
// detect panel size
|
||||
if (p->pourcentx)
|
||||
p->area.width = (float)server.monitor[p->monitor].width * p->initial_width / 100;
|
||||
else
|
||||
p->area.width = p->initial_width;
|
||||
if (p->pourcenty)
|
||||
p->area.height = (float)server.monitor[p->monitor].height * p->initial_height / 100;
|
||||
else
|
||||
p->area.height = p->initial_height;
|
||||
|
||||
// full width mode
|
||||
if (!p->area.width)
|
||||
p->area.width = server.monitor[p->monitor].width;
|
||||
if (!p->initial_width) {
|
||||
p->initial_width = 100;
|
||||
p->pourcentx = 1;
|
||||
}
|
||||
|
||||
if (p->area.pix.border.rounded > p->area.height/2)
|
||||
p->area.pix.border.rounded = p->area.height/2;
|
||||
// detect panel size
|
||||
if (panel_horizontal) {
|
||||
if (p->pourcentx)
|
||||
p->area.width = (float)server.monitor[p->monitor].width * p->initial_width / 100;
|
||||
else
|
||||
p->area.width = p->initial_width;
|
||||
if (p->pourcenty)
|
||||
p->area.height = (float)server.monitor[p->monitor].height * p->initial_height / 100;
|
||||
else
|
||||
p->area.height = p->initial_height;
|
||||
if (p->area.pix.border.rounded > p->area.height/2)
|
||||
p->area.pix.border.rounded = p->area.height/2;
|
||||
}
|
||||
else {
|
||||
if (p->pourcentx)
|
||||
p->area.height = (float)server.monitor[p->monitor].height * p->initial_width / 100;
|
||||
else
|
||||
p->area.height = p->initial_width;
|
||||
if (p->pourcenty)
|
||||
p->area.width = (float)server.monitor[p->monitor].width * p->initial_height / 100;
|
||||
else
|
||||
p->area.width = p->initial_height;
|
||||
if (p->area.pix.border.rounded > p->area.width/2)
|
||||
p->area.pix.border.rounded = p->area.width/2;
|
||||
}
|
||||
|
||||
/* panel position determined here */
|
||||
if (panel_position & LEFT) {
|
||||
@@ -109,16 +125,24 @@ void init_panel()
|
||||
p->posx = server.monitor[p->monitor].x + server.monitor[p->monitor].width - p->area.width - p->marginx;
|
||||
}
|
||||
else {
|
||||
p->posx = server.monitor[p->monitor].x + ((server.monitor[p->monitor].width - p->area.width) / 2);
|
||||
if (panel_horizontal)
|
||||
p->posx = server.monitor[p->monitor].x + ((server.monitor[p->monitor].width - p->area.width) / 2);
|
||||
else
|
||||
p->posx = server.monitor[p->monitor].x + p->marginx;
|
||||
}
|
||||
}
|
||||
if (panel_position & TOP) {
|
||||
p->posy = server.monitor[p->monitor].y + p->marginy;
|
||||
}
|
||||
else {
|
||||
p->posy = server.monitor[p->monitor].y + server.monitor[p->monitor].height - p->area.height - p->marginy;
|
||||
if (panel_position & BOTTOM) {
|
||||
p->posy = server.monitor[p->monitor].y + server.monitor[p->monitor].height - p->area.height - p->marginy;
|
||||
}
|
||||
else {
|
||||
p->posy = server.monitor[p->monitor].y + ((server.monitor[p->monitor].height - p->area.height) / 2);
|
||||
}
|
||||
}
|
||||
//printf("posx %d, posy %d, width %d, height %d\n", p->posx, p->posy, p->area.width, p->area.height);
|
||||
// printf("panel : posx %d, posy %d, width %d, height %d\n", p->posx, p->posy, p->area.width, p->area.height);
|
||||
|
||||
// Catch some events
|
||||
XSetWindowAttributes att = { ParentRelative, 0L, 0, 0L, 0, 0, Always, 0L, 0L, False, ExposureMask|ButtonPressMask|ButtonReleaseMask, NoEventMask, False, 0, 0 };
|
||||
@@ -261,18 +285,34 @@ void set_panel_properties(Panel *p)
|
||||
|
||||
// Reserved space
|
||||
long struts [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (panel_position & TOP) {
|
||||
struts[2] = p->area.height + p->marginy;
|
||||
struts[8] = p->posx;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[9] = p->posx + p->area.width - 1;
|
||||
}
|
||||
else {
|
||||
struts[3] = p->area.height + p->marginy;
|
||||
struts[10] = p->posx;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[11] = p->posx + p->area.width - 1;
|
||||
}
|
||||
if (panel_horizontal) {
|
||||
if (panel_position & TOP) {
|
||||
struts[2] = p->area.height + p->marginy;
|
||||
struts[8] = p->posx;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[9] = p->posx + p->area.width - 1;
|
||||
}
|
||||
else {
|
||||
struts[3] = p->area.height + p->marginy;
|
||||
struts[10] = p->posx;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[11] = p->posx + p->area.width - 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (panel_position & LEFT) {
|
||||
struts[0] = p->area.width + p->marginx;
|
||||
struts[4] = p->posy;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[5] = p->posy + p->area.height - 1;
|
||||
}
|
||||
else {
|
||||
struts[1] = p->area.width + p->marginx;
|
||||
struts[6] = p->posy;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[7] = p->posy + p->area.height - 1;
|
||||
}
|
||||
}
|
||||
// Old specification : fluxbox need _NET_WM_STRUT.
|
||||
XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STRUT, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 4);
|
||||
XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STRUT_PARTIAL, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 12);
|
||||
|
||||
Reference in New Issue
Block a user