Implementation of X11 pasting

This commit is contained in:
Thomas Bernard
2018-07-02 21:32:26 +02:00
parent 0d3ab36291
commit b67e264026
2 changed files with 60 additions and 1 deletions

View File

@@ -82,6 +82,10 @@ int Snap_axis_origin_Y;
char * Drop_file_name = NULL;
#if defined(USE_X11)
char * X11_clipboard = NULL;
#endif
// --
// Digital joystick state
@@ -1472,6 +1476,25 @@ int Get_input(int sleep_time)
XSendEvent(X11_display, event.xselection.requestor, False, NoEventMask, &reply);
}
}
else if (event.xselection.selection == XInternAtom(X11_display, "CLIPBOARD", False)
|| event.xselection.selection == XInternAtom(X11_display, "PRIMARY", False))
{
Atom type = 0;
int format = 0;
int r;
unsigned long count = 0, bytesAfter = 0;
unsigned char * value = NULL;
r = XGetWindowProperty(X11_display, X11_window, event.xselection.property, 0, LONG_MAX,
False, event.xselection.target /* type */, &type, &format,
&count, &bytesAfter, &value);
if (r == Success && value != NULL)
{
X11_clipboard = strdup((char *)value);
XFree(value);
}
user_feedback_required = 1;
}
break;
default:
printf("event.type = %d\n", event.type);