@@ -3650,13 +3650,8 @@ can_tile (MetaWindow *window,
36503650}
36513651
36523652static void
3653- handle_tile_action (MetaDisplay * display ,
3654- MetaWindow * window ,
3655- ClutterKeyEvent * event ,
3656- MetaKeyBinding * binding ,
3657- gpointer dummy )
3653+ do_tile_move (MetaWindow * window , MetaTileMode mode )
36583654{
3659- MetaTileMode mode = binding -> handler -> data ;
36603655 MetaTileMode new_mode ;
36613656
36623657 new_mode = get_new_tile_mode (mode , META_WINDOW_MAXIMIZED (window ) ? META_TILE_MAXIMIZED : window -> tile_mode );
@@ -3676,6 +3671,65 @@ handle_tile_action (MetaDisplay *display,
36763671 }
36773672}
36783673
3674+ static void
3675+ handle_tile_action (MetaDisplay * display ,
3676+ MetaWindow * window ,
3677+ ClutterKeyEvent * event ,
3678+ MetaKeyBinding * binding ,
3679+ gpointer dummy )
3680+ {
3681+ MetaTileMode mode = binding -> handler -> data ;
3682+ do_tile_move (window , mode );
3683+ }
3684+
3685+ /**
3686+ * meta_display_push_tile:
3687+ * @display: the #MetaDisplay
3688+ * @window: the #MetaWindow to act upon
3689+ * @direction: the #MetaMotionDirection to push the window in.
3690+ *
3691+ * If the window is not yet tiled, tile the window to the portion
3692+ * of the monitor indicated by @direction. If already tiled, perform
3693+ * navigation around the possible tile positions, or untile the
3694+ * window, according to @direction.
3695+ *
3696+ * For example, if @window is left-tiled, and the @direction is
3697+ * #META_MOTION_UP, the window will be upper-left corner tiled. If the
3698+ * @direction is #META_MOTION_RIGHT, the window will be untiled.
3699+ *
3700+ * This logic is identical to the behavior of the tiling keyboard
3701+ * shortcuts.
3702+ **/
3703+ void
3704+ meta_display_push_tile (MetaDisplay * display ,
3705+ MetaWindow * window ,
3706+ MetaMotionDirection direction )
3707+ {
3708+ g_return_if_fail (META_IS_DISPLAY (display ) && META_IS_WINDOW (window ));
3709+
3710+ MetaTileMode mode ;
3711+ switch (direction )
3712+ {
3713+ case META_MOTION_LEFT :
3714+ mode = META_TILE_LEFT ;
3715+ break ;
3716+ case META_MOTION_RIGHT :
3717+ mode = META_TILE_RIGHT ;
3718+ break ;
3719+ case META_MOTION_UP :
3720+ mode = META_TILE_TOP ;
3721+ break ;
3722+ case META_MOTION_DOWN :
3723+ mode = META_TILE_BOTTOM ;
3724+ break ;
3725+ default :
3726+ return ;
3727+ }
3728+
3729+ do_tile_move (window , mode );
3730+ }
3731+
3732+
36793733static void
36803734handle_toggle_maximized (MetaDisplay * display ,
36813735 MetaWindow * window ,
0 commit comments