Andrew> Here's a "WindowShade" function for fvwm 2.0.43 I worked
Andrew> up with an added feature of being able to force the window
Andrew> shade up or down with an argument.
Here's also a version which works with the borderstyle/usedecor patch
(tbsp9b). Again, not tested very much.
diff -cr orig/fvwm-2.0.43/Fvwm.tmpl fvwm-2.0.43/Fvwm.tmpl
*** orig/fvwm-2.0.43/Fvwm.tmpl Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/Fvwm.tmpl Tue Dec 10 10:46:29 1996
***************
*** 204,215 ****
* and DestroyDecor. There is a slight memory penalty for each
* additionally defined decor.
*
***************************************************************************/
OPTION_DEFINES = -DSHAPE
OPTION_DEFINES += -DVECTOR_BUTTONS -DPIXMAP_BUTTONS -DGRADIENT_BUTTONS
OPTION_DEFINES += -DMULTISTYLE -DEXTENDED_TITLESTYLE -DBORDERSTYLE
! OPTION_DEFINES += -DUSEDECOR
--- 204,223 ----
* and DestroyDecor. There is a slight memory penalty for each
* additionally defined decor.
*
+ *
+ * -DWINDOWSHADE
+ *
+ * Compiles in support for the WindowShade function. This function "rolls"
+ * the window up so only the title-bar remains. There are a few applications
+ * which seem to not like having this happen to them, but for the most part
+ * it seems to work.
+ *
***************************************************************************/
OPTION_DEFINES = -DSHAPE
OPTION_DEFINES += -DVECTOR_BUTTONS -DPIXMAP_BUTTONS -DGRADIENT_BUTTONS
OPTION_DEFINES += -DMULTISTYLE -DEXTENDED_TITLESTYLE -DBORDERSTYLE
! OPTION_DEFINES += -DUSEDECOR -DWINDOWSHADE
diff -cr orig/fvwm-2.0.43/fvwm/borders.c fvwm-2.0.43/fvwm/borders.c
*** orig/fvwm-2.0.43/fvwm/borders.c Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/fvwm/borders.c Tue Dec 10 10:43:43 1996
***************
*** 1370,1376 ****
}
}
! if(tmp_win->flags & BORDER)
{
tmp_win->corner_width = Scr.TitleHeight + tmp_win->bw +
tmp_win->boundary_width ;
--- 1370,1380 ----
}
}
! if((tmp_win->flags & BORDER)
! #ifdef WINDOWSHADE
! && !(tmp_win->buttons & WSHADE)
! #endif
! )
{
tmp_win->corner_width = Scr.TitleHeight + tmp_win->bw +
tmp_win->boundary_width ;
***************
*** 1447,1452 ****
--- 1451,1461 ----
/* may need to omit the -1 for shaped windows, next two lines*/
cx = tmp_win->boundary_width-tmp_win->bw;
cy = tmp_win->title_height + tmp_win->boundary_width-tmp_win->bw;
+
+ #ifdef WINDOWSHADE
+ if (tmp_win->attr.height <= 0)
+ tmp_win->attr.height = tmp_win->hints.height_inc;
+ #endif
XResizeWindow(dpy, tmp_win->w, tmp_win->attr.width,
tmp_win->attr.height);
diff -cr orig/fvwm-2.0.43/fvwm/builtins.c fvwm-2.0.43/fvwm/builtins.c
*** orig/fvwm-2.0.43/fvwm/builtins.c Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/fvwm/builtins.c Tue Dec 10 10:43:43 1996
***************
*** 326,331 ****
--- 326,339 ----
if (tmp_win->flags & MAXIMIZED)
{
tmp_win->flags &= ~MAXIMIZED;
+
+ #ifdef WINDOWSHADE
+ if (tmp_win->buttons & WSHADE) {
+ tmp_win->flags &= ~MAXIMIZED;
+ tmp_win->buttons &= ~WSHADE;
+ }
+ #endif
+
SetupFrame(tmp_win, tmp_win->orig_x, tmp_win->orig_y, tmp_win->orig_wd,
tmp_win->orig_ht,TRUE);
SetBorder(tmp_win,True,True,True,None);
***************
*** 359,364 ****
--- 367,425 ----
SetBorder(tmp_win,Scr.Hilite == tmp_win,True,True,tmp_win->right_w[0]);
}
}
+
+ #ifdef WINDOWSHADE
+ /***********************************************************************
+ *
+ * WindowShade -- shades or unshades a window (veliaa_at_rpi.edu)
+ *
+ * Args: 1 -- force shade, 2 -- force unshade No Arg: toggle
+ *
+ ***********************************************************************/
+ void WindowShade(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ unsigned long context, char *action, int *Module)
+ {
+ int n = 0;
+
+ if (DeferExecution(eventp,&w,&tmp_win,&context, SELECT,ButtonRelease))
+ return;
+
+ if (!(tmp_win->flags & BORDER)) {
+ XBell(dpy, Scr.screen);
+ return;
+ }
+
+ while (isspace(*action))
+ ++action;
+
+ if (*action)
+ sscanf(action,"%d",&n);
+
+ if (((tmp_win->buttons & WSHADE)||(n==2))&&(n!=1))
+ {
+ tmp_win->flags &= ~MAXIMIZED;
+ tmp_win->buttons &= ~WSHADE;
+ SetupFrame(tmp_win,
+ tmp_win->frame_x,
+ tmp_win->frame_y,
+ tmp_win->orig_wd,
+ tmp_win->orig_ht,
+ False);
+ SetBorder(tmp_win,True,True,True,None);
+ }
+ else
+ {
+ tmp_win->flags |= MAXIMIZED;
+ tmp_win->buttons |= WSHADE;
+ SetupFrame(tmp_win,
+ tmp_win->frame_x,
+ tmp_win->frame_y,
+ tmp_win->frame_width,
+ tmp_win->title_height + tmp_win->boundary_width,
+ False);
+ }
+ }
+ #endif /* WINDOWSHADE */
/* For Ultrix 4.2 */
#include <sys/types.h>
diff -cr orig/fvwm-2.0.43/fvwm/functions.c fvwm-2.0.43/fvwm/functions.c
*** orig/fvwm-2.0.43/fvwm/functions.c Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/fvwm/functions.c Tue Dec 10 10:43:43 1996
***************
*** 124,129 ****
--- 124,132 ----
{"WarpToWindow", warp_func, F_WARP, FUNC_NEEDS_WINDOW},
{"WindowFont", LoadWindowFont, F_WINDOWFONT, FUNC_NO_WINDOW},
{"WindowList", do_windowList, F_WINDOWLIST, FUNC_NO_WINDOW},
+ #ifdef WINDOWSHADE
+ {"WindowShade", WindowShade, F_WINDOW_SHADE, FUNC_NEEDS_WINDOW},
+ #endif
{"WindowsDesk", changeWindowsDesk,F_CHANGE_WINDOWS_DESK, FUNC_NEEDS_WINDOW},
{"XORValue", SetXOR, F_XOR, FUNC_NO_WINDOW},
{"+", add_another_item, F_ADDMENU2, FUNC_NO_WINDOW},
diff -cr orig/fvwm-2.0.43/fvwm/fvwm.c fvwm-2.0.43/fvwm/fvwm.c
*** orig/fvwm-2.0.43/fvwm/fvwm.c Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/fvwm/fvwm.c Tue Dec 10 10:43:44 1996
***************
*** 1256,1261 ****
--- 1256,1271 ----
Reborder ();
+ #ifdef WINDOWSHADE
+ {
+ /* disable WindowShade of any windows */
+ FvwmWindow *fw = Scr.FvwmRoot.next;
+ for (; fw; fw = fw->next)
+ if (fw->buttons&WSHADE)
+ ExecuteFunction("WindowShade", fw,&Event,C_WINDOW,-1);
+ }
+ #endif
+
if(restart)
{
SaveDesktopState(); /* I wonder why ... */
diff -cr orig/fvwm-2.0.43/fvwm/fvwm.h fvwm-2.0.43/fvwm/fvwm.h
*** orig/fvwm-2.0.43/fvwm/fvwm.h Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/fvwm/fvwm.h Tue Dec 10 10:43:44 1996
***************
*** 268,273 ****
--- 268,277 ----
#define BUTTON9 256
#define BUTTON10 512
+ #ifdef WINDOWSHADE
+ #define WSHADE (1<<31)
+ #endif
+
#include <stdlib.h>
extern void Reborder(void);
extern void SigDone(int);
diff -cr orig/fvwm-2.0.43/fvwm/misc.h fvwm-2.0.43/fvwm/misc.h
*** orig/fvwm-2.0.43/fvwm/misc.h Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/fvwm/misc.h Tue Dec 10 10:43:44 1996
***************
*** 204,209 ****
--- 204,213 ----
extern void sleep_a_little(int);
void Maximize(XEvent *eventp,Window w,FvwmWindow *tmp_win,
unsigned long context, char *action, int *Module);
+ #ifdef WINDOWSHADE
+ void WindowShade(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ unsigned long context, char *action, int *Module);
+ #endif
extern void RaiseWindow(FvwmWindow *t);
extern void LowerWindow(FvwmWindow *t);
extern Bool GrabEm(int);
diff -cr orig/fvwm-2.0.43/fvwm/parse.h fvwm-2.0.43/fvwm/parse.h
*** orig/fvwm-2.0.43/fvwm/parse.h Tue Dec 10 10:49:48 1996
--- fvwm-2.0.43/fvwm/parse.h Tue Dec 10 10:51:09 1996
***************
*** 96,101 ****
--- 96,102 ----
#define F_CHANGE_DECOR 119
#define F_DESTROY_DECOR 120
#define F_UPDATE_DECOR 121
+ #define F_WINDOW_SHADE 122
/* Functions for use by modules only! */
#define F_SEND_WINDOW_LIST 1000
diff -cr orig/fvwm-2.0.43/fvwm/resize.c fvwm-2.0.43/fvwm/resize.c
*** orig/fvwm-2.0.43/fvwm/resize.c Fri Jun 30 11:07:23 1995
--- fvwm-2.0.43/fvwm/resize.c Tue Dec 10 10:43:44 1996
***************
*** 110,115 ****
--- 110,121 ----
XGrabServer(dpy);
+ #ifdef WINDOWSHADE
+ if (tmp_win->buttons & WSHADE) {
+ tmp_win->flags &= ~MAXIMIZED;
+ tmp_win->buttons &= ~WSHADE;
+ }
+ #endif
/* handle problems with edge-wrapping while resizing */
flags = Scr.flags;
--
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 Tue Dec 10 1996 - 10:26:56 GMT