kiss-mfavila-small/ports/fvwm-patched/patches/12-FvwmButtonsTips.patch

323 lines
8.2 KiB
Diff
Raw Normal View History

2021-05-09 02:10:08 -04:00
diff --unified --recursive --text fvwm-2.6.9/libs/FTips.c fvwm-patched/libs/FTips.c
--- fvwm-2.6.9/libs/FTips.c 2018-05-26 05:35:26.000000000 -0600
+++ fvwm-patched/libs/FTips.c 2020-08-21 16:20:45.638664630 -0600
@@ -504,7 +504,7 @@
if (fc == NULL)
{
fc = default_config;
- }
+ }
current_config = fc;
if (label != NULL)
Only in fvwm-patched/libs: FTips.c.orig
diff --unified --recursive --text fvwm-2.6.9/modules/FvwmButtons/FvwmButtons.c fvwm-patched/modules/FvwmButtons/FvwmButtons.c
--- fvwm-2.6.9/modules/FvwmButtons/FvwmButtons.c 2018-05-26 05:35:26.000000000 -0600
+++ fvwm-patched/modules/FvwmButtons/FvwmButtons.c 2020-08-21 16:28:07.722997146 -0600
@@ -55,6 +55,7 @@
#include "libs/Colorset.h"
#include "libs/vpacket.h"
#include "libs/FRender.h"
+#include "libs/FTips.h"
#include "libs/fsm.h"
#include "libs/ColorUtils.h"
#include "libs/Graphics.h"
@@ -900,6 +901,7 @@
button_info *tmp = ActiveButton;
ActiveButton = b;
RedrawButton(tmp, DRAW_FORCE, NULL);
+
}
if (
b->flags.b_ActiveIcon ||
@@ -1040,6 +1042,9 @@
tmp.name = NULL;
tmp.name_list = NULL;
+
+ FTipsInit(Dpy);
+
while ( !isTerminated )
{
if (My_FNextEvent(Dpy, &Event))
@@ -1166,6 +1171,10 @@
if (!event.xconfigure.send_event &&
Event.xconfigure.window != MyWindow)
continue;
+
+ if(FTipsHandleEvents(Dpy, &event))
+ continue;
+
fev_sanitise_configure_notify(&event.xconfigure);
Event.xconfigure.x = event.xconfigure.x;
Event.xconfigure.y = event.xconfigure.y;
@@ -1209,10 +1218,33 @@
case EnterNotify:
b = handle_new_position(
b, Event.xcrossing.x, Event.xcrossing.y);
+
+ if(Event.xcrossing.mode == NotifyNormal)
+ {
+ b = handle_new_position(
+ b, Event.xcrossing.x, Event.xcrossing.y);
+ FTipsOn(Dpy,MyWindow,UberButton->c->tips_config,
+ (void *)UberButton, b->tipslabel,
+ b->x, b->y, Width,Height);
+ FTipsUpdateLabel(Dpy, b->tipslabel);
+ }
break;
case MotionNotify:
+
b = handle_new_position(b, Event.xmotion.x, Event.xmotion.y);
+
+ x = Event.xbutton.x;
+ y = Event.xbutton.y;
+
+ if(b->tipslabel != NULL)
+ {
+ FTipsOn(Dpy,MyWindow,UberButton->c->tips_config, (void *)UberButton, b->tipslabel, x, y, w, h);
+ FTipsUpdateLabel(Dpy, b->tipslabel);
+ } else {
+ FTipsCancel(Dpy);
+ }
+
break;
case LeaveNotify:
@@ -1235,11 +1267,13 @@
b = ActiveButton;
ActiveButton = NULL;
RedrawButton(b, DRAW_FORCE, NULL);
+
}
if (CurrentButton)
{
RedrawButton(b, DRAW_FORCE, NULL);
}
+ FTipsCancel(Dpy);
}
break;
@@ -1261,8 +1295,8 @@
Window dummy;
XTranslateCoordinates(
- Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
- Event.xbutton.y, &x, &y, &dummy);
+ Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
+ Event.xbutton.y, &x, &y, &dummy);
}
if (CurrentButton)
{
@@ -1304,7 +1338,10 @@
RedrawButton(tmp, DRAW_FORCE, NULL);
}
else
+ {
RedrawButton(b, DRAW_FORCE, NULL);
+ }
+
if (!act)
{
break;
Only in fvwm-patched/modules/FvwmButtons: FvwmButtons.c.orig
diff --unified --recursive --text fvwm-2.6.9/modules/FvwmButtons/FvwmButtons.h fvwm-patched/modules/FvwmButtons/FvwmButtons.h
--- fvwm-2.6.9/modules/FvwmButtons/FvwmButtons.h 2018-05-26 05:35:26.000000000 -0600
+++ fvwm-patched/modules/FvwmButtons/FvwmButtons.h 2020-08-21 16:20:45.638664630 -0600
@@ -32,6 +32,8 @@
#include "libs/fvwmlib.h"
#include "libs/Picture.h"
#include "libs/Flocale.h"
+#include "libs/FTips.h"
+#define FONT_STRING "-*-fixed-medium-r-normal--13-*"
/* ------------------------------- structs --------------------------------- */
@@ -76,6 +78,7 @@
unsigned b_PressIcon : 1; /* Use alternate Icon on press */
unsigned b_PressColorset : 1; /* Use alternate Colorset on press */
unsigned b_PressTitle : 1; /* Use alternate Title text on press */
+ unsigned b_UseTips : 1; /* Whether to use tips or not. */
} flags_type;
/* Flags for b->swallow */
@@ -125,6 +128,9 @@
int colorset; /* b_Colorset */
int activeColorset; /* b_ActiveColorset */
int pressColorset; /* b_PressColorset */
+ char *tipsfont; /* b_TipsFont*/
+ ftips_config *tips_config; /* Struct that holds tips info.*/
+
Pixel fc; /* b_Fore */
Pixel bc, hc, sc; /* b_Back && !b_IconBack */
FvwmPicture *backicon; /* b_Back && b_IconBack */
@@ -181,6 +187,7 @@
FvwmPicture *pressicon; /* b_PressIcon */
int activeColorset; /* b_ActiveColorset */
int pressColorset; /* b_PressColorset */
+ char *tipslabel; /* b_TipsLabel */
Window IconWin; /* b_Swallow */
Window PanelWin; /* b_Panel */
Window BackIconWin; /* b_Back && b_IconBack */
Only in fvwm-patched/modules/FvwmButtons: FvwmButtons.h.orig
diff --unified --recursive --text fvwm-2.6.9/modules/FvwmButtons/parse.c fvwm-patched/modules/FvwmButtons/parse.c
--- fvwm-2.6.9/modules/FvwmButtons/parse.c 2018-05-26 05:35:26.000000000 -0600
+++ fvwm-patched/modules/FvwmButtons/parse.c 2020-08-21 16:20:45.638664630 -0600
@@ -882,6 +882,7 @@
"presstitle",
"activecolorset",
"presscolorset",
+ "tipslabel",
"top",
NULL
};
@@ -1605,7 +1606,33 @@
b->flags.b_ActiveColorset = 0;
}
break;
+ /* --------- TipsLabel ---------*/
+ case 28:
+ s = trimleft(s);
+ t = seekright(&s);
+ if(ub->c->flags.b_UseTips)
+ {
+ if (*s == '(')
+ {
+ fprintf(stderr,
+ "%s: justification not allowed "
+ "for TipsLabel.\n", MyName);
+ }
+
+
+
+ if (t && *t && (t[0] != '-' || t[1] != 0))
+ {
+ if (b->tipslabel != NULL)
+ {
+ free(b->tipslabel);
+ } else {
+ b->tipslabel = t;
+ }
+ }
+ }
+ break;
/* --------------- --------------- */
case 26: /* PressColorset */
i = strtol(s, &t, 10);
@@ -1777,6 +1804,14 @@
"colorset",
"activecolorset",
"presscolorset",
+ "usetips",
+ "tipsfont",
+ "tipsdelay",
+ "tipscolorset",
+ "tipsborderwidth",
+ "tipsplacement",
+ "tipsjustification",
+ "tipsoffset",
NULL
};
int i, j, k;
@@ -1924,7 +1959,97 @@
ub->c->flags.b_PressColorset = 0;
}
break;
+ case 15: /* UseTips */
+ /* We're using tips.*/
+ ub->c->flags.b_UseTips = 1;
+
+ /* Set the defaults up. */
+ ub->c->tips_config = FTipsNewConfig();
+
+ /* Include fonts. */
+ CopyStringWithQuotes(&ub->c->tipsfont,FONT_STRING);
+ ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy,
+ ub->c->tipsfont, MyName);
+ break;
+ case 16: /* TipsFont */
+ if(ub->c->flags.b_UseTips)
+ {
+ CopyStringWithQuotes(&ub->c->tipsfont,s);
+ ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy, ub->c->tipsfont,
+ MyName);
+ }
+
+ break;
+ case 17: /*TipsDelay */
+ if(ub->c->flags.b_UseTips)
+ {
+ i = sscanf(s, "%d %d", &j, &k);
+ if( i > 0)
+ {
+ /* Then only one value was given. Set the
+ * mapped_delay option to this given value
+ * also since it's optional.
+ */
+ ub->c->tips_config->delay = ub->c->tips_config->mapped_delay = j;
+ }
+ if( i > 1)
+ {
+ /* Two values passed in. We only need to
+ * change the value for mapped_delay here.
+ */
+
+ ub->c->tips_config->mapped_delay = k;
+
+ }
+ }
+ break;
+ case 18: /* TipsColorset */
+ if (ub->c->flags.b_UseTips)
+ {
+ i = sscanf(s, "%d", &j);
+ if (i > 0)
+ {
+ ub->c->tips_config->colorset = j;
+ AllocColorset(j);
+ }
+ }
+ break;
+ case 19: /* TipsBorderWidth */
+ if (ub->c->flags.b_UseTips)
+ {
+ i = sscanf(s, "%d", &j);
+
+ if(i > 0)
+ {
+ ub->c->tips_config->border_width = j;
+ }
+ }
+ break;
+ case 20: /* TipsPlacement */
+ if(ub->c->flags.b_UseTips)
+ {
+ s = trimleft(s);
+
+ /* Options ... */
+ if(!strcasecmp(s, "up"))
+ {
+ i = FTIPS_PLACEMENT_UP;
+ } else if(!strcasecmp(s, "down")) {
+ i = FTIPS_PLACEMENT_DOWN;
+ } else if(!strcasecmp(s, "left")) {
+ i = FTIPS_PLACEMENT_LEFT;
+ } else if(!strcasecmp(s, "right")) {
+ i = FTIPS_PLACEMENT_RIGHT;
+ } else if(!strcasecmp(s, "updown")) {
+ i = FTIPS_PLACEMENT_AUTO_UPDOWN;
+ } else if(!strcasecmp(s, "leftright")) {
+ i = FTIPS_PLACEMENT_AUTO_LEFTRIGHT;
+ }
+
+ ub->c->tips_config->placement = i;
+ }
+ break;
default:
s = trimleft(s);
ParseButton(ubb, s);
Only in fvwm-patched/modules/FvwmButtons: parse.c.orig