Fix focus stealing for changing desktops/Use timestamp for user input events
[dana/openbox.git] / openbox / event.c
index ba39ef9..ba156da 100644 (file)
@@ -700,6 +700,8 @@ static void event_process(const XEvent *ec, gpointer data)
         static guint pressed = 0;
         static Window pressed_win = None;
 
+        event_sourcetime = event_curtime;
+
         /* If the button press was on some non-root window, or was physically
            on the root window... */
         if (window != obt_root(ob_screen) ||
@@ -726,6 +728,8 @@ static void event_process(const XEvent *ec, gpointer data)
     else if (e->type == KeyPress || e->type == KeyRelease ||
              e->type == MotionNotify)
     {
+        event_sourcetime = event_curtime;
+
         used = event_handle_user_input(client, e);
 
         if (prompt && !used)
@@ -1945,8 +1949,15 @@ static gboolean event_handle_menu_input(XEvent *ev)
                 if (found) {
                     menu_frame_select(frame, found, TRUE);
 
-                    if (num_found == 1)
-                        frame->press_doexec = TRUE;
+                    if (num_found == 1) {
+                        if (found->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) {
+                            /* move focus to the child menu */
+                            menu_frame_select_next(frame->child);
+                        }
+                        else {
+                            frame->press_doexec = TRUE;
+                        }
+                    }
                     ret = TRUE;
                 }
             }