mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
Actually implement opening the app menu
The last commit added support for the "appmenu" button in decorations, but didn't actually implement it. Add a new MetaWindowMenuType parameter to the show_window_menu () functions and use it to ask the compositor to display the app menu when the new button is activated. https://bugzilla.gnome.org/show_bug.cgi?id=730752
This commit is contained in:
parent
c2ea650b3c
commit
31db32e826
@ -1360,8 +1360,9 @@ meta_compositor_hide_tile_preview (MetaCompositor *compositor)
|
||||
void
|
||||
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window, x, y);
|
||||
meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window, menu, x, y);
|
||||
}
|
||||
|
@ -360,6 +360,7 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
|
||||
void
|
||||
meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
@ -371,5 +372,5 @@ meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||
return;
|
||||
|
||||
if (klass->show_window_menu)
|
||||
klass->show_window_menu (plugin, window, x, y);
|
||||
klass->show_window_menu (plugin, window, menu, x, y);
|
||||
}
|
||||
|
@ -83,7 +83,9 @@ gboolean meta_plugin_manager_hide_tile_preview (MetaPluginManager *mgr);
|
||||
|
||||
void meta_plugin_manager_show_window_menu (MetaPluginManager *mgr,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -376,6 +376,7 @@ meta_core_change_workspace (Display *xdisplay,
|
||||
void
|
||||
meta_core_show_window_menu (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaWindowMenuType menu,
|
||||
int root_x,
|
||||
int root_y,
|
||||
guint32 timestamp)
|
||||
@ -386,7 +387,7 @@ meta_core_show_window_menu (Display *xdisplay,
|
||||
meta_window_raise (window);
|
||||
meta_window_focus (window, timestamp);
|
||||
|
||||
meta_window_show_menu (window, root_x, root_y);
|
||||
meta_window_show_menu (window, menu, root_x, root_y);
|
||||
}
|
||||
|
||||
const char*
|
||||
|
@ -134,11 +134,11 @@ const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
|
||||
|
||||
void meta_core_show_window_menu (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaWindowMenuType menu,
|
||||
int root_x,
|
||||
int root_y,
|
||||
guint32 timestamp);
|
||||
|
||||
|
||||
gboolean meta_core_begin_grab_op (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaGrabOp op,
|
||||
|
@ -2751,7 +2751,7 @@ handle_activate_window_menu (MetaDisplay *display,
|
||||
x += child_rect.width;
|
||||
|
||||
y = frame_rect.y + child_rect.y;
|
||||
meta_window_show_menu (display->focus_window, x, y);
|
||||
meta_window_show_menu (display->focus_window, META_WINDOW_MENU_WM, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,6 +606,7 @@ void meta_window_set_focused_internal (MetaWindow *window,
|
||||
void meta_window_current_workspace_changed (MetaWindow *window);
|
||||
|
||||
void meta_window_show_menu (MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
|
@ -5315,11 +5315,12 @@ meta_window_recalc_features (MetaWindow *window)
|
||||
|
||||
void
|
||||
meta_window_show_menu (MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
g_return_if_fail (!window->override_redirect);
|
||||
meta_compositor_show_window_menu (window->display->compositor, window, x, y);
|
||||
meta_compositor_show_window_menu (window->display->compositor, window, menu, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
@ -7980,6 +7981,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||
if (meta_prefs_get_raise_on_click ())
|
||||
meta_window_raise (window);
|
||||
meta_window_show_menu (window,
|
||||
META_WINDOW_MENU_WM,
|
||||
event->button.x,
|
||||
event->button.y);
|
||||
return TRUE;
|
||||
|
@ -387,6 +387,19 @@ struct _MetaButtonLayout
|
||||
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
|
||||
};
|
||||
|
||||
/**
|
||||
* MetaWindowMenuType:
|
||||
* @META_WINDOW_MENU_WM: the window manager menu
|
||||
* @META_WINDOW_MENU_APP: the (fallback) app menu
|
||||
*
|
||||
* Menu the compositor should display for a given window
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
META_WINDOW_MENU_WM,
|
||||
META_WINDOW_MENU_APP
|
||||
} MetaWindowMenuType;
|
||||
|
||||
/**
|
||||
* MetaFrameBorders:
|
||||
* @visible: inner visible portion of frame border
|
||||
|
@ -124,6 +124,7 @@ void meta_compositor_show_tile_preview (MetaCompositor *compositor,
|
||||
void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
|
||||
void meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
|
@ -166,6 +166,7 @@ struct _MetaPluginClass
|
||||
|
||||
void (*show_window_menu) (MetaPlugin *plugin,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
|
@ -1101,6 +1101,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
|
||||
case G_DESKTOP_TITLEBAR_ACTION_MENU:
|
||||
meta_core_show_window_menu (display,
|
||||
frame->xwindow,
|
||||
META_WINDOW_MENU_WM,
|
||||
event->x_root,
|
||||
event->y_root,
|
||||
event->time);
|
||||
@ -1202,7 +1203,8 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
control == META_FRAME_CONTROL_UNABOVE ||
|
||||
control == META_FRAME_CONTROL_STICK ||
|
||||
control == META_FRAME_CONTROL_UNSTICK ||
|
||||
control == META_FRAME_CONTROL_MENU))
|
||||
control == META_FRAME_CONTROL_MENU ||
|
||||
control == META_FRAME_CONTROL_APPMENU))
|
||||
{
|
||||
frames->grab_xwindow = frame->xwindow;
|
||||
|
||||
@ -1211,15 +1213,17 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
frame->prelit_control = control;
|
||||
redraw_control (frames, frame, control);
|
||||
|
||||
if (control == META_FRAME_CONTROL_MENU)
|
||||
if (control == META_FRAME_CONTROL_MENU ||
|
||||
control == META_FRAME_CONTROL_APPMENU)
|
||||
{
|
||||
MetaFrameGeometry fgeom;
|
||||
GdkRectangle *rect;
|
||||
MetaWindowMenuType menu;
|
||||
int dx, dy;
|
||||
|
||||
meta_frames_calc_geometry (frames, frame, &fgeom);
|
||||
|
||||
rect = control_rect (META_FRAME_CONTROL_MENU, &fgeom);
|
||||
rect = control_rect (control, &fgeom);
|
||||
|
||||
/* get delta to convert to root coords */
|
||||
dx = event->x_root - event->x;
|
||||
@ -1229,8 +1233,12 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||
dx += rect->width;
|
||||
|
||||
menu = control == META_FRAME_CONTROL_MENU ? META_WINDOW_MENU_WM
|
||||
: META_WINDOW_MENU_APP;
|
||||
|
||||
meta_core_show_window_menu (display,
|
||||
frame->xwindow,
|
||||
menu,
|
||||
rect->x + dx,
|
||||
rect->y + rect->height + dy,
|
||||
event->time);
|
||||
|
@ -784,7 +784,7 @@ xdg_surface_show_window_menu (struct wl_client *client,
|
||||
if (!meta_wayland_seat_can_grab_surface (seat, surface, serial))
|
||||
return;
|
||||
|
||||
meta_window_show_menu (surface->window, x, y);
|
||||
meta_window_show_menu (surface->window, META_WINDOW_MENU_WM, x, y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -2723,7 +2723,7 @@ meta_window_x11_client_message (MetaWindow *window,
|
||||
x = event->xclient.data.l[1];
|
||||
y = event->xclient.data.l[2];
|
||||
|
||||
meta_window_show_menu (window, x, y);
|
||||
meta_window_show_menu (window, META_WINDOW_MENU_WM, x, y);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user