Commits

Tim van der Molen  committed 12912fc

Bring menu_move_entry_down() and menu_move_entry_up() into line with the new
menu_move_entry_before().

  • Participants
  • Parent commits 3dd2cd5

Comments (0)

Files changed (3)

 }
 
 void
-menu_move_entry_down(struct menu_entry *e)
+menu_move_entry_down(struct menu *m, struct menu_entry *e)
 {
-	struct menu_entry	*f;
-	void			*data;
+	struct menu_entry *f;
 
-	if ((f = TAILQ_NEXT(e, entries)) != NULL) {
-		data = e->data;
-		e->data = f->data;
-		f->data = data;
-	}
+	if ((f = TAILQ_NEXT(e, entries)) != NULL)
+		menu_move_entry_before(m, e, f);
 }
 
 void
-menu_move_entry_up(struct menu_entry *e)
+menu_move_entry_up(struct menu *m, struct menu_entry *e)
 {
-	struct menu_entry	*f;
-	void			*data;
+	struct menu_entry *f;
 
-	if ((f = TAILQ_PREV(e, menu_list, entries)) != NULL) {
-		data = e->data;
-		e->data = f->data;
-		f->data = data;
-	}
+	if ((f = TAILQ_PREV(e, menu_list, entries)) != NULL)
+		menu_move_entry_before(m, f, e);
 }
 
 void
 	struct menu_entry *e;
 
 	XPTHREAD_MUTEX_LOCK(&queue_menu_mtx);
-	if ((e = menu_get_selected_entry(queue_menu)) != NULL) {
-		menu_move_entry_down(e);
-		menu_select_next_entry(queue_menu);
-	}
+	if ((e = menu_get_selected_entry(queue_menu)) != NULL)
+		menu_move_entry_down(queue_menu, e);
 	XPTHREAD_MUTEX_UNLOCK(&queue_menu_mtx);
 	queue_print();
 }
 	struct menu_entry *e;
 
 	XPTHREAD_MUTEX_LOCK(&queue_menu_mtx);
-	if ((e = menu_get_selected_entry(queue_menu)) != NULL) {
-		menu_move_entry_up(e);
-		menu_select_prev_entry(queue_menu);
-	}
+	if ((e = menu_get_selected_entry(queue_menu)) != NULL)
+		menu_move_entry_up(queue_menu, e);
 	XPTHREAD_MUTEX_UNLOCK(&queue_menu_mtx);
 	queue_print();
 }
 void		 menu_insert_tail(struct menu *, void *) NONNULL();
 void		 menu_move_entry_before(struct menu *m, struct menu_entry *,
 		    struct menu_entry *) NONNULL();
-void		 menu_move_entry_down(struct menu_entry *) NONNULL();
-void		 menu_move_entry_up(struct menu_entry *) NONNULL();
+void		 menu_move_entry_down(struct menu *, struct menu_entry *)
+		    NONNULL();
+void		 menu_move_entry_up(struct menu *m, struct menu_entry *)
+		    NONNULL();
 void		 menu_print(struct menu *) NONNULL();
 void		 menu_remove_all_entries(struct menu *) NONNULL();
 void		 menu_remove_entry(struct menu *, struct menu_entry *)