From owner-freebsd-ports@FreeBSD.ORG Tue Oct 4 04:16:57 2005 Return-Path: X-Original-To: freebsd-ports@freebsd.org Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2CF0816A41F for ; Tue, 4 Oct 2005 04:16:57 +0000 (GMT) (envelope-from glewis@eyesbeyond.com) Received: from misty.eyesbeyond.com (glewis.dsl.xmission.com [166.70.56.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E71843D45 for ; Tue, 4 Oct 2005 04:16:54 +0000 (GMT) (envelope-from glewis@eyesbeyond.com) Received: from misty.eyesbeyond.com (localhost.eyesbeyond.com [127.0.0.1]) by misty.eyesbeyond.com (8.13.3/8.13.3) with ESMTP id j944Ghx8058166; Mon, 3 Oct 2005 22:16:43 -0600 (MDT) (envelope-from glewis@eyesbeyond.com) Received: (from glewis@localhost) by misty.eyesbeyond.com (8.13.3/8.13.3/Submit) id j944Gg2u058165; Mon, 3 Oct 2005 22:16:42 -0600 (MDT) (envelope-from glewis@eyesbeyond.com) X-Authentication-Warning: misty.eyesbeyond.com: glewis set sender to glewis@eyesbeyond.com using -f Date: Mon, 3 Oct 2005 22:16:42 -0600 From: Greg Lewis To: Mike Hunter Message-ID: <20051004041642.GA58118@misty.eyesbeyond.com> References: <20050928190349.GA72194@malcolm.berkeley.edu> <20050928194514.GA20631@misty.eyesbeyond.com> <20051001001910.GA37857@malcolm.berkeley.edu> <20051003154132.GA52761@misty.eyesbeyond.com> <20051004002656.GA4713@malcolm.berkeley.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline In-Reply-To: <20051004002656.GA4713@malcolm.berkeley.edu> User-Agent: Mutt/1.4.2.1i Cc: freebsd-ports@freebsd.org Subject: Re: Java (jdk1.5) woes with firefox (1.0.6) and opera (8.5) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2005 04:16:57 -0000 --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Oct 03, 2005 at 05:26:56PM -0700, Mike Hunter wrote: > On Oct 03, "Greg Lewis" wrote: > > Hmmm. Try upgrading both of these. I'd try open-motif first (its > > currently at 2.2.3_2) and then xorg (currently at 6.82). Let me know if > > either of these makes any difference. > > Tried open-motif, didn't help. The port has a WITH_JDK_PATCH knob that I > can't figure out what to do with, anybody familiar with it? I'll try X > tomorrow and let you know how it goes. Hmm, that could definitely be related. Try dropping the attached patch into ports/x11-toolkits/open-motif/files and rebuilding and reinstalling it. If that doesn't work try the xorg update. Thanks! -- Greg Lewis Email : glewis@eyesbeyond.com Eyes Beyond Web : http://www.eyesbeyond.com Information Technology FreeBSD : glewis@FreeBSD.org --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-java-dnd-fix Only in Xm: .libs diff -ur /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragC.c Xm/DragC.c --- /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragC.c Thu Jan 10 22:56:30 2002 +++ lib/Xm/DragC.c Sun Oct 26 13:26:03 2003 @@ -147,6 +147,12 @@ Display *dpy, Window win, Atom atom) ; +static Window GetReceiverWindow( + Display *dpy, + Window window, + Window subWindow, + int x, + int y) ; static void ValidateDragOver( XmDragContext dc, unsigned char oldStyle, @@ -668,6 +674,8 @@ { XmDragContext dc = (XmDragContext)new_w; + /* Solaris 2.6 Motif 2.1 diff bug 1190577 1 line */ + dc->drag.currWmRoot = 0; dc->drag.roundOffTime = 50; dc->drag.dragFinishTime = @@ -685,7 +693,7 @@ InitDropSiteManager(dc); if (dc->drag.exportTargets) { - unsigned int size; + size_t size; /* Wyoming 64-bit fix */ size = sizeof(Atom) * dc->drag.numExportTargets; dc->drag.exportTargets = (Atom *) _XmAllocAndCopy(dc->drag.exportTargets, size); @@ -729,7 +737,7 @@ if (oldDC->drag.exportTargets) /* should have been freed */ XtFree( (char *)oldDC->drag.exportTargets); if (newDC->drag.exportTargets) { - unsigned int size; + size_t size; /* Wyoming 64-bit fix */ size = sizeof(Atom) * newDC->drag.numExportTargets; newDC->drag.exportTargets = (Atom *) _XmAllocAndCopy(newDC->drag.exportTargets, size); @@ -796,6 +804,12 @@ #endif /* MULTI_SCREEN_DONE */ XtFree((char *)dc->drag.receiverInfos); } + + /* + * Clear the drag icon cache of all mixed icons + * when drag operation has finished + */ + _XmDragOverUpdateCache (); } static void @@ -810,6 +824,55 @@ _XmFastSubclassInit (wc, XmDRAG_CONTEXT_BIT); } +/* Look for the lowest window having XS_MOTIF_RECEIVER set. This should be set + on shells only. We need this as if one shell is reparented to another then + WM_STATE does not lead us to the correct window. +*/ +static Window +GetReceiverWindow( + Display *dpy, + Window window, + Window subWindow, + int x, + int y ) + { + Atom MOTIF_RECEIVER = XInternAtom(dpy, XS_MOTIF_RECEIVER, True); + Atom type; + int format; + unsigned long nitems; + unsigned long after; + unsigned char *data; + + Window src_w = window; + Window dest_w = subWindow; + Window ret_w = subWindow; + Window child_w = None; + int src_x = x; + int src_y = y; + + while (dest_w != None) { + + type = None; + XGetWindowProperty(dpy, dest_w, MOTIF_RECEIVER, 0, 0, False, + MOTIF_RECEIVER, &type, &format, &nitems, + &after, &data); + + if (data) XFree(data); + + if (type != None) { + ret_w = dest_w; + } + + XTranslateCoordinates(dpy, src_w, dest_w, + src_x, src_y, &src_x, &src_y, &child_w); + + src_w = dest_w; + dest_w = child_w; + } + + return ret_w; + } + static Window GetClientWindow( Display *dpy, @@ -823,13 +886,12 @@ Atom type = None; int format; unsigned long nitems, after; - unsigned char *data = NULL; + unsigned char *data; Window inf = 0; XGetWindowProperty(dpy, win, atom, 0, 0, False, AnyPropertyType, &type, &format, &nitems, &after, &data); - if (data) - XFree(data); + if (data) XFree(data); if (type) return win; @@ -919,10 +981,10 @@ _XmAllocReceiverInfo( XmDragContext dc ) { - Cardinal offset = 0; + size_t offset = 0; /* Wyoming 64-bit fix */ if (dc->drag.currReceiverInfo) { - offset = (Cardinal) (dc->drag.currReceiverInfo - + offset = (dc->drag.currReceiverInfo - /* Wyoming 64-bit fix */ dc->drag.receiverInfos); } if (dc->drag.numReceiverInfos == dc->drag.maxReceiverInfos) { @@ -965,30 +1027,37 @@ (!currReceiverInfo || (currReceiverInfo->frame == currReceiverInfo->window))) { Window currRoot = dc->drag.currWmRoot; - int root_x, root_y; - Position rel_x, rel_y; - /* - * set frame (win) to something reasonable - */ - rel_x = dc->drag.startX - dc->drag.srcShell->core.x; - rel_y = dc->drag.startY - dc->drag.srcShell->core.y; - if (rel_x < 0) rel_x = 0; - if (rel_y < 0) rel_y = 0; + /* Solaris 2.6 Motif diff 2.1 bugid 1190577 */ + Window root_w, parent_w, new_parent_w, *children_w; + unsigned int num_children; + + new_parent_w = win; + + do + { + parent_w = new_parent_w; + + XQueryTree(XtDisplayOfObject((Widget) dc), parent_w, + &root_w, &new_parent_w, &children_w, &num_children); + + if (children_w) XFree((void *) children_w); + + } while (new_parent_w && (new_parent_w != currRoot)); - (void) XTranslateCoordinates(XtDisplayOfObject((Widget) dc), - win, currRoot, - rel_x, rel_y, - &root_x, &root_y, - &win); if (currReceiverInfo) - currReceiverInfo->frame = win; + currReceiverInfo->frame = parent_w; + /* END Solaris 2.6 Motif diff 2.1 bugid 1190577 */ } if (currReceiverInfo == NULL) { if (clientWin == win) { if ((clientWin = GetClientWindow(dpy, win, WM_STATE)) == 0) clientWin = win; + clientWin = GetReceiverWindow(dpy, dc->drag.currWmRoot, + clientWin, + dc->core.x, + dc->core.y); } currReceiverInfo = dc->drag.currReceiverInfo = _XmAllocReceiverInfo(dc); @@ -1031,6 +1100,12 @@ else currReceiverInfo->dragProtocolStyle = XmDRAG_NONE; + /* + * Fix for 4617028. + * The drag entered a new shell that resides in the initiator process. + * Sync the shell position with the X server. + */ + _XmSyncShellPosition(currReceiverInfo->shell); currReceiverInfo->xOrigin = dc->drag.currReceiverInfo->shell->core.x; currReceiverInfo->yOrigin = dc->drag.currReceiverInfo->shell->core.y; currReceiverInfo->width = dc->drag.currReceiverInfo->shell->core.width; @@ -1494,19 +1569,11 @@ XtPointer clientData, XtRequestId *requestID ) { - enum { - XmATRANSFER_SUCCESS, XmATRANSFER_FAILURE, - XmA_MOTIF_CANCEL_DROP_EFFECT, XmA_MOTIF_DROP, XmATARGETS, NUM_ATOMS }; - static char *atom_names[] = { - XmSTRANSFER_SUCCESS, XmSTRANSFER_FAILURE, - XmS_MOTIF_CANCEL_DROP_EFFECT, XmS_MOTIF_DROP, XmSTARGETS }; - XmDragContext dc; String targetName = NULL; Time dropTime; Boolean returnVal = True; Boolean success; - Atom atoms[XtNumber(atom_names)]; dropTime = XtGetSelectionRequest(w, *selection, requestID)->time; @@ -1515,12 +1582,12 @@ XmeWarning(w, MESSAGE2); return False; } - assert(XtNumber(atom_names) == NUM_ATOMS); - XInternAtoms(XtDisplayOfObject((Widget) dc), atom_names, - XtNumber(atom_names), False, atoms); - if ((success = (*target == atoms[XmATRANSFER_SUCCESS])) || - (*target == atoms[XmATRANSFER_FAILURE])) - { + if ((success = + (*target == XInternAtom(XtDisplayOfObject((Widget) dc), + XmSTRANSFER_SUCCESS, False))) || + *target == XInternAtom(XtDisplayOfObject((Widget) dc), + XmSTRANSFER_FAILURE, False)) + { if (success) dc->drag.dragDropCompletionStatus = XmDROP_SUCCESS; else @@ -1536,13 +1603,17 @@ dc->drag.dropFinishTime = dropTime; DragDropFinish(dc); } - else if (*target == atoms[XmA_MOTIF_CANCEL_DROP_EFFECT]) + else if (*target == XInternAtom(XtDisplayOfObject((Widget) dc), + XmS_MOTIF_CANCEL_DROP_EFFECT, False)) { dc->drag.dragDropCancelEffect = True; } else /* normal transfer */ { - Atom motifDrop = atoms[XmA_MOTIF_DROP]; + Atom motifDrop; + + motifDrop = XInternAtom(XtDisplay(dc), XmS_MOTIF_DROP, False); + returnVal = (Boolean)((*(dc->drag.convertProc.sel_incr)) ((Widget)dc, &motifDrop, @@ -1557,8 +1628,10 @@ } /* add code to handle TARGET target automatically if not there yet */ - if ((! returnVal) && (*target == atoms[XmATARGETS])) { - int len = sizeof(Atom) * dc->drag.numExportTargets; + if ((! returnVal) && + (*target == XInternAtom(XtDisplayOfObject((Widget) dc), + "TARGETS", False))) { + size_t len = sizeof(Atom) * dc->drag.numExportTargets; /* Wyoming 64-bit fix */ if (dc->drag.incremental & 0x2) { dc->drag.incremental = 1; @@ -1593,19 +1666,11 @@ unsigned long *lengthRtn, int *formatRtn ) { - enum { - XmATRANSFER_SUCCESS, XmATRANSFER_FAILURE, - XmA_MOTIF_CANCEL_DROP_EFFECT, XmA_MOTIF_DROP, XmATARGETS, NUM_ATOMS }; - static char *atom_names[] = { - XmSTRANSFER_SUCCESS, XmSTRANSFER_FAILURE, - XmS_MOTIF_CANCEL_DROP_EFFECT, XmS_MOTIF_DROP, XmSTARGETS }; - XmDragContext dc; String targetName = NULL; Time dropTime; Boolean returnVal = True; Boolean success; - Atom atoms[XtNumber(atom_names)]; dropTime = XtGetSelectionRequest(w, *selection, NULL)->time; @@ -1614,11 +1679,11 @@ XmeWarning(w, MESSAGE2); return False; } - assert(XtNumber(atom_names) == NUM_ATOMS); - XInternAtoms(XtDisplayOfObject((Widget) dc), atom_names, - XtNumber(atom_names), False, atoms); - if ((success = (*target == atoms[XmATRANSFER_SUCCESS])) || - (*target == atoms[XmATRANSFER_FAILURE])) + if ((success = + (*target == XInternAtom(XtDisplayOfObject((Widget) dc), + XmSTRANSFER_SUCCESS, False))) || + *target == XInternAtom(XtDisplayOfObject((Widget) dc), + XmSTRANSFER_FAILURE, False)) { if (success) dc->drag.dragDropCompletionStatus = XmDROP_SUCCESS; @@ -1634,13 +1699,17 @@ dc->drag.dropFinishTime = dropTime; DragDropFinish(dc); } - else if (*target == atoms[XmA_MOTIF_CANCEL_DROP_EFFECT]) + else if (*target == XInternAtom(XtDisplayOfObject((Widget) dc), + XmS_MOTIF_CANCEL_DROP_EFFECT, False)) { dc->drag.dragDropCancelEffect = True; } else /* normal transfer */ { - Atom motifDrop = atoms[XmA_MOTIF_DROP]; + Atom motifDrop; + + motifDrop = XInternAtom(XtDisplay(dc), XmS_MOTIF_DROP, False); + returnVal = (Boolean) ((*(dc->drag.convertProc.sel)) ((Widget)dc, @@ -1653,8 +1722,10 @@ } /* add code to handle TARGET target automatically if not there yet */ - if ((! returnVal) && (*target == atoms[XmATARGETS])) { - int len = sizeof(Atom) * dc->drag.numExportTargets; + if ((! returnVal) && + (*target == XInternAtom(XtDisplayOfObject((Widget) dc), + "TARGETS", False))) { + size_t len = sizeof(Atom) * dc->drag.numExportTargets; /* Wyoming 64-bit fix */ *valueRtn = XtMalloc(len); memmove(*valueRtn, dc->drag.exportTargets, len); *lengthRtn = dc->drag.numExportTargets; @@ -1694,7 +1765,7 @@ Cardinal i; Arg args[8]; Widget old = (Widget) (dc->drag.curDragOver); - + /* Find the new screen number */ for (i = 0; i < XScreenCount(XtDisplayOfObject((Widget) dc)); i++) if (RootWindow(XtDisplayOfObject((Widget) dc), i) == newRoot) @@ -1750,9 +1821,13 @@ if (old != NULL) { if (old != (Widget) (dc->drag.origDragOver)) + { XtDestroyWidget(old); + } else + { _XmDragOverHide((Widget)dc->drag.origDragOver, 0, 0, NULL); + } } GetScreenInfo(dc); @@ -1769,7 +1844,7 @@ if (XGrabPointer(XtDisplayOfObject((Widget) dc->drag.curDragOver), RootWindowOfScreen(XtScreen(dc->drag.curDragOver)), False, - mask, + (unsigned int)mask, /* Wyoming 64-bit fix */ GrabModeSync, GrabModeAsync, None, @@ -1781,6 +1856,7 @@ SyncPointer, dc->drag.lastChangeTime); } + } @@ -2166,7 +2242,7 @@ if (XGrabPointer(XtDisplayOfObject((Widget) dc), RootWindowOfScreen(XtScreen(dc)), False, - mask, + (unsigned int)mask, /* Wyoming 64-bit fix */ GrabModeSync, GrabModeAsync, confineWindow, @@ -2317,7 +2393,7 @@ (XGrabPointer(XtDisplayOfObject((Widget) dc), RootWindowOfScreen(XtScreen(dc)), False, - mask, + (unsigned int)mask, /* Wyoming 64-bit fix */ GrabModeSync, GrabModeAsync, confineWindow, @@ -2350,18 +2426,16 @@ /* End fixing OSF CR 5556 */ if (dc->drag.trackingMode == XmDRAG_TRACK_WM_QUERY_PENDING) { - enum { XmA_MOTIF_WM_QUERY, XmA_MOTIF_WM_ALL_CLIENTS, NUM_ATOMS }; - static char *atom_names[] = { - XmS_MOTIF_WM_QUERY, XmS_MOTIF_WM_ALL_CLIENTS }; - Atom atoms[XtNumber(atom_names)]; - - assert(XtNumber(atom_names) == NUM_ATOMS); - XInternAtoms(XtDisplay(dc), atom_names, XtNumber(atom_names), - False, atoms); + Atom wmQuery; + Atom wmAllClients; + wmQuery = XInternAtom(XtDisplay(dc), XmS_MOTIF_WM_QUERY, False); + wmAllClients = XInternAtom(XtDisplay(dc), + XmS_MOTIF_WM_ALL_CLIENTS, + False); XtGetSelectionValue((Widget)dd, - atoms[XmA_MOTIF_WM_QUERY], - atoms[XmA_MOTIF_WM_ALL_CLIENTS], + wmQuery, + wmAllClients, TopWindowsReceived, (XtPointer)dc, dc->drag.dragStartTime); @@ -2411,7 +2485,7 @@ if (XGrabPointer(XtDisplayOfObject((Widget) dc), RootWindowOfScreen(XtScreen(dc)), True, - mask, + (unsigned int)mask, /* Wyoming 64-bit fix */ GrabModeSync, GrabModeAsync, confineWindow, @@ -2449,6 +2523,9 @@ * info. The window field is always set (by us) to the DC window. */ switch(event->type) { + +/* Solaris 2.6 Motif diff 1190577 1 line */ +#ifndef SUN_MOTIF_PERF case MotionNotify: if (mb->count && ((mb->count % (STACKMOTIONBUFFERSIZE)) == 0)) { if (mb->count == (STACKMOTIONBUFFERSIZE)){ @@ -2489,6 +2566,9 @@ mb->entries[mb->count].x = x; mb->entries[mb->count++].y = y; break; +/* Solaris 2.6 Motif diff 1190577 1 line */ +#endif /* SUN_MOTIF_PERF */ + case EnterNotify: if ((event->xcrossing.mode == NotifyNormal) && @@ -2514,6 +2594,73 @@ default: break; } + +/* Solaris 2.6 Motif diff bug 1190577 */ +#ifdef SUN_MOTIF_PERF + /* + * EnterNotify and LeaveNotify events must be processed the same + * as MotionNotify events otherwise pointer movement can be lost. + */ + if ((event->type == MotionNotify) || + (event->type == EnterNotify) || + (event->type == LeaveNotify)) + { + if (mb->count && ((mb->count % (STACKMOTIONBUFFERSIZE)) == 0)) { + if (mb->count == (STACKMOTIONBUFFERSIZE)){ + MotionBuffer oldMb = mb; + Cardinal size; + + size = sizeof(MotionBufferRec) + + (STACKMOTIONBUFFERSIZE * sizeof(MotionEntryRec)); + mb = (MotionBuffer) XtMalloc(size); + memcpy((char *)mb, (char *)oldMb, sizeof(MotionBufferRec)); + } + else { + mb = (MotionBuffer) + XtRealloc((char *)mb, + (sizeof(MotionBufferRec) + + (mb->count + STACKMOTIONBUFFERSIZE) *sizeof(MotionEntryRec))); + } + } + /* + * for right now use the root although this wont work for + * pseudo-roots + */ + if (event->type == MotionNotify) + { + state = event->xmotion.state; + time = event->xmotion.time; + x = event->xmotion.x_root; + y = event->xmotion.y_root; + window = event->xmotion.root; + } + else + { + state = event->xcrossing.state; + time = event->xcrossing.time; + x = event->xcrossing.x_root; + y = event->xcrossing.y_root; + window = event->xmotion.root; + } + if (dc->drag.trackingMode != XmDRAG_TRACK_MOTION) { + subwindow = mb->currReceiverInfo->window; + } + else { + if (event->type == MotionNotify) + subwindow = event->xmotion.subwindow; + else + subwindow = event->xcrossing.subwindow; + } + mb->entries[mb->count].time = time; + mb->entries[mb->count].window = window; + mb->entries[mb->count].subwindow = subwindow; + mb->entries[mb->count].state = state; + mb->entries[mb->count].x = x; + mb->entries[mb->count++].y = y; + } +#endif /* SUN_MOTIF_PERF */ +/* END Solaris 2.6 Motif diff bug 1190577 */ + } @@ -2525,14 +2672,30 @@ { Boolean incrementTimestamp = False; + /* 4318757 - If this info is NULL then the dc is not properly setup. */ + if(dc->drag.currReceiverInfo == NULL) + return; + /* * We've selected for motion on the root window. This allows us to * use the subwindow field to know whenever we have left or * entered a potential top-level window. */ + + /* 4318757 - If this info is NULL then the dc is not setup correctly */ + if(dc->drag.currReceiverInfo == NULL) + return; + + /* + * Fix for 4527081. + * With the fix for 4340913, subWindow is a receiver window, not a toplevel + * window. To determine that the drag entered a new receiver window + * we should compare subWindow against the current receiver window which is + * stored in currReceiverInfo->window. + */ if ((root != dc->drag.currWmRoot) || ((((dc->drag.trackingMode == XmDRAG_TRACK_MOTION) && - (dc->drag.currReceiverInfo->frame != subWindow))) || + (dc->drag.currReceiverInfo->window != subWindow))) || ((dc->drag.trackingMode == XmDRAG_TRACK_WM_QUERY) && (dc->drag.currReceiverInfo->window != subWindow)))) { @@ -2651,7 +2814,8 @@ * one pixel hole (which has just been moved to be under where * the pointer was), and determine what real window we are over */ - if (protoWindow == XtWindow(dc->drag.curDragOver)) + if ((protoWindow != None) && + (protoWindow == XtWindow(dc->drag.curDragOver))) /* Bug ID 4102689 */ { Window currRoot = dc->drag.currWmRoot; int dummyx, dummyy; @@ -2663,10 +2827,25 @@ } /* + * Fix for 4617028. + * Search for the receiver window only after we have finished with the + * determination of the protoWindow. + */ + if (protoWindow != None) { + protoWindow = GetReceiverWindow(XtDisplay(dc), + dc->drag.currWmRoot, + protoWindow, + dc->core.x, + dc->core.y); + } + + /* * actually inform the receiver/initiator that movement has * occurred */ - DragMotionProto(dc, dc->drag.currWmRoot, protoWindow); + /* Solaris 2.6 Motif diff bug 1190577 1 line */ + if (protoWindow != None) + DragMotionProto(dc, dc->drag.currWmRoot, protoWindow); if (mb->count > STACKMOTIONBUFFERSIZE) XtFree( (char *)mb); @@ -2839,14 +3018,46 @@ XEvent *ev ) { unsigned int state = 0; - Arg args[4]; + /* Solaris 2.6 Motif diff bug 4044190 1 line */ + Arg args[5]; Cardinal i = 0; XmDisplay dd = (XmDisplay) XmGetXmDisplay(XtDisplay(dc)); dd->display.activeDC = NULL; dd->display.userGrabbed = False; + /* 4404627 - Moved the #ifdef code block inside the ev guard */ if (ev) { + +/* Solaris 2.6 Motif diff bug 1190577 */ +#ifdef SUN_MOTIF_PERF + /* + * The drop must occur at the coordinates of the button release + * so get the window that corresponds to these coordinates and + * process it. + */ + int dummyx, dummyy; + Window protoWindow; + + (void) XTranslateCoordinates(XtDisplay(dc), dc->drag.currWmRoot, + dc->drag.currWmRoot, + ev->xbutton.x_root, ev->xbutton.y_root, + &dummyx, &dummyy, + &protoWindow); + if (protoWindow != None) { + protoWindow = GetReceiverWindow(XtDisplay(dc), + dc->drag.currWmRoot, + protoWindow, + ev->xbutton.x_root, + ev->xbutton.y_root); + } + + DragMotionProto( dc, dc->drag.currWmRoot, protoWindow ); +#endif /* SUN_MOTIF_PERF */ +/* END Solaris 2.6 Motif diff bug 1190577 */ + + + switch(ev->type) { case ButtonRelease: state = ev->xbutton.state; @@ -2888,6 +3099,22 @@ (currentMode != XmDRAG_WINDOW && currentMode != XmWINDOW) ) { XtSetArg(args[i], XmNdragOverMode, XmWINDOW); i++; } +/* Solaris 2.6 Motif diff bug 1190577 */ +#ifdef SUN_MOTIF_PERF + /* + * We must move the drag over shell to the location where + * the mouse button was released. Otherwise the drag icon + * will popup at the last location the window was used and + * then move to the current location. This causes flashing + */ + + /* 4404627 - Check for NULL, i.e. call from XmDragCancel */ + if(ev) { + XtSetArg(args[i], XmNx, ev->xbutton.x_root); i++; + XtSetArg(args[i], XmNy, ev->xbutton.y_root); i++; + } +#endif /* SUN_MOTIF_PERF */ +/* END Solaris 2.6 Motif diff bug 1190577 */ XtSetValues((Widget) dc->drag.curDragOver, args, i); XUngrabPointer(XtDisplayOfObject((Widget) dc), dc->drag.lastChangeTime); @@ -3074,8 +3301,7 @@ XtSetKeyboardFocus(shell, None); } else { XmFocusData focusData = _XmGetFocusData(shell); - if(focusData) - focusData->needToFlush = False; + if (focusData) focusData->needToFlush = False; /* CR 6384, check for null focusWidget */ if (focusWidget != (Widget) NULL) { if (XmIsPrimitive(focusWidget)) { Only in Xm: DragC.c.orig diff -ur /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragICCI.h Xm/DragICCI.h --- /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragICCI.h Fri Jan 4 23:22:09 2002 +++ lib/Xm/DragICCI.h Sun Oct 26 13:26:03 2003 @@ -377,6 +377,9 @@ /* Macros for the manipulation of ICCmessages and xmDSData */ +#define XS_MOTIF_INITIATOR "_MOTIF_DRAG_INITIATOR_INFO" +#define XS_MOTIF_RECEIVER "_MOTIF_DRAG_RECEIVER_INFO" + #define _XM_TRAVERSAL_TYPE_MASK ((CARD16) 0x0003) #define _XM_TRAVERSAL_TYPE_SHIFT 0 diff -ur /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragOverS.c Xm/DragOverS.c --- /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragOverS.c Thu Jan 10 22:56:31 2002 +++ lib/Xm/DragOverS.c Sun Oct 26 13:26:03 2003 @@ -152,6 +152,9 @@ ***********************************************************************/ #include +#include +#include +#include #include #include #include @@ -201,7 +204,9 @@ XmDragIconObject icon, XmDragIconObject sourceIcon, Position *iconX, - Position *iconY) ; + Position *iconY, + Position offsetX, + Position offsetY) ; static void BlendIcon( XmDragOverShellWidget dos, XmDragIconObject icon, XmDragIconObject mixedIcon, @@ -291,6 +296,14 @@ #endif /* NeedWidePrototypes */ static void ChangeDragWindow( XmDragOverShellWidget dos) ; + +/* Solaris 2.6 Motif diff bug 4076121 4 lines */ +static void Realize( + Widget wid, + XtValueMask *vmask, + XSetWindowAttributes *attr ); + + static void FindColormapShell(XmDragOverShellWidget dw) ; static void InstallColormap(XmDragOverShellWidget dw) ; static void UninstallColormap(XmDragOverShellWidget dw) ; @@ -308,10 +321,11 @@ XmRBoolean, sizeof(Boolean), Offset(shell.override_redirect), XtRImmediate, (XtPointer)True, }, +/* Bug # 4106187 fix. Solaris 2.7. */ { XmNsaveUnder, XmCSaveUnder, XmRBoolean, sizeof(Boolean), Offset(shell.save_under), - XtRImmediate, (XtPointer)True, + XtRImmediate, (XtPointer)False, }, { XmNhotX, XmCHot, XmRPosition, @@ -360,7 +374,8 @@ FALSE, /* class_inited flag */ Initialize, /* instance initialize proc */ (XtArgsProc)NULL, /* init_hook proc */ - XtInheritRealize, /* realize widget proc */ +/* Solaris 2.6 Motif diff bug 4076121 1 line */ + Realize, /* realize widget proc */ NULL, /* action table for class */ 0, /* num_actions */ resources, /* resource list of class */ @@ -409,6 +424,7 @@ externaldef(xmDragOvershellwidgetclass) WidgetClass xmDragOverShellWidgetClass = (WidgetClass) (&xmDragOverShellClassRec); + typedef struct _MixedIconCache { Cardinal depth; @@ -514,7 +530,7 @@ register MixedIconCache * cache_ptr; for (cache_ptr = mixed_cache; cache_ptr; cache_ptr = cache_ptr->next) - { + { if (cache_ptr->depth == depth && cache_ptr->width == width && cache_ptr->height == height && @@ -836,67 +852,96 @@ XmDragIconObject icon, XmDragIconObject sourceIcon, Position *iconX, - Position *iconY) + Position *iconY, + Position offsetX, + Position offsetY) { + + /* Solaris 2.6 Motif diff bug 4076121 */ + Position offset_x; + Position offset_y; + +#if CDE_DRAG_ICON + offset_x = offsetX; + offset_y = offsetY; +#else + + offset_x = icon->drag.offset_x; + offset_y = icon->drag.offset_y; +#endif /* CDE_DRAG_ICON */ + /* END Solaris 2.6 Motif diff bug */ + + + + switch ((int) icon->drag.attachment) { default: XmeWarning ((Widget) icon, MESSAGE2); /* cast ok here */ case XmATTACH_NORTH_WEST: - *iconX = icon->drag.offset_x; - *iconY = icon->drag.offset_y; + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ + *iconX = offset_x; + *iconY = offset_y; break; case XmATTACH_NORTH: + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ *iconX = ((Position) sourceIcon->drag.width/2) - + icon->drag.offset_x; - *iconY = icon->drag.offset_y; + + offset_x; + *iconY = offset_y; break; case XmATTACH_NORTH_EAST: + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ *iconX = ((Position) sourceIcon->drag.width) - + icon->drag.offset_x; - *iconY = icon->drag.offset_y; + + offset_x; + *iconY = offset_y; break; case XmATTACH_EAST: + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ *iconX = ((Position) sourceIcon->drag.width) - + icon->drag.offset_x; + + offset_x; *iconY = ((Position) sourceIcon->drag.height/2) - + icon->drag.offset_y; + + offset_y; break; case XmATTACH_SOUTH_EAST: + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ *iconX = ((Position) sourceIcon->drag.width) - + icon->drag.offset_x; + + offset_x; *iconY = ((Position) sourceIcon->drag.height) - + icon->drag.offset_y; + + offset_y; break; case XmATTACH_SOUTH: + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ *iconX = ((Position) sourceIcon->drag.width/2) - + icon->drag.offset_x; + + offset_x; *iconY = ((Position) sourceIcon->drag.height) - + icon->drag.offset_y; + + offset_y; break; case XmATTACH_SOUTH_WEST: - *iconX = icon->drag.offset_x; + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ + *iconX = offset_x; *iconY = ((Position) sourceIcon->drag.height) - + icon->drag.offset_y; + + offset_y; break; case XmATTACH_WEST: - *iconX = icon->drag.offset_x; + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ + *iconX = offset_x; *iconY = ((Position) sourceIcon->drag.height/2) - + icon->drag.offset_y; + + offset_y; break; case XmATTACH_CENTER: + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ *iconX = ((Position) sourceIcon->drag.width/2) - + icon->drag.offset_x; + + offset_x; *iconY = ((Position) sourceIcon->drag.height/2) - + icon->drag.offset_y; + + offset_y; break; case XmATTACH_HOT: @@ -1153,7 +1198,15 @@ Position maxX, maxY; if (stateIcon) { - GetIconPosition (dos, stateIcon, sourceIcon, &stateX, &stateY); + +/* Solaris 2.6 Motif diff bug 4076121 6 lines */ +#if CDE_DRAG_ICON + GetIconPosition (dos, stateIcon, sourceIcon, &stateX, &stateY, + cde_text_x_state_offset, cde_text_y_state_offset); +#else + GetIconPosition (dos, stateIcon, sourceIcon, &stateX, &stateY, 0,0); +#endif /* CDE_DRAG_ICON */ + minX = MIN(stateX, minX); minY = MIN(stateY, minY); } @@ -1164,7 +1217,13 @@ opY = stateY + stateIcon->drag.hot_y - opIcon->drag.hot_y; } else { - GetIconPosition (dos, opIcon, sourceIcon, &opX, &opY); +/* Solaris 2.6 Motif diff bug 4076121 6 lines */ +#if CDE_DRAG_ICON + GetIconPosition (dos, opIcon, sourceIcon, &opX, &opY, + cde_text_x_operation_offset, cde_text_y_operation_offset); +#else + GetIconPosition (dos, opIcon, sourceIcon, &opX, &opY, 0, 0); +#endif /* CDE_DRAG_ICON */ } minX = MIN(opX, minX); minY = MIN(opY, minY); @@ -1201,6 +1260,10 @@ * The MixedIcon's pixmap and mask, if present, were scratch pixmaps, * and not from the Xm pixmap cache. Therefore, they need to be freed * separately and reset to XmUNSPECIFIED_PIXMAP. + * + * Dot not destory icon if within the cache. + * These will get destroyed by _XmDragOverUpdateCache + * ***********************************************************************/ static void @@ -1208,42 +1271,88 @@ XmDragOverShellWidget dos, XmDragIconObject mixedIcon) { - XmScreen xmScreen = (XmScreen) XmGetXmScreen(XtScreen(dos)); MixedIconCache *cache_ptr; - MixedIconCache *prev_cache_ptr = NULL; + Boolean found = False; + + _XmProcessLock(); + cache_ptr = mixed_cache; - if (mixedIcon->drag.pixmap != XmUNSPECIFIED_PIXMAP) { - _XmFreeScratchPixmap (xmScreen, mixedIcon->drag.pixmap); - mixedIcon->drag.pixmap = XmUNSPECIFIED_PIXMAP; + while(cache_ptr) { + if (cache_ptr->mixedIcon == mixedIcon) { + found = True; + break; + } + cache_ptr = cache_ptr->next; } + _XmProcessUnlock(); - if (mixedIcon->drag.mask != XmUNSPECIFIED_PIXMAP) { - _XmFreeScratchPixmap (xmScreen, mixedIcon->drag.mask); - mixedIcon->drag.mask = XmUNSPECIFIED_PIXMAP; + if (found == False) { + XmScreen xmScreen = (XmScreen) XmGetXmScreen(XtScreen(dos)); + + if (mixedIcon->drag.pixmap != XmUNSPECIFIED_PIXMAP) { + _XmFreeScratchPixmap (xmScreen, mixedIcon->drag.pixmap); + mixedIcon->drag.pixmap = XmUNSPECIFIED_PIXMAP; + } + if (mixedIcon->drag.mask != XmUNSPECIFIED_PIXMAP) { + _XmFreeScratchPixmap (xmScreen, mixedIcon->drag.mask); + mixedIcon->drag.mask = XmUNSPECIFIED_PIXMAP; + } + XtDestroyWidget ((Widget) mixedIcon); } +} + +void _XmDragOverUpdateCache () +{ + MixedIconCache *cache_ptr; + MixedIconCache *next_cache_ptr; + XmDragIconObject *objects; + XmDragIconObject mixedIcon; + XmScreen xmScreen; + + int n; _XmProcessLock(); cache_ptr = mixed_cache; + if (cache_ptr == NULL) { + _XmProcessUnlock(); + return; + } + + n = 0; + while (cache_ptr) { + n++; + cache_ptr = cache_ptr->next; + } + objects = (XmDragIconObject *)XtMalloc (sizeof (XmDragIconObject) * n); - while(cache_ptr) { - MixedIconCache *next_cache_ptr = cache_ptr -> next; - - if (cache_ptr->mixedIcon == mixedIcon) { - if (cache_ptr == mixed_cache) { - prev_cache_ptr = mixed_cache = cache_ptr->next; - } else { - prev_cache_ptr->next = cache_ptr->next; - } + n = 0; + cache_ptr = mixed_cache; + while (cache_ptr) { + objects[n++] = cache_ptr->mixedIcon; + next_cache_ptr = cache_ptr->next; XtFree((char *) cache_ptr); - } else { - prev_cache_ptr = cache_ptr; - } - cache_ptr = next_cache_ptr; + cache_ptr = next_cache_ptr; } + mixed_cache = NULL; _XmProcessUnlock(); - XtDestroyWidget ((Widget) mixedIcon); + + while (n--) { + mixedIcon = objects[n]; + xmScreen = (XmScreen )XmGetXmScreen (XtScreen (mixedIcon)); + if (mixedIcon->drag.pixmap != XmUNSPECIFIED_PIXMAP) { + _XmFreeScratchPixmap (xmScreen, mixedIcon->drag.pixmap); + mixedIcon->drag.pixmap = XmUNSPECIFIED_PIXMAP; + } + if (mixedIcon->drag.mask != XmUNSPECIFIED_PIXMAP) { + _XmFreeScratchPixmap (xmScreen, mixedIcon->drag.mask); + mixedIcon->drag.mask = XmUNSPECIFIED_PIXMAP; + } + XtDestroyWidget ((Widget )mixedIcon); + } + + XtFree ((XtPointer )objects); } /************************************************************************ @@ -1293,7 +1402,14 @@ */ if (stateIcon) { - GetIconPosition (dos, stateIcon, sourceIcon, &stateX, &stateY); +/* Solaris 2.6 Motif diff bug 4076121 6 lines */ +#if CDE_DRAG_ICON + GetIconPosition (dos, stateIcon, sourceIcon, &stateX, &stateY, + cde_text_x_state_offset, cde_text_y_state_offset); +#else + GetIconPosition (dos, stateIcon, sourceIcon, &stateX, &stateY, 0, 0); +#endif /* CDE_DRAG_ICON */ + minX = MIN(stateX, minX); minY = MIN(stateY, minY); } @@ -1311,7 +1427,13 @@ opY = stateY + stateIcon->drag.hot_y - opIcon->drag.hot_y; } else { - GetIconPosition (dos, opIcon, sourceIcon, &opX, &opY); +/* Solaris 2.6 Motif diff bug 4076121 6 lines */ +#if CDE_DRAG_ICON + GetIconPosition (dos, opIcon, sourceIcon, &opX, &opY, + cde_text_x_operation_offset, cde_text_y_operation_offset); +#else + GetIconPosition (dos, opIcon, sourceIcon, &opX, &opY, 0, 0); +#endif /* CDE_DRAG_ICON */ } minX = MIN(opX, minX); minY = MIN(opY, minY); @@ -1496,8 +1618,6 @@ v.graphics_exposures = False; v.subwindow_mode = IncludeInferiors; v.clip_mask = None; - v.clip_x_origin = 0; /* pedantic */ - v.clip_y_origin = 0; /* pedantic */ vmask = GCBackground|GCForeground|GCFunction| GCClipXOrigin|GCClipYOrigin|GCClipMask| GCGraphicsExposures|GCSubwindowMode; @@ -1522,8 +1642,6 @@ v.graphics_exposures = False; v.subwindow_mode = IncludeInferiors; v.clip_mask = None; - v.clip_x_origin = 0; /* pedantic */ - v.clip_y_origin = 0; /* pedantic */ vmask = GCBackground|GCForeground|GCFunction| GCClipXOrigin|GCClipYOrigin|GCClipMask| GCGraphicsExposures|GCSubwindowMode; @@ -1540,8 +1658,9 @@ XChangeGC (display, cursorBlend->gc, vmask, &v); } + /* Solaris 2.6 Motif diff bug 4076121 2 lines */ XFillRectangle (display, mixedIcon->drag.mask, cursorBlend->gc, - 0, 0, mixedIcon->drag.width, mixedIcon->drag.height); + 0, 0, PIXMAP_MAX_WIDTH, PIXMAP_MAX_HEIGHT); } /* @@ -1695,8 +1814,6 @@ v.graphics_exposures = False; v.subwindow_mode = IncludeInferiors; v.clip_mask = None; - v.clip_x_origin = 0; /* pedantic */ - v.clip_y_origin = 0; /* pedantic */ vmask = GCBackground|GCForeground| GCClipXOrigin|GCClipYOrigin|GCClipMask| GCGraphicsExposures|GCSubwindowMode; @@ -2131,33 +2248,30 @@ UninstallColormap(dos); } - if (dos->drag.activeMode != XmWINDOW) { - if (clipRegion != None) { + if (dos->drag.activeMode != XmWINDOW && clipRegion != None) { clipped = True; _XmRegionSetGCRegion (XtDisplay(w), dos->drag.rootBlend.gc, clipOriginX, clipOriginY, clipRegion); - } - else { + } + else { XSetClipMask (XtDisplay(w), dos->drag.rootBlend.gc, None); - } + } - if (BackingPixmap(dos) != XmUNSPECIFIED_PIXMAP) { + if (BackingPixmap(dos) != XmUNSPECIFIED_PIXMAP) { XCopyArea (XtDisplay(w), BackingPixmap(dos), RootWindowOfScreen(XtScreen(w)), dos->drag.rootBlend.gc, 0, 0, dos->core.width, dos->core.height, BackingX(dos), BackingY(dos)); - } + } - if (clipped) { + if (clipped) { XSetClipMask (XtDisplay(w), dos->drag.rootBlend.gc, None); - } - } - + } dos->drag.isVisible = False; } } @@ -2428,9 +2542,8 @@ XSetWindowAttributes xswa; XtPopup((Widget)dos, XtGrabNone); xswa.cursor = XmeGetNullCursor((Widget)dos); - xswa.do_not_propagate_mask = _XmDRAG_EVENT_MASK(dc); XChangeWindowAttributes (display, XtWindow(dos), - CWCursor|CWDontPropagate, &xswa); + CWCursor, &xswa); /* * don't call thru class record since VendorS bug may be * causing override @@ -2506,8 +2619,6 @@ v.graphics_exposures = False; v.subwindow_mode = IncludeInferiors; v.clip_mask = None; - v.clip_x_origin = 0; /* pedantic */ - v.clip_y_origin = 0; /* pedantic */ vmask = GCBackground|GCForeground|GCFunction| GCClipXOrigin|GCClipYOrigin|GCClipMask| GCGraphicsExposures|GCSubwindowMode; @@ -2522,6 +2633,32 @@ XFillRectangle (display, mixedIcon->drag.mask, cursorBlend->gc, 0, 0, mixedIcon->drag.width, mixedIcon->drag.height); } + + /* Solaris 2.6 Motif diff bug 4076121 */ + if(sourceIcon->drag.region != NULL && mixedIcon->drag.region != NULL ) + { + XmDragIconObject stateIcon; + XmDragIconObject opIcon; + + stateIcon = dos->drag.stateIcon; + opIcon = dos->drag.opIcon; + + if(stateIcon && stateIcon->drag.region != NULL ) + { + XSubtractRegion(mixedIcon->drag.region, + stateIcon->drag.region, + mixedIcon->drag.region); + } + if(opIcon && opIcon->drag.region != NULL ) + { + XSubtractRegion(mixedIcon->drag.region, + opIcon->drag.region, + mixedIcon->drag.region); + } + + } + /* END Solaris 2.6 Motif diff bug 4076121 */ + BlendIcon (dos, sourceIcon, mixedIcon, blend->sourceX, blend->sourceY, cursorBlend->gc, blend->gc); @@ -2530,7 +2667,15 @@ * Remove the current drag window. */ XUnmapWindow(display, win); - + XSetClipMask (display, draw_gc, None); + if (BackingPixmap(dos) != XmUNSPECIFIED_PIXMAP) { + XCopyArea (display, BackingPixmap(dos), + RootWindowOfScreen(XtScreen(dos)), draw_gc, + 0, 0, + dos->core.width, dos->core.height, + BackingX(dos), BackingY(dos)); + } + /* * Handle an icon size change. */ @@ -2751,7 +2896,7 @@ pt.x = BackingX(dos) + rect1.x; pt.y = BackingY(dos); - if (rect1.width > 0) { + if (rect1.width != 0) { /* Wyoming 64-bit fix */ XCopyArea (display, old_backing, root, draw_gc, rect1.x, rect1.y, rect1.width, rect1.height, pt.x, pt.y); @@ -2775,7 +2920,7 @@ pt.x = BackingX(dos); pt.y = BackingY(dos) + rect2.y; - if (rect2.height > 0) { + if (rect2.height != 0) { /* Wyoming 64-bit fix */ XCopyArea (display, old_backing, root, draw_gc, rect2.x, rect2.y, rect2.width, rect2.height, pt.x, pt.y); @@ -3358,3 +3503,21 @@ FindColormapShell(dos); } } + + +/* Solaris 2.6 Motif diff bug 4076121 */ +static void +Realize( + Widget wid, + XtValueMask *vmask, + XSetWindowAttributes *attr ) +{ + WidgetClass super_wc = wid->core.widget_class->core_class.superclass ; + XSetWindowAttributes attrs; + + (*super_wc->core_class.realize)(wid, vmask, attr); + attrs.do_not_propagate_mask = ButtonPressMask; + XChangeWindowAttributes(XtDisplay(wid), XtWindow(wid), + CWDontPropagate, &attrs); +} +/* END Solaris 2.6 Motif diff bug 4076121 */ Only in Xm: DragOverS.c.orig diff -ur /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragOverSI.h Xm/DragOverSI.h --- /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DragOverSI.h Fri Jan 4 23:22:10 2002 +++ lib/Xm/DragOverSI.h Sun Oct 26 13:26:03 2003 @@ -105,6 +105,8 @@ Position initialY) ; #endif /* NeedWidePrototypes */ +extern void _XmDragOverUpdateCache(); + /******** End Private Function Declarations ********/ #ifdef __cplusplus diff -ur /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DropSMgr.c Xm/DropSMgr.c --- /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/DropSMgr.c Wed Jan 30 17:47:17 2002 +++ lib/Xm/DropSMgr.c Sun Oct 26 13:26:03 2003 @@ -47,6 +47,8 @@ #include #endif +#define _BSD_SOURCE + /***************************************************************************** * THE DROPSITE DATABASE @@ -131,6 +133,18 @@ #define DPRINT(x) #endif +/******** Linked List Data structure ********/ +typedef struct _listElement { + XtPointer dsm; + XtIntervalId ival_id; + struct _listElement *next; +}_listElement; + +static _listElement *intervalListHead = NULL; + +static void RemoveTimersByDSM(XtPointer); + + /******** Static Function Declarations ********/ static void ClassInit( void ) ; @@ -523,7 +537,6 @@ dsm->dropManager.rootW = dsm->dropManager.rootH = ~0; dsm->dropManager.clipperList = NULL; dsm->dropManager.updateInfo = NULL; - dsm->dropManager.updateTimeOutId = 0; /* Patch around broken Xt interfaces */ XtGetSubresources(nw, info, NULL, NULL, _XmDSResources, @@ -536,14 +549,13 @@ { XmDropSiteManagerObject dsm = (XmDropSiteManagerObject)w; - if (dsm->dropManager.updateTimeOutId) - XtRemoveTimeOut(dsm->dropManager.updateTimeOutId); - DSMDestroyTable(dsm); _XmRegionDestroy(dsm->dropManager.curAncestorClipRegion); _XmRegionDestroy(dsm->dropManager.newAncestorClipRegion); + RemoveTimersByDSM((XtPointer)dsm); } + /*ARGSUSED*/ static Boolean SetValues( @@ -576,8 +588,11 @@ { XtPointer *tab = &(dsm->dropManager.dsTable); +/* Solaris 2.6 Motif diff bug 4085003 1 line */ + _XmProcessLock(); *tab = (XtPointer) _XmAllocHashTable(100, CompareWidgets, HashWidget); + dsm->dropManager.updateInfo=NULL; _XmProcessUnlock(); } @@ -587,10 +602,14 @@ { XtPointer * tab = &(dsm->dropManager.dsTable); +/* Solaris 2.6 Motif diff bug 4085003 1 line */ + _XmProcessLock(); _XmFreeHashTable((XmHashTable) *tab); _XmProcessUnlock(); - *tab = NULL; + dsm->dropManager.dsTable = NULL; + dsm->dropManager.updateInfo = NULL; + tab = NULL; } #define DSTABLE(dsm) ((XmHashTable)(dsm->dropManager.dsTable)) @@ -867,7 +886,7 @@ } _XmProcessUnlock(); - for (i = 0; i < (int)GetDSNumChildren(parentInfo); i++) + for (i = 0; i < GetDSNumChildren(parentInfo); i++) { childInfo = (XmDSInfo) GetDSChild(parentInfo, i); /* @@ -938,7 +957,7 @@ if (GetDSLeaf(parentInfo)) return(False); - for (i=0; i < (int)GetDSNumChildren(parentInfo); i++) + for (i=0; i < GetDSNumChildren(parentInfo); i++) { childInfo = (XmDSInfo) GetDSChild(parentInfo, i); if (InsertClipper(dsm, childInfo, clipper)) @@ -948,7 +967,7 @@ if (IsDescendent(GetDSWidget(parentInfo), GetDSWidget(clipper))) { i = 0; - while (i < (int)GetDSNumChildren(parentInfo)) + while (i < GetDSNumChildren(parentInfo)) { childInfo = (XmDSInfo) GetDSChild(parentInfo, i); if (IsDescendent(GetDSWidget(clipper), @@ -1010,7 +1029,7 @@ * Pull all of the children up into the parent's child * list between the clipper and the clipper's sibling. */ - for (i = 0; i < (int)GetDSNumChildren(clipper); i++) { + for (i = 0; i < GetDSNumChildren(clipper); i++) { XmDSInfo childInfo = (XmDSInfo) GetDSChild(clipper, i); AddDSChild(parentInfo, childInfo, GetDSNumChildren(parentInfo)); } @@ -1033,7 +1052,7 @@ if (!GetDSLeaf(parentInfo)) { i = 0; - while(i < (int)GetDSNumChildren(parentInfo)) { + while(i < GetDSNumChildren(parentInfo)) { child = (XmDSInfo) GetDSChild(parentInfo, i); RemoveAllClippers(dsm, child); if (GetDSInternal(child)) @@ -1199,6 +1218,7 @@ { Widget widget = GetDSWidget(info); XmDSInfo parentInfo = (XmDSInfo) GetDSParent(info); + int k=0; RemoveDSChild(parentInfo, (XmDSInfo) info); @@ -1230,6 +1250,8 @@ DSMDestroyInfo(dsm, GetDSWidget(parentInfo)); } + + RemoveTimersByDSM((XtPointer)dsm); } @@ -1481,8 +1503,7 @@ _XmProcessUnlock(); return(False); } - - /* _XmProcessUnlock(); */ /* not reached */ + _XmProcessUnlock(); } @@ -1677,7 +1698,7 @@ /* trim off anything obsucred by a sibling stacked above us */ if (parentInfo != NULL) { - for (i = 0; i < (int)GetDSNumChildren(parentInfo); i++) + for (i = 0; i < GetDSNumChildren(parentInfo); i++) { child = (XmDSInfo) GetDSChild(parentInfo, i); if (child == info) @@ -1857,20 +1878,8 @@ * in shell coordinates; Local info's are in widget * relative coordinates. */ - if (GetDSRemote(info)) - { - outCB.x = extents.x + dsm->dropManager.rootX; - outCB.y = extents.y + dsm->dropManager.rootY; - } - else - { - Widget widget = GetDSWidget(info); - - XtTranslateCoords(widget, 0, 0, &tmpX, &tmpY); - - outCB.x = extents.x + tmpX; - outCB.y = extents.y + tmpY; - } + outCB.x = extents.x + dsm->dropManager.curX; + outCB.y = extents.y + dsm->dropManager.curY; (*(dsm->dropManager.notifyProc)) ((Widget)dsm, dsm->dropManager.client_data, @@ -2128,7 +2137,7 @@ Widget dragContext = XmGetDragContext((Widget)dsm, callback->timeStamp); XmDSInfo info = NULL; - Widget widget = NULL; + Widget widget; Position x, y, tmpX, tmpY; XmDSInfo savRoot, savInfo; XmDSInfo newRoot = (XmDSInfo) DSMWidgetToInfo(dsm, cd->destShell); @@ -2173,10 +2182,8 @@ if (newRoot != NULL) info = PointToDSInfo(dsm, (XmDSInfo) dsm->dropManager.dsRoot, x, y); - if (info != NULL) - { - widget = GetDSWidget(info); - } + if (info != NULL) widget = GetDSWidget(info); + /* Handle error conditions nicely */ if ((info == NULL) || ! XtIsManaged(widget) || /* CR 5215 */ @@ -2881,7 +2888,7 @@ PutDSToStream(dsm, parentInfo, last, dataPtr); last = False; - for (i = 0; i < (int)GetDSNumChildren(parentInfo); i++) + for (i = 0; i < GetDSNumChildren(parentInfo); i++) { if ((i + 1) == GetDSNumChildren(parentInfo)) last = True; @@ -3143,7 +3150,7 @@ XmDSInfo child; if (!GetDSLeaf(tree)) - for (i = 0; i < (int)GetDSNumChildren(tree); i++) + for (i = 0; i < GetDSNumChildren(tree); i++) { child = (XmDSInfo) GetDSChild(tree, i); FreeDSTree(child); @@ -3247,7 +3254,7 @@ if (!GetDSLeaf(info)) { - for (i = 0; i < (int)GetDSNumChildren(info); i++) + for (i = 0; i < GetDSNumChildren(info); i++) { child = (XmDSInfo) GetDSChild(info, i); acc += CountDropSites(child); @@ -3433,7 +3440,6 @@ Cardinal num_targets; long num_rects; XRectangle *rects; -int index; if (GetDSRemote(variant)) shell = XtParent(dsm); @@ -3466,20 +3472,11 @@ full_info->type = GetDSType(variant); full_info->animation_style = GetDSAnimationStyle(variant); full_info->activity = GetDSActivity(variant); - index = GetDSImportTargetsID(variant); - if (index) - { - num_targets = _XmIndexToTargets(shell, - index, &targets); - full_info->num_import_targets = num_targets; - full_info->import_targets = targets; - } - else - { - full_info->num_import_targets = 0; - full_info->import_targets = NULL; - } + num_targets = _XmIndexToTargets(shell, + GetDSImportTargetsID(variant), &targets); + full_info->num_import_targets = num_targets; + full_info->import_targets = targets; _XmRegionGetRectangles(GetDSRegion(variant), &rects, &num_rects); full_info->rectangles = rects; @@ -3815,7 +3812,7 @@ XmDSInfo child; int i; - for (i=0; i < (int)GetDSNumChildren(new_info); i++) + for (i=0; i < GetDSNumChildren(new_info); i++) { child = (XmDSInfo) GetDSChild(new_info, i); SetDSParent(child, new_info); @@ -3841,7 +3838,6 @@ { CopyFullIntoVariant(full_info, info); } - DSMEndUpdate(dsm, widget); if (rects!=NULL) XtFree ((char *)rects); @@ -3862,7 +3858,7 @@ shellInfo = (XmDSInfo) DSMWidgetToInfo(dsm, shell); if (shellInfo) - SetDSUpdateLevel(shellInfo, (GetDSUpdateLevel(shellInfo) + 1)); + SetDSUpdateLevel(shellInfo, (GetDSUpdateLevel(shellInfo) + (ptrdiff_t)1)); /* Wyoming 64-bit Fix */ } /*ARGSUSED*/ @@ -3876,10 +3872,12 @@ Boolean clean; Widget shell; XmDSInfo shellInfo; +#if defined(__linux__) || defined(_BSD_SOURCE) + int itemcount = 0; +#endif dsupdate = dsm -> dropManager.updateInfo; clean = (dsupdate == NULL); - shell = refWidget; while(!(XtIsShell(shell))) @@ -3890,7 +3888,7 @@ if (shellInfo == NULL) return; if (GetDSUpdateLevel(shellInfo) > 0) - SetDSUpdateLevel(shellInfo, (GetDSUpdateLevel(shellInfo) - 1)); + SetDSUpdateLevel(shellInfo, (GetDSUpdateLevel(shellInfo) - (ptrdiff_t)1)); /* Wyoming 64-bit Fix */ if (GetDSUpdateLevel(shellInfo) > 0) return; @@ -3898,8 +3896,12 @@ list manipulation */ oldupdate = dsupdate; +#if defined(__linux__) || defined(_BSD_SOURCE) + itemcount=0; +#endif /* Really, keep track of toplevel widgets to be updated */ while(dsupdate) { + itemcount++; if (dsupdate -> refWidget == shell) { found = True; break; @@ -3907,7 +3909,11 @@ dsupdate = dsupdate -> next; } - if (! found) { +#if defined(__linux__) || defined(_BSD_SOURCE) + if (! found && itemcount > 0 ) { +#else + if (! found ) { +#endif /* Queue real end update to a timeout */ dsupdate = (_XmDropSiteUpdateInfo) XtMalloc(sizeof(_XmDropSiteUpdateInfoRec)); @@ -3915,16 +3921,32 @@ dsupdate -> refWidget = shell; dsupdate -> next = oldupdate; dsm -> dropManager.updateInfo = dsupdate; + +#if defined(__linux__) || defined(_BSD_SOURCE) + } else if (itemcount == 0) { + dsupdate = (_XmDropSiteUpdateInfo) + XtMalloc(sizeof(_XmDropSiteUpdateInfoRec)); + dsupdate -> dsm =dsm; + dsupdate -> refWidget = shell; + dsupdate -> next = NULL; + dsm -> dropManager.updateInfo = dsupdate; + } +#else } +#endif /* We don't add a timeout if the record is already marked for update */ - if (clean) { - dsm -> dropManager.updateTimeOutId = - XtAppAddTimeOut(XtWidgetToApplicationContext(shell), 0, - _XmIEndUpdate, dsm); + if (clean && dsm != NULL) { +#if defined(__linux__) || defined(_BSD_SOURCE) + _XmIEndUpdate((XtPointer) dsm, (XtIntervalId *) NULL); +#else + XtAppAddTimeOut(XtWidgetToApplicationContext(shell), 0, _XmIEndUpdate, dsm); +#endif } + } + /*ARGSUSED*/ void _XmIEndUpdate(XtPointer client_data, XtIntervalId *interval_id) @@ -3933,18 +3955,15 @@ _XmDropSiteUpdateInfo dsupdate; Widget shell; XmDSInfo shellInfo; +/* XXX: _XmWidgetToAppContext(dsupdate->refWidget); */ - /* Remove timeout if this is a forced update */ - if (dsm -> dropManager.updateTimeOutId) { - if (interval_id == NULL) - XtRemoveTimeOut(dsm -> dropManager.updateTimeOutId); - dsm -> dropManager.updateTimeOutId = 0; - } - +/* XXX: _XmAppLock(app); */ /* Return if all updates have already happened */ - while(dsm -> dropManager.updateInfo != NULL) { + while(dsm -> dropManager.updateInfo != NULL && + dsm->dropManager.dsTable != NULL) { dsupdate = (_XmDropSiteUpdateInfo) dsm -> dropManager.updateInfo; shell = dsupdate -> refWidget; + dsm -> dropManager.updateInfo = dsupdate -> next; XtFree((char*) dsupdate); @@ -3972,25 +3991,28 @@ (dsm->dropManager.treeUpdateProc) ((Widget) dsm, NULL, (XtPointer) &outCB); } - else - { + else { /* We have to Sync the regions with the widgets */ SyncTree(dsm, shell); } } - } + } +/* XXX: _XmAppUnlock(app); */ } + static void DestroyInfo( XmDropSiteManagerObject dsm, Widget widget ) { XmDSInfo info = (XmDSInfo) DSMWidgetToInfo(dsm, widget); + _XmWidgetToAppContext(widget); if (info == NULL) return; + _XmAppLock(app); DSMStartUpdate(dsm, widget); if (info == (XmDSInfo) (dsm->dropManager.curInfo)) @@ -4037,8 +4059,8 @@ until done */ info = (XmDSInfo) DSMWidgetToInfo(dsm, widget); } - DSMEndUpdate(dsm, widget); + _XmAppUnlock(app); } static void @@ -4052,7 +4074,7 @@ { int i; - for (i = 0; i < (int)GetDSNumChildren(info); i++) + for (i = 0; i < GetDSNumChildren(info); i++) { child = (XmDSInfo) GetDSChild(info, i); SyncDropSiteGeometry(dsm, child); @@ -4253,11 +4275,14 @@ XtPointer call_data ) { XmDropSiteManagerObject dsm = (XmDropSiteManagerObject) client_data; + _XmWidgetToAppContext(widget); + _XmAppLock(app); DSMDestroyInfo(dsm, widget); /* Force Update */ _XmIEndUpdate((XtPointer) dsm, (XtIntervalId *) NULL); + _XmAppUnlock(app); } Boolean @@ -4421,7 +4446,7 @@ if (!GetDSLeaf(info)) { - for (i=0; i < (int)GetDSNumChildren(info); i++) + for (i=0; i < GetDSNumChildren(info); i++) { XmDSInfo child = (XmDSInfo) GetDSChild(info, i); if (!GetDSInternal(child)) @@ -4548,7 +4573,7 @@ SwapDSChildren(parent, i, i - 1); break; case XmBELOW: - for (i=index; i < (int)(GetDSNumChildren(parent) - 1); i++) + for (i=index; i < (GetDSNumChildren(parent) - 1); i++) SwapDSChildren(parent, i, i + 1); break; default: @@ -4577,7 +4602,9 @@ sizeof(XmDropSiteVisualsRec)); /* Update if dsm is dirty */ +#if !defined(__linux__) && !defined(_BSD_SOURCE) _XmIEndUpdate((XtPointer) dsm, (XtIntervalId *) NULL); +#endif if (info == NULL) { @@ -4772,6 +4799,30 @@ return(GetDSWidget(info)); } + + +static void +RemoveTimersByDSM(XtPointer dsm) +{ + _listElement * item=intervalListHead, + ** itempp=&intervalListHead; + + while (item) + { + if (item->dsm == dsm) + { + XtRemoveTimeOut(item->ival_id); + *itempp = item->next; + XtFree((char *)item); + } + else + { + itempp = &item->next; + } + item = *itempp; + } +} + #ifdef DEBUG /********************************************************************** Only in Xm: DropSMgr.c.orig Only in Xm: Makefile diff -ur /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/ShellE.c Xm/ShellE.c --- /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/ShellE.c Thu Jan 10 22:56:53 2002 +++ lib/Xm/ShellE.c Sun Oct 26 13:26:03 2003 @@ -330,3 +330,24 @@ (*resize)((Widget) w); } } + +void +_XmSyncShellPosition(Widget widget) { + Widget w = widget; + for ( ; w != NULL && !XtIsShell(w); w = XtParent(w)); + + if (w != NULL && XtIsRealized(w)) { + Display *dpy = XtDisplay(w); + Window root = RootWindowOfScreen(XtScreen(w)); + Window win = XtWindow(w); + Window child = None; + int x = 0; + int y = 0; + + XTranslateCoordinates(dpy, win, root, 0, 0, &x, &y, &child); + + w->core.x = (Position)x; + w->core.y = (Position)y; + } +} + diff -ur /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/ShellEP.h Xm/ShellEP.h --- /var/portbuild/usr/ports/x11-toolkits/open-motif/work/openmotif-2.2.2/lib/Xm/ShellEP.h Fri Jan 4 23:22:56 2002 +++ lib/Xm/ShellEP.h Sun Oct 26 13:26:03 2003 @@ -100,6 +100,17 @@ /******** Private Function Declarations ********/ +#ifdef _NO_PROTO + +extern void _XmSyncShellPosition(); + +#else + +extern void _XmSyncShellPosition(Widget w); + +#endif /* _NO_PROTO */ + + /******** End Private Function Declarations ********/ Only in Xm: libXm.la --6TrnltStXW4iwmi0--