[mutter/wip/gbsneto/tile-picker: 2/2] compositor: Introduce tile picker API
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/gbsneto/tile-picker: 2/2] compositor: Introduce tile picker API
- Date: Fri, 5 Jan 2018 23:28:24 +0000 (UTC)
commit 66910ab422061fb94273cf44292566f90993b2db
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Dec 25 15:12:20 2017 -0200
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.
src/compositor/compositor.c | 8 ++++++++
src/compositor/meta-plugin-manager.c | 21 +++++++++++++++++++++
src/compositor/meta-plugin-manager.h | 5 +++++
src/core/window.c | 6 ++++++
src/meta/compositor.h | 4 ++++
src/meta/meta-plugin.h | 8 ++++++++
6 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index aa49347..a7e7ca1 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -1457,6 +1457,14 @@ meta_compositor_hide_tile_preview (MetaCompositor *compositor)
}
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,
MetaWindowMenuType menu,
diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c
index 834f678..d1f3f49 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -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;
+}
diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h
index 1915903..988c2ed 100644
--- a/src/compositor/meta-plugin-manager.h
+++ b/src/compositor/meta-plugin-manager.h
@@ -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
diff --git a/src/core/window.c b/src/core/window.c
index 806f6f4..a8e369d 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -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]);
diff --git a/src/meta/compositor.h b/src/meta/compositor.h
index f4de9b1..18b1a62 100644
--- a/src/meta/compositor.h
+++ b/src/meta/compositor.h
@@ -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,
diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h
index 73d94e5..deb20ed 100644
--- a/src/meta/meta-plugin.h
+++ b/src/meta/meta-plugin.h
@@ -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);
};
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]