all repos — openbox @ ca40e8b9eca2bba3d4aadd650722bc80542b4819

openbox fork - make it a bit more like ryudo

add resizing event
Dana Jansens danakj@orodu.net
commit

ca40e8b9eca2bba3d4aadd650722bc80542b4819

parent

1cbe8af5e32984da6a5a11a2e7aecf8d069921cf

3 files changed, 50 insertions(+), 11 deletions(-)

jump to
M openbox/action.copenbox/action.c

@@ -592,13 +592,15 @@

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); }
M openbox/dispatch.copenbox/dispatch.c

@@ -153,6 +153,7 @@ obe.type = e;

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) {

@@ -213,8 +214,8 @@

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;

@@ -236,3 +237,31 @@

*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]; +}
M openbox/dispatch.hopenbox/dispatch.h

@@ -28,14 +28,15 @@ Event_Client_Unfocus = 1 << 13, /* unfocused */

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 {

@@ -45,12 +46,16 @@ } EventData_X;

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;

@@ -91,5 +96,8 @@ void dispatch_signal(int signal);

/* *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