X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Factions%2Fmoveresizeto.c;h=56f21e61042122b2564d45c2479a2d4ee4989e35;hb=6c87b1dd703bb67d7c945dc846da9d17c9c72382;hp=14695d4cb168b3518ea823992dc51f681786d77e;hpb=7a679dd1989ee0b5b36ab2d6b16af47be8a537ad;p=chaz%2Fopenbox diff --git a/openbox/actions/moveresizeto.c b/openbox/actions/moveresizeto.c index 14695d4c..56f21e61 100644 --- a/openbox/actions/moveresizeto.c +++ b/openbox/actions/moveresizeto.c @@ -3,7 +3,6 @@ #include "openbox/screen.h" #include "openbox/frame.h" #include "openbox/config.h" -#include /* for atoi */ enum { CURRENT_MONITOR = -1, @@ -20,6 +19,8 @@ typedef struct { gint h; gint h_denom; gint monitor; + gboolean w_sets_client_size; + gboolean h_sets_client_size; } Options; static gpointer setup_func(xmlNodePtr node); @@ -58,12 +59,16 @@ static gpointer setup_func(xmlNodePtr node) if (g_ascii_strcasecmp(s, "current") != 0) config_parse_relative_number(s, &o->w, &o->w_denom); g_free(s); + + obt_xml_attr_bool(n, "client", &o->w_sets_client_size); } if ((n = obt_xml_find_node(node, "height"))) { gchar *s = obt_xml_node_string(n); if (g_ascii_strcasecmp(s, "current") != 0) config_parse_relative_number(s, &o->h, &o->h_denom); g_free(s); + + obt_xml_attr_bool(n, "client", &o->h_sets_client_size); } if ((n = obt_xml_find_node(node, "monitor"))) { @@ -119,14 +124,31 @@ static gboolean run_func(ObActionsData *data, gpointer options) area = screen_area(c->desktop, mon, NULL); carea = screen_area(c->desktop, cmon, NULL); + /* find a target size for the client/frame. */ w = o->w; - if (w == G_MININT) w = c->area.width; + if (w == G_MININT) { + if (o->w_sets_client_size) + w = c->area.width; + else + w = c->frame->area.width; + } else if (o->w_denom) w = (w * area->width) / o->w_denom; h = o->h; - if (h == G_MININT) h = c->area.height; + if (h == G_MININT) { + if (o->h_sets_client_size) + h = c->area.height; + else + h = c->frame->area.height; + } else if (o->h_denom) h = (h * area->height) / o->h_denom; + /* get back to the client's size. */ + if (!o->w_sets_client_size) + w -= c->frame->size.left + c->frame->size.right; + if (!o->h_sets_client_size) + h -= c->frame->size.top + c->frame->size.bottom; + /* it might not be able to resize how they requested, so find out what it will actually be resized to */ x = c->area.x;