summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-22 08:34:36 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-22 08:34:36 (GMT)
commitb67be45d1807e075425cf3337dcb3c9a6abe534c (patch)
tree4c859c51b357799978ab9a803b0b68cb29d66297 /unix
parentf76a56b12b16dcadb74a3227122180b565685410 (diff)
parent689cf0354d07b2dd98217e9f836cf734e9f5741e (diff)
downloadtk-b67be45d1807e075425cf3337dcb3c9a6abe534c.zip
tk-b67be45d1807e075425cf3337dcb3c9a6abe534c.tar.gz
tk-b67be45d1807e075425cf3337dcb3c9a6abe534c.tar.bz2
Merge 8.7. Remove utility functions which should be provided by Tcl
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixMenu.c4
-rwxr-xr-xunix/tkUnixSysNotify.c22
2 files changed, 19 insertions, 7 deletions
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 97aeffc..1eba266 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -854,13 +854,13 @@ DrawMenuUnderline(
if (mePtr->labelPtr != NULL) {
int len;
- len = TkNumUtfChars(Tcl_GetString(mePtr->labelPtr), -1);
+ len = Tcl_GetCharLength(mePtr->labelPtr));
if (mePtr->underline < len && mePtr->underline >= -len) {
int activeBorderWidth, leftEdge, ch;
const char *label, *start, *end;
label = Tcl_GetString(mePtr->labelPtr);
- start = TkUtfAtIndex(label, (mePtr->underline < 0) ? mePtr->underline + len : mePtr->underline);
+ start = Tcl_UtfAtIndex(label, (mePtr->underline < 0) ? mePtr->underline + len : mePtr->underline);
end = start + TkUtfToUniChar(start, &ch);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
diff --git a/unix/tkUnixSysNotify.c b/unix/tkUnixSysNotify.c
index 1572027..3985f0e 100755
--- a/unix/tkUnixSysNotify.c
+++ b/unix/tkUnixSysNotify.c
@@ -108,6 +108,7 @@ SysNotifyCmd(
const char *title;
const char *message;
const char *icon;
+ const char *appname = "Wish";
void *notif;
if (objc < 3) {
@@ -124,6 +125,15 @@ SysNotifyCmd(
message = Tcl_GetString(objv[2]);
icon = "dialog-information";
+
+ /* Use the appname for libnotify initialization
+ * See bug f63c37be3a for a discussion whether this should be
+ * allowed at all on safe interpreters
+ */
+ if (!Tcl_IsSafe(interp)) {
+ appname = ((TkWindow *)Tk_MainWindow(interp))->nameUid;
+ }
+
/*
* Call to notify_init should go here to prevent test suite failure.
*/
@@ -132,11 +142,14 @@ SysNotifyCmd(
Tcl_Encoding enc;
Tcl_DString dst, dsm;
+ Tcl_DStringInit(&dst);
+ Tcl_DStringInit(&dsm);
enc = Tcl_GetEncoding(NULL, "utf-8");
- Tcl_ExternalToUtfDString(enc, title, -1, &dst);
- Tcl_ExternalToUtfDString(enc, message, -1, &dsm);
- notify_init("Wish");
- notif = notify_notification_new(title, message, icon, NULL);
+ Tcl_UtfToExternalDString(enc, title, -1, &dst);
+ Tcl_UtfToExternalDString(enc, message, -1, &dsm);
+ notify_init(appname);
+ notif = notify_notification_new(Tcl_DStringValue(&dst),
+ Tcl_DStringValue(&dsm), icon, NULL);
notify_notification_show(notif, NULL);
Tcl_DStringFree(&dsm);
Tcl_DStringFree(&dst);
@@ -218,4 +231,3 @@ SysNotify_Init(
* coding: utf-8
* End:
*/
-