* Flash the visible region. Useful for debugging.
*/
void
-FlashRegion(dpy, s, gc)
- Display *dpy;
- int s;
- GC gc;
+FlashRegion(Display *dpy, int s, GC gc)
{
XEvent e;
Bool done = False;
void
-FlashDropSites(dpy)
- Display *dpy;
+FlashDropSites(Display *dpy)
{
drop_site_t *site = MasterSiteList;
XGCValues gcv;
*/
#ifdef oldcode
void *
+GetInterestProperty(Display *dpy, Window win, int *nitems)
#else
unsigned char *
-#endif
-GetInterestProperty(dpy, win, nitems)
- Display *dpy;
- Window win;
-#ifdef oldcode
- int *nitems;
-#else
- unsigned long *nitems;
+GetInterestProperty(Display *dpy, Window win, unsigned long *nitems)
#endif
{
Status s;
* children of this window are searched.
*/
Bool
-FindRecursively(dpy, root, win, pwin, psite, plen, px, py)
- Display *dpy;
- Window root, win, *pwin;
- void **psite;
- unsigned long *plen;
- int *px, *py;
+FindRecursively(Display *dpy, Window root, Window win, Window *pwin, void **psite, unsigned long *plen, int *px, int *py)
{
XWindowAttributes attr;
Window junk;
*/
Bool
#ifdef oldcode
-SearchChildren(dpy, root, win, pwin, psite, plen, px, py)
- Display *dpy;
- Window root, win, *pwin;
- void **psite;
- unsigned long *plen;
- int *px, *py;
+SearchChildren(Display *dpy, Window root, Window win, Window *pwin, void **psite, unsigned long *plen, int *px, int *py)
#else
-SearchChildren(dpy, root, win, pwin, psite, plen, px, py, from_FindRec)
- Display *dpy;
- Window root, win, *pwin;
- void **psite;
- unsigned long *plen;
- int *px, *py;
- Bool from_FindRec;
+SearchChildren(Display *dpy, Window root, Window win, Window *pwin, void **psite, unsigned long *plen, int *px, int *py, Bool from_FindRec)
#endif
{
Window junk;
* Create and return a region that contains a given rectangle.
*/
Region
-MakeRegionFromRect(x, y, w, h)
- int x, y;
- unsigned int w, h;
+MakeRegionFromRect(int x, int y, unsigned int w, unsigned int h)
{
XRectangle r;
Region reg;
* corner is at (0,0).
*/
Region
-GetWindowRegion(dpy, win, offset)
- Display *dpy;
- Window win;
- Bool offset;
+GetWindowRegion(Display *dpy, Window win, Bool offset)
{
Window wjunk;
int x, y;
* Subtract the area of a window from the current visible region.
*/
void
-SubtractWindowFromVisibleRegion(dpy, win, visrgn)
- Display *dpy;
- Window win;
- Region visrgn;
+SubtractWindowFromVisibleRegion(Display *dpy, Window win, Region visrgn)
{
Region winrgn = GetWindowRegion(dpy, win, True);
XSubtractRegion(visrgn, winrgn, visrgn);
* forwarding information to the site database.
*/
void
-FindDropSites(dpy)
- Display *dpy;
+FindDropSites(Display *dpy)
{
#ifdef oldcode
int s, i, nchildren;
void
-FreeDropSites()
+FreeDropSites(void)
{
drop_site_t *next, *temp;
* 8k+7 flags
*/
void
-WriteSiteRectList(dpy, win, prop)
- Display *dpy;
- Window win;
- Atom prop;
+WriteSiteRectList(Display *dpy, Window win, Atom prop)
{
unsigned long *cur;
unsigned long *array;
* site database. REMIND: more robust error handling is called for.
*/
int
-ErrorHandler(dpy, error)
- Display *dpy;
- XErrorEvent *error;
+ErrorHandler(Display *dpy, XErrorEvent *error)
{
if ( (error->error_code == BadWindow ||
error->error_code == BadDrawable) &&
} /* end of ErrorHandler */
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
enum { XA_SUN_DRAGDROP_DSDM, XA_SUN_DRAGDROP_INTEREST,
XA_SUN_DRAGDROP_SITE_RECTS, XAWM_STATE, NUM_ATOMS };
#endif
}
} /* end of main */
+
char motif_byte_order;
void
-InitializeByteOrder()
+InitializeByteOrder(void)
{
unsigned int endian = 1;
}
/* swap 2 bytes of data if the byte order is different */
-Swap2Bytes(byte_order, data)
- char byte_order;
- CARD16 data;
+int
+Swap2Bytes(char byte_order, CARD16 data)
{
static CARD16 ret_data;
char *old_p = (char *) &data;
}
/* swap 4 bytes of data if the byte order is different */
-Swap4Bytes(byte_order, data)
- char byte_order;
- CARD32 data;
+int
+Swap4Bytes(char byte_order, CARD32 data)
{
static CARD32 ret_data;
char *old_p = (char *) &data;
/* Get a new drop record */
/* use source_handle to indicate whether record is free or in use */
static drop_info_t *
-NewDropInfo()
+NewDropInfo(void)
{
int i, oldest_index=0;
/* Search for a drop record */
/* use source_handle as the key to the drop_info record */
static drop_info_t *
-GetDropInfo(proxy_sel_req_win)
- Window proxy_sel_req_win;
+GetDropInfo(Window proxy_sel_req_win)
{
int i;
/* Search for a drop record using the proxy_handle as the key */
static drop_info_t *
-GetDropInfoUsingProxyHandle(proxy_handle)
- Atom proxy_handle;
+GetDropInfoUsingProxyHandle(Atom proxy_handle)
{
int i;
/* Delete a drop record */
static void
-ClearDropInfo(proxy_handle)
- Atom proxy_handle;
+ClearDropInfo(Atom proxy_handle)
{
int i;
for(i=0; i<DROP_TABLE_MAX; i++)
/* get the window that has the atom associated with it */
Window
-GetAtomWindow(dpy, win, atom)
- Display *dpy;
- Window win;
- Atom atom;
+GetAtomWindow(Display *dpy, Window win, Atom atom)
{
Window root, parent;
Window *children;
/* get the window that is a property of the inputed window */
Window
-GetPropertyWindow(dpy, in_win, atom)
- Display *dpy;
- Window in_win;
- Atom atom;
+GetPropertyWindow(Display *dpy, Window in_win, Atom atom)
{
Atom type;
int format;
/* startup initialization */
void
-ProxyInit(dpy, dsdm_win)
- Display *dpy;
- Window dsdm_win;
+ProxyInit(Display *dpy, Window dsdm_win)
{
enum { XA_MOTIF_DRAG_WINDOW, XA_MOTIF_DRAG_PROXY_WINDOW,
XA_MOTIF_DRAG_AND_DROP_MESSAGE,
/* Place the motif receiver property on the Openlook receiver's top
level window */
int
-AdvertiseMotifDropSite(dpy, win)
- Display *dpy;
- Window win;
+AdvertiseMotifDropSite(Display *dpy, Window win)
{
motif_receiver_t receiver_info;
unsigned long nitems;
/* Determine if the drop coordinate is within a rectangle */
static char
-InRect(drop_x, drop_y, x, y, width, height)
- int drop_x, drop_y, x, y;
- unsigned int width, height;
+InRect(int drop_x, int drop_y, int x, int y, unsigned int width, unsigned int height)
{
if ((drop_x >= x) && (drop_x <= (x+width)) &&
(drop_y >= y) && (drop_y <= (y+height)))
/* get the drop site given the window and coordinate */
static void
-GetOlitDropSite(dpy, top_level_win, drop_x, drop_y, ret_site_id, ret_event_win)
- Display *dpy;
- Window top_level_win;
- INT16 drop_x, drop_y;
- unsigned long *ret_site_id;
- Window *ret_event_win;
+GetOlitDropSite(Display *dpy, Window top_level_win, INT16 drop_x, INT16 drop_y,
+ unsigned long *ret_site_id, Window *ret_event_win)
{
unsigned long *data, nitems, version, nsites, event_win, site_id, flags;
unsigned long areatype, nrects, areawin;
/* translate an OLIT operation to a Motif operation */
static CARD16
-ConvertOlitAction(olit_action)
- CARD32 olit_action;
+ConvertOlitAction(CARD32 olit_action)
{
CARD16 motif_action;
/* translate a Motif operation to an OLIT operation */
static CARD32
-ConvertMotifAction(motif_action)
- CARD16 motif_action;
+ConvertMotifAction(CARD16 motif_action)
{
CARD32 olit_action;
/* Process Motif ClientMessage */
void
-HandleMotifMessage(dpy, event)
- Display *dpy;
- XClientMessageEvent *event;
+HandleMotifMessage(Display *dpy, XClientMessageEvent *event)
{
motif_drop_start_t info;
drop_info_t *drop_info;
/* Process OLIT ClientMessage */
static void
-HandleOlitTrigger(dpy, event)
- Display *dpy;
- XClientMessageEvent *event;
+HandleOlitTrigger(Display *dpy, XClientMessageEvent *event)
{
drop_site_t *site;
char success = False;
/* Place the Motif initiator property on the initiator's top level window */
static void
-UpdateInitiatorAtom(dpy, win, channel, targets_index)
- Display *dpy;
- Window win;
- Atom channel;
- CARD16 targets_index;
+UpdateInitiatorAtom(Display *dpy, Window win, Atom channel, CARD16 targets_index)
{
motif_initiator_t initiator_info;
/* Send Motif DROP_START ClientMessage to receiver */
void
-SendStartDrop(dpy, src_win, drop_info)
- Display *dpy;
- Window src_win;
- drop_info_t *drop_info;
+SendStartDrop(Display *dpy, Window src_win, drop_info_t *drop_info)
{
motif_drop_start_t info;
XClientMessageEvent event;
/* Compare data of type Atom */
static int
-AtomCompare(atom1, atom2)
- Atom *atom1, *atom2;
+AtomCompare(const void *a1, const void *a2)
{
+ const Atom *atom1 = a1;
+ const Atom *atom2 = a2;
+
return(*atom1 - *atom2);
}
/* Get the Motif TARGETS */
static void
-GetTargetsList(dpy, targets_list_p)
- Display *dpy;
- motif_targets_t **targets_list_p;
+GetTargetsList(Display *dpy, motif_targets_t **targets_list_p)
{
motif_targets_t *targets_list;
Atom type;
}
static void
-MatchTargets(targets_list, atoms, atom_cnt, targets_index_p)
- motif_targets_t *targets_list;
- Atom *atoms;
- unsigned long atom_cnt;
- CARD16 *targets_index_p;
+MatchTargets(motif_targets_t *targets_list, Atom *atoms, unsigned long atom_cnt, CARD16 *targets_index_p)
{
int target_index;
CARD32 *data;
/* Put OLIT targets on the Motif TARGETS targets list */
static void
-GetTargetsIndex(dpy, in_data, atom_cnt, targets_index_p)
- Display *dpy;
- unsigned char *in_data;
- unsigned long atom_cnt;
- CARD16 *targets_index_p; /* RETURN */
+GetTargetsIndex(Display *dpy, unsigned char *in_data, unsigned long atom_cnt, CARD16 *targets_index_p)
{
Atom *atoms = (Atom *) in_data;
motif_targets_t *new_list, *targets_list;
* send DROP_START message to motif receiver
*/
static void
-ContinueHandleOlitTrigger(dpy, data, length, drop_info)
- Display *dpy;
- unsigned char *data;
- unsigned long length;
- drop_info_t *drop_info;
+ContinueHandleOlitTrigger(Display *dpy, unsigned char *data, unsigned long length, drop_info_t *drop_info)
{
CARD16 targets_index;
Window psuedo_motif_initiator_win;
/* Get OLIT initiator's TARGETS */
void
-ProcessOlitInitiatorConversion(event, drop_info)
- XSelectionEvent *event;
- drop_info_t *drop_info;
+ProcessOlitInitiatorConversion(XSelectionEvent *event, drop_info_t *drop_info)
{
Atom type;
int format;
/* copy a property and the associated data from one window to another.
Returns True if successful else returns False */
static int
-CopyProperty(dpy, property, old_win, new_win)
- Display *dpy;
- Atom property;
- Window old_win, new_win;
+CopyProperty(Display *dpy, Atom property, Window old_win, Window new_win)
{
Atom type;
int format;
from one window to another.
Returns True if we get ATOM_SUN_DND_DONE or ATOM_SUN_SELECTION_END */
static int
-CopyTargets(dpy, prop, old_win, new_win)
- Display *dpy;
- Atom prop;
- Window old_win, new_win;
+CopyTargets(Display *dpy, Atom prop, Window old_win, Window new_win)
{
Atom type;
int format;
/* Forward the SelectionNotify to the receiver.
Returns True if we get ATOM_SUN_DND_DONE or ATOM_SUN_SELECTION_END */
static
-ForwardConversion(event, drop_info)
- XSelectionEvent *event;
- drop_info_t *drop_info;
+ForwardConversion(XSelectionEvent *event, drop_info_t *drop_info)
{
int ol_done = False;
the target data and places this info in a property on window A.
*/
void
-ForwardMultpleSelectionRequest(event, drop_info)
- XSelectionRequestEvent *event;
- drop_info_t *drop_info;
+ForwardMultpleSelectionRequest(XSelectionRequestEvent *event, drop_info_t *drop_info)
{
int format, status;
unsigned long length, bytes_after;
/* tell the initiator to clean up and do internal cleanup */
void
-DndDone(dpy, status, drop_info)
- Display *dpy;
- Atom status;
- drop_info_t *drop_info;
+DndDone(Display *dpy, Atom status, drop_info_t *drop_info)
{
XConvertSelection(dpy,
drop_info->source_handle,
}
void
-ProxyMain(dpy, event)
- Display *dpy;
- XEvent *event;
+ProxyMain(Display *dpy, XEvent *event)
{
switch(event->type) {
case ClientMessage:
(event->xselection.property == ATOM_SUN_DND_ACK)) {
ProcessOlitInitiatorConversion(&event->xselection, drop_info);
} else {
- if (ForwardConversion(event, drop_info)) {
+ if (ForwardConversion(&event->xselection, drop_info)) {
/* We are here ONLY if the target is ATOM_MULTIPLE and
* the target list contains either _SUN_DRAGDROP_DONE or
} /* end of case SelectionNotify */
} /* end of switch */
}
+