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:
Georges Basile Stavracas Neto 2017-12-25 15:12:20 -02:00
parent 17b56e9604
commit 66910ab422
6 changed files with 52 additions and 0 deletions

View File

@ -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,

View File

@ -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;
}

View File

@ -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

View File

@ -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]);

View File

@ -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,

View File

@ -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);
};
/**