diff options
author | Stefano Karapetsas <[email protected]> | 2014-01-24 09:21:38 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-01-24 09:21:38 +0100 |
commit | 6f4ee23657a8fbaed9cc89e56e08b543203fefd3 (patch) | |
tree | 0866b9f11b0c1561ab03853d2d6efd2cbcbe0aeb /src/core/screen.c | |
parent | 534f563ef5647a5d6359078b3c0c8eaba1aec877 (diff) | |
parent | a87157176ca6e01c8c4047999ee584f00b63c11e (diff) | |
download | marco-6f4ee23657a8fbaed9cc89e56e08b543203fefd3.tar.bz2 marco-6f4ee23657a8fbaed9cc89e56e08b543203fefd3.tar.xz |
Merge branch '1.7.0-window-snapping'
Diffstat (limited to 'src/core/screen.c')
-rw-r--r-- | src/core/screen.c | 66 |
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) |