X11 root window coordinates where the click occurred
button::
X11 button ID (for example 1 to 3 for left/middle/right mouse button)
+relative_x, relative_y::
+ Coordinates where the click occurred, with respect to the top left corner
+ of the block
+width, height::
+ Width and height (in px) of the block
*Example*:
------------------------------------------
"instance": "eth0",
"button": 1,
"x": 1320,
- "y": 1400
+ "y": 1400,
+ "relative_x": 12,
+ "relative_y": 8,
+ "width": 50,
+ "height": 22
}
------------------------------------------
* Generates a click event, if enabled.
*
*/
-void send_block_clicked(int button, const char *name, const char *instance, int x, int y);
+void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int width, int height);
* Generates a click event, if enabled.
*
*/
-void send_block_clicked(int button, const char *name, const char *instance, int x, int y) {
+void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int width, int height) {
if (!child.click_events) {
return;
}
child_click_events_key("y");
yajl_gen_integer(gen, y);
+ child_click_events_key("relative_x");
+ yajl_gen_integer(gen, x_rel);
+
+ child_click_events_key("relative_y");
+ yajl_gen_integer(gen, y_rel);
+
+ child_click_events_key("width");
+ yajl_gen_integer(gen, width);
+
+ child_click_events_key("height");
+ yajl_gen_integer(gen, height);
+
yajl_gen_map_close(gen);
child_write_output();
}
block_x += render->width + render->x_offset + render->x_append + get_sep_offset(block) + sep_offset_remainder;
if (statusline_x <= block_x && statusline_x >= last_block_x) {
- send_block_clicked(event->detail, block->name, block->instance, event->root_x, event->root_y);
+ send_block_clicked(event->detail, block->name, block->instance,
+ event->root_x, event->root_y, statusline_x - last_block_x, event->event_y, block_x - last_block_x, bar_height);
return;
}