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>
* 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->y_root);
}
else if ((control == META_FRAME_CONTROL_TITLE ||
control == META_FRAME_CONTROL_NONE) &&
else if (control == META_FRAME_CONTROL_TITLE &&
event->button == 1)
{
MetaFrameFlags flags;
@ -1856,6 +1855,7 @@ get_control (MetaFrames *frames,
MetaFrameFlags flags;
gboolean has_vert, has_horiz;
GdkRectangle client;
int bottom_of_titlebar;
meta_frames_calc_geometry (frames, frame, &fgeom);
@ -1864,6 +1864,8 @@ get_control (MetaFrames *frames,
client.width = fgeom.width - fgeom.left_width - fgeom.right_width;
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))
return META_FRAME_CONTROL_CLIENT_AREA;
@ -1876,16 +1878,19 @@ get_control (MetaFrames *frames,
if (POINT_IN_RECT (x, y, fgeom.menu_rect))
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 (y <= TOP_RESIZE_HEIGHT)
if (has_vert && y <= TOP_RESIZE_HEIGHT)
return META_FRAME_CONTROL_RESIZE_N;
else
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 (flags & META_FRAME_MAXIMIZED)
@ -1894,15 +1899,6 @@ get_control (MetaFrames *frames,
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,
* in case of overlap.
*/
@ -1914,7 +1910,7 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_RESIZE_SE;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
else
else if (has_horiz)
return META_FRAME_CONTROL_RESIZE_E;
}
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
@ -1924,7 +1920,7 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_RESIZE_SW;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
else
else if (has_horiz)
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y < (fgeom.top_height + RESIZE_EXTENDS) &&
@ -1934,7 +1930,7 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_RESIZE_NW;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else
else if (has_horiz)
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y < (fgeom.top_height + RESIZE_EXTENDS) &&
@ -1944,7 +1940,7 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_RESIZE_NE;
else if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else
else if (has_horiz)
return META_FRAME_CONTROL_RESIZE_E;
}
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS))
@ -1956,6 +1952,8 @@ get_control (MetaFrames *frames,
{
if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
else if (has_horiz)
return META_FRAME_CONTROL_TITLE;
}
else if (x <= fgeom.left_width)
{
@ -1967,9 +1965,11 @@ get_control (MetaFrames *frames,
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