1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

Added Expert option: "Close rootmenu when mouse (left or right) is clicked outside focus.

Common WindowMaker's rootmenu behavior if press right mouse button open menu and close only with same button.
It's uncomfortably, it patch  allows close menu by left or right is clicked outside focus.
Changed func "static WMenu*configureMenu(WScreen *scr, WMPropList *definition)" to non-static forglobal use.
Added new  OPTION_WMAKER for this Expert-option. Changed event.c: for correct work should use initialization
func configureMenu afterwMenuDestroy (this is a feature of the event implementation XEvent).
This commit is contained in:
Alexander Komarov
2020-09-09 13:29:11 +03:00
committed by Carlos R. Mafra
parent 033d2d9a6f
commit 7d423a3a0f
7 changed files with 26 additions and 5 deletions

View File

@@ -116,7 +116,10 @@ static const struct {
/* default: */ True, OPTION_WMAKER, "WrapAppiconsInDock" },
{ N_("Double click on titlebar maximize a window to full screen."),
/* default: */ False, OPTION_WMAKER, "DbClickFullScreen" }
/* default: */ False, OPTION_WMAKER, "DbClickFullScreen" },
{ N_("Close rootmenu when mouse (left or right) is clicked outside focus."),
/* default: */ False, OPTION_WMAKER, "CloseRootMenuByLeftOrRightMouseClick" }
};

View File

@@ -432,11 +432,14 @@ msgstr "Прилипания окон по краям и углам."
msgid "Snapping a window to the top maximizes it to the full screen."
msgstr "Распахнуть окно при перетаскивании к верхнему краю."
#: ../../WPrefs.app/Expert.c:118
msgid "Double click on titlebar maximize a window to full screen."
msgstr "Распахнуть окно двойным щелчком."
#: ../../WPrefs.app/Expert.c:121
msgid "Close rootmenu when mouse (left or right) is clicked outside focus."
msgstr "Закрывать меню приложений правым или левым щелчком мыши вне фокуса."
#: ../../WPrefs.app/Expert.c:328
msgid "Expert User Preferences"
msgstr "Установки для опытного пользователя"

View File

@@ -454,6 +454,7 @@ extern struct WPreferences {
char cycle_active_head_only; /* Cycle only windows on the active head */
char cycle_ignore_minimized; /* Ignore minimized windows when cycling */
char double_click_fullscreen; /* Double click on titlebar maximize a window to full screen*/
char close_rootmenu_left_right_click;/* Close application menu when mouse (left or right) is clicked outside focus */
char strict_windoze_cycle; /* don't close switch panel when shift is released */
char panel_only_open; /* Only open the switch panel; don't switch */
int minipreview_size; /* Size of Mini-Previews in pixels */

View File

@@ -827,7 +827,9 @@ WDefaultEntry optionList[] = {
{"CycleIgnoreMinimized", "NO", NULL,
&wPreferences.cycle_ignore_minimized, getBool, NULL, NULL, NULL},
{"DbClickFullScreen", "NO", NULL,
&wPreferences.double_click_fullscreen, getBool, NULL, NULL, NULL}
&wPreferences.double_click_fullscreen, getBool, NULL, NULL, NULL},
{"CloseRootMenuByLeftOrRightMouseClick", "NO", NULL,
&wPreferences.close_rootmenu_left_right_click, getBool, NULL, NULL, NULL}
};
static void initDefaults(void)

View File

@@ -759,6 +759,18 @@ static void executeButtonAction(WScreen *scr, XEvent *event, int action)
case WA_SELECT_WINDOWS:
wUnselectWindows(scr);
wSelectWindows(scr, event);
if (wPreferences.close_rootmenu_left_right_click){
WMenu *menu = NULL;
WMPropList *definition;
menu = scr->root_menu;
if (scr->root_menu){
wMenuDestroy(menu,True);
scr->root_menu = NULL;
definition = w_global.domain.root_menu->dictionary;
menu = configureMenu(scr, definition);
scr->root_menu = menu;
}
}
break;
case WA_OPEN_APPMENU:
OpenRootMenu(scr, event->xbutton.x_root, event->xbutton.y_root, False);

View File

@@ -66,7 +66,6 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name);
static WMenu *readPLMenuPipe(WScreen * scr, char **file_name);
static WMenu *readMenuFile(WScreen *scr, const char *file_name);
static WMenu *readMenuDirectory(WScreen *scr, const char *title, char **file_name, const char *command);
static WMenu *configureMenu(WScreen *scr, WMPropList *definition);
static void menu_parser_register_macros(WMenuParser parser);
typedef struct Shortcut {
@@ -1467,7 +1466,7 @@ static WMenu *makeDefaultMenu(WScreen * scr)
*
*----------------------------------------------------------------------
*/
static WMenu *configureMenu(WScreen *scr, WMPropList *definition)
WMenu *configureMenu(WScreen *scr, WMPropList *definition)
{
WMenu *menu = NULL;
WMPropList *elem;

View File

@@ -25,5 +25,6 @@
Bool wRootMenuPerformShortcut(XEvent * event);
void wRootMenuBindShortcuts(Window window);
void OpenRootMenu(WScreen * scr, int x, int y, int keyboard);
WMenu *configureMenu(WScreen *scr, WMPropList *definition);
#endif /* WMROOTMENU_H */