summarylogtreecommitdiffstats
path: root/12-FvwmButtonsTips.patch
diff options
context:
space:
mode:
Diffstat (limited to '12-FvwmButtonsTips.patch')
-rw-r--r--12-FvwmButtonsTips.patch318
1 files changed, 318 insertions, 0 deletions
diff --git a/12-FvwmButtonsTips.patch b/12-FvwmButtonsTips.patch
new file mode 100644
index 000000000000..7c6516ff6182
--- /dev/null
+++ b/12-FvwmButtonsTips.patch
@@ -0,0 +1,318 @@
+diff -U3 -r libs/FTips.c libs/FTips.c
+--- libs/FTips.c 2007-01-27 12:33:16.000000000 +0100
++++ libs/FTips.c 2011-12-09 21:42:01.022148670 +0100
+@@ -505,7 +505,7 @@
+ if (fc == NULL)
+ {
+ fc = default_config;
+- }
++ }
+ current_config = fc;
+
+ if (label != NULL)
+diff -U3 -r modules/FvwmButtons/FvwmButtons.c modules/FvwmButtons/FvwmButtons.c
+--- modules/FvwmButtons/FvwmButtons.c 2011-08-27 23:51:29.000000000 +0200
++++ modules/FvwmButtons/FvwmButtons.c 2011-12-09 21:42:01.022148670 +0100
+@@ -62,6 +62,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"
+@@ -907,6 +908,7 @@
+ button_info *tmp = ActiveButton;
+ ActiveButton = b;
+ RedrawButton(tmp, DRAW_FORCE, NULL);
++
+ }
+ if (
+ b->flags.b_ActiveIcon ||
+@@ -1061,6 +1063,9 @@
+
+ tmp.name = NULL;
+ tmp.name_list = NULL;
++
++ FTipsInit(Dpy);
++
+ while ( !isTerminated )
+ {
+ if (My_FNextEvent(Dpy, &Event))
+@@ -1186,6 +1191,10 @@
+ if (!event.xconfigure.send_event &&
+ Event.xconfigure.window != MyWindow)
+ continue;
++
++ if(FTipsHandleEvents(Dpy, &event))
++ continue;
++
+ Event.xconfigure.x = event.xconfigure.x;
+ Event.xconfigure.y = event.xconfigure.y;
+ Event.xconfigure.send_event = True;
+@@ -1228,10 +1237,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:
+@@ -1254,11 +1286,13 @@
+ b = ActiveButton;
+ ActiveButton = NULL;
+ RedrawButton(b, DRAW_FORCE, NULL);
++
+ }
+ if (CurrentButton)
+ {
+ RedrawButton(b, DRAW_FORCE, NULL);
+ }
++ FTipsCancel(Dpy);
+ }
+ break;
+
+@@ -1280,8 +1314,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)
+ {
+@@ -1323,7 +1357,10 @@
+ RedrawButton(tmp, DRAW_FORCE, NULL);
+ }
+ else
++ {
+ RedrawButton(b, DRAW_FORCE, NULL);
++ }
++
+ if (!act)
+ {
+ break;
+diff -U3 -r modules/FvwmButtons/FvwmButtons.h modules/FvwmButtons/FvwmButtons.h
+--- modules/FvwmButtons/FvwmButtons.h 2008-04-05 12:02:45.000000000 +0200
++++ modules/FvwmButtons/FvwmButtons.h 2011-12-09 21:42:01.022148670 +0100
+@@ -38,6 +38,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 --------------------------------- */
+
+@@ -82,6 +84,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 */
+@@ -131,6 +134,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 */
+@@ -187,6 +193,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 */
+diff -U3 -r modules/FvwmButtons/parse.c modules/FvwmButtons/parse.c
+--- modules/FvwmButtons/parse.c 2008-04-05 12:02:45.000000000 +0200
++++ modules/FvwmButtons/parse.c 2011-12-09 21:42:01.025481917 +0100
+@@ -889,6 +889,7 @@
+ "presstitle",
+ "activecolorset",
+ "presscolorset",
++ "tipslabel",
+ "top",
+ NULL
+ };
+@@ -1612,7 +1613,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);
+@@ -1784,6 +1811,14 @@
+ "colorset",
+ "activecolorset",
+ "presscolorset",
++ "usetips",
++ "tipsfont",
++ "tipsdelay",
++ "tipscolorset",
++ "tipsborderwidth",
++ "tipsplacement",
++ "tipsjustification",
++ "tipsoffset",
+ NULL
+ };
+ int i, j, k;
+@@ -1931,7 +1966,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);