rework statusbar stuff
This commit is contained in:
parent
0d1497d3bf
commit
9e1994d879
40
statusbar.c
40
statusbar.c
|
@ -116,21 +116,23 @@ statusbar_draw(Statusbar *statusbar)
|
|||
left += widget->draw(widget, ctx, left, (left + right));
|
||||
}
|
||||
|
||||
if(statusbar->position == Right
|
||||
|| statusbar->position == Left)
|
||||
switch(statusbar->position)
|
||||
{
|
||||
if(statusbar->position == Right)
|
||||
statusbar->sw->drawable = draw_rotate(ctx, phys_screen, M_PI_2, statusbar->height, 0);
|
||||
else
|
||||
statusbar->sw->drawable = draw_rotate(ctx, phys_screen, - M_PI_2, 0, statusbar->width);
|
||||
|
||||
draw_free_context(ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
statusbar->sw->drawable = ctx->drawable;
|
||||
/* just delete the struct, don't delete the drawable */
|
||||
p_delete(&ctx);
|
||||
case Right:
|
||||
statusbar->sw->drawable = draw_rotate(ctx, phys_screen, M_PI_2,
|
||||
statusbar->height, 0);
|
||||
draw_free_context(ctx);
|
||||
break;
|
||||
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;
|
||||
/* just delete the struct, don't delete the drawable */
|
||||
p_delete(&ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
statusbar_display(statusbar);
|
||||
|
@ -150,13 +152,13 @@ statusbar_display(Statusbar *statusbar)
|
|||
XCopyArea(globalconf.display, statusbar->sw->drawable,
|
||||
statusbar->sw->window,
|
||||
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
||||
statusbar->height,
|
||||
statusbar->width, 0, 0);
|
||||
statusbar->sw->geometry.height,
|
||||
statusbar->sw->geometry.width, 0, 0);
|
||||
else
|
||||
XCopyArea(globalconf.display, statusbar->sw->drawable,
|
||||
statusbar->sw->window,
|
||||
DefaultGC(globalconf.display, phys_screen), 0, 0,
|
||||
statusbar->width, statusbar->height, 0, 0);
|
||||
statusbar->sw->geometry.width, statusbar->sw->geometry.height, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -207,10 +209,10 @@ statusbar_init(Statusbar *statusbar)
|
|||
|
||||
if(statusbar->dposition == Right || statusbar->dposition == Left)
|
||||
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
|
||||
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);
|
||||
|
||||
|
|
16
window.c
16
window.c
|
@ -178,7 +178,7 @@ window_settrans(Window win, double opacity)
|
|||
|
||||
SimpleWindow *
|
||||
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;
|
||||
SimpleWindow *sw;
|
||||
|
@ -206,10 +206,16 @@ simplewindow_new(int phys_screen, int x, int y, unsigned int w, unsigned int h,
|
|||
CWOverrideRedirect | CWBackPixmap | CWEventMask,
|
||||
&wa);
|
||||
|
||||
sw->drawable = XCreatePixmap(globalconf.display,
|
||||
RootWindow(globalconf.display, phys_screen),
|
||||
w, h,
|
||||
DefaultDepth(globalconf.display, phys_screen));
|
||||
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,
|
||||
RootWindow(globalconf.display, phys_screen),
|
||||
w, h,
|
||||
DefaultDepth(globalconf.display, phys_screen));
|
||||
|
||||
XDefineCursor(globalconf.display,
|
||||
sw->window,
|
||||
|
|
2
window.h
2
window.h
|
@ -30,7 +30,7 @@ Status window_configure(Window, Area, int);
|
|||
void window_grabbuttons(int, Window, Bool, Bool);
|
||||
void window_setshape(int, Window);
|
||||
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 *);
|
||||
int simplewindow_move(SimpleWindow *, int, int);
|
||||
|
||||
|
|
Loading…
Reference in New Issue