pass the Client for frame_context cuz the client might be NULL

This commit is contained in:
Dana Jansens 2003-04-13 08:36:38 +00:00
parent 14a842b34c
commit bb8b9ddbc5
4 changed files with 12 additions and 9 deletions

View file

@ -369,7 +369,7 @@ static void event_handle_client(Client *client, XEvent *e)
switch (e->type) { switch (e->type) {
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
switch (frame_context(client->frame, e->xbutton.window)) { switch (frame_context(client, e->xbutton.window)) {
case Context_Maximize: case Context_Maximize:
client->frame->max_press = (e->type == ButtonPress); client->frame->max_press = (e->type == ButtonPress);
framerender_frame(client->frame); framerender_frame(client->frame);

View file

@ -646,12 +646,15 @@ Context frame_context_from_string(char *name)
return Context_None; return Context_None;
} }
Context frame_context(Frame *self, Window win) Context frame_context(Client *client, Window win)
{ {
if (win == ob_root) return Context_Root; Frame *self;
if (self == NULL) return Context_None;
if (win == self->client->window) return Context_Client;
if (win == ob_root) return Context_Root;
if (client == NULL) return Context_None;
if (win == client->window) return Context_Client;
self = client->frame;
if (win == self->window) return Context_Frame; if (win == self->window) return Context_Frame;
if (win == self->plate) return Context_Client; if (win == self->plate) return Context_Client;
if (win == self->title) return Context_Titlebar; if (win == self->title) return Context_Titlebar;

View file

@ -98,7 +98,7 @@ void frame_release_client(Frame *self, Client *client);
Context frame_context_from_string(char *name); Context frame_context_from_string(char *name);
Context frame_context(Frame *self, Window win); Context frame_context(Client *self, Window win);
/*! Applies gravity to the client's position to find where the frame should /*! Applies gravity to the client's position to find where the frame should
be positioned. be positioned.

View file

@ -240,7 +240,7 @@ static void event(ObEvent *e, void *foo)
button = e->data.x.e->xbutton.button; button = e->data.x.e->xbutton.button;
state = e->data.x.e->xbutton.state; state = e->data.x.e->xbutton.state;
} }
context = frame_context(e->data.x.client->frame, context = frame_context(e->data.x.client,
e->data.x.e->xbutton.window); e->data.x.e->xbutton.window);
fire_button(MouseAction_Press, context, fire_button(MouseAction_Press, context,
@ -255,7 +255,7 @@ static void event(ObEvent *e, void *foo)
break; break;
case Event_X_ButtonRelease: case Event_X_ButtonRelease:
context = frame_context(e->data.x.client->frame, context = frame_context(e->data.x.client,
e->data.x.e->xbutton.window); 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 */
@ -314,7 +314,7 @@ static void event(ObEvent *e, void *foo)
(ABS(dx) >= threshold || ABS(dy) >= threshold)) (ABS(dx) >= threshold || ABS(dy) >= threshold))
drag = TRUE; drag = TRUE;
if (drag) { if (drag) {
context = frame_context(e->data.x.client->frame, context = frame_context(e->data.x.client,
e->data.x.e->xbutton.window); e->data.x.e->xbutton.window);
drag_used = fire_motion(MouseAction_Motion, context, drag_used = fire_motion(MouseAction_Motion, context,
e->data.x.client, e->data.x.client,