On Wed, Mar 16, 2005 at 11:06:20PM +0200, Tuomo Valkonen wrote:
> On 2005-03-16 21:33 +0100, Edwin Steiner wrote:
> > I called it simply 'gravity'. I attach a preliminary patch. A 'gravity'
> > winprop, if present, overrides the CLIENTWIN_TRANSIENTS_AT_TOP flag of
> > the manager. Is this correct or should it be the other way round?
>
> Remove the transients_at_top winprop and replace with transients_gravity.
> Use this value if the transient doesn't have its own gravity set. I think it
> is better to store the gravity settings as X gravity values instead of
> x/yalign in WClientWin, with StaticGravity standing for centering, and
> ForgetGravity for nothing being set (and thus defaulting to manager setting
> or SouthGravity for those transients managed by a client windows and
> StaticGravity for those not).
Yes, it looks cleaner now. I use CenterGravity instead of StaticGravity.
'transients_at_top' still works, but it is now implemented by
'transients_gravity'.
Defaults are ForgetGravity for 'gravity' and SouthGravity for
'transients_gravity'.
-Edwin
New patches:
[winprop_gravity
Edwin Steiner <[EMAIL PROTECTED]>**20050316222024
add 'gravity' and 'transient_gravity' winprops
] {
hunk ./ioncore/clientwin.c 14
+#include <ctype.h>
hunk ./ioncore/clientwin.c 97
+struct gravity_spec {
+ const char *spec; /* name of the gravity value */
+ int gravity; /* X gravity value */
+};
+
+/* translation table for gravity specifications */
+static struct gravity_spec gravity_specs[] = {
+ {"center" , CenterGravity },
+ {"west" , WestGravity },
+ {"east" , EastGravity },
+ {"north" , NorthGravity },
+ {"northwest" , NorthWestGravity },
+ {"northeast" , NorthEastGravity },
+ {"south" , SouthGravity },
+ {"southwest" , SouthWestGravity },
+ {"southeast" , SouthEastGravity },
+ { NULL , 0 } /* end marker */
+};
+
+static int get_gravity_winprop(WClientWin *cwin,const char *propname)
+{
+ char *gravity;
+ char *s;
+ const struct gravity_spec *sp;
+ int value = ForgetGravity;
+
+ if (extl_table_gets_s(cwin->proptab,propname,&gravity)) {
+ for (s=gravity; *s; ++s)
+ *s = tolower(*s);
+
+ for (sp=gravity_specs; sp->spec; ++sp) {
+ if (strcmp(gravity,sp->spec) == 0) {
+ value = sp->gravity;
+ break;
+ }
+ }
+ free(gravity);
+ }
+ return value;
+}
+
hunk ./ioncore/clientwin.c 207
- cwin->flags|=CLIENTWIN_TRANSIENTS_AT_TOP;
+ cwin->transient_gravity = NorthGravity;
+
+ cwin->gravity = get_gravity_winprop(cwin,"gravity");
+ cwin->transient_gravity = get_gravity_winprop(cwin,"transient_gravity");
hunk ./ioncore/clientwin.c 360
+
+ cwin->gravity=ForgetGravity;
+ cwin->transient_gravity=SouthGravity;
hunk ./ioncore/clientwin.c 1069
-
hunk ./ioncore/clientwin.c 1073
- bool bottom=FALSE;
- bool top=FALSE;
+ int gravity = cwin->gravity;
hunk ./ioncore/clientwin.c 1085
- if(mgr->flags&CLIENTWIN_TRANSIENTS_AT_TOP)
- top=TRUE;
- else
- bottom=TRUE;
+ if (gravity == ForgetGravity)
+ gravity = mgr->transient_gravity;
hunk ./ioncore/clientwin.c 1096
- geom->x=max_geom->x+max_geom->w/2-geom->w/2;
-
- if(top)
- geom->y=max_geom->y;
- else if(bottom)
- geom->y=max_geom->y+max_geom->h-geom->h;
- else
- geom->y=max_geom->y+max_geom->h/2-geom->h/2;
+ switch (gravity) {
+ case WestGravity:
+ case NorthWestGravity:
+ case SouthWestGravity:
+ geom->x=max_geom->x;
+ break;
+
+ case EastGravity:
+ case NorthEastGravity:
+ case SouthEastGravity:
+ geom->x=max_geom->x+max_geom->w-geom->w;
+ break;
+
+ default:
+ geom->x=max_geom->x+max_geom->w/2-geom->w/2;
+ }
+
+ switch (gravity) {
+ case NorthGravity:
+ case NorthWestGravity:
+ case NorthEastGravity:
+ geom->y=max_geom->y;
+ break;
+
+ case SouthGravity:
+ case SouthWestGravity:
+ case SouthEastGravity:
+ geom->y=max_geom->y+max_geom->h-geom->h;
+ break;
+
+ default:
+ geom->y=max_geom->y+max_geom->h/2-geom->h/2;
+ }
hunk ./ioncore/clientwin.c 1566
- cwin->flags^=CLIENTWIN_TRANSIENTS_AT_TOP;
+ if (cwin->transient_gravity == NorthGravity)
+ cwin->transient_gravity = SouthGravity;
+ else
+ cwin->transient_gravity = NorthGravity;
hunk ./ioncore/clientwin.h 38
-#define CLIENTWIN_TRANSIENTS_AT_TOP 0x20000
hunk ./ioncore/clientwin.h 72
+
+ int gravity; /* gravity used when there is slack */
+ int transient_gravity; /* gravity used for transients of this window */
+ /* if the transient's gravity is ForgetGravity */
}
Context:
[Some more layer list scanning optimisations.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050316180738]
[Split out some code from mplex.c to llist.c.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050316180405]
[Some WMPlex switch code optimisations/simplifications.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050315233232]
[WMPlex layer2 visiblity synchronisation fixes and focus policy changes.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050315224551]
[Ionws flip/transpose fixes.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050315210851]
[mod_query.query_menu can now display context menus.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050315142515]
[Dummy regions are no longer given name/registered.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050314182714
- WPaneHandles, WInfoWins and such are not accessible to the scripter
(from ioncore.region_list).
]
[Fixed goto_previous and tab switch (pointer) interaction.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050314161618]
[Alternative fix to bindmap precedence.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313212227
- "owned" bindmaps are added last on list, while region's own bindmaps
are listed first.
]
[Changed region bindmap linking order.
Tuomo Valkonen <[EMAIL PROTECTED]>*-20050313205827
- Frame bindmaps should now take precedence over workspace bindmaps
(that are grabbed on frames as workspaces don't have normal windows
associated to them).
]
[Panehandles (floating splits) are now reparented correctly.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313211846]
[Changed region bindmap linking order.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313205827
- Frame bindmaps should now take precedence over workspace bindmaps
(that are grabbed on frames as workspaces don't have normal windows
associated to them).
]
[Removed #warnings (and fixed a few).
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313204102]
[Removed ioncore.root_windows export.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313131840
- ioncore.region_list("WRootWin") does the task.
]
[ion-runinxterm uses the whole command as title now.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313130614]
[PWM menu definition updates and fixes.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313130439]
[Removed the ion-man script.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050313130247
- ioncore.exec_on now interprets the ':cmd' ion-runinxterm syntax.
- mod_query.query_man accepts the man command to use as parameter,
defaulting to ':man'.
- The default for query_ssh is also ':ssh' now.
]
[clientwin_unmapped_hook parameter was wrong.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050311144448
(Stupid semi-weakly typed languages...)
]
[Removed ion-ssh wrapper script.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050310082934
- mod_query.query_ssh defaults to running ssh with ion-runinxterm, but
accepts additional parameter specifying another program.
]
[Added field alignment code to statusbar module.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050309215838]
[Updated README information on F5/F6 keys.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050309121028]
[Changes in mod_query.query_editfile/viewfile.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050309120619
- These functions take the script (and prompt) as optional parameter now,
defaulting to run-mailcap.
- Removed the ion-edit and ion-view scripts.
]
[More mplex region indexing fixes.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050309113648
After the changes in layer list code recently and following attach index fix,
regions were now loaded in wrong order at startup.
]
[Removed WScreen.set_managed_offset.
Tuomo Valkonen <[EMAIL PROTECTED]>*-20050302120352
It seems unncessary now that there's the statusbar, and it's just an ugly
kludge for dubious uses anyway.
]
[Scratchpad and dock default toggle bindings changed.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050308143228
- Mod1+space now toggles the scratchpad, and
- Mod1+D toggles the dock.
]
[The dock is floating by default now.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050308141009
- New users shouldn't at firs try be bewildered by the dock not being able
to coexist with the statusbar.
]
[Exported classes are now marked with EXTL_EXPORT.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050308082518]
[Stdisp was being destroyed along with floatws.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050308073132]
[Fixed open quote handling in cmdline completion improvements.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050307171703]
[Default attach index was wrong for WMPlex.attach*.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050307170419
- Should be after current instead of last.
]
[Fixed focusingn of non-passive mplex layer2 regions.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050307084542]
[Check that reparenting can be done before trying to use a placeholder.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050306103530
- Added pholder_(do_)target and pholder_(do_)check_reparent
]
[More helper routines from attach.c are globally available.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050306102438]
[Removed pholder_stale as useless given placeholder redirection.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050305162535]
[Changed how query and menu cancel and finish routines destroy the region.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050305124204]
[Paths in mod_statusbar file headers were wrong.
Tuomo Valkonen <[EMAIL PROTECTED]>**20050305091557]
[TAG ion-3ds-20050304-1
Tuomo Valkonen <[EMAIL PROTECTED]>**20050304085938]
Patch bundle hash:
987edec31e3b7642809e720854248fb41d4ad0d7