]> Dogcows Code - chaz/openbox/commitdiff
add resizing event
authorDana Jansens <danakj@orodu.net>
Fri, 28 Mar 2003 09:33:40 +0000 (09:33 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 28 Mar 2003 09:33:40 +0000 (09:33 +0000)
openbox/action.c
openbox/dispatch.c
openbox/dispatch.h

index f0c703ffd152a05f28c2a0c12ad83e55d34c2082..6eb06298f7cec4dc8c99166f0ed673ba2ad33cea 100644 (file)
@@ -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);
 }
index 08690a3715c9e74e8ed1842400f2572f3eab4817..6f2b3d4e2e36441a7dadc1e9899ae8906aaf02ed 100644 (file)
@@ -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];
+}
index 412e135e6a1df159601717de5fde82179881b01d..d3ac0d4e7b41676296e05f586492d5233ae3844a 100644 (file)
@@ -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
This page took 0.030831 seconds and 4 git commands to generate.