FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
shadow_lobby.c
1
19#include <freerdp/config.h>
20
21#include <winpr/assert.h>
22#include <winpr/cast.h>
23
24#include <rdtk/rdtk.h>
25
26#include "shadow.h"
27
28#include "shadow_lobby.h"
29
30BOOL shadow_client_init_lobby(rdpShadowServer* server)
31{
32 BOOL rc = FALSE;
33 int width = 0;
34 int height = 0;
35 rdtkSurface* surface = NULL;
36 RECTANGLE_16 invalidRect;
37 rdpShadowSurface* lobby = server->lobby;
38
39 if (!lobby)
40 return FALSE;
41
42 rdtkEngine* engine = rdtk_engine_new();
43 if (!engine)
44 return FALSE;
45
46 EnterCriticalSection(&lobby->lock);
47 surface =
48 rdtk_surface_new(engine, lobby->data, WINPR_ASSERTING_INT_CAST(uint16_t, lobby->width),
49 WINPR_ASSERTING_INT_CAST(uint16_t, lobby->height), lobby->scanline);
50 if (!surface)
51 goto fail;
52
53 invalidRect.left = 0;
54 invalidRect.top = 0;
55 WINPR_ASSERT(lobby->width <= UINT16_MAX);
56 WINPR_ASSERT(lobby->height <= UINT16_MAX);
57 invalidRect.right = (UINT16)lobby->width;
58 invalidRect.bottom = (UINT16)lobby->height;
59 if (server->shareSubRect)
60 {
61 /* If we have shared sub rect setting, only fill shared rect */
62 rectangles_intersection(&invalidRect, &(server->subRect), &invalidRect);
63 }
64
65 width = invalidRect.right - invalidRect.left;
66 height = invalidRect.bottom - invalidRect.top;
67 WINPR_ASSERT(width <= UINT16_MAX);
68 WINPR_ASSERT(width >= 0);
69 WINPR_ASSERT(height <= UINT16_MAX);
70 WINPR_ASSERT(height >= 0);
71 rdtk_surface_fill(surface, invalidRect.left, invalidRect.top, (UINT16)width, (UINT16)height,
72 0x3BB9FF);
73
74 rdtk_label_draw(surface, invalidRect.left, invalidRect.top, (UINT16)width, (UINT16)height, NULL,
75 "Welcome", 0, 0);
76 // rdtk_button_draw(surface, 16, 64, 128, 32, NULL, "button");
77 // rdtk_text_field_draw(surface, 16, 128, 128, 32, NULL, "text field");
78
79 rdtk_surface_free(surface);
80
81 region16_union_rect(&(lobby->invalidRegion), &(lobby->invalidRegion), &invalidRect);
82
83 rc = TRUE;
84fail:
85 LeaveCriticalSection(&lobby->lock);
86 rdtk_engine_free(engine);
87 return rc;
88}