Executor: send click coordinates via environment variables
This commit is contained in:
parent
8af45bf3e6
commit
5966b198b6
3 changed files with 14 additions and 4 deletions
|
@ -428,7 +428,7 @@ void draw_execp(void *obj, cairo_t *c)
|
||||||
g_object_unref(layout);
|
g_object_unref(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void execp_action(void *obj, int button)
|
void execp_action(void *obj, int button, int x, int y)
|
||||||
{
|
{
|
||||||
Execp *execp = obj;
|
Execp *execp = obj;
|
||||||
char *command = NULL;
|
char *command = NULL;
|
||||||
|
@ -450,7 +450,17 @@ void execp_action(void *obj, int button)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (command) {
|
if (command) {
|
||||||
tint_exec(command);
|
char *full_cmd = g_strdup_printf("export EXECP_X=%d;"
|
||||||
|
"export EXECP_Y=%d;"
|
||||||
|
"export EXECP_W=%d;"
|
||||||
|
"export EXECP_H=%d; %s",
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
execp->area.width,
|
||||||
|
execp->area.height,
|
||||||
|
command);
|
||||||
|
tint_exec(full_cmd);
|
||||||
|
g_free(full_cmd);
|
||||||
} else {
|
} else {
|
||||||
if (execp->backend->child_pipe > 0) {
|
if (execp->backend->child_pipe > 0) {
|
||||||
// Command currently running, nothing to do
|
// Command currently running, nothing to do
|
||||||
|
|
|
@ -130,7 +130,7 @@ void draw_execp(void *obj, cairo_t *c);
|
||||||
gboolean resize_execp(void *obj);
|
gboolean resize_execp(void *obj);
|
||||||
|
|
||||||
// Called on mouse click event.
|
// Called on mouse click event.
|
||||||
void execp_action(void *obj, int button);
|
void execp_action(void *obj, int button, int x, int y);
|
||||||
|
|
||||||
// Called to check if new output from the command can be read.
|
// Called to check if new output from the command can be read.
|
||||||
// No command might be running.
|
// No command might be running.
|
||||||
|
|
|
@ -808,7 +808,7 @@ void event_button_release(XEvent *e)
|
||||||
|
|
||||||
Execp *execp = click_execp(panel, e->xbutton.x, e->xbutton.y);
|
Execp *execp = click_execp(panel, e->xbutton.x, e->xbutton.y);
|
||||||
if (execp) {
|
if (execp) {
|
||||||
execp_action(execp, e->xbutton.button);
|
execp_action(execp, e->xbutton.button, e->xbutton.x - execp->area.posx, e->xbutton.y - execp->area.posy);
|
||||||
if (panel_layer == BOTTOM_LAYER)
|
if (panel_layer == BOTTOM_LAYER)
|
||||||
XLowerWindow(server.display, panel->main_win);
|
XLowerWindow(server.display, panel->main_win);
|
||||||
task_drag = 0;
|
task_drag = 0;
|
||||||
|
|
Loading…
Reference in a new issue