annotate gui/wm/wsxdnd.c @ 26557:bced0f27c9a5

Remove unnecessary dependency declaration.
author diego
date Tue, 29 Apr 2008 07:00:27 +0000
parents b0a7b35b78d2
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * WindowMaker implementation adopted for MPlayer
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
19 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include <X11/Xlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22 #include "ws.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23 #include "wsxdnd.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
28
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29 #include <X11/Xatom.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 25619
diff changeset
31 #include "mp_msg.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 25619
diff changeset
32 #include "help_mp.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34 #define XDND_VERSION 3L
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
36 Atom XA_XdndAware;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
37 Atom XA_XdndEnter;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
38 Atom XA_XdndLeave;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
39 Atom XA_XdndDrop;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
40 Atom XA_XdndPosition;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
41 Atom XA_XdndStatus;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
42 Atom XA_XdndActionCopy;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
43 Atom XA_XdndSelection;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
44 Atom XA_XdndFinished;
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
45 Atom XA_XdndTypeList;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 Atom atom_support;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 void wsXDNDInitialize(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
52 XA_XdndAware = XInternAtom(wsDisplay, "XdndAware", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
53 XA_XdndEnter = XInternAtom(wsDisplay, "XdndEnter", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
54 XA_XdndLeave = XInternAtom(wsDisplay, "XdndLeave", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
55 XA_XdndDrop = XInternAtom(wsDisplay, "XdndDrop", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
56 XA_XdndPosition = XInternAtom(wsDisplay, "XdndPosition", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
57 XA_XdndStatus = XInternAtom(wsDisplay, "XdndStatus", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
58 XA_XdndActionCopy = XInternAtom(wsDisplay, "XdndActionCopy", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
59 XA_XdndSelection = XInternAtom(wsDisplay, "XdndSelection", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
60 XA_XdndFinished = XInternAtom(wsDisplay, "XdndFinished", False);
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
61 XA_XdndTypeList = XInternAtom(wsDisplay, "XdndTypeList", False);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 void wsXDNDMakeAwareness(wsTWindow* window) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 long int xdnd_version = XDND_VERSION;
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
66 XChangeProperty (wsDisplay, window->WindowID, XA_XdndAware, XA_ATOM,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 32, PropModeAppend, (char *)&xdnd_version, 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 void wsXDNDClearAwareness(wsTWindow* window) {
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
71 XDeleteProperty (wsDisplay, window->WindowID, XA_XdndAware);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 #define MAX_DND_FILES 64
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 Bool
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 wsXDNDProcessSelection(wsTWindow* wnd, XEvent *event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 Atom ret_type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 int ret_format;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 unsigned long ret_items;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 unsigned long remain_byte;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 char * delme;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 XEvent xevent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
85 Window selowner = XGetSelectionOwner(wsDisplay,XA_XdndSelection);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 XGetWindowProperty(wsDisplay, event->xselection.requestor,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 event->xselection.property,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 0, 65536, True, atom_support, &ret_type, &ret_format,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 &ret_items, &remain_byte, (unsigned char **)&delme);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 /*send finished*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 memset (&xevent, 0, sizeof(xevent));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 xevent.xany.type = ClientMessage;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 xevent.xany.display = wsDisplay;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 xevent.xclient.window = selowner;
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
97 xevent.xclient.message_type = XA_XdndFinished;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 xevent.xclient.format = 32;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 XDND_FINISHED_TARGET_WIN(&xevent) = wnd->WindowID;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 XSendEvent(wsDisplay, selowner, 0, 0, &xevent);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 if (!delme){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_WS_DDNothing );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 return False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 /* Handle dropped files */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 char * retain = delme;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 char * files[MAX_DND_FILES];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 int num = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 while(retain < delme + ret_items) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 if (!strncmp(retain,"file:",5)) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 /* add more 2 chars while removing 5 is harmless */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116 retain+=5;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 /* add the "retain" to the list */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 files[num++]=retain;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123 /* now check for special characters */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 int newone = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 while(retain < (delme + ret_items)){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 if(*retain == '\r' || *retain == '\n'){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 *retain=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 newone = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 if (newone)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 retain++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 if (num >= MAX_DND_FILES)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 /* Handle the files */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 if(wnd->DandDHandler){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 wnd->DandDHandler(num,files);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 free(delme);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 Bool
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 wsXDNDProcessClientMessage(wsTWindow* wnd, XClientMessageEvent *event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 /* test */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 /*{
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 char * name = XGetAtomName(wsDisplay, event->message_type);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 printf("Got %s\n",name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 XFree(name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 }*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
162 if (event->message_type == XA_XdndEnter) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 Atom ok = XInternAtom(wsDisplay, "text/uri-list", False);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164 atom_support = None;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 if ((event->data.l[1] & 1) == 0){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 int index;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 for(index = 0; index <= 2 ; index++){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 if (event->data.l[2+index] == ok) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 atom_support = ok;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 if (atom_support == None) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_WS_NotAFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 /* need to check the whole list here */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 unsigned long ret_left = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 int offset = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 Atom* ret_buff;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 Atom ret_type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 int ret_format;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 unsigned long ret_items;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 /* while there is data left...*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 while(ret_left && atom_support == None){
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
186 XGetWindowProperty(wsDisplay,event->data.l[0],XA_XdndTypeList,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 offset,256,False,XA_ATOM,&ret_type,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188 &ret_format,&ret_items,&ret_left,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189 (unsigned char**)&ret_buff);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 /* sanity checks...*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 if(ret_buff == NULL || ret_type != XA_ATOM || ret_format != 8*sizeof(Atom)){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 XFree(ret_buff);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 /* now chek what we've got */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 for(i=0; i<ret_items; i++){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 if(ret_buff[i] == ok){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 atom_support = ok;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 /* maybe next time ... */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 XFree(ret_buff);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 offset += 256;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
214 if (event->message_type == XA_XdndLeave) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
218 if (event->message_type == XA_XdndDrop) {
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
219 if (event->data.l[0] != XGetSelectionOwner(wsDisplay, XA_XdndSelection)){
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 puts("Wierd selection owner... QT?");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 if (atom_support != None) {
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
223 XConvertSelection(wsDisplay, XA_XdndSelection, atom_support,
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
224 XA_XdndSelection, event->window,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 CurrentTime);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
230 if (event->message_type == XA_XdndPosition) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 Window srcwin = event->data.l[0];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 if (atom_support == None){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 /* send response */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 XEvent xevent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 memset (&xevent, 0, sizeof(xevent));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 xevent.xany.type = ClientMessage;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 xevent.xany.display = wsDisplay;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242 xevent.xclient.window = srcwin;
25619
20f549053410 Fix illegal identifier, names starting with _ and uppercase are reserved.
diego
parents: 23077
diff changeset
243 xevent.xclient.message_type = XA_XdndStatus;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 xevent.xclient.format = 32;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 XDND_STATUS_TARGET_WIN (&xevent) = event->window;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 XDND_STATUS_WILL_ACCEPT_SET (&xevent, True);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 XDND_STATUS_WANT_POSITION_SET(&xevent, True);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 /* actually need smth real here */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 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
251 XDND_STATUS_ACTION(&xevent) = XA_XdndActionCopy;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 XSendEvent(wsDisplay, srcwin, 0, 0, &xevent);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 return False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 }