summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/systray.tcl2
-rw-r--r--macosx/tkMacOSXSysTray.c2
-rw-r--r--unix/tkUnixSysTray.c5
-rw-r--r--win/tkWinIco.c69
-rw-r--r--win/tkWinIco.h2
-rw-r--r--win/tkWinSysTray.c93
-rw-r--r--win/tkWinWm.c114
7 files changed, 78 insertions, 209 deletions
diff --git a/library/systray.tcl b/library/systray.tcl
index 99b2c1f..7587b02 100644
--- a/library/systray.tcl
+++ b/library/systray.tcl
@@ -1,6 +1,6 @@
# systray.tcl --
-# This file defines the ::tk::systray command for icon display and manipulation
+# This file defines the systray command for icon display and manipulation
# in the system tray on X11, Windows, and macOS, and the ::tk::systnotify command
# for system alerts on each platform. It implements an abstraction layer that
# presents a consistent API across the three platforms.
diff --git a/macosx/tkMacOSXSysTray.c b/macosx/tkMacOSXSysTray.c
index 21e126e..b0021d0 100644
--- a/macosx/tkMacOSXSysTray.c
+++ b/macosx/tkMacOSXSysTray.c
@@ -200,7 +200,7 @@ MacSystrayObjCmd(
int objc,
Tcl_Obj *const *objv)
{
- Tk_Image tk_image;
+ Tk_Image tk_image;
TkSizeT length;
const char *arg = TkGetStringFromObj(objv[1], &length);
if ((strncmp(arg, "create", length) == 0) && (length >= 2)) {
diff --git a/unix/tkUnixSysTray.c b/unix/tkUnixSysTray.c
index 6e62ef8..a74a5f4 100644
--- a/unix/tkUnixSysTray.c
+++ b/unix/tkUnixSysTray.c
@@ -240,6 +240,7 @@ static int IconGenericHandler(ClientData cd, XEvent *ev);
int Tktray_Init ( Tcl_Interp* interp );
+#if 0
/*
*----------------------------------------------------------------------
*
@@ -269,7 +270,9 @@ static int TrayIconObjectCmd(ClientData cd, Tcl_Interp *interp,
int msgid;
enum {XWC_CONFIGURE=0, XWC_CGET, XWC_BALLOON, XWC_CANCEL, XWC_BBOX, XWC_DOCKED, XWC_ORIENTATION};
+ if 0
const char *st_wcmd[]={"configure","cget","balloon","cancel","bbox","docked","orientation",NULL};
+ end if
long timeout = 0;
Tcl_Obj* optionValue;
@@ -370,7 +373,7 @@ static int TrayIconObjectCmd(ClientData cd, Tcl_Interp *interp,
}
return TCL_OK;
}
-
+#end if
/*
*----------------------------------------------------------------------
*
diff --git a/win/tkWinIco.c b/win/tkWinIco.c
index b301ceb..f23d619 100644
--- a/win/tkWinIco.c
+++ b/win/tkWinIco.c
@@ -123,6 +123,75 @@ BytesPerLine(
/*
+ *----------------------------------------------------------------------
+ *
+ * AdjustIconImagePointers --
+ *
+ * Adjusts internal pointers in icon resource struct, as given by
+ * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon
+ * code.
+ *
+ * Results:
+ * BOOL - TRUE for success, FALSE for failure
+ *
+ *----------------------------------------------------------------------
+ */
+
+static BOOL
+AdjustIconImagePointers(
+ LPICONIMAGE lpImage)
+{
+ /*
+ * Sanity check.
+ */
+
+ if (lpImage == NULL) {
+ return FALSE;
+ }
+
+ /*
+ * BITMAPINFO is at beginning of bits.
+ */
+
+ lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits;
+
+ /*
+ * Width - simple enough.
+ */
+
+ lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
+
+ /*
+ * Icons are stored in funky format where height is doubled so account for
+ * that.
+ */
+
+ lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
+
+ /*
+ * How many colors?
+ */
+
+ lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes
+ * lpImage->lpbi->bmiHeader.biBitCount;
+
+ /*
+ * XOR bits follow the header and color table.
+ */
+
+ lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi);
+
+ /*
+ * AND bits follow the XOR bits.
+ */
+
+ lpImage->lpAND = lpImage->lpXOR +
+ lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi);
+ return TRUE;
+}
+
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4
diff --git a/win/tkWinIco.h b/win/tkWinIco.h
index c8d51a1..db2e204 100644
--- a/win/tkWinIco.h
+++ b/win/tkWinIco.h
@@ -92,6 +92,8 @@ LPSTR FindDIBBits(LPSTR lpbi);
WORD PaletteSize(LPSTR lpbi);
WORD DIBNumColors(LPSTR lpbi);
int ReadICOHeader(Tcl_Channel channel);
+BOOL AdjustIconImagePointers(LPICONIMAGE lpImage);
+
/*
* Local Variables:
diff --git a/win/tkWinSysTray.c b/win/tkWinSysTray.c
index 5044d60..f26c39d 100644
--- a/win/tkWinSysTray.c
+++ b/win/tkWinSysTray.c
@@ -176,99 +176,6 @@ FreeIconResource(BlockOfIconImagesPtr lpIR) {
}
-
-/*
- *----------------------------------------------------------------------
- *
- * AdjustICONIMAGEPointers --
- *
- * Adjust internal pointers in icon resource struct.
- *
- * Results:
- * Pointers adjusted as needed in icon resource struct.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static BOOL
-AdjustICONIMAGEPointers(LPICONIMAGE lpImage) {
- /* Sanity check */
- if (lpImage == NULL)
- return FALSE;
- /* BITMAPINFO is at beginning of bits */
- lpImage -> lpbi = (LPBITMAPINFO) lpImage -> lpBits;
- /* Width - simple enough */
- lpImage -> Width = lpImage -> lpbi -> bmiHeader.biWidth;
- /* Icons are stored in funky format where height is doubled - account for it */
- lpImage -> Height = (lpImage -> lpbi -> bmiHeader.biHeight) / 2;
- /* How many colors? */
- lpImage -> Colors = lpImage -> lpbi -> bmiHeader.biPlanes * lpImage -> lpbi -> bmiHeader.biBitCount;
- /* XOR bits follow the header and color table */
- lpImage -> lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage -> lpbi);
- /* AND bits follow the XOR bits */
- lpImage -> lpAND = lpImage -> lpXOR + (lpImage -> Height * BytesPerLine((LPBITMAPINFOHEADER)(lpImage -> lpbi)));
- return TRUE;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * ReadICOHeader --
- *
- * Read the header from an ICO file.
- *
- * Results:
- * Icon is created.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-
-static int
-ReadICOHeader(Tcl_Channel channel) {
- WORD Input;
- DWORD dwBytesRead;
-
- /* Read the 'reserved' WORD */
- if ((dwBytesRead = Tcl_Read(channel, (char * ) & Input, sizeof(WORD))) < 0)
- return -1;
-
- /* Did we get a WORD? */
- if (dwBytesRead != sizeof(WORD))
- return -1;
-
- /* Was it 'reserved' ? (ie 0) */
- if (Input != 0)
- return -1;
-
- /* Read the type WORD */
- if ((dwBytesRead = Tcl_Read(channel, (char * ) & Input, sizeof(WORD))) < 0)
- return -1;
-
- /* Did we get a WORD? */
- if (dwBytesRead != sizeof(WORD))
- return -1;
- /* Was it type 1? */
- if (Input != 1)
- return -1;
-
- /* Get the count of images */
- if ((dwBytesRead = Tcl_Read(channel, (char * ) & Input, sizeof(WORD))) < 0)
- return -1;
- /* Did we get a WORD? */
- if (dwBytesRead != sizeof(WORD))
- return -1;
- /* Return the count */
- return (int) Input;
-}
-
/*
* If someone wants to see the several masks somewhere on the screen...
* set the ICO_DRAW define and feel free to make some Tcl commands
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 587d6af..d856da0 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -14,7 +14,7 @@
*/
#include "tkWinInt.h"
-#include "TkWinIco.h"
+#include "tkWinIco.h"
#include <shellapi.h>
/*
@@ -561,119 +561,7 @@ PaletteSize(
return (WORD) (DIBNumColors(lpbi) * sizeof(RGBQUAD));
}
-/*
- *----------------------------------------------------------------------
- *
- * FindDIBits --
- *
- * Locate the image bits in a CF_DIB format DIB, as given by LPSTR lpbi -
- * pointer to the CF_DIB memory block. Used by titlebar icon code.
- *
- * Results:
- * pointer to the image bits
- *
- * Side effects: None
- *
- *
- *----------------------------------------------------------------------
- */
-static LPSTR
-FindDIBBits(
- LPSTR lpbi)
-{
- return lpbi + *((LPDWORD) lpbi) + PaletteSize(lpbi);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * BytesPerLine --
- *
- * Calculates the number of bytes in one scan line, as given by
- * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER that
- * begins the CF_DIB block. Used by titlebar icon code.
- *
- * Results:
- * number of bytes in one scan line (DWORD aligned)
- *
- *----------------------------------------------------------------------
- */
-
-static DWORD
-BytesPerLine(
- LPBITMAPINFOHEADER lpBMIH)
-{
- return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AdjustIconImagePointers --
- *
- * Adjusts internal pointers in icon resource struct, as given by
- * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon
- * code.
- *
- * Results:
- * BOOL - TRUE for success, FALSE for failure
- *
- *----------------------------------------------------------------------
- */
-
-static BOOL
-AdjustIconImagePointers(
- LPICONIMAGE lpImage)
-{
- /*
- * Sanity check.
- */
-
- if (lpImage == NULL) {
- return FALSE;
- }
-
- /*
- * BITMAPINFO is at beginning of bits.
- */
-
- lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits;
-
- /*
- * Width - simple enough.
- */
-
- lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
-
- /*
- * Icons are stored in funky format where height is doubled so account for
- * that.
- */
-
- lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
-
- /*
- * How many colors?
- */
-
- lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes
- * lpImage->lpbi->bmiHeader.biBitCount;
-
- /*
- * XOR bits follow the header and color table.
- */
-
- lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi);
-
- /*
- * AND bits follow the XOR bits.
- */
-
- lpImage->lpAND = lpImage->lpXOR +
- lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi);
- return TRUE;
-}
/*
*----------------------------------------------------------------------