ajc> "lmyers" == lmyers <lmyers_at_co.intel.com> writes:
lmyers> I'm not too knowledgable about X, but I was wondering if
lmyers> it would be possible to in impliment something like Mac's
lmyers> WindowShade. In case you don't know what that is, it
lmyers> allows you to click twice on the windows title to collapse
lmyers> the window to just it's title row.
ajc> For what it's worth, I noticed AfterStep supports this (not
ajc> that I personally have a use for it, but...)
ajc> See
http://mango.sfasu.edu/~frank/afterstep/
ajc> Of course if you're fond of some of fvwm 2's features you may
ajc> not want to change, since AfterStep is based on fvwm 1...
Here's a "WindowShade" function for fvwm 2.0.43 I worked up with an
added feature of being able to force the window shade up or down with
an argument.
I've not tested it much, so don't expect much :)...
Regards,
Andrew
diff -cr ../orig/fvwm-2.0.43/Fvwm.tmpl fvwm-2.0.43/Fvwm.tmpl
*** ../orig/fvwm-2.0.43/Fvwm.tmpl Thu Jun 27 10:57:21 1996
--- fvwm-2.0.43/Fvwm.tmpl Tue Dec 10 02:55:44 1996
***************
*** 164,170 ****
*
***************************************************************************/
! OPTION_DEFINES = -DSHAPE -DPIXMAP_BUTTONS
--- 164,170 ----
*
***************************************************************************/
! OPTION_DEFINES = -DSHAPE -DPIXMAP_BUTTONS -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 Thu Apr 11 11:27:10 1996
--- fvwm-2.0.43/fvwm/borders.c Tue Dec 10 03:05:35 1996
***************
*** 1060,1066 ****
}
}
! if(tmp_win->flags & BORDER)
{
tmp_win->corner_width = Scr.TitleHeight + tmp_win->bw +
tmp_win->boundary_width ;
--- 1060,1070 ----
}
}
! 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 ;
***************
*** 1137,1142 ****
--- 1141,1152 ----
/* 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 < tmp_win->hints.height_inc)
+ || (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 Thu Jun 27 10:34:19 1996
--- fvwm-2.0.43/fvwm/builtins.c Tue Dec 10 03:19:42 1996
***************
*** 326,331 ****
--- 326,340 ----
if (tmp_win->flags & MAXIMIZED)
{
tmp_win->flags &= ~MAXIMIZED;
+
+ #ifdef WINDOWSHADE
+ if (tmp_win->buttons&WSHADE) {
+ tmp_win->flags &= ~MAXIMIZED;
+ tmp_win->buttons &= ~WSHADE;
+ XMapWindow(dpy,tmp_win->w);
+ }
+ #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 ****
--- 368,434 ----
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;
+ XMapWindow(dpy,tmp_win->w);
+ 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
+ {
+ XWindowAttributes xwa;
+ unsigned long eventMask = xwa.your_event_mask;
+ tmp_win->flags |= MAXIMIZED;
+ tmp_win->buttons |= WSHADE;
+ XGetWindowAttributes(dpy, tmp_win->w, &xwa);
+ XSelectInput(dpy, tmp_win->w, eventMask & ~StructureNotifyMask);
+ tmp_win->flags &= ~MAPPED;
+ XUnmapWindow(dpy, tmp_win->w);
+ SetupFrame(tmp_win,
+ tmp_win->frame_x,
+ tmp_win->frame_y,
+ tmp_win->frame_width,
+ tmp_win->title_height + tmp_win->boundary_width,
+ True);
+ XSelectInput(dpy, tmp_win->w, eventMask);
+ }
+ }
+ #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 Wed Jun 19 20:01:56 1996
--- fvwm-2.0.43/fvwm/functions.c Tue Dec 10 00:59:54 1996
***************
*** 105,110 ****
--- 105,113 ----
{"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 Thu Jun 27 10:08:08 1996
--- fvwm-2.0.43/fvwm/fvwm.c Tue Dec 10 03:17:39 1996
***************
*** 1080,1085 ****
--- 1080,1095 ----
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 Thu Apr 11 11:22:24 1996
--- fvwm-2.0.43/fvwm/fvwm.h Tue Dec 10 02:53:24 1996
***************
*** 262,267 ****
--- 262,271 ----
#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/fvwm2.man fvwm-2.0.43/fvwm/fvwm2.man
*** ../orig/fvwm-2.0.43/fvwm/fvwm2.man Wed Jun 19 22:55:43 1996
--- fvwm-2.0.43/fvwm/fvwm2.man Tue Dec 10 01:26:28 1996
***************
*** 1336,1341 ****
--- 1336,1349 ----
will be shown.
+ .IP "WindowShade [ \fIopt\fP ]"
+ Toggles the window shade feature of windows with borders. Windows in
+ the shaded state only display a title-bar. If \fIopt\fP is not given,
+ the window shade state is toggled. If \fIopt\fP is 1, the window is
+ forced to the shaded state. If \fIopt\fP is 2, then the window is
+ forced to the non-shaded state.
+
+
.IP "WindowFont \fIfontname\fP"
Makes \fIfvwm\fP use font \fIfontname\fP instead of "fixed" for window
title-bars.
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 Wed Jun 19 21:31:15 1996
--- fvwm-2.0.43/fvwm/misc.h Tue Dec 10 01:01:16 1996
***************
*** 194,199 ****
--- 194,203 ----
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 Thu May 30 14:03:10 1996
--- fvwm-2.0.43/fvwm/parse.h Tue Dec 10 01:00:19 1996
***************
*** 89,94 ****
--- 89,95 ----
#define F_SEND_STRING 112
#define F_ADD_MOD 113
#define F_DESTROY_MOD 114
+ #define F_WINDOW_SHADE 115
/* 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 03:13:00 1996
***************
*** 110,115 ****
--- 110,122 ----
XGrabServer(dpy);
+ #ifdef WINDOWSHADE
+ if (tmp_win->buttons&WSHADE) {
+ tmp_win->flags &= ~MAXIMIZED;
+ tmp_win->buttons &= ~WSHADE;
+ XMapWindow(dpy,tmp_win->w);
+ }
+ #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 - 02:32:39 GMT