2 * FreeRDP: A Remote Desktop Protocol Client
5 * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <freerdp/utils/stream.h>
21 #include <freerdp/utils/memory.h>
25 #include <freerdp/rail/window_list.h>
27 void window_list_rewind(rdpWindowList* list)
29 list->iterator = list->head;
32 boolean window_list_has_next(rdpWindowList* list)
34 if (list->iterator != NULL)
36 if (list->iterator != NULL)
43 rdpWindow* window_list_get_next(rdpWindowList* list)
45 rdpWindow* next = NULL;
47 if (list->iterator != NULL)
49 next = list->iterator;
50 list->iterator = list->iterator->next;
56 rdpWindow* window_list_get_by_extra_id(rdpWindowList* list, void* extraId)
65 while (window != NULL)
67 if (window->extraId == extraId)
70 window = window->next;
76 rdpWindow* window_list_get_by_id(rdpWindowList* list, uint32 windowId)
85 while (window != NULL)
87 if (window->windowId == windowId)
90 window = window->next;
96 void window_list_create(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
100 window = (rdpWindow*) xzalloc(sizeof(rdpWindow));
105 window->windowId = orderInfo->windowId;
107 if (list->head == NULL)
109 list->head = list->tail = window;
115 window->prev = list->tail;
116 list->tail->next = window;
121 window->windowId = orderInfo->windowId;
123 window_state_update(window, orderInfo, window_state);
125 rail_CreateWindow(list->rail, window);
128 void window_list_update(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
132 window = window_list_get_by_id(list, orderInfo->windowId);
137 window_state_update(window, orderInfo, window_state);
139 rail_UpdateWindow(list->rail, window);
142 void window_list_delete(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo)
148 window = window_list_get_by_id(list, orderInfo->windowId);
162 if (list->head == list->tail)
164 list->head = list->tail = NULL;
168 if (list->head == window)
171 if (list->tail == window)
175 rail_DestroyWindow(list->rail, window);
178 rdpWindowList* window_list_new(rdpRail* rail)
182 list = (rdpWindowList*) xzalloc(sizeof(rdpWindowList));
194 void window_list_free(rdpWindowList* list)