mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
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@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
This commit is contained in:
committed by
Carlos R. Mafra
parent
c7c0b43629
commit
84727563f9
16
src/menu.c
16
src/menu.c
@@ -182,6 +182,7 @@ WMenu *wMenuCreate(WScreen *screen, const char *title, int main_menu)
|
|||||||
menu->frame->child = menu;
|
menu->frame->child = menu;
|
||||||
|
|
||||||
menu->flags.lowered = 0;
|
menu->flags.lowered = 0;
|
||||||
|
menu->flags.shaded = 0;
|
||||||
|
|
||||||
/* create borders */
|
/* create borders */
|
||||||
if (title) {
|
if (title) {
|
||||||
@@ -1114,6 +1115,12 @@ void wMenuUnmap(WMenu * menu)
|
|||||||
menu->flags.mapped = 0;
|
menu->flags.mapped = 0;
|
||||||
menu->flags.open_to_left = 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++) {
|
for (i = 0; i < menu->cascade_no; i++) {
|
||||||
if (menu->cascades[i] != NULL
|
if (menu->cascades[i] != NULL
|
||||||
&& menu->cascades[i]->flags.mapped && !menu->cascades[i]->flags.buttoned) {
|
&& 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;
|
lower = 1;
|
||||||
}
|
}
|
||||||
changeMenuLevels(menu, lower);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ typedef struct WMenu {
|
|||||||
unsigned int jump_back_pending:1;
|
unsigned int jump_back_pending:1;
|
||||||
|
|
||||||
unsigned int inside_handler:1;
|
unsigned int inside_handler:1;
|
||||||
|
unsigned int shaded:1;
|
||||||
} flags;
|
} flags;
|
||||||
} WMenu;
|
} WMenu;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user