diff --git a/doc/ROADMAP.md b/doc/ROADMAP.md index ef23bd9..31c9722 100644 --- a/doc/ROADMAP.md +++ b/doc/ROADMAP.md @@ -22,7 +22,7 @@ Support for visual effects to improve usability, but not for pure show. * [done] Menu shown on right-button-down, items trigger on right-button-up. * [done] When invoked on unclaimed button, exits menu on button release. * [done] Available as window menu in windows. - * Available also for X11 windows. + * [done] Available also for X11 windows. * Available as (hardcoded) application menu. * Menu with submenus. * Window menu adapting to window state. diff --git a/src/tl_menu.c b/src/tl_menu.c index 6502630..8ce8f6b 100644 --- a/src/tl_menu.c +++ b/src/tl_menu.c @@ -83,7 +83,6 @@ wlmaker_tl_menu_t *wlmaker_tl_menu_create( wlmaker_action_item_menu_item(action_item_ptr)); } - return tl_menu_ptr; } diff --git a/src/toolkit/content.c b/src/toolkit/content.c index 9107623..bede5df 100644 --- a/src/toolkit/content.c +++ b/src/toolkit/content.c @@ -60,8 +60,6 @@ bool wlmtk_content_init( &content_ptr->super_container.super_element, &_wlmtk_content_element_vmt); - wlmtk_content_set_element(content_ptr, element_ptr); - if (!wlmtk_container_init(&content_ptr->popup_container, env_ptr)) { wlmtk_content_fini(content_ptr); return false; @@ -73,6 +71,8 @@ bool wlmtk_content_init( &content_ptr->popup_container.super_element, true); + wlmtk_content_set_element(content_ptr, element_ptr); + return true; } @@ -123,6 +123,10 @@ void wlmtk_content_set_element( content_ptr->element_ptr = element_ptr; wlmtk_element_set_visible(element_ptr, true); + // FIXME + wlmtk_container_raise_element_to_top( + &content_ptr->super_container, + &content_ptr->popup_container.super_element); } } diff --git a/src/xdg_toplevel.c b/src/xdg_toplevel.c index b9ce5ca..27103f0 100644 --- a/src/xdg_toplevel.c +++ b/src/xdg_toplevel.c @@ -171,12 +171,7 @@ wlmtk_window_t *wlmtk_window_create_from_xdg_toplevel( xdg_toplevel_surface_destroy(surface_ptr); return NULL; } - wl_signal_emit(&server_ptr->window_created_event, wlmtk_window_ptr); - - bs_log(BS_INFO, "Created window %p for wlmtk XDG toplevel surface %p", - wlmtk_window_ptr, surface_ptr); - // FIXME: surface_ptr->tl_menu_ptr = wlmaker_tl_menu_create( wlmtk_window_ptr, server_ptr); if (NULL == surface_ptr->tl_menu_ptr) { @@ -184,6 +179,9 @@ wlmtk_window_t *wlmtk_window_create_from_xdg_toplevel( return NULL; } + wl_signal_emit(&server_ptr->window_created_event, wlmtk_window_ptr); + bs_log(BS_INFO, "Created window %p for wlmtk XDG toplevel surface %p", + wlmtk_window_ptr, surface_ptr); return wlmtk_window_ptr; } diff --git a/src/xwl_toplevel.c b/src/xwl_toplevel.c index 2c3d0bd..dc5c98b 100644 --- a/src/xwl_toplevel.c +++ b/src/xwl_toplevel.c @@ -21,6 +21,8 @@ #include "xwl_toplevel.h" +#include "tl_menu.h" + /* == Declarations ========================================================= */ /** State of a XWayland toplevel window. */ @@ -31,6 +33,9 @@ struct _wlmaker_xwl_toplevel_t { /** Back-link to server. */ wlmaker_server_t *server_ptr; + /** The toplevel's window menu. */ + wlmaker_tl_menu_t *tl_menu_ptr; + /** Listener for `map` event of the surface. */ struct wl_listener surface_map_listener; /** Listener for `unmap` event of the surface. */ @@ -66,6 +71,15 @@ wlmaker_xwl_toplevel_t *wlmaker_xwl_toplevel_create( wlmaker_xwl_toplevel_destroy(xwl_toplevel_ptr); return NULL; } + + xwl_toplevel_ptr->tl_menu_ptr = wlmaker_tl_menu_create( + xwl_toplevel_ptr->window_ptr, + server_ptr); + if (NULL == xwl_toplevel_ptr->tl_menu_ptr) { + wlmaker_xwl_toplevel_destroy(xwl_toplevel_ptr); + return NULL; + } + wl_signal_emit(&server_ptr->window_created_event, xwl_toplevel_ptr->window_ptr); @@ -98,6 +112,11 @@ void wlmaker_xwl_toplevel_destroy( wl_list_remove(&xwl_toplevel_ptr->surface_unmap_listener.link); wl_list_remove(&xwl_toplevel_ptr->surface_map_listener.link); + if (NULL != xwl_toplevel_ptr->tl_menu_ptr) { + wlmaker_tl_menu_destroy(xwl_toplevel_ptr->tl_menu_ptr); + xwl_toplevel_ptr->tl_menu_ptr = NULL; + } + free(xwl_toplevel_ptr); }