Skip to content

Commit

Permalink
support window z order sync with client (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: Hideyuki Nagase <[email protected]>
  • Loading branch information
hideyukn88 and Hideyuki Nagase authored May 10, 2021
1 parent 248dbb6 commit 43741db
Show file tree
Hide file tree
Showing 6 changed files with 219 additions and 72 deletions.
7 changes: 6 additions & 1 deletion include/libweston/backend-rdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct weston_rdprail_shell_api {

/** Activate a window.
*/
void (*request_window_activate)(struct weston_surface *surface, struct weston_seat *seat);
void (*request_window_activate)(void *shell_context, struct weston_seat *seat, struct weston_surface *surface);

/** Close a window.
*/
Expand Down Expand Up @@ -160,6 +160,11 @@ struct weston_rdprail_api {
/** Get primary output
*/
struct weston_output *(*get_primary_output)(void *rdp_backend);

/** Update window zorder
*/
void (*notify_window_zorder_change)(struct weston_compositor *compositor,
struct weston_surface *surface);
};

static inline const struct weston_rdprail_api *
Expand Down
9 changes: 6 additions & 3 deletions libweston/backend-rdp/rdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ rdp_validate_button_state(RdpPeerContext *peerContext, bool pressed, uint32_t* b
uint32_t index = *button - BTN_LEFT;
assert(index < ARRAY_LENGTH(peerContext->button_state));
if (pressed == peerContext->button_state[index]) {
rdp_debug(b, "%s: inconsistent button state button:%d (index:%d) pressed:%d\n",
rdp_debug_verbose(b, "%s: inconsistent button state button:%d (index:%d) pressed:%d\n",
__func__, *button, index, pressed);
/* ignore button input */
*button = 0;
Expand Down Expand Up @@ -1634,7 +1634,7 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code)
uint32_t scan_code, vk_code, full_code;
enum wl_keyboard_key_state keyState;
RdpPeerContext *peerContext = (RdpPeerContext *)input->context;
/*struct rdp_backend *b = peerContext->rdpBackend;*/
struct rdp_backend *b = peerContext->rdpBackend;

int notify = 0;
struct timespec time;
Expand All @@ -1659,8 +1659,11 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code)
assert(vk_code <= 0xFF);
if (keyState == WL_KEYBOARD_KEY_STATE_RELEASED) {
/* Ignore release if key is not previously pressed. */
if ((peerContext->key_state[vk_code>>3] & (1<<(vk_code&0x7))) == 0)
if ((peerContext->key_state[vk_code>>3] & (1<<(vk_code&0x7))) == 0) {
rdp_debug_verbose(b, "%s: inconsistent key state vk_code:%x\n",
__func__, vk_code);
goto exit;
}
peerContext->key_state[vk_code>>3] &= ~(1<<(vk_code&0x7));
} else {
peerContext->key_state[vk_code>>3] |= (1<<(vk_code&0x7));
Expand Down
5 changes: 5 additions & 0 deletions libweston/backend-rdp/rdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ struct rdp_backend {

struct wl_listener create_window_listener;

bool enable_window_zorder_sync;

bool enable_hi_dpi_support;
bool enable_fractional_hi_dpi_support;
uint32_t debug_desktop_scaling_factor; /* must be between 100 to 500 */
Expand Down Expand Up @@ -309,6 +311,9 @@ struct rdp_peer_context {
struct wl_listener idle_listener;
struct wl_listener wake_listener;

bool is_window_zorder_dirty;
struct weston_surface *active_surface;

// Multiple monitor support (monitor topology)
pixman_region32_t regionClientHeads;
pixman_region32_t regionWestonHeads;
Expand Down
12 changes: 7 additions & 5 deletions libweston/backend-rdp/rdpclip.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,15 +834,15 @@ clipboard_data_source_send(struct weston_data_source *base,
formatDataRequest.msgType = CB_FORMAT_DATA_REQUEST;
formatDataRequest.dataLen = 4;
formatDataRequest.requestedFormatId = source->client_format_id_table[index];
rdp_debug_clipboard(b, "RDP %s (%p) request index:%d formatId:%d %s\n",
__func__, source, index,
rdp_debug_clipboard(b, "RDP %s (%p) request \"%s\" index:%d formatId:%d %s\n",
__func__, source, mime_type, index,
formatDataRequest.requestedFormatId,
clipboard_format_id_to_string(formatDataRequest.requestedFormatId, false));
if (peerCtx->clipboard_server_context->ServerFormatDataRequest(peerCtx->clipboard_server_context, &formatDataRequest) != 0)
goto error_return_unref_source;
}
} else {
weston_log("RDP %s (%p) specified format (%s.%d.%d) is not supported by client\n",
weston_log("RDP %s (%p) specified format \"%s\" index:%d formatId:%d is not supported by client\n",
__func__, source, mime_type, index, source->client_format_id_table[index]);
goto error_return_close_fd;
}
Expand Down Expand Up @@ -878,11 +878,12 @@ clipboard_data_source_cancel(struct weston_data_source *base)
ASSERT_COMPOSITOR_THREAD(b);

if (source == peerCtx->clipboard_inflight_client_data_source) {
weston_log("RDP %s (%p): still inflight\n", __func__, source);
rdp_debug_clipboard(b, "RDP %s (%p): still inflight\n", __func__, source);
assert(source->refcount > 1);
source->is_canceled = TRUE;
} else {
/* everything outside of the base has to be cleaned up */
rdp_debug_clipboard_verbose(b, "RDP %s (%p): cancelled\n", __func__, source);
assert(source->event_source == NULL);
wl_array_release(&source->data_contents);
wl_array_init(&source->data_contents);
Expand Down Expand Up @@ -1183,7 +1184,8 @@ clipboard_client_format_list(CliprdrServerContext* context, const CLIPRDR_FORMAT
if (s) {
p = wl_array_add(&source->base.mime_types, sizeof *p);
if (p) {
rdp_debug_clipboard(b, "Client: %s (%p) mine_type:\"%s\"\n", __func__, source, s);
rdp_debug_clipboard(b, "Client: %s (%p) mine_type:\"%s\" index:%d formatId:%d\n",
__func__, source, s, index, format->formatId);
*p = s;
} else {
rdp_debug_clipboard(b, "Client: %s (%p) wl_array_add failed\n", __func__, source);
Expand Down
Loading

0 comments on commit 43741db

Please sign in to comment.