diff options
| author | Dana Jansens <danakj@orodu.net> | 2010-01-08 10:45:24 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2010-01-08 10:45:24 -0500 |
| commit | 3368b91d544ab8c6510d88e5ad58d070fad62baa (patch) | |
| tree | 3eaf5bc850e025bffb5d29a6e7e31693e89ec265 /openbox/prompt.c | |
| parent | 73575c10ce3ede1637e4f959b56e1f7d5f110b91 (diff) | |
Don't handle input events on prompts if they should be used for a binding/menu instead.
Also, be more careful about making the prompt buttons look pressed, don't make them pressed from a motion notify event if they didnt first handle the press.
Diffstat (limited to 'openbox/prompt.c')
| -rw-r--r-- | openbox/prompt.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/openbox/prompt.c b/openbox/prompt.c index 829c57f4..4f8930d7 100644 --- a/openbox/prompt.c +++ b/openbox/prompt.c @@ -411,10 +411,10 @@ static void render_button(ObPrompt *self, ObPromptElement *e) { RrAppearance *a; - if (e->pressed && self->focus == e) a = prompt_a_pfocus; - else if (self->focus == e) a = prompt_a_focus; - else if (e->pressed) a = prompt_a_press; - else a = prompt_a_button; + if (e->hover && self->focus == e) a = prompt_a_pfocus; + else if (self->focus == e) a = prompt_a_focus; + else if (e->pressed) a = prompt_a_press; + else a = prompt_a_button; a->surface.parent = prompt_a_bg; a->surface.parentx = e->x; @@ -587,25 +587,28 @@ gboolean prompt_mouse_event(ObPrompt *self, XEvent *e) oldfocus = self->focus; - but->pressed = TRUE; + but->pressed = but->hover = TRUE; self->focus = but; if (oldfocus != but) render_button(self, oldfocus); render_button(self, but); } else if (e->type == ButtonRelease) { - if (but->pressed) + if (but->hover) prompt_run_callback(self, but->result); + but->pressed = FALSE; } else if (e->type == MotionNotify) { - gboolean press; + if (but->pressed) { + gboolean hover; - press = (e->xmotion.x >= 0 && e->xmotion.y >= 0 && - e->xmotion.x < but->width && e->xmotion.y < but->height); + hover = (e->xmotion.x >= 0 && e->xmotion.y >= 0 && + e->xmotion.x < but->width && e->xmotion.y < but->height); - if (press != but->pressed) { - but->pressed = press; - render_button(self, but); + if (hover != but->hover) { + but->hover = hover; + render_button(self, but); + } } } return TRUE; |
