summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-07-03 02:32:40 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-07-03 02:32:40 +0000
commitd826e620a9719527c535aa6c5e5d11ebeaa0afd5 (patch)
tree77f284adfe4549efb71adb7dbd105db09812e350
parent1db28d3b3fbf93abc54477d82270471f180057fd (diff)
downloadmetacity-d826e620a9719527c535aa6c5e5d11ebeaa0afd5.tar.gz
metacity-d826e620a9719527c535aa6c5e5d11ebeaa0afd5.tar.bz2
use new macros to get whether we allow move/resize correct
2002-07-02 Havoc Pennington <hp@pobox.com> * src/window.c (meta_window_show_menu): use new macros to get whether we allow move/resize correct * src/frame.c (meta_frame_get_flags): use new macros to get whether we can move/resize correct, considering maximized/fullscreen for the move case. * src/window.h (META_WINDOW_ALLOWS_RESIZE, META_WINDOW_ALLOWS_MOVE): new macros * src/keybindings.c (process_keyboard_resize_grab): finish the right/left resize, patch from Jayaraj #78179. Has the same old move/resize bug, if it hits a constraint it starts to break because we move without resizing.
-rw-r--r--ChangeLog18
-rw-r--r--src/frame.c19
-rw-r--r--src/keybindings.c77
-rw-r--r--src/window.c4
-rw-r--r--src/window.h8
5 files changed, 109 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index b19561d..3cf804f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2002-07-02 Havoc Pennington <hp@pobox.com>
+
+ * src/window.c (meta_window_show_menu): use new macros to get
+ whether we allow move/resize correct
+
+ * src/frame.c (meta_frame_get_flags): use new macros to get
+ whether we can move/resize correct, considering
+ maximized/fullscreen for the move case.
+
+ * src/window.h (META_WINDOW_ALLOWS_RESIZE,
+ META_WINDOW_ALLOWS_MOVE): new macros
+
+ * src/keybindings.c (process_keyboard_resize_grab): finish the
+ right/left resize, patch from Jayaraj #78179.
+
+ Has the same old move/resize bug, if it hits a constraint it
+ starts to break because we move without resizing.
+
2002-07-02 Mark McLoughlin <mark@skynet.ie>
* src/keybindings.c:
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);