diff options
author | petasis <petasis@f3661a36-4baa-549a-d6c7-40e0ffef350e> | 2010-06-16 18:25:46 (GMT) |
---|---|---|
committer | petasis <petasis@f3661a36-4baa-549a-d6c7-40e0ffef350e> | 2010-06-16 18:25:46 (GMT) |
commit | dba5f8f36b76953baa8696cb55de86e89bcd1265 (patch) | |
tree | 93fcedcc4404256e2eaf5df4da180a7bbafd3bdb | |
parent | 2b59ebc5f1f4d4c88081cc8ed903b1794928bd2a (diff) | |
download | tkdnd-dba5f8f36b76953baa8696cb55de86e89bcd1265.zip tkdnd-dba5f8f36b76953baa8696cb55de86e89bcd1265.tar.gz tkdnd-dba5f8f36b76953baa8696cb55de86e89bcd1265.tar.bz2 |
Patch from Andreas Kupries
-rw-r--r-- | Changelog | 14 | ||||
-rw-r--r-- | Makefile.in | 3 | ||||
-rw-r--r-- | configure.in | 5 | ||||
-rw-r--r-- | unix/TkDND_XDND.c | 46 | ||||
-rw-r--r-- | win/Makefile | 2 | ||||
-rw-r--r-- | win/TkDND_OleDND.cpp | 2 |
6 files changed, 48 insertions, 24 deletions
@@ -1,3 +1,17 @@ +2010-06-16 Petasis George <petasis@iit.demokritos.gr> + TkDND 2.2 released. + * Makefile.in: + * configure.in: + * win/Makefile: + * win/TkDND_OleDND.cpp: + * unix/TkDND_XDND.c: Applied a patch from Andreas Kupries, which + make the unix code compatible with compilers supporting C89 (i.e. + AIX's cc). Also, the TEA files were updated. + + * /unix/TkDND_XDND.c: Fixed a bug in TkDND_RegisterTypesObjCmd. + It seems that KDE wants the XdndAware property on the window these + days, and not at the toplevel one. + 2010-06-11 Petasis George <petasis@iit.demokritos.gr> TkDND 2.1 released. diff --git a/Makefile.in b/Makefile.in index 3830a51..a336645 100644 --- a/Makefile.in +++ b/Makefile.in @@ -286,6 +286,9 @@ $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx .c.@OBJEXT@: $(COMPILE) -c `@CYGPATH@ $<` -o $@ +.cpp.@OBJEXT@: + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + .m.@OBJEXT@: $(COMPILE) -c `@CYGPATH@ $<` -o $@ diff --git a/configure.in b/configure.in index 5473b90..c28d03c 100644 --- a/configure.in +++ b/configure.in @@ -94,6 +94,9 @@ TEA_ADD_TCL_SOURCES([library/tkdnd_compat.tcl library/tkdnd.tcl library/tkdnd_un #-------------------------------------------------------------------- if test "${TEA_PLATFORM}" = "windows" ; then + TEA_ADD_SOURCES([win/TkDND_OleDND.cpp]) + TEA_ADD_LIBS(kernel32.lib user32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib) + AC_DEFINE(BUILD_tkdnd, 1, [Build windows export dll]) CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" #TEA_ADD_SOURCES([win/winFile.c]) @@ -105,7 +108,7 @@ else fi if test "${TEA_WINDOWINGSYSTEM}" = "x11"; then -TEA_ADD_SOURCES([unix/TkDND_XDND.c]) + TEA_ADD_SOURCES([unix/TkDND_XDND.c]) fi if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then diff --git a/unix/TkDND_XDND.c b/unix/TkDND_XDND.c index 5372cb4..b581369 100644 --- a/unix/TkDND_XDND.c +++ b/unix/TkDND_XDND.c @@ -76,12 +76,16 @@ Tcl_Interp * TkDND_Interp(Tk_Window tkwin) { return ((TkWindow *)tkwin)->mainPtr->interp; } return NULL; -}; /* Tk_Interp */ +} /* Tk_Interp */ #define Tk_Interp TkDND_Interp #endif /* Tk_Interp */ int TkDND_RegisterTypesObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + + Atom version = XDND_VERSION; + Tk_Window path = TkDND_TkWin(objv[1]); + if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "path toplevel types-list"); return TCL_ERROR; @@ -91,11 +95,6 @@ int TkDND_RegisterTypesObjCmd(ClientData clientData, Tcl_Interp *interp, * We must make the toplevel that holds this widget XDND aware. This means * that we have to set the XdndAware property on our toplevel. */ - Window root_return, parent, *children_return = 0; - unsigned int nchildren_return; - int status; - Atom version = XDND_VERSION; - Tk_Window path = TkDND_TkWin(objv[1]); Tk_MakeWindowExist(path); XChangeProperty(Tk_Display(path), Tk_WindowId(path), Tk_InternAtom(path, "XdndAware"), @@ -103,6 +102,9 @@ int TkDND_RegisterTypesObjCmd(ClientData clientData, Tcl_Interp *interp, (unsigned char *) &version, 1); return TCL_OK; #if 0 + int status; + Window root_return, parent, *children_return = 0; + unsigned int nchildren_return; Tk_Window toplevel = TkDND_TkWin(objv[2]); if (!Tk_IsTopLevel(toplevel)) { Tcl_ResetResult(interp); @@ -129,8 +131,10 @@ int TkDND_HandleXdndEnter(Tk_Window tkwin, XClientMessageEvent cm) { Atom *typelist; const long *l = cm.data.l; int i, version = (int)(((unsigned long)(l[1])) >> 24); + Window drag_source; + Tcl_Obj* objv[4], *element; if (interp == NULL) return False; - Window drag_source = l[0]; + drag_source = l[0]; if (version > XDND_VERSION) return False; if (l[1] & 0x1UL) { /* Get the types from XdndTypeList property. */ @@ -157,7 +161,6 @@ int TkDND_HandleXdndEnter(Tk_Window tkwin, XClientMessageEvent cm) { } /* We have all the information we need. Its time to pass it at the Tcl * level.*/ - Tcl_Obj* objv[4], *element; objv[0] = Tcl_NewStringObj("tkdnd::xdnd::_HandleXdndEnter", -1); objv[1] = Tcl_NewStringObj(Tk_PathName(tkwin), -1); objv[2] = Tcl_NewLongObj(drag_source); @@ -169,7 +172,7 @@ int TkDND_HandleXdndEnter(Tk_Window tkwin, XClientMessageEvent cm) { TkDND_Eval(4); Tcl_Free((char *) typelist); return True; -}; /* TkDND_HandleXdndEnter */ +} /* TkDND_HandleXdndEnter */ int TkDND_HandleXdndPosition(Tk_Window tkwin, XClientMessageEvent cm) { Tcl_Interp *interp = Tk_Interp(tkwin); @@ -239,10 +242,10 @@ int TkDND_HandleXdndPosition(Tk_Window tkwin, XClientMessageEvent cm) { response.format = 32; response.message_type = Tk_InternAtom(tkwin, "XdndStatus"); response.data.l[0] = (mouse_tkwin!=NULL) ? Tk_WindowId(mouse_tkwin) : 0; - response.data.l[1] = 1; // yes - response.data.l[2] = ((rootX) << 16) | ((rootY) & 0xFFFFUL); // x, y - response.data.l[3] = ((width) << 16) | ((height) & 0xFFFFUL); // w, h - response.data.l[4] = 0; // action + response.data.l[1] = 1; /* yes */ + response.data.l[2] = ((rootX) << 16) | ((rootY) & 0xFFFFUL); /* x, y */ + response.data.l[3] = ((width) << 16) | ((height) & 0xFFFFUL); /* w, h */ + response.data.l[4] = 0; /* action */ switch ((enum dropactions) index) { case ActionDefault: case ActionCopy: @@ -262,17 +265,17 @@ int TkDND_HandleXdndPosition(Tk_Window tkwin, XClientMessageEvent cm) { XSendEvent(cm.display, response.window, False, NoEventMask, (XEvent*)&response); return True; -}; /* TkDND_HandleXdndPosition */ +} /* TkDND_HandleXdndPosition */ int TkDND_HandleXdndLeave(Tk_Window tkwin, XClientMessageEvent cm) { Tcl_Interp *interp = Tk_Interp(tkwin); - if (interp == NULL) return False; Tcl_Obj* objv[1]; int i; + if (interp == NULL) return False; objv[0] = Tcl_NewStringObj("tkdnd::xdnd::_HandleXdndLeave", -1); TkDND_Eval(1); return True; -}; /* TkDND_HandleXdndLeave */ +} /* TkDND_HandleXdndLeave */ int TkDND_HandleXdndDrop(Tk_Window tkwin, XClientMessageEvent cm) { XClientMessageEvent finished; @@ -309,7 +312,7 @@ int TkDND_HandleXdndDrop(Tk_Window tkwin, XClientMessageEvent cm) { objv[0] = Tcl_NewStringObj("tkdnd::xdnd::_HandleXdndDrop", -1); objv[1] = Tcl_NewLongObj(time); TkDND_Status_Eval(2); - finished.data.l[1] = 1; // Accept drop. + finished.data.l[1] = 1; /* Accept drop. */ if (status == TCL_OK) { /* Get the returned action... */ result = Tcl_GetObjResult(interp); Tcl_IncrRefCount(result); @@ -343,19 +346,20 @@ int TkDND_HandleXdndDrop(Tk_Window tkwin, XClientMessageEvent cm) { XSendEvent(cm.display, finished.window, False, NoEventMask, (XEvent*)&finished); return True; -}; /* TkDND_HandleXdndDrop */ +} /* TkDND_HandleXdndDrop */ int TkDND_HandleXdndStatus(Tk_Window tkwin, XClientMessageEvent cm) { return False; -}; /* TkDND_HandleXdndStatus */ +} /* TkDND_HandleXdndStatus */ int TkDND_HandleXdndFinished(Tk_Window tkwin, XClientMessageEvent cm) { return False; -}; /* TkDND_HandleXdndFinished */ +} /* TkDND_HandleXdndFinished */ static int TkDND_XDNDHandler(Tk_Window tkwin, XEvent *xevent) { + XClientMessageEvent clientMessage; if (xevent->type != ClientMessage) return False; - XClientMessageEvent clientMessage = xevent->xclient; + clientMessage = xevent->xclient; if (clientMessage.message_type == Tk_InternAtom(tkwin, "XdndPosition")) { #ifdef DEBUG_CLIENTMESSAGE_HANDLER diff --git a/win/Makefile b/win/Makefile index 67a71a7..09c779b 100644 --- a/win/Makefile +++ b/win/Makefile @@ -57,7 +57,7 @@ RMDIR = rmdir /S /Q all:
$(cc32) $(cflags) $(INCDIR) TkDND_OleDND.cpp \
- -D TKDND_PACKAGE="\"tkdnd\"" -D TKDND_VERSION="\"2.0\""
+ -D PACKAGE_NAME="\"tkdnd\"" -D PACKAGE_VERSION="\"2.1\""
$(link32) $(lflags) $(LIBDIR) tclstub84.lib tkstub84.lib $(LIBS)\
TkDND_OleDND.obj -out:"..\libtkdnd20.dll"
$(RM) ..\*.exp ..\*.lib *.idb *.pch *.obj
diff --git a/win/TkDND_OleDND.cpp b/win/TkDND_OleDND.cpp index fa92ffc..a2d8053 100644 --- a/win/TkDND_OleDND.cpp +++ b/win/TkDND_OleDND.cpp @@ -396,7 +396,7 @@ int DLLEXPORT Tkdnd_Init(Tcl_Interp *interp) { return TCL_ERROR;
}
- Tcl_PkgProvide(interp, TKDND_PACKAGE, TKDND_VERSION);
+ Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION);
return TCL_OK;
} /* Tkdnd_Init */
|