mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-22 04:15:39 +02:00
bar: move x,y coordinates to xcb backend
This commit is contained in:
parent
3d8cb7f17e
commit
0ab772f869
3 changed files with 12 additions and 16 deletions
|
@ -40,7 +40,6 @@ struct private {
|
|||
} right;
|
||||
|
||||
/* Calculated run-time */
|
||||
int x, y;
|
||||
int width;
|
||||
int height_with_border;
|
||||
|
||||
|
|
|
@ -657,11 +657,6 @@ setup(struct bar *_bar)
|
|||
}
|
||||
|
||||
bar->width = backend->width;
|
||||
bar->x = backend->monitor->x;
|
||||
bar->y = backend->monitor->y;
|
||||
bar->y += bar->location == BAR_TOP
|
||||
? 0
|
||||
: backend->monitor->height_px - bar->height_with_border;
|
||||
|
||||
if (pipe(backend->pipe_fds) == -1) {
|
||||
LOG_ERRNO("failed to create pipe");
|
||||
|
|
22
bar/xcb.c
22
bar/xcb.c
|
@ -21,6 +21,8 @@
|
|||
#include "../xcb.h"
|
||||
|
||||
struct xcb_backend {
|
||||
int x, y;
|
||||
|
||||
xcb_connection_t *conn;
|
||||
|
||||
xcb_window_t win;
|
||||
|
@ -92,10 +94,10 @@ setup(struct bar *_bar)
|
|||
|
||||
free(name);
|
||||
|
||||
bar->x = mon->x;
|
||||
bar->y = mon->y;
|
||||
backend->x = mon->x;
|
||||
backend->y = mon->y;
|
||||
bar->width = mon->width;
|
||||
bar->y += bar->location == BAR_TOP ? 0
|
||||
backend->y += bar->location == BAR_TOP ? 0
|
||||
: screen->height_in_pixels - bar->height_with_border;
|
||||
found_monitor = true;
|
||||
break;
|
||||
|
@ -131,7 +133,7 @@ setup(struct bar *_bar)
|
|||
xcb_create_window(
|
||||
backend->conn,
|
||||
depth, backend->win, screen->root,
|
||||
bar->x, bar->y, bar->width, bar->height_with_border,
|
||||
backend->x, backend->y, bar->width, bar->height_with_border,
|
||||
0,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, vis->visual_id,
|
||||
(XCB_CW_BACK_PIXEL |
|
||||
|
@ -184,16 +186,16 @@ setup(struct bar *_bar)
|
|||
uint32_t top_pair[2], bottom_pair[2];
|
||||
|
||||
if (bar->location == BAR_TOP) {
|
||||
top_strut = bar->y + bar->height_with_border;
|
||||
top_pair[0] = bar->x;
|
||||
top_pair[1] = bar->x + bar->width - 1;
|
||||
top_strut = backend->y + bar->height_with_border;
|
||||
top_pair[0] = backend->x;
|
||||
top_pair[1] = backend->x + bar->width - 1;
|
||||
|
||||
bottom_strut = 0;
|
||||
bottom_pair[0] = bottom_pair[1] = 0;
|
||||
} else {
|
||||
bottom_strut = screen->height_in_pixels - bar->y;
|
||||
bottom_pair[0] = bar->x;
|
||||
bottom_pair[1] = bar->x + bar->width - 1;
|
||||
bottom_strut = screen->height_in_pixels - backend->y;
|
||||
bottom_pair[0] = backend->x;
|
||||
bottom_pair[1] = backend->x + bar->width - 1;
|
||||
|
||||
top_strut = 0;
|
||||
top_pair[0] = top_pair[1] = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue