]> Dogcows Code - chaz/openbox/commitdiff
Merge branch 'backport'
authorMikael Magnusson <mikachu@comhem.se>
Tue, 18 Dec 2007 20:12:52 +0000 (21:12 +0100)
committerMikael Magnusson <mikachu@comhem.se>
Tue, 18 Dec 2007 20:12:52 +0000 (21:12 +0100)
1  2 
openbox/actions/growtoedge.c

index 44e528724d016a16d9ef204aad1f494533769433,69b8ef77b33ce4db0621992c08ceafe9b26e7a15..630ead10c446861a103fbdd7ad9d0c009da43c05
@@@ -7,27 -7,19 +7,27 @@@
  
  typedef struct {
      ObDirection dir;
 +    gboolean shrink;
  } Options;
  
  static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
 +static gpointer setup_shrink_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
  static void     free_func(gpointer options);
  static gboolean run_func(ObActionsData *data, gpointer options);
  
- void action_growtoedge_startup()
+ void action_growtoedge_startup(void)
  {
      actions_register("GrowToEdge",
                       setup_func,
                       free_func,
                       run_func,
                       NULL, NULL);
 +
 +    actions_register("ShrinkToEdge",
 +                     setup_shrink_func,
 +                     free_func,
 +                     run_func,
 +                     NULL, NULL);
  }
  
  static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
@@@ -37,7 -29,6 +37,7 @@@
  
      o = g_new0(Options, 1);
      o->dir = OB_DIRECTION_NORTH;
 +    o->shrink = FALSE;
  
      if ((n = parse_find_node("direction", node))) {
          gchar *s = parse_string(doc, n);
      return o;
  }
  
 +static gpointer setup_shrink_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
 +{
 +    Options *o;
 +
 +    o = setup_func(i, doc, node);
 +    o->shrink = TRUE;
 +
 +    return o;
 +}
 +
  static void free_func(gpointer options)
  {
      Options *o = options;
@@@ -117,13 -98,11 +117,13 @@@ static gboolean run_func(ObActionsData 
          return FALSE;
      }
  
 -    /* try grow */
 -    client_find_resize_directional(data->client, o->dir, TRUE,
 -                                   &x, &y, &w, &h);
 -    if (do_grow(data, x, y, w, h))
 -        return FALSE;
 +    if (!o->shrink) {
 +        /* try grow */
 +        client_find_resize_directional(data->client, o->dir, TRUE,
 +                                       &x, &y, &w, &h);
 +        if (do_grow(data, x, y, w, h))
 +            return FALSE;
 +    }
  
      /* we couldn't grow, so try shrink! */
      opp = (o->dir == OB_DIRECTION_NORTH ? OB_DIRECTION_SOUTH :
This page took 0.023533 seconds and 4 git commands to generate.