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));
|
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);
|
||||||
|
break;
|
||||||
draw_free_context(ctx);
|
case Left:
|
||||||
}
|
statusbar->sw->drawable = draw_rotate(ctx, phys_screen, - M_PI_2,
|
||||||
else
|
0, statusbar->width);
|
||||||
{
|
draw_free_context(ctx);
|
||||||
statusbar->sw->drawable = ctx->drawable;
|
break;
|
||||||
/* just delete the struct, don't delete the drawable */
|
default:
|
||||||
p_delete(&ctx);
|
statusbar->sw->drawable = ctx->drawable;
|
||||||
|
/* just delete the struct, don't delete the drawable */
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
16
window.c
16
window.c
|
@ -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,10 +206,16 @@ simplewindow_new(int phys_screen, int x, int y, unsigned int w, unsigned int h,
|
||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask,
|
CWOverrideRedirect | CWBackPixmap | CWEventMask,
|
||||||
&wa);
|
&wa);
|
||||||
|
|
||||||
sw->drawable = XCreatePixmap(globalconf.display,
|
if(rotate_drawable)
|
||||||
RootWindow(globalconf.display, phys_screen),
|
sw->drawable = XCreatePixmap(globalconf.display,
|
||||||
w, h,
|
RootWindow(globalconf.display, phys_screen),
|
||||||
DefaultDepth(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,
|
XDefineCursor(globalconf.display,
|
||||||
sw->window,
|
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_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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue