This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  e819818eeb82ee93cb5d06b3d554d4fd16bae54c (commit)
      from  99aad55425339efc4b3598b42192a9f8d6c631a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/e819818eeb82ee93cb5d06b3d554d4fd16bae54c

commit e819818eeb82ee93cb5d06b3d554d4fd16bae54c
Author: Alexey I. Froloff <[email protected]>
Date:   Mon Feb 27 14:13:07 2012 +0000

    Options for limiting window/menu title height
    
    (Window|Menu)Title(Min|Max)Height defaults options allow to set
    minimum and maximum titlebar height.
    
    For example, to force all titlebars to 24 pixels execute
    following commands:
    
    $ wdwrite WindowMaker WindowTitleMinHeight 24
    $ wdwrite WindowMaker WindowTitleMaxHeight 24
    $ wdwrite WindowMaker MenuTitleMinHeight 24
    $ wdwrite WindowMaker MenuTitleMaxHeight 24
    
    Signed-off-by: Alexey I. Froloff <[email protected]>

diff --git a/NEWS b/NEWS
index c6bf3e6..e9a6f7a 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,22 @@
 NEWS for veteran Window Maker users
 -----------------------------------
 
---- 0.94.0-crm
+--- 0.95.X
+
+Options to limit the window/menu title height
+---------------------------------------------
+
+You can now set the minimum and maximum titlebar heights.
+For example, to force all titlebars to 24 pixels execute
+the following commands:
+
+$ wdwrite WindowMaker WindowTitleMinHeight 24
+$ wdwrite WindowMaker WindowTitleMaxHeight 24
+$ wdwrite WindowMaker MenuTitleMinHeight 24
+$ wdwrite WindowMaker MenuTitleMaxHeight 24
+
+
+--- 0.95.2
 
 New Resizing functionality
 --------------------------
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 9153496..e10b5ab 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -338,7 +338,11 @@ typedef struct WPreferences {
     char open_transients_with_parent;  /* open transient window in same 
workspace as parent */
     signed char title_justification;   /* titlebar text alignment */
     int window_title_clearance;
+    int window_title_min_height;
+    int window_title_max_height;
     int menu_title_clearance;
+    int menu_title_min_height;
+    int menu_title_max_height;
     int menu_text_clearance;
     char multi_byte_text;
 #ifdef KEEP_XKB_LOCK_STATUS
diff --git a/src/defaults.c b/src/defaults.c
index cb3501b..5b5269b 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -329,6 +329,9 @@ WDefaultEntry staticOptionList[] = {
            &wPreferences.disable_miniwindows, getBool, NULL, NULL, NULL}
 };
 
+#define NUM2STRING_(x) #x
+#define NUM2STRING(x) NUM2STRING_(x)
+
 WDefaultEntry optionList[] = {
 
        /* dynamic options */
@@ -469,8 +472,16 @@ WDefaultEntry optionList[] = {
            NULL, getFont, setWinTitleFont, NULL, NULL},
        {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE, NULL,
            &wPreferences.window_title_clearance, getInt, setClearance, NULL, 
NULL},
+       {"WindowTitleMinHeight", "0", NULL,
+           &wPreferences.window_title_min_height, getInt, setClearance, NULL, 
NULL},
+       {"WindowTitleMaxHeight", NUM2STRING(INT_MAX), NULL,
+           &wPreferences.window_title_max_height, getInt, setClearance, NULL, 
NULL},
        {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE, NULL,
            &wPreferences.menu_title_clearance, getInt, setClearance, NULL, 
NULL},
+       {"MenuTitleMinHeight", "0", NULL,
+           &wPreferences.menu_title_min_height, getInt, setClearance, NULL, 
NULL},
+       {"MenuTitleMaxHeight", NUM2STRING(INT_MAX), NULL,
+           &wPreferences.menu_title_max_height, getInt, setClearance, NULL, 
NULL},
        {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE, NULL,
            &wPreferences.menu_text_clearance, getInt, setClearance, NULL, 
NULL},
        {"MenuTitleFont", DEF_MENU_TITLE_FONT, NULL,
diff --git a/src/framewin.c b/src/framewin.c
index f47d24e..73f68b2 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -59,7 +59,8 @@ static void paintButton(WCoreWindow * button, WTexture * 
texture,
 static void updateTitlebar(WFrameWindow * fwin);
 
 WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel, int x, int y,
-                                int width, int height, int *clearance, int 
flags,
+                                int width, int height, int *clearance,
+                                int *title_min, int *title_max, int flags,
                                 WTexture ** title_texture, WTexture ** 
resize_texture,
                                 WMColor ** color, WMFont ** font)
 {
@@ -76,6 +77,8 @@ WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel, 
int x, int y,
        fwin->resizebar_texture = resize_texture;
        fwin->title_color = color;
        fwin->title_clearance = clearance;
+       fwin->title_min_height = title_min;
+       fwin->title_max_height = title_max;
        fwin->font = font;
 #ifdef KEEP_XKB_LOCK_STATUS
        fwin->languagemode = XkbGroup1Index;
@@ -121,9 +124,15 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
        else
                height = fwin->core->height - fwin->top_width - 
fwin->bottom_width;
 
-       if (flags & WFF_TITLEBAR)
+       if (flags & WFF_TITLEBAR) {
                theight = WMFontHeight(*fwin->font) + (*fwin->title_clearance + 
TITLEBAR_EXTEND_SPACE) * 2;
-       else
+
+               if (theight > *fwin->title_max_height)
+                       theight = *fwin->title_max_height;
+
+               if (theight < *fwin->title_min_height)
+                       theight = *fwin->title_min_height;
+       } else
                theight = 0;
 
        if (wPreferences.new_style == TS_NEW) {
@@ -462,6 +471,12 @@ static void updateTitlebar(WFrameWindow * fwin)
 
        theight = WMFontHeight(*fwin->font) + (*fwin->title_clearance + 
TITLEBAR_EXTEND_SPACE) * 2;
 
+       if (theight > *fwin->title_max_height)
+               theight = *fwin->title_max_height;
+
+       if (theight < *fwin->title_min_height)
+               theight = *fwin->title_min_height;
+
        x = 0;
        w = fwin->core->width + 1;
 
@@ -1018,6 +1033,12 @@ void wFrameWindowPaint(WFrameWindow * fwin)
                        y = *fwin->title_clearance + TITLEBAR_EXTEND_SPACE;
                        h = WMFontHeight(*fwin->font);
 
+                       if (y*2 + h > *fwin->title_max_height)
+                               y = (*fwin->title_max_height - h) / 2;
+
+                       if (y*2 + h < *fwin->title_min_height)
+                               y = (*fwin->title_min_height - h) / 2;
+
                        /* We use a w+2 buffer to have an extra pixel on the 
left and
                         * another one on the right. This is because for some 
odd reason,
                         * sometimes when using AA fonts (when libfreetype2 is 
compiled
diff --git a/src/framewin.h b/src/framewin.h
index f01e267..24b438c 100644
--- a/src/framewin.h
+++ b/src/framewin.h
@@ -60,6 +60,8 @@ typedef struct WFrameWindow {
 
     short top_width;
     int *title_clearance;
+    int *title_min_height;
+    int *title_max_height;
     short bottom_width;
 
     short resizebar_corner_width;
@@ -150,7 +152,8 @@ typedef struct WFrameWindow {
 
 WFrameWindow*
 wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
-                   int width, int height, int *clearance, int flags,
+                   int width, int height, int *clearance,
+                   int *title_min, int *title_max, int flags,
                    union WTexture **title_texture,
                    union WTexture **resize_texture,
                    WMColor **color, WMFont **font);
diff --git a/src/menu.c b/src/menu.c
index 449904f..2d26ee7 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -160,7 +160,10 @@ WMenu *wMenuCreate(WScreen * screen, char *title, int 
main_menu)
                menu->flags.titled = 1;
        }
        menu->frame =
-           wFrameWindowCreate(screen, tmp, 8, 2, 1, 1, 
&wPreferences.menu_title_clearance, flags,
+           wFrameWindowCreate(screen, tmp, 8, 2, 1, 1, 
&wPreferences.menu_title_clearance,
+                              &wPreferences.menu_title_min_height,
+                              &wPreferences.menu_title_max_height,
+                              flags,
                               screen->menu_title_texture, NULL,
                               screen->menu_title_color, 
&screen->menu_title_font);
 
diff --git a/src/moveres.c b/src/moveres.c
index d0ac651..a232fbe 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -470,6 +470,12 @@ static void drawTransparentFrame(WWindow * wwin, int x, 
int y, int width, int he
        if (HAS_TITLEBAR(wwin) && !wwin->flags.shaded) {
                h = WMFontHeight(wwin->screen_ptr->title_font) + 
(wPreferences.window_title_clearance +
                                                                  
TITLEBAR_EXTEND_SPACE) * 2;
+
+               if (h > wPreferences.window_title_max_height)
+                       h = wPreferences.window_title_max_height;
+
+               if (h < wPreferences.window_title_min_height)
+                       h = wPreferences.window_title_min_height;
        }
        if (HAS_RESIZEBAR(wwin) && !wwin->flags.shaded) {
                /* Can't use wwin-frame->bottom_width because, in some cases
@@ -2219,6 +2225,13 @@ void InteractivePlaceWindow(WWindow * wwin, int *x_ret, 
int *y_ret, unsigned wid
        if (HAS_TITLEBAR(wwin)) {
                h = WMFontHeight(scr->title_font) + 
(wPreferences.window_title_clearance +
                                                     TITLEBAR_EXTEND_SPACE) * 2;
+
+               if (h > wPreferences.window_title_max_height)
+                       h = wPreferences.window_title_max_height;
+
+               if (h < wPreferences.window_title_min_height)
+                       h = wPreferences.window_title_min_height;
+
                height += h;
        }
        if (HAS_RESIZEBAR(wwin)) {
diff --git a/src/placement.c b/src/placement.c
index 4e19765..a3cdd23 100644
--- a/src/placement.c
+++ b/src/placement.c
@@ -484,6 +484,13 @@ void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, 
unsigned width, unsigned
        WScreen *scr = wwin->screen_ptr;
        int h = WMFontHeight(scr->title_font)
                + (wPreferences.window_title_clearance + TITLEBAR_EXTEND_SPACE) 
* 2;
+
+       if (h > wPreferences.window_title_max_height)
+               h = wPreferences.window_title_max_height;
+
+       if (h < wPreferences.window_title_min_height)
+               h = wPreferences.window_title_min_height;
+
        WArea usableArea = wGetUsableAreaForHead(scr, 
wGetHeadForPointerLocation(scr),
                                                 NULL, True);
 
diff --git a/src/window.c b/src/window.c
index 7402b7d..549da87 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1125,7 +1125,10 @@ WWindow *wManageWindow(WScreen *scr, Window window)
 
        wwin->frame = wFrameWindowCreate(scr, window_level,
                                         x, y, width, height,
-                                        &wPreferences.window_title_clearance, 
foo,
+                                        &wPreferences.window_title_clearance,
+                                        &wPreferences.window_title_min_height,
+                                        &wPreferences.window_title_max_height,
+                                        foo,
                                         scr->window_title_texture,
                                         scr->resizebar_texture, 
scr->window_title_color, &scr->title_font);
 
@@ -1428,7 +1431,10 @@ WWindow *wManageInternalWindow(WScreen *scr, Window 
window, Window owner,
        wwin->frame = wFrameWindowCreate(scr, WMFloatingLevel,
                                         wwin->frame_x, wwin->frame_y,
                                         width, height,
-                                        &wPreferences.window_title_clearance, 
foo,
+                                        &wPreferences.window_title_clearance,
+                                        &wPreferences.window_title_min_height,
+                                        &wPreferences.window_title_max_height,
+                                        foo,
                                         scr->window_title_texture,
                                         scr->resizebar_texture, 
scr->window_title_color, &scr->title_font);
 

-----------------------------------------------------------------------

Summary of changes:
 NEWS              |   17 ++++++++++++++++-
 src/WindowMaker.h |    4 ++++
 src/defaults.c    |   11 +++++++++++
 src/framewin.c    |   27 ++++++++++++++++++++++++---
 src/framewin.h    |    5 ++++-
 src/menu.c        |    5 ++++-
 src/moveres.c     |   13 +++++++++++++
 src/placement.c   |    7 +++++++
 src/window.c      |   10 ++++++++--
 9 files changed, 91 insertions(+), 8 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to [email protected].

Reply via email to