21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_X11 25 #include <sys/types.h> 34 #include "../../events/SDL_events_c.h" 35 #include "../../events/SDL_mouse_c.h" 36 #include "../../events/SDL_touch_c.h" 46 #ifndef _NET_WM_MOVERESIZE_SIZE_TOPLEFT 47 #define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0 50 #ifndef _NET_WM_MOVERESIZE_SIZE_TOP 51 #define _NET_WM_MOVERESIZE_SIZE_TOP 1 54 #ifndef _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 55 #define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2 58 #ifndef _NET_WM_MOVERESIZE_SIZE_RIGHT 59 #define _NET_WM_MOVERESIZE_SIZE_RIGHT 3 62 #ifndef _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 63 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4 66 #ifndef _NET_WM_MOVERESIZE_SIZE_BOTTOM 67 #define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5 70 #ifndef _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 71 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6 74 #ifndef _NET_WM_MOVERESIZE_SIZE_LEFT 75 #define _NET_WM_MOVERESIZE_SIZE_LEFT 7 78 #ifndef _NET_WM_MOVERESIZE_MOVE 79 #define _NET_WM_MOVERESIZE_MOVE 8 91 static void X11_ReadProperty(SDL_x11Prop *
p, Display *disp, Window
w, Atom prop)
93 unsigned char *ret=
NULL;
97 unsigned long bytes_left;
101 if (ret != 0) X11_XFree(ret);
102 X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret);
103 bytes_fetch += bytes_left;
104 }
while (bytes_left != 0);
114 static Atom X11_PickTarget(Display *disp, Atom list[],
int list_count)
119 for (i=0; i < list_count && request == None; i++) {
120 name = X11_XGetAtomName(disp, list[i]);
131 static Atom X11_PickTargetFromAtoms(Display *disp, Atom a0, Atom a1, Atom a2)
135 if (a0 != None) atom[count++] = a0;
136 if (a1 != None) atom[count++] = a1;
137 if (a2 != None) atom[count++] = a2;
138 return X11_PickTarget(disp, atom, count);
141 struct KeyRepeatCheckData
147 static Bool X11_KeyRepeatCheckIfEvent(Display *display, XEvent *chkev,
150 struct KeyRepeatCheckData *
d = (
struct KeyRepeatCheckData *) arg;
151 if (chkev->type == KeyPress &&
152 chkev->xkey.keycode == d->event->xkey.keycode &&
153 chkev->xkey.time - d->event->xkey.time < 2)
161 static SDL_bool X11_KeyRepeat(Display *display, XEvent *
event)
164 struct KeyRepeatCheckData d;
167 if (X11_XPending(display))
168 X11_XCheckIfEvent(display, &dummyev, X11_KeyRepeatCheckIfEvent,
174 X11_IsWheelEvent(Display * display,XEvent * event,
int * xticks,
int * yticks)
181 switch (event->xbutton.button) {
182 case 4: *yticks = 1;
return SDL_TRUE;
183 case 5: *yticks = -1;
return SDL_TRUE;
184 case 6: *xticks = 1;
return SDL_TRUE;
185 case 7: *xticks = -1;
return SDL_TRUE;
204 int X11_URIDecode(
char *
buf,
int len) {
207 if (buf ==
NULL || len < 0) {
214 for (ri = 0, wi = 0, di = 0; ri < len && wi <
len; ri += 1) {
217 if (buf[ri] ==
'%') {
226 }
else if (di == 1 || di == 2) {
228 char isa = buf[ri] >=
'a' && buf[ri] <=
'f';
229 char isA = buf[ri] >=
'A' && buf[ri] <=
'F';
230 char isn = buf[ri] >=
'0' && buf[ri] <=
'9';
231 if (!(isa || isA || isn)) {
234 for (sri = ri - di; sri <= ri; sri += 1) {
249 decode |= (buf[ri] + off) << (2 - di) * 4;
267 static char* X11_URIToLocal(
char* uri) {
271 if (memcmp(uri,
"file:/",6) == 0) uri += 6;
272 else if (strstr(uri,
":/") !=
NULL)
return file;
274 local = uri[0] !=
'/' || (uri[0] !=
'\0' && uri[1] ==
'/');
277 if (!local && uri[0] ==
'/' && uri[2] !=
'/') {
278 char* hostname_end = strchr(uri+1,
'/');
279 if (hostname_end !=
NULL) {
280 char hostname[ 257 ];
281 if (gethostname(hostname, 255) == 0) {
282 hostname[ 256 ] =
'\0';
283 if (memcmp(uri+1, hostname, hostname_end - (uri+1)) == 0) {
284 uri = hostname_end + 1;
293 X11_URIDecode(file, 0);
303 #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 304 static void X11_HandleGenericEvent(
SDL_VideoData *videodata,XEvent event)
308 if (X11_XGetEventData(videodata->
display, cookie)) {
310 X11_XFreeEventData(videodata->
display, cookie);
316 X11_GetNumLockModifierMask(
_THIS)
319 Display *display = viddata->
display;
320 unsigned num_mask = 0;
322 XModifierKeymap *xmods;
325 xmods = X11_XGetModifierMapping(display);
326 n = xmods->max_keypermod;
327 for(i = 3; i < 8; i++) {
328 for(
j = 0;
j <
n;
j++) {
329 KeyCode kc = xmods->modifiermap[i * n +
j];
336 X11_XFreeModifiermap(xmods);
342 X11_ReconcileKeyboardState(
_THIS)
345 Display *display = viddata->
display;
352 X11_XQueryKeymap(display, keys);
355 if (X11_XQueryPointer(display, DefaultRootWindow(display), &junk_window, &junk_window, &x, &
y, &x, &
y, &
mask)) {
360 for (keycode = 0; keycode < 256; ++keycode) {
361 if (keys[keycode / 8] & (1 << (keycode % 8))) {
374 printf(
"window %p: Dispatching FocusIn\n", data);
377 X11_ReconcileKeyboardState(
_this);
378 #ifdef X_HAVE_UTF8_STRING 380 X11_XSetICFocus(data->
ic);
392 printf(
"window %p: Dispatching FocusOut\n", data);
401 #ifdef X_HAVE_UTF8_STRING 403 X11_XUnsetICFocus(data->
ic);
430 Display *display = viddata->
display;
434 X11_XUngrabPointer(display, 0L);
437 evt.xclient.type = ClientMessage;
438 evt.xclient.window = data->
xwindow;
439 evt.xclient.message_type = X11_XInternAtom(display,
"_NET_WM_MOVERESIZE", True);
440 evt.xclient.format = 32;
441 evt.xclient.data.l[0] =
window->
x + point->
x;
442 evt.xclient.data.l[1] =
window->
y + point->
y;
443 evt.xclient.data.l[2] = _NET_WM_MOVERESIZE_MOVE;
444 evt.xclient.data.l[3] = Button1;
445 evt.xclient.data.l[4] = 0;
446 X11_XSendEvent(display, DefaultRootWindow(display), False, SubstructureRedirectMask | SubstructureNotifyMask, &evt);
448 X11_XSync(display, 0);
456 Display *display = viddata->
display;
459 if (direction < _NET_WM_MOVERESIZE_SIZE_TOPLEFT || direction > _NET_WM_MOVERESIZE_SIZE_LEFT)
463 X11_XUngrabPointer(display, 0L);
466 evt.xclient.type = ClientMessage;
467 evt.xclient.window = data->
xwindow;
468 evt.xclient.message_type = X11_XInternAtom(display,
"_NET_WM_MOVERESIZE", True);
469 evt.xclient.format = 32;
470 evt.xclient.data.l[0] =
window->
x + point->
x;
471 evt.xclient.data.l[1] =
window->
y + point->
y;
472 evt.xclient.data.l[2] = direction;
473 evt.xclient.data.l[3] = Button1;
474 evt.xclient.data.l[4] = 0;
475 X11_XSendEvent(display, DefaultRootWindow(display), False, SubstructureRedirectMask | SubstructureNotifyMask, &evt);
477 X11_XSync(display, 0);
486 const SDL_Point point = { xev->xbutton.
x, xev->xbutton.y };
488 static const int directions[] = {
489 _NET_WM_MOVERESIZE_SIZE_TOPLEFT, _NET_WM_MOVERESIZE_SIZE_TOP,
490 _NET_WM_MOVERESIZE_SIZE_TOPRIGHT, _NET_WM_MOVERESIZE_SIZE_RIGHT,
491 _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT, _NET_WM_MOVERESIZE_SIZE_BOTTOM,
492 _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT, _NET_WM_MOVERESIZE_SIZE_LEFT
497 InitiateWindowMove(
_this, data, &point);
519 X11_UpdateUserTime(
SDL_WindowData *data,
const unsigned long latest)
521 if (latest && (latest != data->
user_time)) {
523 Display *display = videodata->
display;
525 XA_CARDINAL, 32, PropModeReplace,
526 (
const unsigned char *) &latest, 1);
528 printf(
"window %p: updating _NET_WM_USER_TIME to %lu\n", data, latest);
536 X11_DispatchEvent(
_THIS)
543 KeyCode orig_keycode;
544 XClientMessageEvent
m;
553 X11_XNextEvent(display, &xevent);
558 orig_event_type = xevent.type;
559 if (orig_event_type == KeyPress || orig_event_type == KeyRelease) {
560 orig_keycode = xevent.xkey.keycode;
566 if (X11_XFilterEvent(&xevent, None) == True) {
568 printf(
"Filtered event type = %d display = %d window = %d\n",
569 xevent.type, xevent.xany.display, xevent.xany.window);
574 if (orig_event_type == KeyPress) {
589 wmmsg.
msg.
x11.event = xevent;
593 #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 594 if(xevent.type == GenericEvent) {
595 X11_HandleGenericEvent(videodata,xevent);
601 printf(
"type = %d display = %d window = %d\n",
602 xevent.type, xevent.xany.display, xevent.xany.window);
617 if (xevent.type == KeymapNotify) {
619 X11_ReconcileKeyboardState(
_this);
621 }
else if (xevent.type == MappingNotify) {
623 const int request = xevent.xmapping.request;
626 printf(
"window %p: MappingNotify!\n", data);
628 if ((request == MappingKeyboard) || (request == MappingModifier)) {
629 X11_XRefreshKeyboardMapping(&xevent.xmapping);
638 switch (xevent.type) {
644 printf(
"window %p: EnterNotify! (%d,%d,%d)\n", data,
647 xevent.xcrossing.mode);
648 if (xevent.xcrossing.mode == NotifyGrab)
649 printf(
"Mode: NotifyGrab\n");
650 if (xevent.xcrossing.mode == NotifyUngrab)
651 printf(
"Mode: NotifyUngrab\n");
655 mouse->
last_x = xevent.xcrossing.x;
656 mouse->
last_y = xevent.xcrossing.y;
666 printf(
"window %p: LeaveNotify! (%d,%d,%d)\n", data,
669 xevent.xcrossing.mode);
670 if (xevent.xcrossing.mode == NotifyGrab)
671 printf(
"Mode: NotifyGrab\n");
672 if (xevent.xcrossing.mode == NotifyUngrab)
673 printf(
"Mode: NotifyUngrab\n");
679 if (xevent.xcrossing.mode != NotifyGrab &&
680 xevent.xcrossing.mode != NotifyUngrab &&
681 xevent.xcrossing.detail != NotifyInferior) {
689 if (xevent.xfocus.mode == NotifyGrab || xevent.xfocus.mode == NotifyUngrab) {
692 printf(
"window %p: FocusIn (NotifyGrab/NotifyUngrab, ignoring)\n", data);
697 if (xevent.xfocus.detail == NotifyInferior) {
699 printf(
"window %p: FocusIn (NotifierInferior, ignoring)\n", data);
704 printf(
"window %p: FocusIn!\n", data);
710 X11_DispatchFocusIn(
_this, data);
723 if (xevent.xfocus.mode == NotifyGrab || xevent.xfocus.mode == NotifyUngrab) {
726 printf(
"window %p: FocusOut (NotifyGrab/NotifyUngrab, ignoring)\n", data);
730 if (xevent.xfocus.detail == NotifyInferior) {
733 printf(
"window %p: FocusOut (NotifierInferior, ignoring)\n", data);
738 printf(
"window %p: FocusOut!\n", data);
744 X11_DispatchFocusOut(
_this, data);
756 KeyCode keycode = xevent.xkey.keycode;
757 KeySym keysym = NoSymbol;
763 printf(
"window %p: KeyPress (X11 keycode = 0x%X)\n", data, xevent.xkey.keycode);
767 int min_keycode, max_keycode;
768 X11_XDisplayKeycodes(display, &min_keycode, &max_keycode);
771 "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <sdl@libsdl.org> X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n",
772 keycode, keycode - min_keycode, keysym,
773 X11_XKeysymToString(keysym));
778 #ifdef X_HAVE_UTF8_STRING 780 X11_Xutf8LookupString(data->
ic, &xevent.xkey, text,
sizeof(text),
783 X11_XLookupString(&xevent.xkey, text,
sizeof(text), &keysym,
NULL);
786 X11_XLookupString(&xevent.xkey, text,
sizeof(text), &keysym,
NULL);
794 if (!handled_by_ime) {
801 X11_UpdateUserTime(data, xevent.xkey.time);
807 KeyCode keycode = xevent.xkey.keycode;
810 printf(
"window %p: KeyRelease (X11 keycode = 0x%X)\n", data, xevent.xkey.keycode);
812 if (X11_KeyRepeat(display, &xevent)) {
823 printf(
"window %p: UnmapNotify!\n", data);
825 X11_DispatchUnmapNotify(data);
832 printf(
"window %p: MapNotify!\n", data);
834 X11_DispatchMapNotify(data);
839 case ConfigureNotify:{
841 printf(
"window %p: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", data,
842 xevent.xconfigure.x, xevent.xconfigure.y,
843 xevent.xconfigure.width, xevent.xconfigure.height);
846 if (!xevent.xconfigure.send_event) {
847 unsigned int NumChildren;
848 Window ChildReturn, Root, Parent;
851 X11_XQueryTree(data->
videodata->
display, xevent.xconfigure.window, &Root, &Parent, &Children, &NumChildren);
852 X11_XTranslateCoordinates(xevent.xconfigure.display,
853 Parent, DefaultRootWindow(xevent.xconfigure.display),
854 xevent.xconfigure.x, xevent.xconfigure.y,
855 &xevent.xconfigure.x, &xevent.xconfigure.y,
862 xevent.xconfigure.x, xevent.xconfigure.y);
873 xevent.xconfigure.width,
874 xevent.xconfigure.height);
883 static int xdnd_version=0;
885 if (xevent.xclient.message_type == videodata->
XdndEnter) {
887 SDL_bool use_list = xevent.xclient.data.l[1] & 1;
889 xdnd_version = (xevent.xclient.data.l[1] >> 24);
891 printf(
"XID of source window : %ld\n", data->
xdnd_source);
892 printf(
"Protocol version to use : %d\n", xdnd_version);
893 printf(
"More then 3 data types : %d\n", (
int) use_list);
901 data->
xdnd_req = X11_PickTarget(display, (Atom*)p.data, p.count);
905 data->
xdnd_req = X11_PickTargetFromAtoms(display, xevent.xclient.data.l[2], xevent.xclient.data.l[3], xevent.xclient.data.l[4]);
908 else if (xevent.xclient.message_type == videodata->
XdndPosition) {
912 if(xdnd_version >= 2) {
913 act = xevent.xclient.data.l[4];
915 printf(
"Action requested by user is : %s\n", X11_XGetAtomName(display , act));
920 memset(&
m, 0,
sizeof(XClientMessageEvent));
921 m.type = ClientMessage;
922 m.display = xevent.xclient.display;
923 m.window = xevent.xclient.data.l[0];
932 X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&
m);
935 else if(xevent.xclient.message_type == videodata->
XdndDrop) {
938 memset(&
m, 0,
sizeof(XClientMessageEvent));
939 m.type = ClientMessage;
940 m.display = xevent.xclient.display;
941 m.window = xevent.xclient.data.l[0];
947 X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&
m);
950 if(xdnd_version >= 1) {
957 else if ((xevent.xclient.message_type == videodata->
WM_PROTOCOLS) &&
958 (xevent.xclient.format == 32) &&
959 (xevent.xclient.data.l[0] == videodata->
_NET_WM_PING)) {
960 Window root = DefaultRootWindow(display);
963 printf(
"window %p: _NET_WM_PING\n", data);
965 xevent.xclient.window = root;
966 X11_XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xevent);
970 else if ((xevent.xclient.message_type == videodata->
WM_PROTOCOLS) &&
971 (xevent.xclient.format == 32) &&
975 printf(
"window %p: WM_DELETE_WINDOW\n", data);
980 else if ((xevent.xclient.message_type == videodata->
WM_PROTOCOLS) &&
981 (xevent.xclient.format == 32) &&
985 printf(
"window %p: WM_TAKE_FOCUS\n", data);
996 printf(
"window %p: Expose (count = %d)\n", data, xevent.xexpose.count);
1006 printf(
"window %p: X11 motion: %d,%d\n", data, xevent.xmotion.x, xevent.xmotion.y);
1015 int xticks = 0, yticks = 0;
1016 #ifdef DEBUG_XEVENTS 1017 printf(
"window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button);
1019 if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) {
1023 int button = xevent.xbutton.button;
1024 if(button == Button1) {
1025 if (ProcessHitTest(
_this, data, &xevent)) {
1030 else if(button > 7) {
1036 const int X11_FOCUS_CLICK_TIMEOUT = 10;
1042 if (!ignore_click) {
1046 X11_UpdateUserTime(data, xevent.xbutton.time);
1050 case ButtonRelease:{
1051 int button = xevent.xbutton.button;
1053 int xticks = 0, yticks = 0;
1054 #ifdef DEBUG_XEVENTS 1055 printf(
"window %p: ButtonRelease (X11 button = %d)\n", data, xevent.xbutton.button);
1057 if (!X11_IsWheelEvent(display, &xevent, &xticks, &yticks)) {
1067 case PropertyNotify:{
1068 #ifdef DEBUG_XEVENTS 1069 unsigned char *propdata;
1070 int status, real_format;
1072 unsigned long items_read, items_left;
1074 char *name = X11_XGetAtomName(display, xevent.xproperty.atom);
1076 printf(
"window %p: PropertyNotify: %s %s time=%lu\n", data, name, (xevent.xproperty.state == PropertyDelete) ?
"deleted" :
"changed", xevent.xproperty.time);
1080 status = X11_XGetWindowProperty(display, data->
xwindow, xevent.xproperty.atom, 0L, 8192L, False, AnyPropertyType, &real_type, &real_format, &items_read, &items_left, &propdata);
1081 if (status == Success && items_read > 0) {
1082 if (real_type == XA_INTEGER) {
1083 int *
values = (
int *)propdata;
1086 for (i = 0; i < items_read; i++) {
1087 printf(
" %d", values[i]);
1090 }
else if (real_type == XA_CARDINAL) {
1091 if (real_format == 32) {
1095 for (i = 0; i < items_read; i++) {
1096 printf(
" %d", values[i]);
1099 }
else if (real_format == 16) {
1103 for (i = 0; i < items_read; i++) {
1104 printf(
" %d", values[i]);
1107 }
else if (real_format == 8) {
1111 for (i = 0; i < items_read; i++) {
1112 printf(
" %d", values[i]);
1116 }
else if (real_type == XA_STRING ||
1118 printf(
"{ \"%s\" }\n", propdata);
1119 }
else if (real_type == XA_ATOM) {
1120 Atom *atoms = (Atom *)propdata;
1123 for (i = 0; i < items_read; i++) {
1124 char *atomname = X11_XGetAtomName(display, atoms[i]);
1126 printf(
" %s", atomname);
1127 X11_XFree(atomname);
1132 char *atomname = X11_XGetAtomName(display, real_type);
1133 printf(
"Unknown type: %ld (%s)\n", real_type, atomname ? atomname :
"UNKNOWN");
1135 X11_XFree(atomname);
1139 if (status == Success) {
1140 X11_XFree(propdata);
1152 data->
user_time = xevent.xproperty.time;
1165 if (flags & SDL_WINDOW_HIDDEN) {
1166 X11_DispatchUnmapNotify(data);
1168 X11_DispatchMapNotify(data);
1173 if (flags & SDL_WINDOW_MAXIMIZED) {
1191 unsigned long nitems, bytes_after;
1192 unsigned char *property;
1193 if (X11_XGetWindowProperty(display, data->
xwindow, videodata->
_NET_FRAME_EXTENTS, 0, 16, 0, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &property) == Success) {
1194 if (type != None && nitems == 4) {
1197 data->
border_top = (int) ((
long*)property)[2];
1200 X11_XFree(property);
1202 #ifdef DEBUG_XEVENTS 1211 case SelectionRequest: {
1212 XSelectionRequestEvent *req;
1215 unsigned long nbytes;
1216 unsigned long overflow;
1217 unsigned char *seln_data;
1219 req = &xevent.xselectionrequest;
1220 #ifdef DEBUG_XEVENTS 1221 printf(
"window %p: SelectionRequest (requestor = %ld, target = %ld)\n", data,
1222 req->requestor, req->target);
1226 sevent.xany.type = SelectionNotify;
1227 sevent.xselection.selection = req->selection;
1228 sevent.xselection.target = None;
1229 sevent.xselection.property = None;
1230 sevent.xselection.requestor = req->requestor;
1231 sevent.xselection.time = req->time;
1233 if (X11_XGetWindowProperty(display, DefaultRootWindow(display),
1235 &sevent.xselection.target, &seln_format, &nbytes,
1236 &overflow, &seln_data) == Success) {
1237 Atom XA_TARGETS = X11_XInternAtom(display,
"TARGETS", 0);
1238 if (sevent.xselection.target == req->target) {
1239 X11_XChangeProperty(display, req->requestor, req->property,
1240 sevent.xselection.target, seln_format, PropModeReplace,
1242 sevent.xselection.property = req->property;
1243 }
else if (XA_TARGETS == req->target) {
1244 Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target };
1245 X11_XChangeProperty(display, req->requestor, req->property,
1246 XA_ATOM, 32, PropModeReplace,
1247 (
unsigned char*)SupportedFormats,
1249 sevent.xselection.property = req->property;
1250 sevent.xselection.target = XA_TARGETS;
1252 X11_XFree(seln_data);
1254 X11_XSendEvent(display, req->requestor, False, 0, &sevent);
1255 X11_XSync(display, False);
1259 case SelectionNotify: {
1260 Atom
target = xevent.xselection.target;
1261 #ifdef DEBUG_XEVENTS 1262 printf(
"window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data,
1263 xevent.xselection.requestor, xevent.xselection.target);
1268 X11_ReadProperty(&p, display, data->
xwindow, videodata->
PRIMARY);
1270 if (p.format == 8) {
1272 char* name = X11_XGetAtomName(display, target);
1273 char *token = strtok((
char *) p.data,
"\r\n");
1274 while (token !=
NULL) {
1277 }
else if (
SDL_strcmp(
"text/uri-list", name)==0) {
1278 char *fn = X11_URIToLocal(token);
1283 token = strtok(
NULL,
"\r\n");
1291 m.type = ClientMessage;
1292 m.display = display;
1299 X11_XSendEvent(display, data->
xdnd_source, False, NoEventMask, (XEvent*)&
m);
1301 X11_XSync(display, False);
1309 case SelectionClear: {
1310 Atom XA_CLIPBOARD = X11_XInternAtom(display,
"CLIPBOARD", 0);
1312 if (xevent.xselectionclear.selection == XA_PRIMARY ||
1313 (XA_CLIPBOARD != None && xevent.xselectionclear.selection == XA_CLIPBOARD)) {
1320 #ifdef DEBUG_XEVENTS 1321 printf(
"window %p: Unhandled event %d\n", data, xevent.type);
1329 X11_HandleFocusChanges(
_THIS)
1341 X11_DispatchFocusIn(
_this, data);
1343 X11_DispatchFocusOut(
_this, data);
1353 X11_Pending(Display * display)
1356 X11_XFlush(display);
1357 if (X11_XEventsQueued(display, QueuedAlready)) {
1363 static struct timeval zero_time;
1367 x11_fd = ConnectionNumber(display);
1369 FD_SET(x11_fd, &fdset);
1370 if (select(x11_fd + 1, &fdset,
NULL,
NULL, &zero_time) == 1) {
1371 return (X11_XPending(display));
1395 X11_XResetScreenSaver(data->
display);
1398 SDL_DBus_ScreensaverTickle();
1406 while (X11_Pending(data->
display)) {
1407 X11_DispatchEvent(
_this);
1417 X11_HandleFocusChanges(
_this);
1424 #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1427 int major_version, minor_version;
1436 SDL_DBus_ScreensaverTickle();
1440 #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1441 if (SDL_X11_HAVE_XSS) {
1443 if (!X11_XScreenSaverQueryExtension(data->
display, &dummy, &dummy) ||
1444 !X11_XScreenSaverQueryVersion(data->
display,
1445 &major_version, &minor_version) ||
1446 major_version < 1 || (major_version == 1 && minor_version < 1)) {
1451 X11_XResetScreenSaver(data->
display);
void SDL_IME_SetFocus(SDL_bool focused)
void X11_PumpEvents(_THIS)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
SDL_Mouse * SDL_GetMouse(void)
void SDL_SetKeyboardFocus(SDL_Window *window)
Uint32 X11_GetNetWMState(_THIS, Window xwindow)
GLint GLint GLint GLint GLint x
SDL_bool relative_mode_warp
GLuint GLuint GLsizei count
int SDL_SendDropFile(SDL_Window *window, const char *file)
struct wl_display * display
static SDL_Window * window
The structure that defines a point.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void SDL_IME_UpdateTextRect(SDL_Rect *rect)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
SDL_WindowData ** windowlist
SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
GLuint const GLchar * name
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
void SDL_SetMouseFocus(SDL_Window *window)
#define SDL_GetKeyboardFocus
uint32_t Uint32
An unsigned 32-bit integer type.
union SDL_SysWMmsg::@16 msg
SDL_bool selection_waiting
int SDL_SendDropComplete(SDL_Window *window)
int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
#define SDL_GetHintBoolean
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
static SDL_VideoDevice * _this
SDL_HitTestResult
Possible return values from the SDL_HitTest callback.
GLuint GLuint GLsizei GLenum type
Uint32 screensaver_activity
Uint32 pending_focus_time
int SDL_SendDropText(SDL_Window *window, const char *text)
#define SDL_GetEventState(type)
void X11_SuspendScreenSaver(_THIS)
GLint GLint GLint GLint GLint GLint y
KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group)
int SDL_SendMouseMotion(SDL_Window *window, SDL_MouseID mouseID, int relative, int x, int y)
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
struct SDL_VideoData * videodata
int SDL_SendClipboardUpdate(void)
uint8_t Uint8
An unsigned 8-bit integer type.
int SDL_SendKeyboardText(const char *text)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
GLenum GLsizei GLsizei GLint * values
void X11_UpdateKeymap(_THIS)
GLenum GLuint GLenum GLsizei const GLchar * buf
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
void SDL_IME_PumpEvents()
void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
Atom X11_GetSDLCutBufferClipboardType(Display *display)
static char text[MAX_TEXT_LENGTH]
struct SDL_SysWMmsg::@16::@17 x11
int SDL_SendKeymapChangedEvent(void)
#define PENDING_FOCUS_TIME
The type used to identify a window.
uint16_t Uint16
An unsigned 16-bit integer type.
XConfigureEvent last_xconfigure
SDL_bool suspend_screensaver
#define SDL_arraysize(array)
int SDL_SendMouseWheel(SDL_Window *window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction)
Uint32 last_focus_event_time
#define SDL_TEXTINPUTEVENT_TEXT_SIZE
GLubyte GLubyte GLubyte GLubyte w
Uint32 last_mode_change_deadline
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH
Allow mouse click events when clicking to focus an SDL window.
PendingFocusEnum pending_focus
int SDL_SendMouseButton(SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
SDL_Scancode
The SDL keyboard scancode representation.