mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
compositor: Introduce tile picker API
Plugins might want to know when they should show a tile picker UI and, since we control the tiling state from the window manager side, we just need to tell the compositor when they should do that. This commit adds the necessary plumbing to let the compositor and plugins know when a tile picker should be shown.
This commit is contained in:
parent
17b56e9604
commit
66910ab422
@ -1456,6 +1456,14 @@ meta_compositor_hide_tile_preview (MetaCompositor *compositor)
|
||||
meta_plugin_manager_hide_tile_preview (compositor->plugin_mgr);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_show_tile_picker (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
int tile_monitor_number)
|
||||
{
|
||||
meta_plugin_manager_show_tile_picker (compositor->plugin_mgr, window, tile_monitor_number);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
|
@ -404,3 +404,24 @@ meta_plugin_manager_create_inhibit_shortcuts_dialog (MetaPluginManager *plugin_m
|
||||
|
||||
return meta_inhibit_shortcuts_dialog_default_new (window);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_plugin_manager_show_tile_picker (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window,
|
||||
int tile_monitor_number)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
|
||||
if (display->display_opening)
|
||||
return FALSE;
|
||||
|
||||
if (klass->show_tile_picker)
|
||||
{
|
||||
klass->show_tile_picker (plugin, window, tile_monitor_number);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -98,4 +98,9 @@ MetaInhibitShortcutsDialog *
|
||||
meta_plugin_manager_create_inhibit_shortcuts_dialog (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window);
|
||||
|
||||
gboolean meta_plugin_manager_show_tile_picker (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window,
|
||||
int tile_monitor_number);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -3153,6 +3153,12 @@ meta_window_tile (MetaWindow *window,
|
||||
if (window->frame)
|
||||
meta_frame_queue_draw (window->frame);
|
||||
|
||||
/* If the window doesn't have a tile match after being tiled, ask the
|
||||
* compositor to show the tile picker.
|
||||
*/
|
||||
if (META_WINDOW_TILED_SIDE_BY_SIDE (window) && !window->tile_match)
|
||||
meta_compositor_show_tile_picker (window->display->compositor, window, window->monitor->number);
|
||||
|
||||
out:
|
||||
if (should_notify)
|
||||
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_TILE_MODE]);
|
||||
|
@ -122,6 +122,10 @@ void meta_compositor_show_tile_preview (MetaCompositor *compositor,
|
||||
MetaRectangle *tile_rect,
|
||||
int tile_monitor_number);
|
||||
void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
|
||||
void meta_compositor_show_tile_picker (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
int tile_monitor_number);
|
||||
|
||||
void meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
|
@ -251,6 +251,14 @@ struct _MetaPluginClass
|
||||
*/
|
||||
MetaInhibitShortcutsDialog * (* create_inhibit_shortcuts_dialog) (MetaPlugin *plugin,
|
||||
MetaWindow *window);
|
||||
|
||||
/**
|
||||
* MetaPluginClass::show_tile_picker:
|
||||
*
|
||||
*/
|
||||
void * (* show_tile_picker) (MetaPlugin *plugin,
|
||||
MetaWindow *window,
|
||||
int tile_monitor_number);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user