add resizing event
This commit is contained in:
parent
1cbe8af5e3
commit
ca40e8b9ec
3 changed files with 50 additions and 11 deletions
|
@ -592,13 +592,15 @@ void action_move(union ActionData *data)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -153,6 +153,7 @@ void dispatch_client(EventType e, Client *c, int num0, int num1)
|
|||
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_signal(int signal)
|
|||
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 @@ void dispatch_move(Client *c, int *x, int *y)
|
|||
*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];
|
||||
}
|
||||
|
|
|
@ -28,14 +28,15 @@ typedef enum {
|
|||
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 @@ 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;
|
||||
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue