Browse Source

Add _NET_WM_WINDOW_TYPE_DIALOG support

Martin Duquesnoy 12 years ago
parent
commit
99d732292f
3 changed files with 23 additions and 5 deletions
  1. 3 1
      src/client.c
  2. 18 2
      src/ewmh.c
  3. 2 2
      src/layout.c

+ 3 - 1
src/client.c

@@ -948,7 +948,10 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
      client_frame_new(c);
 
      if(!scan)
+     {
+          ewmh_manage_window_type(c);
           tag_client((c->flags & CLIENT_RULED ? c->tag : c->screen->seltag), c);
+     }
 
      /* Map, not at reload */
      if(c->tag == c->screen->seltag)
@@ -969,7 +972,6 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
           client_get_name(c);
           client_focus(c);
           client_configure(c);
-          ewmh_manage_window_type(c);
      }
 
      ewmh_get_client_list();

+ 18 - 2
src/ewmh.c

@@ -206,7 +206,8 @@ ewmh_manage_state(long data[], struct client *c)
                XReparentWindow(W->dpy, c->win, W->root, c->screen->geo.x, c->screen->geo.y);
                XResizeWindow(W->dpy, c->win, c->screen->geo.w, c->screen->geo.h);
 
-               client_focus(c);
+               if(c->tag)
+                    client_focus(c);
 
                XRaiseWindow(W->dpy, c->win);
           }
@@ -217,7 +218,7 @@ ewmh_manage_state(long data[], struct client *c)
                                (unsigned char*)0, 0);
                XReparentWindow(W->dpy, c->win, c->frame, c->wgeo.x, c->wgeo.y);
 
-               client_moveresize(c, &c->geo);
+               layout_client(c);
           }
      }
 }
@@ -231,6 +232,21 @@ ewmh_manage_window_type(struct client *c)
      unsigned char *data = NULL;
      long ldata[5] = { _NET_WM_STATE_ADD };
 
+
+     if(XGetWindowProperty(W->dpy, c->win, W->net_atom[net_wm_window_type], 0L, 0x7FFFFFFFL,
+                           False, XA_ATOM, &rf, &f, &n, &il, &data) == Success && n)
+     {
+          atom = (Atom*)data;
+
+          for(i = 0; i < n; ++i)
+          {
+               /* MANAGE _NET_WM_WINDOW_TYPE_DIALOG */
+               if(atom[i] == W->net_atom[net_wm_window_type_dialog])
+                    c->flags |= CLIENT_FREE;
+          }
+          XFree(data);
+     }
+
      /* _NET_WM_STATE at window mangement */
      if(XGetWindowProperty(W->dpy, c->win, W->net_atom[net_wm_state], 0L, 0x7FFFFFFFL, false,
                            XA_ATOM, &rf, &f, &n, &il, &data) == Success && n)

+ 2 - 2
src/layout.c

@@ -598,9 +598,9 @@ LAYOUT_INTEGRATE_DIR(Bottom);
 void
 layout_client(struct client *c)
 {
-     if(c->flags & CLIENT_IGNORE_LAYOUT)
+     if(c->flags & (CLIENT_IGNORE_LAYOUT | CLIENT_FULLSCREEN))
      {
-          c->flags ^= CLIENT_IGNORE_LAYOUT;
+          c->flags &= ~CLIENT_IGNORE_LAYOUT;
           return;
      }