take borders into account for figuring clicks
This commit is contained in:
parent
51c0c73982
commit
bb087efb79
1 changed files with 22 additions and 16 deletions
|
@ -213,6 +213,10 @@ static void event(ObEvent *e, void *foo)
|
||||||
}
|
}
|
||||||
context = engine_get_context(e->data.x.client,
|
context = engine_get_context(e->data.x.client,
|
||||||
e->data.x.e->xbutton.window);
|
e->data.x.e->xbutton.window);
|
||||||
|
g_message("press %d frame %d client %d",
|
||||||
|
context,
|
||||||
|
g_quark_try_string("frame"),
|
||||||
|
g_quark_try_string("client"));
|
||||||
|
|
||||||
fire_button(MouseAction_Press, context,
|
fire_button(MouseAction_Press, context,
|
||||||
e->data.x.client, e->data.x.e->xbutton.state,
|
e->data.x.client, e->data.x.e->xbutton.state,
|
||||||
|
@ -228,6 +232,10 @@ static void event(ObEvent *e, void *foo)
|
||||||
case Event_X_ButtonRelease:
|
case Event_X_ButtonRelease:
|
||||||
context = engine_get_context(e->data.x.client,
|
context = engine_get_context(e->data.x.client,
|
||||||
e->data.x.e->xbutton.window);
|
e->data.x.e->xbutton.window);
|
||||||
|
g_message("release %d frame %d client %d",
|
||||||
|
context,
|
||||||
|
g_quark_try_string("frame"),
|
||||||
|
g_quark_try_string("client"));
|
||||||
if (e->data.x.e->xbutton.button == button) {
|
if (e->data.x.e->xbutton.button == button) {
|
||||||
/* end drags */
|
/* end drags */
|
||||||
if (drag) {
|
if (drag) {
|
||||||
|
@ -240,22 +248,20 @@ static void event(ObEvent *e, void *foo)
|
||||||
lbutton = 0;
|
lbutton = 0;
|
||||||
} else {
|
} else {
|
||||||
/* clicks are only valid if its released over the window */
|
/* clicks are only valid if its released over the window */
|
||||||
if (e->data.x.e->xbutton.x >= 0 &&
|
int junk;
|
||||||
e->data.x.e->xbutton.y >= 0) {
|
Window wjunk;
|
||||||
int junk;
|
guint ujunk, b, w, h;
|
||||||
Window wjunk;
|
XGetGeometry(ob_display, e->data.x.e->xbutton.window,
|
||||||
guint ujunk, w, h;
|
&wjunk, &junk, &junk, &w, &h, &b, &ujunk);
|
||||||
XGetGeometry(ob_display, e->data.x.e->xbutton.window,
|
if (e->data.x.e->xbutton.x >= (signed)-b &&
|
||||||
&wjunk, &junk, &junk, &w, &h, &ujunk, &ujunk);
|
e->data.x.e->xbutton.y >= (signed)-b &&
|
||||||
if (e->data.x.e->xbutton.x < (signed)w &&
|
e->data.x.e->xbutton.x < (signed)(w+b) &&
|
||||||
e->data.x.e->xbutton.y < (signed)h) {
|
e->data.x.e->xbutton.y < (signed)(h+b)) {
|
||||||
click =TRUE;
|
click =TRUE;
|
||||||
/* double clicks happen if there were 2 in a row! */
|
/* double clicks happen if there were 2 in a row! */
|
||||||
if (lbutton == button &&
|
if (lbutton == button &&
|
||||||
e->data.x.e->xbutton.time - 300 <= ltime)
|
e->data.x.e->xbutton.time - 300 <= ltime)
|
||||||
dclick = TRUE;
|
dclick = TRUE;
|
||||||
}
|
|
||||||
lbutton = button;
|
|
||||||
} else
|
} else
|
||||||
lbutton = 0;
|
lbutton = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue