summaryrefslogtreecommitdiff
path: root/src/core/screen.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-01-24 11:30:54 +0100
committerStefano Karapetsas <[email protected]>2014-01-24 11:30:54 +0100
commit1b21c86f638514dd5ac4bd165601b2fef4743287 (patch)
treed9ed65a1bf2e8b11e1510f07e876deb3425ada9f /src/core/screen.c
parente34bef124252b86e118019b78e2abbb8abfe0540 (diff)
parent6ef9c1061ec0bb78bf773f69a50d556ce8e23c01 (diff)
downloadmarco-1b21c86f638514dd5ac4bd165601b2fef4743287.tar.bz2
marco-1b21c86f638514dd5ac4bd165601b2fef4743287.tar.xz
Merge branch 'master' of github.com:mate-desktop/marco
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 a35447ad..f52f382c 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);
@@ -1460,6 +1469,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)