mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
new functions to resize to fill screen
2002-12-08 Havoc Pennington <hp@pobox.com> * src/window.c (meta_window_fill_vertical) (meta_window_fill_horizontal): new functions to resize to fill screen * src/keybindings.c: add vert, horiz maximize * src/prefs.c: had vert, horiz maximize * src/metacity.schemas.in: shorten some overlong short descriptions that make the keybindings capplet look ugly. Add maximize_vertically, maximize_horizontally keys.
This commit is contained in:
parent
8d314aead8
commit
e0c8b245ef
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
2002-12-08 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* src/window.c (meta_window_fill_vertical)
|
||||||
|
(meta_window_fill_horizontal): new functions to resize to
|
||||||
|
fill screen
|
||||||
|
|
||||||
|
* src/keybindings.c: add vert, horiz maximize
|
||||||
|
|
||||||
|
* src/prefs.c: had vert, horiz maximize
|
||||||
|
|
||||||
|
* src/metacity.schemas.in: shorten some overlong short
|
||||||
|
descriptions that make the keybindings capplet look ugly.
|
||||||
|
Add maximize_vertically, maximize_horizontally keys.
|
||||||
|
|
||||||
2002-12-08 Havoc Pennington <hp@pobox.com>
|
2002-12-08 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* src/prefs.c (meta_prefs_get_application_based): make this always
|
* src/prefs.c (meta_prefs_get_application_based): make this always
|
||||||
|
@ -154,6 +154,16 @@ static void handle_run_command (MetaDisplay *display,
|
|||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
MetaKeyBinding *binding);
|
MetaKeyBinding *binding);
|
||||||
|
static void handle_maximize_vert (MetaDisplay *display,
|
||||||
|
MetaScreen *screen,
|
||||||
|
MetaWindow *window,
|
||||||
|
XEvent *event,
|
||||||
|
MetaKeyBinding *binding);
|
||||||
|
static void handle_maximize_horiz (MetaDisplay *display,
|
||||||
|
MetaScreen *screen,
|
||||||
|
MetaWindow *window,
|
||||||
|
XEvent *event,
|
||||||
|
MetaKeyBinding *binding);
|
||||||
|
|
||||||
/* debug */
|
/* debug */
|
||||||
static void handle_spew_mark (MetaDisplay *display,
|
static void handle_spew_mark (MetaDisplay *display,
|
||||||
@ -329,6 +339,8 @@ static const MetaKeyHandler window_handlers[] = {
|
|||||||
{ META_KEYBINDING_RAISE_OR_LOWER, handle_raise_or_lower, NULL},
|
{ META_KEYBINDING_RAISE_OR_LOWER, handle_raise_or_lower, NULL},
|
||||||
{ META_KEYBINDING_RAISE, handle_raise, NULL},
|
{ META_KEYBINDING_RAISE, handle_raise, NULL},
|
||||||
{ META_KEYBINDING_LOWER, handle_lower, NULL},
|
{ META_KEYBINDING_LOWER, handle_lower, NULL},
|
||||||
|
{ META_KEYBINDING_MAXIMIZE_VERTICALLY, handle_maximize_vert, NULL },
|
||||||
|
{ META_KEYBINDING_MAXIMIZE_HORIZONTALLY, handle_maximize_horiz, NULL },
|
||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2239,6 +2251,35 @@ handle_run_command (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_maximize_vert (MetaDisplay *display,
|
||||||
|
MetaScreen *screen,
|
||||||
|
MetaWindow *window,
|
||||||
|
XEvent *event,
|
||||||
|
MetaKeyBinding *binding)
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
if (window->has_resize_func)
|
||||||
|
meta_window_fill_vertical (window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_maximize_horiz (MetaDisplay *display,
|
||||||
|
MetaScreen *screen,
|
||||||
|
MetaWindow *window,
|
||||||
|
XEvent *event,
|
||||||
|
MetaKeyBinding *binding)
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
if (window->has_resize_func)
|
||||||
|
meta_window_fill_horizontal (window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
process_workspace_switch_grab (MetaDisplay *display,
|
process_workspace_switch_grab (MetaDisplay *display,
|
||||||
MetaScreen *screen,
|
MetaScreen *screen,
|
||||||
|
@ -71,8 +71,8 @@
|
|||||||
<short>Action on title bar double-click</short>
|
<short>Action on title bar double-click</short>
|
||||||
<long>
|
<long>
|
||||||
This option determines the effects of double-clicking on the
|
This option determines the effects of double-clicking on the
|
||||||
title bar. Current valid options are 'toggle_shade', which will
|
title bar. Current valid options are 'toggle_shaded', which will
|
||||||
shade/unshade the window, and 'toggle_maximize' which will
|
shade/unshade the window, and 'toggle_maximized' which will
|
||||||
maximize/unmaximize the window.
|
maximize/unmaximize the window.
|
||||||
</long>
|
</long>
|
||||||
</locale>
|
</locale>
|
||||||
@ -426,7 +426,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default>disabled</default>
|
<default>disabled</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Toggle whether the window is on all workspaces</short>
|
<short>Toggle window on all workspaces</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to toggle whether the window is on all
|
The keybinding used to toggle whether the window is on all
|
||||||
workspaces or just one.
|
workspaces or just one.
|
||||||
@ -823,7 +823,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<!-- no default for this one -->
|
<!-- no default for this one -->
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Raise window if obscured, lowers it otherwise</short>
|
<short>Raise obscured window, otherwise lower</short>
|
||||||
<long>
|
<long>
|
||||||
This keybinding changes whether a window is above or below
|
This keybinding changes whether a window is above or below
|
||||||
other windows. If the window is covered by another window, it raises
|
other windows. If the window is covered by another window, it raises
|
||||||
@ -888,6 +888,51 @@ you set
|
|||||||
</locale>
|
</locale>
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
|
<schema>
|
||||||
|
<key>/schemas/apps/metacity/window_keybindings/maximize_vertically</key>
|
||||||
|
<applyto>/apps/metacity/window_keybindings/maximize_vertically</applyto>
|
||||||
|
<owner>metacity</owner>
|
||||||
|
<type>string</type>
|
||||||
|
<!-- no default for this one -->
|
||||||
|
<locale name="C">
|
||||||
|
<short>Maximize window vertically</short>
|
||||||
|
<long>
|
||||||
|
This keybinding resizes a window to fill available vertical space.
|
||||||
|
|
||||||
|
The format looks like "<Control>a" or
|
||||||
|
"<Shift><Alt>F1.
|
||||||
|
|
||||||
|
The parser is fairly liberal and allows lower or upper case,
|
||||||
|
and also abbreviations such as "<Ctl>" and
|
||||||
|
"<Ctrl>". If you set the option to the special string
|
||||||
|
"disabled", then there will be no keybinding for this
|
||||||
|
action.
|
||||||
|
</long>
|
||||||
|
</locale>
|
||||||
|
</schema>
|
||||||
|
|
||||||
|
<schema>
|
||||||
|
<key>/schemas/apps/metacity/window_keybindings/maximize_horizontally</key>
|
||||||
|
<applyto>/apps/metacity/window_keybindings/maximize_horizontally</applyto>
|
||||||
|
<owner>metacity</owner>
|
||||||
|
<type>string</type>
|
||||||
|
<!-- no default for this one -->
|
||||||
|
<locale name="C">
|
||||||
|
<short>Maximize window horizontally</short>
|
||||||
|
<long>
|
||||||
|
This keybinding resizes a window to fill available horizontal space.
|
||||||
|
|
||||||
|
The format looks like "<Control>a" or
|
||||||
|
"<Shift><Alt>F1.
|
||||||
|
|
||||||
|
The parser is fairly liberal and allows lower or upper case,
|
||||||
|
and also abbreviations such as "<Ctl>" and
|
||||||
|
"<Ctrl>". If you set the option to the special string
|
||||||
|
"disabled", then there will be no keybinding for this
|
||||||
|
action.
|
||||||
|
</long>
|
||||||
|
</locale>
|
||||||
|
</schema>
|
||||||
|
|
||||||
<!-- Global Keybindings -->
|
<!-- Global Keybindings -->
|
||||||
|
|
||||||
@ -899,7 +944,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default><Alt>Tab</default>
|
<default><Alt>Tab</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Move focus between windows using popup display</short>
|
<short>Move between windows with popup</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to move focus between windows, using
|
The keybinding used to move focus between windows, using
|
||||||
a popup window.
|
a popup window.
|
||||||
@ -950,7 +995,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default><Control><Alt>Tab</default>
|
<default><Control><Alt>Tab</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Move focus between panels and the desktop using popup display</short>
|
<short>Move between panels and the desktop with popup</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to move focus between panels and
|
The keybinding used to move focus between panels and
|
||||||
the desktop, using a popup window.
|
the desktop, using a popup window.
|
||||||
@ -974,7 +1019,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default>disabled</default>
|
<default>disabled</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Move focus backwards between panels and the desktop using popup display</short>
|
<short>Move backwards between panels and the desktop with popup</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to move focus backwards between panels
|
The keybinding used to move focus backwards between panels
|
||||||
and the desktop, using a popup window.
|
and the desktop, using a popup window.
|
||||||
@ -998,7 +1043,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default><Alt>Escape</default>
|
<default><Alt>Escape</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Move focus between windows immediately</short>
|
<short>Move between windows immediately</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to move focus between windows without
|
The keybinding used to move focus between windows without
|
||||||
a popup window.
|
a popup window.
|
||||||
@ -1024,7 +1069,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default>disabled</default>
|
<default>disabled</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Move focus backwards between windows immediately</short>
|
<short>Move backwards between windows immediately</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to move focus backwards between windows
|
The keybinding used to move focus backwards between windows
|
||||||
without a popup window. Holding "shift" together with this
|
without a popup window. Holding "shift" together with this
|
||||||
@ -1049,7 +1094,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default><Control><Alt>Escape</default>
|
<default><Control><Alt>Escape</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Move focus between panels and the desktop immediately</short>
|
<short>Move between panels and the desktop immediately</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to move focus between panels and
|
The keybinding used to move focus between panels and
|
||||||
the desktop, without a popup window.
|
the desktop, without a popup window.
|
||||||
@ -1073,7 +1118,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default><Control><Alt>Escape</default>
|
<default><Control><Alt>Escape</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Move focus backward between panels and the desktop immediately</short>
|
<short>Move backward between panels and the desktop immediately</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding used to move focus backwards between panels and
|
The keybinding used to move focus backwards between panels and
|
||||||
the desktop, without a popup window.
|
the desktop, without a popup window.
|
||||||
@ -1461,7 +1506,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default><Control><Alt>Up</default>
|
<default><Control><Alt>Up</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Switch to workspace above the current space</short>
|
<short>Switch to workspace above this one</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding that switches to the workspace above
|
The keybinding that switches to the workspace above
|
||||||
the current workspace.
|
the current workspace.
|
||||||
@ -1486,7 +1531,7 @@ you set
|
|||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default><Control><Alt>Down</default>
|
<default><Control><Alt>Down</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Switch to workspace below the current space</short>
|
<short>Switch to workspace below this one</short>
|
||||||
<long>
|
<long>
|
||||||
The keybinding that switches to the workspace below
|
The keybinding that switches to the workspace below
|
||||||
the current workspace.
|
the current workspace.
|
||||||
|
@ -1295,6 +1295,8 @@ static MetaKeyPref window_bindings[] = {
|
|||||||
{ META_KEYBINDING_RAISE_OR_LOWER, 0, 0 },
|
{ META_KEYBINDING_RAISE_OR_LOWER, 0, 0 },
|
||||||
{ META_KEYBINDING_RAISE, 0, 0 },
|
{ META_KEYBINDING_RAISE, 0, 0 },
|
||||||
{ META_KEYBINDING_LOWER, 0, 0 },
|
{ META_KEYBINDING_LOWER, 0, 0 },
|
||||||
|
{ META_KEYBINDING_MAXIMIZE_VERTICALLY, 0, 0 },
|
||||||
|
{ META_KEYBINDING_MAXIMIZE_HORIZONTALLY, 0, 0 },
|
||||||
{ NULL, 0, 0 }
|
{ NULL, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,6 +150,8 @@ void meta_prefs_change_workspace_name (int i,
|
|||||||
#define META_KEYBINDING_RAISE_OR_LOWER "raise_or_lower"
|
#define META_KEYBINDING_RAISE_OR_LOWER "raise_or_lower"
|
||||||
#define META_KEYBINDING_RAISE "raise"
|
#define META_KEYBINDING_RAISE "raise"
|
||||||
#define META_KEYBINDING_LOWER "lower"
|
#define META_KEYBINDING_LOWER "lower"
|
||||||
|
#define META_KEYBINDING_MAXIMIZE_VERTICALLY "maximize_vertically"
|
||||||
|
#define META_KEYBINDING_MAXIMIZE_HORIZONTALLY "maximize_horizontally"
|
||||||
|
|
||||||
typedef enum _MetaKeyBindingAction
|
typedef enum _MetaKeyBindingAction
|
||||||
{
|
{
|
||||||
|
82
src/window.c
82
src/window.c
@ -2621,6 +2621,88 @@ meta_window_move_resize_now (MetaWindow *window)
|
|||||||
window->rect.height);
|
window->rect.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_maximize_to_xinerama (MetaWindow *window,
|
||||||
|
const MetaXineramaScreenInfo *xinerama)
|
||||||
|
{
|
||||||
|
/* If we now fill the screen, maximize.
|
||||||
|
* the point here is that fill horz + fill vert = maximized
|
||||||
|
*/
|
||||||
|
MetaRectangle rect;
|
||||||
|
|
||||||
|
if (!window->has_maximize_func)
|
||||||
|
return;
|
||||||
|
|
||||||
|
meta_window_get_outer_rect (window, &rect);
|
||||||
|
|
||||||
|
if ( rect.x >= xinerama->x_origin &&
|
||||||
|
rect.y >= xinerama->y_origin &&
|
||||||
|
(((xinerama->width - xinerama->x_origin) - rect.width) <
|
||||||
|
window->size_hints.width_inc) &&
|
||||||
|
(((xinerama->height - xinerama->y_origin) - rect.height) <
|
||||||
|
window->size_hints.height_inc) )
|
||||||
|
meta_window_maximize (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_window_fill_horizontal (MetaWindow *window)
|
||||||
|
{
|
||||||
|
const MetaXineramaScreenInfo *xinerama;
|
||||||
|
int x, y, w, h;
|
||||||
|
|
||||||
|
meta_window_get_user_position (window, &x, &y);
|
||||||
|
|
||||||
|
w = window->rect.width;
|
||||||
|
h = window->rect.height;
|
||||||
|
|
||||||
|
xinerama = meta_screen_get_xinerama_for_window (window->screen,
|
||||||
|
window);
|
||||||
|
|
||||||
|
|
||||||
|
x = xinerama->x_origin;
|
||||||
|
w = xinerama->width;
|
||||||
|
|
||||||
|
if (window->frame != NULL)
|
||||||
|
{
|
||||||
|
x += window->frame->child_x;
|
||||||
|
w -= (window->frame->child_x + window->frame->right_width);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_window_move_resize (window, TRUE,
|
||||||
|
x, y, w, h);
|
||||||
|
|
||||||
|
check_maximize_to_xinerama (window, xinerama);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_window_fill_vertical (MetaWindow *window)
|
||||||
|
{
|
||||||
|
const MetaXineramaScreenInfo *xinerama;
|
||||||
|
int x, y, w, h;
|
||||||
|
|
||||||
|
meta_window_get_user_position (window, &x, &y);
|
||||||
|
|
||||||
|
w = window->rect.width;
|
||||||
|
h = window->rect.height;
|
||||||
|
|
||||||
|
xinerama = meta_screen_get_xinerama_for_window (window->screen,
|
||||||
|
window);
|
||||||
|
|
||||||
|
|
||||||
|
y = xinerama->y_origin;
|
||||||
|
h = xinerama->height;
|
||||||
|
|
||||||
|
if (window->frame != NULL)
|
||||||
|
{
|
||||||
|
y += window->frame->child_y;
|
||||||
|
h -= (window->frame->child_y + window->frame->bottom_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_window_move_resize (window, TRUE,
|
||||||
|
x, y, w, h);
|
||||||
|
|
||||||
|
check_maximize_to_xinerama (window, xinerama);
|
||||||
|
}
|
||||||
|
|
||||||
static guint move_resize_idle = 0;
|
static guint move_resize_idle = 0;
|
||||||
static GSList *move_resize_pending = NULL;
|
static GSList *move_resize_pending = NULL;
|
||||||
|
@ -322,6 +322,10 @@ void meta_window_resize_with_gravity (MetaWindow *window,
|
|||||||
int h,
|
int h,
|
||||||
int gravity);
|
int gravity);
|
||||||
|
|
||||||
|
|
||||||
|
void meta_window_fill_horizontal (MetaWindow *window);
|
||||||
|
void meta_window_fill_vertical (MetaWindow *window);
|
||||||
|
|
||||||
/* This recalcs the window/frame size, and recalcs the frame
|
/* This recalcs the window/frame size, and recalcs the frame
|
||||||
* size/contents as well.
|
* size/contents as well.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user