ReactOS 0.4.15-dev-7906-g1b85a5f
xproto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void xclip_handle_SelectionNotify (RDPCLIENT *This, XSelectionEvent *event)
 
void xclip_handle_SelectionRequest (RDPCLIENT *This, XSelectionRequestEvent *xevent)
 
void xclip_handle_SelectionClear (RDPCLIENT *This)
 
void xclip_handle_PropertyNotify (RDPCLIENT *This, XPropertyEvent *xev)
 
int ewmh_get_window_state (RDPCLIENT *This, Window w)
 
int ewmh_change_state (RDPCLIENT *This, Window wnd, int state)
 
int ewmh_move_to_desktop (RDPCLIENT *This, Window wnd, unsigned int desktop)
 
int ewmh_get_window_desktop (RDPCLIENT *This, Window wnd)
 
void ewmh_set_wm_name (RDPCLIENT *This, Window wnd, const char *title)
 
int ewmh_set_window_popup (RDPCLIENT *This, Window wnd)
 
int ewmh_set_window_modal (RDPCLIENT *This, Window wnd)
 

Function Documentation

◆ ewmh_change_state()

int ewmh_change_state ( RDPCLIENT This,
Window  wnd,
int  state 
)

Definition at line 321 of file ewmhints.c.

322{
323 /*
324 * Deal with the max atoms
325 */
327 {
329 (This, wnd, 1, This->ewmhints.state_maximized_vert_atom,
330 This->ewmhints.state_maximized_horz_atom) < 0)
331 return -1;
332 }
333 else
334 {
336 (This, wnd, 0, This->ewmhints.state_maximized_vert_atom,
337 This->ewmhints.state_maximized_horz_atom) < 0)
338 return -1;
339 }
340
341 return 0;
342}
static int state
Definition: maze.c:121
#define SEAMLESSRDP_MAXIMIZED
Definition: constants.h:569
static int ewmh_modify_state(RDPCLIENT *This, Window wnd, int add, Atom atom1, Atom atom2)
Definition: ewmhints.c:227

Referenced by ui_seamless_setstate().

◆ ewmh_get_window_desktop()

int ewmh_get_window_desktop ( RDPCLIENT This,
Window  wnd 
)

Definition at line 346 of file ewmhints.c.

347{
348 unsigned long nitems_return;
349 unsigned char *prop_return;
350 int desktop;
351
352 if (get_property_value(This, wnd, "_NET_WM_DESKTOP", 1, &nitems_return, &prop_return, 0) < 0)
353 return (-1);
354
355 if (nitems_return != 1)
356 {
357 fprintf(stderr, "_NET_WM_DESKTOP has bad length\n");
358 return (-1);
359 }
360
361 desktop = *prop_return;
362 XFree(prop_return);
363 return desktop;
364}
static int get_property_value(RDPCLIENT *This, Window wnd, char *propname, long max_length, unsigned long *nitems_return, unsigned char **prop_return, int nowarn)
Definition: ewmhints.c:38
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)

Referenced by xwin_process_events().

◆ ewmh_get_window_state()

int ewmh_get_window_state ( RDPCLIENT This,
Window  w 
)

Definition at line 191 of file ewmhints.c.

192{
193 unsigned long nitems_return;
194 unsigned char *prop_return;
195 uint32 *return_words;
196 unsigned long item;
197 BOOL maximized_vert, maximized_horz, hidden;
198
199 maximized_vert = maximized_horz = hidden = False;
200
201 if (get_property_value(This, w, "_NET_WM_STATE", 64, &nitems_return, &prop_return, 0) < 0)
202 return SEAMLESSRDP_NORMAL;
203
204 return_words = (uint32 *) prop_return;
205
206 for (item = 0; item < nitems_return; item++)
207 {
208 if (return_words[item] == This->ewmhints.state_maximized_vert_atom)
209 maximized_vert = True;
210 if (return_words[item] == This->ewmhints.state_maximized_horz_atom)
211 maximized_horz = True;
212 if (return_words[item] == This->ewmhints.state_hidden_atom)
213 hidden = True;
214 }
215
216 XFree(prop_return);
217
218 if (maximized_vert && maximized_horz)
220 else if (hidden)
222 else
223 return SEAMLESSRDP_NORMAL;
224}
#define SEAMLESSRDP_MINIMIZED
Definition: constants.h:568
#define SEAMLESSRDP_NORMAL
Definition: constants.h:567
unsigned int uint32
Definition: types.h:32
#define False
Definition: types.h:25
#define True
Definition: types.h:24
unsigned int BOOL
Definition: ntddk_ex.h:94
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
__u32 hidden
Definition: mkdosfs.c:13
static ATOM item
Definition: dde.c:856

Referenced by xwin_process_events().

◆ ewmh_move_to_desktop()

int ewmh_move_to_desktop ( RDPCLIENT This,
Window  wnd,
unsigned int  desktop 
)

Definition at line 368 of file ewmhints.c.

369{
371 XEvent xevent;
372
373 xevent.type = ClientMessage;
374 xevent.xclient.window = wnd;
375 xevent.xclient.message_type = This->net_wm_desktop_atom;
376 xevent.xclient.format = 32;
377 xevent.xclient.data.l[0] = desktop;
378 xevent.xclient.data.l[1] = 0;
379 xevent.xclient.data.l[2] = 0;
380 xevent.xclient.data.l[3] = 0;
381 xevent.xclient.data.l[4] = 0;
382 status = XSendEvent(This->display, DefaultRootWindow(This->display), False,
383 SubstructureNotifyMask | SubstructureRedirectMask, &xevent);
384 if (!status)
385 return -1;
386
387 return 0;
388}
Status
Definition: gdiplustypes.h:25
Definition: ps.c:97

Referenced by sw_all_to_desktop().

◆ ewmh_set_window_modal()

int ewmh_set_window_modal ( RDPCLIENT This,
Window  wnd 
)

Definition at line 411 of file ewmhints.c.

412{
413 if (ewmh_modify_state(This, wnd, 1, This->ewmhints.state_modal_atom, 0) < 0)
414 return -1;
415 return 0;
416}

Referenced by ui_seamless_create_window().

◆ ewmh_set_window_popup()

int ewmh_set_window_popup ( RDPCLIENT This,
Window  wnd 
)

Definition at line 402 of file ewmhints.c.

403{
405 (This, wnd, 1, This->ewmhints.state_skip_taskbar_atom, This->ewmhints.state_skip_pager_atom) < 0)
406 return -1;
407 return 0;
408}

Referenced by ui_seamless_create_window().

◆ ewmh_set_wm_name()

void ewmh_set_wm_name ( RDPCLIENT This,
Window  wnd,
const char title 
)

Definition at line 391 of file ewmhints.c.

392{
393 int len;
394
395 len = strlen(title);
396 XChangeProperty(This->display, wnd, This->ewmhints.name_atom, This->ewmhints.utf8_string_atom,
397 8, PropModeReplace, (unsigned char *) title, len);
398}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLsizei len
Definition: glext.h:6722
static char title[]
Definition: ps.c:92

Referenced by ui_seamless_create_window(), and ui_seamless_settitle().

◆ xclip_handle_PropertyNotify()

void xclip_handle_PropertyNotify ( RDPCLIENT This,
XPropertyEvent *  xev 
)

Definition at line 779 of file xclip.c.

780{
781 unsigned long nitems;
782 unsigned long offset = 0;
783 unsigned long bytes_left = 1;
784 int format;
785 XWindowAttributes wa;
786 uint8 *data;
787 Atom type;
788
789 if (event->state == PropertyNewValue && This->xclip.waiting_for_INCR)
790 {
791 DEBUG_CLIPBOARD(("x_clip_handle_PropertyNotify: This->xclip.waiting_for_INCR != 0\n"));
792
793 while (bytes_left > 0)
794 {
795 /* Unlike the specification, we don't set the 'delete' arugment to True
796 since we slurp the INCR's chunks in even-smaller chunks of 4096 bytes. */
797 if ((XGetWindowProperty
798 (This->display, This->wnd, This->xclip.rdesktop_clipboard_target_atom, offset, 4096L,
799 False, AnyPropertyType, &type, &format, &nitems, &bytes_left,
800 &data) != Success))
801 {
802 XFree(data);
803 return;
804 }
805
806 if (nitems == 0)
807 {
808 /* INCR transfer finished */
809 XGetWindowAttributes(This->display, This->wnd, &wa);
810 XSelectInput(This->display, This->wnd,
811 (wa.your_event_mask ^ PropertyChangeMask));
812 XFree(data);
813 This->xclip.waiting_for_INCR = 0;
814
815 if (This->xclip.clip_buflen > 0)
816 {
818 (This, This->xclip.clip_buffer, This->xclip.clip_buflen, This->xclip.incr_target))
819 {
821 }
822 xfree(This->xclip.clip_buffer);
823 This->xclip.clip_buffer = NULL;
824 This->xclip.clip_buflen = 0;
825 }
826 }
827 else
828 {
829 /* Another chunk in the INCR transfer */
830 offset += (nitems / 4); /* offset at which to begin the next slurp */
831 This->xclip.clip_buffer = xrealloc(This->xclip.clip_buffer, This->xclip.clip_buflen + nitems);
832 memcpy(This->xclip.clip_buffer + This->xclip.clip_buflen, data, nitems);
833 This->xclip.clip_buflen += nitems;
834
835 XFree(data);
836 }
837 }
838 XDeleteProperty(This->display, This->wnd, This->xclip.rdesktop_clipboard_target_atom);
839 return;
840 }
841
842 if ((event->atom == This->xclip.rdesktop_selection_notify_atom) &&
843 (event->window == DefaultRootWindow(This->display)))
845}
void xfree(void *mem)
Definition: uimain.c:758
void * xrealloc(void *oldmem, size_t size)
Definition: uimain.c:736
#define DEBUG_CLIPBOARD(args)
Definition: rdesktop.h:147
unsigned char uint8
Definition: types.h:28
_Out_ RTL_ATOM * Atom
Definition: class.h:54
#define NULL
Definition: types.h:112
@ Success
Definition: eventcreate.c:712
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
struct _cl_event * event
Definition: glext.h:7739
GLintptr offset
Definition: glext.h:5920
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void xclip_probe_selections(RDPCLIENT *This)
Definition: xclip.c:342
static void helper_cliprdr_send_empty_response(RDPCLIENT *This)
Definition: xclip.c:197
static Bool xclip_send_data_with_convert(RDPCLIENT *This, uint8 *source, size_t source_size, Atom target)
Definition: xclip.c:206

Referenced by xwin_process_events().

◆ xclip_handle_SelectionClear()

void xclip_handle_SelectionClear ( RDPCLIENT This)

Definition at line 770 of file xclip.c.

771{
772 DEBUG_CLIPBOARD(("xclip_handle_SelectionClear\n"));
775}
static void xclip_notify_change(RDPCLIENT *This)
Definition: xclip.c:335

Referenced by xwin_process_events().

◆ xclip_handle_SelectionNotify()

void xclip_handle_SelectionNotify ( RDPCLIENT This,
XSelectionEvent *  event 
)

Definition at line 417 of file xclip.c.

418{
419 unsigned long nitems, bytes_left;
420 XWindowAttributes wa;
421 Atom type;
422 Atom *supported_targets;
423 int res, i, format;
424 uint8 *data = NULL;
425
426 if (event->property == None)
427 goto fail;
428
429 DEBUG_CLIPBOARD(("xclip_handle_SelectionNotify: selection=%s, target=%s, property=%s\n",
430 XGetAtomName(This->display, event->selection),
431 XGetAtomName(This->display, event->target),
432 XGetAtomName(This->display, event->property)));
433
434 if (event->target == This->xclip.timestamp_atom)
435 {
436 if (event->selection == This->xclip.primary_atom)
437 {
438 res = XGetWindowProperty(This->display, This->wnd,
439 This->xclip.rdesktop_primary_timestamp_target_atom, 0,
440 XMaxRequestSize(This->display), False, AnyPropertyType,
441 &type, &format, &nitems, &bytes_left, &data);
442 }
443 else
444 {
445 res = XGetWindowProperty(This->display, This->wnd,
446 This->xclip.rdesktop_clipboard_timestamp_target_atom, 0,
447 XMaxRequestSize(This->display), False, AnyPropertyType,
448 &type, &format, &nitems, &bytes_left, &data);
449 }
450
451
452 if ((res != Success) || (nitems != 1) || (format != 32))
453 {
454 DEBUG_CLIPBOARD(("XGetWindowProperty failed!\n"));
455 goto fail;
456 }
457
458 if (event->selection == This->xclip.primary_atom)
459 {
460 This->xclip.primary_timestamp = *(Time *) data;
461 if (This->xclip.primary_timestamp == 0)
462 This->xclip.primary_timestamp++;
463 XDeleteProperty(This->display, This->wnd, This->xclip.rdesktop_primary_timestamp_target_atom);
464 DEBUG_CLIPBOARD(("Got PRIMARY timestamp: %u\n",
465 (unsigned) This->xclip.primary_timestamp));
466 }
467 else
468 {
469 This->xclip.clipboard_timestamp = *(Time *) data;
470 if (This->xclip.clipboard_timestamp == 0)
471 This->xclip.clipboard_timestamp++;
472 XDeleteProperty(This->display, This->wnd, This->xclip.rdesktop_clipboard_timestamp_target_atom);
473 DEBUG_CLIPBOARD(("Got CLIPBOARD timestamp: %u\n",
474 (unsigned) This->xclip.clipboard_timestamp));
475 }
476
477 XFree(data);
478
479 if (This->xclip.primary_timestamp && This->xclip.clipboard_timestamp)
480 {
481 if (This->xclip.primary_timestamp > This->xclip.clipboard_timestamp)
482 {
483 DEBUG_CLIPBOARD(("PRIMARY is most recent selection.\n"));
484 XConvertSelection(This->display, This->xclip.primary_atom, This->xclip.targets_atom,
485 This->xclip.rdesktop_clipboard_target_atom, This->wnd,
486 event->time);
487 }
488 else
489 {
490 DEBUG_CLIPBOARD(("CLIPBOARD is most recent selection.\n"));
491 XConvertSelection(This->display, This->xclip.clipboard_atom, This->xclip.targets_atom,
492 This->xclip.rdesktop_clipboard_target_atom, This->wnd,
493 event->time);
494 }
495 }
496
497 return;
498 }
499
500 if (This->xclip.probing_selections && This->xclip.reprobe_selections)
501 {
502 This->xclip.probing_selections = False;
504 return;
505 }
506
507 res = XGetWindowProperty(This->display, This->wnd, This->xclip.rdesktop_clipboard_target_atom,
508 0, XMaxRequestSize(This->display), False, AnyPropertyType,
509 &type, &format, &nitems, &bytes_left, &data);
510
512
513 if (res != Success)
514 {
515 DEBUG_CLIPBOARD(("XGetWindowProperty failed!\n"));
516 goto fail;
517 }
518
519 if (type == This->xclip.incr_atom)
520 {
521 DEBUG_CLIPBOARD(("Received INCR.\n"));
522
523 XGetWindowAttributes(This->display, This->wnd, &wa);
524 if ((wa.your_event_mask | PropertyChangeMask) != wa.your_event_mask)
525 {
526 XSelectInput(This->display, This->wnd, (wa.your_event_mask | PropertyChangeMask));
527 }
528 XFree(data);
529 This->xclip.incr_target = event->target;
530 This->xclip.waiting_for_INCR = 1;
531 goto end;
532 }
533
534 /* Negotiate target format */
535 if (event->target == This->xclip.targets_atom)
536 {
537 /* Determine the best of text This->xclip.targets that we have available:
538 Prefer UTF8_STRING > text/unicode (unspecified encoding) > STRING
539 (ignore TEXT and COMPOUND_TEXT because we don't have code to handle them)
540 */
541 int text_target_satisfaction = 0;
542 Atom best_text_target = 0; /* measures how much we're satisfied with what we found */
543 if (type != None)
544 {
545 supported_targets = (Atom *) data;
546 for (i = 0; i < nitems; i++)
547 {
548 DEBUG_CLIPBOARD(("Target %d: %s\n", i,
549 XGetAtomName(This->display, supported_targets[i])));
550 if (supported_targets[i] == This->xclip.format_string_atom)
551 {
552 if (text_target_satisfaction < 1)
553 {
554 DEBUG_CLIPBOARD(("Other party supports STRING, choosing that as best_target\n"));
555 best_text_target = supported_targets[i];
556 text_target_satisfaction = 1;
557 }
558 }
559#ifdef USE_UNICODE_CLIPBOARD
560 else if (supported_targets[i] == This->xclip.format_unicode_atom)
561 {
562 if (text_target_satisfaction < 2)
563 {
564 DEBUG_CLIPBOARD(("Other party supports text/unicode, choosing that as best_target\n"));
565 best_text_target = supported_targets[i];
566 text_target_satisfaction = 2;
567 }
568 }
569 else if (supported_targets[i] == This->xclip.format_utf8_string_atom)
570 {
571 if (text_target_satisfaction < 3)
572 {
573 DEBUG_CLIPBOARD(("Other party supports UTF8_STRING, choosing that as best_target\n"));
574 best_text_target = supported_targets[i];
575 text_target_satisfaction = 3;
576 }
577 }
578#endif
579 else if (supported_targets[i] == This->xclip.rdesktop_clipboard_formats_atom)
580 {
581 if (This->xclip.probing_selections && (text_target_satisfaction < 4))
582 {
583 DEBUG_CLIPBOARD(("Other party supports native formats, choosing that as best_target\n"));
584 best_text_target = supported_targets[i];
585 text_target_satisfaction = 4;
586 }
587 }
588 }
589 }
590
591 /* Kickstarting the next step in the process of satisfying RDP's
592 clipboard request -- specifically, requesting the actual clipboard data.
593 */
594 if ((best_text_target != 0)
595 && (!This->xclip.probing_selections
596 || (best_text_target == This->xclip.rdesktop_clipboard_formats_atom)))
597 {
598 XConvertSelection(This->display, event->selection, best_text_target,
599 This->xclip.rdesktop_clipboard_target_atom, This->wnd, event->time);
600 goto end;
601 }
602 else
603 {
604 DEBUG_CLIPBOARD(("Unable to find a textual target to satisfy RDP clipboard text request\n"));
605 goto fail;
606 }
607 }
608 else
609 {
610 if (This->xclip.probing_selections)
611 {
612 Window primary_owner, clipboard_owner;
613
614 /* FIXME:
615 Without XFIXES, we must make sure that the other
616 rdesktop owns all relevant selections or we might try
617 to get a native format from non-rdesktop window later
618 on. */
619
620 clipboard_owner = XGetSelectionOwner(This->display, This->xclip.clipboard_atom);
621
622 if (This->xclip.auto_mode)
623 primary_owner = XGetSelectionOwner(This->display, This->xclip.primary_atom);
624 else
625 primary_owner = clipboard_owner;
626
627 if (primary_owner != clipboard_owner)
628 goto fail;
629
630 DEBUG_CLIPBOARD(("Got fellow rdesktop formats\n"));
631 This->xclip.probing_selections = False;
632 This->xclip.rdesktop_is_selection_owner = True;
634 }
635 else if (!xclip_send_data_with_convert(This, data, nitems, event->target))
636 {
637 goto fail;
638 }
639 }
640
641 end:
642 if (data)
643 XFree(data);
644
645 return;
646
647 fail:
649 if (This->xclip.probing_selections)
650 {
651 DEBUG_CLIPBOARD(("Unable to find suitable target. Using default text format.\n"));
652 This->xclip.probing_selections = False;
653 This->xclip.rdesktop_is_selection_owner = False;
654
655 /* FIXME:
656 Without XFIXES, we cannot reliably know the formats offered by an
657 upcoming selection owner, so we just lie about him offering
658 RDP_CF_TEXT. */
660 }
661 else
662 {
664 }
665 goto end;
666}
void cliprdr_send_simple_native_format_announce(uint32 format)
void cliprdr_send_native_format_announce(uint8 *formats_data, uint32 formats_data_length)
@ None
Definition: install.h:14
GLuint GLuint end
Definition: gl.h:1545
GLuint res
Definition: glext.h:9613
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PLARGE_INTEGER Time
Definition: time.c:105
Definition: window.c:28
#define RDP_CF_TEXT
Definition: xclip.c:48
static void xclip_clear_target_props(RDPCLIENT *This)
Definition: xclip.c:327

Referenced by xwin_process_events().

◆ xclip_handle_SelectionRequest()

void xclip_handle_SelectionRequest ( RDPCLIENT This,
XSelectionRequestEvent *  xevent 
)

Definition at line 673 of file xclip.c.

674{
675 unsigned long nitems, bytes_left;
676 unsigned char *prop_return;
677 int format, res;
678 Atom type;
679
680 DEBUG_CLIPBOARD(("xclip_handle_SelectionRequest: selection=%s, target=%s, property=%s\n",
681 XGetAtomName(This->display, event->selection),
682 XGetAtomName(This->display, event->target),
683 XGetAtomName(This->display, event->property)));
684
685 if (event->target == This->xclip.targets_atom)
686 {
687 xclip_provide_selection(This, event, XA_ATOM, 32, (uint8 *) & This->xclip.targets, This->xclip.num_targets);
688 return;
689 }
690 else if (event->target == This->xclip.timestamp_atom)
691 {
692 xclip_provide_selection(This, event, XA_INTEGER, 32, (uint8 *) & This->xclip.acquire_time, 1);
693 return;
694 }
695 else if (event->target == This->xclip.rdesktop_clipboard_formats_atom)
696 {
697 xclip_provide_selection(This, event, XA_STRING, 8, This->xclip.formats_data, This->xclip.formats_data_length);
698 }
699 else
700 {
701 /* All the following This->xclip.targets require an async operation with the RDP server
702 and currently we don't do X clipboard request queueing so we can only
703 handle one such request at a time. */
704 if (This->xclip.has_selection_request)
705 {
706 DEBUG_CLIPBOARD(("Error: Another clipboard request was already sent to the RDP server and not yet responded. Refusing this request.\n"));
708 return;
709 }
710 if (event->target == This->xclip.rdesktop_native_atom)
711 {
712 /* Before the requestor makes a request for the _RDESKTOP_NATIVE target,
713 he should declare requestor[property] = CF_SOMETHING. */
714 res = XGetWindowProperty(This->display, event->requestor,
715 event->property, 0, 1, True,
716 XA_INTEGER, &type, &format, &nitems, &bytes_left,
717 &prop_return);
718 if (res != Success)
719 {
720 DEBUG_CLIPBOARD(("Requested native format but didn't specifiy which.\n"));
722 return;
723 }
724
725 format = *(uint32 *) prop_return;
726 XFree(prop_return);
727 }
728 else if (event->target == This->xclip.format_string_atom || event->target == XA_STRING)
729 {
730 /* STRING and XA_STRING are defined to be ISO8859-1 */
731 format = CF_TEXT;
732 }
733 else if (event->target == This->xclip.format_utf8_string_atom)
734 {
735#ifdef USE_UNICODE_CLIPBOARD
737#else
738 DEBUG_CLIPBOARD(("Requested target unavailable due to lack of Unicode support. (It was not in TARGETS, so why did you ask for it?!)\n"));
740 return;
741#endif
742 }
743 else if (event->target == This->xclip.format_unicode_atom)
744 {
745 /* Assuming text/unicode to be UTF-16 */
747 }
748 else
749 {
750 DEBUG_CLIPBOARD(("Requested target unavailable. (It was not in TARGETS, so why did you ask for it?!)\n"));
752 return;
753 }
754
756 This->xclip.selection_request = *event;
757 This->xclip.has_selection_request = True;
758 return; /* wait for data */
759 }
760}
#define CF_UNICODETEXT
Definition: constants.h:408
#define CF_TEXT
Definition: constants.h:396
void cliprdr_send_data_request(uint32 format)
static void xclip_provide_selection(RDPCLIENT *This, XSelectionRequestEvent *req, Atom type, unsigned int format, uint8 *data, uint32 length)
Definition: xclip.c:136
static void xclip_refuse_selection(RDPCLIENT *This, XSelectionRequestEvent *req)
Definition: xclip.c:161

Referenced by xwin_process_events().