annotate gui/wm/wsxdnd.c @ 26189:8d1e8229b660

Try to fix the description of what mbcmp influences, please fix if I misunderstood the code.
author reimar
date Tue, 11 Mar 2008 10:03:25 +0000
parents 20f549053410
children b2f4abcf20ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1 /* Took WindowMaker implementation and adopted for MPlayer */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
2
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
3
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
4 #include <X11/Xlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
5 #include "ws.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
6 #include "wsxdnd.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
7
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
8 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
9 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
10 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
11
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
12 #include <X11/Xatom.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
13
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
14 #include "../mp_msg.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
15 #include "../help_mp.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
16
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
17 #define XDND_VERSION 3L
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
19 Atom XA_XdndAware;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
20 Atom XA_XdndEnter;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
21 Atom XA_XdndLeave;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
22 Atom XA_XdndDrop;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
23 Atom XA_XdndPosition;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
24 Atom XA_XdndStatus;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
25 Atom XA_XdndActionCopy;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
26 Atom XA_XdndSelection;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
27 Atom XA_XdndFinished;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
28 Atom XA_XdndTypeList;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30 Atom atom_support;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
31
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
32 void wsXDNDInitialize(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
35 XA_XdndAware = XInternAtom(wsDisplay, "XdndAware", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
36 XA_XdndEnter = XInternAtom(wsDisplay, "XdndEnter", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
37 XA_XdndLeave = XInternAtom(wsDisplay, "XdndLeave", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
38 XA_XdndDrop = XInternAtom(wsDisplay, "XdndDrop", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
39 XA_XdndPosition = XInternAtom(wsDisplay, "XdndPosition", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
40 XA_XdndStatus = XInternAtom(wsDisplay, "XdndStatus", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
41 XA_XdndActionCopy = XInternAtom(wsDisplay, "XdndActionCopy", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
42 XA_XdndSelection = XInternAtom(wsDisplay, "XdndSelection", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
43 XA_XdndFinished = XInternAtom(wsDisplay, "XdndFinished", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
44 XA_XdndTypeList = XInternAtom(wsDisplay, "XdndTypeList", False);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 void wsXDNDMakeAwareness(wsTWindow* window) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48 long int xdnd_version = XDND_VERSION;
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
49 XChangeProperty (wsDisplay, window->WindowID, XA_XdndAware, XA_ATOM,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 32, PropModeAppend, (char *)&xdnd_version, 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 void wsXDNDClearAwareness(wsTWindow* window) {
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
54 XDeleteProperty (wsDisplay, window->WindowID, XA_XdndAware);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 #define MAX_DND_FILES 64
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 Bool
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 wsXDNDProcessSelection(wsTWindow* wnd, XEvent *event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 Atom ret_type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 int ret_format;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 unsigned long ret_items;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 unsigned long remain_byte;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 char * delme;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 XEvent xevent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
68 Window selowner = XGetSelectionOwner(wsDisplay,XA_XdndSelection);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 XGetWindowProperty(wsDisplay, event->xselection.requestor,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 event->xselection.property,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 0, 65536, True, atom_support, &ret_type, &ret_format,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 &ret_items, &remain_byte, (unsigned char **)&delme);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 /*send finished*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 memset (&xevent, 0, sizeof(xevent));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 xevent.xany.type = ClientMessage;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 xevent.xany.display = wsDisplay;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 xevent.xclient.window = selowner;
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
80 xevent.xclient.message_type = XA_XdndFinished;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 xevent.xclient.format = 32;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 XDND_FINISHED_TARGET_WIN(&xevent) = wnd->WindowID;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 XSendEvent(wsDisplay, selowner, 0, 0, &xevent);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 if (!delme){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_WS_DDNothing );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 return False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 /* Handle dropped files */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 char * retain = delme;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 char * files[MAX_DND_FILES];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 int num = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 while(retain < delme + ret_items) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 if (!strncmp(retain,"file:",5)) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 /* add more 2 chars while removing 5 is harmless */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 retain+=5;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 /* add the "retain" to the list */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 files[num++]=retain;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 /* now check for special characters */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 int newone = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 while(retain < (delme + ret_items)){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 if(*retain == '\r' || *retain == '\n'){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 *retain=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112 newone = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 if (newone)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 retain++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 if (num >= MAX_DND_FILES)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 /* Handle the files */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 if(wnd->DandDHandler){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 wnd->DandDHandler(num,files);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 free(delme);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 Bool
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 wsXDNDProcessClientMessage(wsTWindow* wnd, XClientMessageEvent *event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 /* test */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 /*{
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 char * name = XGetAtomName(wsDisplay, event->message_type);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 printf("Got %s\n",name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 XFree(name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 }*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
145 if (event->message_type == XA_XdndEnter) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 Atom ok = XInternAtom(wsDisplay, "text/uri-list", False);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 atom_support = None;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 if ((event->data.l[1] & 1) == 0){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 int index;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 for(index = 0; index <= 2 ; index++){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 if (event->data.l[2+index] == ok) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 atom_support = ok;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 if (atom_support == None) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_WS_NotAFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 /* need to check the whole list here */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 unsigned long ret_left = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 int offset = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 Atom* ret_buff;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 Atom ret_type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164 int ret_format;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 unsigned long ret_items;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 /* while there is data left...*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 while(ret_left && atom_support == None){
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
169 XGetWindowProperty(wsDisplay,event->data.l[0],XA_XdndTypeList,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 offset,256,False,XA_ATOM,&ret_type,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 &ret_format,&ret_items,&ret_left,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 (unsigned char**)&ret_buff);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 /* sanity checks...*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 if(ret_buff == NULL || ret_type != XA_ATOM || ret_format != 8*sizeof(Atom)){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 XFree(ret_buff);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 /* now chek what we've got */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 for(i=0; i<ret_items; i++){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 if(ret_buff[i] == ok){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 atom_support = ok;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189 /* maybe next time ... */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190 XFree(ret_buff);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 offset += 256;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
197 if (event->message_type == XA_XdndLeave) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
201 if (event->message_type == XA_XdndDrop) {
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
202 if (event->data.l[0] != XGetSelectionOwner(wsDisplay, XA_XdndSelection)){
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 puts("Wierd selection owner... QT?");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 if (atom_support != None) {
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
206 XConvertSelection(wsDisplay, XA_XdndSelection, atom_support,
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
207 XA_XdndSelection, event->window,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 CurrentTime);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
213 if (event->message_type == XA_XdndPosition) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 Window srcwin = event->data.l[0];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 if (atom_support == None){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 /* send response */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 XEvent xevent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 memset (&xevent, 0, sizeof(xevent));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 xevent.xany.type = ClientMessage;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 xevent.xany.display = wsDisplay;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 xevent.xclient.window = srcwin;
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
226 xevent.xclient.message_type = XA_XdndStatus;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 xevent.xclient.format = 32;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 XDND_STATUS_TARGET_WIN (&xevent) = event->window;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 XDND_STATUS_WILL_ACCEPT_SET (&xevent, True);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 XDND_STATUS_WANT_POSITION_SET(&xevent, True);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 /* actually need smth real here */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 XDND_STATUS_RECT_SET(&xevent, 0, 0, 1024,768);
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
234 XDND_STATUS_ACTION(&xevent) = XA_XdndActionCopy;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 XSendEvent(wsDisplay, srcwin, 0, 0, &xevent);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 return False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242 }