Add ability to vertically and horizontally maximise using the mouse, by

2008-03-03  Cosimo Cecchi  <anarki@lilik.it>

	Add ability to vertically and horizontally maximise
	using the mouse, by clicking the titlebar in various
	ways.  A very similar patch was received from Jason Ribero.
	Thanks also go to Tony Houghton and Carlo Wood, who
	both submitted patches which solved this differently.
	Closes #358674.

        * src/include/common.h (MetaActionTitlebar): new values
	for the new actions
        * src/core/core.c (meta_core_maximize_{vertic|horizont}ally):
	new functions.
        * src/ui/frames.c (meta_frame_titlebar_event): handle the
	new action values
        * src/core/window.h: new macros (for regularity, not really
	necessary)
        * src/core/prefs.c (symtab_titlebar_action): new string
	representations of the action values
        * src/metacity.schemas.in: documentation


svn path=/trunk/; revision=3619
This commit is contained in:
Cosimo Cecchi
2008-03-03 01:58:54 +00:00
committed by Thomas James Alexander Thurman
parent ac10c309ea
commit a8c3d1614f
8 changed files with 123 additions and 12 deletions

View File

@ -328,6 +328,40 @@ meta_core_maximize (Display *xdisplay,
META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
}
void
meta_core_toggle_maximize_vertically (Display *xdisplay,
Window frame_xwindow)
{
MetaWindow *window = get_window (xdisplay, frame_xwindow);
if (meta_prefs_get_raise_on_click ())
meta_window_raise (window);
if (META_WINDOW_MAXIMIZED_VERTICALLY (window))
meta_window_unmaximize (window,
META_MAXIMIZE_VERTICAL);
else
meta_window_maximize (window,
META_MAXIMIZE_VERTICAL);
}
void
meta_core_toggle_maximize_horizontally (Display *xdisplay,
Window frame_xwindow)
{
MetaWindow *window = get_window (xdisplay, frame_xwindow);
if (meta_prefs_get_raise_on_click ())
meta_window_raise (window);
if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window))
meta_window_unmaximize (window,
META_MAXIMIZE_HORIZONTAL);
else
meta_window_maximize (window,
META_MAXIMIZE_HORIZONTAL);
}
void
meta_core_toggle_maximize (Display *xdisplay,
Window frame_xwindow)

View File

@ -200,6 +200,10 @@ static GConfEnumStringPair symtab_titlebar_action[] =
{
{ META_ACTION_TITLEBAR_TOGGLE_SHADE, "toggle_shade" },
{ META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE, "toggle_maximize" },
{ META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY,
"toggle_maximize_horizontally" },
{ META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY,
"toggle_maximize_vertically" },
{ META_ACTION_TITLEBAR_MINIMIZE, "minimize" },
{ META_ACTION_TITLEBAR_NONE, "none" },
{ META_ACTION_TITLEBAR_LOWER, "lower" },

View File

@ -362,6 +362,8 @@ struct _MetaWindow
*/
#define META_WINDOW_MAXIMIZED(w) ((w)->maximized_horizontally && \
(w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_VERTICALLY(w) ((w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_HORIZONTALLY(w) ((w)->maximized_horizontally)
#define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \