rdp: Pass a monitor configuration to rdp_head_create

Instead of passing a name, pass a FreeRDP rdpMonitor struct. For now the
only caller will pass a NULL to use default values.

Also, drop static from the function declaration as new code will call it
from another file shortly.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
This commit is contained in:
Hideyuki Nagase 2022-08-09 13:40:30 -05:00 committed by Daniel Stone
parent 3e27571001
commit 8a2d961b92
2 changed files with 31 additions and 6 deletions

View File

@ -543,20 +543,37 @@ rdp_output_create(struct weston_compositor *compositor, const char *name)
return &output->base;
}
static void
rdp_head_create(struct weston_compositor *compositor, const char *name)
void
rdp_head_create(struct weston_compositor *compositor, rdpMonitor *config)
{
struct rdp_backend *backend = to_rdp_backend(compositor);
struct rdp_head *head;
char name[13] = {}; /* "rdp-" + 8 chars for hex uint32_t + NULL. */
head = xzalloc(sizeof *head);
head->index = backend->head_index++;
if (config)
head->config = *config;
else {
/* Before any client conenctions we create a default head
* with no configuration. Make it the primary, and make
* it avoid the high dpi scaling paths.
*/
head->config.is_primary = true;
head->config.attributes.desktopScaleFactor = 0;
}
sprintf(name, "rdp-%x", head->index);
weston_head_init(&head->base, name);
weston_head_set_monitor_strings(&head->base, "weston", "rdp", NULL);
/* This is a virtual output, so report a zero physical size.
* It's better to let frontends/clients use their defaults. */
weston_head_set_physical_size(&head->base, 0, 0);
if (config)
weston_head_set_physical_size(&head->base,
config->attributes.physicalWidth,
config->attributes.physicalHeight);
else
weston_head_set_physical_size(&head->base, 0, 0);
head->base.backend = &backend->base;
@ -1725,7 +1742,7 @@ rdp_backend_create(struct weston_compositor *compositor,
if (pixman_renderer_init(compositor) < 0)
goto err_compositor;
rdp_head_create(compositor, "rdp");
rdp_head_create(compositor, NULL);
compositor->capabilities |= WESTON_CAP_ARBITRARY_MODES;

View File

@ -96,6 +96,8 @@ struct rdp_backend {
rdp_audio_in_teardown audio_in_teardown;
rdp_audio_out_setup audio_out_setup;
rdp_audio_out_teardown audio_out_teardown;
uint32_t head_index;
};
enum peer_item_flags {
@ -113,6 +115,8 @@ struct rdp_peers_item {
struct rdp_head {
struct weston_head base;
uint32_t index;
rdpMonitor config;
};
struct rdp_output {
@ -229,6 +233,10 @@ rdp_clipboard_init(freerdp_peer *client);
void
rdp_clipboard_destroy(RdpPeerContext *peerCtx);
/* rdp.c */
void
rdp_head_create(struct weston_compositor *compositor, rdpMonitor *config);
void
rdp_destroy(struct weston_compositor *ec);