FVWM: WindowShadeAnimate 1.3

From: Cristian Tibirna <ctibirna_at_degas.gch.ulaval.ca>
Date: Wed, 3 Sep 1997 15:33:42 -0400

Hi

The promissed corrected windowshade patch is ready. The changes are
quite minimal. The moving-bar-swirls-shade-bug is corrected.

                                Cristian

-------shade_anim-1.3.patch---------cut here---------------------------
diff -u fvwm_orig/builtins.c fvwm/builtins.c
--- fvwm_orig/builtins.c Tue Aug 19 19:41:27 1997
+++ fvwm/builtins.c Wed Sep 3 15:09:04 1997
_at_@ -22,6 +22,12 @@
 #include "screen.h"
 #include "module.h"
 
+#ifdef WINDOWSHADE
+/*->CT set shade_anim and shade_anim_steps defaults */
+static int shade_anim_steps=10;
+/*<-CT*/
+#endif
+
 static char *exec_shell_name="/bin/sh";
 /* button state strings must match the enumerated states */
 static char *button_states[MaxButtonState]={
_at_@ -34,6 +40,7 @@
 #endif
 };
 
+
 /***********************************************************************
  *
  * Procedure:
_at_@ -383,48 +390,102 @@
  *
  * Args: 1 -- force shade, 2 -- force unshade No Arg: toggle
  *
+ ***********************************************************************
+ *
+ * Animation added.
+ * Based on code from AfterStep-1.0 (CT: ctibirna_at_gch.ulaval.ca)
+ *
+ * Builtin function: WindowShadeAnimate <steps>
+ * <steps> is number of steps in animation. If 0, the
+ * windowshade animation goes off. Default = 10.
+ *
  ***********************************************************************/
 void WindowShade(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                  unsigned long context, char *action, int *Module)
-{
+{
     int n = 0;
+ int f_h, f_w, f_oh, t_h, tb_h;
+ int h, y, s;
 
     if (DeferExecution(eventp,&w,&tmp_win,&context, SELECT,ButtonRelease))
- return;
-
+ return;
+ if ( tmp_win == NULL )
+ return;
     if (!(tmp_win->flags & TITLE) || (tmp_win->flags & MAXIMIZED)) {
- XBell(dpy, Scr.screen);
- return;
+ XBell(dpy, Scr.screen);
+ return;
     }
+
+ f_h = tmp_win->frame_height;
+ f_w = tmp_win->frame_width;
+ t_h = tmp_win->title_height;
+ tb_h = tmp_win->title_height+tmp_win->boundary_width;
+ f_oh = tmp_win->orig_ht;
+
+ if(shade_anim_steps) s = f_oh/shade_anim_steps;
+
     while (isspace(*action))++action;
     if (isdigit(*action))
- sscanf(action,"%d",&n);
-
+ sscanf(action,"%d",&n);
+
     if (((tmp_win->buttons & WSHADE)||(n==2))&&(n!=1))
- {
+ {
         tmp_win->buttons &= ~WSHADE;
+
+ if(shade_anim_steps) {
+ XMoveWindow(dpy, tmp_win->w, 0, - (f_oh - tb_h));
+ h = tb_h;
+ y = -(tmp_win->orig_ht - tb_h);
+ while (h < f_oh - tb_h) {
+ XResizeWindow(dpy, tmp_win->frame, f_w, h);
+ XMoveWindow(dpy, tmp_win->w, 0, y);
+ XSync(dpy, 0);
+ h+=s;
+ y+=s;
+ }
+ XMoveWindow(dpy, tmp_win->w, 0, 0);
+ }
+
         SetupFrame(tmp_win,
                    tmp_win->frame_x,
                    tmp_win->frame_y,
- tmp_win->orig_wd,
- tmp_win->orig_ht,
+ f_w,
+ f_oh,
                    True);
- Broadcast(M_DEWINDOWSHADE, 3, tmp_win->w, tmp_win->frame,
- (unsigned long)tmp_win, 0, 0, 0, 0);
- }
+ Broadcast(M_DEWINDOWSHADE,3,tmp_win->w,tmp_win->frame,
+ (unsigned long)tmp_win,0,0,0,0);
+ }
     else
- {
+ {
         tmp_win->buttons |= WSHADE;
+
+ if (shade_anim_steps) {
+ XLowerWindow(dpy, tmp_win->w);
+ h = f_h;
+ y = tb_h;
+ while (h>tb_h) {
+ XMoveWindow(dpy, tmp_win->w, 0, y);
+ XResizeWindow(dpy, tmp_win->frame, f_w, h);
+ XSync(dpy, 0);
+ h-=s;
+ y-=s;
+ }
+ XMoveWindow(dpy, tmp_win->w, 0, 0);
+ }
+
         SetupFrame(tmp_win,
                    tmp_win->frame_x,
                    tmp_win->frame_y,
- tmp_win->frame_width,
- tmp_win->title_height + tmp_win->boundary_width,
+ f_w,
+ tb_h,
                    False);
- Broadcast(M_WINDOWSHADE, 3, tmp_win->w, tmp_win->frame,
- (unsigned long)tmp_win, 0, 0, 0, 0);
- }
+ Broadcast(M_WINDOWSHADE,3,tmp_win->w,tmp_win->frame,
+ (unsigned long)tmp_win,0,0,0,0);
+ }
+
 }
+
+
 #endif /* WINDOWSHADE */
 
 /* For Ultrix 4.2 */
_at_@ -3329,3 +3390,22 @@
   if (opts) /* should be empty at this point... */
     free(opts);
 }
+
+#ifdef WINDOWSHADE
+/*->CT set shade_anim_steps */
+void setShadeAnim (XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ unsigned long context, char *action,int* Module)
+{
+ int val,val_unit,n;
+
+ n=GetOneArgument(action, &val, &val_unit);
+ if(n != 1) {
+ fvwm_msg(ERR,"setShadeAnim","WindowShadeAnimate requires 1 argument");
+ return;
+ }
+
+ shade_anim_steps = val;
+}
+/*<-CT*/
+#endif
+
diff -u fvwm_orig/functions.c fvwm/functions.c
--- fvwm_orig/functions.c Mon Aug 11 16:09:29 1997
+++ fvwm/functions.c Sat Aug 30 17:30:43 1997
_at_@ -139,6 +139,9 @@
   {"WindowsDesk", changeWindowsDesk,F_CHANGE_WINDOWS_DESK, FUNC_NEEDS_WINDOW},
 #ifdef WINDOWSHADE
   {"WindowShade", WindowShade, F_WINDOW_SHADE, FUNC_NEEDS_WINDOW},
+ /*->CT for SHADE_ANIMATE*/
+ {"WindowShadeAnimate",setShadeAnim,F_SHADE_ANIMATE, FUNC_NO_WINDOW},
+ /*<-CT*/
 #endif /* WINDOWSHADE */
   {"XORValue", SetXOR, F_XOR, FUNC_NO_WINDOW},
   {"",0,0,0}
diff -u fvwm_orig/fvwm.c fvwm/fvwm.c
--- fvwm_orig/fvwm.c Mon Aug 4 16:53:32 1997
+++ fvwm/fvwm.c Sat Aug 30 01:11:40 1997
_at_@ -630,6 +630,7 @@
   char *defaults[] = {
     "HilightColor black grey",
     "XORValue 0",
+ "WindowShadeAnimate 0",
     "MenuStyle black grey slategrey fixed fvwm",
     "TitleStyle Centered -- Raised",
     "IconFont fixed",
diff -u fvwm_orig/misc.h fvwm/misc.h
--- fvwm_orig/misc.h Mon Aug 11 16:10:19 1997
+++ fvwm/misc.h Sat Aug 30 17:37:53 1997
_at_@ -217,7 +217,13 @@
 #ifdef WINDOWSHADE
 void WindowShade(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                  unsigned long context, char *action, int *Module);
+
+/*->CT for window shade animation */
+void setShadeAnim(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ unsigned long context, char *action, int *Module);
+/*<-CT*/
 #endif
+
 extern void RaiseWindow(FvwmWindow *t);
 extern void LowerWindow(FvwmWindow *t);
 extern Bool GrabEm(int);
diff -u fvwm_orig/parse.h fvwm/parse.h
--- fvwm_orig/parse.h Mon Aug 11 16:10:39 1997
+++ fvwm/parse.h Sat Aug 30 00:46:25 1997
_at_@ -75,6 +75,9 @@
 #define F_EXEC_SETUP 57
 #define F_CURSOR_STYLE 58
 #define F_CURRENT 59
+/*->CT*/
+#define F_SHADE_ANIMATE 60
+/*<-CT*/
 
 /* Functions which require a target window */
 #define F_RESIZE 100
_at_@ -104,6 +107,7 @@
 #define F_DESTROY_DECOR 124
 #define F_UPDATE_DECOR 125
 #define F_WINDOW_SHADE 126
+
 
 /* Functions for use by modules only! */
 #define F_SEND_WINDOW_LIST 1000
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Wed Sep 03 1997 - 14:32:17 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:00 BST