Making Mouse-clicks work
This commit is contained in:
parent
f4b7394655
commit
49eef0db3f
|
@ -20,8 +20,8 @@ void ev_check_cb(struct ev_loop *loop, ev_check *w, int revents) {
|
||||||
xcb_generic_event_t *event;
|
xcb_generic_event_t *event;
|
||||||
if ((event = xcb_poll_for_event(xcb_connection)) != NULL) {
|
if ((event = xcb_poll_for_event(xcb_connection)) != NULL) {
|
||||||
handle_xcb_event(event);
|
handle_xcb_event(event);
|
||||||
free(event);
|
|
||||||
}
|
}
|
||||||
|
free(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xcb_io_cb(struct ev_loop *loop, ev_io *w, int revents) {
|
void xcb_io_cb(struct ev_loop *loop, ev_io *w, int revents) {
|
||||||
|
|
|
@ -47,7 +47,23 @@ void handle_button(xcb_button_press_event_t *event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t x = event->event_x;
|
||||||
|
|
||||||
|
printf("Got Button %d\n", event->detail);
|
||||||
|
|
||||||
switch (event->detail) {
|
switch (event->detail) {
|
||||||
|
case 1:
|
||||||
|
TAILQ_FOREACH(cur_ws, walk->workspaces, tailq) {
|
||||||
|
printf("x = %d\n", x);
|
||||||
|
if (x < cur_ws->name_width + 10) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
x -= cur_ws->name_width + 10;
|
||||||
|
}
|
||||||
|
if (cur_ws == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (cur_ws == TAILQ_LAST(walk->workspaces, ws_head)) {
|
if (cur_ws == TAILQ_LAST(walk->workspaces, ws_head)) {
|
||||||
cur_ws = TAILQ_FIRST(walk->workspaces);
|
cur_ws = TAILQ_FIRST(walk->workspaces);
|
||||||
|
@ -241,7 +257,7 @@ void draw_buttons() {
|
||||||
&rect);
|
&rect);
|
||||||
i3_ws *ws_walk;
|
i3_ws *ws_walk;
|
||||||
TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
|
TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
|
||||||
printf("Drawing Button for WS %s...\n", ws_walk->name);
|
printf("Drawing Button for WS %s at x = %d\n", ws_walk->name, i);
|
||||||
uint32_t color = get_colorpixel("240000");
|
uint32_t color = get_colorpixel("240000");
|
||||||
if (ws_walk->visible) {
|
if (ws_walk->visible) {
|
||||||
color = get_colorpixel("480000");
|
color = get_colorpixel("480000");
|
||||||
|
|
Loading…
Reference in New Issue