Commit a8c3d161 authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Thomas James Alexander Thurman
Browse files

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
parent ac10c309
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
2008-02-29 Andrea Del Signore <sejerpz@tin.it>
Add support for "spacer" as a button type which adds some
......
......@@ -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)
......
......@@ -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" },
......
......@@ -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) && \
......
......@@ -174,6 +174,8 @@ typedef enum
{
META_ACTION_TITLEBAR_TOGGLE_SHADE,
META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE,
META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY,
META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY,
META_ACTION_TITLEBAR_MINIMIZE,
META_ACTION_TITLEBAR_NONE,
META_ACTION_TITLEBAR_LOWER,
......
......@@ -120,6 +120,10 @@ void meta_core_minimize (Display *xdisplay,
Window frame_xwindow);
void meta_core_toggle_maximize (Display *xdisplay,
Window frame_xwindow);
void meta_core_toggle_maximize_horizontally (Display *xdisplay,
Window frame_xwindow);
void meta_core_toggle_maximize_vertically (Display *xdisplay,
Window frame_xwindow);
void meta_core_unmaximize (Display *xdisplay,
Window frame_xwindow);
void meta_core_maximize (Display *xdisplay,
......
......@@ -114,10 +114,16 @@
<short>Action on title bar double-click</short>
<long>
This option determines the effects of double-clicking on the
title bar. Current valid options are 'toggle_shade', which will
shade/unshade the window, 'toggle_maximize' which will
maximize/unmaximize the window, 'minimize' which will minimize
the window, and 'none' which will not do anything.
title bar. Current valid options are
'toggle_shade', which will shade/unshade the window,
'toggle_maximize' which will maximize/unmaximize the window,
'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
which will maximize/unmaximize the window in that direction only,
'minimize' which will minimize the window,
'shade' which will roll the window up,
'menu' which will display the window menu,
'lower' which will put the window behind all the others,
and 'none' which will not do anything.
</long>
</locale>
</schema>
......@@ -132,10 +138,16 @@
<short>Action on title bar middle-click</short>
<long>
This option determines the effects of middle-clicking on the
title bar. Current valid options are 'toggle_shade', which will
shade/unshade the window, 'toggle_maximize' which will
maximize/unmaximize the window, 'minimize' which will minimize
the window, and 'none' which will not do anything.
title bar. Current valid options are
'toggle_shade', which will shade/unshade the window,
'toggle_maximize' which will maximize/unmaximize the window,
'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
which will maximize/unmaximize the window in that direction only,
'minimize' which will minimize the window,
'shade' which will roll the window up,
'menu' which will display the window menu,
'lower' which will put the window behind all the others,
and 'none' which will not do anything.
</long>
</locale>
</schema>
......@@ -150,10 +162,16 @@
<short>Action on title bar right-click</short>
<long>
This option determines the effects of right-clicking on the
title bar. Current valid options are 'toggle_shade', which will
shade/unshade the window, 'toggle_maximize' which will
maximize/unmaximize the window, 'minimize' which will minimize
the window, and 'none' which will not do anything.
title bar. Current valid options are
'toggle_shade', which will shade/unshade the window,
'toggle_maximize' which will maximize/unmaximize the window,
'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
which will maximize/unmaximize the window in that direction only,
'minimize' which will minimize the window,
'shade' which will roll the window up,
'menu' which will display the window menu,
'lower' which will put the window behind all the others,
and 'none' which will not do anything.
</long>
</locale>
</schema>
......
......@@ -1249,6 +1249,32 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
}
break;
case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY:
{
meta_core_get (gdk_display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
{
meta_core_toggle_maximize_horizontally (gdk_display, frame->xwindow);
}
}
break;
case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY:
{
meta_core_get (gdk_display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
{
meta_core_toggle_maximize_vertically (gdk_display, frame->xwindow);
}
}
break;
case META_ACTION_TITLEBAR_MINIMIZE:
{
meta_core_get (gdk_display, frame->xwindow,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment