File tree Expand file tree Collapse file tree
Applications/Workspace/WM Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -785,18 +785,6 @@ void wApplicationMenuShow(WMenu *menu)
785785 }
786786}
787787
788- WMenuItem * wMenuItemWithTitle (WMenu * menu , char * title )
789- {
790- WMenuItem * * items = menu -> items ;
791-
792- for (int i = 0 ; i < menu -> items_count ; i ++ ) {
793- if (!strcmp (items [i ]-> text , title )) {
794- return items [i ];
795- }
796- }
797- return NULL ;
798- }
799-
800788// Menu state
801789//--------------------------------------------------------------------------------------------------
802790
Original file line number Diff line number Diff line change @@ -35,7 +35,5 @@ void wApplicationMenuShow(WMenu *menu);
3535void wApplicationMenuSaveState (WMenu * main_menu , CFMutableArrayRef menus_state );
3636void wApplicationMenuRestoreFromState (WMenu * menu , CFArrayRef state );
3737
38- WMenuItem * wMenuItemWithTitle (WMenu * menu , char * title );
39-
4038void wApplicationMenuSetKeyGrabs (WWindow * wwin );
4139Bool wApplicationMenuHandleKeyPress (struct WWindow * focused_window , XEvent * event );
Original file line number Diff line number Diff line change @@ -2198,3 +2198,24 @@ void wMenuRestoreState(WScreen *scr)
21982198
21992199 restoreMenu (scr , menu );
22002200}
2201+
2202+ WMenuItem * wMenuItemWithTitle (WMenu * menu , char * title )
2203+ {
2204+ WMenuItem * item = NULL ;
2205+
2206+ for (short i = 0 ; i < menu -> items_count ; i ++ ) {
2207+ item = menu -> items [i ];
2208+ if (strcmp (item -> text , title ) == 0 ) {
2209+ break ;
2210+ }
2211+ if (item -> submenu_index >= 0 ) {
2212+ item = wMenuItemWithTitle (menu -> submenus [item -> submenu_index ], title );
2213+ if (item ) {
2214+ break ;
2215+ }
2216+ }
2217+ item = NULL ;
2218+ }
2219+
2220+ return item ;
2221+ }
Original file line number Diff line number Diff line change @@ -83,15 +83,15 @@ typedef struct WMenu {
8383 void (* on_destroy )(struct WMenu * menu );
8484
8585 struct {
86- unsigned int titled : 1 ;
86+ unsigned int titled : 1 ;
8787 unsigned int realized : 1 ; /* whether the window was configured */
8888 unsigned int restored : 1 ; /* whether the menu was restored from saved state */
8989 unsigned int app_menu : 1 ; /* this is a application or root menu */
90- unsigned int mapped : 1 ; /* if menu is already mapped on screen*/
91- unsigned int hidden : 1 ; /* if menu was hidden on app deactivation */
92- unsigned int tornoff : 1 ; /* if the close button is visible (menu was torn off) */
93- unsigned int lowered : 1 ;
94- unsigned int brother : 1 ; /* if this is a copy of the menu */
90+ unsigned int mapped : 1 ; /* if menu is already mapped on screen*/
91+ unsigned int hidden : 1 ; /* if menu was hidden on app deactivation */
92+ unsigned int tornoff : 1 ; /* if the close button is visible (menu was torn off) */
93+ unsigned int lowered : 1 ;
94+ unsigned int brother : 1 ; /* if this is a copy of the menu */
9595 } flags ;
9696} WMenu ;
9797
@@ -128,4 +128,6 @@ WMenu *wMenuUnderPointer(WScreen *screen);
128128void wMenuSaveState (WScreen * scr );
129129void wMenuRestoreState (WScreen * scr );
130130
131+ WMenuItem * wMenuItemWithTitle (WMenu * menu , char * title );
132+
131133#endif /* __WORKSPACE_WM_MENU__ */
You can’t perform that action at this time.
0 commit comments