fewer context lookups

This commit is contained in:
Dana Jansens 2003-03-19 18:34:15 +00:00
parent 90e654131d
commit 32a17b31b0

View file

@ -185,6 +185,7 @@ static void event(ObEvent *e, void *foo)
static Corner corner = Corner_TopLeft; static Corner corner = Corner_TopLeft;
gboolean click = FALSE; gboolean click = FALSE;
gboolean dclick = FALSE; gboolean dclick = FALSE;
GQuark context;
switch (e->type) { switch (e->type) {
case Event_Client_Mapped: case Event_Client_Mapped:
@ -208,16 +209,14 @@ static void event(ObEvent *e, void *foo)
} }
button = e->data.x.e->xbutton.button; button = e->data.x.e->xbutton.button;
} }
fire_button(MouseAction_Press, context = engine_get_context(e->data.x.client,
engine_get_context(e->data.x.client, e->data.x.e->xbutton.window);
e->data.x.e->xbutton.window),
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,
e->data.x.e->xbutton.button); e->data.x.e->xbutton.button);
/* XXX dont look up the context so many times */ if (context == g_quark_try_string("client")) {
if (engine_get_context(e->data.x.client,
e->data.x.e->xbutton.window) ==
g_quark_try_string("client")) {
/* Replay the event, so it goes to the client*/ /* Replay the event, so it goes to the client*/
XAllowEvents(ob_display, ReplayPointer, CurrentTime); XAllowEvents(ob_display, ReplayPointer, CurrentTime);
/* Fall through to the release case! */ /* Fall through to the release case! */
@ -225,12 +224,12 @@ static void event(ObEvent *e, void *foo)
break; break;
case Event_X_ButtonRelease: case Event_X_ButtonRelease:
context = engine_get_context(e->data.x.client,
e->data.x.e->xbutton.window);
if (e->data.x.e->xbutton.button == button) { if (e->data.x.e->xbutton.button == button) {
/* end drags */ /* end drags */
if (drag) { if (drag) {
fire_motion(MouseAction_Motion, fire_motion(MouseAction_Motion, context,
engine_get_context(e->data.x.client,
e->data.x.e->xbutton.window),
e->data.x.client, e->data.x.e->xbutton.state, e->data.x.client, e->data.x.e->xbutton.state,
e->data.x.e->xbutton.button, e->data.x.e->xbutton.button,
cx, cy, cw, ch, dx, dy, TRUE, corner); cx, cy, cw, ch, dx, dy, TRUE, corner);
@ -262,21 +261,15 @@ static void event(ObEvent *e, void *foo)
button = 0; button = 0;
ltime = e->data.x.e->xbutton.time; ltime = e->data.x.e->xbutton.time;
} }
fire_button(MouseAction_Press, fire_button(MouseAction_Press, context,
engine_get_context(e->data.x.client,
e->data.x.e->xbutton.window),
e->data.x.client, e->data.x.e->xbutton.state, e->data.x.client, e->data.x.e->xbutton.state,
e->data.x.e->xbutton.button); e->data.x.e->xbutton.button);
if (click) if (click)
fire_button(MouseAction_Click, fire_button(MouseAction_Click, context,
engine_get_context(e->data.x.client,
e->data.x.e->xbutton.window),
e->data.x.client, e->data.x.e->xbutton.state, e->data.x.client, e->data.x.e->xbutton.state,
e->data.x.e->xbutton.button); e->data.x.e->xbutton.button);
if (dclick) if (dclick)
fire_button(MouseAction_DClick, fire_button(MouseAction_DClick, context,
engine_get_context(e->data.x.client,
e->data.x.e->xbutton.window),
e->data.x.client, e->data.x.e->xbutton.state, e->data.x.client, e->data.x.e->xbutton.state,
e->data.x.e->xbutton.button); e->data.x.e->xbutton.button);
break; break;
@ -286,9 +279,9 @@ static void event(ObEvent *e, void *foo)
drag = TRUE; drag = TRUE;
dx = e->data.x.e->xmotion.x_root - px; dx = e->data.x.e->xmotion.x_root - px;
dy = e->data.x.e->xmotion.y_root - py; dy = e->data.x.e->xmotion.y_root - py;
fire_motion(MouseAction_Motion, context = engine_get_context(e->data.x.client,
engine_get_context(e->data.x.client, e->data.x.e->xbutton.window);
e->data.x.e->xbutton.window), fire_motion(MouseAction_Motion, context,
e->data.x.client, e->data.x.e->xmotion.state, e->data.x.client, e->data.x.e->xmotion.state,
button, cx, cy, cw, ch, dx, dy, FALSE, corner); button, cx, cy, cw, ch, dx, dy, FALSE, corner);
} }