rework statusbar stuff

This commit is contained in:
Julien Danjou 2008-01-23 17:44:07 +01:00
parent 0d1497d3bf
commit 9e1994d879
3 changed files with 33 additions and 25 deletions

View File

@ -116,21 +116,23 @@ statusbar_draw(Statusbar *statusbar)
left += widget->draw(widget, ctx, left, (left + right)); left += widget->draw(widget, ctx, left, (left + right));
} }
if(statusbar->position == Right switch(statusbar->position)
|| statusbar->position == Left)
{ {
if(statusbar->position == Right) case Right:
statusbar->sw->drawable = draw_rotate(ctx, phys_screen, M_PI_2, statusbar->height, 0); statusbar->sw->drawable = draw_rotate(ctx, phys_screen, M_PI_2,
else statusbar->height, 0);
statusbar->sw->drawable = draw_rotate(ctx, phys_screen, - M_PI_2, 0, statusbar->width);
draw_free_context(ctx); draw_free_context(ctx);
} break;
else case Left:
{ statusbar->sw->drawable = draw_rotate(ctx, phys_screen, - M_PI_2,
0, statusbar->width);
draw_free_context(ctx);
break;
default:
statusbar->sw->drawable = ctx->drawable; statusbar->sw->drawable = ctx->drawable;
/* just delete the struct, don't delete the drawable */ /* just delete the struct, don't delete the drawable */
p_delete(&ctx); p_delete(&ctx);
break;
} }
statusbar_display(statusbar); statusbar_display(statusbar);
@ -150,13 +152,13 @@ statusbar_display(Statusbar *statusbar)
XCopyArea(globalconf.display, statusbar->sw->drawable, XCopyArea(globalconf.display, statusbar->sw->drawable,
statusbar->sw->window, statusbar->sw->window,
DefaultGC(globalconf.display, phys_screen), 0, 0, DefaultGC(globalconf.display, phys_screen), 0, 0,
statusbar->height, statusbar->sw->geometry.height,
statusbar->width, 0, 0); statusbar->sw->geometry.width, 0, 0);
else else
XCopyArea(globalconf.display, statusbar->sw->drawable, XCopyArea(globalconf.display, statusbar->sw->drawable,
statusbar->sw->window, statusbar->sw->window,
DefaultGC(globalconf.display, phys_screen), 0, 0, DefaultGC(globalconf.display, phys_screen), 0, 0,
statusbar->width, statusbar->height, 0, 0); statusbar->sw->geometry.width, statusbar->sw->geometry.height, 0, 0);
} }
void void
@ -207,10 +209,10 @@ statusbar_init(Statusbar *statusbar)
if(statusbar->dposition == Right || statusbar->dposition == Left) if(statusbar->dposition == Right || statusbar->dposition == Left)
statusbar->sw = statusbar->sw =
simplewindow_new(phys_screen, 0, 0, statusbar->height, statusbar->width, 0); simplewindow_new(phys_screen, 0, 0, statusbar->height, statusbar->width, 0, True);
else else
statusbar->sw = statusbar->sw =
simplewindow_new(phys_screen, 0, 0, statusbar->width, statusbar->height, 0); simplewindow_new(phys_screen, 0, 0, statusbar->width, statusbar->height, 0, False);
widget_calculate_alignments(statusbar->widgets); widget_calculate_alignments(statusbar->widgets);

View File

@ -178,7 +178,7 @@ window_settrans(Window win, double opacity)
SimpleWindow * SimpleWindow *
simplewindow_new(int phys_screen, int x, int y, unsigned int w, unsigned int h, simplewindow_new(int phys_screen, int x, int y, unsigned int w, unsigned int h,
unsigned int border_width) unsigned int border_width, Bool rotate_drawable)
{ {
XSetWindowAttributes wa; XSetWindowAttributes wa;
SimpleWindow *sw; SimpleWindow *sw;
@ -206,6 +206,12 @@ simplewindow_new(int phys_screen, int x, int y, unsigned int w, unsigned int h,
CWOverrideRedirect | CWBackPixmap | CWEventMask, CWOverrideRedirect | CWBackPixmap | CWEventMask,
&wa); &wa);
if(rotate_drawable)
sw->drawable = XCreatePixmap(globalconf.display,
RootWindow(globalconf.display, phys_screen),
h, w,
DefaultDepth(globalconf.display, phys_screen));
else
sw->drawable = XCreatePixmap(globalconf.display, sw->drawable = XCreatePixmap(globalconf.display,
RootWindow(globalconf.display, phys_screen), RootWindow(globalconf.display, phys_screen),
w, h, w, h,

View File

@ -30,7 +30,7 @@ Status window_configure(Window, Area, int);
void window_grabbuttons(int, Window, Bool, Bool); void window_grabbuttons(int, Window, Bool, Bool);
void window_setshape(int, Window); void window_setshape(int, Window);
int window_settrans(Window, double); int window_settrans(Window, double);
SimpleWindow * simplewindow_new(int, int, int, unsigned int, unsigned int, unsigned int); SimpleWindow * simplewindow_new(int, int, int, unsigned int, unsigned int, unsigned int, Bool);
void simplewindow_delete(SimpleWindow *); void simplewindow_delete(SimpleWindow *);
int simplewindow_move(SimpleWindow *, int, int); int simplewindow_move(SimpleWindow *, int, int);