1 /*
2  * This file is part of MPlayer.
3  *
4  * MPlayer is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * MPlayer is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * based on: WindowMaker implementation,
19  *           adopted for MPlayer
20  */
21 
22 #ifndef MPLAYER_GUI_WSXDND_H
23 #define MPLAYER_GUI_WSXDND_H
24 
25 #include "ws.h"
26 
27 void wsXDNDInitialize(void);
28 Bool wsXDNDProcessSelection(wsWindow* win,XEvent *event);
29 Bool wsXDNDProcessClientMessage(XClientMessageEvent *event);
30 void wsXDNDMakeAwareness(wsWindow* win);
31 void wsXDNDClearAwareness(wsWindow* win);
32 
33 /* header was ripped from xdnd's example on its page */
34 
35 #define XDND_THREE 3
36 #define XDND_ENTER_SOURCE_WIN(e)        ((e)->xclient.data.l[0])
37 #define XDND_ENTER_THREE_TYPES(e)       (((e)->xclient.data.l[1] & 0x1UL) == 0)
38 #define XDND_ENTER_THREE_TYPES_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
39 #define XDND_ENTER_VERSION(e)           ((e)->xclient.data.l[1] >> 24)
40 #define XDND_ENTER_VERSION_SET(e,v)     (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~(0xFF << 24)) | ((v) << 24)
41 #define XDND_ENTER_TYPE(e,i)            ((e)->xclient.data.l[2 + (i)])  /* i => (0, 1, 2) */
42 
43 /* XdndPosition */
44 #define XDND_POSITION_SOURCE_WIN(e)     ((e)->xclient.data.l[0])
45 #define XDND_POSITION_ROOT_X(e)         ((e)->xclient.data.l[2] >> 16)
46 #define XDND_POSITION_ROOT_Y(e)         ((e)->xclient.data.l[2] & 0xFFFFUL)
47 #define XDND_POSITION_ROOT_SET(e,x,y)   (e)->xclient.data.l[2]  = ((x) << 16) | ((y) & 0xFFFFUL)
48 #define XDND_POSITION_TIME(e)           ((e)->xclient.data.l[3])
49 #define XDND_POSITION_ACTION(e)         ((e)->xclient.data.l[4])
50 
51 /* XdndStatus */
52 #define XDND_STATUS_TARGET_WIN(e)       ((e)->xclient.data.l[0])
53 #define XDND_STATUS_WILL_ACCEPT(e)      ((e)->xclient.data.l[1] & 0x1L)
54 #define XDND_STATUS_WILL_ACCEPT_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
55 #define XDND_STATUS_WANT_POSITION(e)    ((e)->xclient.data.l[1] & 0x2UL)
56 #define XDND_STATUS_WANT_POSITION_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x2UL) | (((b) == 0) ? 0 : 0x2UL)
57 #define XDND_STATUS_RECT_X(e)           ((e)->xclient.data.l[2] >> 16)
58 #define XDND_STATUS_RECT_Y(e)           ((e)->xclient.data.l[2] & 0xFFFFL)
59 #define XDND_STATUS_RECT_WIDTH(e)       ((e)->xclient.data.l[3] >> 16)
60 #define XDND_STATUS_RECT_HEIGHT(e)      ((e)->xclient.data.l[3] & 0xFFFFL)
61 #define XDND_STATUS_RECT_SET(e,x,y,w,h) {(e)->xclient.data.l[2] = ((x) << 16) | ((y) & 0xFFFFUL); (e)->xclient.data.l[3] = ((w) << 16) | ((h) & 0xFFFFUL); }
62 #define XDND_STATUS_ACTION(e)           ((e)->xclient.data.l[4])
63 
64 /* XdndLeave */
65 #define XDND_LEAVE_SOURCE_WIN(e)        ((e)->xclient.data.l[0])
66 
67 /* XdndDrop */
68 #define XDND_DROP_SOURCE_WIN(e)         ((e)->xclient.data.l[0])
69 #define XDND_DROP_TIME(e)               ((e)->xclient.data.l[2])
70 
71 /* XdndFinished */
72 #define XDND_FINISHED_TARGET_WIN(e)     ((e)->xclient.data.l[0])
73 
74 #endif /* MPLAYER_GUI_WSXDND_H */
75