rearrange this function a bit, so that we return CONTROL_TITLE for

2002-12-01  Havoc Pennington  <hp@pobox.com>

	* src/frames.c (get_control): rearrange this function a bit, so
	that we return CONTROL_TITLE for anything above the bottom of the
	titlebar, in the fallback case where no other control was found.
	Also, don't return RESIZE_N for title rect above the top resize
	size, unless the window is resizable.
	(meta_frames_button_press_event): only start a move when clicking
	control TITLE, not control NONE. This way you don't start moving
	a nonresizable window if you click its edges.
This commit is contained in:
Havoc Pennington 2002-12-02 01:34:27 +00:00 committed by Havoc Pennington
parent 214bcceaea
commit cef58f676d
2 changed files with 91 additions and 80 deletions

View File

@ -1,3 +1,14 @@
2002-12-01 Havoc Pennington <hp@pobox.com>
* src/frames.c (get_control): rearrange this function a bit, so
that we return CONTROL_TITLE for anything above the bottom of the
titlebar, in the fallback case where no other control was found.
Also, don't return RESIZE_N for title rect above the top resize
size, unless the window is resizable.
(meta_frames_button_press_event): only start a move when clicking
control TITLE, not control NONE. This way you don't start moving
a nonresizable window if you click its edges.
2002-12-01 Havoc Pennington <hp@pobox.com> 2002-12-01 Havoc Pennington <hp@pobox.com>
* src/tools/Makefile.am: conditionalize building the config dialog * src/tools/Makefile.am: conditionalize building the config dialog

View File

@ -1230,8 +1230,7 @@ meta_frames_button_press_event (GtkWidget *widget,
event->x_root, event->x_root,
event->y_root); event->y_root);
} }
else if ((control == META_FRAME_CONTROL_TITLE || else if (control == META_FRAME_CONTROL_TITLE &&
control == META_FRAME_CONTROL_NONE) &&
event->button == 1) event->button == 1)
{ {
MetaFrameFlags flags; MetaFrameFlags flags;
@ -1856,14 +1855,17 @@ get_control (MetaFrames *frames,
MetaFrameFlags flags; MetaFrameFlags flags;
gboolean has_vert, has_horiz; gboolean has_vert, has_horiz;
GdkRectangle client; GdkRectangle client;
int bottom_of_titlebar;
meta_frames_calc_geometry (frames, frame, &fgeom); meta_frames_calc_geometry (frames, frame, &fgeom);
client.x = fgeom.left_width; client.x = fgeom.left_width;
client.y = fgeom.top_height; client.y = fgeom.top_height;
client.width = fgeom.width - fgeom.left_width - fgeom.right_width; client.width = fgeom.width - fgeom.left_width - fgeom.right_width;
client.height = fgeom.height - fgeom.top_height - fgeom.bottom_height; client.height = fgeom.height - fgeom.top_height - fgeom.bottom_height;
bottom_of_titlebar = fgeom.title_rect.y + fgeom.title_rect.height;
if (POINT_IN_RECT (x, y, client)) if (POINT_IN_RECT (x, y, client))
return META_FRAME_CONTROL_CLIENT_AREA; return META_FRAME_CONTROL_CLIENT_AREA;
@ -1875,16 +1877,19 @@ get_control (MetaFrames *frames,
if (POINT_IN_RECT (x, y, fgeom.menu_rect)) if (POINT_IN_RECT (x, y, fgeom.menu_rect))
return META_FRAME_CONTROL_MENU; return META_FRAME_CONTROL_MENU;
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0;
has_horiz = (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) != 0;
if (POINT_IN_RECT (x, y, fgeom.title_rect)) if (POINT_IN_RECT (x, y, fgeom.title_rect))
{ {
if (y <= TOP_RESIZE_HEIGHT) if (has_vert && y <= TOP_RESIZE_HEIGHT)
return META_FRAME_CONTROL_RESIZE_N; return META_FRAME_CONTROL_RESIZE_N;
else else
return META_FRAME_CONTROL_TITLE; return META_FRAME_CONTROL_TITLE;
} }
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
if (POINT_IN_RECT (x, y, fgeom.max_rect)) if (POINT_IN_RECT (x, y, fgeom.max_rect))
{ {
@ -1893,83 +1898,78 @@ get_control (MetaFrames *frames,
else else
return META_FRAME_CONTROL_MAXIMIZE; return META_FRAME_CONTROL_MAXIMIZE;
} }
has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0;
has_horiz = (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) != 0;
if (has_vert || has_horiz)
{
int bottom_of_titlebar;
bottom_of_titlebar = fgeom.title_rect.y + fgeom.title_rect.height;
/* South resize always has priority over north resize, /* South resize always has priority over north resize,
* in case of overlap. * in case of overlap.
*/ */
if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) && if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
x >= (fgeom.width - fgeom.right_width - RESIZE_EXTENDS)) x >= (fgeom.width - fgeom.right_width - RESIZE_EXTENDS))
{ {
if (has_vert && has_horiz) if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_SE; return META_FRAME_CONTROL_RESIZE_SE;
else if (has_vert) else if (has_vert)
return META_FRAME_CONTROL_RESIZE_S; return META_FRAME_CONTROL_RESIZE_S;
else else if (has_horiz)
return META_FRAME_CONTROL_RESIZE_E; 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.top_height + RESIZE_EXTENDS) &&
x < RESIZE_EXTENDS)
{
if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_NW;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y < (fgeom.top_height + RESIZE_EXTENDS) &&
x >= (fgeom.width - RESIZE_EXTENDS))
{
if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_NE;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else
return META_FRAME_CONTROL_RESIZE_E;
}
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS))
{
if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
}
else if (y <= TOP_RESIZE_HEIGHT)
{
if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
}
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;
}
} }
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
return META_FRAME_CONTROL_NONE; 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 if (has_horiz)
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y < (fgeom.top_height + RESIZE_EXTENDS) &&
x < RESIZE_EXTENDS)
{
if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_NW;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else if (has_horiz)
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y < (fgeom.top_height + RESIZE_EXTENDS) &&
x >= (fgeom.width - RESIZE_EXTENDS))
{
if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_NE;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else if (has_horiz)
return META_FRAME_CONTROL_RESIZE_E;
}
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS))
{
if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
}
else if (y <= TOP_RESIZE_HEIGHT)
{
if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else if (has_horiz)
return META_FRAME_CONTROL_TITLE;
}
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;
}
if (y >= bottom_of_titlebar)
return META_FRAME_CONTROL_NONE;
else
return META_FRAME_CONTROL_TITLE;
} }
void void