summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-10-18 20:00:37 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-10-18 20:00:37 (GMT)
commitc78262e0f1d0674bc94022bd0b2cd7f52004307e (patch)
tree92f650610d3343290d1cb8fd9883a2e22ebd1a18 /tksao
parent3a3e0ec6a0420753b25620f5b63fd5c087581024 (diff)
downloadblt-c78262e0f1d0674bc94022bd0b2cd7f52004307e.zip
blt-c78262e0f1d0674bc94022bd0b2cd7f52004307e.tar.gz
blt-c78262e0f1d0674bc94022bd0b2cd7f52004307e.tar.bz2
add support for MacOS darkmode
Diffstat (limited to 'tksao')
-rw-r--r--tksao/magnifier/magnifier.C2
-rw-r--r--tksao/magnifier/magnifier.h17
-rw-r--r--tksao/magnifier/magnifiertrue.C36
3 files changed, 42 insertions, 13 deletions
diff --git a/tksao/magnifier/magnifier.C b/tksao/magnifier/magnifier.C
index ae9797e..2c097dc 100644
--- a/tksao/magnifier/magnifier.C
+++ b/tksao/magnifier/magnifier.C
@@ -38,6 +38,8 @@ Magnifier::Magnifier(Tcl_Interp* i, Tk_Canvas c, Tk_Item* item)
{
thumbnail = 0;
needsUpdate = 0;
+
+ ((MagnifierTrueOptions*)options)->bgColor = NULL;
}
int Magnifier::parse(istringstream& istr)
diff --git a/tksao/magnifier/magnifier.h b/tksao/magnifier/magnifier.h
index c007fe8..a9d6b65 100644
--- a/tksao/magnifier/magnifier.h
+++ b/tksao/magnifier/magnifier.h
@@ -7,6 +7,23 @@
#include "widget.h"
+struct MagnifierTrueOptions {
+ Tk_Item item; // required by tk
+ int x, y; // Coordinates of positioning point on canvas
+ int width; // widget width
+ int height; // widget height
+ Tk_Anchor anchor; // Where to anchor widget relative to x,y
+ char* cmdName; // Suggested Tcl command name
+
+ char* helvetica; // name of X11 font
+ char* courier; // name of X11 font
+ char* times; // name of X11 font
+
+ Widget* widget; // pointer to widget class
+
+ XColor* bgColor;
+};
+
class Magnifier : public Widget {
private:
Pixmap thumbnail; // current gterm thumbnail pixmap
diff --git a/tksao/magnifier/magnifiertrue.C b/tksao/magnifier/magnifiertrue.C
index d022f62..c1e26bf 100644
--- a/tksao/magnifier/magnifiertrue.C
+++ b/tksao/magnifier/magnifiertrue.C
@@ -21,26 +21,30 @@ static Tk_CustomOption tagsOption = {
static Tk_ConfigSpec magnifierTrueColorSpecs[] = {
{TK_CONFIG_STRING, (char*)"-command", NULL, NULL, "magnifier",
- Tk_Offset(WidgetOptions, cmdName), TK_CONFIG_OPTION_SPECIFIED, NULL},
+ Tk_Offset(MagnifierTrueOptions, cmdName), TK_CONFIG_OPTION_SPECIFIED, NULL},
{TK_CONFIG_INT, (char*)"-x", NULL, NULL, "1",
- Tk_Offset(WidgetOptions, x), TK_CONFIG_OPTION_SPECIFIED, NULL},
+ Tk_Offset(MagnifierTrueOptions, x), TK_CONFIG_OPTION_SPECIFIED, NULL},
{TK_CONFIG_INT, (char*)"-y", NULL, NULL, "1",
- Tk_Offset(WidgetOptions, y), TK_CONFIG_OPTION_SPECIFIED, NULL},
+ Tk_Offset(MagnifierTrueOptions, y), TK_CONFIG_OPTION_SPECIFIED, NULL},
{TK_CONFIG_INT, (char*)"-width", NULL, NULL, "256",
- Tk_Offset(WidgetOptions, width), TK_CONFIG_OPTION_SPECIFIED, NULL},
+ Tk_Offset(MagnifierTrueOptions, width), TK_CONFIG_OPTION_SPECIFIED, NULL},
{TK_CONFIG_INT, (char*)"-height", NULL, NULL, "256",
- Tk_Offset(WidgetOptions, height), TK_CONFIG_OPTION_SPECIFIED, NULL},
+ Tk_Offset(MagnifierTrueOptions, height), TK_CONFIG_OPTION_SPECIFIED, NULL},
{TK_CONFIG_ANCHOR, (char*)"-anchor", NULL, NULL, "nw",
- Tk_Offset(WidgetOptions, anchor), 0, NULL},
+ Tk_Offset(MagnifierTrueOptions, anchor), 0, NULL},
{TK_CONFIG_CUSTOM, (char*)"-tags", NULL, NULL, NULL,
0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_STRING, (char*)"-helvetica", NULL, NULL, "helvetica",
- Tk_Offset(WidgetOptions, helvetica), 0, NULL},
+ Tk_Offset(MagnifierTrueOptions, helvetica), 0, NULL},
{TK_CONFIG_STRING, (char*)"-courier", NULL, NULL, "courier",
- Tk_Offset(WidgetOptions, courier), 0, NULL},
+ Tk_Offset(MagnifierTrueOptions, courier), 0, NULL},
{TK_CONFIG_STRING, (char*)"-times", NULL, NULL, "times",
- Tk_Offset(WidgetOptions, times), 0, NULL},
+ Tk_Offset(MagnifierTrueOptions, times), 0, NULL},
+
+ {TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0, NULL},
+ {TK_CONFIG_COLOR, "-background", "background", "Background", "white",
+ Tk_Offset(MagnifierTrueOptions, bgColor), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL},
};
@@ -49,7 +53,7 @@ static Tk_ConfigSpec magnifierTrueColorSpecs[] = {
static Tk_ItemType magnifierTrueColorType = {
(char*)"magnifiertruecolor", // name
- sizeof(WidgetOptions), // size
+ sizeof(MagnifierTrueOptions), // size
MagnifierTrueColorCreateProc, // configProc
magnifierTrueColorSpecs, // configSpecs
WidgetConfigProc, // configProc
@@ -105,16 +109,22 @@ MagnifierTrueColor::MagnifierTrueColor(Tcl_Interp* i, Tk_Canvas c,
void MagnifierTrueColor::clearPixmap()
{
+ if (0) {
XImage* xmap = XGetImage(display, pixmap, 0, 0, options->width,
options->height, AllPlanes, ZPixmap);
if (!xmap) {
internalError("MagnifierTrueColor: Unable to Create XImage");
return;
}
-
memset(xmap->data, 255, xmap->bytes_per_line * xmap->height);
-
TkPutImage(NULL, 0, display, pixmap, widgetGC, xmap,
- 0, 0, 0, 0, options->width, options->height);
+ 0, 0, 0, 0, options->width, options->height);
XDestroyImage(xmap);
+ }
+
+ MagnifierTrueOptions* opts = (MagnifierTrueOptions*)options;
+
+ XSetForeground(display, widgetGC, opts->bgColor->pixel);
+ XFillRectangle(display, pixmap, widgetGC, 0, 0, \
+ options->width,options->height);
}