ui/motif/list.c

changeset 909
28c2a28026ab
parent 808
2b0ecad00872
child 910
311bebe6aa82
equal deleted inserted replaced
908:54150a21abb4 909:28c2a28026ab
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <Xm/Xm.h>
31 32
32 #include "container.h" 33 #include "container.h"
33 34
34 #include "list.h" 35 #include "list.h"
35 #include "../common/object.h" 36 #include "../common/object.h"
142 143
143 static void listview_save_selection(UiListView *listview, XmListCallbackStruct *cb) { 144 static void listview_save_selection(UiListView *listview, XmListCallbackStruct *cb) {
144 UiListSelection sel = { cb->selected_item_count, NULL }; 145 UiListSelection sel = { cb->selected_item_count, NULL };
145 if(sel.count > 0) { 146 if(sel.count > 0) {
146 sel.rows = calloc(sel.count, sizeof(int)); 147 sel.rows = calloc(sel.count, sizeof(int));
147 for(int i=0;i<sel.count;i++) { 148 if(sel.count == 1) {
148 sel.rows[i] = cb->selected_item_positions[i]-1; 149 sel.rows[0] = cb->item_position-1;
150 } else if(cb->selected_item_positions) {
151 for(int i=0;i<sel.count;i++) {
152 sel.rows[i] = cb->selected_item_positions[i]-1;
153 }
149 } 154 }
150 } 155 }
151 free(listview->current_selection.rows); 156 free(listview->current_selection.rows);
152 listview->current_selection = sel; 157 listview->current_selection = sel;
153 } 158 }

mercurial