Merge pull request #92 from kjdev/ewmh-position

Fixed xcb-ewmh window position
This commit is contained in:
George Badawi 2017-02-03 04:05:40 +02:00 committed by GitHub
commit f659cb8bb8
3 changed files with 15 additions and 10 deletions

View file

@ -256,6 +256,8 @@ struct ya_bar {
uint32_t bgcolor; //background color
uint16_t width;
uint16_t height;
uint16_t x;
uint16_t y;
xcb_window_t win;
uint8_t position; //top, bottom, left or right.

View file

@ -136,24 +136,24 @@ void ya_create_block(ya_block_t *blk) {
*/
void ya_create_bar(ya_bar_t * bar) {
bar->win = xcb_generate_id(ya.c);
int x=0, y=0;
bar->x=0, bar->y=0;
if ((ya.gen_flag & GEN_RANDR))
x = bar->hgap + bar->mon->pos.x - bar->brsize;
else
x = bar->hgap - bar->brsize;
bar->x = bar->hgap + bar->mon->pos.x - bar->brsize;
else
bar->x = bar->hgap - bar->brsize;
switch(bar->position){
case YA_TOP:{
if ((ya.gen_flag & GEN_RANDR))
y = bar->vgap + bar->mon->pos.y;
bar->y = bar->vgap + bar->mon->pos.y;
else
y = bar->vgap;
bar->y = bar->vgap;
break;
}
case YA_BOTTOM: {
if ((ya.gen_flag & GEN_RANDR))
y = bar->mon->pos.height - bar->vgap - bar->height - 2*bar->brsize;
bar->y = bar->mon->pos.height - bar->vgap - bar->height - 2*bar->brsize;
else
y = ya.scr->height_in_pixels - bar->vgap - bar->height - 2*bar->brsize;
bar->y = ya.scr->height_in_pixels - bar->vgap - bar->height - 2*bar->brsize;
break;
}
}
@ -163,7 +163,7 @@ void ya_create_bar(ya_bar_t * bar) {
ya.depth,
bar->win,
ya.scr->root,
x,y,
bar->x,bar->y,
bar->width, bar->height,
bar->brsize,
XCB_WINDOW_CLASS_INPUT_OUTPUT,

View file

@ -434,8 +434,11 @@ void ya_execute() {
}
#endif //YA_INTERNAL_EWMH
for(; curbar->prev_bar; curbar = curbar->prev_bar);
for(; curbar; curbar = curbar->next_bar)
for(; curbar; curbar = curbar->next_bar) {
xcb_map_window(ya.c, curbar->win);
const uint32_t coords[] = { curbar->x, curbar->y };
xcb_configure_window (ya.c, curbar->win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, coords);
}
xcb_flush(ya.c);
for(curbar = ya.curbar; curbar->prev_bar; curbar = curbar->prev_bar);
ya.curbar = curbar;