From 9ed1636ffe3160ea89935266e64e3506bdba69c0 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 15 Aug 2002 05:14:49 +0000 Subject: [PATCH] leave has_fullscreen_func set to TRUE if the window is screen sized and 2002-08-15 Havoc Pennington * 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 * 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 --- ChangeLog | 23 ++++++++++++++++++++ src/display.c | 2 ++ src/keybindings.c | 39 +++++++++++++++++++++++++++++++++- src/metacity.schemas.in | 47 +++++++++++++++++++++++++++++++++++++++++ src/prefs.c | 2 ++ src/prefs.h | 2 ++ src/window.c | 13 ++++++++++-- 7 files changed, 125 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96d756556..36cd8f70e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2002-08-15 Havoc Pennington + + * 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 + + * 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 * src/display.c (meta_display_set_grab_op_cursor): diff --git a/src/display.c b/src/display.c index e20fc32f6..ac1f787b4 100644 --- a/src/display.c +++ b/src/display.c @@ -2275,6 +2275,8 @@ meta_display_set_grab_op_cursor (MetaDisplay *display, } else { + g_assert (screen != NULL); + if (XGrabPointer (display->xdisplay, grab_xwindow, False, diff --git a/src/keybindings.c b/src/keybindings.c index 2f3e1a1b0..6eaaefdfb 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -102,6 +102,14 @@ static void handle_raise_or_lower (MetaDisplay *display, MetaWindow *window, XEvent *event, 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, MetaWindow *window, XEvent *event, @@ -264,6 +272,8 @@ static const MetaKeyHandler window_handlers[] = { { META_KEYBINDING_MOVE_WORKSPACE_DOWN, handle_move_to_workspace, GINT_TO_POINTER (META_MOTION_DOWN) }, { 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 } }; @@ -2415,7 +2425,7 @@ handle_toggle_fullscreen (MetaDisplay *display, { if (window->fullscreen) meta_window_unmake_fullscreen (window); - else if (window->has_resize_func) + else if (window->has_fullscreen_func) meta_window_make_fullscreen (window); } } @@ -2570,6 +2580,9 @@ handle_raise_or_lower (MetaDisplay *display, 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); if (screen == NULL) 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 handle_workspace_switch (MetaDisplay *display, MetaWindow *window, diff --git a/src/metacity.schemas.in b/src/metacity.schemas.in index 982964c15..9031733ff 100644 --- a/src/metacity.schemas.in +++ b/src/metacity.schemas.in @@ -717,6 +717,53 @@ you set + + /schemas/apps/metacity/window_keybindings/raise + /apps/metacity/window_keybindings/raise + metacity + string + + + Raise window above other windows + + This keybinding raises the window above other windows. + + 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. + + + + + + /schemas/apps/metacity/window_keybindings/lower + /apps/metacity/window_keybindings/lower + metacity + string + + + Lower window below other windows + + This keybinding lowers a window below other windows. + + 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. + + + + + diff --git a/src/prefs.c b/src/prefs.c index 9a9b59f2a..631464598 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -897,6 +897,8 @@ static MetaKeyPref window_bindings[] = { { META_KEYBINDING_MOVE_WORKSPACE_UP, 0, 0 }, { META_KEYBINDING_MOVE_WORKSPACE_DOWN, 0, 0 }, { META_KEYBINDING_RAISE_OR_LOWER, 0, 0 }, + { META_KEYBINDING_RAISE, 0, 0 }, + { META_KEYBINDING_LOWER, 0, 0 }, { NULL, 0, 0 } }; diff --git a/src/prefs.h b/src/prefs.h index c6cc0d035..1658cd96f 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -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_DOWN "move_to_workspace_down" #define META_KEYBINDING_RAISE_OR_LOWER "raise_or_lower" +#define META_KEYBINDING_RAISE "raise" +#define META_KEYBINDING_LOWER "lower" typedef enum _MetaKeyBindingAction { diff --git a/src/window.c b/src/window.c index 5a8846fa9..49faa2444 100644 --- a/src/window.c +++ b/src/window.c @@ -5284,11 +5284,20 @@ recalc_window_features (MetaWindow *window) window->size_hints.min_height == window->size_hints.max_height) 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) { window->has_maximize_func = FALSE; - window->has_fullscreen_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; } /* no shading if not decorated */