On Wed, Mar 16, 2005 at 04:58:25PM +0000, Tuomo Valkonen wrote:
> On 2005-03-16, Edwin Steiner <[EMAIL PROTECTED]> wrote:
> > I looked at the winprop stuff and there seem to be two ways
> > to handle a winprop:
> >
> >     1) use extl_table_gets_...(cwin->proptab,key,...) directly,
> >
> >     2) translate the winprop to a member of cwin in
> >        clientwin_get_winprops and then use this member.
> >
> > I suppose I should use 1), right?
> 
> 2) is better because the property is going to be used oftne.
> 
> > I'm not sure about the name of the winprop:
> >     client_gravity
> >     client_alignment
> >     ??
> 
> slack_gravity?
> slack_alignment_gravity?
> 
> Probably something with gravity, though. No need to have 'client' in
> it as winprops are obviously for client windows.

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?

-Edwin
New patches:

[winprop_gravity
Edwin Steiner <[EMAIL PROTECTED]>**20050316201819
 add a 'gravity' winprop for placing windows when there is slack
 inside a region
] {
hunk ./ioncore/clientwin.c 14
+#include <ctype.h>
hunk ./ioncore/clientwin.c 97
+struct alignment_spec {
+    const char *spec;    /* name of the alignment           */
+    int         xalign;  /* -1..left, 0..center, +1..right  */
+    int         yalign;  /* -1..top , 0..cetner, +1..bottom */
+};
+
+/* translation table for alignment specifications */
+static struct alignment_spec alignment_specs[] = {
+    {"center"        ,  0,  0},
+    {"west"          , -1,  0},
+    {"east"          , +1,  0},
+    {"north"         ,  0, -1},
+    {"northwest"     , -1, -1},
+    {"northeast"     , +1, -1},
+    {"south"         ,  0, +1},
+    {"southwest"     , -1, +1},
+    {"southeast"     , +1, +1},
+    { NULL           ,  0,  0}   /* end marker */
+};
+
hunk ./ioncore/clientwin.c 122
+    char *alignment;
hunk ./ioncore/clientwin.c 188
+    
+    if (extl_table_gets_s(cwin->proptab,"gravity",&alignment)) {
+       char *s;
+       const struct alignment_spec *sp;
+       
+       for (s=alignment; *s; ++s)
+           *s = tolower(*s);
+
+       for (sp=alignment_specs; sp->spec; ++sp) {
+           if (strcmp(alignment,sp->spec) == 0) {
+               cwin->flags |= CLIENTWIN_PROP_ALIGN;
+               cwin->xalign = sp->xalign;
+               cwin->yalign = sp->yalign;
+               break;
+           }
+       }
+       free(alignment);
+    }
hunk ./ioncore/clientwin.c 355
+
+    cwin->xalign=0;
+    cwin->yalign=0;
hunk ./ioncore/clientwin.c 1064
-
hunk ./ioncore/clientwin.c 1068
-    bool bottom=FALSE;
-    bool top=FALSE;
+    int xalign = cwin->xalign;  /* -1..left, 0..center, +1..right  */
+    int yalign = cwin->yalign;  /* -1..top , 0..center, +1..bottom */
hunk ./ioncore/clientwin.c 1081
-        if(mgr->flags&CLIENTWIN_TRANSIENTS_AT_TOP)
-            top=TRUE;
-        else
-            bottom=TRUE;
+       if ((cwin->flags&CLIENTWIN_PROP_ALIGN) == 0) {
+           if(mgr->flags&CLIENTWIN_TRANSIENTS_AT_TOP)
+               yalign = -1;
+           else
+               yalign = +1;
+       }
hunk ./ioncore/clientwin.c 1096
-    geom->x=max_geom->x+max_geom->w/2-geom->w/2;
+    if (xalign < 0)
+       geom->x=max_geom->x;
+    else if (xalign > 0)
+       geom->x=max_geom->x+max_geom->w-geom->w;
+    else
+       geom->x=max_geom->x+max_geom->w/2-geom->w/2;
hunk ./ioncore/clientwin.c 1103
-    if(top)
+    if (yalign < 0)
hunk ./ioncore/clientwin.c 1105
-    else if(bottom)
+    else if (yalign > 0)
hunk ./ioncore/clientwin.h 36
+#define CLIENTWIN_PROP_ALIGN         0x00800
hunk ./ioncore/clientwin.h 74
+
+    /* only used if CLIENTWIN_PROP_ALIGN is set: */
+    int xalign;  /* -1..left, 0..center, +1..right  */
+    int yalign;  /* -1..top , 0..cetner, +1..bottom */
}

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:
9cbba3a9c696f189d4d05e8c0d50c525bd641203

Reply via email to