[Pkg-wmaker-commits] [wmaker] 12/24: wmaker: Implement basic menu shading.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Mar 24 20:09:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository wmaker.

commit 84727563f95ce166453bdee833539dedb3ea6b95
Author: Doug Torrance <dtorrance at piedmont.edu>
Date:   Wed Jan 20 23:19:04 2016 -0500

    wmaker: Implement basic menu shading.
    
    Menus may now be shaded like other windows by double clicking on their title
    bars.  Note that, even if animations are enabled, the shade animation seen
    with other windows does not work for menus.
    
    This fixes Debian bug #72038 [1]:
    
      From: Chris Pimlott <pimlottc at null.net>
      Subject: wmaker: Persistant menus should be shade-able
      Date: Tue, 19 Sep 2000 14:04:41 -0400
    
      One of the many little things that makes me appreciate Window
      Maker is that by clicking on the title bar of a menu, it can be made
      "persistant" so it stays on screen and doesn't dissappear after click or
      mouseout like normal.  I find it useful if I need to run a number of
      commands in a submenu, or for keeping a list of open windows on
      screen.
    
      The usefulness of this feature could be extended by allowing menus
      to be shaded (by double-clicking the title) like normal windows, thus
      collapsing them to take up less space when not needed but still be
      persistant.  Perhaps other commands of windows (like maximizing/
      minimizing, resizing) might be considered as well, although
      personally only shading stands out as particularly useful for menus.
    
    [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=72038
---
 src/menu.c | 16 ++++++++++++++++
 src/menu.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/src/menu.c b/src/menu.c
index 83eb804..cc4d737 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -182,6 +182,7 @@ WMenu *wMenuCreate(WScreen *screen, const char *title, int main_menu)
 	menu->frame->child = menu;
 
 	menu->flags.lowered = 0;
+	menu->flags.shaded = 0;
 
 	/* create borders */
 	if (title) {
@@ -1114,6 +1115,12 @@ void wMenuUnmap(WMenu * menu)
 	menu->flags.mapped = 0;
 	menu->flags.open_to_left = 0;
 
+	if (menu->flags.shaded) {
+		wFrameWindowResize(menu->frame, menu->frame->core->width, menu->frame->top_width +
+				   menu->entry_height*menu->entry_no + menu->frame->bottom_width - 1);
+		menu->flags.shaded = 0;
+	}
+
 	for (i = 0; i < menu->cascade_no; i++) {
 		if (menu->cascades[i] != NULL
 		    && menu->cascades[i]->flags.mapped && !menu->cascades[i]->flags.buttoned) {
@@ -2103,6 +2110,15 @@ static void menuTitleDoubleClick(WCoreWindow * sender, void *data, XEvent * even
 			lower = 1;
 		}
 		changeMenuLevels(menu, lower);
+	} else {
+		if (menu->flags.shaded) {
+			wFrameWindowResize(menu->frame, menu->frame->core->width, menu->frame->top_width +
+					   menu->entry_height*menu->entry_no + menu->frame->bottom_width - 1);
+			menu->flags.shaded = 0;
+		} else {
+			wFrameWindowResize(menu->frame, menu->frame->core->width, menu->frame->top_width - 1);
+			menu->flags.shaded = 1;
+		}
 	}
 }
 
diff --git a/src/menu.h b/src/menu.h
index e568a7e..547f051 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -99,6 +99,7 @@ typedef struct WMenu {
 		unsigned int jump_back_pending:1;
 
 		unsigned int inside_handler:1;
+		unsigned int shaded:1;
 	} flags;
 } WMenu;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmaker.git



More information about the Pkg-wmaker-commits mailing list