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
@ -1358,10 +1358,11 @@ meta_compositor_hide_tile_preview (MetaCompositor *compositor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
int x,
|
MetaWindowMenuType menu,
|
||||||
int y)
|
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);
|
||||||
}
|
}
|
||||||
|
@ -358,10 +358,11 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
int x,
|
MetaWindowMenuType menu,
|
||||||
int y)
|
int x,
|
||||||
|
int y)
|
||||||
{
|
{
|
||||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||||
@ -371,5 +372,5 @@ meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (klass->show_window_menu)
|
if (klass->show_window_menu)
|
||||||
klass->show_window_menu (plugin, window, x, y);
|
klass->show_window_menu (plugin, window, menu, x, y);
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,11 @@ gboolean meta_plugin_manager_show_tile_preview (MetaPluginManager *mgr,
|
|||||||
int tile_monitor_number);
|
int tile_monitor_number);
|
||||||
gboolean meta_plugin_manager_hide_tile_preview (MetaPluginManager *mgr);
|
gboolean meta_plugin_manager_hide_tile_preview (MetaPluginManager *mgr);
|
||||||
|
|
||||||
void meta_plugin_manager_show_window_menu (MetaPluginManager *mgr,
|
void meta_plugin_manager_show_window_menu (MetaPluginManager *mgr,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
int x,
|
MetaWindowMenuType menu,
|
||||||
int y);
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -374,11 +374,12 @@ meta_core_change_workspace (Display *xdisplay,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_core_show_window_menu (Display *xdisplay,
|
meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
int root_x,
|
MetaWindowMenuType menu,
|
||||||
int root_y,
|
int root_x,
|
||||||
guint32 timestamp)
|
int root_y,
|
||||||
|
guint32 timestamp)
|
||||||
{
|
{
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||||
|
|
||||||
@ -386,7 +387,7 @@ meta_core_show_window_menu (Display *xdisplay,
|
|||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_focus (window, timestamp);
|
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*
|
const char*
|
||||||
|
@ -132,12 +132,12 @@ const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
|
|||||||
Window xroot,
|
Window xroot,
|
||||||
int index);
|
int index);
|
||||||
|
|
||||||
void meta_core_show_window_menu (Display *xdisplay,
|
void meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
int root_x,
|
MetaWindowMenuType menu,
|
||||||
int root_y,
|
int root_x,
|
||||||
guint32 timestamp);
|
int root_y,
|
||||||
|
guint32 timestamp);
|
||||||
|
|
||||||
gboolean meta_core_begin_grab_op (Display *xdisplay,
|
gboolean meta_core_begin_grab_op (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
|
@ -2751,7 +2751,7 @@ handle_activate_window_menu (MetaDisplay *display,
|
|||||||
x += child_rect.width;
|
x += child_rect.width;
|
||||||
|
|
||||||
y = frame_rect.y + child_rect.y;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,9 +605,10 @@ void meta_window_set_focused_internal (MetaWindow *window,
|
|||||||
|
|
||||||
void meta_window_current_workspace_changed (MetaWindow *window);
|
void meta_window_current_workspace_changed (MetaWindow *window);
|
||||||
|
|
||||||
void meta_window_show_menu (MetaWindow *window,
|
void meta_window_show_menu (MetaWindow *window,
|
||||||
int x,
|
MetaWindowMenuType menu,
|
||||||
int y);
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
@ -5314,12 +5314,13 @@ meta_window_recalc_features (MetaWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_show_menu (MetaWindow *window,
|
meta_window_show_menu (MetaWindow *window,
|
||||||
int x,
|
MetaWindowMenuType menu,
|
||||||
int y)
|
int x,
|
||||||
|
int y)
|
||||||
{
|
{
|
||||||
g_return_if_fail (!window->override_redirect);
|
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
|
void
|
||||||
@ -7980,6 +7981,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
if (meta_prefs_get_raise_on_click ())
|
if (meta_prefs_get_raise_on_click ())
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_show_menu (window,
|
meta_window_show_menu (window,
|
||||||
|
META_WINDOW_MENU_WM,
|
||||||
event->button.x,
|
event->button.x,
|
||||||
event->button.y);
|
event->button.y);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -387,6 +387,19 @@ struct _MetaButtonLayout
|
|||||||
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
|
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:
|
* MetaFrameBorders:
|
||||||
* @visible: inner visible portion of frame border
|
* @visible: inner visible portion of frame border
|
||||||
|
@ -122,9 +122,10 @@ void meta_compositor_show_tile_preview (MetaCompositor *compositor,
|
|||||||
MetaRectangle *tile_rect,
|
MetaRectangle *tile_rect,
|
||||||
int tile_monitor_number);
|
int tile_monitor_number);
|
||||||
void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
|
void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
|
||||||
void meta_compositor_show_window_menu (MetaCompositor *compositor,
|
void meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
int x,
|
MetaWindowMenuType menu,
|
||||||
int y);
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
#endif /* META_COMPOSITOR_H */
|
#endif /* META_COMPOSITOR_H */
|
||||||
|
@ -164,10 +164,11 @@ struct _MetaPluginClass
|
|||||||
int tile_monitor_number);
|
int tile_monitor_number);
|
||||||
void (*hide_tile_preview) (MetaPlugin *plugin);
|
void (*hide_tile_preview) (MetaPlugin *plugin);
|
||||||
|
|
||||||
void (*show_window_menu) (MetaPlugin *plugin,
|
void (*show_window_menu) (MetaPlugin *plugin,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
int x,
|
MetaWindowMenuType menu,
|
||||||
int y);
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MetaPluginClass::kill_window_effects:
|
* MetaPluginClass::kill_window_effects:
|
||||||
|
@ -1101,6 +1101,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
|
|||||||
case G_DESKTOP_TITLEBAR_ACTION_MENU:
|
case G_DESKTOP_TITLEBAR_ACTION_MENU:
|
||||||
meta_core_show_window_menu (display,
|
meta_core_show_window_menu (display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
|
META_WINDOW_MENU_WM,
|
||||||
event->x_root,
|
event->x_root,
|
||||||
event->y_root,
|
event->y_root,
|
||||||
event->time);
|
event->time);
|
||||||
@ -1202,7 +1203,8 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
control == META_FRAME_CONTROL_UNABOVE ||
|
control == META_FRAME_CONTROL_UNABOVE ||
|
||||||
control == META_FRAME_CONTROL_STICK ||
|
control == META_FRAME_CONTROL_STICK ||
|
||||||
control == META_FRAME_CONTROL_UNSTICK ||
|
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;
|
frames->grab_xwindow = frame->xwindow;
|
||||||
|
|
||||||
@ -1211,15 +1213,17 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
frame->prelit_control = control;
|
frame->prelit_control = control;
|
||||||
redraw_control (frames, frame, 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;
|
MetaFrameGeometry fgeom;
|
||||||
GdkRectangle *rect;
|
GdkRectangle *rect;
|
||||||
|
MetaWindowMenuType menu;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
|
||||||
meta_frames_calc_geometry (frames, frame, &fgeom);
|
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 */
|
/* get delta to convert to root coords */
|
||||||
dx = event->x_root - event->x;
|
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)
|
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||||
dx += rect->width;
|
dx += rect->width;
|
||||||
|
|
||||||
|
menu = control == META_FRAME_CONTROL_MENU ? META_WINDOW_MENU_WM
|
||||||
|
: META_WINDOW_MENU_APP;
|
||||||
|
|
||||||
meta_core_show_window_menu (display,
|
meta_core_show_window_menu (display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
|
menu,
|
||||||
rect->x + dx,
|
rect->x + dx,
|
||||||
rect->y + rect->height + dy,
|
rect->y + rect->height + dy,
|
||||||
event->time);
|
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))
|
if (!meta_wayland_seat_can_grab_surface (seat, surface, serial))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_window_show_menu (surface->window, x, y);
|
meta_window_show_menu (surface->window, META_WINDOW_MENU_WM, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -2723,7 +2723,7 @@ meta_window_x11_client_message (MetaWindow *window,
|
|||||||
x = event->xclient.data.l[1];
|
x = event->xclient.data.l[1];
|
||||||
y = event->xclient.data.l[2];
|
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;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user