summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorben <benjaminfranzke@googlemail.com>2010-07-13 15:18:20 +0200
committerben <benjaminfranzke@googlemail.com>2010-07-13 15:18:20 +0200
commit54c748fc6c1ceb0e3602482ab29f1e4e523d0b77 (patch)
tree02c7ba3eb9c906cb283b5a51d0f6a161940870fc /src
parent853e749c94eac7263a1568a73216d9d74eb5d36c (diff)
downloadpa-sink-ctl-54c748fc6c1ceb0e3602482ab29f1e4e523d0b77.tar.gz
pa-sink-ctl-54c748fc6c1ceb0e3602482ab29f1e4e523d0b77.tar.bz2
pa-sink-ctl-54c748fc6c1ceb0e3602482ab29f1e4e523d0b77.zip
inputs made movable
Diffstat (limited to 'src')
-rw-r--r--src/interface.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/interface.c b/src/interface.c
index d5e8923..5492fbf 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -20,6 +20,8 @@ int chooser_input;
int startx;
int starty;
+int selected_index;
+
extern int sink_counter;
extern int sink_max;
extern sink_info** sink_list;
@@ -54,6 +56,19 @@ void print_sink_list(void) {
werase(menu_win);
box(menu_win, 0, 0);
+
+ /* derive chooser_input from selected_index (this is set when input is moved) */
+ if (chooser_input == -2) {
+ chooser_input = -1; /* if index is going to be not found, select the sink itself */
+ /* step through inputs for current sink and find the selected */
+ for (int i = 0; i < sink_list[chooser_sink]->input_counter; ++i) {
+ if (selected_index == sink_list[chooser_sink]->input_list[i]->index) {
+ chooser_input = i;
+ break;
+ }
+ }
+ }
+
// printf("print sinks: %d\n", sink_input_counter);
// qsort(sink_input_list, sink_input_counter, sizeof(sink_input_info*), cmp_sink_input_list);
@@ -161,20 +176,23 @@ void get_input(void)
break;
case 32:
-
-/* if (chooser_sink < sink_counter - 1)
- sink = chooser_sink + 1;
+ if (chooser_input == -1)
+ break;
+ selected_index = sink_list[chooser_sink]->input_list[chooser_input]->index;
+ if (chooser_sink < sink_counter - 1)
+ chooser_sink++;//sink = chooser_sink + 1;
else
- sink = 0;
+ chooser_sink = 0;
+ chooser_input = -2; /* chooser_input needs to be derived from $selected_index */
pa_operation_unref(
pa_context_move_sink_input_by_index(
- context,
- sink_input_list[chooser]->index,
- sink,
+ context,
+ selected_index,
+ sink_list[chooser_sink]->index,
change_callback,
NULL));
- return;*/
+ return;
break;
default: