summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-09-04 14:32:41 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-09-04 14:32:41 (GMT)
commitdd93cf9a8f269f6ea8020e64e881a3a327ef677f (patch)
treed9dbfd5903c72b5d93cdb58cb8ccdaf1eb6acb91 /win
parentb9ff10225e28c24733fe06712500cdfa1e0454ea (diff)
parent3f5641ced949113a086adc0abd956b7d42f8f8f3 (diff)
downloadtk-dd93cf9a8f269f6ea8020e64e881a3a327ef677f.zip
tk-dd93cf9a8f269f6ea8020e64e881a3a327ef677f.tar.gz
tk-dd93cf9a8f269f6ea8020e64e881a3a327ef677f.tar.bz2
Fix [d2396a9f1b]: [send] with options returns weird strings on X11
Diffstat (limited to 'win')
-rw-r--r--win/tkWinSend.c79
1 files changed, 21 insertions, 58 deletions
diff --git a/win/tkWinSend.c b/win/tkWinSend.c
index 7aaee7e..a855d22 100644
--- a/win/tkWinSend.c
+++ b/win/tkWinSend.c
@@ -64,8 +64,6 @@ static Tcl_ThreadDataKey dataKey;
#ifdef TK_SEND_ENABLED_ON_WINDOWS
static void CmdDeleteProc(void *clientData);
-static void InterpDeleteProc(void *clientData,
- Tcl_Interp *interp);
static void RevokeObjectRegistration(RegisteredInterp *riPtr);
#endif /* TK_SEND_ENABLED_ON_WINDOWS */
static HRESULT BuildMoniker(const char *name, LPMONIKER *pmk);
@@ -212,12 +210,11 @@ Tk_SetAppName(
int
TkGetInterpNames(
Tcl_Interp *interp, /* Interpreter for returning a result. */
- Tk_Window tkwin) /* Window whose display is to be used for the
+ TCL_UNUSED(Tk_Window)) /* Window whose display is to be used for the
* lookup. */
{
#ifndef TK_SEND_ENABLED_ON_WINDOWS
(void)interp;
- (void)tkwin;
/*
* Temporarily disabled for bug #858822
*/
@@ -331,29 +328,34 @@ Tk_SendObjCmd(
{
enum {
SEND_ASYNC, SEND_DISPLAYOF, SEND_LAST
- };
+ } index;
static const char *const sendOptions[] = {
"-async", "-displayof", "--", NULL
};
+ const char *stringRep;
int result = TCL_OK;
- int i, optind, async = 0;
- Tcl_Obj *displayPtr = NULL;
+ int i, async = 0;
/*
* Process the command options.
*/
- for (i = 1; i < objc; i++) {
- if (Tcl_GetIndexFromObjStruct(interp, objv[i], sendOptions,
- sizeof(char *), "option", 0, &optind) != TCL_OK) {
- break;
- }
- if (optind == SEND_ASYNC) {
- ++async;
- } else if (optind == SEND_DISPLAYOF) {
- displayPtr = objv[++i];
- } else if (optind == SEND_LAST) {
- i++;
+ for (i = 1; i < (objc - 1); i++) {
+ stringRep = Tcl_GetString(objv[i]);
+ if (stringRep[0] == '-') {
+ if (Tcl_GetIndexFromObjStruct(interp, objv[i], sendOptions,
+ sizeof(char *), "option", 0, &index) != TCL_OK) {
+ break;
+ }
+ if (index == SEND_ASYNC) {
+ async = 1;
+ } else if (index == SEND_DISPLAYOF) {
+ i++;
+ } else /* if (index == SEND_LAST) */ {
+ i++;
+ break;
+ }
+ } else {
break;
}
}
@@ -362,25 +364,13 @@ Tk_SendObjCmd(
* Ensure we still have a valid command.
*/
- if ((objc - i) < 2) {
+ if (objc < (i + 2)) {
Tcl_WrongNumArgs(interp, 1, objv,
"?-async? ?-displayof? ?--? interpName arg ?arg ...?");
result = TCL_ERROR;
}
/*
- * We don't support displayPtr. See TIP #150.
- */
-
- if (displayPtr) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "option not implemented: \"displayof\" is not available"
- " for this platform.", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TK", "SEND", "DISPLAYOF_WIN", NULL);
- result = TCL_ERROR;
- }
-
- /*
* Send the arguments to the foreign interp.
*/
/* FIX ME: we need to check for local interp */
@@ -571,33 +561,6 @@ RevokeObjectRegistration(
/*
* ----------------------------------------------------------------------
*
- * InterpDeleteProc --
- *
- * This is called when the interpreter is deleted and used to unregister
- * the COM libraries.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- * ----------------------------------------------------------------------
- */
-
-#ifdef TK_SEND_ENABLED_ON_WINDOWS
-static void
-InterpDeleteProc(
- void *clientData,
- Tcl_Interp *interp)
-{
- CoUninitialize();
-}
-#endif /* TK_SEND_ENABLED_ON_WINDOWS */
-
-/*
- * ----------------------------------------------------------------------
- *
* BuildMoniker --
*
* Construct a moniker from the given name. This ensures that all our