#include "frame.h"
#include "grab.h"
#include "menu.h"
+#include "prompt.h"
#include "menuframe.h"
#include "keyboard.h"
#include "mouse.h"
static void event_handle_root(XEvent *e);
static gboolean event_handle_menu_input(XEvent *e);
static void event_handle_menu(ObMenuFrame *frame, XEvent *e);
+static gboolean event_handle_prompt(ObPrompt *p, XEvent *e);
static void event_handle_dock(ObDock *s, XEvent *e);
static void event_handle_dockapp(ObDockApp *app, XEvent *e);
static void event_handle_client(ObClient *c, XEvent *e);
ObDockApp *dockapp = NULL;
ObWindow *obwin = NULL;
ObMenuFrame *menu = NULL;
+ ObPrompt *prompt = NULL;
/* make a copy we can mangle */
ee = *ec;
break;
case OB_WINDOW_CLASS_CLIENT:
client = WINDOW_AS_CLIENT(obwin);
+ /* events on clients can be events on prompt windows too */
+ prompt = client->prompt;
break;
case OB_WINDOW_CLASS_MENUFRAME:
menu = WINDOW_AS_MENUFRAME(obwin);
case OB_WINDOW_CLASS_INTERNAL:
/* we don't do anything with events directly on these windows */
break;
+ case OB_WINDOW_CLASS_PROMPT:
+ prompt = WINDOW_AS_PROMPT(obwin);
+ break;
}
}
else
}
#endif
- if (e->type == ButtonPress || e->type == ButtonRelease) {
+ if (prompt && event_handle_prompt(prompt, e))
+ ;
+ else if (e->type == ButtonPress || e->type == ButtonRelease) {
/* If the button press was on some non-root window, or was physically
on the root window, then process it */
if (window != obt_root(ob_screen) ||
ob_debug_type(OB_DEBUG_APP_BUGS,
"_NET_ACTIVE_WINDOW message for window %s is "
"missing source indication");
- client_activate(client, FALSE, TRUE, TRUE,
+ client_activate(client, TRUE, TRUE, TRUE,
(e->xclient.data.l[0] == 0 ||
e->xclient.data.l[0] == 2));
} else if (msgtype == OBT_PROP_ATOM(NET_WM_MOVERESIZE)) {
return ret;
}
+static gboolean event_handle_prompt(ObPrompt *p, XEvent *e)
+{
+ switch (e->type) {
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ return prompt_mouse_event(p, e);
+ break;
+ case KeyPress:
+ return prompt_key_event(p, e);
+ break;
+ }
+ return FALSE;
+}
+
static gboolean event_handle_menu_input(XEvent *ev)
{
gboolean ret = FALSE;
- if (ev->type == ButtonRelease) {
+ if (ev->type == ButtonRelease || ev->type == ButtonPress) {
ObMenuEntryFrame *e;
if (menu_hide_delay_reached() &&
if ((e = menu_entry_frame_under(ev->xbutton.x_root,
ev->xbutton.y_root)))
{
+ if (ev->type == ButtonPress && e->frame->child)
+ menu_frame_select(e->frame->child, NULL, TRUE);
menu_frame_select(e->frame, e, TRUE);
- menu_entry_frame_execute(e, ev->xbutton.state);
+ if (ev->type == ButtonRelease)
+ menu_entry_frame_execute(e, ev->xbutton.state);
}
- else
+ else if (ev->type == ButtonRelease)
menu_frame_hide_all();
}
ret = TRUE;