? .AUTHORS.swp ? FvwmButtons-ActiveAction.patch ? modules/.ChangeLog.swp ? modules/FvwmButtons-ActiveActionOld.patch ? modules/FvwmButtons/.FvwmButtons.1.in.swp ? modules/FvwmButtons/FvwmButtons-ActiveAction,patch Index: AUTHORS =================================================================== RCS file: /home/cvs/fvwm/fvwm/AUTHORS,v retrieving revision 1.120 diff -u -r1.120 AUTHORS --- AUTHORS 27 Dec 2006 16:18:36 -0000 1.120 +++ AUTHORS 8 Jan 2007 21:40:20 -0000 @@ -6,6 +6,8 @@ Window style !StickyStippledTitle (and hence StickyStippledTitle). Icon style StippledIconTitle and !StickyStippledIconTitle. +Added support in FvwmButtons for ActiveAction. + Serge (gentoosiast) Koksharov: Documentation fixes, bug fixes. Index: modules/ChangeLog =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/ChangeLog,v retrieving revision 1.1235 diff -u -r1.1235 ChangeLog --- modules/ChangeLog 7 Jan 2007 23:07:59 -0000 1.1235 +++ modules/ChangeLog 8 Jan 2007 21:40:30 -0000 @@ -1,3 +1,13 @@ +2007-01-08 Thomas Adam + * FvwmButtons/FvwmButtons.c (AddButtonActiveAction): + (GetButtonActiveAction): + (RunAssociatedActiveAction): + Added functionality to support an ActiveAction property to specific + buttons in FvwmButtons to run a command once a command hovers over a + button. The set of functions above should allow for expansion when + considering extending this to include support for SendToModule for + instance. + 2007-01-08 Dominik Vogt * FvwmConsole/getline.c (get_line): Index: modules/FvwmButtons/FvwmButtons.1.in =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.1.in,v retrieving revision 1.3 diff -u -r1.3 FvwmButtons.1.in --- modules/FvwmButtons/FvwmButtons.1.in 10 Feb 2006 12:33:22 -0000 1.3 +++ modules/FvwmButtons/FvwmButtons.1.in 8 Jan 2007 21:40:32 -0000 @@ -262,6 +262,19 @@ popups, or when \fBFrame\fP is 0 and the button would look unresponsive otherwise. +.IP "ActiveAction \fIcommand\fP" +This works much like \fIAction\fP does except that it doesn't +accept any options, and only executes \fIcommand\fP when the +mouse enters into the specified button. As an example: + +.nf +.sp + *FvwmButtons: (1x1, Title button, Action beep, \\ + ActiveAction "Exec exec xcalc" \\ + Swallow xeyes "Exec exec xeyes") +.sp +.fi + .IP "Back \fIcolor\fP" Specifies the background color to be used drawing this box. A relief color and a shadow color are calculated from this. Index: modules/FvwmButtons/FvwmButtons.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.c,v retrieving revision 1.201 diff -u -r1.201 FvwmButtons.c --- modules/FvwmButtons/FvwmButtons.c 10 Feb 2006 12:33:22 -0000 1.201 +++ modules/FvwmButtons/FvwmButtons.c 8 Jan 2007 21:40:34 -0000 @@ -508,6 +508,53 @@ return act; } +/** +*** AddButtonActiveAction() +**/ +void AddButtonActiveAction(button_info *b, char *action) +{ + if (!b || !action) + { + /* Oops, shouldn't happen. */ + fprintf(stderr, "%s: BUG: AddButtonActiveAction failed\n", MyName); + exit(2); + } + + if(b->flags.b_ActiveAction) + { + if(b->activeAction) + { + free(b->activeAction); + b->flags.b_ActiveAction = 0; + } + } else { + /* Set the action */ + b->activeAction = action; + b->flags.b_ActiveAction = 1; + } +} + +/** +*** GetButtonActiveAction() +**/ +char *GetButtonActiveAction(button_info *b) +{ + rectangle r; + char *act; + + if (!b || !(b->flags.b_ActiveAction) || !(b->activeAction)) + { + return NULL; + } + + get_button_root_geometry(&r, b); + act = module_expand_action( + Dpy, screen, b->activeAction, &r, UberButton->c->fore, + UberButton->c->back); + + return act; +} + Pixmap shapeMask = None; /** *** SetTransparentBackground() @@ -929,9 +976,15 @@ button_info *tmp = ActiveButton; ActiveButton = b; RedrawButton(tmp, DRAW_FORCE, NULL); + + if( b->flags.b_ActiveAction ) + { + RunAssociatedActiveAction(b); + } } if (b->flags.b_ActiveIcon || b->flags.b_ActiveTitle || - UberButton->c->flags.b_ActiveColorset) + UberButton->c->flags.b_ActiveColorset || + b->flags.b_ActiveAction) { ActiveButton = b; redraw = True; @@ -1249,6 +1302,14 @@ case EnterNotify: b = handle_new_position( b, Event.xcrossing.x, Event.xcrossing.y); + + if(Event.xcrossing.mode == NotifyNormal) + { + if( b->flags.b_ActiveAction ) + { + RunAssociatedActiveAction(b); + } + } break; case MotionNotify: @@ -1578,6 +1639,20 @@ } /** +*** RunAssociatedActiveAction() +*** Runs a specified active action once the pointer enters said button. +**/ +void RunAssociatedActiveAction(button_info *b) +{ + char *theAction = GetButtonActiveAction(b); + + if (theAction != NULL && b->flags.b_ActiveAction) + { + SendText(fd, theAction, 0); + } +} + +/** *** RedrawWindow() *** Draws the window by traversing the button tree **/ Index: modules/FvwmButtons/FvwmButtons.h =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.h,v retrieving revision 1.52 diff -u -r1.52 FvwmButtons.h --- modules/FvwmButtons/FvwmButtons.h 10 Feb 2006 12:33:22 -0000 1.52 +++ modules/FvwmButtons/FvwmButtons.h 8 Jan 2007 21:40:34 -0000 @@ -54,6 +54,8 @@ unsigned b_Icon : 1; /* Contains icon */ unsigned b_Swallow : 1; /* Contains swallowed window */ unsigned b_Action : 1; /* Fvwm action when clicked on */ + unsigned b_ActiveAction : 1; /* FVWM Action when mouse is hovered + over the button. */ unsigned b_Hangon : 1; /* Is waiting for a window before turning active */ unsigned b_Justify : 1; /* Has justification info */ @@ -173,6 +175,7 @@ char *activeTitle; /* b_ActiveTitle */ char *pressTitle; /* b_PressTitle */ char **action; /* b_Action */ + char *activeAction; /* b_ActiveAction */ char *icon_file; /* b_Icon */ char *active_icon_file; /* b_ActiveIcon */ char *press_icon_file; /* b_PressIcon */ @@ -235,6 +238,7 @@ /* -------------------------------- prototypes ----------------------------- */ void AddButtonAction(button_info*, int, char*); +void AddButtonActiveAction(button_info*, char*); void MakeContainer(button_info*); void change_swallowed_window_colorset(button_info *b, Bool do_clear); #ifdef DEBUG @@ -248,6 +252,8 @@ void exec_swallow(char *action, button_info *b); char *GetButtonAction(button_info*,int); +char *GetButtonActiveAction(button_info*); +void RunAssociatedActiveAction(button_info *); void ButtonPressProcess(button_info *b, char **act); /* ----------------------------- global variables -------------------------- */ Index: modules/FvwmButtons/parse.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/parse.c,v retrieving revision 1.94 diff -u -r1.94 parse.c --- modules/FvwmButtons/parse.c 7 Apr 2006 08:16:00 -0000 1.94 +++ modules/FvwmButtons/parse.c 8 Jan 2007 21:40:36 -0000 @@ -887,6 +887,7 @@ "presstitle", "activecolorset", "presscolorset", + "activeaction", NULL }; s = trimleft(s); @@ -1625,7 +1626,29 @@ b->flags.b_PressColorset = 0; } break; + /* --------------- --------------- */ + case 27: /* ActiveAction */ + s = trimleft(s); + t = seekright(&s); + if (*s == '(') + { + fprintf(stderr, "%s: Mouse-specific" + "actions make no sense" + "for ActiveAction", + MyName); + } + + if (t && *t && (t[0] != '-' || t[1] != 0)) + { + if (b->activeAction != NULL) + { + free(b->activeAction); + } else { + AddButtonActiveAction(b, t); + } + } + break; /* --------------- --------------- */ default: t = seekright(&s);