2
* FreeRDP: A Remote Desktop Protocol Implementation
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.
24
#include <winpr/crt.h>
26
#include <winpr/stream.h>
30
#include <freerdp/rail/window_list.h>
32
void window_list_rewind(rdpWindowList* list)
34
list->iterator = list->head;
37
BOOL window_list_has_next(rdpWindowList* list)
39
if (list->iterator != NULL)
41
if (list->iterator != NULL)
48
rdpWindow* window_list_get_next(rdpWindowList* list)
50
rdpWindow* next = NULL;
52
if (list->iterator != NULL)
54
next = list->iterator;
55
list->iterator = list->iterator->next;
61
rdpWindow* window_list_get_by_extra_id(rdpWindowList* list, void* extraId)
70
while (window != NULL)
72
if (window->extraId == extraId)
75
window = window->next;
81
rdpWindow* window_list_get_by_id(rdpWindowList* list, UINT32 windowId)
90
while (window != NULL)
92
if (window->windowId == windowId)
95
window = window->next;
101
void window_list_create(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
105
/* See if the window already exists */
106
window = window_list_get_by_id(list, orderInfo->windowId);
108
/* If the window already exists, just update the existing window */
111
window_list_update(list, orderInfo, window_state);
115
window = (rdpWindow*) malloc(sizeof(rdpWindow));
120
ZeroMemory(window, sizeof(rdpWindow));
122
window->windowId = orderInfo->windowId;
124
if (list->head == NULL)
126
list->head = list->tail = window;
132
window->prev = list->tail;
133
list->tail->next = window;
138
window->windowId = orderInfo->windowId;
140
window_state_update(window, orderInfo, window_state);
142
rail_CreateWindow(list->rail, window);
145
void window_list_update(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
149
window = window_list_get_by_id(list, orderInfo->windowId);
154
window_state_update(window, orderInfo, window_state);
156
rail_UpdateWindow(list->rail, window);
159
void window_list_delete(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo)
165
window = window_list_get_by_id(list, orderInfo->windowId);
179
if (list->head == list->tail)
181
list->head = list->tail = NULL;
185
if (list->head == window)
188
if (list->tail == window)
192
rail_DestroyWindow(list->rail, window);
195
void window_list_clear(rdpWindowList* list)
197
rdpWindow* current = list->head;
199
while (current != NULL)
201
list->head = current->next;
202
rail_DestroyWindow(list->rail, current);
203
current = list->head;
209
rdpWindowList* window_list_new(rdpRail* rail)
213
list = (rdpWindowList*) malloc(sizeof(rdpWindowList));
217
ZeroMemory(list, sizeof(rdpWindowList));
227
void window_list_free(rdpWindowList* list)