leave has_fullscreen_func set to TRUE if the window is screen sized and

2002-08-15  Havoc Pennington  <hp@pobox.com>

	* src/window.c (recalc_window_features): leave has_fullscreen_func
	set to TRUE if the window is screen sized and undecorated, even if
	the window isn't resizable. idea from Christian - Manny Calavera -
	Neumair

	* src/keybindings.c (handle_toggle_fullscreen)
	(handle_toggle_maximize): these disabled fullscreen/maximize if
	the window wasn't resizable, should have used has_fullscreen_func
	has_maximize_func instead.

2002-08-15  Havoc Pennington  <hp@pobox.com>

	* src/keybindings.c: implement raise/lower

	* src/metacity.schemas.in: add raise/lower

	* src/prefs.c: add "raise" and "lower" prefs to keybindings

	* src/display.c (meta_display_set_grab_op_cursor): assert that
	the screen arg is non-NULL in appropriate cases
This commit is contained in:
Havoc Pennington 2002-08-15 05:14:49 +00:00 committed by Havoc Pennington
parent bb9cc21d8e
commit 9ed1636ffe
7 changed files with 125 additions and 3 deletions

View File

@ -1,3 +1,26 @@
2002-08-15 Havoc Pennington <hp@pobox.com>
* src/window.c (recalc_window_features): leave has_fullscreen_func
set to TRUE if the window is screen sized and undecorated, even if
the window isn't resizable. idea from Christian - Manny Calavera -
Neumair
* src/keybindings.c (handle_toggle_fullscreen)
(handle_toggle_maximize): these disabled fullscreen/maximize if
the window wasn't resizable, should have used has_fullscreen_func
has_maximize_func instead.
2002-08-15 Havoc Pennington <hp@pobox.com>
* src/keybindings.c: implement raise/lower
* src/metacity.schemas.in: add raise/lower
* src/prefs.c: add "raise" and "lower" prefs to keybindings
* src/display.c (meta_display_set_grab_op_cursor): assert that
the screen arg is non-NULL in appropriate cases
2002-08-14 Jayaraj Rajappan <jayaraj.rajappan@wipro.com> 2002-08-14 Jayaraj Rajappan <jayaraj.rajappan@wipro.com>
* src/display.c (meta_display_set_grab_op_cursor): * src/display.c (meta_display_set_grab_op_cursor):

View File

@ -2275,6 +2275,8 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
} }
else else
{ {
g_assert (screen != NULL);
if (XGrabPointer (display->xdisplay, if (XGrabPointer (display->xdisplay,
grab_xwindow, grab_xwindow,
False, False,

View File

@ -102,6 +102,14 @@ static void handle_raise_or_lower (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_raise (MetaDisplay *display,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding);
static void handle_lower (MetaDisplay *display,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding);
static void handle_run_command (MetaDisplay *display, static void handle_run_command (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
@ -264,6 +272,8 @@ static const MetaKeyHandler window_handlers[] = {
{ META_KEYBINDING_MOVE_WORKSPACE_DOWN, handle_move_to_workspace, { META_KEYBINDING_MOVE_WORKSPACE_DOWN, handle_move_to_workspace,
GINT_TO_POINTER (META_MOTION_DOWN) }, GINT_TO_POINTER (META_MOTION_DOWN) },
{ 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_LOWER, handle_lower, NULL},
{ NULL, NULL, NULL } { NULL, NULL, NULL }
}; };
@ -2415,7 +2425,7 @@ handle_toggle_fullscreen (MetaDisplay *display,
{ {
if (window->fullscreen) if (window->fullscreen)
meta_window_unmake_fullscreen (window); meta_window_unmake_fullscreen (window);
else if (window->has_resize_func) else if (window->has_fullscreen_func)
meta_window_make_fullscreen (window); meta_window_make_fullscreen (window);
} }
} }
@ -2570,6 +2580,9 @@ handle_raise_or_lower (MetaDisplay *display,
MetaScreen *screen; MetaScreen *screen;
/* FIXME I'm really not sure why we get the screen here
* instead of using window->screen
*/
screen = meta_display_screen_for_root (display, event->xbutton.root); screen = meta_display_screen_for_root (display, event->xbutton.root);
if (screen == NULL) if (screen == NULL)
return; return;
@ -2611,6 +2624,30 @@ handle_raise_or_lower (MetaDisplay *display,
} }
} }
static void
handle_raise (MetaDisplay *display,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding)
{
if (window)
{
meta_window_raise (window);
}
}
static void
handle_lower (MetaDisplay *display,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding)
{
if (window)
{
meta_window_lower (window);
}
}
static void static void
handle_workspace_switch (MetaDisplay *display, handle_workspace_switch (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,

View File

@ -717,6 +717,53 @@ you set
</locale> </locale>
</schema> </schema>
<schema>
<key>/schemas/apps/metacity/window_keybindings/raise</key>
<applyto>/apps/metacity/window_keybindings/raise</applyto>
<owner>metacity</owner>
<type>string</type>
<!-- no default for this one -->
<locale name="C">
<short>Raise window above other windows</short>
<long>
This keybinding raises the window above other windows.
The format looks like "&lt;Control&gt;a" or
"&lt;Shift&gt;&lt;Alt&gt;F1.
The parser is fairly liberal and allows lower or upper case,
and also abbreviations such as "&lt;Ctl&gt;" and
"&lt;Ctrl&gt;". 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/lower</key>
<applyto>/apps/metacity/window_keybindings/lower</applyto>
<owner>metacity</owner>
<type>string</type>
<!-- no default for this one -->
<locale name="C">
<short>Lower window below other windows</short>
<long>
This keybinding lowers a window below other windows.
The format looks like "&lt;Control&gt;a" or
"&lt;Shift&gt;&lt;Alt&gt;F1.
The parser is fairly liberal and allows lower or upper case,
and also abbreviations such as "&lt;Ctl&gt;" and
"&lt;Ctrl&gt;". 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 -->

View File

@ -897,6 +897,8 @@ static MetaKeyPref window_bindings[] = {
{ META_KEYBINDING_MOVE_WORKSPACE_UP, 0, 0 }, { META_KEYBINDING_MOVE_WORKSPACE_UP, 0, 0 },
{ META_KEYBINDING_MOVE_WORKSPACE_DOWN, 0, 0 }, { META_KEYBINDING_MOVE_WORKSPACE_DOWN, 0, 0 },
{ META_KEYBINDING_RAISE_OR_LOWER, 0, 0 }, { META_KEYBINDING_RAISE_OR_LOWER, 0, 0 },
{ META_KEYBINDING_RAISE, 0, 0 },
{ META_KEYBINDING_LOWER, 0, 0 },
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };

View File

@ -130,6 +130,8 @@ void meta_prefs_set_num_workspaces (int n_workspaces);
#define META_KEYBINDING_MOVE_WORKSPACE_UP "move_to_workspace_up" #define META_KEYBINDING_MOVE_WORKSPACE_UP "move_to_workspace_up"
#define META_KEYBINDING_MOVE_WORKSPACE_DOWN "move_to_workspace_down" #define META_KEYBINDING_MOVE_WORKSPACE_DOWN "move_to_workspace_down"
#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_LOWER "lower"
typedef enum _MetaKeyBindingAction typedef enum _MetaKeyBindingAction
{ {

View File

@ -5284,10 +5284,19 @@ recalc_window_features (MetaWindow *window)
window->size_hints.min_height == window->size_hints.max_height) window->size_hints.min_height == window->size_hints.max_height)
window->has_resize_func = FALSE; window->has_resize_func = FALSE;
/* don't allow fullscreen if we can't resize */ /* don't allow fullscreen if we can't resize, unless the size
* is entire screen size (kind of broken, because we
* actually fullscreen to xinerama head size not screen size)
*/
if (!window->has_resize_func) if (!window->has_resize_func)
{ {
window->has_maximize_func = FALSE; window->has_maximize_func = FALSE;
if (window->size_hints.min_width == window->screen->width &&
window->size_hints.min_height == window->screen->height &&
!window->decorated)
; /* leave fullscreen available */
else
window->has_fullscreen_func = FALSE; window->has_fullscreen_func = FALSE;
} }