add disabled buttons, instead of now showing buttons at all when they wont do anythin...
authorDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 23:27:02 +0000 (23:27 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 23:27:02 +0000 (23:27 +0000)
when a window cant be resized, its handle is not removed but its grips are.

change allowing the user to disable individual decorations as that is overkill,
instead allow a toggle through the client.decorate boolean.

openbox/action.c
openbox/client.c
openbox/client.h
openbox/frame.c
openbox/frame.h
openbox/framerender.c
openbox/openbox.c
render/theme.c
render/theme.h
tests/.cvsignore
tests/noresize.c [new file with mode: 0644]

index 6e06d37..a14ea7c 100644 (file)
@@ -1105,7 +1105,7 @@ void action_toggle_decorations(union ActionData *data)
 
     if (!c) return;
 
-    c->disabled_decorations = c->disabled_decorations ? 0 : ~0;
+    c->decorate = !c->decorate;
     client_setup_decor_and_functions(c);
 }
 
index aa6e5be..a339bf0 100644 (file)
@@ -544,7 +544,7 @@ static void client_get_all(ObClient *self)
     self->layer = -1;
     self->urgent = FALSE;
     self->positioned = FALSE;
-    self->disabled_decorations = 0;
+    self->decorate = TRUE;
     self->group = NULL;
     self->nicons = 0;
 
@@ -914,22 +914,28 @@ void client_update_normal_hints(ObClient *self)
 void client_setup_decor_and_functions(ObClient *self)
 {
     /* start with everything (cept fullscreen) */
-    self->decorations = Decor_Titlebar | Decor_Handle | Decor_Border |
-       Decor_Icon | Decor_AllDesktops | Decor_Iconify | Decor_Maximize |
-        Decor_Shade;
-    self->functions = OB_CLIENT_FUNC_RESIZE | OB_CLIENT_FUNC_MOVE |
-        OB_CLIENT_FUNC_ICONIFY | OB_CLIENT_FUNC_MAXIMIZE |
-        OB_CLIENT_FUNC_SHADE;
+    self->decorations = (OB_FRAME_DECOR_TITLEBAR |
+                         OB_FRAME_DECOR_HANDLE |
+                         OB_FRAME_DECOR_GRIPS |
+                         OB_FRAME_DECOR_BORDER |
+                         OB_FRAME_DECOR_ICON |
+                         OB_FRAME_DECOR_ALLDESKTOPS |
+                         OB_FRAME_DECOR_ICONIFY |
+                         OB_FRAME_DECOR_MAXIMIZE |
+                         OB_FRAME_DECOR_SHADE);
+    self->functions = (OB_CLIENT_FUNC_RESIZE |
+                       OB_CLIENT_FUNC_MOVE |
+                       OB_CLIENT_FUNC_ICONIFY |
+                       OB_CLIENT_FUNC_MAXIMIZE |
+                       OB_CLIENT_FUNC_SHADE);
     if (self->delete_window) {
-       self->decorations |= Decor_Close;
        self->functions |= OB_CLIENT_FUNC_CLOSE;
+        self->decorations |= OB_FRAME_DECOR_CLOSE;
     }
 
     if (!(self->min_size.width < self->max_size.width ||
-         self->min_size.height < self->max_size.height)) {
-       self->decorations &= ~(Decor_Maximize | Decor_Handle);
+         self->min_size.height < self->max_size.height))
        self->functions &= ~OB_CLIENT_FUNC_RESIZE;
-    }
 
     switch (self->type) {
     case OB_CLIENT_TYPE_NORMAL:
@@ -941,14 +947,12 @@ void client_setup_decor_and_functions(ObClient *self)
     case OB_CLIENT_TYPE_DIALOG:
     case OB_CLIENT_TYPE_UTILITY:
        /* these windows cannot be maximized */
-       self->decorations &= ~Decor_Maximize;
        self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
        break;
 
     case OB_CLIENT_TYPE_MENU:
     case OB_CLIENT_TYPE_TOOLBAR:
        /* these windows get less functionality */
-       self->decorations &= ~(Decor_Iconify | Decor_Handle);
        self->functions &= ~(OB_CLIENT_FUNC_ICONIFY | OB_CLIENT_FUNC_RESIZE);
        break;
 
@@ -965,16 +969,11 @@ void client_setup_decor_and_functions(ObClient *self)
        decor and functionality */
     if (self->mwmhints.flags & OB_MWM_FLAG_DECORATIONS) {
        if (! (self->mwmhints.decorations & OB_MWM_DECOR_ALL)) {
-           if (! (self->mwmhints.decorations & OB_MWM_DECOR_BORDER))
-               self->decorations &= ~Decor_Border;
-           if (! (self->mwmhints.decorations & OB_MWM_DECOR_HANDLE))
-               self->decorations &= ~Decor_Handle;
-           if (! (self->mwmhints.decorations & OB_MWM_DECOR_TITLE))
-               self->decorations &= ~Decor_Titlebar;
-           if (! (self->mwmhints.decorations & OB_MWM_DECOR_ICONIFY))
-               self->decorations &= ~Decor_Iconify;
-           if (! (self->mwmhints.decorations & OB_MWM_DECOR_MAXIMIZE))
-               self->decorations &= ~Decor_Maximize;
+           if (! ((self->mwmhints.decorations & OB_MWM_DECOR_HANDLE) ||
+                   (self->mwmhints.decorations & OB_MWM_DECOR_TITLE)))
+                /* if the mwm hints request no handle or title, then all
+                   decorations are disabled */
+               self->decorations = 0;
        }
     }
 
@@ -984,43 +983,40 @@ void client_setup_decor_and_functions(ObClient *self)
                self->functions &= ~OB_CLIENT_FUNC_RESIZE;
            if (! (self->mwmhints.functions & OB_MWM_FUNC_MOVE))
                self->functions &= ~OB_CLIENT_FUNC_MOVE;
+            /* dont let mwm hints kill any buttons
            if (! (self->mwmhints.functions & OB_MWM_FUNC_ICONIFY))
                self->functions &= ~OB_CLIENT_FUNC_ICONIFY;
            if (! (self->mwmhints.functions & OB_MWM_FUNC_MAXIMIZE))
                self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
+            */
            /* dont let mwm hints kill the close button
               if (! (self->mwmhints.functions & MwmFunc_Close))
-              self->functions &= ~Func_Close; */
+              self->functions &= ~OB_CLIENT_FUNC_CLOSE; */
        }
     }
 
+    if (!(self->functions & OB_CLIENT_FUNC_SHADE))
+        self->decorations &= ~OB_FRAME_DECOR_SHADE;
+    if (!(self->functions & OB_CLIENT_FUNC_ICONIFY))
+        self->decorations &= ~OB_FRAME_DECOR_ICONIFY;
+    if (!(self->functions & OB_CLIENT_FUNC_RESIZE))
+        self->decorations &= ~OB_FRAME_DECOR_GRIPS;
+
     /* can't maximize without moving/resizing */
-    if (!((self->functions & OB_CLIENT_FUNC_MOVE) &&
-          (self->functions & OB_CLIENT_FUNC_RESIZE)))
-       self->functions &= ~(OB_CLIENT_FUNC_MAXIMIZE |
-                             OB_CLIENT_FUNC_FULLSCREEN);
-
-    /* finally, user specified disabled decorations are applied to subtract
-       decorations */
-    if (self->disabled_decorations & Decor_Titlebar)
-       self->decorations &= ~Decor_Titlebar;
-    if (self->disabled_decorations & Decor_Handle)
-       self->decorations &= ~Decor_Handle;
-    if (self->disabled_decorations & Decor_Border)
-       self->decorations &= ~Decor_Border;
-    if (self->disabled_decorations & Decor_Iconify)
-       self->decorations &= ~Decor_Iconify;
-    if (self->disabled_decorations & Decor_Maximize)
-       self->decorations &= ~Decor_Maximize;
-    if (self->disabled_decorations & Decor_AllDesktops)
-       self->decorations &= ~Decor_AllDesktops;
-    if (self->disabled_decorations & Decor_Shade)
-       self->decorations &= ~Decor_Shade;
-    if (self->disabled_decorations & Decor_Close)
-       self->decorations &= ~Decor_Close;
+    if (!((self->functions & OB_CLIENT_FUNC_MAXIMIZE) &&
+          (self->functions & OB_CLIENT_FUNC_MOVE) &&
+          (self->functions & OB_CLIENT_FUNC_RESIZE))) {
+       self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
+        self->decorations &= ~OB_FRAME_DECOR_MAXIMIZE;
+    }
+
+    /* finally, the user can have requested no decorations, which overrides
+       everything */
+    if (!self->decorate)
+        self->decorations = 0;
 
     /* if we don't have a titlebar, then we cannot shade! */
-    if (!(self->decorations & Decor_Titlebar))
+    if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR))
        self->functions &= ~OB_CLIENT_FUNC_SHADE;
 
     /* now we need to check against rules for the client's current state */
index 24cefe3..c3bbe2b 100644 (file)
@@ -53,21 +53,6 @@ typedef enum
     OB_CLIENT_FUNC_CLOSE      = 1 << 6  /*!< Allow to be closed */
 } ObFunctions;
 
-/*! The decorations the client window wants to be displayed on it */
-typedef enum {
-    Decor_Titlebar    = 1 << 0, /*!< Display a titlebar */
-    Decor_Handle      = 1 << 1, /*!< Display a handle (bottom) */
-    Decor_Border      = 1 << 2, /*!< Display a border */
-    Decor_Icon        = 1 << 3, /*!< Display the window's icon */
-    Decor_Iconify     = 1 << 4, /*!< Display an iconify button */
-    Decor_Maximize    = 1 << 5, /*!< Display a maximize button */
-    /*! Display a button to toggle the window's placement on
-      all desktops */
-    Decor_AllDesktops = 1 << 6,
-    Decor_Shade       = 1 << 7, /*!< Displays a shade button */
-    Decor_Close       = 1 << 8  /*!< Display a close button */
-} Decoration;
-
 struct _ObClient
 {
     ObWindow obwin;
@@ -225,16 +210,16 @@ struct _ObClient
       are always below windows in higher layers. */
     ObStackingLayer layer;
 
-    /*! A bitmask of values in the Decoration enum
+    /*! A bitmask of values in the ObFrameDecorations enum
       The values in the variable are the decorations that the client wants to
       be displayed around it.
     */
     guint decorations;
 
-    /*! A bitmask of values in the Decoration enum.
-      Specifies the decorations that should NOT be displayed on the client.
+    /*! A user option. When this is set to FALSE the client will not ever
+      be decorated.
     */
-    guint disabled_decorations;
+    gboolean decorate;
 
     /*! A bitmask of values in the ObFunctions enum
       The values in the variable specify the ways in which the user is allowed
index 5efc869..3e90c3e 100644 (file)
 
 static void layout_title(ObFrame *self);
 
-void frame_startup()
-{
-}
-
-void frame_shutdown()
-{
-}
-
 static Window createWindow(Window parent, unsigned long mask,
                           XSetWindowAttributes *attrib)
 {
@@ -171,7 +163,7 @@ void frame_adjust_shape(ObFrame *self)
                           ShapeBounding, ShapeSet);
 
        num = 0;
-       if (self->decorations & Decor_Titlebar) {
+       if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
            xrect[0].x = -ob_rr_theme->bevel;
            xrect[0].y = -ob_rr_theme->bevel;
            xrect[0].width = self->width + self->bwidth * 2;
@@ -180,7 +172,7 @@ void frame_adjust_shape(ObFrame *self)
            ++num;
        }
 
-       if (self->decorations & Decor_Handle) {
+       if (self->decorations & OB_FRAME_DECOR_HANDLE) {
            xrect[1].x = -ob_rr_theme->bevel;
            xrect[1].y = FRAME_HANDLE_Y(self);
            xrect[1].width = self->width + self->bwidth * 2;
@@ -200,7 +192,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
 {
     if (resized) {
         self->decorations = self->client->decorations;
-        if (self->decorations & Decor_Border) {
+        if (self->decorations & OB_FRAME_DECOR_BORDER) {
             self->bwidth = ob_rr_theme->bwidth;
             self->cbwidth = ob_rr_theme->cbwidth;
         } else {
@@ -230,7 +222,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
         self->max_x = -1;
         self->close_x = -1;
 
-        if (self->decorations & Decor_Titlebar) {
+        if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
             XMoveResizeWindow(ob_display, self->title,
                               -self->bwidth, -self->bwidth,
                               self->width, ob_rr_theme->title_height);
@@ -242,19 +234,27 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
         } else
             XUnmapWindow(ob_display, self->title);
 
-        if (self->decorations & Decor_Handle) {
+        if (self->decorations & OB_FRAME_DECOR_HANDLE) {
             XMoveResizeWindow(ob_display, self->handle,
                               -self->bwidth, FRAME_HANDLE_Y(self),
                               self->width, ob_rr_theme->handle_height);
-            XMoveWindow(ob_display, self->lgrip,
-                        -self->bwidth, -self->bwidth);
-            XMoveWindow(ob_display, self->rgrip,
-                        -self->bwidth + self->width -
-                        ob_rr_theme->grip_width, -self->bwidth);
             self->innersize.bottom += ob_rr_theme->handle_height +
                 self->bwidth;
             XMapWindow(ob_display, self->handle);
 
+            if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+                XMoveWindow(ob_display, self->lgrip,
+                            -self->bwidth, -self->bwidth);
+                XMoveWindow(ob_display, self->rgrip,
+                            -self->bwidth + self->width -
+                            ob_rr_theme->grip_width, -self->bwidth);
+                XMapWindow(ob_display, self->lgrip);
+                XMapWindow(ob_display, self->rgrip);
+            } else {
+                XUnmapWindow(ob_display, self->lgrip);
+                XUnmapWindow(ob_display, self->rgrip);
+            }
+
             /* XXX make a subwindow with these dimentions?
                ob_rr_theme->grip_width + self->bwidth, 0,
                self->width - (ob_rr_theme->grip_width + self->bwidth) * 2,
@@ -433,28 +433,24 @@ static void layout_title(ObFrame *self)
     for (lc = ob_rr_theme->title_layout; *lc != '\0'; ++lc) {
        switch (*lc) {
        case 'N':
-           if (!(self->decorations & Decor_Icon)) break;
             if (n) { *lc = ' '; break; } /* rm duplicates */
            n = TRUE;
            self->label_width -= (ob_rr_theme->button_size + 2 +
                                   ob_rr_theme->bevel + 1);
            break;
        case 'D':
-           if (!(self->decorations & Decor_AllDesktops)) break;
             if (d) { *lc = ' '; break; } /* rm duplicates */
            d = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->bevel + 1);
            break;
        case 'S':
-           if (!(self->decorations & Decor_Shade)) break;
             if (s) { *lc = ' '; break; } /* rm duplicates */
            s = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->bevel + 1);
            break;
        case 'I':
-           if (!(self->decorations & Decor_Iconify)) break;
             if (i) { *lc = ' '; break; } /* rm duplicates */
            i = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
@@ -465,14 +461,12 @@ static void layout_title(ObFrame *self)
            l = TRUE;
            break;
        case 'M':
-           if (!(self->decorations & Decor_Maximize)) break;
             if (m) { *lc = ' '; break; } /* rm duplicates */
            m = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
                                   ob_rr_theme->bevel + 1);
            break;
        case 'C':
-           if (!(self->decorations & Decor_Close)) break;
             if (c) { *lc = ' '; break; } /* rm duplicates */
            c = TRUE;
            self->label_width -= (ob_rr_theme->button_size +
index 4f117fa..0295a6b 100644 (file)
@@ -26,6 +26,22 @@ typedef enum {
     OB_FRAME_NUM_CONTEXTS
 } ObFrameContext;
 
+/*! The decorations the client window wants to be displayed on it */
+typedef enum {
+    OB_FRAME_DECOR_TITLEBAR    = 1 << 0, /*!< Display a titlebar */
+    OB_FRAME_DECOR_HANDLE      = 1 << 1, /*!< Display a handle (bottom) */
+    OB_FRAME_DECOR_GRIPS       = 1 << 2, /*!< Display grips in the handle */
+    OB_FRAME_DECOR_BORDER      = 1 << 3, /*!< Display a border */
+    OB_FRAME_DECOR_ICON        = 1 << 4, /*!< Display the window's icon */
+    OB_FRAME_DECOR_ICONIFY     = 1 << 5, /*!< Display an iconify button */
+    OB_FRAME_DECOR_MAXIMIZE    = 1 << 6, /*!< Display a maximize button */
+    /*! Display a button to toggle the window's placement on
+      all desktops */
+    OB_FRAME_DECOR_ALLDESKTOPS = 1 << 7,
+    OB_FRAME_DECOR_SHADE       = 1 << 8, /*!< Displays a shade button */
+    OB_FRAME_DECOR_CLOSE       = 1 << 9  /*!< Display a close button */
+} ObFrameDecorations;
+
 struct _ObFrame
 {
     struct _ObClient *client;
@@ -83,9 +99,6 @@ struct _ObFrame
     gboolean  focused;
 };
 
-void frame_startup();
-void frame_shutdown();
-
 ObFrame *frame_new();
 void frame_show(ObFrame *self);
 void frame_hide(ObFrame *self);
index b73077c..5f2f259 100644 (file)
@@ -22,61 +22,81 @@ void framerender_frame(ObFrame *self)
         XSetWindowBorder(ob_display, self->plate,
                          RrColorPixel(ob_rr_theme->cb_unfocused_color));
 
-    if (self->client->decorations & Decor_Titlebar) {
+    if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
         RrAppearance *t, *l, *m, *n, *i, *d, *s, *c;
 
         t = (self->focused ?
              self->a_focused_title : self->a_unfocused_title);
         l = (self->focused ?
              self->a_focused_label : self->a_unfocused_label);
-        m = (self->focused ?
-             (self->client->max_vert || self->client->max_horz ?
-              ob_rr_theme->a_focused_pressed_set_max :
-              (self->max_press ?
-               ob_rr_theme->a_focused_pressed_max :
-               ob_rr_theme->a_focused_unpressed_max)) :
-             (self->client->max_vert || self->client->max_horz ?
-              ob_rr_theme->a_unfocused_pressed_set_max :
-              (self->max_press ?
-               ob_rr_theme->a_unfocused_pressed_max :
-               ob_rr_theme->a_unfocused_unpressed_max)));
+        m = (!(self->decorations & OB_FRAME_DECOR_MAXIMIZE) ?
+             (self->focused ?
+              ob_rr_theme->a_disabled_focused_max :
+              ob_rr_theme->a_disabled_unfocused_max) :
+             (self->focused ?
+              (self->client->max_vert || self->client->max_horz ?
+               ob_rr_theme->a_focused_pressed_set_max :
+               (self->max_press ?
+                ob_rr_theme->a_focused_pressed_max :
+                ob_rr_theme->a_focused_unpressed_max)) :
+              (self->client->max_vert || self->client->max_horz ?
+               ob_rr_theme->a_unfocused_pressed_set_max :
+               (self->max_press ?
+                ob_rr_theme->a_unfocused_pressed_max :
+                ob_rr_theme->a_unfocused_unpressed_max))));
         n = self->a_icon;
-        i = (self->focused ?
-             (self->iconify_press ?
-              ob_rr_theme->a_focused_pressed_iconify :
-              ob_rr_theme->a_focused_unpressed_iconify) :
-             (self->iconify_press ?
-              ob_rr_theme->a_unfocused_pressed_iconify :
-              ob_rr_theme->a_unfocused_unpressed_iconify));
-        d = (self->focused ?
-             (self->client->desktop == DESKTOP_ALL ?
-              ob_rr_theme->a_focused_pressed_set_desk :
-              (self->desk_press ?
-               ob_rr_theme->a_focused_pressed_desk :
-               ob_rr_theme->a_focused_unpressed_desk)) :
-             (self->client->desktop == DESKTOP_ALL ?
-              ob_rr_theme->a_unfocused_pressed_set_desk :
-              (self->desk_press ?
-               ob_rr_theme->a_unfocused_pressed_desk :
-               ob_rr_theme->a_unfocused_unpressed_desk)));
-        s = (self->focused ?
-             (self->client->shaded ?
-              ob_rr_theme->a_focused_pressed_set_shade :
-              (self->shade_press ?
-               ob_rr_theme->a_focused_pressed_shade :
-               ob_rr_theme->a_focused_unpressed_shade)) :
-             (self->client->shaded ?
-              ob_rr_theme->a_unfocused_pressed_set_shade :
-              (self->shade_press ?
-               ob_rr_theme->a_unfocused_pressed_shade :
-               ob_rr_theme->a_unfocused_unpressed_shade)));
-        c = (self->focused ?
-             (self->close_press ?
-              ob_rr_theme->a_focused_pressed_close :
-              ob_rr_theme->a_focused_unpressed_close) :
-             (self->close_press ?
-              ob_rr_theme->a_unfocused_pressed_close :
-              ob_rr_theme->a_unfocused_unpressed_close));
+        i = (!(self->decorations & OB_FRAME_DECOR_ICONIFY) ?
+             (self->focused ?
+              ob_rr_theme->a_disabled_focused_iconify :
+              ob_rr_theme->a_disabled_unfocused_iconify) :
+             (self->focused ?
+              (self->iconify_press ?
+               ob_rr_theme->a_focused_pressed_iconify :
+               ob_rr_theme->a_focused_unpressed_iconify) :
+              (self->iconify_press ?
+               ob_rr_theme->a_unfocused_pressed_iconify :
+               ob_rr_theme->a_unfocused_unpressed_iconify)));
+        d = (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) ?
+             (self->focused ?
+              ob_rr_theme->a_disabled_focused_desk :
+              ob_rr_theme->a_disabled_unfocused_desk) :
+             (self->focused ?
+              (self->client->desktop == DESKTOP_ALL ?
+               ob_rr_theme->a_focused_pressed_set_desk :
+               (self->desk_press ?
+                ob_rr_theme->a_focused_pressed_desk :
+                ob_rr_theme->a_focused_unpressed_desk)) :
+              (self->client->desktop == DESKTOP_ALL ?
+               ob_rr_theme->a_unfocused_pressed_set_desk :
+               (self->desk_press ?
+                ob_rr_theme->a_unfocused_pressed_desk :
+                ob_rr_theme->a_unfocused_unpressed_desk))));
+        s = (!(self->decorations & OB_FRAME_DECOR_SHADE) ?
+             (self->focused ?
+              ob_rr_theme->a_disabled_focused_shade :
+              ob_rr_theme->a_disabled_unfocused_shade) :
+             (self->focused ?
+              (self->client->shaded ?
+               ob_rr_theme->a_focused_pressed_set_shade :
+               (self->shade_press ?
+                ob_rr_theme->a_focused_pressed_shade :
+                ob_rr_theme->a_focused_unpressed_shade)) :
+              (self->client->shaded ?
+               ob_rr_theme->a_unfocused_pressed_set_shade :
+               (self->shade_press ?
+                ob_rr_theme->a_unfocused_pressed_shade :
+                ob_rr_theme->a_unfocused_unpressed_shade))));
+        c = (!(self->decorations & OB_FRAME_DECOR_CLOSE) ?
+             (self->focused ?
+              ob_rr_theme->a_disabled_focused_close :
+              ob_rr_theme->a_disabled_unfocused_close) :
+             (self->focused ?
+              (self->close_press ?
+               ob_rr_theme->a_focused_pressed_close :
+               ob_rr_theme->a_focused_unpressed_close) :
+              (self->close_press ?
+               ob_rr_theme->a_unfocused_pressed_close :
+               ob_rr_theme->a_unfocused_unpressed_close)));
 
         RrPaint(t, self->title, self->width, ob_rr_theme->title_height);
 
@@ -118,7 +138,7 @@ void framerender_frame(ObFrame *self)
         framerender_close(self, c);
     }
 
-    if (self->client->decorations & Decor_Handle) {
+    if (self->decorations & OB_FRAME_DECOR_HANDLE) {
         RrAppearance *h, *g;
 
         h = (self->focused ?
@@ -126,23 +146,25 @@ void framerender_frame(ObFrame *self)
 
         RrPaint(h, self->handle, self->width, ob_rr_theme->handle_height);
 
-        g = (self->focused ?
-             ob_rr_theme->a_focused_grip : ob_rr_theme->a_unfocused_grip);
+        if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+            g = (self->focused ?
+                 ob_rr_theme->a_focused_grip : ob_rr_theme->a_unfocused_grip);
 
-        if (g->surface.grad == RR_SURFACE_PARENTREL)
-            g->surface.parent = h;
+            if (g->surface.grad == RR_SURFACE_PARENTREL)
+                g->surface.parent = h;
 
-        g->surface.parentx = 0;
-        g->surface.parenty = 0;
+            g->surface.parentx = 0;
+            g->surface.parenty = 0;
 
-        RrPaint(g, self->lgrip,
-                ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+            RrPaint(g, self->lgrip,
+                    ob_rr_theme->grip_width, ob_rr_theme->handle_height);
 
-        g->surface.parentx = self->width - ob_rr_theme->grip_width;
-        g->surface.parenty = 0;
+            g->surface.parentx = self->width - ob_rr_theme->grip_width;
+            g->surface.parenty = 0;
 
-        RrPaint(g, self->rgrip,
-                ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+            RrPaint(g, self->rgrip,
+                    ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+        }
     }
 }
 
index 73b9615..4c36022 100644 (file)
@@ -243,7 +243,6 @@ int main(int argc, char **argv)
         if (ob_rr_theme == NULL)
             exit_with_error("Unable to load a theme.");
 
-        frame_startup();
         moveresize_startup();
        screen_startup();
         group_startup();
@@ -271,7 +270,6 @@ int main(int argc, char **argv)
        screen_shutdown();
        focus_shutdown();
         moveresize_shutdown();
-        frame_shutdown();
         menu_shutdown();
         window_shutdown();
         grab_shutdown();
index e41860e..877d2f1 100644 (file)
@@ -31,44 +31,14 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
 
     theme->inst = inst;
 
-    theme->b_color = theme->cb_unfocused_color = theme->cb_focused_color = 
-        theme->title_unfocused_color = theme->title_focused_color = 
-        theme->titlebut_unfocused_color = theme->titlebut_focused_color = 
-        theme->menu_color = theme->menu_title_color =
-        theme->menu_disabled_color = theme->menu_hilite_color = NULL;
-    theme->winfont = theme->mtitlefont = theme->mfont = NULL;
-    theme->title_layout = NULL;
-    theme->max_set_mask = theme->max_unset_mask = NULL;
-    theme->desk_set_mask = theme->desk_unset_mask = NULL;
-    theme->shade_set_mask = theme->shade_unset_mask = NULL;
-    theme->iconify_mask = theme->close_mask = NULL;
-
+    theme->a_disabled_focused_max = RrAppearanceNew(inst, 1);
+    theme->a_disabled_unfocused_max = RrAppearanceNew(inst, 1);
     theme->a_focused_unpressed_max = RrAppearanceNew(inst, 1);
     theme->a_focused_pressed_max = RrAppearanceNew(inst, 1);
     theme->a_focused_pressed_set_max = RrAppearanceNew(inst, 1);
     theme->a_unfocused_unpressed_max = RrAppearanceNew(inst, 1);
     theme->a_unfocused_pressed_max = RrAppearanceNew(inst, 1);
     theme->a_unfocused_pressed_set_max = RrAppearanceNew(inst, 1);
-    theme->a_focused_unpressed_close = NULL;
-    theme->a_focused_pressed_close = NULL;
-    theme->a_unfocused_unpressed_close = NULL;
-    theme->a_unfocused_pressed_close = NULL;
-    theme->a_focused_unpressed_desk = NULL;
-    theme->a_focused_pressed_desk = NULL;
-    theme->a_focused_pressed_set_desk = NULL;
-    theme->a_unfocused_unpressed_desk = NULL;
-    theme->a_unfocused_pressed_desk = NULL;
-    theme->a_unfocused_pressed_set_desk = NULL;
-    theme->a_focused_unpressed_shade = NULL;
-    theme->a_focused_pressed_shade = NULL;
-    theme->a_focused_pressed_set_shade = NULL;
-    theme->a_unfocused_unpressed_shade = NULL;
-    theme->a_unfocused_pressed_shade = NULL;
-    theme->a_unfocused_pressed_set_shade = NULL;
-    theme->a_focused_unpressed_iconify = NULL;
-    theme->a_focused_pressed_iconify = NULL;
-    theme->a_unfocused_unpressed_iconify = NULL;
-    theme->a_unfocused_pressed_iconify = NULL;
     theme->a_focused_grip = RrAppearanceNew(inst, 0);
     theme->a_unfocused_grip = RrAppearanceNew(inst, 0);
     theme->a_focused_title = RrAppearanceNew(inst, 0);
@@ -195,6 +165,15 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
                     &theme->title_unfocused_color))
        theme->title_unfocused_color = RrColorNew(inst, 0xff, 0xff, 0xff);
     if (!read_color(db, inst,
+                    "window.button.disabled.focus.picColor",
+                    &theme->titlebut_disabled_focused_color))
+       theme->titlebut_disabled_focused_color =
+            RrColorNew(inst, 0xff, 0xff, 0xff);
+    if (!read_color(db, inst,
+                    "window.button.disabled.unfocus.picColor",
+                    &theme->titlebut_disabled_unfocused_color))
+       theme->titlebut_disabled_unfocused_color = RrColorNew(inst, 0, 0, 0);
+    if (!read_color(db, inst,
                     "window.button.focus.picColor",
                     &theme->titlebut_focused_color))
        theme->titlebut_focused_color = RrColorNew(inst, 0, 0, 0);
@@ -323,6 +302,14 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
 
     /* read buttons textures */
     if (!read_appearance(db, inst,
+                         "window.button.disabled.focus",
+                        theme->a_disabled_focused_max))
+        set_default_appearance(theme->a_disabled_focused_max);
+    if (!read_appearance(db, inst,
+                         "window.button.disabled.unfocus",
+                        theme->a_disabled_unfocused_max))
+        set_default_appearance(theme->a_disabled_unfocused_max);
+    if (!read_appearance(db, inst,
                          "window.button.pressed.focus",
                         theme->a_focused_pressed_max))
        if (!read_appearance(db, inst,
@@ -345,6 +332,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
                         theme->a_unfocused_unpressed_max))
        set_default_appearance(theme->a_unfocused_unpressed_max);
 
+    theme->a_disabled_focused_close =
+        RrAppearanceCopy(theme->a_disabled_focused_max);
+    theme->a_disabled_unfocused_close =
+        RrAppearanceCopy(theme->a_disabled_unfocused_max);
     theme->a_unfocused_unpressed_close =
         RrAppearanceCopy(theme->a_unfocused_unpressed_max);
     theme->a_unfocused_pressed_close =
@@ -353,6 +344,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         RrAppearanceCopy(theme->a_focused_unpressed_max);
     theme->a_focused_pressed_close =
         RrAppearanceCopy(theme->a_focused_pressed_max);
+    theme->a_disabled_focused_desk =
+        RrAppearanceCopy(theme->a_disabled_focused_max);
+    theme->a_disabled_unfocused_desk =
+        RrAppearanceCopy(theme->a_disabled_unfocused_max);
     theme->a_unfocused_unpressed_desk =
         RrAppearanceCopy(theme->a_unfocused_unpressed_max);
     theme->a_unfocused_pressed_desk =
@@ -365,6 +360,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         RrAppearanceCopy(theme->a_focused_pressed_max);
     theme->a_focused_pressed_set_desk =
         RrAppearanceCopy(theme->a_focused_pressed_max);
+    theme->a_disabled_focused_shade =
+        RrAppearanceCopy(theme->a_disabled_focused_max);
+    theme->a_disabled_unfocused_shade =
+        RrAppearanceCopy(theme->a_disabled_unfocused_max);
     theme->a_unfocused_unpressed_shade =
         RrAppearanceCopy(theme->a_unfocused_unpressed_max);
     theme->a_unfocused_pressed_shade =
@@ -377,6 +376,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         RrAppearanceCopy(theme->a_focused_pressed_max);
     theme->a_focused_pressed_set_shade =
         RrAppearanceCopy(theme->a_focused_pressed_max);
+    theme->a_disabled_focused_iconify =
+        RrAppearanceCopy(theme->a_disabled_focused_max);
+    theme->a_disabled_unfocused_iconify =
+        RrAppearanceCopy(theme->a_disabled_focused_max);
     theme->a_unfocused_unpressed_iconify =
         RrAppearanceCopy(theme->a_unfocused_unpressed_max);
     theme->a_unfocused_pressed_iconify =
@@ -437,33 +440,45 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
     theme->a_menu_hilite->texture[0].data.text.color =
         theme->menu_hilite_color;
 
-    theme->a_focused_unpressed_max->texture[0].type = 
+    theme->a_disabled_focused_max->texture[0].type = 
+        theme->a_disabled_unfocused_max->texture[0].type = 
+        theme->a_focused_unpressed_max->texture[0].type = 
         theme->a_focused_pressed_max->texture[0].type = 
         theme->a_focused_pressed_set_max->texture[0].type =  
         theme->a_unfocused_unpressed_max->texture[0].type = 
         theme->a_unfocused_pressed_max->texture[0].type = 
         theme->a_unfocused_pressed_set_max->texture[0].type = 
+        theme->a_disabled_focused_close->texture[0].type = 
+        theme->a_disabled_unfocused_close->texture[0].type = 
         theme->a_focused_unpressed_close->texture[0].type = 
         theme->a_focused_pressed_close->texture[0].type = 
         theme->a_unfocused_unpressed_close->texture[0].type = 
         theme->a_unfocused_pressed_close->texture[0].type = 
+        theme->a_disabled_focused_desk->texture[0].type = 
+        theme->a_disabled_unfocused_desk->texture[0].type = 
         theme->a_focused_unpressed_desk->texture[0].type = 
         theme->a_focused_pressed_desk->texture[0].type = 
         theme->a_focused_pressed_set_desk->texture[0].type = 
         theme->a_unfocused_unpressed_desk->texture[0].type = 
         theme->a_unfocused_pressed_desk->texture[0].type = 
         theme->a_unfocused_pressed_set_desk->texture[0].type = 
+        theme->a_disabled_focused_shade->texture[0].type = 
+        theme->a_disabled_unfocused_shade->texture[0].type = 
         theme->a_focused_unpressed_shade->texture[0].type = 
         theme->a_focused_pressed_shade->texture[0].type = 
         theme->a_focused_pressed_set_shade->texture[0].type = 
         theme->a_unfocused_unpressed_shade->texture[0].type = 
         theme->a_unfocused_pressed_shade->texture[0].type = 
         theme->a_unfocused_pressed_set_shade->texture[0].type = 
+        theme->a_disabled_focused_iconify->texture[0].type = 
+        theme->a_disabled_unfocused_iconify->texture[0].type = 
         theme->a_focused_unpressed_iconify->texture[0].type = 
         theme->a_focused_pressed_iconify->texture[0].type = 
         theme->a_unfocused_unpressed_iconify->texture[0].type = 
         theme->a_unfocused_pressed_iconify->texture[0].type = RR_TEXTURE_MASK;
-    theme->a_focused_unpressed_max->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_max->texture[0].data.mask.mask = 
+        theme->a_disabled_unfocused_max->texture[0].data.mask.mask = 
+        theme->a_focused_unpressed_max->texture[0].data.mask.mask = 
         theme->a_unfocused_unpressed_max->texture[0].data.mask.mask = 
         theme->a_focused_pressed_max->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_max->texture[0].data.mask.mask =
@@ -471,12 +486,16 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
     theme->a_focused_pressed_set_max->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_set_max->texture[0].data.mask.mask =
         theme->max_set_mask;
-    theme->a_focused_pressed_close->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_close->texture[0].data.mask.mask = 
+        theme->a_disabled_unfocused_close->texture[0].data.mask.mask = 
+        theme->a_focused_pressed_close->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_close->texture[0].data.mask.mask =
         theme->a_focused_unpressed_close->texture[0].data.mask.mask = 
         theme->a_unfocused_unpressed_close->texture[0].data.mask.mask =
         theme->close_mask;
-    theme->a_focused_unpressed_desk->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_desk->texture[0].data.mask.mask = 
+        theme->a_disabled_unfocused_desk->texture[0].data.mask.mask = 
+        theme->a_focused_unpressed_desk->texture[0].data.mask.mask = 
         theme->a_unfocused_unpressed_desk->texture[0].data.mask.mask = 
         theme->a_focused_pressed_desk->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_desk->texture[0].data.mask.mask =
@@ -484,7 +503,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
     theme->a_focused_pressed_set_desk->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_set_desk->texture[0].data.mask.mask =
         theme->desk_set_mask;
-    theme->a_focused_unpressed_shade->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_shade->texture[0].data.mask.mask = 
+        theme->a_disabled_unfocused_shade->texture[0].data.mask.mask = 
+        theme->a_focused_unpressed_shade->texture[0].data.mask.mask = 
         theme->a_unfocused_unpressed_shade->texture[0].data.mask.mask = 
         theme->a_focused_pressed_shade->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_shade->texture[0].data.mask.mask =
@@ -492,11 +513,25 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
     theme->a_focused_pressed_set_shade->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_set_shade->texture[0].data.mask.mask =
         theme->shade_set_mask;
-    theme->a_focused_unpressed_iconify->texture[0].data.mask.mask = 
+    theme->a_disabled_focused_iconify->texture[0].data.mask.mask = 
+        theme->a_disabled_unfocused_iconify->texture[0].data.mask.mask = 
+        theme->a_focused_unpressed_iconify->texture[0].data.mask.mask = 
         theme->a_unfocused_unpressed_iconify->texture[0].data.mask.mask = 
         theme->a_focused_pressed_iconify->texture[0].data.mask.mask = 
         theme->a_unfocused_pressed_iconify->texture[0].data.mask.mask =
         theme->iconify_mask;
+    theme->a_disabled_focused_max->texture[0].data.mask.color = 
+        theme->a_disabled_focused_close->texture[0].data.mask.color = 
+        theme->a_disabled_focused_desk->texture[0].data.mask.color = 
+        theme->a_disabled_focused_shade->texture[0].data.mask.color = 
+        theme->a_disabled_focused_iconify->texture[0].data.mask.color = 
+        theme->titlebut_disabled_focused_color;
+    theme->a_disabled_unfocused_max->texture[0].data.mask.color = 
+        theme->a_disabled_unfocused_close->texture[0].data.mask.color = 
+        theme->a_disabled_unfocused_desk->texture[0].data.mask.color = 
+        theme->a_disabled_unfocused_shade->texture[0].data.mask.color = 
+        theme->a_disabled_unfocused_iconify->texture[0].data.mask.color = 
+        theme->titlebut_disabled_unfocused_color;
     theme->a_focused_unpressed_max->texture[0].data.mask.color = 
         theme->a_focused_pressed_max->texture[0].data.mask.color = 
         theme->a_focused_pressed_set_max->texture[0].data.mask.color = 
index 518c7e7..acf17c3 100644 (file)
@@ -27,6 +27,8 @@ struct _RrTheme {
     RrColor *cb_unfocused_color;
     RrColor *title_focused_color;
     RrColor *title_unfocused_color;
+    RrColor *titlebut_disabled_focused_color;
+    RrColor *titlebut_disabled_unfocused_color;
     RrColor *titlebut_focused_color;
     RrColor *titlebut_unfocused_color;
     RrColor *menu_title_color;
@@ -56,28 +58,38 @@ struct _RrTheme {
     RrPixmapMask *close_mask;
 
     /* global appearances */
+    RrAppearance *a_disabled_focused_max;
+    RrAppearance *a_disabled_unfocused_max;
     RrAppearance *a_focused_unpressed_max;
     RrAppearance *a_focused_pressed_max;
     RrAppearance *a_focused_pressed_set_max;
     RrAppearance *a_unfocused_unpressed_max;
     RrAppearance *a_unfocused_pressed_max;
     RrAppearance *a_unfocused_pressed_set_max;
+    RrAppearance *a_disabled_focused_close;
+    RrAppearance *a_disabled_unfocused_close;
     RrAppearance *a_focused_unpressed_close;
     RrAppearance *a_focused_pressed_close;
     RrAppearance *a_unfocused_unpressed_close;
     RrAppearance *a_unfocused_pressed_close;
+    RrAppearance *a_disabled_focused_desk;
+    RrAppearance *a_disabled_unfocused_desk;
     RrAppearance *a_focused_unpressed_desk;
     RrAppearance *a_focused_pressed_desk;
     RrAppearance *a_focused_pressed_set_desk;
     RrAppearance *a_unfocused_unpressed_desk;
     RrAppearance *a_unfocused_pressed_desk;
     RrAppearance *a_unfocused_pressed_set_desk;
+    RrAppearance *a_disabled_focused_shade;
+    RrAppearance *a_disabled_unfocused_shade;
     RrAppearance *a_focused_unpressed_shade;
     RrAppearance *a_focused_pressed_shade;
     RrAppearance *a_focused_pressed_set_shade;
     RrAppearance *a_unfocused_unpressed_shade;
     RrAppearance *a_unfocused_pressed_shade;
     RrAppearance *a_unfocused_pressed_set_shade;
+    RrAppearance *a_disabled_focused_iconify;
+    RrAppearance *a_disabled_unfocused_iconify;
     RrAppearance *a_focused_unpressed_iconify;
     RrAppearance *a_focused_pressed_iconify;
     RrAppearance *a_unfocused_unpressed_iconify;
index 9b5fa86..4a422f1 100644 (file)
@@ -7,3 +7,4 @@ modal3
 urgent
 icons
 override
+noresize
diff --git a/tests/noresize.c b/tests/noresize.c
new file mode 100644 (file)
index 0000000..dd33fd4
--- /dev/null
@@ -0,0 +1,61 @@
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+int main () {
+  XSetWindowAttributes xswa;
+  unsigned long        xswamask;
+  Display   *display;
+  Window     win;
+  XEvent     report;
+  int        x=10,y=10,h=100,w=400;
+  XSizeHints size;
+
+  display = XOpenDisplay(NULL);
+
+  if (display == NULL) {
+    fprintf(stderr, "couldn't connect to X server :0\n");
+    return 0;
+  }
+
+  xswa.win_gravity = StaticGravity;
+  xswamask = CWWinGravity;
+
+  win = XCreateWindow(display, RootWindow(display, 0),
+                     x, y, w, h, 10, CopyFromParent, CopyFromParent,
+                     CopyFromParent, xswamask, &xswa);
+
+  XSetWindowBackground(display,win,WhitePixel(display,0)); 
+
+  size.flags = PMinSize | PMaxSize;
+  size.max_width = 0;
+  size.min_width = w;
+  size.max_height = 0;
+  size.min_height = h;
+  XSetWMNormalHints(display, win, &size);
+  
+  XMapWindow(display, win);
+  XFlush(display);
+
+  XSelectInput(display, win, ExposureMask | StructureNotifyMask);
+
+  while (1) {
+    XNextEvent(display, &report);
+
+    switch (report.type) {
+    case Expose:
+      printf("exposed\n");
+      break;
+    case ConfigureNotify:
+      x = report.xconfigure.x;
+      y = report.xconfigure.y;
+      w = report.xconfigure.width;
+      h = report.xconfigure.height;
+      printf("confignotify %i,%i-%ix%i\n",x,y,w,h);
+      break;
+    }
+
+  }
+
+  return 1;
+}