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.
This commit is contained in:
Havoc Pennington 2002-07-03 02:32:40 +00:00 committed by Havoc Pennington
parent 1db28d3b3f
commit d826e620a9
5 changed files with 109 additions and 17 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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:

View File

@ -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)

View File

@ -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);