summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/frame.c19
-rw-r--r--src/keybindings.c77
-rw-r--r--src/window.c4
-rw-r--r--src/window.h8
4 files changed, 91 insertions, 17 deletions
diff --git a/src/frame.c b/src/frame.c
index 9262880..06e14f1 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -229,21 +229,14 @@ meta_frame_get_flags (MetaFrame *frame)
flags |= META_FRAME_ALLOWS_SHADE;
}
- if (frame->window->has_move_func)
+ if (META_WINDOW_ALLOWS_MOVE (frame->window))
flags |= META_FRAME_ALLOWS_MOVE;
-
- if (frame->window->has_resize_func &&
- !frame->window->maximized &&
- !frame->window->shaded)
- {
- if (frame->window->size_hints.min_width <
- frame->window->size_hints.max_width)
- flags |= META_FRAME_ALLOWS_HORIZONTAL_RESIZE;
- if (frame->window->size_hints.min_height <
- frame->window->size_hints.max_height)
- flags |= META_FRAME_ALLOWS_VERTICAL_RESIZE;
- }
+ if (META_WINDOW_ALLOWS_HORIZONTAL_RESIZE (frame->window))
+ flags |= META_FRAME_ALLOWS_HORIZONTAL_RESIZE;
+
+ if (META_WINDOW_ALLOWS_VERTICAL_RESIZE (frame->window))
+ flags |= META_FRAME_ALLOWS_VERTICAL_RESIZE;
if (frame->window->has_focus)
flags |= META_FRAME_HAS_FOCUS;
diff --git a/src/keybindings.c b/src/keybindings.c
index 957e34c..b343b45 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -1597,11 +1597,84 @@ process_keyboard_resize_grab (MetaDisplay *display,
case XK_Left:
case XK_KP_Left:
- /* FIXME */
+ switch (gravity)
+ {
+ case EastGravity:
+ case SouthEastGravity:
+ case NorthEastGravity:
+ /* Move left edge left */
+ edge = meta_window_find_next_vertical_edge (window, TRUE);
+ x -= width_inc;
+
+ if (smart_snap || ((edge > x) && ABS (edge - x) < width_inc))
+ x = edge;
+
+ width += (orig_x - x);
+ break;
+
+ case WestGravity:
+ case SouthWestGravity:
+ case NorthWestGravity:
+ /* Move right edge left */
+ edge = meta_window_find_next_vertical_edge (window, FALSE);
+ width -= width_inc;
+
+ if (smart_snap || ((edge > (x+width)) &&
+ ABS (edge - (x+width)) < width_inc))
+ width = edge - x;
+
+ handled = TRUE;
+ break;
+
+ case NorthGravity:
+ case SouthGravity:
+ case CenterGravity:
+ g_assert_not_reached ();
+ break;
+ }
+
+ handled = TRUE;
break;
+
case XK_Right:
case XK_KP_Right:
- /* FIXME */
+ switch (gravity)
+ {
+ case EastGravity:
+ case SouthEastGravity:
+ case NorthEastGravity:
+ /* Move left edge right */
+ edge = meta_window_find_next_vertical_edge (window, FALSE);
+ x += width_inc;
+
+ if (smart_snap || ((edge < x) && ABS (edge - x) < width_inc))
+ x = edge;
+
+ width -= (x - orig_x);
+ break;
+
+ case WestGravity:
+ case SouthWestGravity:
+ case NorthWestGravity:
+ /* Move right edge right */
+ edge = meta_window_find_next_vertical_edge (window, TRUE);
+ width += width_inc;
+
+ if (smart_snap || ((edge > (x+width)) &&
+ ABS (edge - (x+width)) < width_inc))
+ width = edge - x;
+
+ handled = TRUE;
+ break;
+
+ case NorthGravity:
+ case SouthGravity:
+ case CenterGravity:
+ g_assert_not_reached ();
+ break;
+ }
+
+ handled = TRUE;
break;
default:
diff --git a/src/window.c b/src/window.c
index 1d8998f..9eccea1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5499,10 +5499,10 @@ meta_window_show_menu (MetaWindow *window,
if (!window->has_shade_func)
insensitive |= META_MENU_OP_SHADE | META_MENU_OP_UNSHADE;
- if (!window->has_move_func)
+ if (!META_WINDOW_ALLOWS_MOVE (window))
insensitive |= META_MENU_OP_MOVE;
- if (!window->has_resize_func)
+ if (!META_WINDOW_ALLOWS_RESIZE (window))
insensitive |= META_MENU_OP_RESIZE;
if (window->always_sticky)
diff --git a/src/window.h b/src/window.h
index 4794677..a3e8df5 100644
--- a/src/window.h
+++ b/src/window.h
@@ -252,6 +252,14 @@ struct _MetaWindow
int dialog_pipe;
};
+#define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->maximized && !(w)->fullscreen)
+#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !(w)->maximized && !(w)->fullscreen && !(w)->shaded)
+#define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \
+ (((w)->size_hints.min_width < (w)->size_hints.max_width) || \
+ ((w)->size_hints.min_height < (w)->size_hints.max_height)))
+#define META_WINDOW_ALLOWS_HORIZONTAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_width < (w)->size_hints.max_width)
+#define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_height < (w)->size_hints.max_height)
+
MetaWindow* meta_window_new (MetaDisplay *display,
Window xwindow,
gboolean must_be_viewable);