This commit is contained in:
rhp 2001-07-03 01:45:43 +00:00
parent 43f807c5e1
commit 7d79a37c9d
6 changed files with 391 additions and 140 deletions

View File

@ -28,18 +28,19 @@
typedef enum typedef enum
{ {
META_FRAME_ALLOWS_DELETE = 1 << 0, META_FRAME_ALLOWS_DELETE = 1 << 0,
META_FRAME_ALLOWS_MENU = 1 << 1, META_FRAME_ALLOWS_MENU = 1 << 1,
META_FRAME_ALLOWS_MINIMIZE = 1 << 2, META_FRAME_ALLOWS_MINIMIZE = 1 << 2,
META_FRAME_ALLOWS_MAXIMIZE = 1 << 3, META_FRAME_ALLOWS_MAXIMIZE = 1 << 3,
META_FRAME_ALLOWS_RESIZE = 1 << 4, META_FRAME_ALLOWS_VERTICAL_RESIZE = 1 << 4,
META_FRAME_TRANSIENT = 1 << 5, META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 5,
META_FRAME_HAS_FOCUS = 1 << 6, META_FRAME_TRANSIENT = 1 << 6,
META_FRAME_SHADED = 1 << 7, META_FRAME_HAS_FOCUS = 1 << 7,
META_FRAME_STUCK = 1 << 8, META_FRAME_SHADED = 1 << 8,
META_FRAME_MAXIMIZED = 1 << 9, META_FRAME_STUCK = 1 << 9,
META_FRAME_ALLOWS_SHADE = 1 << 10, META_FRAME_MAXIMIZED = 1 << 10,
META_FRAME_ALLOWS_MOVE = 1 << 11 META_FRAME_ALLOWS_SHADE = 1 << 11,
META_FRAME_ALLOWS_MOVE = 1 << 12
} MetaFrameFlags; } MetaFrameFlags;
typedef enum typedef enum

View File

@ -183,7 +183,15 @@ meta_frame_get_flags (MetaFrame *frame)
flags |= META_FRAME_ALLOWS_MOVE; flags |= META_FRAME_ALLOWS_MOVE;
if (frame->window->has_resize_func) if (frame->window->has_resize_func)
flags |= META_FRAME_ALLOWS_RESIZE; {
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 (frame->window->has_focus) if (frame->window->has_focus)
flags |= META_FRAME_HAS_FOCUS; flags |= META_FRAME_HAS_FOCUS;

View File

@ -90,41 +90,44 @@ static void meta_frames_destroy (GtkObject *object);
static void meta_frames_finalize (GObject *object); static void meta_frames_finalize (GObject *object);
static void meta_frames_style_set (GtkWidget *widget, static void meta_frames_style_set (GtkWidget *widget,
GtkStyle *prev_style); GtkStyle *prev_style);
static void meta_frames_realize (GtkWidget *widget);
static void meta_frames_unrealize (GtkWidget *widget);
static gboolean meta_frames_button_press_event (GtkWidget *widget,
GdkEventButton *event);
static gboolean meta_frames_button_release_event (GtkWidget *widget,
GdkEventButton *event);
static gboolean meta_frames_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event);
static gboolean meta_frames_destroy_event (GtkWidget *widget,
GdkEventAny *event);
static gboolean meta_frames_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static gboolean meta_frames_key_press_event (GtkWidget *widget,
GdkEventKey *event);
static gboolean meta_frames_key_release_event (GtkWidget *widget,
GdkEventKey *event);
static gboolean meta_frames_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean meta_frames_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean meta_frames_configure_event (GtkWidget *widget,
GdkEventConfigure *event);
static gboolean meta_frames_focus_in_event (GtkWidget *widget,
GdkEventFocus *event);
static gboolean meta_frames_focus_out_event (GtkWidget *widget,
GdkEventFocus *event);
static gboolean meta_frames_map_event (GtkWidget *widget,
GdkEventAny *event);
static gboolean meta_frames_unmap_event (GtkWidget *widget,
GdkEventAny *event);
static gboolean meta_frames_property_notify_event (GtkWidget *widget,
GdkEventProperty *event);
static gboolean meta_frames_client_event (GtkWidget *widget,
GdkEventClient *event);
static gboolean meta_frames_window_state_event (GtkWidget *widget,
GdkEventWindowState *event);
gboolean meta_frames_button_press_event (GtkWidget *widget,
GdkEventButton *event);
gboolean meta_frames_button_release_event (GtkWidget *widget,
GdkEventButton *event);
gboolean meta_frames_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event);
gboolean meta_frames_destroy_event (GtkWidget *widget,
GdkEventAny *event);
gboolean meta_frames_expose_event (GtkWidget *widget,
GdkEventExpose *event);
gboolean meta_frames_key_press_event (GtkWidget *widget,
GdkEventKey *event);
gboolean meta_frames_key_release_event (GtkWidget *widget,
GdkEventKey *event);
gboolean meta_frames_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
gboolean meta_frames_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
gboolean meta_frames_configure_event (GtkWidget *widget,
GdkEventConfigure *event);
gboolean meta_frames_focus_in_event (GtkWidget *widget,
GdkEventFocus *event);
gboolean meta_frames_focus_out_event (GtkWidget *widget,
GdkEventFocus *event);
gboolean meta_frames_map_event (GtkWidget *widget,
GdkEventAny *event);
gboolean meta_frames_unmap_event (GtkWidget *widget,
GdkEventAny *event);
gboolean meta_frames_property_notify_event (GtkWidget *widget,
GdkEventProperty *event);
gboolean meta_frames_client_event (GtkWidget *widget,
GdkEventClient *event);
gboolean meta_frames_window_state_event (GtkWidget *widget,
GdkEventWindowState *event);
static void meta_frames_calc_geometry (MetaFrames *frames, static void meta_frames_calc_geometry (MetaFrames *frames,
@ -226,6 +229,9 @@ meta_frames_class_init (MetaFramesClass *class)
widget_class->style_set = meta_frames_style_set; widget_class->style_set = meta_frames_style_set;
widget_class->realize = meta_frames_realize;
widget_class->unrealize = meta_frames_unrealize;
widget_class->expose_event = meta_frames_expose_event; widget_class->expose_event = meta_frames_expose_event;
widget_class->unmap_event = meta_frames_unmap_event; widget_class->unmap_event = meta_frames_unmap_event;
widget_class->destroy_event = meta_frames_destroy_event; widget_class->destroy_event = meta_frames_destroy_event;
@ -765,6 +771,46 @@ meta_frames_unmanage_window (MetaFrames *frames,
meta_warning ("Frame 0x%lx not managed, can't unmanage\n", xwindow); meta_warning ("Frame 0x%lx not managed, can't unmanage\n", xwindow);
} }
static void
meta_frames_realize (GtkWidget *widget)
{
MetaFrames *frames;
frames = META_FRAMES (widget);
frames->south_resize_cursor = gdk_cursor_new (GDK_BOTTOM_SIDE);
frames->east_resize_cursor = gdk_cursor_new (GDK_RIGHT_SIDE);
frames->west_resize_cursor = gdk_cursor_new (GDK_LEFT_SIDE);
frames->se_resize_cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER);
frames->sw_resize_cursor = gdk_cursor_new (GDK_BOTTOM_LEFT_CORNER);
if (GTK_WIDGET_CLASS (parent_class)->realize)
GTK_WIDGET_CLASS (parent_class)->realize (widget);
}
static void
meta_frames_unrealize (GtkWidget *widget)
{
MetaFrames *frames;
frames = META_FRAMES (widget);
gdk_cursor_unref (frames->south_resize_cursor);
gdk_cursor_unref (frames->east_resize_cursor);
gdk_cursor_unref (frames->west_resize_cursor);
gdk_cursor_unref (frames->se_resize_cursor);
gdk_cursor_unref (frames->sw_resize_cursor);
frames->south_resize_cursor = NULL;
frames->east_resize_cursor = NULL;
frames->west_resize_cursor = NULL;
frames->se_resize_cursor = NULL;
frames->sw_resize_cursor = NULL;
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
static MetaUIFrame* static MetaUIFrame*
meta_frames_lookup_window (MetaFrames *frames, meta_frames_lookup_window (MetaFrames *frames,
Window xwindow) Window xwindow)
@ -968,6 +1014,44 @@ clear_tip (MetaFrames *frames)
meta_fixed_tip_hide (); meta_fixed_tip_hide ();
} }
static GdkCursor*
cursor_for_resize (MetaFrames *frames,
MetaFrameStatus status)
{
GdkCursor *cursor;
cursor = NULL;
switch (status)
{
case META_FRAME_STATUS_RESIZING_E:
cursor = frames->east_resize_cursor;
break;
case META_FRAME_STATUS_RESIZING_W:
cursor = frames->west_resize_cursor;
break;
case META_FRAME_STATUS_RESIZING_S:
cursor = frames->south_resize_cursor;
break;
case META_FRAME_STATUS_RESIZING_SE:
cursor = frames->se_resize_cursor;
break;
case META_FRAME_STATUS_RESIZING_SW:
cursor = frames->sw_resize_cursor;
break;
case META_FRAME_STATUS_RESIZING_N:
case META_FRAME_STATUS_RESIZING_NE:
case META_FRAME_STATUS_RESIZING_NW:
break;
default:
g_assert_not_reached ();
break;
}
return cursor;
}
static void static void
meta_frames_begin_grab (MetaFrames *frames, meta_frames_begin_grab (MetaFrames *frames,
MetaUIFrame *frame, MetaUIFrame *frame,
@ -981,17 +1065,52 @@ meta_frames_begin_grab (MetaFrames *frames,
int start_window_h, int start_window_h,
guint32 timestamp) guint32 timestamp)
{ {
GdkCursor *cursor;
g_return_if_fail (frames->grab_frame == NULL); g_return_if_fail (frames->grab_frame == NULL);
clear_tip (frames); clear_tip (frames);
cursor = NULL;
switch (status)
{
case META_FRAME_STATUS_MOVING:
break;
case META_FRAME_STATUS_RESIZING_E:
case META_FRAME_STATUS_RESIZING_W:
case META_FRAME_STATUS_RESIZING_S:
case META_FRAME_STATUS_RESIZING_SE:
case META_FRAME_STATUS_RESIZING_SW:
case META_FRAME_STATUS_RESIZING_N:
case META_FRAME_STATUS_RESIZING_NE:
case META_FRAME_STATUS_RESIZING_NW:
cursor = cursor_for_resize (frames, status);
break;
case META_FRAME_STATUS_CLICKING_MINIMIZE:
break;
case META_FRAME_STATUS_CLICKING_MAXIMIZE:
break;
case META_FRAME_STATUS_CLICKING_DELETE:
break;
case META_FRAME_STATUS_CLICKING_MENU:
break;
case META_FRAME_STATUS_NORMAL:
break;
}
/* This grab isn't needed I don't think */ /* This grab isn't needed I don't think */
if (gdk_pointer_grab (frame->window, if (gdk_pointer_grab (frame->window,
FALSE, FALSE,
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_MASK, GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_MASK,
NULL, NULL,
NULL, cursor,
timestamp) == GDK_GRAB_SUCCESS) timestamp) == GDK_GRAB_SUCCESS)
{ {
frames->grab_frame = frame; frames->grab_frame = frame;
@ -1171,7 +1290,7 @@ point_in_control (MetaFrames *frames,
return control == get_control (frames, frame, x, y); return control == get_control (frames, frame, x, y);
} }
gboolean static gboolean
meta_frames_button_press_event (GtkWidget *widget, meta_frames_button_press_event (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
{ {
@ -1285,65 +1404,58 @@ meta_frames_button_press_event (GtkWidget *widget,
control == META_FRAME_CONTROL_RESIZE_E || control == META_FRAME_CONTROL_RESIZE_E ||
control == META_FRAME_CONTROL_RESIZE_W)) control == META_FRAME_CONTROL_RESIZE_W))
{ {
MetaFrameFlags flags; int w, h, x, y;
MetaFrameStatus status;
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); meta_core_get_size (gdk_display,
frame->xwindow,
&w, &h);
if (flags & META_FRAME_ALLOWS_RESIZE) meta_core_get_position (gdk_display,
{
int w, h, x, y;
MetaFrameStatus status;
meta_core_get_size (gdk_display,
frame->xwindow, frame->xwindow,
&w, &h); &x, &y);
meta_core_get_position (gdk_display, status = META_FRAME_STATUS_NORMAL;
frame->xwindow,
&x, &y);
status = META_FRAME_STATUS_NORMAL; switch (control)
{
switch (control) case META_FRAME_CONTROL_RESIZE_SE:
{ status = META_FRAME_STATUS_RESIZING_SE;
case META_FRAME_CONTROL_RESIZE_SE: break;
status = META_FRAME_STATUS_RESIZING_SE; case META_FRAME_CONTROL_RESIZE_S:
break; status = META_FRAME_STATUS_RESIZING_S;
case META_FRAME_CONTROL_RESIZE_S: break;
status = META_FRAME_STATUS_RESIZING_S; case META_FRAME_CONTROL_RESIZE_SW:
break; status = META_FRAME_STATUS_RESIZING_SW;
case META_FRAME_CONTROL_RESIZE_SW: break;
status = META_FRAME_STATUS_RESIZING_SW; case META_FRAME_CONTROL_RESIZE_NE:
break; status = META_FRAME_STATUS_RESIZING_NE;
case META_FRAME_CONTROL_RESIZE_NE: break;
status = META_FRAME_STATUS_RESIZING_NE; case META_FRAME_CONTROL_RESIZE_N:
break; status = META_FRAME_STATUS_RESIZING_N;
case META_FRAME_CONTROL_RESIZE_N: break;
status = META_FRAME_STATUS_RESIZING_N; case META_FRAME_CONTROL_RESIZE_NW:
break; status = META_FRAME_STATUS_RESIZING_NW;
case META_FRAME_CONTROL_RESIZE_NW: break;
status = META_FRAME_STATUS_RESIZING_NW; case META_FRAME_CONTROL_RESIZE_E:
break; status = META_FRAME_STATUS_RESIZING_E;
case META_FRAME_CONTROL_RESIZE_E: break;
status = META_FRAME_STATUS_RESIZING_E; case META_FRAME_CONTROL_RESIZE_W:
break; status = META_FRAME_STATUS_RESIZING_W;
case META_FRAME_CONTROL_RESIZE_W: break;
status = META_FRAME_STATUS_RESIZING_W; default:
break; g_assert_not_reached ();
default: break;
g_assert_not_reached ();
break;
}
meta_frames_begin_grab (frames, frame,
status,
event->button,
event->x_root,
event->y_root,
x, y,
w, h,
event->time);
} }
meta_frames_begin_grab (frames, frame,
status,
event->button,
event->x_root,
event->y_root,
x, y,
w, h,
event->time);
} }
else if (((control == META_FRAME_CONTROL_TITLE || else if (((control == META_FRAME_CONTROL_TITLE ||
control == META_FRAME_CONTROL_NONE) && control == META_FRAME_CONTROL_NONE) &&
@ -1390,7 +1502,7 @@ meta_frames_notify_menu_hide (MetaFrames *frames)
} }
} }
gboolean static gboolean
meta_frames_button_release_event (GtkWidget *widget, meta_frames_button_release_event (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
{ {
@ -1478,7 +1590,7 @@ meta_frames_button_release_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_motion_notify_event (GtkWidget *widget, meta_frames_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event) GdkEventMotion *event)
{ {
@ -1525,14 +1637,69 @@ meta_frames_motion_notify_event (GtkWidget *widget,
case META_FRAME_STATUS_CLICKING_MAXIMIZE: case META_FRAME_STATUS_CLICKING_MAXIMIZE:
break; break;
case META_FRAME_STATUS_NORMAL: case META_FRAME_STATUS_NORMAL:
queue_tip (frames); {
MetaFrameControl control;
GdkCursor *cursor;
int x, y;
gdk_window_get_pointer (frame->window, &x, &y, NULL);
control = get_control (frames, frame, x, y);
cursor = NULL;
switch (control)
{
case META_FRAME_CONTROL_NONE:
break;
case META_FRAME_CONTROL_TITLE:
break;
case META_FRAME_CONTROL_DELETE:
break;
case META_FRAME_CONTROL_MENU:
break;
case META_FRAME_CONTROL_MINIMIZE:
break;
case META_FRAME_CONTROL_MAXIMIZE:
break;
case META_FRAME_CONTROL_RESIZE_SE:
cursor = frames->se_resize_cursor;
break;
case META_FRAME_CONTROL_RESIZE_S:
cursor = frames->south_resize_cursor;
break;
case META_FRAME_CONTROL_RESIZE_SW:
cursor = frames->sw_resize_cursor;
break;
case META_FRAME_CONTROL_RESIZE_N:
break;
case META_FRAME_CONTROL_RESIZE_NE:
break;
case META_FRAME_CONTROL_RESIZE_NW:
break;
case META_FRAME_CONTROL_RESIZE_W:
cursor = frames->west_resize_cursor;
break;
case META_FRAME_CONTROL_RESIZE_E:
cursor = frames->east_resize_cursor;
break;
}
if (cursor != frames->current_cursor)
{
gdk_window_set_cursor (frame->window, cursor);
frames->current_cursor = cursor;
}
queue_tip (frames);
}
break; break;
} }
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_destroy_event (GtkWidget *widget, meta_frames_destroy_event (GtkWidget *widget,
GdkEventAny *event) GdkEventAny *event)
{ {
@ -1726,7 +1893,7 @@ draw_control_bg (MetaFrames *frames,
} }
} }
gboolean static gboolean
meta_frames_expose_event (GtkWidget *widget, meta_frames_expose_event (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
{ {
@ -1905,7 +2072,7 @@ meta_frames_expose_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_key_press_event (GtkWidget *widget, meta_frames_key_press_event (GtkWidget *widget,
GdkEventKey *event) GdkEventKey *event)
{ {
@ -1921,7 +2088,7 @@ meta_frames_key_press_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_key_release_event (GtkWidget *widget, meta_frames_key_release_event (GtkWidget *widget,
GdkEventKey *event) GdkEventKey *event)
{ {
@ -1937,7 +2104,7 @@ meta_frames_key_release_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_enter_notify_event (GtkWidget *widget, meta_frames_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event) GdkEventCrossing *event)
{ {
@ -1953,7 +2120,7 @@ meta_frames_enter_notify_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_leave_notify_event (GtkWidget *widget, meta_frames_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event) GdkEventCrossing *event)
{ {
@ -1966,10 +2133,16 @@ meta_frames_leave_notify_event (GtkWidget *widget,
if (frame == NULL) if (frame == NULL)
return FALSE; return FALSE;
if (frames->current_cursor)
{
gdk_window_set_cursor (frame->window, NULL);
frames->current_cursor = NULL;
}
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_configure_event (GtkWidget *widget, meta_frames_configure_event (GtkWidget *widget,
GdkEventConfigure *event) GdkEventConfigure *event)
{ {
@ -1985,7 +2158,7 @@ meta_frames_configure_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_focus_in_event (GtkWidget *widget, meta_frames_focus_in_event (GtkWidget *widget,
GdkEventFocus *event) GdkEventFocus *event)
{ {
@ -2001,7 +2174,7 @@ meta_frames_focus_in_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_focus_out_event (GtkWidget *widget, meta_frames_focus_out_event (GtkWidget *widget,
GdkEventFocus *event) GdkEventFocus *event)
{ {
@ -2017,7 +2190,7 @@ meta_frames_focus_out_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_map_event (GtkWidget *widget, meta_frames_map_event (GtkWidget *widget,
GdkEventAny *event) GdkEventAny *event)
{ {
@ -2033,7 +2206,7 @@ meta_frames_map_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_unmap_event (GtkWidget *widget, meta_frames_unmap_event (GtkWidget *widget,
GdkEventAny *event) GdkEventAny *event)
{ {
@ -2052,7 +2225,7 @@ meta_frames_unmap_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_property_notify_event (GtkWidget *widget, meta_frames_property_notify_event (GtkWidget *widget,
GdkEventProperty *event) GdkEventProperty *event)
{ {
@ -2068,7 +2241,7 @@ meta_frames_property_notify_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_client_event (GtkWidget *widget, meta_frames_client_event (GtkWidget *widget,
GdkEventClient *event) GdkEventClient *event)
{ {
@ -2084,7 +2257,7 @@ meta_frames_client_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
gboolean static gboolean
meta_frames_window_state_event (GtkWidget *widget, meta_frames_window_state_event (GtkWidget *widget,
GdkEventWindowState *event) GdkEventWindowState *event)
{ {
@ -2163,9 +2336,20 @@ get_control (MetaFrames *frames,
int x, int y) int x, int y)
{ {
MetaFrameGeometry fgeom; MetaFrameGeometry fgeom;
MetaFrameFlags flags;
gboolean has_vert, has_horiz;
GdkRectangle client;
meta_frames_calc_geometry (frames, frame, &fgeom); meta_frames_calc_geometry (frames, frame, &fgeom);
client.x = fgeom.left_width;
client.y = fgeom.top_height;
client.width = fgeom.width - fgeom.left_width - fgeom.right_width;
client.height = fgeom.height - fgeom.top_height - fgeom.bottom_height;
if (POINT_IN_RECT (x, y, client))
return META_FRAME_CONTROL_NONE;
if (POINT_IN_RECT (x, y, fgeom.close_rect)) if (POINT_IN_RECT (x, y, fgeom.close_rect))
return META_FRAME_CONTROL_DELETE; return META_FRAME_CONTROL_DELETE;
@ -2181,18 +2365,49 @@ get_control (MetaFrames *frames,
if (POINT_IN_RECT (x, y, fgeom.title_rect)) if (POINT_IN_RECT (x, y, fgeom.title_rect))
return META_FRAME_CONTROL_TITLE; return META_FRAME_CONTROL_TITLE;
if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) && flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
x >= (fgeom.width - fgeom.right_width - RESIZE_EXTENDS))
return META_FRAME_CONTROL_RESIZE_SE; has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0;
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) && has_horiz = (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) != 0;
x <= (fgeom.left_width + RESIZE_EXTENDS))
return META_FRAME_CONTROL_RESIZE_SW; if (has_vert || has_horiz)
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS)) {
return META_FRAME_CONTROL_RESIZE_S; if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
else if (x <= fgeom.left_width) x >= (fgeom.width - fgeom.right_width - RESIZE_EXTENDS))
return META_FRAME_CONTROL_RESIZE_W; {
else if (x >= (fgeom.width - fgeom.right_width)) if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_E; return META_FRAME_CONTROL_RESIZE_SE;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
else
return META_FRAME_CONTROL_RESIZE_E;
}
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
x <= (fgeom.left_width + RESIZE_EXTENDS))
{
if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_SW;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
else
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS))
{
if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
}
else if (x <= fgeom.left_width)
{
if (has_horiz)
return META_FRAME_CONTROL_RESIZE_W;
}
else if (x >= (fgeom.width - fgeom.right_width))
{
if (has_horiz)
return META_FRAME_CONTROL_RESIZE_E;
}
}
return META_FRAME_CONTROL_NONE; return META_FRAME_CONTROL_NONE;
} }

View File

@ -100,6 +100,14 @@ struct _MetaFrames
guint tooltip_timeout; guint tooltip_timeout;
MetaUIFrame *last_motion_frame; MetaUIFrame *last_motion_frame;
GdkCursor *south_resize_cursor;
GdkCursor *west_resize_cursor;
GdkCursor *east_resize_cursor;
GdkCursor *se_resize_cursor;
GdkCursor *sw_resize_cursor;
GdkCursor *current_cursor;
/* The below is all for grabs */ /* The below is all for grabs */
MetaFrameStatus grab_status; MetaFrameStatus grab_status;
MetaUIFrame *grab_frame; MetaUIFrame *grab_frame;

View File

@ -6,7 +6,7 @@ fi
if test "$DEBUG" = none; then if test "$DEBUG" = none; then
DEBUG= DEBUG=
elif test -z "$DEBUG"; then elif test -z "$DEBUG"; then
DEBUG=gdb DEBUG=
fi fi
if test -z "$CLIENTS"; then if test -z "$CLIENTS"; then
@ -14,8 +14,8 @@ if test -z "$CLIENTS"; then
fi fi
if test -z "$ONLY_WM"; then if test -z "$ONLY_WM"; then
Xnest -ac :1 -scrns $SCREENS -geometry 640x480 -bw 15 & Xnest -ac :1 -scrns $SCREENS -geometry 640x600 -bw 15 &
usleep 50000 usleep 100000
if test $CLIENTS != 0; then if test $CLIENTS != 0; then
for I in `seq 1 $CLIENTS`; do for I in `seq 1 $CLIENTS`; do
@ -23,7 +23,7 @@ if test -z "$ONLY_WM"; then
done done
fi fi
usleep 5000 usleep 50000
DISPLAY=:1 xsetroot -solid royalblue3 DISPLAY=:1 xsetroot -solid royalblue3
fi fi

View File

@ -1075,7 +1075,6 @@ meta_window_move_resize_internal (MetaWindow *window,
int pos_dy; int pos_dy;
int frame_size_dx; int frame_size_dx;
int frame_size_dy; int frame_size_dy;
int client_gravity;
{ {
int oldx, oldy; int oldx, oldy;
@ -2116,6 +2115,26 @@ update_size_hints (MetaWindow *window)
window->size_hints.flags |= PMaxSize; window->size_hints.flags |= PMaxSize;
} }
if (window->size_hints.max_width < window->size_hints.min_width)
{
/* someone is on crack */
meta_warning (_("Window %s sets max width %d less than min width %d, disabling resize\n"),
window->desc,
window->size_hints.max_width,
window->size_hints.min_width);
window->size_hints.max_width = window->size_hints.min_width;
}
if (window->size_hints.max_height < window->size_hints.min_height)
{
/* another cracksmoker */
meta_warning (_("Window %s sets max height %d less than min height %d, disabling resize\n"),
window->desc,
window->size_hints.max_height,
window->size_hints.min_height);
window->size_hints.max_height = window->size_hints.min_height;
}
if (window->size_hints.flags & PResizeInc) if (window->size_hints.flags & PResizeInc)
{ {
meta_verbose ("Window %s sets resize width inc: %d height inc: %d\n", meta_verbose ("Window %s sets resize width inc: %d height inc: %d\n",