summaryrefslogtreecommitdiff
path: root/src/core/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/screen.c')
-rw-r--r--src/core/screen.c66
1 files changed, 64 insertions, 2 deletions
diff --git a/src/core/screen.c b/src/core/screen.c
index e8fce40a..eefe58f2 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -582,7 +582,10 @@ meta_screen_new (MetaDisplay *display,
screen->xscreen);
screen->tab_popup = NULL;
-
+ screen->tile_preview = NULL;
+
+ screen->tile_preview_timeout_id = 0;
+
screen->stack = meta_stack_new (screen);
meta_prefs_add_listener (prefs_changed_callback, screen);
@@ -691,7 +694,13 @@ meta_screen_free (MetaScreen *screen,
if (screen->xinerama_infos)
g_free (screen->xinerama_infos);
-
+
+ if (screen->tile_preview_timeout_id)
+ g_source_remove (screen->tile_preview_timeout_id);
+
+ if (screen->tile_preview)
+ meta_tile_preview_free (screen->tile_preview);
+
g_free (screen->screen_name);
g_free (screen);
@@ -1451,6 +1460,59 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
/* don't show tab popup, since proper space isn't selected yet */
}
+static gboolean
+meta_screen_tile_preview_update_timeout (gpointer data)
+{
+ MetaScreen *screen = data;
+ MetaWindow *window = screen->display->grab_window;
+ gboolean composited = screen->display->compositor != NULL;
+
+ screen->tile_preview_timeout_id = 0;
+
+ if (!screen->tile_preview)
+ screen->tile_preview = meta_tile_preview_new (screen->number,
+ composited);
+
+ if (window
+ && !META_WINDOW_TILED (window)
+ && window->tile_mode != META_TILE_NONE)
+ {
+ MetaRectangle tile_rect;
+
+ meta_window_get_current_tile_area (window, &tile_rect);
+ meta_tile_preview_show (screen->tile_preview, &tile_rect);
+ }
+ else
+ meta_tile_preview_hide (screen->tile_preview);
+
+ return FALSE;
+}
+
+#define TILE_PREVIEW_TIMEOUT_MS 200
+
+void
+meta_screen_tile_preview_update (MetaScreen *screen,
+ gboolean delay)
+{
+ if (delay)
+ {
+ if (screen->tile_preview_timeout_id > 0)
+ return;
+
+ screen->tile_preview_timeout_id =
+ g_timeout_add (TILE_PREVIEW_TIMEOUT_MS,
+ meta_screen_tile_preview_update_timeout,
+ screen);
+ }
+ else
+ {
+ if (screen->tile_preview_timeout_id > 0)
+ g_source_remove (screen->tile_preview_timeout_id);
+
+ meta_screen_tile_preview_update_timeout ((gpointer)screen);
+ }
+}
+
MetaWindow*
meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one)