void action_resize(union ActionData *data)
{
Client *c = data->resize.c;
- int w = data->resize.x - c->frame->size.left - c->frame->size.right;
- int h = data->resize.y - c->frame->size.top - c->frame->size.bottom;
+ int w = data->resize.x;
+ int h = data->resize.y;
if (!c || !client_normal(c)) return;
- /* XXX window snapping/struts */
-
+ dispatch_resize(c, &w, &h, data->resize.corner);
+
+ w -= c->frame->size.left + c->frame->size.right;
+ h -= c->frame->size.top + c->frame->size.bottom;
client_configure(c, data->resize.corner, c->area.x, c->area.y, w, h,
TRUE, data->resize.final);
}
obe.data.c.client = c;
obe.data.c.num[0] = num0;
obe.data.c.num[1] = num1;
+ obe.data.c.num[2] = 0;
i = 0;
while (e > 1) {
void dispatch_move(Client *c, int *x, int *y)
{
guint i;
- EventType e = Event_Client_Moving;
GSList *it;
+ EventType e = Event_Client_Moving;
ObEvent obe;
obe.type = e;
*x = obe.data.c.num[0];
*y = obe.data.c.num[1];
}
+
+void dispatch_resize(Client *c, int *w, int *h, Corner corner)
+{
+ guint i;
+ GSList *it;
+ EventType e = Event_Client_Resizing;
+ ObEvent obe;
+
+ obe.type = e;
+ obe.data.c.client = c;
+ obe.data.c.num[0] = *w;
+ obe.data.c.num[1] = *h;
+ obe.data.c.num[2] = corner;
+
+ i = 0;
+ while (e > 1) {
+ e >>= 1;
+ ++i;
+ }
+
+ for (it = funcs[i]; it != NULL; it = it->next) {
+ Func *f = it->data;
+ f->h(&obe, f->data);
+ }
+
+ *w = obe.data.c.num[0];
+ *h = obe.data.c.num[1];
+}
Event_Client_Urgent = 1 << 14, /* entered/left urgent state */
Event_Client_Desktop = 1 << 15, /* moved to a new desktop */
Event_Client_Moving = 1 << 16, /* being interactively moved */
+ Event_Client_Resizing = 1 << 17, /* being interactively resized */
- Event_Ob_Desktop = 1 << 17, /* changed desktops */
- Event_Ob_NumDesktops = 1 << 18, /* changed the number of desktops */
- Event_Ob_ShowDesktop = 1 << 19, /* entered/left show-the-desktop mode */
+ Event_Ob_Desktop = 1 << 18, /* changed desktops */
+ Event_Ob_NumDesktops = 1 << 19, /* changed the number of desktops */
+ Event_Ob_ShowDesktop = 1 << 20, /* entered/left show-the-desktop mode */
- Event_Signal = 1 << 20, /* a signal from the OS */
+ Event_Signal = 1 << 21, /* a signal from the OS */
- EVENT_RANGE = 1 << 21
+ EVENT_RANGE = 1 << 22
} EventType;
typedef struct {
typedef struct {
Client *client;
- int num[2];
+ int num[3];
/* Event_Client_Desktop: num[0] = new number, num[1] = old number
Event_Client_Urgent: num[0] = urgent state
Event_Client_Moving: num[0] = dest x coord, num[1] = dest y coord --
change these in the handler to adjust where the
window will be placed
+ Event_Client_Resizing: num[0] = dest width, num[1] = dest height --
+ change these in the handler to adjust where the
+ window will be placed
+ num[2] = the anchored corner
*/
} EventData_Client;
/* *x and *y should be set with the destination of the window, they may be
changed by the event handlers */
void dispatch_move(Client *c, int *x, int *y);
+/* *w and *h should be set with the destination of the window, they may be
+ changed by the event handlers */
+void dispatch_resize(Client *c, int *w, int *h, Corner corner);
#endif