a few weeks ago, i asked about StartsOnPage and the only answers i got
were 'yes, please, implement it'.
well, here it is, hacked together in some 90 minutes.
*** WARNING: use at your own risk! ***
in fvwm/misc.h all the 32 bits of an int are already taken for the
values for name_list flags. i had to use one of the bits and chose the
one that is used by MINIICON_FLAG, and therefore my patch only works
when MINI_ICONS is disabled in Fvwm.tmpl. (the patch takes care of that.)
you'll find a short description of the StartsOnPage feature in both the
(unmodified) TO-DO file and in the (patched) manual.
best,
rj
diff -ru o/fvwm-2.0.45/Fvwm.tmpl fvwm-2.0.45/Fvwm.tmpl
--- o/fvwm-2.0.45/Fvwm.tmpl Wed Jan 22 14:38:49 1997
+++ fvwm-2.0.45/Fvwm.tmpl Thu Apr 10 12:55:12 1997
_at_@ -256,7 +256,8 @@
#else
/* the works, not using '+=': */
-OPTION_DEFINES = -DSHAPE -DACTIVEDOWN_BTNS -DINACTIVE_BTNS -DMINI_ICONS -DVECTOR_BUTTONS -DPIXMAP_BUTTONS -DGRADIENT_BUTTONS -DMULTISTYLE -DEXTENDED_TITLESTYLE -DBORDERSTYLE -DUSEDECOR -DWINDOWSHADE
+/* OPTION_DEFINES = -DSHAPE -DACTIVEDOWN_BTNS -DINACTIVE_BTNS -DMINI_ICONS -DVECTOR_BUTTONS -DPIXMAP_BUTTONS -DGRADIENT_BUTTONS -DMULTISTYLE -DEXTENDED_TITLESTYLE -DBORDERSTYLE -DUSEDECOR -DWINDOWSHADE */
+OPTION_DEFINES = -DSHAPE -DACTIVEDOWN_BTNS -DINACTIVE_BTNS -DVECTOR_BUTTONS -DPIXMAP_BUTTONS -DGRADIENT_BUTTONS -DMULTISTYLE -DEXTENDED_TITLESTYLE -DBORDERSTYLE -DUSEDECOR -DWINDOWSHADE
#endif
diff -ru o/fvwm-2.0.45/fvwm/add_window.c fvwm-2.0.45/fvwm/add_window.c
--- o/fvwm-2.0.45/fvwm/add_window.c Wed Jan 22 16:46:54 1997
+++ fvwm-2.0.45/fvwm/add_window.c Thu Apr 10 12:57:24 1997
_at_@ -102,7 +102,7 @@
char *decor = NULL;
#endif
unsigned long tflag;
- int Desk, border_width, resize_width;
+ int Desk, PageX, PageY, border_width, resize_width;
extern Bool NeedToResizeToo;
extern FvwmWindow *colormap_win;
char *forecolor = NULL, *backcolor = NULL;
_at_@ -202,7 +202,7 @@
#ifdef USEDECOR
&decor,
#endif
- &Desk,
+ &Desk, &PageX, &PageY,
&border_width, &resize_width,
&forecolor,&backcolor,&tmp_win->buttons,
tmp_win->IconBox,&(tmp_win->BoxFillMethod));
_at_@ -274,11 +274,16 @@
Desk = atoi(rm_value.addr);
tflag |= STARTSONDESK_FLAG;
}
+ status = XrmGetResource (db, "fvwm.page", "Fvwm.Page", &str_type, &rm_value);
+ if ((status == True) && (rm_value.size != 0)) {
+ if (sscanf (rm_value.addr, "%d %d", &PageX, &PageY) == 2)
+ tflag |= STARTSONPAGE_FLAG;
+ }
XrmDestroyDatabase (db);
db = NULL;
}
- if(!PlaceWindow(tmp_win, tflag, Desk))
+ if(!PlaceWindow(tmp_win, tflag, Desk, PageX, PageY))
return NULL;
/*
_at_@ -977,7 +982,7 @@
#ifdef USEDECOR
char **decor,
#endif
- int *Desk, int *border_width,
+ int *Desk, int *PageX, int *PageY, int *border_width,
int *resize_width, char **forecolor, char **backcolor,
unsigned long * buttons, int *IconBox,
int *BoxFillMethod)
_at_@ -995,6 +1000,7 @@
*forecolor = NULL;
*backcolor = NULL;
*Desk = 0;
+ *PageX = *PageY = 0;
*buttons = 0;
*BoxFillMethod = 0;
*border_width = 0;
_at_@ -1021,6 +1027,11 @@
#endif
if(nptr->off_flags & STARTSONDESK_FLAG)
*Desk = nptr->Desk;
+ if(nptr->off_flags & STARTSONPAGE_FLAG)
+ {
+ *PageX = nptr->PageX;
+ *PageY = nptr->PageY;
+ }
if(nptr->off_flags & BW_FLAG)
*border_width = nptr->border_width;
if(nptr->off_flags & FORE_COLOR_FLAG)
_at_@ -1056,6 +1067,11 @@
#endif
if(nptr->off_flags & STARTSONDESK_FLAG)
*Desk = nptr->Desk;
+ if(nptr->off_flags & STARTSONPAGE_FLAG)
+ {
+ *PageX = nptr->PageX;
+ *PageY = nptr->PageY;
+ }
if(nptr->off_flags & FORE_COLOR_FLAG)
*forecolor = nptr->ForeColor;
if(nptr->off_flags & BACK_COLOR_FLAG)
_at_@ -1091,6 +1107,11 @@
#endif
if(nptr->off_flags & STARTSONDESK_FLAG)
*Desk = nptr->Desk;
+ if(nptr->off_flags & STARTSONPAGE_FLAG)
+ {
+ *PageX = nptr->PageX;
+ *PageY = nptr->PageY;
+ }
if(nptr->off_flags & FORE_COLOR_FLAG)
*forecolor = nptr->ForeColor;
if(nptr->off_flags & BACK_COLOR_FLAG)
diff -ru o/fvwm-2.0.45/fvwm/builtins.c fvwm-2.0.45/fvwm/builtins.c
--- o/fvwm-2.0.45/fvwm/builtins.c Wed Jan 22 14:37:28 1997
+++ fvwm-2.0.45/fvwm/builtins.c Thu Apr 10 13:02:09 1997
_at_@ -713,7 +713,7 @@
#ifdef USEDECOR
&junkC,
#endif
- &junkD, &junkD, &junkD, &junkC, &junkC, &junkN,
+ &junkD, &junkD, &junkD, &junkD, &junkD, &junkC, &junkC, &junkN,
BoxJunk, &method)& STAYSONTOP_FLAG)
tmp_win->flags |= ONTOP;
KeepOnTop();
_at_@ -1166,7 +1166,7 @@
#ifdef USEDECOR
&junkC,
#endif
- &junkD,&junkD, &junkD, &junkC,&junkC,&junkN,BoxJunk,
+ &junkD,&junkD, &junkD, &junkD, &junkD, &junkC,&junkC,&junkN,BoxJunk,
&method)&STAYSONTOP_FLAG)
tmp_win->flags |= ONTOP;
KeepOnTop();
diff -ru o/fvwm-2.0.45/fvwm/fvwm.man fvwm-2.0.45/fvwm/fvwm.man
--- o/fvwm-2.0.45/fvwm/fvwm.man Wed Jan 22 17:13:38 1997
+++ fvwm-2.0.45/fvwm/fvwm.man Thu Apr 10 14:06:56 1997
_at_@ -1459,7 +1459,7 @@
NoTitle/Title, NoHandles/Handles, WindowListSkip/WindowListHit,
CirculateSkip/CirculateHit, StaysOnTop/StaysPut, Sticky/Slippery,
StartIconic/StartNormal, Color, ForeColor, BackColor,
-StartsOnDesk/StartsAnyWhere, IconTitle/NoIconTitle,
+StartsOnDesk/StartsOnPage/StartsAnyWhere, IconTitle/NoIconTitle,
MWMButtons/FvwmButtons, MWMBorder/FvwmBorder, MWMDecor/NoDecorHint,
MWMFunctions/NoFuncHint, HintOverride/NoOverride, NoButton/Button,
OLDecor/NoOLDecor, StickyIcon/SlipperyIcon,
_at_@ -1496,6 +1496,10 @@
which the window should be initially placed. Note that standard Xt
programs can also specify this via a resource (e.g. "-xrm '*Desk: 1'").
+StartsOnPage takes two numeric arguments which are the page on the desktop on
+which the window should be initially placed. Note that standard Xt
+programs can also specify this via a resource (e.g. "-xrm '*Page: 1 0'").
+
StaysOnTop makes the window always try to stay on top of the other
windows. This might be handy for clocks or mailboxes that you would
always like to be visible. If the window is explicitly lowered it
_at_@ -1550,7 +1554,7 @@
without retyping. For example: 'Style "rxvt" UseStyle "XTerm"'.
SkipMapping tells fvwm not to switch to the desk the window is on when
-it gets mapped initially (useful with StartsOnDesk).
+it gets mapped initially (useful with StartsOnDesk (and StartsOnPage?)).
Lenience instructs fvwm to ignore the convention in the ICCCM which
states that if an application sets the input field of the wm_hints
_at_@ -1605,7 +1609,7 @@
Style "rxvt" Icon term.xpm
Style "xterm" Icon rterm.xpm
-Style "xcalc" Icon xcalc.xpm
+Style "xcalc" Icon xcalc.xpm, StartsOnPage 1 1
Style "xbiff" Icon mail1.xpm
Style "xmh" Icon mail1.xpm, StartsOnDesk 2
Style "xman" Icon xman.xpm
diff -ru o/fvwm-2.0.45/fvwm/fvwm2.man fvwm-2.0.45/fvwm/fvwm2.man
--- o/fvwm-2.0.45/fvwm/fvwm2.man Wed Jan 22 17:13:38 1997
+++ fvwm-2.0.45/fvwm/fvwm2.man Thu Apr 10 14:06:56 1997
_at_@ -1459,7 +1459,7 @@
NoTitle/Title, NoHandles/Handles, WindowListSkip/WindowListHit,
CirculateSkip/CirculateHit, StaysOnTop/StaysPut, Sticky/Slippery,
StartIconic/StartNormal, Color, ForeColor, BackColor,
-StartsOnDesk/StartsAnyWhere, IconTitle/NoIconTitle,
+StartsOnDesk/StartsOnPage/StartsAnyWhere, IconTitle/NoIconTitle,
MWMButtons/FvwmButtons, MWMBorder/FvwmBorder, MWMDecor/NoDecorHint,
MWMFunctions/NoFuncHint, HintOverride/NoOverride, NoButton/Button,
OLDecor/NoOLDecor, StickyIcon/SlipperyIcon,
_at_@ -1496,6 +1496,10 @@
which the window should be initially placed. Note that standard Xt
programs can also specify this via a resource (e.g. "-xrm '*Desk: 1'").
+StartsOnPage takes two numeric arguments which are the page on the desktop on
+which the window should be initially placed. Note that standard Xt
+programs can also specify this via a resource (e.g. "-xrm '*Page: 1 0'").
+
StaysOnTop makes the window always try to stay on top of the other
windows. This might be handy for clocks or mailboxes that you would
always like to be visible. If the window is explicitly lowered it
_at_@ -1550,7 +1554,7 @@
without retyping. For example: 'Style "rxvt" UseStyle "XTerm"'.
SkipMapping tells fvwm not to switch to the desk the window is on when
-it gets mapped initially (useful with StartsOnDesk).
+it gets mapped initially (useful with StartsOnDesk (and StartsOnPage?)).
Lenience instructs fvwm to ignore the convention in the ICCCM which
states that if an application sets the input field of the wm_hints
_at_@ -1605,7 +1609,7 @@
Style "rxvt" Icon term.xpm
Style "xterm" Icon rterm.xpm
-Style "xcalc" Icon xcalc.xpm
+Style "xcalc" Icon xcalc.xpm, StartsOnPage 1 1
Style "xbiff" Icon mail1.xpm
Style "xmh" Icon mail1.xpm, StartsOnDesk 2
Style "xman" Icon xman.xpm
diff -ru o/fvwm-2.0.45/fvwm/misc.h fvwm-2.0.45/fvwm/misc.h
--- o/fvwm-2.0.45/fvwm/misc.h Mon Dec 23 23:07:47 1996
+++ fvwm-2.0.45/fvwm/misc.h Thu Apr 10 13:48:56 1997
_at_@ -27,6 +27,7 @@
char *Decor;
#endif
int Desk; /* Desktop number */
+ int PageX, PageY;
unsigned long on_flags;
unsigned long off_flags;
int border_width;
_at_@ -103,7 +104,10 @@
#define OL_DECOR_FLAG (1<<30)
#ifdef MINI_ICONS
+#error "MINI_ICONS must not be defined for StartsOnPage to be usable!"
#define MINIICON_FLAG (1<<31)
+#else
+#define STARTSONPAGE_FLAG (1<<31)
#endif
/* some fancy font handling stuff */
_at_@ -138,7 +142,8 @@
#ifdef USEDECOR
char **decor,
#endif
- int *Desk, int *bw, int *nobw,
+ int *Desk, int *PageX, int *PageY,
+ int *bw, int *nobw,
char **forecolor, char **backcolor,
unsigned long * buttons, int *IconBox,
int *BoxFillMethod);
_at_@ -298,7 +303,7 @@
void WaitForButtonsUp(void);
void FocusOn(FvwmWindow *t,int DeIconifyOnly);
void WarpOn(FvwmWindow *t,int warp_x, int x_unit, int warp_y, int y_unit);
-Bool PlaceWindow(FvwmWindow *tmp_win, unsigned long flags,int Desk);
+Bool PlaceWindow(FvwmWindow *tmp_win, unsigned long flags,int Desk, int PageX, int PageY);
void free_window_names (FvwmWindow *tmp, Bool nukename, Bool nukeicon);
int do_menu (MenuRoot *menu,int style);
_at_@ -319,7 +324,7 @@
char *decor,
#endif
unsigned long off_flags,
- unsigned long on_flags, int desk,int bw, int nobw,
+ unsigned long on_flags, int desk, int pagex, int pagey, int bw, int nobw,
char *forecolor, char *backcolor,
unsigned long off_buttons, unsigned long on_buttons,
int *IconBox, int BoxFillMethod);
diff -ru o/fvwm-2.0.45/fvwm/placement.c fvwm-2.0.45/fvwm/placement.c
--- o/fvwm-2.0.45/fvwm/placement.c Fri Jan 17 15:39:21 1997
+++ fvwm-2.0.45/fvwm/placement.c Thu Apr 10 14:01:49 1997
_at_@ -322,7 +322,7 @@
* Returns False in the event of a lost window.
*
**************************************************************************/
-Bool PlaceWindow(FvwmWindow *tmp_win, unsigned long tflag,int Desk)
+Bool PlaceWindow(FvwmWindow *tmp_win, unsigned long tflag, int Desk, int PageX, int PageY)
{
FvwmWindow *t;
int xl = -1,yt,DragWidth,DragHeight;
_at_@ -375,7 +375,7 @@
tmp_win->Desk = t->Desk;
}
}
-
+
if ((XGetWindowProperty(dpy, tmp_win->w, _XA_WM_DESKTOP, 0L, 1L, True,
_XA_WM_DESKTOP, &atype, &aformat, &nitems,
&bytes_remain, &prop))==Success)
_at_@ -392,8 +392,34 @@
if((!PPosOverride)&&(!(tmp_win->flags & SHOW_ON_MAP)))
changeDesks(0,tmp_win->Desk);
+ /* Select a page to put the window on (in list of priority):
+ * 1. Sticky Windows stay on the current page.
+ * 2. Windows specified with StartsOnPage go where specified
+...while the above two look reasonable, i don't know about the next three:
+(while the screen structure knows about its `current desk', it has no such
+thing as a `current page'.)
+ * 3. Put it on the page it was on before the restart.
+ -> this one is probably fully automatic, the window gets its old
+ x/y position
+ * 4. Transients go on the same page as their parents.
+ -> currently not...?
+ * 5. Window groups stay together (completely untested)
+ -> dunno...
+ */
+ if (!(tflag & STICKY_FLAG) && (tflag & STARTSONPAGE_FLAG))
+ {
+ /* I think it would be good to switch to the selected desk
+ * whenever a new window pops up, except during initialization */
+ if((!PPosOverride)&&(!(tmp_win->flags & SHOW_ON_MAP)))
+ {
+ int x = PageX * Scr.MyDisplayWidth;
+ int y = PageY * Scr.MyDisplayHeight;
+ MoveViewport(x,y,True);
+ }
+ }
+
- /* Desk has been selected, now pick a location for the window */
+ /* Desk and page have been selected, now pick a location for the window */
/*
* If
* o the window is a transient, or
diff -ru o/fvwm-2.0.45/fvwm/style.c fvwm-2.0.45/fvwm/style.c
--- o/fvwm-2.0.45/fvwm/style.c Fri Jan 17 15:56:30 1997
+++ fvwm-2.0.45/fvwm/style.c Thu Apr 10 14:03:02 1997
_at_@ -52,7 +52,7 @@
int IconBox[4];
int num,i;
- int len,desknumber = 0,bw=0, nobw = 0;
+ int len,desknumber = 0, pagex = 0, pagey = 0, bw=0, nobw = 0;
unsigned long off_flags = 0;
unsigned long on_flags = 0;
_at_@ -548,7 +548,7 @@
on_flags |= STICKY_FLAG;
restofline +=8;
}
- else if(mystrncasecmp(restofline,"STARTSONDESK",12)==0)
+ else if(mystrncasecmp(restofline,"StartsOnDesk",12)==0)
{
restofline +=12;
off_flags |= STARTSONDESK_FLAG;
_at_@ -559,6 +559,21 @@
restofline++;
while(isspace(*restofline))restofline++;
}
+ else if(mystrncasecmp(restofline,"StartsOnPage",12)==0)
+ {
+ restofline +=12;
+ off_flags |= STARTSONPAGE_FLAG;
+ sscanf(restofline,"%d %d",&pagex,&pagey);
+ while(isspace(*restofline))restofline++;
+ while((!isspace(*restofline))&&(*restofline!= 0)&&
+ (*restofline != ',')&&(*restofline != '\n'))
+ restofline++;
+ while(isspace(*restofline))restofline++;
+ while((!isspace(*restofline))&&(*restofline!= 0)&&
+ (*restofline != ',')&&(*restofline != '\n'))
+ restofline++;
+ while(isspace(*restofline))restofline++;
+ }
else if(mystrncasecmp(restofline,"STARTSANYWHERE",14)==0)
{
restofline +=14;
_at_@ -756,7 +771,7 @@
#ifdef USEDECOR
decor,
#endif
- off_flags,on_flags,desknumber,bw,nobw,
+ off_flags,on_flags,desknumber,pagex,pagey,bw,nobw,
forecolor,backcolor,off_buttons,on_buttons,IconBox,BoxFillMethod);
}
_at_@ -772,6 +787,7 @@
unsigned long off_flags,
unsigned long on_flags,
int desk,
+ int pagex, int pagey,
int bw,
int nobw,
char *forecolor,
_at_@ -821,6 +837,8 @@
nptr->Decor = decor;
#endif
nptr->Desk = desk;
+ nptr->PageX = pagex;
+ nptr->PageY = pagey;
nptr->border_width = bw;
nptr->resize_width = nobw;
nptr->ForeColor = forecolor;
--
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 Thu Apr 10 1997 - 11:12:39 BST